Class OperationContext

  • All Implemented Interfaces:
    Externalizable, Serializable, SafeSerializable

    public class OperationContext
    extends AbstractContext
    implements Externalizable, SafeSerializable
    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.

    See Also:
    Serialized Form
    • Constructor Detail

      • OperationContext

        public OperationContext()
        Simple constructor (needed for deserialization, shouldn't be used otherwise!)
      • 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 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.
        msgContext -
      • 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 the axisOperation.
      • getConfigurationContext

        public ConfigurationContext getConfigurationContext()
        Returns the EngineContext in which the parent ServiceContext lives.
        Returns parent ServiceContext's parent EngineContext.
      • getMessageContext

        public MessageContext getMessageContext​(String messageLabel)
                                         throws AxisFault
        Get the message context identified by a given label.
        messageLabel - The label of the message context to retrieve. This should be one of the MESSAGE_LABEL_xxx constants defined in WSDLConstants.
        the message context for the given label, or null if no message context was found
        AxisFault - never
      • removeMessageContext

        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.
        label -
      • getServiceContext

        public ServiceContext getServiceContext()
        Returns the ServiceContext in which this OperationContext lives.
        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)
      • setKey

        public void setKey​(String key)
      • writeExternal

        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.

        Specified by:
        writeExternal in interface Externalizable
        out - The stream to write the object contents to
      • activate

        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.
        cc - The configuration context object representing the active configuration
      • isolateMessageContext

        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.

        mc - The message context object
      • restoreMessageContext

        public void restoreMessageContext​(MessageContext msg)
        Restore the specified MessageContext object in the table used to hold the message contexts associated with this operation.
        msg - The message context object
      • getOperationName

        public String getOperationName()
        Get the name associated with the operation.
        The name String
      • getServiceName

        public String getServiceName()
        Get the name associated with the service.
        The name String
      • getServiceGroupName

        public String getServiceGroupName()
        Get the name associated with the service group.
        The name String
      • isEquivalent

        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).

        ctx - The object to compare with
        TRUE if this object is equivalent with the specified object that is, key fields match FALSE, otherwise
      • getLogCorrelationIDString

        public String getLogCorrelationIDString()
        Get the ID associated with this object instance.
        A string that can be output to a log file as an identifier for this object instance. It is suitable for matching related log entries.