Extension SDK 9.0.5

oracle.jdeveloper.audit.analyzer
Class Analyzer

java.lang.Object
  extended byoracle.jdeveloper.audit.analyzer.Analyzer

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 documents 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
 Category[] getCategories()
          Gets the categories of the rules or metrics of this analyzer, or null if none.
 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 isEnabled()
          Gets whether this analyzer is enabled.
 void setEnabled(boolean enabled)
          Sets whether this analyzer is enabled.
 
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

getCategories

public Category[] getCategories()
Gets the categories of the rules or metrics of this analyzer, or null if none. The default implementation returns null.

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


getRules

public Rule[] getRules()
Gets the rules verified by this analyzer, or null if none. The default 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 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. If enabled, visitor methods are invoked during an audit. If disabled, they are not. By default, the analyzer is enabled.

An analyzer can be disabled for the subtree rooted at a construct by disabling it in the enter method for the construct and reenabling it in the corresponding exit method.

See Also:
isEnabled()

Extension SDK

 

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