anon.pay.xml
Class XMLErrorMessage

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by anon.pay.xml.XMLErrorMessage
All Implemented Interfaces:
IXMLEncodable, java.io.Serializable

public class XMLErrorMessage
extends java.lang.Exception
implements IXMLEncodable

This class encapsulates an error or success message. In order to be indipendent from the HTTP protocol on the higher layer, this is now used instead of http errorcodes.

Author:
Bastian Voigt
See Also:
Serialized Form

Field Summary
static int ERR_ACCOUNT_EMPTY
           
static int ERR_BAD_REQUEST
           
static int ERR_BAD_SIGNATURE
           
static int ERR_BLOCKED
           
static int ERR_CASCADE_LENGTH
           
static int ERR_DATABASE_ERROR
           
static int ERR_INSUFFICIENT_BALANCE
           
static int ERR_INTERNAL_SERVER_ERROR
           
static int ERR_INVALID_CODE
           
static int ERR_INVALID_PRICE_CERTS
           
static int ERR_KEY_NOT_FOUND
           
static int ERR_MULTIPLE_LOGIN
           
static int ERR_NO_ACCOUNTCERT
           
static int ERR_NO_BALANCE
           
static int ERR_NO_CONFIRMATION
           
static int ERR_NO_FLATRATE_OFFERED
           
static int ERR_NO_RECORD_FOUND
           
static int ERR_OK
           
static int ERR_OUTDATED_CC
           
static int ERR_SUCCESS_BUT_WITH_ERRORS
           
static int ERR_WRONG_DATA
           
static int ERR_WRONG_FORMAT
           
private static java.lang.String[] m_errStrings
          default error descriptions
private  int m_iErrorCode
           
private static java.lang.String[] m_messageObjectTypes
           
private  IXMLEncodable m_oMessageObject
           
private  java.lang.String m_strErrMsg
           
static java.lang.String XML_ELEMENT_NAME
           
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
 
Constructor Summary
XMLErrorMessage(org.w3c.dom.Document doc)
          Parses an XMLErrorMessage object from DOM Document
XMLErrorMessage(org.w3c.dom.Element element)
          XMLErrorMessage
XMLErrorMessage(int errorCode)
          Uses a default description String
XMLErrorMessage(int errorCode, java.lang.String message)
          Creates an errorMessage object.
XMLErrorMessage(int errorCode, java.lang.String message, IXMLEncodable messageObject)
           
 
Method Summary
 int getErrorCode()
           
 java.lang.String getErrorDescription()
           
 java.lang.String getMessage()
           
 IXMLEncodable getMessageObject()
          getMessageObject: object corresponding to the message, may be null
 java.lang.Class getMessageObjectType()
           
 void setMessageObject(IXMLEncodable a_messageObject)
           
private  void setValues(org.w3c.dom.Element elemRoot)
           
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Return an element that can be appended to the document.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERR_OK

public static final int ERR_OK
See Also:
Constant Field Values

ERR_INTERNAL_SERVER_ERROR

public static final int ERR_INTERNAL_SERVER_ERROR
See Also:
Constant Field Values

ERR_WRONG_FORMAT

public static final int ERR_WRONG_FORMAT
See Also:
Constant Field Values

ERR_WRONG_DATA

public static final int ERR_WRONG_DATA
See Also:
Constant Field Values

ERR_KEY_NOT_FOUND

public static final int ERR_KEY_NOT_FOUND
See Also:
Constant Field Values

ERR_BAD_SIGNATURE

public static final int ERR_BAD_SIGNATURE
See Also:
Constant Field Values

ERR_BAD_REQUEST

public static final int ERR_BAD_REQUEST
See Also:
Constant Field Values

ERR_NO_ACCOUNTCERT

public static final int ERR_NO_ACCOUNTCERT
See Also:
Constant Field Values

ERR_NO_BALANCE

public static final int ERR_NO_BALANCE
See Also:
Constant Field Values

ERR_NO_CONFIRMATION

public static final int ERR_NO_CONFIRMATION
See Also:
Constant Field Values

ERR_ACCOUNT_EMPTY

public static final int ERR_ACCOUNT_EMPTY
See Also:
Constant Field Values

ERR_CASCADE_LENGTH

public static final int ERR_CASCADE_LENGTH
See Also:
Constant Field Values

ERR_DATABASE_ERROR

public static final int ERR_DATABASE_ERROR
See Also:
Constant Field Values

ERR_INSUFFICIENT_BALANCE

public static final int ERR_INSUFFICIENT_BALANCE
See Also:
Constant Field Values

ERR_NO_FLATRATE_OFFERED

public static final int ERR_NO_FLATRATE_OFFERED
See Also:
Constant Field Values

ERR_INVALID_CODE

public static final int ERR_INVALID_CODE
See Also:
Constant Field Values

ERR_OUTDATED_CC

public static final int ERR_OUTDATED_CC
See Also:
Constant Field Values

ERR_INVALID_PRICE_CERTS

public static final int ERR_INVALID_PRICE_CERTS
See Also:
Constant Field Values

ERR_MULTIPLE_LOGIN

public static final int ERR_MULTIPLE_LOGIN
See Also:
Constant Field Values

ERR_NO_RECORD_FOUND

public static final int ERR_NO_RECORD_FOUND
See Also:
Constant Field Values

ERR_SUCCESS_BUT_WITH_ERRORS

public static final int ERR_SUCCESS_BUT_WITH_ERRORS
See Also:
Constant Field Values

ERR_BLOCKED

public static final int ERR_BLOCKED
See Also:
Constant Field Values

m_iErrorCode

private int m_iErrorCode

m_strErrMsg

private java.lang.String m_strErrMsg

m_oMessageObject

private IXMLEncodable m_oMessageObject

m_errStrings

private static final java.lang.String[] m_errStrings
default error descriptions


m_messageObjectTypes

private static final java.lang.String[] m_messageObjectTypes

XML_ELEMENT_NAME

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

XMLErrorMessage

public XMLErrorMessage(org.w3c.dom.Document doc)
                throws java.lang.Exception
Parses an XMLErrorMessage object from DOM Document

Parameters:
document - Document
Throws:
java.lang.Exception

XMLErrorMessage

public XMLErrorMessage(org.w3c.dom.Element element)
                throws java.lang.Exception
XMLErrorMessage

Parameters:
element - Element
Throws:
java.lang.Exception

XMLErrorMessage

public XMLErrorMessage(int errorCode,
                       java.lang.String message)
Creates an errorMessage object. The errorcode should be one of the above ERR_* constants.

Parameters:
errorCode - int one of the above constants
message - String a human-readable description of the error

XMLErrorMessage

public XMLErrorMessage(int errorCode,
                       java.lang.String message,
                       IXMLEncodable messageObject)

XMLErrorMessage

public XMLErrorMessage(int errorCode)
Uses a default description String

Parameters:
errorCode - int
Method Detail

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Description copied from interface: IXMLEncodable
Return an element that can be appended to the document. This Method must not change the document in any way!

Specified by:
toXmlElement in interface IXMLEncodable
Parameters:
a_doc - a document
Returns:
the interface as xml element

getErrorDescription

public java.lang.String getErrorDescription()

getErrorCode

public int getErrorCode()

getMessage

public java.lang.String getMessage()
Overrides:
getMessage in class java.lang.Throwable

getMessageObject

public IXMLEncodable getMessageObject()
getMessageObject: object corresponding to the message, may be null

Returns:
IXMLEncodable: exact type will depend on the message code, to be looked up via getMessageObjectType

getMessageObjectType

public java.lang.Class getMessageObjectType()

setMessageObject

public void setMessageObject(IXMLEncodable a_messageObject)

setValues

private void setValues(org.w3c.dom.Element elemRoot)
                throws java.lang.Exception
Throws:
java.lang.Exception