com.verisign.epp.framework

## Class EPPBalanceHandler

- java.lang.Object
- - com.verisign.epp.framework.EPPBalanceHandler

- All Implemented Interfaces:
    EPPEventHandler
  Direct Known Subclasses:
    BalanceHandler

      public abstract class EPPBalanceHandler
      extends java.lang.Object
      implements EPPEventHandler

  This class provides an interface for handling EPP Balance Commands in a Server implementation. EPPEvents are handled by the handleEvent() method here and routed to the appropriate abstract member function. Subclasses should override the abstract methods to define the desired behavior of a particular command when it is received. A subclassed instance of `EPPBalanceHandler` should be registered with the `EPPDispatcher` so that EPPEvents related to the Balance Mapping will be handled there.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EPPBalanceHandler()` Construct an instance of `EPPBalanceHandler`.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract EPPEventResponse` | `doBalanceInfo(EPPEvent aEvent, java.lang.Object aData)` Returns the `EPPEventResponse` back to the client after processing the passed in `aEvent`.
    `java.lang.String` | `getNamespace()` Returns the Balance Namespace associated with this handler.
    `EPPEventResponse` | `handleEvent(EPPEvent aEvent, java.lang.Object aData)` Returns the `EPPEventResponse` after processing the passed in `aEvent`.
    `protected void` | `postHandleEvent(EPPEvent aEvent, java.lang.Object aData)` Handles any common behavior that all Balance commands need to execute after they execute their command specific behavior.
    `protected void` | `preHandleEvent(EPPEvent aEvent, java.lang.Object aData)` Handles any common behavior that all Balance commands need to execute before they execute their command specific behavior.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EPPBalanceHandler

          public EPPBalanceHandler()

      Construct an instance of `EPPBalanceHandler`. Whenever an `EPPBalanceHandler` instance is created it also adds `EPPBalanceMapFactory` to the `EPPFactory` map factory.

  - ### Method Detail

    - #### getNamespace

          public java.lang.String getNamespace()

      Returns the Balance Namespace associated with this handler.
      Specified by:
        `getNamespace` in interface `EPPEventHandler`
      Returns:
        String the Balance Namespace associated with this handler.

    - #### handleEvent

          public EPPEventResponse handleEvent(EPPEvent aEvent,
                                              java.lang.Object aData)
                                       throws EPPEventException

      Returns the `EPPEventResponse` after processing the passed in `aEvent`. This method receives an `EPPEvent` and routes it to the appropriate abstract method.
      Specified by:
        `handleEvent` in interface `EPPEventHandler`
      Parameters:
        `aEvent` - An `EPPEvent` that contains the `EPPCommand`
        `aData` - Any data that a Server needs to send to this `EPPBalanceHandler` instance.
      Returns:
        the `EPPEventResponse` after processing the passed in `aEvent`.
      Throws:
        `EPPEventException` - Thrown if an unrecognized `EPPEvent` is received

    - #### preHandleEvent

          protected void preHandleEvent(EPPEvent aEvent,
                                        java.lang.Object aData)
                                 throws EPPHandleEventException

      Handles any common behavior that all Balance commands need to execute before they execute their command specific behavior. The default implementation does nothing.
      Parameters:
        `aEvent` - The `EPPEvent` that is being handled
        `aData` - Any data that a Server needs to send to this `EPPBalanceHandler`
      Throws:
        `EPPHandleEventException` - Thrown if an error condition occurs. It must contain an `EPPEventResponse`

    - #### postHandleEvent

          protected void postHandleEvent(EPPEvent aEvent,
                                         java.lang.Object aData)
                                  throws EPPHandleEventException

      Handles any common behavior that all Balance commands need to execute after they execute their command specific behavior. The default implementation does nothing
      Parameters:
        `aEvent` - The `EPPEvent` that is being handled
        `aData` - Any data that a Server needs to send to this `EPPBalanceHandler`
      Throws:
        `EPPHandleEventException` - Thrown if an error condition occurs. It must contain an `EPPEventResponse`

    - #### doBalanceInfo

          protected abstract EPPEventResponse doBalanceInfo(EPPEvent aEvent,
                                                            java.lang.Object aData)

      Returns the `EPPEventResponse` back to the client after processing the passed in `aEvent`. Invoked when a Balance Info command is received. Subclasses should define the behavior when a Balance Info command is received.
      Parameters:
        `aEvent` - The `EPPEvent` that is being handled
        `aData` - Any data that a Server needs to send to this `EPPBalanceHandler`
      Returns:
        the `EPPEventResponse` back to the client after processing the passed in `aEvent`.