## org.beepcore.beep.core
Interface Session

All Known Implementing Classes:
  SessionImpl

public interface Session

This interface represents the operations available for all BEEP Sessions.

A BEEP Session encapsulates a connection for a given transport.

See Also:
  `Channel`

Field Summary
`static int` `SESSION_STATE_ABORTED`
`static int` `SESSION_STATE_ACTIVE`
`static int` `SESSION_STATE_CLOSE_PENDING`
`static int` `SESSION_STATE_CLOSED`
`static int` `SESSION_STATE_CLOSING`
`static int` `SESSION_STATE_GREETING_SENT`
`static int` `SESSION_STATE_INITIALIZED`
`static int` `SESSION_STATE_TUNING`
`static int` `SESSION_STATE_TUNING_PENDING`

Method Summary
`void` `addChannelListener(org.beepcore.beep.core.event.ChannelListener listener)` Adds a listener to be notified of Channel events (start, close, etc.).
`void` `addSessionListener(org.beepcore.beep.core.event.SessionListener listener)` Adds a listener to be notified of Session events (greeting, close, etc.).
`void` `close()` Request to close this `Session` gracefully.
`SessionCredential` `getLocalCredential()` Get the `SessionCredential` used to authenticate this peer of this Session.
`SessionCredential` `getPeerCredential()` Get the `SessionCredential` used to authenticate the remote peer of this Session.
`java.util.Collection` `getPeerSupportedProfiles()` Get the profiles supported by the remote peer.
`ProfileRegistry` `getProfileRegistry()` Get the `ProfileRegistry` for this `Session`.
`int` `getState()` Returns the state of `Session`.
`SessionTuningProperties` `getTuningProperties()`
`boolean` `isInitiator()` Indicates whehter or not this peer is the initiator of this Session.
`void` `removeChannelListener(org.beepcore.beep.core.event.ChannelListener l)` Removes the listener from the list of listeners to be notified of future events.
`void` `removeSessionListener(org.beepcore.beep.core.event.SessionListener l)` Removes the listener from the list of listeners to be notified of future events.
`Channel` `startChannel(java.util.Collection profiles, MessageListener listener)` Deprecated.
`Channel` `startChannel(java.util.Collection profiles, RequestHandler handler)` Sends a start channel request using the given list of profiles.
`Channel` `startChannel(StartChannelProfile profile, RequestHandler handler)` Sends a request to start a new Channel on this Session for the specified profile.
`Channel` `startChannel(java.lang.String profile)` Sends a request to start a new Channel on this Session for the specified profile.
`Channel` `startChannel(java.lang.String profile, boolean base64Encoding, java.lang.String data)` Sends a request to start a new Channel on this Session for the specified profile.
`Channel` `startChannel(java.lang.String profile, boolean base64Encoding, java.lang.String data, MessageListener listener)` Deprecated.
`Channel` `startChannel(java.lang.String profile, MessageListener listener)` Deprecated.
`Channel` `startChannel(java.lang.String profile, RequestHandler handler)` Sends a request to start a new Channel on this Session for the specified profile.
`void` `terminate(java.lang.String reason)` This method is used to terminate the session when there is an non-recoverable error.

Field Detail

### SESSION_STATE_INITIALIZED

    public static final int SESSION_STATE_INITIALIZED

See Also:
  Constant Field Values

### SESSION_STATE_GREETING_SENT

    public static final int SESSION_STATE_GREETING_SENT

See Also:
  Constant Field Values

### SESSION_STATE_ACTIVE

    public static final int SESSION_STATE_ACTIVE

See Also:
  Constant Field Values

### SESSION_STATE_TUNING_PENDING

    public static final int SESSION_STATE_TUNING_PENDING

See Also:
  Constant Field Values

### SESSION_STATE_TUNING

    public static final int SESSION_STATE_TUNING

See Also:
  Constant Field Values

### SESSION_STATE_CLOSE_PENDING

    public static final int SESSION_STATE_CLOSE_PENDING

See Also:
  Constant Field Values

### SESSION_STATE_CLOSING

    public static final int SESSION_STATE_CLOSING

See Also:
  Constant Field Values

### SESSION_STATE_CLOSED

    public static final int SESSION_STATE_CLOSED

See Also:
  Constant Field Values

### SESSION_STATE_ABORTED

    public static final int SESSION_STATE_ABORTED

See Also:
  Constant Field Values

Method Detail

### addChannelListener

    public void addChannelListener(org.beepcore.beep.core.event.ChannelListener listener)

  Adds a listener to be notified of Channel events (start, close, etc.).

  See Also:
    `removeChannelListener(org.beepcore.beep.core.event.ChannelListener)`

### addSessionListener

    public void addSessionListener(org.beepcore.beep.core.event.SessionListener listener)

  Adds a listener to be notified of Session events (greeting, close, etc.).

  See Also:
    `removeSessionListener(org.beepcore.beep.core.event.SessionListener)`

### close

    public void close()
               throws BEEPException

  Request to close this `Session` gracefully. The profiles of the open `Channels` on this `Session` may veto the close request.

  Throws:
    `BEEPException`

### getLocalCredential

    public SessionCredential getLocalCredential()

  Get the `SessionCredential` used to authenticate this peer of this Session.

  Returns:
    `null` if this session has not been authenticated

### getPeerCredential

    public SessionCredential getPeerCredential()

  Get the `SessionCredential` used to authenticate the remote peer of this Session.

  Returns:
    `null` if this session has not been authenticated

### getPeerSupportedProfiles

    public java.util.Collection getPeerSupportedProfiles()

  Get the profiles supported by the remote peer.

### getProfileRegistry

    public ProfileRegistry getProfileRegistry()

  Get the `ProfileRegistry` for this `Session`.

  See Also:
    `ProfileRegistry`

### getState

    public int getState()

  Returns the state of `Session`.

  Returns:
    Session state (see the SESSION_STATE_xxx constants defined in this interface).

### isInitiator

    public boolean isInitiator()

  Indicates whehter or not this peer is the initiator of this Session.

### removeChannelListener

    public void removeChannelListener(org.beepcore.beep.core.event.ChannelListener l)

  Removes the listener from the list of listeners to be notified of future events. Note that the listener will be notified of events which have already happened and are in the process of being dispatched.

  See Also:
    `addChannelListener(org.beepcore.beep.core.event.ChannelListener)`

### removeSessionListener

    public void removeSessionListener(org.beepcore.beep.core.event.SessionListener l)

  Removes the listener from the list of listeners to be notified of future events. Note that the listener will be notified of events which have already happened and are in the process of being dispatched.

  See Also:
    `addSessionListener(org.beepcore.beep.core.event.SessionListener)`

### startChannel

    public Channel startChannel(java.lang.String profile)
                         throws BEEPException,
                                BEEPError

  Sends a request to start a new Channel on this Session for the specified profile.

  Parameters:
    `profile` - The URI of the profile for the new Channel.
  Throws:
    `BEEPError` - Thrown if the remote peer is unable or refuses to start a new Channel for the requested profile.
    `BEEPException` - Thrown for errors other than those defined by the BEEP protocol (e.g. the Session is not in a state to create a new Channel).

### startChannel

    public Channel startChannel(java.lang.String profile,
                                MessageListener listener)
                         throws BEEPException,
                                BEEPError

  Deprecated.

  Sends a request to start a new Channel on this Session for the specified profile. This version of `startChannel` allows a `MessageListener` to be specified to be registered once the Channel is started. This is useful for profiles that are peer-to-peer in nature.

  Parameters:
    `profile` - The URI of the profile for the new Channel.
    `listener` - A `MessageListener` to receive MSG messages sent by the remote peer of this Session.
  Throws:
    `BEEPError` - Thrown if the remote peer is unable or refuses to start a new Channel for the requested profile.
    `BEEPException` - Thrown for errors other than those defined by the BEEP protocol (e.g. the Session is not in a state to create a new Channel).
  See Also:
    `MessageListener`

### startChannel

    public Channel startChannel(java.lang.String profile,
                                RequestHandler handler)
                         throws BEEPException,
                                BEEPError

  Sends a request to start a new Channel on this Session for the specified profile. This version of `startChannel` allows a `RequestHandler` to be specified to be registered once the Channel is started. This is useful for profiles that are peer-to-peer in nature.

  Parameters:
    `profile` - The URI of the profile for the new Channel.
    `handler` - A `RequestHandler` to receive MSG messages sent by the remote peer of this Session.
  Throws:
    `BEEPError` - Thrown if the remote peer is unable or refuses to start a new Channel for the requested profile.
    `BEEPException` - Thrown for errors other than those defined by the BEEP protocol (e.g. the Session is not in a state to create a new Channel).

### startChannel

    public Channel startChannel(java.lang.String profile,
                                boolean base64Encoding,
                                java.lang.String data)
                         throws BEEPException,
                                BEEPError

  Sends a request to start a new Channel on this Session for the specified profile. This version of `startChannel` allows a `MessageListener` to be specified to be registered once the Channel is started. This is useful for profiles that are peer-to-peer in nature.

  Parameters:
    `profile` - The URI of the profile for the new Channel.
    `base64Encoding` - Indicates whether or not `data` is base64 encoded. `data` must be base64 encoded if it is not valid XML CDATA.
    `data` - An initial request to be sent piggyback'd along with the request to start the Channel. This request can be at most 4K in size.
  Throws:
    `BEEPError` - Thrown if the remote peer is unable or refuses to start a new Channel for the requested profile.
    `BEEPException` - Thrown for errors other than those defined by the BEEP protocol (e.g. the Session is not in a state to create a new Channel).
  See Also:
    `MessageListener`

### startChannel

    public Channel startChannel(java.lang.String profile,
                                boolean base64Encoding,
                                java.lang.String data,
                                MessageListener listener)
                         throws BEEPException,
                                BEEPError

  Deprecated.

  Sends a request to start a new Channel on this Session for the specified profile. This version of `startChannel` allows a `MessageListener` to be specified to be registered once the Channel is started. This is useful for profiles that are peer-to-peer in nature.

  Parameters:
    `profile` - The URI of the profile for the new Channel.
    `base64Encoding` - Indicates whether or not `data` is base64 encoded. `data` must be base64 encoded if it is not valid XML CDATA.
    `data` - An initial request to be sent piggyback'd along with the request to start the Channel. This request can be at most 4K in size.
    `listener` - A `MessageListener` to receive MSG messages sent by the remote peer of this Session.
  Throws:
    `BEEPError` - Thrown if the remote peer is unable or refuses to start a new Channel for the requested profile.
    `BEEPException` - Thrown for errors other than those defined by the BEEP protocol (e.g. the Session is not in a state to create a new Channel).
  See Also:
    `MessageListener`

### startChannel

    public Channel startChannel(StartChannelProfile profile,
                                RequestHandler handler)
                         throws BEEPException,
                                BEEPError

  Sends a request to start a new Channel on this Session for the specified profile. This version of `startChannel` allows a `RequestHandler` to be specified to be registered once the Channel is started.

  Parameters:
    `profile` -
    `handler` - A `RequestHandler` to receive MSG messages sent by the remote peer of this Session.
  Throws:
    `BEEPError` - Thrown if the remote peer is unable or refuses to start a new Channel for the requested profile.
    `BEEPException` - Thrown for errors other than those defined by the BEEP protocol (e.g. the Session is not in a state to create a new Channel).

### startChannel

    public Channel startChannel(java.util.Collection profiles,
                                MessageListener listener)
                         throws BEEPException,
                                BEEPError

  Deprecated.

  Sends a start channel request using the given list of profiles.

  Parameters:
    `profiles` - A collection of `StartChannelProfile`(s).
    `listener` - A `MessageListener` to receive MSG messages sent by the remote peer of this Session.
  Throws:
    `BEEPError` - Thrown if the remote peer is unable or refuses to start a new Channel for the requested profile.
    `BEEPException` - Thrown for errors other than those defined by the BEEP protocol (e.g. the Session is not in a state to create a new Channel).
  See Also:
    `StartChannelProfile`, `MessageListener`

### startChannel

    public Channel startChannel(java.util.Collection profiles,
                                RequestHandler handler)
                         throws BEEPException,
                                BEEPError

  Sends a start channel request using the given list of profiles.

  Parameters:
    `profiles` - A collection of `StartChannelProfile`(s).
    `handler` - A `RequestHandler` to receive MSG messages sent by the remote peer of this Session.
  Throws:
    `BEEPError` - Thrown if the remote peer is unable or refuses to start a new Channel for the requested profile.
    `BEEPException` - Thrown for errors other than those defined by the BEEP protocol (e.g. the Session is not in a state to create a new Channel).
  See Also:
    `StartChannelProfile`, `RequestHandler`

### terminate

    public void terminate(java.lang.String reason)

  This method is used to terminate the session when there is an non-recoverable error.

  Parameters:
    `reason` -

### getTuningProperties

    public SessionTuningProperties getTuningProperties()

Copyright ? 2001 Invisible Worlds, Inc. All Rights Reserved.