WebNMS CLI 2.0 API Specification

com.adventnet.util.parser
Interface ParserInterface

All Known Implementing Classes:
GenericParser, LineParser

public interface ParserInterface

This interface should be implemented by the user to parse his own Parsing rule structure. The implementation for this class should be specified in the Parser Configuration file.


Method Summary
 void init()
          This method is called by the Parser API for initialization (such as loading of configuration files, etc.).
 java.lang.Object parseMessage(java.lang.String message, java.lang.String command)
          This method is called by the ParserAPI when a Response is to be parsed.
 void parseRules(java.lang.String[] commands, java.lang.String[] rules)
          This method is called by the ParserAPI when a Rule needs to be parsed.
 

Method Detail

init

public void init()
          throws ParseException
This method is called by the Parser API for initialization (such as loading of configuration files, etc.).
Throws:
ParseException - if any error occurs during initialisation

parseMessage

public java.lang.Object parseMessage(java.lang.String message,
                                     java.lang.String command)
                              throws ParseException
This method is called by the ParserAPI when a Response is to be parsed. The command parameter is used to identify a particular rule with which the response is to be parsed. The Parsed result is returned as any user Object.
Parameters:
message - the Response message.
command - the Command which produced the response messsage.
Returns:
the parsed result as any user Object
Throws:
ParseException - if any error occurs while parsing the response message.

parseRules

public void parseRules(java.lang.String[] commands,
                       java.lang.String[] rules)
                throws ParseException
This method is called by the ParserAPI when a Rule needs to be parsed. The rule could be a String in XML format or any other string. The list of commands (the command String array) denotes the commands to which this rule belongs.
Parameters:
commands - The list of commands for whose response the rule is to be applied.
rule - the Parsing rule which is required to be parsed.
Throws:
ParseException - if any error occurs while parsing the rule

WebNMS CLI 2.0 API Specification