Extension SDK 9.0.5

oracle.jdeveloper.audit.service
Class Auditor

java.lang.Object
  extended byoracle.jdeveloper.audit.service.Auditor

public abstract class Auditor
extends java.lang.Object

The executor of an audit over a particular set of constructs using a particular profile. The profile used is set by setProfile(oracle.jdeveloper.audit.service.Profile). The constructs audited are those added to this auditor by addLocation(oracle.jdeveloper.audit.model.Location), addElement(oracle.ide.model.Element, oracle.ide.model.Document, oracle.ide.model.Project, oracle.ide.model.Workspace), and/or addConstruct(java.lang.Object, java.net.URL, oracle.ide.model.Project, oracle.ide.model.Workspace). The audit is executed by run(), which stores the results in a model, accessible through getModel(). When the results are no longer needed, resources held by the auditor (and by the model) are released by clear().

An auditor can be reused: locations to be audited can be added and removed.


Constructor Summary
Auditor()
           
 
Method Summary
abstract  void addAuditListener(AuditListener listener)
          Adds an audit listener to this auditor.
abstract  boolean addConstruct(java.lang.Object construct, java.net.URL document, Project project, Workspace workspace)
          Adds the location corresponding to a construct to the set of locations to be audited.
abstract  boolean addElement(Element element, Document document, Project project, Workspace workspace)
          Adds the location corresponding to an Element to the set of locations to be audited.
abstract  int addElements(Element[] elements, Document document, Project project, Workspace workspace)
          Adds the locations corresponding to an array of Elements to the set of locations to be audited.
protected abstract  void addLocation(Location location)
          Adds a location to the set of locations to be audited.
abstract  void applyDefaultFixes()
          Applies default fixes for any violations found by this auditor.
abstract  void cancel()
          Cancel an executing audit.
abstract  void clear()
          Clears the results and locations from this auditor.
abstract  java.util.SortedSet getLocations()
          Gets the set of locations to be audited.
abstract  AuditModel getModel()
          Gets the model for this audit.
abstract  Profile getProfile()
          Gets the profile for this audit.
abstract  AuditType getType()
          Gets the feature type of this audit.
abstract  boolean isAuditing()
          Gets whether an audit is in progress.
abstract  boolean isVisitAncestors()
          Gets whether to visit ancestors of the locations to be audited.
abstract  boolean isVisitDescendants()
          Gets whether to visit descendants of the locations to be audited.
abstract  void removeAuditListener(AuditListener listener)
          Removes an audit listener from this auditor.
abstract  void run()
          Audits the locations of this auditor in the current thread.
abstract  void runAsynchronously()
          Audits the locations of this auditor in a background thread.
abstract  void setProfile(Profile profile)
          Sets the profile for this audit.
abstract  void setVisitAncestors(boolean shallow)
          Sets whether to visit ancestors of the locations to be audited.
abstract  void setVisitDescendants(boolean shallow)
          Sets whether to visit descendants of the locations to be audited.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Auditor

public Auditor()
Method Detail

addAuditListener

public abstract void addAuditListener(AuditListener listener)
Adds an audit listener to this auditor.


removeAuditListener

public abstract void removeAuditListener(AuditListener listener)
Removes an audit listener from this auditor.


cancel

public abstract void cancel()
Cancel an executing audit.


clear

public abstract void clear()
Clears the results and locations from this auditor. This auditor can be reused after a location is added.


addElement

public abstract boolean addElement(Element element,
                                   Document document,
                                   Project project,
                                   Workspace workspace)
Adds the location corresponding to an Element to the set of locations to be audited. The location will not be added if the document is null, unless the element is a document, project, or workspace; if the project is null, unless the element is a project or workspace; or if the workspace is null, unless the element is a workspace.

Parameters:
element - An Element corresponding to a construct in the Audit object model.
document - The document containing the element. May be null if the element is a Workspace or Project or implements Locatable.
project - The project containing the element, or null for the active project. Ignored if element is a Workspace or Project.
workspace - The workpsace containing the element, or null for the active workspace. Ignored if element is a Workspace.
Returns:
True if the element was added.

addElements

public abstract int addElements(Element[] elements,
                                Document document,
                                Project project,
                                Workspace workspace)
Adds the locations corresponding to an array of Elements to the set of locations to be audited. The locations will not be added if the document is null, unless the elements are documents, projects, or workspaces; if the project is null, unless the elements are projects or workspaces; or if the workspace is null, unless the elements are workspaces.

Parameters:
elements - An array of Elements each corresponding to a construct in the Audit object model.
document - The URL of the document containing the elements.
project - The project containing the elements, or null for the active project. Ignored for any element which is a Workspace or Project.
workspace - The workpsace containing the elements, or null for the active workspace. Ignored for any element which is a Workspace.
Returns:
The number of elements added.

addConstruct

public abstract boolean addConstruct(java.lang.Object construct,
                                     java.net.URL document,
                                     Project project,
                                     Workspace workspace)
Adds the location corresponding to a construct to the set of locations to be audited. The location will not be added if the document URL, project, or workspace are null.

Parameters:
construct - A construct in the Audit object model (e.g., a JOT object).
document - The URL of the document containing the construct.
project - The project containing the document, or null for the active project. Ignored if construct is a Workspace or Project.
workspace - The workspace containing the document, or null for the active workspace.
Returns:
True if the element was added.
Throws:
java.lang.IllegalArgumentException - if the construct is null.

addLocation

protected abstract void addLocation(Location location)
Adds a location to the set of locations to be audited.


getLocations

public abstract java.util.SortedSet getLocations()
Gets the set of locations to be audited.


getProfile

public abstract Profile getProfile()
Gets the profile for this audit.


setProfile

public abstract void setProfile(Profile profile)
Sets the profile for this audit.

Throws:
java.lang.IllegalStateException - if a profile has already been set.

getType

public abstract AuditType getType()
Gets the feature type of this audit.

Throws:
java.lang.IllegalStateException - if no profile has been set.

getModel

public abstract AuditModel getModel()
Gets the model for this audit.

Throws:
java.lang.IllegalStateException - if no profile has been set.

isAuditing

public abstract boolean isAuditing()
Gets whether an audit is in progress.


setVisitDescendants

public abstract void setVisitDescendants(boolean shallow)
Sets whether to visit descendants of the locations to be audited. By default, visitAncestors is true.

See Also:
addLocation(oracle.jdeveloper.audit.model.Location), setVisitAncestors(boolean)

isVisitDescendants

public abstract boolean isVisitDescendants()
Gets whether to visit descendants of the locations to be audited.

See Also:
setVisitDescendants(boolean)

setVisitAncestors

public abstract void setVisitAncestors(boolean shallow)
Sets whether to visit ancestors of the locations to be audited. By default, visitAncestors is true.

See Also:
addLocation(oracle.jdeveloper.audit.model.Location), setVisitAncestors(boolean)

isVisitAncestors

public abstract boolean isVisitAncestors()
Gets whether to visit ancestors of the locations to be audited.

See Also:
setVisitAncestors(boolean)

run

public abstract void run()
Audits the locations of this auditor in the current thread. The locations audited are those added to this auditor by addElement(oracle.ide.model.Element, oracle.ide.model.Document, oracle.ide.model.Project, oracle.ide.model.Workspace), and addConstruct(java.lang.Object, java.net.URL, oracle.ide.model.Project, oracle.ide.model.Workspace). The results of the audit are stored in the model.

Throws:
java.lang.IllegalStateException - if no profile has been set or locations added.

runAsynchronously

public abstract void runAsynchronously()
Audits the locations of this auditor in a background thread. The locations audited are those added to this auditor by addElement(oracle.ide.model.Element, oracle.ide.model.Document, oracle.ide.model.Project, oracle.ide.model.Workspace), and addConstruct(java.lang.Object, java.net.URL, oracle.ide.model.Project, oracle.ide.model.Workspace). The results of the audit are stored in the model.


applyDefaultFixes

public abstract void applyDefaultFixes()
Applies default fixes for any violations found by this auditor.


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.