|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTranslatableAnalyzer
com.ibm.dtfj.analyzer.base.AnalyzerBase
public abstract class AnalyzerBase
Define a convenience base class for a set of analysers that will implement the IAnalyzer interfaces.
Constructor Summary | |
---|---|
protected |
AnalyzerBase()
|
Method Summary | |
---|---|
IAnalysisReport |
allocateReport()
A helper function to allocate a report to hold analysis results |
int |
analyzeResponse(java.lang.String[] response,
java.lang.String ruleName)
When the analysis has been done and produced some strings we need to decide what to do next. |
protected DTFJIterator |
buildSafeIterator(java.util.Iterator it)
A simple approach to handling corrupt data from DTFJ. |
protected DTFJIterator |
buildSortedIterator(java.util.Iterator it)
A simple approach to handling corrupt data and imposing ordering on the iterators that come back from DTFJ. |
void |
defineRule(java.lang.String name,
java.lang.String[] rules)
Define a rule which can be executed in order to analyse the response from this analyzer. |
int |
getCachingPriority()
Return an indication of how desirable it is for the AnalyzerContext to cache instances of this analyzer, so that multiple calls to loadAnalyzer() will return the cached instance instead of allocating and initializing a new one each time. |
java.lang.String[] |
getCategories()
|
IAnalyzerContext |
getContext()
(non-Javadoc) |
java.lang.String |
getLongDescription()
Return a description of the analyzer purpose. |
java.lang.String |
getName()
Get the name of the analyzer. |
java.lang.String |
getResourceBundleName()
AnalyzerBase uses AnalyzerBase.properties because it is not derived from MessageLogger |
abstract java.lang.String |
getShortDescription()
Return a short description of the analyzer purpose. |
static int |
getState(java.lang.String state)
A simple helper function to assist the rule checking process when converting from a state defined as a string to a state defined as an integer. |
static java.lang.String |
getStateString(int state)
A simple helper function to assist the rule checking process when converting from a state defined as an integer to a state defined as a string. |
protected int |
getTotalCorruptDataErrors()
Return the total number of CorruptDataExceptions reported against this analyzer. |
protected int |
getTotalDataUnavailable()
Return the total number of DataUnavailable errors reported against this analyzer. |
protected int |
getTotalErrors()
Return the total number of errors reported against this analyzer (includes all DataUnavailable, CorruptData ,UnexpectedNullException,NullPointerException and other errors found). |
protected int |
getTotalNullPointerExceptions()
Return the total number of NullPointerExceptions reported against this analyzer. |
protected int |
getTotalOtherErrors()
Return the total number of errors that were reported against this analyzer and were not DataUnavailable or CorruptDataExceptions . |
protected int |
getTotalUnexpectedNullExceptions()
Return the total number of UnexpectedNullExceptions reported against this analyzer. |
java.lang.String |
getVersion()
Get the version of the analyzer. |
void |
handleError(java.lang.String err,
java.lang.Exception e)
To be used by analyzers and utility classes to handle any exceptions thrown during an analyzer run. |
void |
handleTypeError(java.lang.String err,
java.lang.Object obj)
To be used by analyzers and utility classes to handle any type exceptions thrown during an analyzer run, for example, if the analyzer was expecting a JavaHeap object but didn't find one then this method should be called to handle this. |
boolean |
isPrimaryAnalyzer()
Some Analyzers are designed to perform analysis tasks and others are designed to perform supporting tasks such as wrapping a DTFJ object and providing extra information. |
java.lang.String[] |
listRules()
List the rules which have been defined for this analyzer. |
void |
logTranslatedMessage(java.util.logging.Level level,
java.lang.String msg,
java.lang.Throwable exc,
IAnalysisReport report)
Add the analyzer name to the exception message |
IAnalysisReport |
produceReport(java.lang.String[] response,
java.lang.String rule,
int state)
When the response has been analysed we have produced some state value. |
void |
setContext(IAnalyzerContext a)
(non-Javadoc) |
static int |
testRules(java.lang.String[] xrules,
java.lang.String[] response)
Match some responses against a set of rules. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AnalyzerBase()
Method Detail |
---|
public final void setContext(IAnalyzerContext a)
setContext
in interface IAnalyzerBase
a
- - the context to be associated with this analyserIAnalyzerBase.setContext(com.ibm.dtfj.analyzer.ext.IAnalyzerContext)
public IAnalyzerContext getContext()
getContext
in interface IAnalyzerBase
IAnalyzerBase.getContext()
public java.lang.String getName()
getName
in interface IAnalyzerBase
public java.lang.String getVersion()
getVersion
in interface IAnalyzerBase
public java.lang.String[] getCategories()
getCategories
in interface IAnalyzerBase
null
- "no category" should be indicated by an empty array or
an empty string.IAnalyzerBase.getCategories()
public abstract java.lang.String getShortDescription()
getShortDescription
in interface IAnalyzerBase
public java.lang.String getLongDescription()
getLongDescription
in interface IAnalyzerBase
public void handleError(java.lang.String err, java.lang.Exception e)
err
- - the error message to be associated with the exceptione
- - the exception to be handledpublic void handleTypeError(java.lang.String err, java.lang.Object obj)
err
- - the error message to be associated with the type errorobj
- - the unexpected object that was foundpublic void logTranslatedMessage(java.util.logging.Level level, java.lang.String msg, java.lang.Throwable exc, IAnalysisReport report)
protected int getTotalErrors()
protected int getTotalDataUnavailable()
protected int getTotalCorruptDataErrors()
protected int getTotalUnexpectedNullExceptions()
protected int getTotalNullPointerExceptions()
protected int getTotalOtherErrors()
public int analyzeResponse(java.lang.String[] response, java.lang.String ruleName)
response
- - the set of strings which was produced by running this analyzerruleName
- - the rule which we are analysing
public void defineRule(java.lang.String name, java.lang.String[] rules)
name
- - the name of the rulerules
- - the set of strings defining the rulepublic java.lang.String[] listRules()
public IAnalysisReport produceReport(java.lang.String[] response, java.lang.String rule, int state)
response
- - the set of strings which was produced by running this analyzerrule
- - the rule which we are analysingstate
- - the value returned from analyseResponse.
public static int getState(java.lang.String state)
state
- - the state as a string
public static java.lang.String getStateString(int state)
state
- - the state as an int
public static int testRules(java.lang.String[] xrules, java.lang.String[] response)
xrules
- the set of rules to applyresponse
- the set of responses from the analyzer
public IAnalysisReport allocateReport()
public int getCachingPriority()
IAnalyzerBase
getCachingPriority
in interface IAnalyzerBase
The implementation in the base class returns 10, meaning all analyzers
in this group are cacheable unconditionally.
public boolean isPrimaryAnalyzer()
IAnalyzerBase
isPrimaryAnalyzer
in interface IAnalyzerBase
IAnalyzerBase.isPrimaryAnalyzer()
protected DTFJIterator buildSafeIterator(java.util.Iterator it)
it
- a DTFJ iterator that returns corrupt objects
protected DTFJIterator buildSortedIterator(java.util.Iterator it)
it
- a DTFJ iterator that returns corrupt objects
public java.lang.String getResourceBundleName()
com.ibm.dtfj.analyzer.util.TranslatableMessageLogger#getResourceBundleName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |