org.apache.qpid.server.protocol
Class AMQMinaProtocolSession

java.lang.Object
  extended by org.apache.qpid.server.protocol.AMQMinaProtocolSession
All Implemented Interfaces:
org.apache.qpid.framing.ProtocolVersionList, AMQProtocolWriter, AMQVersionAwareProtocolSession, ProtocolVersionAware, Managable, AMQProtocolSession
Direct Known Subclasses:
ClusteredProtocolSession

public class AMQMinaProtocolSession
extends java.lang.Object
implements AMQProtocolSession, org.apache.qpid.framing.ProtocolVersionList, Managable


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.qpid.server.protocol.AMQProtocolSession
AMQProtocolSession.Task
 
Field Summary
 
Fields inherited from interface org.apache.qpid.framing.ProtocolVersionList
PROTOCOL_MAJOR, PROTOCOL_MINOR, pv
 
Constructor Summary
AMQMinaProtocolSession(org.apache.mina.common.IoSession session, VirtualHostRegistry virtualHostRegistry, AMQCodecFactory codecFactory)
           
AMQMinaProtocolSession(org.apache.mina.common.IoSession session, VirtualHostRegistry virtualHostRegistry, AMQCodecFactory codecFactory, AMQStateManager stateManager)
           
 
Method Summary
 void addChannel(AMQChannel channel)
          Associate a channel with this session.
 void addSessionCloseTask(AMQProtocolSession.Task task)
           
 boolean channelAwaitingClosure(int channelId)
          Check to see if this chanel is closing
 void closeChannel(int channelId)
          Close a specific channel.
 void closeChannelOk(int channelId)
          Markes the specific channel as closed.
 void closeSession()
          This must be called when the session is _closed in order to free up any resources managed by the session.
 void commitTransactions(AMQChannel channel)
           
 void dataBlockReceived(AMQDataBlock message)
          Called when a protocol data block is received
 java.lang.String dump()
           
static AMQProtocolSession getAMQProtocolSession(org.apache.mina.common.IoSession minaProtocolSession)
           
 AMQChannel getChannel(int channelId)
          Get the channel for this session associated with the specified id.
 java.util.List<AMQChannel> getChannels()
           
 java.lang.Object getClientIdentifier()
           
 FieldTable getClientProperties()
           
 AMQShortString getContextKey()
          Get the context key associated with this session.
 org.apache.mina.common.IoSession getIOSession()
           
 java.lang.Object getKey()
           
 java.lang.String getLocalFQDN()
          Get the fully qualified domain name of the local address to which this session is bound.
 ManagedObject getManagedObject()
           
 java.lang.Long getMaximumNumberOfChannels()
           
 byte getProtocolMajorVersion()
           
 byte getProtocolMinorVersion()
           
 VersionSpecificRegistry getRegistry()
           
 javax.security.sasl.SaslServer getSaslServer()
           
 VirtualHost getVirtualHost()
           
 void initHeartbeats(int delay)
          Initialise heartbeats on the session.
 boolean isProtocolVersion(byte major, byte minor)
           
 void removeChannel(int channelId)
          In our current implementation this is used by the clustering code.
 void removeSessionCloseTask(AMQProtocolSession.Task task)
           
 void rollbackTransactions(AMQChannel channel)
           
 void setClientProperties(FieldTable clientProperties)
           
 void setContextKey(AMQShortString contextKey)
          Set the context key associated with this session.
 void setMaximumNumberOfChannels(java.lang.Long value)
           
 void setSaslServer(javax.security.sasl.SaslServer saslServer)
          Set the sasl server that is to perform authentication for this session.
 void setVirtualHost(VirtualHost virtualHost)
           
 java.lang.String toString()
           
 void writeFrame(AMQDataBlock frame)
          Convenience method that writes a frame to the protocol session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AMQMinaProtocolSession

public AMQMinaProtocolSession(org.apache.mina.common.IoSession session,
                              VirtualHostRegistry virtualHostRegistry,
                              AMQCodecFactory codecFactory)
                       throws AMQException
Throws:
AMQException

AMQMinaProtocolSession

public AMQMinaProtocolSession(org.apache.mina.common.IoSession session,
                              VirtualHostRegistry virtualHostRegistry,
                              AMQCodecFactory codecFactory,
                              AMQStateManager stateManager)
                       throws AMQException
Throws:
AMQException
Method Detail

getManagedObject

public ManagedObject getManagedObject()
Specified by:
getManagedObject in interface Managable

getIOSession

public org.apache.mina.common.IoSession getIOSession()

getAMQProtocolSession

public static AMQProtocolSession getAMQProtocolSession(org.apache.mina.common.IoSession minaProtocolSession)

dataBlockReceived

public void dataBlockReceived(AMQDataBlock message)
                       throws java.lang.Exception
Description copied from interface: AMQProtocolSession
Called when a protocol data block is received

Specified by:
dataBlockReceived in interface AMQProtocolSession
Parameters:
message - the data block that has been received
Throws:
java.lang.Exception - if processing the datablock fails

writeFrame

public void writeFrame(AMQDataBlock frame)
Convenience method that writes a frame to the protocol session. Equivalent to calling getProtocolSession().write().

Specified by:
writeFrame in interface AMQProtocolWriter
Parameters:
frame - the frame to write

getContextKey

public AMQShortString getContextKey()
Description copied from interface: AMQProtocolSession
Get the context key associated with this session. Context key is described in the AMQ protocol specification (RFC 6).

Specified by:
getContextKey in interface AMQProtocolSession
Returns:
the context key

setContextKey

public void setContextKey(AMQShortString contextKey)
Description copied from interface: AMQProtocolSession
Set the context key associated with this session. Context key is described in the AMQ protocol specification (RFC 6).

Specified by:
setContextKey in interface AMQProtocolSession
Parameters:
contextKey - the context key

getChannels

public java.util.List<AMQChannel> getChannels()

getChannel

public AMQChannel getChannel(int channelId)
                      throws AMQException
Description copied from interface: AMQProtocolSession
Get the channel for this session associated with the specified id. A channel id is unique per connection (i.e. per session).

Specified by:
getChannel in interface AMQProtocolSession
Parameters:
channelId - the channel id which must be valid
Returns:
null if no channel exists, the channel otherwise
Throws:
AMQException

channelAwaitingClosure

public boolean channelAwaitingClosure(int channelId)
Description copied from interface: AMQProtocolSession
Check to see if this chanel is closing

Specified by:
channelAwaitingClosure in interface AMQProtocolSession
Parameters:
channelId - id to check
Returns:
boolean with state of channel awaiting closure

addChannel

public void addChannel(AMQChannel channel)
                throws AMQException
Description copied from interface: AMQProtocolSession
Associate a channel with this session.

Specified by:
addChannel in interface AMQProtocolSession
Parameters:
channel - the channel to associate with this session. It is an error to associate the same channel with more than one session but this is not validated.
Throws:
AMQException

getMaximumNumberOfChannels

public java.lang.Long getMaximumNumberOfChannels()

setMaximumNumberOfChannels

public void setMaximumNumberOfChannels(java.lang.Long value)

commitTransactions

public void commitTransactions(AMQChannel channel)
                        throws AMQException
Throws:
AMQException

rollbackTransactions

public void rollbackTransactions(AMQChannel channel)
                          throws AMQException
Throws:
AMQException

closeChannel

public void closeChannel(int channelId)
                  throws AMQException
Close a specific channel. This will remove any resources used by the channel, including:

Specified by:
closeChannel in interface AMQProtocolSession
Parameters:
channelId - id of the channel to close
Throws:
AMQException - if an error occurs closing the channel
java.lang.IllegalArgumentException - if the channel id is not valid

closeChannelOk

public void closeChannelOk(int channelId)
Description copied from interface: AMQProtocolSession
Markes the specific channel as closed. This will release the lock for that channel id so a new channel can be created on that id.

Specified by:
closeChannelOk in interface AMQProtocolSession
Parameters:
channelId - id of the channel to close

removeChannel

public void removeChannel(int channelId)
In our current implementation this is used by the clustering code.

Specified by:
removeChannel in interface AMQProtocolSession
Parameters:
channelId -

initHeartbeats

public void initHeartbeats(int delay)
Initialise heartbeats on the session.

Specified by:
initHeartbeats in interface AMQProtocolSession
Parameters:
delay - delay in seconds (not ms)

closeSession

public void closeSession()
                  throws AMQException
This must be called when the session is _closed in order to free up any resources managed by the session.

Specified by:
closeSession in interface AMQProtocolSession
Throws:
AMQException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

dump

public java.lang.String dump()

getKey

public java.lang.Object getKey()
Specified by:
getKey in interface AMQProtocolSession
Returns:
an object that can be used to identity

getLocalFQDN

public java.lang.String getLocalFQDN()
Get the fully qualified domain name of the local address to which this session is bound. Since some servers may be bound to multiple addresses this could vary depending on the acceptor this session was created from.

Specified by:
getLocalFQDN in interface AMQProtocolSession
Returns:
a String FQDN

getSaslServer

public javax.security.sasl.SaslServer getSaslServer()
Specified by:
getSaslServer in interface AMQProtocolSession
Returns:
the sasl server that can perform authentication for this session.

setSaslServer

public void setSaslServer(javax.security.sasl.SaslServer saslServer)
Description copied from interface: AMQProtocolSession
Set the sasl server that is to perform authentication for this session.

Specified by:
setSaslServer in interface AMQProtocolSession

getClientProperties

public FieldTable getClientProperties()
Specified by:
getClientProperties in interface AMQProtocolSession

setClientProperties

public void setClientProperties(FieldTable clientProperties)
Specified by:
setClientProperties in interface AMQProtocolSession

getProtocolMajorVersion

public byte getProtocolMajorVersion()
Specified by:
getProtocolMajorVersion in interface ProtocolVersionAware

getProtocolMinorVersion

public byte getProtocolMinorVersion()
Specified by:
getProtocolMinorVersion in interface ProtocolVersionAware

isProtocolVersion

public boolean isProtocolVersion(byte major,
                                 byte minor)

getRegistry

public VersionSpecificRegistry getRegistry()
Specified by:
getRegistry in interface AMQVersionAwareProtocolSession

getClientIdentifier

public java.lang.Object getClientIdentifier()
Specified by:
getClientIdentifier in interface AMQProtocolSession

getVirtualHost

public VirtualHost getVirtualHost()
Specified by:
getVirtualHost in interface AMQProtocolSession

setVirtualHost

public void setVirtualHost(VirtualHost virtualHost)
                    throws AMQException
Specified by:
setVirtualHost in interface AMQProtocolSession
Throws:
AMQException

addSessionCloseTask

public void addSessionCloseTask(AMQProtocolSession.Task task)
Specified by:
addSessionCloseTask in interface AMQProtocolSession

removeSessionCloseTask

public void removeSessionCloseTask(AMQProtocolSession.Task task)
Specified by:
removeSessionCloseTask in interface AMQProtocolSession


Copyright © 2007. All Rights Reserved.