org.apache.axis2.context
Class OperationContext

java.lang.Object
  extended by org.apache.axis2.context.AbstractContext
      extended by org.apache.axis2.context.OperationContext

public class OperationContext
extends AbstractContext

An OperationContext represents a running "instance" of an operation, which is represented by an AxisOperation object. This concept is needed to allow messages to be grouped into operations as in WSDL 2.0-speak operations are essentially arbitrary message exchange patterns. So as messages are being exchanged the OperationContext remembers the state of where in the message exchange pattern it is in.

OperationContextFactory factory. The base implementation of OperationContext supports MEPs which have one input message and/or one output message. That is, it supports the all the MEPs that are in the WSDL 2.0 specification. In order to support another MEP one must extend this class and register its creation in the OperationContexFactory.


Field Summary
 
Fields inherited from class org.apache.axis2.context.AbstractContext
COPY_PROPERTIES, lastTouchedTime, parent, properties
 
Constructor Summary
OperationContext(AxisOperation axisOperation)
           
OperationContext(AxisOperation axisOperation, ServiceContext serviceContext)
          Constructs a new OperationContext.
 
Method Summary
 void addMessageContext(MessageContext msgContext)
          When a new message is added to the MEPContext the logic should be included remove the MEPContext from the table in the EngineContext.
 void cleanup()
          Removes the pointers to this OperationContext in the ConfigurationContext's OperationContextMap so that this OperationContext will eventually get garbage collected along with the MessageContext's it contains.
 AxisOperation getAxisOperation()
           
 ConfigurationContext getConfigurationContext()
          Returns the EngineContext in which the parent ServiceContext lives.
 MessageContext getMessageContext(String messageLabel)
           
 HashMap getMessageContexts()
           
 ServiceContext getServiceContext()
          Returns the ServiceContext in which this OperationContext lives.
 boolean isComplete()
          Checks to see if the MEP is complete. i.e. whether all the messages that are associated with the MEP has arrived and MEP is complete.
 void setComplete(boolean complete)
           
 void setKey(String key)
           
 void setParent(AbstractContext context)
           
 
Methods inherited from class org.apache.axis2.context.AbstractContext
getLastTouchedTime, getParent, getProperties, getProperty, setProperties, setProperty, touch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationContext

public OperationContext(AxisOperation axisOperation)

OperationContext

public OperationContext(AxisOperation axisOperation,
                        ServiceContext serviceContext)
Constructs a new OperationContext.

Parameters:
axisOperation - the AxisOperation whose running instances' state this OperationContext represents.
serviceContext - the parent ServiceContext representing any state related to the set of all operations of the service.
Method Detail

addMessageContext

public void addMessageContext(MessageContext msgContext)
                       throws AxisFault
When a new message is added to the MEPContext the logic should be included remove the MEPContext from the table in the EngineContext. Example: IN_IN_OUT At the second IN message the MEPContext should be removed from the AxisOperation.

Parameters:
msgContext -
Throws:
AxisFault

cleanup

public void cleanup()
Removes the pointers to this OperationContext in the ConfigurationContext's OperationContextMap so that this OperationContext will eventually get garbage collected along with the MessageContext's it contains. Note that if the caller wants to make sure its safe to clean up this OperationContext he should call isComplete() first. However, in cases like IN_OPTIONAL_OUT and OUT_OPTIONAL_IN, it is possibe this will get called without the MEP being complete due to the optional nature of the MEP.


getAxisOperation

public AxisOperation getAxisOperation()
Returns:
Returns the axisOperation.

getConfigurationContext

public ConfigurationContext getConfigurationContext()
Returns the EngineContext in which the parent ServiceContext lives.

Returns:
Returns parent ServiceContext's parent EngineContext.

getMessageContext

public MessageContext getMessageContext(String messageLabel)
                                 throws AxisFault
Parameters:
messageLabel -
Returns:
Returns MessageContext.
Throws:
AxisFault

getMessageContexts

public HashMap getMessageContexts()

getServiceContext

public ServiceContext getServiceContext()
Returns the ServiceContext in which this OperationContext lives.

Returns:
Returns parent ServiceContext.

isComplete

public boolean isComplete()
Checks to see if the MEP is complete. i.e. whether all the messages that are associated with the MEP has arrived and MEP is complete.


setComplete

public void setComplete(boolean complete)

setParent

public void setParent(AbstractContext context)
Overrides:
setParent in class AbstractContext

setKey

public void setKey(String key)