net.rim.pushsdk.pap.unmarshal
Class PapMessageUnmarshaller

java.lang.Object
  extended by net.rim.pushsdk.pap.unmarshal.PapMessageUnmarshaller
Direct Known Subclasses:
CancelResponseUnmarshaller, PushResponseUnmarshaller, ResultNotificationUnmarshaller, StatusQueryResponseUnmarshaller

public abstract class PapMessageUnmarshaller
extends Object

Abstract class for unmarshalling PAP XML messages into Java objects.

All unmarshallers must extend this class.

Author:
mdicesare

Nested Class Summary
protected  class PapMessageUnmarshaller.PushSDKErrorHandler
          The handler for dealing with errors during unmarshalling.
 
Field Summary
protected static String ADDRESS_TAG
          The address PAP XML tag.
protected static String ADDRESS_VALUE_ATTR
          The address value PAP XML attribute.
protected static String BAD_FORMAT_ERROR_MSG
          The error message for PAP XML found to be in a bad format.
protected static String BEARER_ATTR
          The bearer PAP XML attribute.
protected static String BEARER_REQ_ATTR
          The bearer required PAP XML attribute.
protected static String CODE_ATTR
          The status code PAP XML attribute.
protected static String DELIVERY_METHOD_ATTR
          The delivery method PAP XML attribute.
protected static String DESC_ATTR
          The status description PAP XML attribute.
protected static String EVENT_TIME_ATTR
          The event time PAP XML attribute.
static String MESSAGE_STATE_ATTR
          The message state PAP XML attribute.
static String MISSING_MANDATORY_ERROR_MSG
          The error message when PAP XML tags or attributes are found to be missing.
static String PUSH_ID_ATTR
          The push ID PAP XML attribute.
protected static String QUALITY_OF_SERVICE_TAG
          The quality of service PAP XML attribute.
protected  SAXParser saxParser
          The SAX parser to be used in the unmarshalling.
protected static String SENDER_ADDRESS_ATTR
          The sender address PAP XML attribute.
protected static String SENDER_NAME_ATTR
          The sender name PAP XML attribute.
protected static String VALUE_MSG
          Used in error messages to indicate the value of an attribute or tag.
 
Constructor Summary
PapMessageUnmarshaller()
          Default PAP message unmarshaller constructor.
 
Method Summary
protected abstract  PapMessage unmarshal(String xml)
          Unmarshals a PAP XML message.
 PapMessage unmarshal(String xml, String contentType)
          Unmarshals a PAP XML message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUSH_ID_ATTR

public static final String PUSH_ID_ATTR
The push ID PAP XML attribute.

See Also:
Constant Field Values

MESSAGE_STATE_ATTR

public static final String MESSAGE_STATE_ATTR
The message state PAP XML attribute.

See Also:
Constant Field Values

MISSING_MANDATORY_ERROR_MSG

public static final String MISSING_MANDATORY_ERROR_MSG
The error message when PAP XML tags or attributes are found to be missing.

See Also:
Constant Field Values

SENDER_ADDRESS_ATTR

protected static final String SENDER_ADDRESS_ATTR
The sender address PAP XML attribute.

See Also:
Constant Field Values

SENDER_NAME_ATTR

protected static final String SENDER_NAME_ATTR
The sender name PAP XML attribute.

See Also:
Constant Field Values

CODE_ATTR

protected static final String CODE_ATTR
The status code PAP XML attribute.

See Also:
Constant Field Values

DESC_ATTR

protected static final String DESC_ATTR
The status description PAP XML attribute.

See Also:
Constant Field Values

ADDRESS_TAG

protected static final String ADDRESS_TAG
The address PAP XML tag.

See Also:
Constant Field Values

ADDRESS_VALUE_ATTR

protected static final String ADDRESS_VALUE_ATTR
The address value PAP XML attribute.

See Also:
Constant Field Values

QUALITY_OF_SERVICE_TAG

protected static final String QUALITY_OF_SERVICE_TAG
The quality of service PAP XML attribute.

See Also:
Constant Field Values

EVENT_TIME_ATTR

protected static final String EVENT_TIME_ATTR
The event time PAP XML attribute.

See Also:
Constant Field Values

DELIVERY_METHOD_ATTR

protected static final String DELIVERY_METHOD_ATTR
The delivery method PAP XML attribute.

See Also:
Constant Field Values

BEARER_ATTR

protected static final String BEARER_ATTR
The bearer PAP XML attribute.

See Also:
Constant Field Values

BEARER_REQ_ATTR

protected static final String BEARER_REQ_ATTR
The bearer required PAP XML attribute.

See Also:
Constant Field Values

BAD_FORMAT_ERROR_MSG

protected static final String BAD_FORMAT_ERROR_MSG
The error message for PAP XML found to be in a bad format.

See Also:
Constant Field Values

VALUE_MSG

protected static final String VALUE_MSG
Used in error messages to indicate the value of an attribute or tag.

See Also:
Constant Field Values

saxParser

protected SAXParser saxParser
The SAX parser to be used in the unmarshalling.

Constructor Detail

PapMessageUnmarshaller

public PapMessageUnmarshaller()
                       throws PushSDKException
Default PAP message unmarshaller constructor.

Throws:
PushSDKException - if any errors occur initializing the XML parser
Method Detail

unmarshal

public PapMessage unmarshal(String xml,
                            String contentType)
                     throws PushSDKException,
                            BadMessageException
Unmarshals a PAP XML message.

Parameters:
xml - the PAP XML to unmarshal
contentType - the content type for validation purposes
Returns:
the umarshalled PAP message
Throws:
PushSDKException - if the XML passed in is null or empty or if the content type is not application/xml
BadMessageException - if the unmarshalled message corresponds to a bad message

unmarshal

protected abstract PapMessage unmarshal(String xml)
                                 throws SAXException,
                                        IOException
Unmarshals a PAP XML message.

Parameters:
xml - the PAP XML to unmarshal
Returns:
the umarshalled PAP message
Throws:
SAXException - if any SAX errors occur during processing
IOException - if any IO errors occur


Copyright © 2011 Research In Motion. All Rights Reserved.