net.sf.beep4j.internal.profile
Interface ChannelManagementProfile

All Known Implementing Classes:
ChannelManagementProfileImpl

public interface ChannelManagementProfile

Interface of the channel management profile, which is used on channel 0 of every BEEP session. Channel 0 is a bit special because it exists in every BEEP session as soon as the session is established.

Author:
Simon Raess

Method Summary
 void closeChannel(int channelNumber, CloseChannelCallback callback)
          Send a close channel message.
 void closeSession(CloseCallback callback)
          Closes the session.
 boolean connectionEstablished(java.net.SocketAddress address, SessionHandler handler, Reply response)
          Invoked by the session when the connection has been established.
 ChannelHandler createChannelHandler(SessionManager manager)
          Invoked by the framework to initialize the channel and to get the ChannelHandler for the profile.
 BEEPError receivedError(Message message)
          Invoked by the session when an error has been received during the session startup.
 Greeting receivedGreeting(Message message)
          Invoked by the session when a greeting has been received during the session startup.
 void startChannel(int channelNumber, ProfileInfo[] infos, StartChannelCallback callback)
          Sends a start channel message to the other peer.
 

Method Detail

createChannelHandler

ChannelHandler createChannelHandler(SessionManager manager)
Invoked by the framework to initialize the channel and to get the ChannelHandler for the profile.

Parameters:
manager - the SessionManager to be used by the profile
Returns:
the ChannelHandler for the profile

connectionEstablished

boolean connectionEstablished(java.net.SocketAddress address,
                              SessionHandler handler,
                              Reply response)
Invoked by the session when the connection has been established. The profile must pass this event to the SessionHandler. Depending on the response of the application, either a greeting or an error is sent to the ResponseHandler.

Parameters:
address - address of remote peer
handler - the SessionHandler of the session
response - the ResponseHandler to be used to generate a response
Returns:
true iff the connection is established. Returning false from this method will drop the connection.

receivedGreeting

Greeting receivedGreeting(Message message)
Invoked by the session when a greeting has been received during the session startup. Parses the given message into a Greeting object.

Parameters:
message - the message to be parsed
Returns:
the parsed Greeting object

receivedError

BEEPError receivedError(Message message)
Invoked by the session when an error has been received during the session startup. Parses the given message into a BEEPError object.

Parameters:
message - the message to be parsed
Returns:
the parsed BEEPError object

startChannel

void startChannel(int channelNumber,
                  ProfileInfo[] infos,
                  StartChannelCallback callback)
Sends a start channel message to the other peer.

Parameters:
channelNumber - the channel number of the new peer
infos - the ProfileInfos to be passed inside the profile element in the request
callback - the callback that is invoked when the response is received

closeChannel

void closeChannel(int channelNumber,
                  CloseChannelCallback callback)
Send a close channel message. The corresponding method is invoked on the callback to notify this peer about the outcome of the close request.

Parameters:
channelNumber - the channel to be closed
callback - the callback that is invoked when the response is received

closeSession

void closeSession(CloseCallback callback)
Closes the session. The BEEP specification notes that it is possible for a BEEP peer to decline session closing. However, this does not seem to make a lot of sense. So, if this method is invoked, the session is always closed.

Parameters:
callback - the callback used to notify about the response


Copyright © 2007 null. All Rights Reserved.