class XMLHandler extends java.lang.Object implements DocHandler
| Modifier and Type | Field and Description |
|---|---|
private HashMap<java.lang.String,java.lang.Boolean> |
analyzeMembers
Just stores whether the most detailed type of annotation attachment per
class is a member (true) or not (false).
|
private HashMap<java.lang.String,AnnotationBuilderMap> |
configuration
Stores the configuration, i.e. a mapping from signatures to annotation
types to annotation builders.
|
private ArrayList<PathElement> |
currentPath
Stores the current path of modules and namespaces.
|
private boolean |
exclusive
Stores if this configuration is exclusive, i.e. authoritative or if it may
overlap with source code annotations.
|
private HashMap<java.lang.String,MonitoringGroupConfiguration> |
groupConfigurations
Stores the monitoring group configurations collected during XML file
reading.
|
private boolean |
hasPatterns
Stores whether this configuration contains patterns.
|
private ArrayList<Pattern> |
patterns
Stores the patterns collected during XML file reading.
|
private ArrayList<Pattern> |
patternStack
Stores the actual stack of patterns as read from the XML file.
|
private static java.lang.String |
TAG_MONITOR
Defines the name of the "monitor" tag/annotation.
|
private ArrayList<AnnotationBuilder<?>> |
templateStack
Stores the actual stack of annotation builders as read from the XML file.
|
private HashMap<java.lang.String,java.lang.String> |
unresolvedConfigurations
Stores referenced but unresolved configurations (temporary attribute,
to be resolved at the end of processing.
|
| Constructor and Description |
|---|
XMLHandler() |
| Modifier and Type | Method and Description |
|---|---|
private void |
appendToCurrentPath(PathElement.Type type,
java.lang.String name,
java.lang.String pattern)
Appends a name to the current path.
|
private boolean |
currentPathContainsPattern()
Returns whether the current path contains a pattern.
|
void |
endDocument()
Receive notification of the end of the document.
|
void |
endElement(java.lang.String tag)
Ends reading an element.
|
(package private) HashMap<java.lang.String,java.lang.Boolean> |
getAnalyzeMembers()
Returns the mapping between class names and whether code analysis of
members is required according to the configuration.
|
private Pattern |
getClosestPattern()
Returns the closest pattern.
|
(package private) HashMap<java.lang.String,AnnotationBuilderMap> |
getConfiguration()
Returns the configuration constructed while reading an XML file.
|
private java.lang.String |
getCurrentPath(boolean asRegEx)
Returns the current path by calculating it from the path elements.
|
(package private) HashMap<java.lang.String,MonitoringGroupConfiguration> |
getGroupConfigurations()
Returns the monitoring group configurations identified while reading an
XML file.
|
(package private) ArrayList<Pattern> |
getPatterns()
Returns the patterns identified while reading an XML file.
|
(package private) boolean |
isExclusive()
Returns whether this configuration is exclusive, i.e. source code
annotations should not be considered.
|
private PathElement.Type |
modifyPath(java.lang.String tag,
HashMap<java.lang.String,java.lang.String> attributes)
Modifies the path according to the name of the element and its
attributes.
|
private Pattern |
parsePatterns(PathElement.Type type,
java.lang.String currentPath,
java.lang.String typeOf,
AnnotationBuilder<?> template)
Registers the given pattern for the current path and parses, if provided,
the type restrictions in
typeOf. |
private void |
recordAnnotationLevel()
Records the (deepest) annotation level for the current path.
|
private Pattern |
registerPattern(java.lang.String currentPath,
java.lang.String typeOf,
AnnotationBuilder<?> template)
Registers the given pattern (for the current path and if provided the
type restriction).
|
private void |
removeLastFromCurrentPath()
Removes the last name from the current path.
|
private void |
setMonitorAnnotationConfigurationDefaults(AnnotationBuilder<?> builder,
HashMap<java.lang.String,java.lang.String> attributes)
Sets configuration defaults for the monitor annotation.
|
private void |
setPlainTime()
Sets
analyzeMembers based on already read configuration settings, in particular whether we are
instrumenting for plain time resources only. |
void |
startDocument()
Start of an XML Document.
|
void |
startElement(java.lang.String tag,
HashMap<java.lang.String,java.lang.String> attributes)
Start of an XML Element.
|
void |
text(java.lang.String str)
Text node content.
|
private static final java.lang.String TAG_MONITOR
private HashMap<java.lang.String,AnnotationBuilderMap> configuration
private HashMap<java.lang.String,java.lang.Boolean> analyzeMembers
private boolean exclusive
true.private ArrayList<AnnotationBuilder<?>> templateStack
private ArrayList<Pattern> patternStack
private ArrayList<PathElement> currentPath
private HashMap<java.lang.String,MonitoringGroupConfiguration> groupConfigurations
private HashMap<java.lang.String,java.lang.String> unresolvedConfigurations
private boolean hasPatterns
boolean isExclusive()
true if this configuration is exclusive,
false elseHashMap<java.lang.String,java.lang.Boolean> getAnalyzeMembers()
HashMap<java.lang.String,AnnotationBuilderMap> getConfiguration()
ArrayList<Pattern> getPatterns()
HashMap<java.lang.String,MonitoringGroupConfiguration> getGroupConfigurations()
private void appendToCurrentPath(PathElement.Type type, java.lang.String name, java.lang.String pattern)
type - the type of the path elementname - the name to be appendedpattern - the pattern or nullprivate void removeLastFromCurrentPath()
private void setPlainTime()
analyzeMembers based on already read configuration settings, in particular whether we are
instrumenting for plain time resources only.private boolean currentPathContainsPattern()
true for pattern, false elseprivate java.lang.String getCurrentPath(boolean asRegEx)
asRegEx - should the result be given as a matching regular
expressionprivate PathElement.Type modifyPath(java.lang.String tag, HashMap<java.lang.String,java.lang.String> attributes)
tag - the name of the elementattributes - the attributes of tag, may be
null in order to trigger removal of the last path
element if the current XML element allows thisprivate void recordAnnotationLevel()
public void startElement(java.lang.String tag,
HashMap<java.lang.String,java.lang.String> attributes)
throws QdParserException
startElement in interface DocHandlertag - element nameattributes - element attributesQdParserException - parse errorprivate Pattern getClosestPattern()
private void setMonitorAnnotationConfigurationDefaults(AnnotationBuilder<?> builder, HashMap<java.lang.String,java.lang.String> attributes)
builder - the annotation builderattributes - the actual attributesprivate Pattern parsePatterns(PathElement.Type type, java.lang.String currentPath, java.lang.String typeOf, AnnotationBuilder<?> template) throws QdParserException
typeOf.type - the type of the path elementcurrentPath - the current path (to the specified elements)typeOf - the type restriction (may be multiple separated by commas,
may be one, may be empty, may be null)template - the annotation templateQdParserException - in case of any parsing/interpretation errorprivate Pattern registerPattern(java.lang.String currentPath, java.lang.String typeOf, AnnotationBuilder<?> template) throws QdParserException
currentPath - the current path (to the specified elements)typeOf - a type restriction, i.e. the name of an interface or a
class or nulltemplate - the annotation templateQdParserException - in case of any parsing/interpretation errorpublic void endElement(java.lang.String tag)
throws QdParserException
endElement in interface DocHandlertag - the element nameQdParserException - in case of reading errorspublic void endDocument()
throws QdParserException
unresolvedConfigurations.
By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of a document (such as finalising a tree or closing an output file).
endDocument in interface DocHandlerQdParserException - in case of reading errorspublic void text(java.lang.String str)
throws QdParserException
text in interface DocHandlerstr - node contentQdParserException - parse errorpublic void startDocument()
throws QdParserException
startDocument in interface DocHandlerQdParserException - parse error