|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.echomine.jabber.DefaultMessageParser
public class DefaultMessageParser
Contains a list of message parsers. Essentially, for each type of message, there should be a registered parser for it that will be able to process the incoming data.
When a handler receives a message, it will lookup a message class name that can be instantiated to parse the incoming message. Thus, for each custom message that you create, you should register that message's class name. This includes classes that are contained inside the IQ Message. In fact, the way that the IQMessageParser works is it calls this class again to retrieve a second parser for the message contained inside the IQ Message.
Field Summary |
---|
Constructor Summary | |
---|---|
DefaultMessageParser()
|
Method Summary | |
---|---|
JabberMessage |
createMessage(java.lang.String qName,
Namespace ns,
Element msgTree)
instantiate a message object by looking at the DOM tree. |
void |
removeParser(java.lang.String qName,
Namespace ns)
removes the message parser associated with a specific namespace tag |
void |
setParser(java.lang.String qName,
Namespace ns,
java.lang.String msgClass)
sets a message parser to handle a specific namespace. |
boolean |
supportsParsingFor(java.lang.String qName,
Namespace ns)
checks whether a parser is registered for the specified qname and namespace |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultMessageParser()
Method Detail |
---|
public boolean supportsParsingFor(java.lang.String qName, Namespace ns)
public void removeParser(java.lang.String qName, Namespace ns)
public void setParser(java.lang.String qName, Namespace ns, java.lang.String msgClass) throws ParseException
qName
- the fully qualified tag namens
- the Namespace for the tag elementmsgClass
- the message class that will be instantiated
ParseException
- thrown when class is not found or class is not a message parserpublic JabberMessage createMessage(java.lang.String qName, Namespace ns, Element msgTree) throws MessageNotSupportedException
createMessage
in interface JabberMessageParser
MessageNotSupportedException
- if no class is able to parse this message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |