com.echomine.jabber.msg
Class XMLRPCMessage

java.lang.Object
  extended by com.echomine.jabber.JabberMessage
      extended by com.echomine.jabber.JabberJDOMMessage
          extended by com.echomine.jabber.AbstractJabberMessage
              extended by com.echomine.jabber.JabberIQMessage
                  extended by com.echomine.jabber.msg.XMLRPCMessage
All Implemented Interfaces:
JabberCode, JabberMessageParsable

public class XMLRPCMessage
extends JabberIQMessage
implements JabberCode

sends and receives an XMLRPC message over Jabber's namespace. This message will be able to submit a method call, parse an incoming response, etc. Note that the message is specifically targeted for client-side use. It will allow you to create a method call for the request. Any incoming messages from the server is considered a response message.

Current Implementation: JEP-0009 Version 2.0


Field Summary
static int XMLRPC_CALL
           
static int XMLRPC_RESPONSE
           
 
Fields inherited from class com.echomine.jabber.JabberIQMessage
TYPE_GET, TYPE_RESULT, TYPE_SET
 
Fields inherited from class com.echomine.jabber.AbstractJabberMessage
TYPE_ERROR
 
Fields inherited from class com.echomine.jabber.JabberMessage
messageID
 
Fields inherited from interface com.echomine.jabber.JabberCode
MSG_CHAT, MSG_INIT, MSG_IQ, MSG_IQ_AGENTS, MSG_IQ_AUTH, MSG_IQ_BROWSE, MSG_IQ_DISCO_INFO, MSG_IQ_DISCO_ITEMS, MSG_IQ_GATEWAY, MSG_IQ_LAST, MSG_IQ_OOB, MSG_IQ_PRIVATE, MSG_IQ_REGISTER, MSG_IQ_ROSTER, MSG_IQ_SEARCH, MSG_IQ_TIME, MSG_IQ_VACATION, MSG_IQ_VCARD, MSG_IQ_VERSION, MSG_IQ_XMLRPC, MSG_PRESENCE, MSG_UNKNOWN, MSG_X_DATA, MSG_X_DELAY, MSG_X_EVENT, MSG_X_EXPIRE, MSG_X_OOB, MSG_X_PGP_ENCRYPTED, MSG_X_PGP_SIGNED, MSG_X_ROSTER, PARSER_CHAT, PARSER_IQ, PARSER_IQ_AGENTS, PARSER_IQ_AUTH, PARSER_IQ_BROWSE, PARSER_IQ_DISCO_INFO, PARSER_IQ_DISCO_ITEMS, PARSER_IQ_GATEWAY, PARSER_IQ_LAST, PARSER_IQ_OOB, PARSER_IQ_PRIVATE, PARSER_IQ_REGISTER, PARSER_IQ_ROSTER, PARSER_IQ_SEARCH, PARSER_IQ_TIME, PARSER_IQ_VACATION, PARSER_IQ_VCARD, PARSER_IQ_VERSION, PARSER_IQ_XMLRPC, PARSER_PRESENCE, PARSER_X_DATA, PARSER_X_DELAY, PARSER_X_EVENT, PARSER_X_EXPIRE, PARSER_X_OOB, PARSER_X_PGP_ENCRYPTED, PARSER_X_PGP_SIGNED, PARSER_X_ROSTER, XMLNS_CHAT, XMLNS_ERROR_STANZA, XMLNS_ERROR_STREAM, XMLNS_IQ, XMLNS_IQ_AGENTS, XMLNS_IQ_AUTH, XMLNS_IQ_BROWSE, XMLNS_IQ_DISCO_INFO, XMLNS_IQ_DISCO_ITEMS, XMLNS_IQ_GATEWAY, XMLNS_IQ_LAST, XMLNS_IQ_OOB, XMLNS_IQ_PRIVATE, XMLNS_IQ_REGISTER, XMLNS_IQ_ROSTER, XMLNS_IQ_SEARCH, XMLNS_IQ_TIME, XMLNS_IQ_VACATION, XMLNS_IQ_VCARD, XMLNS_IQ_VERSION, XMLNS_IQ_XMLRPC, XMLNS_PRESENCE, XMLNS_STREAM, XMLNS_X_DATA, XMLNS_X_DELAY, XMLNS_X_EVENT, XMLNS_X_EXPIRE, XMLNS_X_OOB, XMLNS_X_PGP_ENCRYPTED, XMLNS_X_PGP_SIGNED, XMLNS_X_ROSTER
 
Constructor Summary
XMLRPCMessage()
          constructs a default XMLRPC message.
XMLRPCMessage(Call call)
           
XMLRPCMessage(Response response)
           
 
Method Summary
 java.lang.String encode()
          the method is overridden to provide some sanity checks before sending the data out.
 Call getCall()
          retrieves the call object if there is one for this message.
 ErrorMessage getErrorMessage()
          this will retrieve the error if this message is an error message.
 int getMessageType()
          the default message type is unknown.
 Response getResponse()
          retrieves the response object if there is one for this message.
 int getXMLRPCType()
          get the type for this XMLRPC message, whether it is a request or response type.
 boolean isCall()
          convenience methods to check if the messag is a call/request
 boolean isError()
          checks to see if the message is an error message.
 boolean isResponse()
          convenience methods to check if the messag is a response
 JabberMessage parse(JabberMessageParser parser, Element msgTree)
          parses the message.
 void setCall(Call call)
          sets the call request for this message to be sent.
 void setFactory(SerializerFactory factory)
          Sets a custom serializer factory instead of using the default one.
 void setResponse(Response response)
          sets the response for this message to be sent.
 
Methods inherited from class com.echomine.jabber.AbstractJabberMessage
getFrom, getTo, getType, setErrorMessage, setFrom, setTo, setType
 
Methods inherited from class com.echomine.jabber.JabberJDOMMessage
getDOM, getXMLOutputter, setMessageID, toString
 
Methods inherited from class com.echomine.jabber.JabberMessage
getMessageID, getReplyMessage, getTimeout, getXMessage, getXMessages, interrupt, isReplyRequired, isSendXMessages, isSynchronized, replyReceived, setReplyRequired, setSendXMessages, setSynchronized, setTimeout, setXMessage, setXMessages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XMLRPC_CALL

public static final int XMLRPC_CALL
See Also:
Constant Field Values

XMLRPC_RESPONSE

public static final int XMLRPC_RESPONSE
See Also:
Constant Field Values
Constructor Detail

XMLRPCMessage

public XMLRPCMessage()
constructs a default XMLRPC message. The xmlrpc type is not set. You must set the message to have either a call or response before the message can be sent (otherwise, there will be an exception thrown and the message will not be sent). The message is also sent asynchronously. If you want to wait for a response, then you must explicitly set the Synchronization property. If you set the response or call manually, the iq type and XMLRPC type will automatically be set to the proper values. The default SerializerFactory is used for the factory.

See Also:
SerializerFactory

XMLRPCMessage

public XMLRPCMessage(Response response)

XMLRPCMessage

public XMLRPCMessage(Call call)
Method Detail

setFactory

public void setFactory(SerializerFactory factory)
Sets a custom serializer factory instead of using the default one.


parse

public JabberMessage parse(JabberMessageParser parser,
                           Element msgTree)
                    throws ParseException
parses the message. The parser will only retrieve information to find out what type of XMLRPC message this is (call/response).

Specified by:
parse in interface JabberMessageParsable
Overrides:
parse in class AbstractJabberMessage
Throws:
ParseException

encode

public java.lang.String encode()
                        throws ParseException
the method is overridden to provide some sanity checks before sending the data out. If the message does not have a call or response set, an exception is thrown.

Overrides:
encode in class JabberJDOMMessage
Throws:
ParseException - if something went wrong during encoding

isError

public boolean isError()
checks to see if the message is an error message. It will first check to make sure that the server didn't give us an error. If it did, then it's a server error. Then, it will check to see if this is a response message and also check to see if the reply message is an error.

Overrides:
isError in class AbstractJabberMessage
Returns:
true if either the message itself or its reply message is an error message

isResponse

public boolean isResponse()
convenience methods to check if the messag is a response


isCall

public boolean isCall()
convenience methods to check if the messag is a call/request


getResponse

public Response getResponse()
retrieves the response object if there is one for this message. it utilizes the currently set serializer factory to parse the response.

Returns:
the response object, null if none exists

getCall

public Call getCall()
retrieves the call object if there is one for this message. it utilizes the currently set serializer factory to parse the call.

Returns:
the call object, null if none exists

setResponse

public void setResponse(Response response)
sets the response for this message to be sent. By calling this message, the message type will automatically be set as a Response type, the IQ type will be set to "result", all other data will be reset, and the DOM will be newly constructed. You should only use this when you are creating a new message to submit to the server. Don't call this method for an incoming message!


setCall

public void setCall(Call call)
sets the call request for this message to be sent. By calling this message, the message type will automatically be set as a Call type, the IQ type will be set to "set", all other data will be reset, and the DOM will be newly constructed. You should only use this when you are creating a new message to submit to the server. Don't call this method for an incoming message!


getXMLRPCType

public int getXMLRPCType()
get the type for this XMLRPC message, whether it is a request or response type.


getErrorMessage

public ErrorMessage getErrorMessage()
this will retrieve the error if this message is an error message. It this message is not an error message, it will check its reply message to see if it's an error message. If the reply message is an error message, it will return the error from its reply

Overrides:
getErrorMessage in class AbstractJabberMessage
Returns:
the error message either from itself or from its reply message, null if no error message

getMessageType

public int getMessageType()
Description copied from class: JabberJDOMMessage
the default message type is unknown. It doesn't mean that there is no type. It just means that there is no known message parser for this particular object.

Overrides:
getMessageType in class JabberIQMessage
Returns:
the message type code of this message
See Also:
JabberCode


Copyright © 2001-2005 Echomine. All Rights Reserved.