|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.echomine.jabber.JabberMessageHandler
public abstract class JabberMessageHandler
Handles incoming message and creates the proper message object to contain the incoming parse data. It is pretty much a message processor. The handler works in conjunction with the Message Builder, but it doesn't always need to use the message builder.
The way message handling works is pretty simple.
1. message comes in through the low-level sax content handler.
2. content handler looks up a list of handler that can handle incoming elements.
3. content obtain reference of the handler and delegates the rest of the data to the handler.
4. handler receives data, creating new message objects each time that it is called to start a new object. Optionally, the
handler can delegate the task of creating new message objects to the Message Builders (this is default behavior for the
module).
5. message is then sent out to the message listener.
Pretty much each message type will require its own message handler OR message builder. Most of the time you will not need to create a message handler unless it's your desire to work directly with the SAX events (ie. you are not interested in using JDOM for DOM processing). Register a message builder and you are good to go.
The way the methods here are called is very similar to the way SAX Handlers are called.
1. when a new message starts, startMessage() is called. (same as startDocument).
2. Elements are then received through startElement() and endElement().
3. When the end of the message is reached, endMessage() is called.
4. Then getMessage() will hand it off to a message builder to instantiate a message object of the approriate type.
Note that the first element received through startElement() is the beginning of the message itself.
Constructor Summary | |
---|---|
JabberMessageHandler(JabberMessageParser msgParser)
|
Method Summary | |
---|---|
abstract void |
characters(char[] ch,
int start,
int length)
the methods that must be implemented to work with the XML content that's coming in |
abstract void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
the methods that must be implemented to work with the XML content that's coming in |
abstract void |
endMessage()
This method is called when the end of the message is reached. |
abstract JabberMessage |
getMessage()
|
JabberMessageParser |
getMessageParser()
|
abstract void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attr)
the methods that must be implemented to work with the XML content that's coming in |
abstract void |
startMessage()
This method is called when the beginning of the message is received. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JabberMessageHandler(JabberMessageParser msgParser)
Method Detail |
---|
public JabberMessageParser getMessageParser()
public abstract void startMessage()
public abstract void endMessage()
public abstract void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attr)
public abstract void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
public abstract void characters(char[] ch, int start, int length)
public abstract JabberMessage getMessage()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |