com.echomine.jabber
Class JDOMMessageHandler

java.lang.Object
  extended by com.echomine.jabber.JabberMessageHandler
      extended by com.echomine.jabber.JDOMMessageHandler
Direct Known Subclasses:
JDOMXMessageHandler

public class JDOMMessageHandler
extends JabberMessageHandler

The JDOM MessageHandler is the default handler for all incoming messages. It simply takes all incoming messages and put them into a JDOM tree structure that can later be queried and manipulated. JDOM is provided as part of the distribution.

Normally, this will be the base class for all other message handlers. "Subhandlers" normally work directly with the DOM tree and don't have to worry about SAX events. If you're not interested in using JDOM as the base handler, you can create your own MessageHandler and handle the messages your own way.


Constructor Summary
JDOMMessageHandler(JabberMessageParser msgParser)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          the methods that must be implemented to work with the XML content that's coming in
 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
 void endMessage()
          This method is called when the end of the message is reached.
 Element getDOM()
          obtains the DOM tree that is associated with this message handler.
 JabberMessage getMessage()
          the method actually has the parser parse the message.
 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
 void startMessage()
          This method is called when the beginning of the message is received.
 
Methods inherited from class com.echomine.jabber.JabberMessageHandler
getMessageParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDOMMessageHandler

public JDOMMessageHandler(JabberMessageParser msgParser)
Method Detail

startMessage

public void startMessage()
This method is called when the beginning of the message is received. Any sort of resetting or initializing should be done here.

Specified by:
startMessage in class JabberMessageHandler

endMessage

public void endMessage()
This method is called when the end of the message is reached. Any sort of resetting or destroying should be done here. Normally, nothing needs to be done, but you may need to do some post processing if you want.

Specified by:
endMessage in class JabberMessageHandler

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attr)
Description copied from class: JabberMessageHandler
the methods that must be implemented to work with the XML content that's coming in

Specified by:
startElement in class JabberMessageHandler

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
Description copied from class: JabberMessageHandler
the methods that must be implemented to work with the XML content that's coming in

Specified by:
endElement in class JabberMessageHandler

characters

public void characters(char[] ch,
                       int start,
                       int length)
Description copied from class: JabberMessageHandler
the methods that must be implemented to work with the XML content that's coming in

Specified by:
characters in class JabberMessageHandler

getDOM

public Element getDOM()
obtains the DOM tree that is associated with this message handler. It is recommended that you call this method AFTER endMessage() has been called.


getMessage

public JabberMessage getMessage()
the method actually has the parser parse the message. If parser is not found for a message, it will create a default JabberJDOMMessage.

Specified by:
getMessage in class JabberMessageHandler


Copyright © 2001-2005 Echomine. All Rights Reserved.