|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opennms.bb.dp.events.XMLEventsConfParser
The XMLEventsConfParser is a SAX based parser used to decompose an event configuration stream into the corresponding event base classes. The class provides realitivly strong structure checking, but does not require and/or parse an DTD that may proceed the data. This allows the parser to be used with a SAX based SOAP parser, since SOAP prohibits the used of DTDs.
Field Summary | |
private org.xml.sax.Attributes |
m_attributes
The last attributes elements passed to the startElement() method. |
private StringBuffer |
m_data
The buffer where subsequent textual information from the character() method are appendedd. |
private int |
m_depth
The current depth of the elements in the document and the TOS for the m_save member. |
private EventBase |
m_event
The event being currently processes |
private List |
m_events
The list of events from the stream, this is a list of EventBase objects! |
private List |
m_overrides
The header recovered from the event stream |
private int[] |
m_save
The save buffer stack. |
private EventSnmpInfo |
m_snmpInfo
An snmp information block. |
private static int |
SAVE_AUTOACTION
|
private static int |
SAVE_DESCR
|
private static int |
SAVE_DONOTOVERRIDE
|
private static int |
SAVE_EVENT
|
private static int |
SAVE_EVENTS
|
private static int |
SAVE_FORWARD
|
private static int |
SAVE_GLOBAL
|
private static int |
SAVE_IGNORE
|
private static int |
SAVE_LOGGROUP
|
private static int |
SAVE_LOGMSG
|
private static int |
SAVE_MOUSEOVERTEXT
|
private static int |
SAVE_NOTIFICATION
|
private static int |
SAVE_OPERACTION
|
private static int |
SAVE_OPERINSTRUCT
|
private static int |
SAVE_SECURITY
|
private static int |
SAVE_SEVERITY
|
private static int |
SAVE_SNMP
|
private static int |
SAVE_SNMP_EID
|
private static int |
SAVE_SNMP_EIDTEXT
|
private static int |
SAVE_SNMP_GENERIC
|
private static int |
SAVE_SNMP_SPECIFIC
|
private static int |
SAVE_TTICKET
|
private static int |
SAVE_UEI
|
(package private) static String |
TAG_AUTOACTION
|
(package private) static String |
TAG_DESCR
|
(package private) static String |
TAG_DONOTOVERRIDE
|
(package private) static String |
TAG_EID
|
(package private) static String |
TAG_EIDTEXT
|
(package private) static String |
TAG_EVENT
|
(package private) static String |
TAG_EVENTS
|
(package private) static String |
TAG_FORWARD
|
(package private) static String |
TAG_GENERIC
|
(package private) static String |
TAG_GLOBAL
|
(package private) static String |
TAG_LOGGROUP
|
(package private) static String |
TAG_LOGMSG
|
(package private) static String |
TAG_LOGMSGDEST
|
(package private) static String |
TAG_LOGMSGDEST_ATTR_LOGNDISPLAY
|
(package private) static String |
TAG_LOGMSGDEST_ATTR_LOGONLY
|
(package private) static String |
TAG_LOGMSGDEST_ATTR_SUPPRESS
|
(package private) static String |
TAG_MECHANISM
|
(package private) static String |
TAG_MECHANISM_ATTR_SNMPTCP
|
(package private) static String |
TAG_MECHANISM_ATTR_SNMPUDP
|
(package private) static String |
TAG_MECHANISM_ATTR_XMLTCP
|
(package private) static String |
TAG_MECHANISM_ATTR_XMLUDP
|
(package private) static String |
TAG_MOUSEOVERTEXT
|
(package private) static String |
TAG_NOTIFICATION
|
(package private) static String |
TAG_OPERACTION
|
(package private) static String |
TAG_OPERACTIONMENU
|
(package private) static String |
TAG_OPERINSTR
|
(package private) static String |
TAG_SECURITY
|
(package private) static String |
TAG_SEVERITY
|
(package private) static String |
TAG_SNMP
|
(package private) static String |
TAG_SPECIFIC
|
(package private) static String |
TAG_STATE
|
(package private) static String |
TAG_STATE_ATTR_OFF
|
(package private) static String |
TAG_STATE_ATTR_ON
|
(package private) static String |
TAG_TTICKET
|
(package private) static String |
TAG_UEI
|
Constructor Summary | |
XMLEventsConfParser()
Constructs a new default instance of the parser that can be registered with a SAXParser. |
Method Summary | |
void |
characters(char[] data,
int offset,
int length)
Store the characters of the current element in the current element value buffer |
private int |
depthOf(int token)
Returns the depth of a particular SAVE_??? tag. |
void |
endDocument()
Called when the end of the document is reached. |
void |
endElement(String uri,
String localName,
String qName)
At the end of the element store the current element buffer value to the appropriate buffer. |
void |
endPrefixMapping(String prefix)
Ends a prefix to URI mapping. |
void |
error(org.xml.sax.SAXParseException ex)
Throw an exception if there is an error during parse |
void |
fatalError(org.xml.sax.SAXParseException ex)
Throw an exception if there is a fatal error during parse |
List |
getEvents()
Return the events from the parsed stream. |
List |
getOverrides()
Returns the list of events that must be overridden by the event daemon. |
void |
ignorableWhitespace(char[] data,
int offset,
int length)
Ignore the whitespaces |
static void |
main(String[] args)
used for debugging |
void |
processingInstruction(String target,
String data)
Receives processing instructions |
static void |
serializeToXML(OutputStream out,
List events)
Generates a document confomant to this parser from the passed events. |
static void |
serializeToXML(OutputStream out,
List overrides,
List events)
Generates a document confomant to this parser from the passed events. |
static void |
serializeToXML(PrintStream out,
List events)
Generates a document confomant to this parser from the passed events. |
static void |
serializeToXML(PrintStream out,
List overrides,
List events)
Generates a document confomant to this parser from the passed events. |
void |
setDocumentLocator(org.xml.sax.Locator loc)
Sets the document locator. |
void |
skippedEntity(String name)
Recieves notification of a skipped entity. |
void |
startDocument()
Called when the document parsing is beginning. |
void |
startElement(String uri,
String localName,
String qName,
org.xml.sax.Attributes attrs)
Called when a new element is encountered in the document. |
void |
startPrefixMapping(String prefix,
String uri)
Starts a prefix to URI mapping. |
protected boolean |
validate(EventBase e)
Used to validate the event before it is placed onto the actual list of events. |
void |
warning(org.xml.sax.SAXParseException ex)
Throw an exception if there is a warning during parse |
Methods inherited from class java.lang.Object |
|
Field Detail |
static final String TAG_EVENTS
static final String TAG_GLOBAL
static final String TAG_SECURITY
static final String TAG_DONOTOVERRIDE
static final String TAG_EVENT
static final String TAG_UEI
static final String TAG_SNMP
static final String TAG_EID
static final String TAG_EIDTEXT
static final String TAG_SPECIFIC
static final String TAG_GENERIC
static final String TAG_DESCR
static final String TAG_LOGMSG
static final String TAG_LOGMSGDEST
static final String TAG_LOGMSGDEST_ATTR_SUPPRESS
static final String TAG_LOGMSGDEST_ATTR_LOGONLY
static final String TAG_LOGMSGDEST_ATTR_LOGNDISPLAY
static final String TAG_SEVERITY
static final String TAG_OPERINSTR
static final String TAG_AUTOACTION
static final String TAG_OPERACTION
static final String TAG_OPERACTIONMENU
static final String TAG_LOGGROUP
static final String TAG_NOTIFICATION
static final String TAG_TTICKET
static final String TAG_STATE
static final String TAG_STATE_ATTR_ON
static final String TAG_STATE_ATTR_OFF
static final String TAG_FORWARD
static final String TAG_MECHANISM
static final String TAG_MECHANISM_ATTR_SNMPUDP
static final String TAG_MECHANISM_ATTR_SNMPTCP
static final String TAG_MECHANISM_ATTR_XMLUDP
static final String TAG_MECHANISM_ATTR_XMLTCP
static final String TAG_MOUSEOVERTEXT
private static final int SAVE_IGNORE
private static final int SAVE_EVENTS
private static final int SAVE_GLOBAL
private static final int SAVE_SECURITY
private static final int SAVE_DONOTOVERRIDE
private static final int SAVE_EVENT
private static final int SAVE_UEI
private static final int SAVE_SNMP
private static final int SAVE_SNMP_EID
private static final int SAVE_SNMP_EIDTEXT
private static final int SAVE_SNMP_SPECIFIC
private static final int SAVE_SNMP_GENERIC
private static final int SAVE_DESCR
private static final int SAVE_LOGMSG
private static final int SAVE_SEVERITY
private static final int SAVE_OPERINSTRUCT
private static final int SAVE_AUTOACTION
private static final int SAVE_OPERACTION
private static final int SAVE_LOGGROUP
private static final int SAVE_NOTIFICATION
private static final int SAVE_TTICKET
private static final int SAVE_FORWARD
private static final int SAVE_MOUSEOVERTEXT
private StringBuffer m_data
private int[] m_save
private int m_depth
private List m_overrides
private List m_events
private EventBase m_event
private EventSnmpInfo m_snmpInfo
private org.xml.sax.Attributes m_attributes
Constructor Detail |
public XMLEventsConfParser()
Method Detail |
private int depthOf(int token)
token
- The tag to return depth information from.protected boolean validate(EventBase e)
Used to validate the event before it is placed onto the actual list of events. If the method returns true then the event is added to the list. If the method returns false then it is not added to the list.
Additionally, the method is able to modify the values contained in the event if necessary, prior to the event being added to the list of events. Care should be used by all derived classes that implement this behavior.
e
- The event to validatepublic void setDocumentLocator(org.xml.sax.Locator loc)
setDocumentLocator
in interface org.xml.sax.ContentHandler
loc
- The document locator.public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- Thrown if an error occurs
processing the start of the document.public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- Thrown if an error occurs
validating the document semantics.public void startElement(String uri, String localName, String qName, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
uri
- The namespace of the element.localName
- The unqualified name of the element.qName
- The qualified name of the element.attrs
- The attributes for the element.org.xml.sax.SAXException
- Thrown if an error occurs processing
the element.public void endElement(String uri, String localName, String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- Thrown if there is an error during parsepublic void characters(char[] data, int offset, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- if there is an error during parsepublic void ignorableWhitespace(char[] data, int offset, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- if there is an error during parsepublic void processingInstruction(String target, String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
target
- The target of the processing instruction.data
- The processing data.org.xml.sax.SAXException
- Thrown if an an error occurs
during processingpublic void skippedEntity(String name) throws org.xml.sax.SAXException
skippedEntity
in interface org.xml.sax.ContentHandler
name
- The name of the skipped entity.org.xml.sax.SAXException
- Thrown if an an error occurs
during processingpublic void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- The prefix.uri
- The namespace mapping.org.xml.sax.SAXException
- Thrown if an an error occurs
during processingpublic void endPrefixMapping(String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- The prefix that is endingorg.xml.sax.SAXException
- Thrown if an an error occurs
during processingpublic void warning(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
- if there is an error during parsepublic void error(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
- if there is an error during parsepublic void fatalError(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
fatalError
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
- if there is an error during parsepublic List getOverrides()
public List getEvents()
public static void serializeToXML(OutputStream out, List overrides, List events)
out
- The output streamoverrides
- The list of overridesevents
- The list of events to be written.public static void serializeToXML(PrintStream out, List overrides, List events)
out
- The output streamoverrides
- The list of overrides.events
- The list of events to be written.public static void serializeToXML(OutputStream out, List events)
out
- The output streamevents
- The list of events to be written.public static void serializeToXML(PrintStream out, List events)
out
- The output streamevents
- The list of events to be written.public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |