net.sf.beep4j
Interface Session

All Known Subinterfaces:
InternalSession
All Known Implementing Classes:
SessionImpl

public interface Session

Represents a BEEP session with another peer. It allows to close the session or start one or several channels. The Session interface represents the outgoing view of a BEEP peer. The corresponding incoming interface is the SessionHandler.

Author:
Simon Raess

Method Summary
 void close()
          Closes the session.
 java.lang.String[] getProfiles()
          Gets the list of profiles supported by the remote peer.
 void startChannel(ProfileInfo[] profiles, ChannelHandlerFactory factory)
          Tries to start a new channel using one of the profiles passed in.
 void startChannel(ProfileInfo profile, ChannelHandler handler)
          Tries to start a new channel using the profile passed in.
 void startChannel(java.lang.String profileUri, ChannelHandler handler)
          Tries to start a new channel using the profile identified by the given uri.
 

Method Detail

getProfiles

java.lang.String[] getProfiles()
Gets the list of profiles supported by the remote peer. It may be that the peer supports additional profiles, which it did not advertise and which are thus not returned from this method.

Returns:
an array of advertised profiles by the other peer

startChannel

void startChannel(java.lang.String profileUri,
                  ChannelHandler handler)
Tries to start a new channel using the profile identified by the given uri. The returned Future can be used to wait until the channel has been established. It returns only after the passed in ChannelHandler.channelOpened(Channel) method returns.

Parameters:
profileUri - the uri of the profile to be used on the channel
handler - the channel handler for the new channel

startChannel

void startChannel(ProfileInfo profile,
                  ChannelHandler handler)
Tries to start a new channel using the profile passed in. Use this method if you have to pass initialization data along the start channel request. See startChannel(String, ChannelHandler) for the details.

Parameters:
profile - the profile
handler - the channel handler for the new channel

startChannel

void startChannel(ProfileInfo[] profiles,
                  ChannelHandlerFactory factory)
Tries to start a new channel using one of the profiles passed in. Use this method if you have to pass initialization data along the start channel request. See startChannel(String, ChannelHandler) for the details.

Parameters:
profiles - the profiles from which the other peer can choose
factory - the factory that creates new ChannelHandlers for the new channel

close

void close()
Closes the session. Note that this method blocks until all outstanding requests have been sent and all requests received up to the moment this method is called have been properly replied to. It ignores negative replies to a close request from the other peer.



Copyright © 2007 null. All Rights Reserved.