com.h3c.util.net.msg

## Class ConversationBroker

- java.lang.Object
- - com.h3c.util.net.msg.ConversationBroker

- All Implemented Interfaces:
    ConversationProvider

      public class ConversationBroker
      extends Object
      implements ConversationProvider

  A broker, acting as a conversation provider, by dispatching conversation provisioning requests to multiple other conversation providers that have been registered with the broker.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConversationBroker()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addProvider(String topic, ConversationProvider provider)` Add a new provider for the specified topic.
    `ConversationProvider` | `getProvider(String topic)` Get the provider associated with the specified topic.
    `Set<String>` | `getTopics()` Get the set of registered conversation topics.
    `Conversation` | `newConversation(String topic, int cid, int parentId)` Get a conversation for the specified topic.
    `void` | `removeConversation(Conversation c)` Remove the specified conversation.
    `void` | `removeProvider(String topic)` Remove the provider associated with the specified topic.

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

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

- - ### Constructor Detail

    - #### ConversationBroker

          public ConversationBroker()

  - ### Method Detail

    - #### addProvider

          public void addProvider(String topic,
                         ConversationProvider provider)

      Add a new provider for the specified topic. Note that the same provider may be associated with multiple different topics via this method.
      Parameters:
        `topic` - conversation topic
        `provider` - conversation provider to which the requests for conversations on the specified topic will be directed

    - #### removeProvider

          public void removeProvider(String topic)

      Remove the provider associated with the specified topic.
      Parameters:
        `topic` - conversation topic whose provider should be removed

    - #### getProvider

          public ConversationProvider getProvider(String topic)

      Get the provider associated with the specified topic.
      Parameters:
        `topic` - conversation topic whose provider is requested
      Returns:
        conversation provider associated with the given topic; null if no such provider

    - #### getTopics

          public Set<String> getTopics()

      Get the set of registered conversation topics.
      Returns:
        set of topics for which providers are available

    - #### newConversation

          public Conversation newConversation(String topic,
                                     int cid,
                                     int parentId)

      Description copied from interface: `ConversationProvider`
      Get a conversation for the specified topic.
      Specified by:
        `newConversation` in interface `ConversationProvider`
      Parameters:
        `topic` - name of the conversation topic
        `cid` - conversation id
        `parentId` - unique conversation id of the parent conversation; 0 if no parent conversation
      Returns:
        conversation handler for the specified topic

    - #### removeConversation

          public void removeConversation(Conversation c)

      Description copied from interface: `ConversationProvider`
      Remove the specified conversation.
      Specified by:
        `removeConversation` in interface `ConversationProvider`
      Parameters:
        `c` - conversation to be removed

Copyright © 2014. All Rights Reserved.