|
AdventNet CLI 2.0 API Specification | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.adventnet.util.parser.generic.MessageParser
This class parses a message stream and splits it into String tokens based on Delimiter definitions in an XML File. This class can be used to parse the CLI Responses obtained from the syncSend() or send() method in the CLISession.
| Constructor Summary | |
MessageParser()
Constructor for the Parser. |
|
MessageParser(java.lang.String rulesFile)
Constructor for the Parser. |
|
| Method Summary | |
java.util.Vector |
getMatchList()
Gets the Parameters extracted from the Response as a Vector of Hashtables. |
java.lang.String |
getRulesFileName()
Gets the Rule File name. |
java.lang.String |
getVersion()
Gets the Message Parser version in the XML. |
java.util.Vector |
parseIntoTokens(java.lang.String message)
Splits the message into tokens based on the Delimiter. |
void |
parseRule(java.lang.String rule)
Parses the rule given as a String. |
void |
setRulesFileName(java.lang.String rulesFileName)
Sets the Rule File name. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public MessageParser()
throws ParseException
public MessageParser(java.lang.String rulesFile)
throws ParseException
rulesFile - the Rule file name (eg an XML file name).| Method Detail |
public void parseRule(java.lang.String rule)
throws ParseException
rule - the rule as a Stringpublic java.lang.String getRulesFileName()
public void setRulesFileName(java.lang.String rulesFileName)
throws ParseException
rulesFileName - the xml File name.public java.lang.String getVersion()
public java.util.Vector parseIntoTokens(java.lang.String message)
message - the message to parse (eg the CLI response).For example to parse a CLI response do the following:
try{
MessageParser cliParser = new MessageParser("test.xml");
Vector tokens = cliParser.parseIntoTokens(mesg);
Enumeration en = tokens.elements();
while(en.hasMoreElements()){
System.out.println(en.nextElement());
}
}catch(Exception e){
System.out.println("Error while parsing message:");
System.out.println(e);
System.exit(1);
}
Assuming the 'mesg' contains the message and test.xml the rules XML
file.public java.util.Vector getMatchList()
|
AdventNet CLI 2.0 API Specification | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||