Writng a Java class for the static adapter
In creating a static log parser, the extractor, parser and formatter components of the adapter configuration file are replaced with a Java class. The static parser class must implement the interface org.eclipse.hyades.logging.parser.IParser. This can be done by extending the abstract class org.eclipse.hyades.logging.parser.Parser. The following is the standard format required by the Java class.
- public void setConfiguration(Hashtable)
This method is called by the Generic Log Adapter to provide configuration information to the static parser class that is specified by the user in the Import Log File wizard or is provided in the adapter configuration file.- public void preParse()
This is where the initialization work (if applicable) such as estabilishing connections is executed.- pubic void parser(Log)
Implementation of this method is not required. It can be inherited from org.eclipse.hyades.logging.parsers.Parser.- public ICommonBaseEvent[] parseNext()
This method will execute the majority of the logic to parse the log file, such as parsing a set of records and returning an array of Common Base Event objects that represent the data in that set of records.- public void postParse()
This is where any clean up tasks are executed.
Once you have written and tested your Java parser class, you can configure the sensor component of the adapter configuration file to refer to this class. .
Related Concepts
Overview of the Hyades Generic Log Adapter
Common Base Event format specification
Related tasks
Creating a log parser
Creating a static adapter
Configuring the sensor componentRelated references
Adapter Configuration File structure
Adapter Configuration Editor
Regular expression grammar