Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.jdevimpl.audit.core
Class DefaultAuditContext

java.lang.Object
  extended by oracle.jdevimpl.audit.core.DefaultAuditContext
All Implemented Interfaces:
AuditContext

public final class DefaultAuditContext
extends java.lang.Object
implements AuditContext


Nested Class Summary
 
Nested classes/interfaces inherited from interface oracle.jdeveloper.audit.analyzer.AuditContext
AuditContext.Key
 
Field Summary
 
Fields inherited from interface oracle.jdeveloper.audit.analyzer.AuditContext
INTENTIONAL_NULL
 
Constructor Summary
DefaultAuditContext(DefaultAuditor auditor, DefaultAuditContext enclosingContext)
           
 
Method Summary
 void addDependency(Dependency dependency)
          Adds a dependency of the current audit on a target.
 void beginVisit()
           
 void cancelReport()
           
 void clearContext()
           
 void enableGetChildAttribute()
          Enables the enclosing context to use AuditContext.getChildAttribute(java.lang.Object, oracle.jdeveloper.audit.analyzer.AuditContext.Key) to get the the value of an attribute set in this context.
 void endReport()
           
 void endVisit()
           
 boolean enteringApplicationContent()
           
 java.lang.Object[] getArguments()
           
 java.lang.Object getAttribute(AuditContext.Key key)
          Gets the value of an attribute in this or an enclosing context, or null if none.
 float getAttribute(AuditContext.Key key, float defaultValue)
          Gets the float value of an attribute in this or an enclosing context.
 int getAttribute(AuditContext.Key key, int defaultValue)
          Gets the int value of an attribute in this or an enclosing context.
 Auditor getAuditor()
          Gets the auditor running this traversal.
 java.lang.Object getChildAttribute(java.lang.Object child, AuditContext.Key key)
          Gets the value of an attribute in the context of a child of the current construct.
 int getDepth()
          Gets the depth (distance from root) of the construct currently being traversed.
 java.util.List<Analyzer> getDisabledAnalyzers()
           
 AuditContext getEnclosingContext()
          Gets the context of the enclosing construct of this context.
 Context getIdeContext()
          Gets an IDE context for the model currently being traversed.
 int getLength()
          Gets the length of the construct currently being traversed.
 int getLineOffset()
          Gets the line offset (zero-based) of the first character of the construct currently being traversed, or 0 if the construct currently being traversed is not text-based.
 Location getLocation()
          Gets the location of the construct currently being traversed.
 Location getLocation(java.lang.Object construct)
          Gets the location of a construct in the model currently being traversed.
 ModelAdapter getModel()
          Gets the model adapter for the model currently being traversed.
<T extends ModelAdapter>
ModelAdapter
getModel(java.lang.Class<T> type, java.net.URL url)
          Gets the model adapter for the model corresponding to a URL in the workspace and project currently being traversed.
<T extends ModelAdapter>
ModelAdapter
getModel(java.lang.Class<T> type, java.net.URL url, Project project, Workspace workspace)
          Gets the model adapter for the model corresponding to a workspace, project, and url.
 ModelAdapter getModelAdapter()
          Gets the adapter for the model currently being traversed.
<T extends ModelAdapter>
ModelAdapter
getModelAdapter(java.lang.Class<T> type, java.net.URL url)
          Gets the adapter for the model corresponding to a URL in the workspace and project currently being traversed.
<T extends ModelAdapter>
ModelAdapter
getModelAdapter(java.lang.Class<T> type, java.net.URL url, Project project, Workspace workspace)
          Gets the adapter for the model corresponding to a workspace, project, and url.
 int getOffset()
          Gets the character offset of the construct currently being traversed, or 0 if the construct currently being traversed is not text-based.
 Project getProject()
          Gets the project currently being traversed, or null if the root or a workspace is currently being traversed.
 java.lang.String getText()
          Gets the text of the construct currently being traversed, or null if the construct currently being traversed is not text-based..
 java.lang.String getText(java.lang.Object construct)
          Gets the text of a construct in the model currently being traversed.
 java.net.URL getUrl()
          Gets the non-null URL for the model currently being traversed.
 Workspace getWorkspace()
          Gets the workspace currently being traversed, or null if the root is currently being traversed.
 boolean isCancelled()
          Gets whether the current traversal has been cancelled.
 AuditContext.Key key(java.lang.Object object)
          Gets a key for an attribute visible only to this analyzer.
 void produceFragment(java.lang.Class<? extends ModelType> fragmentType)
          Produces a fragment of another model type from the construct currently being traversed.
 void produceFragment(java.lang.Class<? extends ModelType> fragmentType, Location location)
          Produces a fragment of another model type from a construct in the model currently being traversed.
 void produceFragment(java.lang.Class<? extends ModelType> fragmentType, java.lang.Object construct)
          Produces a fragment of another model type from a construct in the model currently being traversed.
 void report(Metric metric, float measurement)
          Reports a float-valued measurement for the current construct.
 void report(Metric metric, int measurement)
          Reports an int-valued measurement for the current construct.
 void report(Metric metric, java.lang.Object measurement)
          Reports a measurement for the current construct.
 ViolationReport report(Rule rule)
          Reports a rule violation for the current construct.
 ViolationReport report(Rule rule, Location location)
          Reports a rule violation for a construct.
 ViolationReport report(Rule rule, ModelAdapter model, java.lang.Object construct)
          Reports a rule violation for a construct.
 ViolationReport report(Rule rule, java.lang.Object construct)
          Reports a rule violation for a construct in the current node.
 void setAttribute(AuditContext.Key key, float value)
          Sets the value of a Float attribute in this context and in its enclosed contexts.
 void setAttribute(AuditContext.Key key, int value)
          Sets the value of an Integer attribute in this context and in its enclosed contexts.
 void setAttribute(AuditContext.Key key, java.lang.Object value)
          Sets the value of an attribute in this context and in its enclosed contexts.
 void setChildAttribute(java.lang.Object child, AuditContext.Key key, java.lang.Object value)
          Sets the value of an attribute in the context of a child of the current construct and in the enclosed contexts of the child.
 void setContext(Location location, java.lang.Object construct)
           
 void setContext(ModelAdapter model, Location location, java.lang.Object construct, boolean isRoot)
           
 void setParentAttribute(AuditContext.Key key, java.lang.Object value)
          Sets the value of an attribute in the context of the construct enclosing the current construct, and in its enclosed contexts.
 AuditContext.Key sharedKey(java.lang.Object object)
          Gets a key for an attribute visible to all analyzers.
 void throwIfCancelled()
          Throw CancellationException if the current traversal has been cancelled.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultAuditContext

public DefaultAuditContext(DefaultAuditor auditor,
                           DefaultAuditContext enclosingContext)
Method Detail

setContext

public void setContext(ModelAdapter model,
                       Location location,
                       java.lang.Object construct,
                       boolean isRoot)

setContext

public void setContext(Location location,
                       java.lang.Object construct)

beginVisit

public void beginVisit()

endVisit

public void endVisit()

clearContext

public void clearContext()

getDisabledAnalyzers

public java.util.List<Analyzer> getDisabledAnalyzers()

enteringApplicationContent

public boolean enteringApplicationContent()

getArguments

public java.lang.Object[] getArguments()

getAuditor

public Auditor getAuditor()
Description copied from interface: AuditContext
Gets the auditor running this traversal.

Specified by:
getAuditor in interface AuditContext

getEnclosingContext

public AuditContext getEnclosingContext()
Description copied from interface: AuditContext
Gets the context of the enclosing construct of this context.

Specified by:
getEnclosingContext in interface AuditContext

getDepth

public int getDepth()
Description copied from interface: AuditContext
Gets the depth (distance from root) of the construct currently being traversed. The root construct has depth 0.

Specified by:
getDepth in interface AuditContext

getWorkspace

public Workspace getWorkspace()
Description copied from interface: AuditContext
Gets the workspace currently being traversed, or null if the root is currently being traversed.

Specified by:
getWorkspace in interface AuditContext

getProject

public Project getProject()
Description copied from interface: AuditContext
Gets the project currently being traversed, or null if the root or a workspace is currently being traversed.

Specified by:
getProject in interface AuditContext

getIdeContext

public Context getIdeContext()
Description copied from interface: AuditContext
Gets an IDE context for the model currently being traversed.

Specified by:
getIdeContext in interface AuditContext

getUrl

public java.net.URL getUrl()
Description copied from interface: AuditContext
Gets the non-null URL for the model currently being traversed.

Specified by:
getUrl in interface AuditContext

getModel

public ModelAdapter getModel()
Description copied from interface: AuditContext
Gets the model adapter for the model currently being traversed. A model adapter is returned even if the construct currently being traversed is the root or a workspace, project, or package.

Specified by:
getModel in interface AuditContext

getLocation

public Location getLocation()
Description copied from interface: AuditContext
Gets the location of the construct currently being traversed.

Specified by:
getLocation in interface AuditContext

getText

public java.lang.String getText()
Description copied from interface: AuditContext
Gets the text of the construct currently being traversed, or null if the construct currently being traversed is not text-based..

Specified by:
getText in interface AuditContext

getLineOffset

public int getLineOffset()
Description copied from interface: AuditContext
Gets the line offset (zero-based) of the first character of the construct currently being traversed, or 0 if the construct currently being traversed is not text-based.

Specified by:
getLineOffset in interface AuditContext

getOffset

public int getOffset()
Description copied from interface: AuditContext
Gets the character offset of the construct currently being traversed, or 0 if the construct currently being traversed is not text-based.

Specified by:
getOffset in interface AuditContext

getLength

public int getLength()
Description copied from interface: AuditContext
Gets the length of the construct currently being traversed.

Specified by:
getLength in interface AuditContext

isCancelled

public boolean isCancelled()
Description copied from interface: AuditContext
Gets whether the current traversal has been cancelled.

Specified by:
isCancelled in interface AuditContext

throwIfCancelled

public void throwIfCancelled()
Description copied from interface: AuditContext
Throw CancellationException if the current traversal has been cancelled.

Specified by:
throwIfCancelled in interface AuditContext

getLocation

public Location getLocation(java.lang.Object construct)
Description copied from interface: AuditContext
Gets the location of a construct in the model currently being traversed.

Specified by:
getLocation in interface AuditContext

getText

public java.lang.String getText(java.lang.Object construct)
Description copied from interface: AuditContext
Gets the text of a construct in the model currently being traversed.

Specified by:
getText in interface AuditContext

getModel

public <T extends ModelAdapter> ModelAdapter getModel(java.lang.Class<T> type,
                                                      java.net.URL url,
                                                      Project project,
                                                      Workspace workspace)
Description copied from interface: AuditContext
Gets the model adapter for the model corresponding to a workspace, project, and url. This method provides the argument required to report a construct or parameter from outside the current model.

Specified by:
getModel in interface AuditContext

getModel

public <T extends ModelAdapter> ModelAdapter getModel(java.lang.Class<T> type,
                                                      java.net.URL url)
Description copied from interface: AuditContext
Gets the model adapter for the model corresponding to a URL in the workspace and project currently being traversed. This method provides the argument required to report a construct or parameter from outside the current model.

Specified by:
getModel in interface AuditContext

key

public AuditContext.Key key(java.lang.Object object)
Description copied from interface: AuditContext
Gets a key for an attribute visible only to this analyzer.

Specified by:
key in interface AuditContext
Parameters:
object - An object which identifies the attribute.
Returns:
a unique AuditContext.Key for use with the set and get attribute methods.

sharedKey

public AuditContext.Key sharedKey(java.lang.Object object)
Description copied from interface: AuditContext
Gets a key for an attribute visible to all analyzers. Multiple invocations of this method on the same object will return the same key. Using a Class as the object is typical.

Specified by:
sharedKey in interface AuditContext
Parameters:
object - An object which uniquely identifies the attribute.
Returns:
a AuditContext.Key corresponding to the object for use with the set and get attribute methods.

setAttribute

public void setAttribute(AuditContext.Key key,
                         java.lang.Object value)
Description copied from interface: AuditContext
Sets the value of an attribute in this context and in its enclosed contexts. The value seen by getAttribute on contexts which enclose this one is unnaffected.

Specified by:
setAttribute in interface AuditContext
Parameters:
key - A key identifying the attribute to set.
value - The possibly null new value of the attribute.
See Also:
AuditContext.key(java.lang.Object), AuditContext.sharedKey(java.lang.Object), AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key)

setAttribute

public void setAttribute(AuditContext.Key key,
                         int value)
Description copied from interface: AuditContext
Sets the value of an Integer attribute in this context and in its enclosed contexts. The value seen by getAttribute on contexts which enclose this one is unnaffected.

Specified by:
setAttribute in interface AuditContext
Parameters:
key - A key identifying the attribute to set.
value - The new value of the attribute.
See Also:
AuditContext.key(java.lang.Object), AuditContext.sharedKey(java.lang.Object), AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key)

setAttribute

public void setAttribute(AuditContext.Key key,
                         float value)
Description copied from interface: AuditContext
Sets the value of a Float attribute in this context and in its enclosed contexts. The value seen by getAttribute on contexts which enclose this one is unnaffected.

Specified by:
setAttribute in interface AuditContext
Parameters:
key - A key identifying the attribute to set.
value - The new value of the attribute.
See Also:
AuditContext.key(java.lang.Object), AuditContext.sharedKey(java.lang.Object), AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key)

getAttribute

public java.lang.Object getAttribute(AuditContext.Key key)
Description copied from interface: AuditContext
Gets the value of an attribute in this or an enclosing context, or null if none.

Specified by:
getAttribute in interface AuditContext
Parameters:
key - A key identifying the attribute to get.
Returns:
The value of the attribute, or null if none.

getAttribute

public int getAttribute(AuditContext.Key key,
                        int defaultValue)
Description copied from interface: AuditContext
Gets the int value of an attribute in this or an enclosing context.

Specified by:
getAttribute in interface AuditContext
Parameters:
key - A key identifying the attribute to get.
defaultValue - The value to return if none set.
Returns:
The value of the attribute, or the default value if none.

getAttribute

public float getAttribute(AuditContext.Key key,
                          float defaultValue)
Description copied from interface: AuditContext
Gets the float value of an attribute in this or an enclosing context.

Specified by:
getAttribute in interface AuditContext
Parameters:
key - A key identifying the attribute to get.
defaultValue - The value to return if none set.
Returns:
The value of the attribute, or the default value if none.

setChildAttribute

public void setChildAttribute(java.lang.Object child,
                              AuditContext.Key key,
                              java.lang.Object value)
Description copied from interface: AuditContext
Sets the value of an attribute in the context of a child of the current construct and in the enclosed contexts of the child. The value seen by getAttribute on this context and contexts which enclose this one is unnaffected.

Specified by:
setChildAttribute in interface AuditContext
Parameters:
child - A child of the current construct.
key - A key identifying the attribute to set.
value - The new value of the attribute.
See Also:
AuditContext.key(java.lang.Object), AuditContext.sharedKey(java.lang.Object), AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key)

setParentAttribute

public void setParentAttribute(AuditContext.Key key,
                               java.lang.Object value)
Description copied from interface: AuditContext
Sets the value of an attribute in the context of the construct enclosing the current construct, and in its enclosed contexts.

Specified by:
setParentAttribute in interface AuditContext
Parameters:
key - A key identifying the attribute to set.
value - The possibly null new value of the attribute.
See Also:
AuditContext.key(java.lang.Object), AuditContext.sharedKey(java.lang.Object), AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key)

getChildAttribute

public java.lang.Object getChildAttribute(java.lang.Object child,
                                          AuditContext.Key key)
Description copied from interface: AuditContext
Gets the value of an attribute in the context of a child of the current construct. The AuditContext.enableGetChildAttribute() method must have been invoked on the context of the child. This method does not search enclosing contexts.

Specified by:
getChildAttribute in interface AuditContext
Parameters:
child - A child of the current construct.
key - A key identifying the attribute to set.
See Also:
AuditContext.key(java.lang.Object), AuditContext.sharedKey(java.lang.Object), AuditContext.enableGetChildAttribute(), AuditContext.setAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key, java.lang.Object)

enableGetChildAttribute

public void enableGetChildAttribute()
Description copied from interface: AuditContext
Enables the enclosing context to use AuditContext.getChildAttribute(java.lang.Object, oracle.jdeveloper.audit.analyzer.AuditContext.Key) to get the the value of an attribute set in this context.

Specified by:
enableGetChildAttribute in interface AuditContext
See Also:
AuditContext.getChildAttribute(java.lang.Object, oracle.jdeveloper.audit.analyzer.AuditContext.Key), AuditContext.setAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key, java.lang.Object)

addDependency

public void addDependency(Dependency dependency)
Description copied from interface: AuditContext
Adds a dependency of the current audit on a target.

Specified by:
addDependency in interface AuditContext

report

public ViolationReport report(Rule rule)
Description copied from interface: AuditContext
Reports a rule violation for the current construct. report returns a ViolationReport which allows parameters and other attributes to be added to the violation. This variant is only applicable when the violating construct is the one currently being visited by Audit.

See the class overview for more information.

Specified by:
report in interface AuditContext
Parameters:
rule - The rule violated.
Returns:
a ViolationReport which allows the violation to be modified.

report

public ViolationReport report(Rule rule,
                              java.lang.Object construct)
Description copied from interface: AuditContext
Reports a rule violation for a construct in the current node. report returns a ViolationReport which allows parameters and other attributes to be added to the violation. This variant is applicable when the violating construct is in the node currently being visited by Audit.

See the class overview for more information.

Specified by:
report in interface AuditContext
Parameters:
rule - The rule violated.
construct - The violating construct.

report

public ViolationReport report(Rule rule,
                              ModelAdapter model,
                              java.lang.Object construct)
Description copied from interface: AuditContext
Reports a rule violation for a construct. report returns a ViolationReport which allows parameters and other attributes to be added to the violation. This variant is applicable for any violating construct. See AuditContext.getModelAdapter(), AuditContext.getModelAdapter(Class,java.net.URL,oracle.ide.model.Project,oracle.ide.model.Workspace), and Location.getModel() for ways to obtain a model.

See the class overview for more information.

Specified by:
report in interface AuditContext
Parameters:
rule - The rule violated.
model - The model containing the violationg construct.
construct - The violating construct.

report

public ViolationReport report(Rule rule,
                              Location location)
Description copied from interface: AuditContext
Reports a rule violation for a construct. report returns a ViolationReport which allows parameters and other attributes to be added to the violation. See the class overview for more information.

Specified by:
report in interface AuditContext
Parameters:
rule - The rule violated.
location - The Location of the the violating construct.

report

public void report(Metric metric,
                   java.lang.Object measurement)
Description copied from interface: AuditContext
Reports a measurement for the current construct.

Specified by:
report in interface AuditContext
measurement - The value that was measured.

report

public void report(Metric metric,
                   int measurement)
Description copied from interface: AuditContext
Reports an int-valued measurement for the current construct.

Specified by:
report in interface AuditContext
measurement - The value that was measured.

report

public void report(Metric metric,
                   float measurement)
Description copied from interface: AuditContext
Reports a float-valued measurement for the current construct.

Specified by:
report in interface AuditContext
measurement - The value that was measured.

endReport

public void endReport()

cancelReport

public void cancelReport()

produceFragment

public void produceFragment(java.lang.Class<? extends ModelType> fragmentType)
Description copied from interface: AuditContext
Produces a fragment of another model type from the construct currently being traversed.

Specified by:
produceFragment in interface AuditContext

produceFragment

public void produceFragment(java.lang.Class<? extends ModelType> fragmentType,
                            java.lang.Object construct)
Description copied from interface: AuditContext
Produces a fragment of another model type from a construct in the model currently being traversed.

Specified by:
produceFragment in interface AuditContext

produceFragment

public void produceFragment(java.lang.Class<? extends ModelType> fragmentType,
                            Location location)
Description copied from interface: AuditContext
Produces a fragment of another model type from a construct in the model currently being traversed.

Specified by:
produceFragment in interface AuditContext

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getModelAdapter

public ModelAdapter getModelAdapter()
Description copied from interface: AuditContext
Gets the adapter for the model currently being traversed. An adapter is returned even if the construct currently being traversed is the root or a workspace, project, or package.

Specified by:
getModelAdapter in interface AuditContext

getModelAdapter

public <T extends ModelAdapter> ModelAdapter getModelAdapter(java.lang.Class<T> type,
                                                             java.net.URL url,
                                                             Project project,
                                                             Workspace workspace)
Description copied from interface: AuditContext
Gets the adapter for the model corresponding to a workspace, project, and url. This method provides the argument required to report a construct or parameter from outside the current model.

Specified by:
getModelAdapter in interface AuditContext

getModelAdapter

public <T extends ModelAdapter> ModelAdapter getModelAdapter(java.lang.Class<T> type,
                                                             java.net.URL url)
Description copied from interface: AuditContext
Gets the adapter for the model corresponding to a URL in the workspace and project currently being traversed. This method provides the argument required to report a construct or parameter from outside the current model.

Specified by:
getModelAdapter in interface AuditContext

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

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