com.echomine.jabber
Class ErrorMessage

java.lang.Object
  extended by com.echomine.jabber.ErrorMessage
All Implemented Interfaces:
ErrorCode, JabberCode

public class ErrorMessage
extends java.lang.Object
implements ErrorCode, JabberCode

Contains the error messages and error codes associated with a specific error. The naming convention may be misleading, but this class does not extend JabberMessage. It is usually used by a JabberMessage when parsing error messages. Pretty much this class is more of a helper class than a message class. Furthermore, because the error message is now rather specific, including the management of the parsing and encoding of xml data, the message is now tied to jdom and is not generic for use for other purposes. If you have an issue with this, then you will need to create your own error message to handle the messages. This message supports the transitional JEP-0086, helping bridge the gap between the old style Jabber error messages to the new XMPP style Jabber Error messages.

Current Implementation: JEP-0086 Version 1.0

Since:
0.8b1

Field Summary
static java.lang.String TYPE_AUTH
           
static java.lang.String TYPE_CANCEL
           
static java.lang.String TYPE_CONTINUE
           
static java.lang.String TYPE_MODIFY
           
static java.lang.String TYPE_WAIT
           
 
Fields inherited from interface com.echomine.jabber.ErrorCode
BAD_REQUEST, C_BAD_REQUEST, C_CONFLICT, C_FEATURE_NOT_IMPLEMENTED, C_FORBIDDEN, C_GONE, C_INTERNAL_SERVER_ERROR, C_ITEM_NOT_FOUND, C_MALFORMED_JID, C_NOT_ACCEPTABLE, C_NOT_ALLOWED, C_NOT_AUTHORIZED, C_PAYMENT_REQUIRED, C_RECIPIENT_UNAVAILABLE, C_REDIRECT, C_REGISTRATION_REQUIRED, C_REMOTE_SERVER_NOT_FOUND, C_REMOTE_SERVER_TIMEOUT, C_RESOURCE_CONSTRAINT, C_SERVICE_UNAVAILABLE, C_SUBSCRIPTION_REQUIRED, C_UNDEFINED, C_UNEXPECTED_REQUEST, CONFLICT, DISCONNECTED, FORBIDDEN, INTERNAL_SERVER_ERROR, NOT_ACCEPTABLE, NOT_ALLOWED, NOT_FOUND, NOT_IMPLEMENTED, PAYMENT_REQUIRED, REDIRECT, REGISTRATION_REQUIRED, REMOTE_SERVER_ERROR, REMOTE_SERVER_TIMEOUT, REQUEST_TIMEOUT, S_BAD_FORMAT, S_BAD_NAMESPACE_PREFIX, S_CONFLICT, S_CONNECTION_TIMEOUT, S_HOST_GONE, S_HOST_UNKNOWN, S_IMPROPER_ADDRESSING, S_INTERNAL_SERVER_ERROR, S_INVALID_FROM, S_INVALID_ID, S_INVALID_NAMESPACE, S_INVALID_XML, S_NOT_AUTHORIZED, S_POLICY_VIOLATION, S_REMOTE_CONNECTION_FAILED, S_RESOURCE_CONSTRAINT, S_RESTRICTED_XML, S_SEE_OTHER_HOST, S_SYSTEM_SHUTDOWN, S_UNDEFINED, S_UNSUPPORTED_ENCODING, S_UNSUPPORTED_STANZA_TYPE, S_UNSUPPORTED_VERSION, S_XML_NOT_WELL_FORMED, SERVICE_UNAVAILABLE, UNAUTHORIZED, USERNAME_NOT_AVAILABLE
 
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
ErrorMessage(int code, java.lang.String msg)
          Constructs the legacy error message using the specified code and message.
ErrorMessage(java.lang.String condition, java.lang.String type)
           
ErrorMessage(java.lang.String condition, java.lang.String type, java.lang.String msg)
           
 
Method Summary
static ErrorMessage createErrorMessage(Element errorElem)
           
 Element getApplicationCondition()
          This retrieves the application-specified condition if there is one.
 int getCode()
           
 java.lang.String getCondition()
           
 java.lang.String getMessage()
           
 java.lang.String getType()
          The error type, as specified in the constants in this class.
 void setApplicationCondition(Element applicationCondition)
          Sets the application condition to be sent along with the error message.
 void setCode(int code)
          Sets the error code for this error message.
 void setCondition(java.lang.String condition)
          Set the condition to be used.
 void setType(java.lang.String type)
          Sets the type to be associated with the condition.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_AUTH

public static final java.lang.String TYPE_AUTH
See Also:
Constant Field Values

TYPE_CANCEL

public static final java.lang.String TYPE_CANCEL
See Also:
Constant Field Values

TYPE_CONTINUE

public static final java.lang.String TYPE_CONTINUE
See Also:
Constant Field Values

TYPE_MODIFY

public static final java.lang.String TYPE_MODIFY
See Also:
Constant Field Values

TYPE_WAIT

public static final java.lang.String TYPE_WAIT
See Also:
Constant Field Values
Constructor Detail

ErrorMessage

public ErrorMessage(int code,
                    java.lang.String msg)
Constructs the legacy error message using the specified code and message. The code will be translated as specified in the JEP.


ErrorMessage

public ErrorMessage(java.lang.String condition,
                    java.lang.String type)

ErrorMessage

public ErrorMessage(java.lang.String condition,
                    java.lang.String type,
                    java.lang.String msg)
Method Detail

createErrorMessage

public static ErrorMessage createErrorMessage(Element errorElem)
                                       throws ParseException
Throws:
ParseException

getMessage

public java.lang.String getMessage()
Returns:
the user-readable error message, or null if there isn't one

getCode

public int getCode()
Returns:
the error code

getCondition

public java.lang.String getCondition()
Returns:
the condition for the message, or null if there isn't one.

getType

public java.lang.String getType()
The error type, as specified in the constants in this class. This value is only set for stanza errors, not for stream errors.

Returns:
the error condition type, or null if there isn't one.

getApplicationCondition

public Element getApplicationCondition()
This retrieves the application-specified condition if there is one. This returns the element for the application condition. Because the application condition is XML data, JDOM is explicitly tied to the use of application conditions.


setApplicationCondition

public void setApplicationCondition(Element applicationCondition)
Sets the application condition to be sent along with the error message. The application condition will have a namespace attached.


setCondition

public void setCondition(java.lang.String condition)
Set the condition to be used. The condition should be from the list of stanza error constants listed in ErrorCode

See Also:
ErrorCode

setType

public void setType(java.lang.String type)
Sets the type to be associated with the condition. The type should be from the list of constants that are in this class.


setCode

public void setCode(int code)
Sets the error code for this error message.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001-2005 Echomine. All Rights Reserved.