net.sf.beep4j.ext
Class SessionHandlerAdapter

java.lang.Object
  extended by net.sf.beep4j.ext.SessionHandlerAdapter
All Implemented Interfaces:
SessionHandler

public abstract class SessionHandlerAdapter
extends java.lang.Object
implements SessionHandler

Base class for SessionHandler implementations. Some of the methods of the SessionHandler interface are implemented by this abstract class. Feel free to override the methods as necessary.

Author:
Simon Raess

Constructor Summary
SessionHandlerAdapter()
           
 
Method Summary
 void channelStartRequested(StartChannelRequest request)
          Notifies the handler that the remote peer wants to open a channel.
 void connectionEstablished(StartSessionRequest s)
          Does not register a profile.
protected  Session getSession()
          Get the associated Session object.
 void sessionClosed()
          Notifies the handler that the Session has been closed.
 void sessionOpened(Session session)
          Notifies the handler that the Session was successfully established.
 void sessionStartDeclined(int code, java.lang.String message)
          Notifies the handler that the session start was refused by the remote peer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionHandlerAdapter

public SessionHandlerAdapter()
Method Detail

getSession

protected Session getSession()
Get the associated Session object. This method will return null as long as sessionOpened(Session) has not been invoked and will return after sessionClosed() has been invoked.

Returns:
the associated Session object

connectionEstablished

public void connectionEstablished(StartSessionRequest s)
Does not register a profile.

Specified by:
connectionEstablished in interface SessionHandler
Parameters:
s - the session startup object

sessionStartDeclined

public void sessionStartDeclined(int code,
                                 java.lang.String message)
Notifies the handler that the session start was refused by the remote peer. This method does nothing. If you need to know about this type of event, override the method.

Specified by:
sessionStartDeclined in interface SessionHandler
Parameters:
code - the reason code
message - the human readable message

sessionOpened

public void sessionOpened(Session session)
Notifies the handler that the Session was successfully established. This class keeps a reference to the Session object, which can be retrieved throught the getSession() method.

Specified by:
sessionOpened in interface SessionHandler
Parameters:
session - the Session object

channelStartRequested

public void channelStartRequested(StartChannelRequest request)
Notifies the handler that the remote peer wants to open a channel. The passed in request can be used to find out which profiles the other peer prefers. This method simply cancels the request. If you want to support profiles, you should override this method and register some profiles. Do not call the super class method in that case.

Specified by:
channelStartRequested in interface SessionHandler
Parameters:
request - all the information about the request to start a channel

sessionClosed

public void sessionClosed()
Notifies the handler that the Session has been closed. This method simply sets the reference to the Session object to null.

Specified by:
sessionClosed in interface SessionHandler


Copyright © 2007 null. All Rights Reserved.