com.google.checkout.notification
Class CompositeNotificationParser

java.lang.Object
  extended by com.google.checkout.notification.CompositeNotificationParser
All Implemented Interfaces:
NotificationParser

public class CompositeNotificationParser
extends java.lang.Object
implements NotificationParser

Author:
Charles Dang (cdang@google.com)

Constructor Summary
CompositeNotificationParser()
          Default constructor
 
Method Summary
 CheckoutNotification parse(org.w3c.dom.Document xmlDocument)
          Parses the xmlDocment and returns a CheckoutNotification object of the specified type.
 CheckoutNotification parse(java.lang.String xmlString)
          Parses an xml string and returns a CheckoutNotification object of the given type.
 void register(java.lang.String notificationType, NotificationParser parser)
          Registers a NotificationParser with the associated notification type
static void registerDefaultNotificationParsers(CompositeNotificationParser parser)
          Registers the default notification parsers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeNotificationParser

public CompositeNotificationParser()
Default constructor

Method Detail

parse

public CheckoutNotification parse(java.lang.String xmlString)
                           throws CheckoutParserException
Parses an xml string and returns a CheckoutNotification object of the given type. Assumes the root element contains the notification type. If the notification type is not one of the following types, an UnknownNotificationException is thrown: new-order-notification, risk-information-notification, order-state-change-notification, refund-amount-notification, chargeback-amount-notification or authorization-amount-notification.

Parameters:
xmlString -
Returns:
A notification object of the specified type
Throws:
com.google.checkout.notification.UnknownNotificationException - if the notification type was not recognized
com.google.checkout.notification.CheckoutException - if there was an error parsing the request string
CheckoutParserException

parse

public CheckoutNotification parse(org.w3c.dom.Document xmlDocument)
                           throws CheckoutParserException
Parses the xmlDocment and returns a CheckoutNotification object of the specified type.

Specified by:
parse in interface NotificationParser
Parameters:
xmlDocument -
Returns:
CheckoutNotification of the type specified in xmlDocument
Throws:
CheckoutParserException

register

public void register(java.lang.String notificationType,
                     NotificationParser parser)
Registers a NotificationParser with the associated notification type

Parameters:
notificationType - The notification type
parser - The parser associated with the notification type

registerDefaultNotificationParsers

public static void registerDefaultNotificationParsers(CompositeNotificationParser parser)
Registers the default notification parsers.