Express (Distributed operating systems), v8.0 > Troubleshoot and support > Analyzing application server Java system dumps with the IBM Monitoring and Diagnostic Tools for Java - Dump Analyzer > Write a new analysis module or script > Write and running a new analysis module
Dump Analyzer Interfaces
There are very few interfaces involved in writing an analyzer module. These are explained briefly below:-
com.ibm.dtfj.analyzer.ext.IAnalyzerBase
All analyzers must implement this interface. The interface defines a few common attributes that all analyzers should have and methods to access them.
- getName() returns the unique name of this analyzer.
- getVersion() returns the version information for this analyzer.
- getShortDescription() returns the single line description for use when displaying lists of analyzers.
- getLongDescription() returns the long description for use in a help message.
- setContext(IAnalyzerContext) sets the context for this analyzer. An analyzer must implement this and store the context which should be returned to getContext()
- getContext() returns the context associated with this analyzer (see IAnalyzerContext below)
- isPrimaryAnalyzer() returns true if this is a primary analyzer, i.e. an analyzer that is expected to be invoked from the top-level of the tool, as opposed to embedded within some other analyzer.
com.ibm.dtfj.analyzer.ext.IAnalyze
An analyzer should implement this interface if it is intended to do some analysis on the dump and reach a conclusion based on this. The analyzer is made up of a set of 1 or more user defined rules and some analysis that produces output in the form of name=value pairs. The output is then compared to the rules to reach a conclusion. The analysis is split into phases so that a controlling environment (e.g. a script or other analyzer) can make some decisions as the analysis is proceeding. These phases are:-
- doAnalysis() is the first phase which produces results in the form of name=value pairs.
- analyzeResponse() will take the output produced by doAnalysis() and apply an analysis rule to it in order to reach a conclusion i.e. true or false.
- produceReport() will take the output produced by doAnalysis(), apply a specified rule and describe the conclusion in report form.
- listRules() produces a list of the rules which the analyzer can evaluate.
com.ibm.dtfj.analyzer.ext.IReport
An analyzer can implement this interface to produce a human readable report of the key information it has generated. It may contain facts about the dump and/or problems it has found. The report is designed to make it simple to produce final output in a variety of formats such as HTML, XML, raw text etc.
- produceReport() generates a report (using allocateReport()) and add the relevant information.
com.ibm.dtfj.analyzer.base.AnalyzerBase
To simplify the task of implementing an analyzer this abstract base class provides default implementations of most of the methods of IAnalyzerBase. You will need to provide an implementation of getShortDescription and may want to override getVersion and isPrimaryAnalyzer. It also provides some helpful utility methods which are designed to simplify the implementation of the IAnalyze interface.
com.ibm.dtfj.analyzer.ext.IAnalyzerContext
This interface defines common functions that are provided by the tool's infrastructure, that all analyzers can take advantage of. These include the ability to obtain the Java Runtime during analysis. Each analyzer accesses these functions through the context object returned by the getContext() method in IAnalyzerBase.
- getCurrentJavaRuntime() Return a reference to the DTFJ JavaRuntime object that represents the JVM runtime environment currently being analyzed.
- loadAnalyzer() returns a reference to another analyzer, designated by its class name.
- outputMessage() print a message to the user.
- addError() add an error which will be printed in the summary after the analysis.
- allocateReport() allocate a new report ready for the analyzer to add content.
- notifyAnalysisProgress() if the analysis is expected to take significant time then you might want to give the user some feedback on the progress.
com.ibm.dtfj.analyzer.ext.IAnalysisReport
This interface defines report creation capabilities that allow an analyzer to generate output that can easily be transformed into many different formats. There are many methods provided but a few examples should give a flavour of the capabilities.
- startSection() starts a new formatting section which may have a heading and various formatting rules.
- printField() is typically used to print the name and contents of a field. The layout of fields is governed by the formatting of the section.
- printLiteral() is used to print some literal text in the report.
- printReport() includes an embedded report within the current report.
- endSection() ends the current formatting section.
For the javadoc of the analyzer interfaces see ( javadoc).