org.apache.qpid.client.state
Class AMQStateManager

java.lang.Object
  extended by org.apache.qpid.client.state.AMQStateManager
All Implemented Interfaces:
AMQMethodListener

public class AMQStateManager
extends java.lang.Object
implements AMQMethodListener

The state manager is responsible for managing the state of the protocol session.

For each AMQProtocolHandler there is a separate state manager.


Constructor Summary
  AMQStateManager()
           
protected AMQStateManager(AMQState state, boolean register)
           
 
Method Summary
 void addStateListener(StateListener listener)
           
 void attainState(AMQState s)
           
 void changeState(AMQState newState)
           
 void error(java.lang.Exception e)
          Callback when an error has occurred.
protected  StateAwareMethodListener findStateTransitionHandler(AMQState currentState, org.apache.qpid.framing.AMQMethodBody frame)
           
 AMQState getCurrentState()
           
 boolean methodReceived(AMQMethodEvent evt)
          Invoked when a method frame has been received
protected  void registerListeners()
           
 void removeStateListener(StateListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AMQStateManager

public AMQStateManager()

AMQStateManager

protected AMQStateManager(AMQState state,
                          boolean register)
Method Detail

registerListeners

protected void registerListeners()

getCurrentState

public AMQState getCurrentState()

changeState

public void changeState(AMQState newState)
                 throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

error

public void error(java.lang.Exception e)
Description copied from interface: AMQMethodListener
Callback when an error has occurred. Allows listeners to clean up.

Specified by:
error in interface AMQMethodListener

methodReceived

public boolean methodReceived(AMQMethodEvent evt)
                       throws org.apache.qpid.AMQException
Description copied from interface: AMQMethodListener
Invoked when a method frame has been received

Specified by:
methodReceived in interface AMQMethodListener
Parameters:
evt - the event
Returns:
true if the handler has processed the method frame, false otherwise. Note that this does not prohibit the method event being delivered to subsequent listeners but can be used to determine if nobody has dealt with an incoming method frame.
Throws:
org.apache.qpid.AMQException - if an error has occurred. This exception will be delivered to all registered listeners using the error() method (see below) allowing them to perform cleanup if necessary.

findStateTransitionHandler

protected StateAwareMethodListener findStateTransitionHandler(AMQState currentState,
                                                              org.apache.qpid.framing.AMQMethodBody frame)
                                                       throws IllegalStateTransitionException
Throws:
IllegalStateTransitionException

addStateListener

public void addStateListener(StateListener listener)

removeStateListener

public void removeStateListener(StateListener listener)

attainState

public void attainState(AMQState s)
                 throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException