|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.beep4j.internal.SessionImpl
public class SessionImpl
Default implementation of the Session interface. Objects of this class are the central object in a BEEP session.
Nested Class Summary | |
---|---|
protected class |
SessionImpl.AbstractSessionState
|
protected class |
SessionImpl.AliveState
|
protected class |
SessionImpl.DeadState
|
protected class |
SessionImpl.DefaultReply
|
protected class |
SessionImpl.InitialReply
|
protected class |
SessionImpl.InitialState
|
protected static interface |
SessionImpl.SessionState
|
protected class |
SessionImpl.WaitForResponseState
|
Constructor Summary | |
---|---|
SessionImpl(boolean initiator,
SessionHandler sessionHandler,
TransportMapping mapping)
|
Method Summary | |
---|---|
protected void |
addSessionListener(SessionListener l)
|
void |
channelCloseRequested(int channelNumber,
CloseChannelRequest request)
Requests to close the channel identified by the given channel number. |
StartChannelResponse |
channelStartRequested(int channelNumber,
ProfileInfo[] profiles)
Requests to start a new channel or cancels the request. |
void |
close()
Closes the session. |
void |
connectionClosed()
Invoked by the Transport when the underlying physical connection has been closed. |
void |
connectionEstablished(java.net.SocketAddress address)
Notifies the context that the physical connection has been established. |
protected InternalChannel |
createChannel(InternalSession session,
java.lang.String profileUri,
int channelNumber)
|
protected ChannelManagementProfile |
createChannelManagementProfile(boolean initiator)
|
FrameHandler |
createFrameHandler()
|
protected Reply |
createReply(TransportMapping mapping,
int channelNumber,
int messageNumber)
|
protected StreamParser |
createStreamParser(FrameHandler frameHandler,
TransportMapping mapping)
|
void |
exceptionCaught(java.lang.Throwable cause)
Invoked by the Transport to notify the context about an exception that has been caught while sending or processing a message. |
protected void |
fireChannelClosed(int channel)
|
protected void |
fireChannelStarted(int channel)
|
java.lang.String[] |
getProfiles()
Gets the list of profiles supported by the remote peer. |
protected void |
initChannelManagementProfile()
|
protected void |
lock()
|
void |
messageReceived(java.nio.ByteBuffer buffer)
Invoked by the Transport whenever new content has been received. |
void |
receiveANS(int channelNumber,
int messageNumber,
int answerNumber,
Message message)
Receive a ANS message. |
void |
receiveERR(int channelNumber,
int messageNumber,
Message message)
Receive a ERR message. |
void |
receiveMSG(int channelNumber,
int messageNumber,
Message message)
Receive a MSG message. |
void |
receiveNUL(int channelNumber,
int messageNumber)
Receive a NUL message. |
void |
receiveRPY(int channelNumber,
int messageNumber,
Message message)
Receive a RPY message. |
void |
requestChannelClose(int channelNumber,
CloseChannelCallback callback)
|
void |
sendMessage(int channelNumber,
Message message,
ReplyHandler listener)
|
void |
sessionCloseRequested(CloseCallback callback)
Closes the session. |
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. |
protected void |
unlock()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SessionImpl(boolean initiator, SessionHandler sessionHandler, TransportMapping mapping)
Method Detail |
---|
protected StreamParser createStreamParser(FrameHandler frameHandler, TransportMapping mapping)
protected ChannelManagementProfile createChannelManagementProfile(boolean initiator)
protected void initChannelManagementProfile()
protected InternalChannel createChannel(InternalSession session, java.lang.String profileUri, int channelNumber)
protected Reply createReply(TransportMapping mapping, int channelNumber, int messageNumber)
protected void lock()
protected void unlock()
protected void addSessionListener(SessionListener l)
protected void fireChannelStarted(int channel)
protected void fireChannelClosed(int channel)
public java.lang.String[] getProfiles()
Session
getProfiles
in interface Session
public void startChannel(java.lang.String profileUri, ChannelHandler handler)
Session
ChannelHandler.channelOpened(Channel)
method returns.
startChannel
in interface Session
profileUri
- the uri of the profile to be used on the channelhandler
- the channel handler for the new channelpublic void startChannel(ProfileInfo profile, ChannelHandler handler)
Session
Session.startChannel(String, ChannelHandler)
for the details.
startChannel
in interface Session
profile
- the profilehandler
- the channel handler for the new channelpublic void startChannel(ProfileInfo[] profiles, ChannelHandlerFactory factory)
Session
Session.startChannel(String, ChannelHandler)
for the details.
startChannel
in interface Session
profiles
- the profiles from which the other peer can choosefactory
- the factory that creates new ChannelHandlers for the new channelpublic void close()
Session
close
in interface Session
public void sendMessage(int channelNumber, Message message, ReplyHandler listener)
sendMessage
in interface InternalSession
public void requestChannelClose(int channelNumber, CloseChannelCallback callback)
requestChannelClose
in interface InternalSession
public FrameHandler createFrameHandler()
createFrameHandler
in interface FrameHandlerFactory
public StartChannelResponse channelStartRequested(int channelNumber, ProfileInfo[] profiles)
SessionManager
channelStartRequested
in interface SessionManager
channelNumber
- the channel numberprofiles
- the list of acceptable profiles
public void channelCloseRequested(int channelNumber, CloseChannelRequest request)
SessionManager
channelCloseRequested
in interface SessionManager
channelNumber
- the channel numberrequest
- the close requestpublic void sessionCloseRequested(CloseCallback callback)
SessionManager
sessionCloseRequested
in interface SessionManager
callback
- the callback that gets notified about the outcomepublic void receiveMSG(int channelNumber, int messageNumber, Message message)
MessageHandler
receiveMSG
in interface MessageHandler
channelNumber
- the channel numbermessageNumber
- the message numbermessage
- the Message itselfpublic void receiveANS(int channelNumber, int messageNumber, int answerNumber, Message message)
MessageHandler
receiveANS
in interface MessageHandler
channelNumber
- the channel numbermessageNumber
- the message numberanswerNumber
- the answer numbermessage
- the Message itselfpublic void receiveNUL(int channelNumber, int messageNumber)
MessageHandler
receiveNUL
in interface MessageHandler
channelNumber
- the channel numbermessageNumber
- the message numberpublic void receiveERR(int channelNumber, int messageNumber, Message message)
MessageHandler
receiveERR
in interface MessageHandler
channelNumber
- the channel numbermessageNumber
- the message numbermessage
- the Message itselfpublic void receiveRPY(int channelNumber, int messageNumber, Message message)
MessageHandler
receiveRPY
in interface MessageHandler
channelNumber
- the channel numbermessageNumber
- the message numbermessage
- the Message itselfpublic void connectionEstablished(java.net.SocketAddress address)
TransportContext
connectionEstablished
in interface TransportContext
address
- the SocketAddress of the remote peerpublic void exceptionCaught(java.lang.Throwable cause)
TransportContext
exceptionCaught
in interface TransportContext
cause
- the causing exceptionpublic void messageReceived(java.nio.ByteBuffer buffer)
TransportContext
messageReceived
in interface TransportContext
buffer
- the received bytespublic void connectionClosed()
TransportContext
connectionClosed
in interface TransportContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |