org.richfaces.application.push.impl

## Class AbstractTopic

- java.lang.Object
- - org.richfaces.application.push.impl.AbstractTopic

- All Implemented Interfaces:
    Topic
  Direct Known Subclasses:
    TopicImpl

      public abstract class AbstractTopic
      extends Object
      implements Topic

  Topic encapsulates particular endpoint for sending/receiving messages.
  Author:
    Nick Belaevski
  See Also:
    `Topic`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractTopic(TopicKey key)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTopicListener(TopicListener topicListener)` Adds listener through that topic events will be published (by calling `Topic.publishEvent(TopicEvent)`).
    `void` | `checkSubscription(Session session)` Checks that the given session can be subscribed to this topic
    `TopicKey` | `getKey()` Returns the key which this topic is associated with
    `MessageDataSerializer` | `getMessageDataSerializer()` Returns the `MessageDataSerializer` that is associated with this topic
    `boolean` | `isAllowSubtopics()` Returns true if this topic allow to use subtopics
    `abstract void` | `publish(Object messageData)` Publish data to the subscribed clients
    `abstract void` | `publish(Object messageData, String subtopicName)` Publish data to the subscribed clients
    `void` | `publishEvent(TopicEvent event)` Publishes topic event to all subscribed TopicListeners
    `void` | `removeTopicListener(TopicListener topicListener)` Removes topic listener
    `void` | `setAllowSubtopics(boolean allowSubtopics)` Allow or disallow use of topics
    `void` | `setMessageDataSerializer(MessageDataSerializer serializer)` Associated this topic with given `MessageDataSerializer`

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

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

- - ### Constructor Detail

    - #### AbstractTopic

          public AbstractTopic(TopicKey key)

  - ### Method Detail

    - #### getMessageDataSerializer

          public MessageDataSerializer getMessageDataSerializer()

      Description copied from interface: `Topic`
      Returns the `MessageDataSerializer` that is associated with this topic
      Specified by:
        `getMessageDataSerializer` in interface `Topic`

    - #### setMessageDataSerializer

          public void setMessageDataSerializer(MessageDataSerializer serializer)

      Description copied from interface: `Topic`
      Associated this topic with given `MessageDataSerializer`
      Specified by:
        `setMessageDataSerializer` in interface `Topic`

    - #### isAllowSubtopics

          public boolean isAllowSubtopics()

      Returns true if this topic allow to use subtopics

    - #### setAllowSubtopics

          public void setAllowSubtopics(boolean allowSubtopics)

      Allow or disallow use of topics

    - #### getKey

          public TopicKey getKey()

      Description copied from interface: `Topic`
      Returns the key which this topic is associated with
      Specified by:
        `getKey` in interface `Topic`

    - #### addTopicListener

          public void addTopicListener(TopicListener topicListener)

      Description copied from interface: `Topic`
      Adds listener through that topic events will be published (by calling `Topic.publishEvent(TopicEvent)`).
      Specified by:
        `addTopicListener` in interface `Topic`

    - #### removeTopicListener

          public void removeTopicListener(TopicListener topicListener)

      Description copied from interface: `Topic`
      Removes topic listener
      Specified by:
        `removeTopicListener` in interface `Topic`

    - #### checkSubscription

          public void checkSubscription(Session session)
                                 throws SubscriptionFailureException

      Description copied from interface: `Topic`
      Checks that the given session can be subscribed to this topic
      Specified by:
        `checkSubscription` in interface `Topic`
      Throws:
        `SubscriptionFailureException` - when given session can't be subscribed to this topic

    - #### publishEvent

          public void publishEvent(TopicEvent event)

      Description copied from interface: `Topic`
      Publishes topic event to all subscribed TopicListeners
      Specified by:
        `publishEvent` in interface `Topic`

    - #### publish

          public abstract void publish(Object messageData)
                                throws MessageException

      Description copied from interface: `Topic`
      Publish data to the subscribed clients
      Specified by:
        `publish` in interface `Topic`
      Parameters:
        `messageData` - data that will be serialized by MessageDataSerializer
      Throws:
        `MessageException`

    - #### publish

          public abstract void publish(Object messageData,
                                       String subtopicName)
                                throws MessageException

      Description copied from interface: `Topic`
      Publish data to the subscribed clients
      Specified by:
        `publish` in interface `Topic`
      Parameters:
        `messageData` - data that will be serialized by MessageDataSerializer
        `subtopicName` - optional subtopic, used to publish to clients that are only interested in specific subtopics
      Throws:
        `MessageException`

Copyright © 2015 JBoss by Red Hat. All Rights Reserved.