public final class DefaultAuditContext extends java.lang.Object implements AuditContext
AuditContext.KeyINTENTIONAL_NULL| Modifier and Type | Method and Description |
|---|---|
void |
addDependency(Dependency dependency)
Adds a dependency of the current audit on a target.
|
void |
cancel() |
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. |
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.
|
java.lang.Object |
getConstruct()
Gets the construct currently being traversed.
|
int |
getDepth()
Gets the depth (distance from root) of the construct currently being
traversed.
|
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> |
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> |
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> |
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> |
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.
|
Node |
getNode()
Gets the
IDE node for the model currently being traversed,
or null if none (in particular, if this is the root or a directory model). |
int |
getOffset()
Gets the character offset of the construct currently being traversed, or 0
if the construct currently being traversed is not text-based.
|
java.lang.Class<?> |
getPresentationType()
Gets the presentation type of construct currently being traversed, or null
if the type is not a presentation type.
|
Project |
getProject()
Gets the project currently being traversed, or null if the root or a
workspace is currently being traversed.
|
java.util.Set<java.lang.String> |
getTechnologies()
Gets the technologies that apply to the construct 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 |
markSuppressionLimit()
Marks the start of the current construct as the limit before which a
suppression cannot be reported.
|
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.
|
IssueReport |
report(Rule rule)
Reports an issue for the construct currently being traversed.
|
IssueReport |
report(Rule rule,
Location location)
Reports an issue for a location in the model currently being traversed
(i.e., location.getModel() == context.getModel()).
|
IssueReport |
report(Rule rule,
ModelAdapter model,
java.lang.Object construct) |
IssueReport |
report(Rule rule,
java.lang.Object construct)
Reports an issue for a construct in the model currently being traversed.
|
SuppressionReport |
report(SuppressionScheme scheme,
java.lang.String name,
Location location)
Reports a suppression for the scope of a location in the model
currently being traversed.
|
SuppressionReport |
report(SuppressionScheme scheme,
java.lang.String name,
java.lang.Object construct)
Reports a suppression for the scope of a construct in the model
currently being traversed.
|
SuppressionReport |
report(SuppressionScheme scheme,
Violation issue)
Reports a suppression for the issue currently being reviewed.
|
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 |
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() |
public Auditor getAuditor()
AuditContextgetAuditor in interface AuditContextpublic AuditContext getEnclosingContext()
AuditContextgetEnclosingContext in interface AuditContextpublic int getDepth()
AuditContextgetDepth in interface AuditContextpublic Workspace getWorkspace()
AuditContextgetWorkspace in interface AuditContextpublic Project getProject()
AuditContextgetProject in interface AuditContextpublic Node getNode()
AuditContextIDE node for the model currently being traversed,
or null if none (in particular, if this is the root or a directory model).getNode in interface AuditContextpublic Context getIdeContext()
AuditContextIDE context for the model currently being
traversed.getIdeContext in interface AuditContextpublic java.util.Set<java.lang.String> getTechnologies()
AuditContextgetTechnologies in interface AuditContextpublic java.net.URL getUrl()
AuditContextgetUrl in interface AuditContextpublic ModelAdapter getModel()
AuditContextgetModel in interface AuditContextpublic Location getLocation()
AuditContextgetLocation in interface AuditContextpublic java.lang.Object getConstruct()
AuditContextgetConstruct in interface AuditContextpublic java.lang.Class<?> getPresentationType()
AuditContextgetPresentationType in interface AuditContextModelType.getPresentationTypes()public java.lang.String getText()
AuditContextgetText in interface AuditContextpublic int getLineOffset()
AuditContextgetLineOffset in interface AuditContextpublic int getOffset()
AuditContextgetOffset in interface AuditContextpublic int getLength()
AuditContextgetLength in interface AuditContextpublic boolean isCancelled()
AuditContextisCancelled in interface AuditContextpublic void throwIfCancelled()
AuditContextthrowIfCancelled in interface AuditContextpublic Location getLocation(java.lang.Object construct)
AuditContextgetLocation in interface AuditContextpublic java.lang.String getText(java.lang.Object construct)
AuditContextgetText in interface AuditContextpublic <T extends ModelAdapter> ModelAdapter getModel(java.lang.Class<T> type, java.net.URL url, Project project, Workspace workspace)
AuditContextgetModel in interface AuditContextpublic <T extends ModelAdapter> ModelAdapter getModel(java.lang.Class<T> type, java.net.URL url)
AuditContextgetModel in interface AuditContextpublic AuditContext.Key key(java.lang.Object object)
AuditContextkey in interface AuditContextobject - An object which identifies the attribute.AuditContext.Key for use with the set and get attribute methods.public AuditContext.Key sharedKey(java.lang.Object object)
AuditContextClass as the object is typical.sharedKey in interface AuditContextobject - An object which uniquely identifies the attribute.AuditContext.Key corresponding to the object for use with the set and
get attribute methods.public void setAttribute(AuditContext.Key key, java.lang.Object value)
AuditContextsetAttribute in interface AuditContextkey - A key identifying the attribute to set.value - The possibly null new value of the attribute.AuditContext.key(java.lang.Object),
AuditContext.sharedKey(java.lang.Object),
AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key)public void setAttribute(AuditContext.Key key, int value)
AuditContextsetAttribute in interface AuditContextkey - A key identifying the attribute to set.value - The new value of the attribute.AuditContext.key(java.lang.Object),
AuditContext.sharedKey(java.lang.Object),
AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key)public void setAttribute(AuditContext.Key key, float value)
AuditContextsetAttribute in interface AuditContextkey - A key identifying the attribute to set.value - The new value of the attribute.AuditContext.key(java.lang.Object),
AuditContext.sharedKey(java.lang.Object),
AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key)public java.lang.Object getAttribute(AuditContext.Key key)
AuditContextgetAttribute in interface AuditContextkey - A key identifying the attribute to get.public int getAttribute(AuditContext.Key key, int defaultValue)
AuditContextgetAttribute in interface AuditContextkey - A key identifying the attribute to get.defaultValue - The value to return if none set.public float getAttribute(AuditContext.Key key, float defaultValue)
AuditContextgetAttribute in interface AuditContextkey - A key identifying the attribute to get.defaultValue - The value to return if none set.public void setChildAttribute(java.lang.Object child,
AuditContext.Key key,
java.lang.Object value)
AuditContextsetChildAttribute in interface AuditContextchild - A child of the current construct.key - A key identifying the attribute to set.value - The new value of the attribute.AuditContext.key(java.lang.Object),
AuditContext.sharedKey(java.lang.Object),
AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key)public void setParentAttribute(AuditContext.Key key, java.lang.Object value)
AuditContextsetParentAttribute in interface AuditContextkey - A key identifying the attribute to set.value - The possibly null new value of the attribute.AuditContext.key(java.lang.Object),
AuditContext.sharedKey(java.lang.Object),
AuditContext.getAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key)public java.lang.Object getChildAttribute(java.lang.Object child,
AuditContext.Key key)
AuditContextAuditContext.enableGetChildAttribute() method must have been invoked
on the context of the child. This method does not search enclosing
contexts.getChildAttribute in interface AuditContextchild - A child of the current construct.key - A key identifying the attribute to set.AuditContext.key(java.lang.Object),
AuditContext.sharedKey(java.lang.Object),
AuditContext.enableGetChildAttribute(),
AuditContext.setAttribute(oracle.jdeveloper.audit.analyzer.AuditContext.Key, java.lang.Object)public void enableGetChildAttribute()
AuditContextAuditContext.getChildAttribute(java.lang.Object, oracle.jdeveloper.audit.analyzer.AuditContext.Key) to get the
the value of an attribute set in this context.public void addDependency(Dependency dependency)
AuditContextaddDependency in interface AuditContextpublic IssueReport report(Rule rule)
AuditContextIssueReport which allows parameters and other
attributes to be added to the issue.
See the class overview for more information.
report in interface AuditContextreport in interface AuditContextCompatibilityrule - The rule violated.public IssueReport report(Rule rule, java.lang.Object construct)
AuditContextIssueReport which allows parameters and
other attributes to be added to the issue.
See the class overview for more information.
report in interface AuditContextreport in interface AuditContextCompatibilityrule - The rule violated.construct - The construct with the issue.public IssueReport report(Rule rule, ModelAdapter model, java.lang.Object construct)
report in interface AuditContextpublic IssueReport report(Rule rule, Location location)
AuditContextIssueReport which allows parameters and other
attributes to be added to the issue.
See the class overview for more information.
report in interface AuditContextreport in interface AuditContextCompatibilityrule - The rule violated.location - The Location of the issue.public SuppressionReport report(SuppressionScheme scheme, java.lang.String name, java.lang.Object construct)
AuditContextSuppressionReport
which allows parameters and other attributes to be added.
A suppression may not be reported for any location before the construct
currently being traversed unless AuditContext.markSuppressionLimit() is used to
relax that restriction (e.g., to allow a suppression to be reported for a
parent while the first child is being traversed).report in interface AuditContextscheme - The scheme to which the suppression belongs.name - A name identifying the issues to suppress.construct - The construct coincident with the scope of the suppression..public SuppressionReport report(SuppressionScheme scheme, java.lang.String name, Location location)
AuditContextSuppressionReport
which allows parameters and other attributes to be added.
A suppression may not be reported for any location before the construct
currently being traversed unless AuditContext.markSuppressionLimit() is used to
relax that restriction (e.g., to allow a suppression to be reported for a
parent while the first child is being traversed).report in interface AuditContextscheme - The scheme to which the suppression belongs.name - A name identifying the issues to suppress.location - The location coincident with the scope of the suppression.public SuppressionReport report(SuppressionScheme scheme, Violation issue)
AuditContextSuppressionReport which allows parameters and other
attributes to be added.
This method may only be called from Analyzer.review(oracle.jdeveloper.audit.analyzer.AuditContext, oracle.jdeveloper.audit.service.Violation) for the issue
being reviewed.report in interface AuditContextscheme - The scheme to which the suppression belongs.issue - The issue currently being reviewed.public void markSuppressionLimit()
AuditContextmarkSuppressionLimit in interface AuditContextpublic void cancel()
public void report(Metric metric, java.lang.Object measurement)
AuditContextreport in interface AuditContextmetric - The metric.measurement - The value that was measured.public void report(Metric metric, int measurement)
AuditContextreport in interface AuditContextmetric - The metric.measurement - The value that was measured.public void report(Metric metric, float measurement)
AuditContextreport in interface AuditContextmetric - The metric.measurement - The value that was measured.public void produceFragment(java.lang.Class<? extends ModelType> fragmentType)
AuditContextproduceFragment in interface AuditContextpublic void produceFragment(java.lang.Class<? extends ModelType> fragmentType, java.lang.Object construct)
AuditContextproduceFragment in interface AuditContextpublic void produceFragment(java.lang.Class<? extends ModelType> fragmentType, Location location)
AuditContextproduceFragment in interface AuditContextpublic java.lang.String toString()
toString in class java.lang.Objectpublic ModelAdapter getModelAdapter()
AuditContextgetModelAdapter in interface AuditContextpublic <T extends ModelAdapter> ModelAdapter getModelAdapter(java.lang.Class<T> type, java.net.URL url, Project project, Workspace workspace)
AuditContextgetModelAdapter in interface AuditContextpublic <T extends ModelAdapter> ModelAdapter getModelAdapter(java.lang.Class<T> type, java.net.URL url)
AuditContextgetModelAdapter in interface AuditContext