|
Tivoli Confidential | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tivoli.tec.event_delivery.TECEvent
TECEvent encapsulates the code for parsing event strings into a class name and name/value pairs. Unfortunately there is not a clearly documented formal specification of the event string syntax.
Below is the syntax this class will accept. First here are the token definitions:
Tokens ------ SEMICLN := ";" EQUALS := "=" CNTRL_A := "\001" ID := Any non-empty sequence of characters from the set a-z,A-Z,0-9,_,-,. containing at least one character from a-z,A-Z STRING := Begins and ends with either single quotes or double quotes Any embedded quotes that are the same as beign used to delimitnate the string must be escaped with the same quote character. For example: - 'embedded single(')' would be written 'embedded single('')' - "embedded double(")" would be written "embedded double("")" - "embedded single(')" would be written "embedded single(')" Other than that the only other restriction on STRING tokens is that they can't contain the NUL character ('\000') or control-A ('\001'). VALUE := Any non-empty sequence of characters excluding all ASCII control characters (" " - ""), the space character (" "), the single quote ("'"), the equals sign ("="), and the semi-colon (";"). EMPTY_STRING := This token represents either an empty string. No quotes are needed for this value.One oddball token in the above is the CNTRL_A character. This character is used to terminate event data when sent over the wire and life is easier if allow it to appear as a terminating character in event strings here. Another oddball token in the above is VALUE and there is an ambiguity because all ID tokens are also valid VALUE tokens. Given these tokens, a legal event string has the following form:
ID SEMICLN ( ID = (STRING | VALUE | EMPTY_STRING) SEMICLN )* "END" [CNTRL_A]The first ID token is the class name, the sequence of instances of "ID=(STRING|VALUE);" specify the slot/value pairs, and "END" marks the end of the event. The teminating character ^A is optional. Each ID used as a slot name must be unique with respect to all the other IDs used as slot names and the slot name can't be "END". Before and after any of the tokens in an event string, there can be an arbitrary amount of whitespace (characters " ", "\t", "\r", "\n") with one exception. Nothing can appear after the terminating ^A if it's present. Here are some examples of valid event strings:
Class1; msg='embedded quote ''.' ; hostname=artemis; END Class2;END^A Class3; msg = theMessage ; END Class4; msg='Here''s a newline rest of msg'; END
Field Summary | |
---|---|
static char |
MIN_EVENT_LEN
Minimum length an event string can have and still have the possibility of being syntactically correct. |
static char |
TECAD_EVENT_END_CHAR
Character used to terminate event data when it's sent over the wire. |
Constructor Summary | |
---|---|
TECEvent()
|
Method Summary | |
---|---|
String |
className()
Retrieves The class name of the TECEvent object. |
static TECEvent[] |
convert(String events,
com.ibm.logging.ILogger edLogger,
com.ibm.logging.ILogger edTrace)
|
static String |
convert(TECEvent[] events)
|
String |
getSlot(String slotName)
Retrieves the value for the slot named slotName. |
boolean |
init(String event)
Parse the string event into the class name and slot/value pairs. |
static void |
main(String[] argv)
Main program for debug testing only. Usage "TECEvent |
static String |
normalizeEvEnd(String event)
Returns a string defining the same event as event, but you are guaranteed that the string ends w/ a newline followed by the character TECAD_EVENT_END_CHAR. |
boolean |
setClassName(String name)
Sets the class name of the TECEvent object. |
void |
setFilterEvent()
|
boolean |
setSlot(String slot,
String value)
Sets the slot name slot to value. |
boolean |
skippedWhitespace()
After calling init() you can call this function to find out if the event string parsed by init() contained any extraneous whitespace characters (' ', '\t', '\r', and '\n') that were skipped over during the parse. |
Enumeration |
slots()
Returns an Enumeration of the slot names in the event. |
String |
toString()
Produces the same result as calling toString(false). |
String |
toString(boolean compact)
Produces a string representation of the event in valid TEC event syntax (as defined in the class comments above). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final char TECAD_EVENT_END_CHAR
public static final char MIN_EVENT_LEN
Constructor Detail |
public TECEvent()
Method Detail |
public boolean init(String event)
event
- the event string to be parsed.
public boolean skippedWhitespace()
public String className()
public boolean setClassName(String name)
public String getSlot(String slotName)
public boolean setSlot(String slot, String value)
public Enumeration slots()
public String toString(boolean compact)
compact
- If true then no extra whitespace is in formatting
the String representing the event. If false, then spaces and
newlines are used to make the String representation of the
event "pretty".public String toString()
public static String normalizeEvEnd(String event)
public static TECEvent[] convert(String events, com.ibm.logging.ILogger edLogger, com.ibm.logging.ILogger edTrace)
public static String convert(TECEvent[] events)
public static void main(String[] argv)
public void setFilterEvent()
|
Tivoli Confidential | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |