org.apache.axis2.context
Class OperationContext

java.lang.Object
  extended byorg.apache.axis2.context.AbstractContext
      extended byorg.apache.axis2.context.OperationContext
All Implemented Interfaces:
java.io.Serializable

public class OperationContext
extends AbstractContext

An OperationContext represents a running "instance" of an operation, which is represented by an OperationDescription 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.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.axis2.context.AbstractContext
nonPersistentMap, parent, persistentMap
 
Constructor Summary
OperationContext(OperationDescription axisOperation)
           
OperationContext(OperationDescription axisOperation, ServiceContext serviceContext)
          Construct 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 EngineContext's OperationContextMap so that this OperationContext will eventually get garbage collected along with the MessageContext's it contains.
 OperationDescription getAxisOperation()
           
 ConfigurationContext getEngineContext()
          Return the EngineContext in which the parent ServiceContext lives.
 MessageContext getMessageContext(int messageLabel)
           
 ServiceContext getServiceContext()
          Return the ServiceContext in which this OperationContext lives.
 void init(AxisConfiguration axisConfiguration)
          The method is used to do the intialization of the EngineContext
 boolean isComplete()
          Checks to see if the MEP is complete.
 void setParent(AbstractContext context)
           
 
Methods inherited from class org.apache.axis2.context.AbstractContext
getNonPersistentMap, getParent, getPersistentMap, getProperty, getProperty, setProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationContext

public OperationContext(OperationDescription axisOperation,
                        ServiceContext serviceContext)
Construct a new OperationContext.

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

OperationContext

public OperationContext(OperationDescription axisOperation)
Method Detail

init

public void init(AxisConfiguration axisConfiguration)
          throws AxisFault
The method is used to do the intialization of the EngineContext

Specified by:
init in class AbstractContext
Throws:
AxisFault

getAxisOperation

public OperationDescription getAxisOperation()
Returns:
Returns the axisOperation.

getServiceContext

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

Returns:
parent ServiceContext

getEngineContext

public ConfigurationContext getEngineContext()
Return the EngineContext in which the parent ServiceContext lives.

Returns:
parent ServiceContext's parent EngineContext

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 OperationDescription

Parameters:
msgContext -
Throws:
AxisFault

getMessageContext

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

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.

Returns:

cleanup

public void cleanup()
Removes the pointers to this OperationContext in the EngineContext'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.


setParent

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