Home » axis2-1.5-src » org.apache » axis2 » context » [javadoc | source]
public class: OperationContext [javadoc | source]

All Implemented Interfaces:
    SafeSerializable, Externalizable

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.

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.
Fields inherited from org.apache.axis2.context.AbstractContext:
COPY_PROPERTIES,  lastTouchedTime,  parent,  properties
 public OperationContext() 
 public OperationContext(AxisOperation axisOperation,
    ServiceContext serviceContext) 
    Constructs a new OperationContext.
    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 from org.apache.axis2.context.OperationContext Summary:
activate,   addMessageContext,   cleanup,   getAxisOperation,   getConfigurationContext,   getLogCorrelationIDString,   getMessageContext,   getMessageContexts,   getOperationName,   getRootContext,   getServiceContext,   getServiceGroupName,   getServiceName,   isComplete,   isEquivalent,   isolateMessageContext,   readExternal,   removeMessageContext,   restoreMessageContext,   setComplete,   setKey,   writeExternal
Methods from org.apache.axis2.context.AbstractContext:
clearPropertyDifferences,   flush,   getLastTouchedTime,   getLocalProperty,   getParent,   getProperties,   getProperty,   getPropertyDifferences,   getPropertyNames,   getPropertyNonReplicable,   getRootContext,   isAncestor,   mergeProperties,   removeProperty,   removePropertyNonReplicable,   setLastTouchedTime,   setNonReplicableProperty,   setParent,   setProperties,   setProperty,   touch
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.axis2.context.OperationContext Detail:
 public  void activate(ConfigurationContext cc) 
    This method checks to see if additional work needs to be done in order to complete the object reconstitution. Some parts of the object restored from the readExternal() cannot be completed until we have a configurationContext from the active engine. The configurationContext is used to help this object to plug back into the engine's configuration and deployment objects.
 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.
 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.
 public AxisOperation getAxisOperation() 
 public ConfigurationContext getConfigurationContext() 
    Returns the EngineContext in which the parent ServiceContext lives.
 public String getLogCorrelationIDString() 
    Get the ID associated with this object instance.
 public MessageContext getMessageContext(String messageLabel) throws AxisFault 
 public HashMap getMessageContexts() 
 public String getOperationName() 
    Get the name associated with the operation.
 public ConfigurationContext getRootContext() 
 public ServiceContext getServiceContext() 
    Returns the ServiceContext in which this OperationContext lives.
 public String getServiceGroupName() 
    Get the name associated with the service group.
 public String getServiceName() 
    Get the name associated with the service.
 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.
 public boolean isEquivalent(OperationContext ctx) 
    Compares key parts of the state from the current instance of this class with the specified instance to see if they are equivalent.

    This differs from the java.lang.Object.equals() method in that the equals() method generally looks at both the object identity (location in memory) and the object state (data).

 public  void isolateMessageContext(MessageContext mc) 
    Isolate the specified message context object to prepare for serialization. Instead of saving the entire message context object, just setup some metadata about the message context.

    Note: this will remove the specified message context object from the message context table.

 public  void readExternal(ObjectInput inObject) throws ClassNotFoundException, IOException 
    Restore the contents of the object that was previously saved.

    NOTE: The field data must read back in the same order and type as it was written. Some data will need to be validated when resurrected.

 public  void removeMessageContext(String label) throws AxisFault 
    Remove the indicated message context. Example Usage: The exchange is aborted and we need to undo the work and free resources.
 public  void restoreMessageContext(MessageContext msg) 
    Restore the specified MessageContext object in the table used to hold the message contexts associated with this operation.
 public  void setComplete(boolean complete) 
 public  void setKey(String key) 
 public  void writeExternal(ObjectOutput o) throws IOException 
    Save the contents of this object.

    NOTE: Transient fields and static fields are not saved. Also, objects that represent "static" data are not saved, except for enough information to be able to find matching objects when the message context is re-constituted.