GenericReceiverFactory (Siena 2.0.4 API Documentation)
Date: 2015-05-17

siena.comm

## Class GenericReceiverFactory

- java.lang.Object
- - siena.comm.GenericReceiverFactory

- All Implemented Interfaces:
    PacketReceiverFactory

      public class GenericReceiverFactory
      extends java.lang.Object
      implements PacketReceiverFactory

  generic packet receiver factory. This factory serves as a generic switch for `PacketReceiverFactory` implementations.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericReceiverFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `PacketReceiver` | `createPacketReceiver(java.lang.String handler)` returns a new packet receiver based on an external string representation.
    `static void` | `registerFactory(java.lang.String schema, PacketReceiverFactory f)` extends this factory by registering a new packet receiver factory.
    `static void` | `removeFactory(java.lang.String schema)` removes a previously registered factory.

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

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

- - ### Constructor Detail

    - #### GenericReceiverFactory

          public GenericReceiverFactory()

  - ### Method Detail

    - #### createPacketReceiver

          public PacketReceiver createPacketReceiver(java.lang.String handler)
                                              throws InvalidReceiverException

      returns a new packet receiver based on an external string representation. This factory handles string representations of the form: schema`:`schema-specific handler by dispatching the handler (including the schema name and the colon character) to another factory that has been registered for that schema. If no factory is registered for that schema, this method throws an `InvalidReceiverException`.
      Specified by:
        `createPacketReceiver` in interface `PacketReceiverFactory`
      Throws:
        `InvalidReceiverException` - when the handler is unknown or malformed

    - #### registerFactory

          public static void registerFactory(java.lang.String schema,
                             PacketReceiverFactory f)

      extends this factory by registering a new packet receiver factory. A `GenericReceiverFactory` can be extended by registering new `PacketReceiverFactory` implementations. Notice that `GenericReceiverFactory` will delegate the instantiation of a specific PacketReceiver to a registered factory by passing if the handler string. See `createPacketReceiver(String)` for more details on how `GenericReceiverFactory` processes handlers.

      Notice that the factory register is static, therefore registration and de-registration will affect every instance of this class.

      Parameters:
        `schema` - schema name
        `f` - schema-specific factory

    - #### removeFactory

          public static void removeFactory(java.lang.String schema)

      removes a previously registered factory.
      See Also:
        `registerFactory(String,PacketReceiverFactory)`

Copyright © 2000-2005 University of Colorado.
Copyright © 2005-2011 Antonio Carzaniga.
This documentation is maintained by Antonio Carzaniga