Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.jdevimpl.audit.core
Class DefaultAuditor

java.lang.Object
  extended by oracle.jdeveloper.audit.service.Auditor
      extended by oracle.jdevimpl.audit.core.DefaultAuditor
All Implemented Interfaces:
java.lang.Runnable

public final class DefaultAuditor
extends Auditor
implements java.lang.Runnable

The default Auditor implementation.


Constructor Summary
DefaultAuditor(ModelTypeFactory factory)
           
 
Method Summary
 void addAuditListener(AuditListener listener)
          Adds an audit listener to this auditor.
 boolean addConstruct(java.lang.Object construct, java.net.URL file, Project project, Workspace workspace)
          Adds the location corresponding to a construct to the set of locations to be audited.
 void addDependency(Dependency dependency)
           
 boolean addElement(Element element, Node node, Project project, Workspace workspace)
          Adds the location corresponding to an Element to the set of locations to be audited.
 boolean addElements(Element[] elements, Node node, Project project, Workspace workspace)
          Adds the locations corresponding to an array of Elements in a Node to the set of locations to be audited.
protected  void addLocation(Location location)
           
 boolean addNode(Node node, Project project, Workspace workspace)
          Adds the location corresponding to a Node to the set of locations to be audited.
 void addOptionalAnalysis(Issue issue)
           
 boolean addUrl(java.net.URL document, Project project, Workspace workspace)
          Adds the location corresponding to a URL to the set of locations to be audited.
 java.lang.Throwable applyDefaultTransforms(java.lang.String label)
          Audits the locations of this auditor in the current thread and applies all default transforms (see Transformer.applyDefaultTransforms(java.lang.String, java.util.Collection, oracle.jdeveloper.audit.service.TransformerListener, oracle.jdeveloper.audit.service.AuditModel).
 void audit()
          Audits the locations of this auditor in the current thread.
 boolean cancel()
          Cancel an executing audit.
 void cancelReport()
           
 void clear()
          Clears the results and locations from this auditor.
 void endReport()
           
 ProfileBinding getBinding()
           
 ModelFactory getFactory()
          Gets the factory used for this audit.
 java.util.Collection<Issue> getOptionalAnalyses()
          Gets issues identifying optional analyses that were not performed while computing the status of the described file.
 Profile getProfile()
          Gets the profile for this audit.
 boolean isAuditable(Element element, Node node, Project project, Workspace workspace)
          Gets whether an Element is auditable.
 boolean isAuditableType(Element element)
          Gets whether an Element is of an auditable type.
 boolean isAuditableType(java.net.URL url)
          Gets whether the element at an URL is of an auditable type.
 boolean isAuditing()
          Gets whether an audit is in progress.
 boolean isCancelled()
          Gets whether an audit in progress has been cancelled.
 boolean isIgnoreAssists()
          Gets whether to ignore Assist issues.
 boolean isVisitAncestors()
          Gets whether to visit ancestors of the locations to be audited.
 boolean isVisitDescendants()
          Gets whether to visit descendants of the locations to be audited.
 boolean isWorkingSetFilteringEnabled()
          Gets whether to filter projects by their current working set.
 void removeAuditListener(AuditListener listener)
          Removes an audit listener from this auditor.
 ViolationReport report(AuditContext context, Rule rule, Location location, java.lang.Object construct)
           
 void report(Metric metric, Location location, java.lang.Object measurement)
           
 void run()
          Audits the locations of this auditor in the current thread.
 void runAsynchronously()
          Audits the locations of this auditor in a background thread.
 void runAsynchronously(java.lang.Thread.UncaughtExceptionHandler handler)
          Audits the locations of this auditor in a background thread.
 void setAttribute(java.lang.Object key, java.lang.Object value)
          Sets a configuration attribute for this auditor.
 void setDependencyCollector(CompositeDependency collector)
          Sets the collector of dependencies discovered when the audit is run, or null.
 void setIgnoreAssists(boolean ignore)
          Sets whether to ignore Assist issues.
 void setProfile(Profile profile)
          Sets the profile for this audit.
 void setVisitAncestors(boolean shallow)
          Sets whether to visit ancestors of the locations to be audited.
 void setVisitDescendants(boolean shallow)
          Sets whether to visit descendants of the locations to be audited.
 void setWorkingSetFilteringEnabled(boolean enabled)
          Sets whether to filter projects by their current working set.
 void setWriteLockRequestListener(WriteLockRequestListener listener)
          Sets the listener to notify if a thread waits to acquire the write lock.
 void throwIfCancelled()
          Throw CancellationException if the last audit to execute was cancelled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAuditor

public DefaultAuditor(ModelTypeFactory factory)
Method Detail

addAuditListener

public void addAuditListener(AuditListener listener)
Description copied from class: Auditor
Adds an audit listener to this auditor.

Specified by:
addAuditListener in class Auditor

removeAuditListener

public void removeAuditListener(AuditListener listener)
Description copied from class: Auditor
Removes an audit listener from this auditor.

Specified by:
removeAuditListener in class Auditor

isAuditableType

public boolean isAuditableType(Element element)
Description copied from class: Auditor
Gets whether an Element is of an auditable type.

Specified by:
isAuditableType in class Auditor

isAuditable

public boolean isAuditable(Element element,
                           Node node,
                           Project project,
                           Workspace workspace)
Description copied from class: Auditor
Gets whether an Element is auditable. An element is auditable if is of an auditable type, and if the context represented by the node, project, workspace is adequate.

Specified by:
isAuditable in class Auditor
Parameters:
element - the element.
node - the Node context of the element, or null if none.
project - the Project context of the element, or null if none.
workspace - the Workspace context of the element, or null if none.

cancel

public boolean cancel()
Description copied from class: Auditor
Cancel an executing audit.

Specified by:
cancel in class Auditor
Returns:
true iff an audit is running and not already cancelled.

throwIfCancelled

public void throwIfCancelled()
Description copied from class: Auditor
Throw CancellationException if the last audit to execute was cancelled.

Specified by:
throwIfCancelled in class Auditor

clear

public void clear()
Description copied from class: Auditor
Clears the results and locations from this auditor. This auditor can be reused after a location is added.

Specified by:
clear in class Auditor

addElement

public boolean addElement(Element element,
                          Node node,
                          Project project,
                          Workspace workspace)
Description copied from class: Auditor
Adds the location corresponding to an Element to the set of locations to be audited. The location will not be added if the element is not auditable.

Specified by:
addElement in class Auditor
Parameters:
element - An Element corresponding to a construct in the Audit object model.
node - The Node containing the element. Ignored if element is a node.
project - The project containing the element. Ignored if element is a Workspace or Project.
workspace - The workspace containing the element. Ignored if element is a Workspace.
Returns:
True if the location was added.
See Also:
Auditor.isAuditable(oracle.ide.model.Element, oracle.ide.model.Node, oracle.ide.model.Project, oracle.ide.model.Workspace)

addElements

public boolean addElements(Element[] elements,
                           Node node,
                           Project project,
                           Workspace workspace)
Description copied from class: Auditor
Adds the locations corresponding to an array of Elements in a Node to the set of locations to be audited. Locations for elements which are not auditable will not be added.

Specified by:
addElements in class Auditor
Parameters:
elements - An array of Elements each corresponding to a construct in the Audit object model.
node - The Node containing the elements.
project - The project containing the elements. Ignored for any element which is a Workspace or Project.
workspace - The workpsace containing the elements. Ignored for any element which is a Workspace.
Returns:
True if at least one location was added.
See Also:
Auditor.isAuditable(oracle.ide.model.Element, oracle.ide.model.Node, oracle.ide.model.Project, oracle.ide.model.Workspace)

addNode

public boolean addNode(Node node,
                       Project project,
                       Workspace workspace)
Description copied from class: Auditor
Adds the location corresponding to a Node to the set of locations to be audited. The location will not be added if the project is null, unless the node is a project or workspace; or if the workspace is null, unless the node is a workspace.

Specified by:
addNode in class Auditor
Parameters:
node - A Node in the Audit object model.
project - The project containing the node. Ignored if node is a Workspace or Project.
workspace - The workspace containing the node. Ignored if node is a Workspace.
Returns:
True if the location was added.

addConstruct

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

Specified by:
addConstruct in class Auditor
Parameters:
construct - A construct in the Audit object model (e.g., a Java object).
file - The URL of the file containing the construct.
project - The project containing the file.
workspace - The workspace containing the file.
Returns:
True if the location was added.

isAuditableType

public boolean isAuditableType(java.net.URL url)
Description copied from class: Auditor
Gets whether the element at an URL is of an auditable type.

Specified by:
isAuditableType in class Auditor

addUrl

public boolean addUrl(java.net.URL document,
                      Project project,
                      Workspace workspace)
Description copied from class: Auditor
Adds the location corresponding to a URL to the set of locations to be audited. The location will not be added if the url, project, or workspace are null.

Specified by:
addUrl in class Auditor
Parameters:
document - The URL of a file in the Audit object model.
project - The project containing the file.
workspace - The workspace containing the file.
Returns:
True if the location was added.

addLocation

protected void addLocation(Location location)

getFactory

public ModelFactory getFactory()
Gets the factory used for this audit.

Specified by:
getFactory in class Auditor

getBinding

public ProfileBinding getBinding()

getProfile

public Profile getProfile()
Description copied from class: Auditor
Gets the profile for this audit.

Specified by:
getProfile in class Auditor

setProfile

public void setProfile(Profile profile)
Description copied from class: Auditor
Sets the profile for this audit.

Specified by:
setProfile in class Auditor

setAttribute

public void setAttribute(java.lang.Object key,
                         java.lang.Object value)
Description copied from class: Auditor
Sets a configuration attribute for this auditor. Configuration attributes are accessible to model adapters through the ModelFactory.getAttribute method and to analyzers through the AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key) method with a AuditContext.sharedKey(java.lang.Object)

Typically, configuration attributes are used to allow an IDE command that is implemented using Audit to provide command-specific attributes to a model adapter or analyzer.

Specified by:
setAttribute in class Auditor
Parameters:
key - An object, typically a java.lang.Class, which uniquely identifies the attribute, used to create the shared key.
value - The possibly null value of the attribute.
See Also:
AuditContext.sharedKey(java.lang.Object), AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key), ModelFactory.getAttribute(java.lang.Object)

isAuditing

public boolean isAuditing()
Description copied from class: Auditor
Gets whether an audit is in progress.

Specified by:
isAuditing in class Auditor

isCancelled

public boolean isCancelled()
Description copied from class: Auditor
Gets whether an audit in progress has been cancelled.

Specified by:
isCancelled in class Auditor

setWorkingSetFilteringEnabled

public void setWorkingSetFilteringEnabled(boolean enabled)
Description copied from class: Auditor
Sets whether to filter projects by their current working set.

Specified by:
setWorkingSetFilteringEnabled in class Auditor

isWorkingSetFilteringEnabled

public boolean isWorkingSetFilteringEnabled()
Description copied from class: Auditor
Gets whether to filter projects by their current working set.

Specified by:
isWorkingSetFilteringEnabled in class Auditor

setIgnoreAssists

public void setIgnoreAssists(boolean ignore)
Description copied from class: Auditor
Sets whether to ignore Assist issues.

Specified by:
setIgnoreAssists in class Auditor

isIgnoreAssists

public boolean isIgnoreAssists()
Description copied from class: Auditor
Gets whether to ignore Assist issues.

Specified by:
isIgnoreAssists in class Auditor

setWriteLockRequestListener

public void setWriteLockRequestListener(WriteLockRequestListener listener)
Description copied from class: Auditor
Sets the listener to notify if a thread waits to acquire the write lock.

Specified by:
setWriteLockRequestListener in class Auditor
Parameters:
listener - The listener to notify if a thread waits to acquire the write lock, or null if none.

setDependencyCollector

public void setDependencyCollector(CompositeDependency collector)
Description copied from class: Auditor
Sets the collector of dependencies discovered when the audit is run, or null. By default, dependencies are not collected. The client must remove itself as a listener when it no longer needs the dependencies.

Specified by:
setDependencyCollector in class Auditor

setVisitDescendants

public void setVisitDescendants(boolean shallow)
Description copied from class: Auditor
Sets whether to visit descendants of the locations to be audited. By default, visitAncestors is true.

Specified by:
setVisitDescendants in class Auditor
See Also:
Auditor.setVisitAncestors(boolean)

isVisitDescendants

public boolean isVisitDescendants()
Description copied from class: Auditor
Gets whether to visit descendants of the locations to be audited.

Specified by:
isVisitDescendants in class Auditor
See Also:
Auditor.setVisitDescendants(boolean)

setVisitAncestors

public void setVisitAncestors(boolean shallow)
Description copied from class: Auditor
Sets whether to visit ancestors of the locations to be audited. By default, visitAncestors is true.

Specified by:
setVisitAncestors in class Auditor
See Also:
Auditor.setVisitAncestors(boolean)

isVisitAncestors

public boolean isVisitAncestors()
Description copied from class: Auditor
Gets whether to visit ancestors of the locations to be audited.

Specified by:
isVisitAncestors in class Auditor
See Also:
Auditor.setVisitAncestors(boolean)

run

public void run()
Description copied from class: Auditor
Audits the locations of this auditor in the current thread. The locations audited are those added to this auditor by Auditor.addElement(oracle.ide.model.Element, oracle.ide.model.Node, oracle.ide.model.Project, oracle.ide.model.Workspace), and Auditor.addConstruct(java.lang.Object, java.net.URL, oracle.ide.model.Project, oracle.ide.model.Workspace). The results of the audit are passed to the audit listeners added by Auditor.addAuditListener(oracle.jdeveloper.audit.service.AuditListener).

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class Auditor

runAsynchronously

public void runAsynchronously()
Description copied from class: Auditor
Audits the locations of this auditor in a background thread. The locations audited are those added to this auditor by Auditor.addElement(oracle.ide.model.Element, oracle.ide.model.Node, oracle.ide.model.Project, oracle.ide.model.Workspace), and Auditor.addConstruct(java.lang.Object, java.net.URL, oracle.ide.model.Project, oracle.ide.model.Workspace). The results of the audit are passed to the audit listeners added by Auditor.addAuditListener(oracle.jdeveloper.audit.service.AuditListener).

Specified by:
runAsynchronously in class Auditor

runAsynchronously

public void runAsynchronously(java.lang.Thread.UncaughtExceptionHandler handler)
Description copied from class: Auditor
Audits the locations of this auditor in a background thread. The locations audited are those added to this auditor by Auditor.addElement(oracle.ide.model.Element, oracle.ide.model.Node, oracle.ide.model.Project, oracle.ide.model.Workspace), and Auditor.addConstruct(java.lang.Object, java.net.URL, oracle.ide.model.Project, oracle.ide.model.Workspace). The results of the audit are passed to the audit listeners added by Auditor.addAuditListener(oracle.jdeveloper.audit.service.AuditListener).

Specified by:
runAsynchronously in class Auditor

audit

public void audit()
Description copied from class: Auditor
Audits the locations of this auditor in the current thread. The locations audited are those added to this auditor by Auditor.addElement(oracle.ide.model.Element, oracle.ide.model.Node, oracle.ide.model.Project, oracle.ide.model.Workspace), and Auditor.addConstruct(java.lang.Object, java.net.URL, oracle.ide.model.Project, oracle.ide.model.Workspace). The results of the audit are passed to the audit listeners added by Auditor.addAuditListener(oracle.jdeveloper.audit.service.AuditListener).

Specified by:
audit in class Auditor

getOptionalAnalyses

public java.util.Collection<Issue> getOptionalAnalyses()
Description copied from class: Auditor
Gets issues identifying optional analyses that were not performed while computing the status of the described file. Performing these analyses may change the status of the file. The issues are expected to offer actions to force those analyses to be performed.

Specified by:
getOptionalAnalyses in class Auditor

applyDefaultTransforms

public java.lang.Throwable applyDefaultTransforms(java.lang.String label)
Description copied from class: Auditor
Audits the locations of this auditor in the current thread and applies all default transforms (see Transformer.applyDefaultTransforms(java.lang.String, java.util.Collection, oracle.jdeveloper.audit.service.TransformerListener, oracle.jdeveloper.audit.service.AuditModel). The locations audited are those added to this auditor by Auditor.addElement(oracle.ide.model.Element, oracle.ide.model.Node, oracle.ide.model.Project, oracle.ide.model.Workspace), and Auditor.addConstruct(java.lang.Object, java.net.URL, oracle.ide.model.Project, oracle.ide.model.Workspace). The results of the audit are passed to the audit listeners added by Auditor.addAuditListener(oracle.jdeveloper.audit.service.AuditListener).

Specified by:
applyDefaultTransforms in class Auditor

addDependency

public void addDependency(Dependency dependency)

addOptionalAnalysis

public void addOptionalAnalysis(Issue issue)

report

public ViolationReport report(AuditContext context,
                              Rule rule,
                              Location location,
                              java.lang.Object construct)

endReport

public void endReport()

cancelReport

public void cancelReport()

report

public void report(Metric metric,
                   Location location,
                   java.lang.Object measurement)

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

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