com.verisign.epp.framework

## Class EPPByteArrayDispatcher

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

-     public class EPPByteArrayDispatcher
      extends java.lang.Object

  A Singleton class that delegates message assembly to an EPPAssembler then routes messages to the appropriate EPPEventHandler.
  See Also:
    `EPPEventHandler`, `EPPEvent`

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static EPPByteArrayDispatcher` | `getInstance()` Gets the one and only instance of the EPPByteArrayDispatcher
    `byte[]` | `processMessage(byte[] aInputBytes, java.lang.Object aData)` Creates an `EPPMessage`, sends the message to the appropriate `EPPEventHandler`, and then returns the response as a `byte` array.
    `void` | `registerHandler(EPPEventHandler aHandler)` Registers an `EPPEvenHandler` for notification of Events.
    `void` | `setAssembler(EPPByteArrayAssembler aByteArrayAssembler)` Sets the ByteArrayAssembler.
    `byte[]` | `toBytes(EPPMessage aMessage)` Encodes an EPP message to a `byte` array.
    `byte[]` | `toBytes(EPPMessage aMessage, java.lang.Object aData)` Encodes an EPP message to a `byte` array.

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

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

- - ### Method Detail

    - #### getInstance

          public static EPPByteArrayDispatcher getInstance()

      Gets the one and only instance of the EPPByteArrayDispatcher
      Returns:
        Dispatcher The dispatcher

    - #### setAssembler

          public void setAssembler(EPPByteArrayAssembler aByteArrayAssembler)

      Sets the ByteArrayAssembler.
      Parameters:
        `aByteArrayAssembler` - The ByteArrayAssembler to use.

    - #### processMessage

          public byte[] processMessage(byte[] aInputBytes,
                                       java.lang.Object aData)
                                throws EPPEventException,
                                       EPPAssemblerException

      Creates an `EPPMessage`, sends the message to the appropriate `EPPEventHandler`, and then returns the response as a `byte` array.
      Parameters:
        `aInputBytes` - The byte array containing the xml input
        `aData` - Any additional data that may be required by the EPPEventHandler
      Returns:
        `byte` array containing the response to the message.
      Throws:
        `EPPEventException` - Exception related to the handling of an event
        `EPPAssemblerException` - Exception related to the assembling/de-assembling of messages. `EPPAssemberException.isFatal` can be called to determine if the exception is a fatal exception for the client session.

    - #### registerHandler

          public void registerHandler(EPPEventHandler aHandler)

      Registers an `EPPEvenHandler` for notification of Events.
      Parameters:
        `aHandler` - The `EPPEventhandler` to register

    - #### toBytes

          public byte[] toBytes(EPPMessage aMessage)
                         throws EPPAssemblerException

      Encodes an EPP message to a `byte` array.
      Parameters:
        `aMessage` - EPP Message to send to the client
      Returns:
        Encoded `aMessage` as a `byte[]`.
      Throws:
        `EPPAssemblerException` - Error encoding the EPP message

    - #### toBytes

          public byte[] toBytes(EPPMessage aMessage,
                                java.lang.Object aData)
                         throws EPPAssemblerException

      Encodes an EPP message to a `byte` array.
      Parameters:
        `aMessage` - EPP Message to send to the client
        `aData` - Any additional data that may be required by the handler.
      Returns:
        Encoded `aMessage` as a `byte[]`.
      Throws:
        `EPPAssemblerException` - Error encoding the EPP message