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

E13403-08

oracle.jdeveloper.audit.analyzer
Class Analyzer

java.lang.Object
  extended by oracle.jdeveloper.audit.analyzer.Analyzer
Direct Known Subclasses:
AuditAddin.TraversalAnalyzer, TranslationAnalyzer

public abstract class Analyzer
extends java.lang.Object

A visitor over the Audit object models which verifies rules and/or computes metrics. An analyzer subclass implements visitor methods which are invoked by the Audit framework as it traverses the Audit object models. The visitor methods report violations and measurements using the reporting methods of a context object passed to them. Besides implementing the visitor methods, an analyzer subclass exposes its rules and metrics for the framework to configure. Analyzers are registered with the AuditManager at startup by IDE extensions.

Analyzer Configuration
The getRules and getMetrics methods supply the framework with the rules and metrics of the Analyzer. The framework configures the instances returned to reflect the profile selected by the user for the current traversal. An analyzer should hold references to the instances returned both to use when reporting violations and measurements and to get the current values of properties which affect the operation of the analyzer. Note that each analyzer instance should create unique rule and metric instances.

Visitor Methods
The visitor methods are the enter and exit methods. The Audit framework traverses the constructs of the object models corresponding to the nodes being audited and at each construct invokes the applicable enter and exit methods of each registered analyzer. As the traversal enters a construct, it invokes the enter method from each analyzer with the most specific type matching the construct. As the traversal exits a construct, it likewise invokes all exit methods with the most specific type matching the construct. The enter and exit methods actually accept two parameters: a context parameter of type AuditContext, and a construct parameter of any type. A method matches a construct if the type of the construct is assignable to the type of the construct parameter and if no construct type of an alternative method is assignable to the type of the construct parameter.

The traversal is depth-first, which means that contained models are visited after invoking the containing construct's enter methods (if any) but before invoking the containing construct's exit methods (if any). A typical analyzer will collect information as the traversal proceeds down, in enter methods; and produce violations or measurements as the traversal proceeds back up, in exit methods. This collected information can be shared between visitor methods through instance fields declared in the analyzer subclass, or through the attribute methods of the context object passed to the visitor method. See AuditContext.


Constructor Summary
Analyzer()
           
 
Method Summary
 void cancel()
          Notifies this analyzer that the audit that created it has been cancelled.
 Metric[] getMetrics()
          Gets the metrics measured by this analyzer, or null if none.
 Rule[] getRules()
          Gets the rules verified by this analyzer, or null if none.
 boolean isApplicationContentSupported()
          Gets whether this analyzer supports analyzing application content files.
 boolean isCancelled()
          Gets whether cancel() has been invoked.
 boolean isEnabled()
          Gets whether this analyzer is enabled.
 void setEnabled(boolean enabled)
          Sets whether this analyzer is enabled.
 boolean startTask(AuditTaskContext context)
          Executes a post-traversal background task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Analyzer

public Analyzer()
Method Detail

startTask

public boolean startTask(AuditTaskContext context)
Executes a post-traversal background task. The task should not execute in the calling thread and the analyzer should override cancel() to allow the background task to be cancelled. The task should report issues using the AuditTaskContext report methods, and should report completion using the AuditTaskContext.taskCompleted() method.

Returns:
true if the task is started.

cancel

public void cancel()
Notifies this analyzer that the audit that created it has been cancelled. The Analyzer implementation ensures that isCancelled() returns true after it is invoked. Analyzers that override startTask(oracle.jdeveloper.audit.analyzer.AuditTaskContext) should also override cancel() to cancel the background task.

See Also:
AuditContext.isCancelled()

isCancelled

public boolean isCancelled()
Gets whether cancel() has been invoked.


isApplicationContentSupported

public boolean isApplicationContentSupported()
Gets whether this analyzer supports analyzing application content files. The project context of an application content file is null. The default Analyzer implementation returns null.


getRules

public Rule[] getRules()
Gets the rules verified by this analyzer, or null if none. The default Analyzer implementation returns null.

Properties of the rule instances returned will be set to the values configured by the user for the current invocation.


getMetrics

public Metric[] getMetrics()
Gets the metrics measured by this analyzer, or null if none. The default Analyzer implementation returns null.

Properties of the metric instances returned will be set to the values configured by the user for the current invocation.


isEnabled

public boolean isEnabled()
Gets whether this analyzer is enabled.

See Also:
setEnabled(boolean)

setEnabled

public void setEnabled(boolean enabled)
Sets whether this analyzer is enabled. When setEnabled(false) is invoked from an enter method, the framework disables the analyzer while the curent construct and its contained constructs are analyzed; the framework reenables the analyzer after exiting the construct (i.e., an exit method for the construct, if present, is not called).

Note that calling setEnabled(false) from an exit method is pointless (it will be reenabled as soon as the exit method returns), and calling setEnabled(true) from an enter or an exit method is also pointless (if the analyzer is not enabled, the enter or exit method will not be invoked in the first place).

See Also:
isEnabled()

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

E13403-08

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