org.richfaces.application.push.impl

## Class SessionImpl

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

- All Implemented Interfaces:
    DestroyableSession, Session

      public class SessionImpl
      extends Object
      implements Session, DestroyableSession

  Session represents user’s subscription to a set of topics
  Author:
    Nick Belaevski
  See Also:
    `Session`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionImpl(String id, SessionManager sessionManager, TopicsContext topicsContext)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearBroadcastedMessages(long sequenceNumber)` Clears all the queues messages associated with this session that has sequence number lower than provided number
    `void` | `connect(Request request)` Connects given request to this session
    `void` | `destroy()` Destroy the session and associated resources
    `void` | `disconnect()` Releases/disconnects associated request from this session
    `Map<TopicKey,String>` | `getFailedSubscriptions()` Get a map of topic keys this session failed to be subscribed to including the message why the subscription failed
    `String` | `getId()` Returns unique identifier of this session.
    `long` | `getLastAccessedTime()` Returns the last time when the session was accessed
    `int` | `getMaxInactiveInterval()` How much minutes is session kept alive since the last time it has been accessed before it is destroyed
    `Collection<MessageData>` | `getMessages()` Returns list of messages associated with this push session
    `protected Request` | `getRequest()` Returns `Request` associated with this session
    `Collection<TopicKey>` | `getSuccessfulSubscriptions()` Get a list of topic keys this session is successfully subscribed to
    `void` | `invalidate()` Invalidates this session, making it non-active
    `protected void` | `processConnect(Request request)` Process connecting of given request to this session and try to post messages if there are any
    `void` | `push(TopicKey topicKey, String serializedData)` Pushes given data to given topic key
    `void` | `subscribe(String[] topics)` Subscribe this session to given topics

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

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

- - ### Constructor Detail

    - #### SessionImpl

          public SessionImpl(String id,
                     SessionManager sessionManager,
                     TopicsContext topicsContext)

  - ### Method Detail

    - #### connect

          public void connect(Request request)
                       throws Exception

      Description copied from interface: `Session`
      Connects given request to this session
      Specified by:
        `connect` in interface `Session`
      Throws:
        `Exception`

    - #### getRequest

          protected Request getRequest()

      Returns `Request` associated with this session

    - #### processConnect

          protected void processConnect(Request request)
                                 throws Exception

      Process connecting of given request to this session and try to post messages if there are any
      Throws:
        `Exception`

    - #### disconnect

          public void disconnect()
                          throws Exception

      Description copied from interface: `Session`
      Releases/disconnects associated request from this session
      Specified by:
        `disconnect` in interface `Session`
      Throws:
        `Exception`

    - #### getLastAccessedTime

          public long getLastAccessedTime()

      Description copied from interface: `Session`
      Returns the last time when the session was accessed
      Specified by:
        `getLastAccessedTime` in interface `Session`

    - #### getMaxInactiveInterval

          public int getMaxInactiveInterval()

      Description copied from interface: `Session`
      How much minutes is session kept alive since the last time it has been accessed before it is destroyed
      Specified by:
        `getMaxInactiveInterval` in interface `Session`

    - #### getId

          public String getId()

      Description copied from interface: `Session`
      Returns unique identifier of this session.
      Specified by:
        `getId` in interface `Session`

    - #### invalidate

          public void invalidate()

      Description copied from interface: `Session`
      Invalidates this session, making it non-active
      Specified by:
        `invalidate` in interface `Session`

    - #### destroy

          public void destroy()

      Description copied from interface: `DestroyableSession`
      Destroy the session and associated resources
      Specified by:
        `destroy` in interface `DestroyableSession`

    - #### getFailedSubscriptions

          public Map<TopicKey,String> getFailedSubscriptions()

      Description copied from interface: `Session`
      Get a map of topic keys this session failed to be subscribed to including the message why the subscription failed
      Specified by:
        `getFailedSubscriptions` in interface `Session`

    - #### getSuccessfulSubscriptions

          public Collection<TopicKey> getSuccessfulSubscriptions()

      Description copied from interface: `Session`
      Get a list of topic keys this session is successfully subscribed to
      Specified by:
        `getSuccessfulSubscriptions` in interface `Session`

    - #### subscribe

          public void subscribe(String[] topics)

      Description copied from interface: `Session`
      Subscribe this session to given topics
      Specified by:
        `subscribe` in interface `Session`

    - #### getMessages

          public Collection<MessageData> getMessages()

      Description copied from interface: `Session`
      Returns list of messages associated with this push session
      Specified by:
        `getMessages` in interface `Session`

    - #### clearBroadcastedMessages

          public void clearBroadcastedMessages(long sequenceNumber)

      Description copied from interface: `Session`
      Clears all the queues messages associated with this session that has sequence number lower than provided number
      Specified by:
        `clearBroadcastedMessages` in interface `Session`

    - #### push

          public void push(TopicKey topicKey,
                  String serializedData)

      Description copied from interface: `Session`
      Pushes given data to given topic key
      Specified by:
        `push` in interface `Session`

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