Example usage for javax.xml.namespace QName getLocalPart

List of usage examples for javax.xml.namespace QName getLocalPart

Introduction

In this page you can find the example usage for javax.xml.namespace QName getLocalPart.

Prototype

public String getLocalPart() 

Source Link

Document

Get the local part of this QName.

Usage

From source file:org.apache.axis2.addressing.EndpointReferenceHelper.java

/**
 * Creates an <code>OMElement</code> based on the properties of the endpoint
 * reference. The output may differ based on the addressing namespace that is
 * in effect when this method is called. If the http://www.w3.org/2005/08/addressing
 * namespace is in effect, and a metadata property has been defined for the
 * endpoint reference, then there will be a metadata element to contain the
 * property in the output. If the http://schemas.xmlsoap.org/ws/2004/08/addressing
 * namespace is in effect, however, then no metadata element will be included
 * in the output, even if a metadata property element has been defined.
 *
 * @param factory/* w w  w. j a va2  s . c  o m*/
 * @param epr
 * @param qname
 * @param addressingNamespace
 * @return
 * @throws AxisFault
 */
public static OMElement toOM(OMFactory factory, EndpointReference epr, QName qname, String addressingNamespace)
        throws AxisFault {
    OMElement eprElement = null;

    if (log.isDebugEnabled()) {
        log.debug("toOM: Factory, " + factory);
        log.debug("toOM: Endpoint reference, " + epr);
        log.debug("toOM: Element qname, " + qname);
        log.debug("toOM: Addressing namespace, " + addressingNamespace);
    }

    if (addressingNamespace == null) {
        throw new AxisFault("Addressing namespace cannot be null.");
    }

    if (qname.getPrefix() != null) {
        OMNamespace wrapNs = factory.createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
        if (factory instanceof SOAPFactory) {
            eprElement = ((SOAPFactory) factory).createSOAPHeaderBlock(qname.getLocalPart(), wrapNs);
        } else {
            eprElement = factory.createOMElement(qname.getLocalPart(), wrapNs);
        }

        OMNamespace wsaNS = factory.createOMNamespace(addressingNamespace,
                AddressingConstants.WSA_DEFAULT_PREFIX);
        OMElement addressE = factory.createOMElement(AddressingConstants.EPR_ADDRESS, wsaNS, eprElement);
        String address = epr.getAddress();
        addressE.setText(address);

        ArrayList addressAttributes = epr.getAddressAttributes();
        if (addressAttributes != null) {
            Iterator attrIter = addressAttributes.iterator();
            while (attrIter.hasNext()) {
                OMAttribute omAttribute = (OMAttribute) attrIter.next();
                AttributeHelper.importOMAttribute(omAttribute, addressE);
            }
        }

        List metaData = epr.getMetaData();
        if (metaData != null && AddressingConstants.Final.WSA_NAMESPACE.equals(addressingNamespace)) {
            OMElement metadataE = factory.createOMElement(AddressingConstants.Final.WSA_METADATA, wsaNS,
                    eprElement);
            for (int i = 0, size = metaData.size(); i < size; i++) {
                OMElement omElement = (OMElement) metaData.get(i);
                metadataE.addChild(ElementHelper.importOMElement(omElement, factory));
            }

            ArrayList metadataAttributes = epr.getMetadataAttributes();
            if (metadataAttributes != null) {
                Iterator attrIter = metadataAttributes.iterator();
                while (attrIter.hasNext()) {
                    OMAttribute omAttribute = (OMAttribute) attrIter.next();
                    AttributeHelper.importOMAttribute(omAttribute, metadataE);
                }
            }
        }

        Map referenceParameters = epr.getAllReferenceParameters();
        if (referenceParameters != null) {
            OMElement refParameterElement = factory
                    .createOMElement(AddressingConstants.EPR_REFERENCE_PARAMETERS, wsaNS, eprElement);
            Iterator iterator = referenceParameters.values().iterator();
            while (iterator.hasNext()) {
                OMElement omElement = (OMElement) iterator.next();
                refParameterElement.addChild(ElementHelper.importOMElement(omElement, factory));
            }
        }

        List attributes = epr.getAttributes();
        if (attributes != null) {
            for (int i = 0, size = attributes.size(); i < size; i++) {
                OMAttribute omAttribute = (OMAttribute) attributes.get(i);
                AttributeHelper.importOMAttribute(omAttribute, eprElement);
            }
        }

        // add xs:any
        List extensibleElements = epr.getExtensibleElements();
        if (extensibleElements != null) {
            for (int i = 0, size = extensibleElements.size(); i < size; i++) {
                OMElement omElement = (OMElement) extensibleElements.get(i);
                eprElement.addChild(ElementHelper.importOMElement(omElement, factory));
            }
        }
    } else {
        throw new AxisFault("prefix must be specified");
    }

    return eprElement;
}

From source file:org.apache.axis2.addressing.wsdl.WSDL11ActionHelper.java

private static String getWSAWActionExtensionAttribute(AttributeExtensible ae) {
    // Search first for a wsaw:Action using the submission namespace
    Object attribute = ae.getExtensionAttribute(submissionWSAWNS);
    // Then if that did not exist one using the w3c WSAM namespace
    if (attribute == null) {
        attribute = ae.getExtensionAttribute(finalWSAMNS);
    }/*from w ww .j  av  a2s.  c  o  m*/
    // Then if that did not exist one using the w3c WSAW namespace
    // (for backwards compat reasons)
    if (attribute == null) {
        attribute = ae.getExtensionAttribute(finalWSAWNS);
    }
    // Then finally if that did not exist, try the 2005/08 NS
    // (Included here because it's needed for Apache Muse)
    if (attribute == null) {
        attribute = ae.getExtensionAttribute(finalWSANS);
    }

    // wsdl4j may return a String, QName or a List of either
    // If it is a list, extract the first element
    if (attribute instanceof List) {
        List l = (List) attribute;
        if (l.size() > 0) {
            attribute = l.get(0);
        } else {
            attribute = null;
        }
    }

    // attribute must now be a QName or String or null
    // If it is a QName, take the LocalPart as a String
    if (attribute instanceof QName) {
        QName qn = (QName) attribute;
        attribute = qn.getLocalPart();
    }

    if ((attribute instanceof String)) {
        String result = (String) attribute;
        log.trace(result);
        return result;
    } else {
        if (log.isTraceEnabled()) {
            log.trace("No wsaw:Action attribute found");
        }
        return null;
    }
}

From source file:org.apache.axis2.builder.BuilderUtil.java

public static SOAPEnvelope buildsoapMessage(MessageContext messageContext,
        MultipleEntryHashMap requestParameterMap, SOAPFactory soapFactory) throws AxisFault {

    SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();
    SOAPBody body = soapEnvelope.getBody();
    XmlSchemaElement xmlSchemaElement;/*from   ww  w  .  j a va  2  s .  c  om*/
    AxisOperation axisOperation = messageContext.getAxisOperation();
    if (axisOperation != null) {
        AxisMessage axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        xmlSchemaElement = axisMessage.getSchemaElement();

        if (xmlSchemaElement == null) {
            OMElement bodyFirstChild = soapFactory.createOMElement(messageContext.getAxisOperation().getName(),
                    body);

            // if there is no schema its piece of cake !! add these to the soap body in any order you like.
            // Note : if there are parameters in the path of the URL, there is no way this can add them
            // to the message.
            createSOAPMessageWithoutSchema(soapFactory, bodyFirstChild, requestParameterMap);
        } else {

            // first get the target namespace from the schema and the wrapping element.
            // create an OMElement out of those information. We are going to extract parameters from
            // url, create OMElements and add them as children to this wrapping element.
            String targetNamespace = xmlSchemaElement.getQName().getNamespaceURI();
            QName bodyFirstChildQName;
            if (targetNamespace != null && !"".equals(targetNamespace)) {
                bodyFirstChildQName = new QName(targetNamespace, xmlSchemaElement.getName());
            } else {
                bodyFirstChildQName = new QName(xmlSchemaElement.getName());
            }
            OMElement bodyFirstChild = soapFactory.createOMElement(bodyFirstChildQName, body);

            // Schema should adhere to the IRI style in this. So assume IRI style and dive in to
            // schema
            XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
            if (schemaType instanceof XmlSchemaComplexType) {
                XmlSchemaComplexType complexType = ((XmlSchemaComplexType) schemaType);
                XmlSchemaParticle particle = complexType.getParticle();
                if (particle instanceof XmlSchemaSequence || particle instanceof XmlSchemaAll) {
                    XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) particle;
                    Iterator iterator = xmlSchemaGroupBase.getItems().getIterator();

                    // now we need to know some information from the binding operation.

                    while (iterator.hasNext()) {
                        XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next();
                        QName qName = innerElement.getQName();
                        // ignoring the elements without proper type and minoccurs zero
                        if ((innerElement.getSchemaTypeName() == null) && (innerElement.getMinOccurs() == 0)) {
                            continue;
                        }

                        if (qName == null && innerElement.getSchemaTypeName()
                                .equals(org.apache.ws.commons.schema.constants.Constants.XSD_ANYTYPE)) {
                            createSOAPMessageWithoutSchema(soapFactory, bodyFirstChild, requestParameterMap);
                            break;
                        }
                        long minOccurs = innerElement.getMinOccurs();
                        boolean nillable = innerElement.isNillable();
                        String name = qName != null ? qName.getLocalPart() : innerElement.getName();
                        Object value;
                        OMNamespace ns = (qName == null || qName.getNamespaceURI() == null
                                || qName.getNamespaceURI().length() == 0) ? null
                                        : soapFactory.createOMNamespace(qName.getNamespaceURI(), null);

                        // FIXME changed
                        while ((value = requestParameterMap.get(name)) != null) {
                            addRequestParameter(soapFactory, bodyFirstChild, ns, name, value);
                            minOccurs--;
                        }
                        if (minOccurs > 0) {
                            if (nillable) {

                                OMNamespace xsi = soapFactory.createOMNamespace(
                                        Constants.URI_DEFAULT_SCHEMA_XSI, Constants.NS_PREFIX_SCHEMA_XSI);
                                OMAttribute omAttribute = soapFactory.createOMAttribute("nil", xsi, "true");
                                soapFactory.createOMElement(name, ns, bodyFirstChild).addAttribute(omAttribute);

                            } else {
                                throw new AxisFault("Required element " + qName
                                        + " defined in the schema can not be" + " found in the request");
                            }
                        }
                    }
                }
            }
        }
    }
    return soapEnvelope;
}

From source file:org.apache.axis2.client.Options.java

/**
 * 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.
 *
 * @param cc The configuration context object representing the active configuration
 *///from w w  w . j a va  2s  . com
public void activate(ConfigurationContext cc) {
    // see if there's any work to do
    if (!needsToBeReconciled) {
        // return quick
        return;
    }

    String logCorrelationIDString = getLogCorrelationIDString();
    // use the supplied configuration context

    // get the axis configuration
    AxisConfiguration axisConfig = cc.getAxisConfiguration();

    // We previously saved metaTransportIn; restore it
    if (metaTransportIn != null) {
        QName qin = metaTransportIn.getQName();
        TransportInDescription tmpIn = null;
        try {
            tmpIn = axisConfig.getTransportIn(qin.getLocalPart());
        } catch (Exception exin) {
            // if a fault is thrown, log it and continue
            log.trace(logCorrelationIDString
                    + "activate():  exception caught when getting the TransportInDescription [" + qin.toString()
                    + "]  from the AxisConfiguration [" + exin.getClass().getName() + " : " + exin.getMessage()
                    + "]");
        }

        if (tmpIn != null) {
            transportIn = tmpIn;
        } else {
            log.trace(logCorrelationIDString + "activate():  No TransportInDescription found for ["
                    + qin.toString() + "]");

            transportIn = null;
        }
    } else {
        log.trace(logCorrelationIDString + "activate():  No TransportInDescription ");

        transportIn = null;
    }

    // We previously saved metaTransportOut; restore it
    if (metaTransportOut != null) {
        QName qout = metaTransportOut.getQName();
        TransportOutDescription tmpOut = null;
        try {
            tmpOut = axisConfig.getTransportOut(qout.getLocalPart());
        } catch (Exception exout) {
            // if a fault is thrown, log it and continue
            log.trace(logCorrelationIDString
                    + "activate():  exception caught when getting the TransportOutDescription ["
                    + qout.toString() + "]  from the AxisConfiguration [" + exout.getClass().getName() + " : "
                    + exout.getMessage() + "]");
        }

        if (tmpOut != null) {
            transportOut = tmpOut;
        } else {
            log.trace(logCorrelationIDString + "activate():  No TransportOutDescription found for ["
                    + qout.toString() + "]");

            transportOut = null;
        }
    } else {
        log.trace(logCorrelationIDString + "activate():  No TransportOutDescription ");

        transportOut = null;
    }

    // We previously saved metaListener; restore it
    if (metaListener != null) {
        // see if we can find an existing object
        String listenerClass = metaListener.getClassName();
        log.trace(logCorrelationIDString + "activate():  TransportListener found for [" + listenerClass + "] ");
    } else {
        listener = null;

        log.trace(logCorrelationIDString + "activate():  No TransportListener ");
    }

    //-------------------------------------------------------
    // done, reset the flag
    //-------------------------------------------------------
    needsToBeReconciled = false;
}

From source file:org.apache.axis2.client.ServiceClient.java

/**
 * Engage a module for this service client.
 *
 * @param moduleName name of the module to engage
 * @throws AxisFault if something goes wrong
 * @deprecated Please use String version instead
 *//*from w  ww  . j a  v a  2s . c  o  m*/
public void engageModule(QName moduleName) throws AxisFault {
    engageModule(moduleName.getLocalPart());
}

From source file:org.apache.axis2.client.ServiceClient.java

/**
 * Disengage a module for this service client
 *
 * @param moduleName name of Module to disengage
 * @deprecated Please use String version instead
 *///  ww  w  .  ja va  2  s .  c  om
public void disengageModule(QName moduleName) {
    disengageModule(moduleName.getLocalPart());
}

From source file:org.apache.axis2.client.ServiceClient.java

/**
 * Create an operation client with the appropriate message exchange pattern (MEP). This method
 * creates a full-function MEP client which can be used to exchange messages for a specific
 * operation. It configures the constructed operation client to use the current normal and
 * override options. This method is used internally, and also by generated client stub code.
 *
 * @param operationQName qualified name of operation (local name is operation name, namespace
 *                       URI is just the empty string)
 * @return client configured to talk to the given operation
 * @throws AxisFault if the operation is not found
 *///  w w  w  . jav  a  2  s  .c  o m
public OperationClient createClient(QName operationQName) throws AxisFault {
    // If we're configured to do so, clean up the last OperationContext (thus
    // releasing its resources) each time we create a new one.
    if (JavaUtils.isTrue(getOptions().getProperty(AUTO_OPERATION_CLEANUP), true)
            && !getOptions().isUseSeparateListener()) {
        cleanupTransport();
    }

    AxisOperation axisOperation = axisService.getOperation(operationQName);
    if (axisOperation == null) {
        throw new AxisFault(Messages.getMessage("operationnotfound", operationQName.getLocalPart()));
    }

    // add the option properties to the service context
    String key;
    for (Object o : options.getProperties().keySet()) {
        key = (String) o;
        serviceContext.setProperty(key, options.getProperties().get(key));
    }
    OperationClient operationClient = axisOperation.createClient(serviceContext, options);

    // if overide options have been set, that means we need to make sure
    // those options override the options of even the operation client. So,
    // what we do is switch the parents around to make that work.
    if (overrideOptions != null) {
        overrideOptions.setParent(operationClient.getOptions());
        operationClient.setOptions(overrideOptions);
    }
    return operationClient;
}

From source file:org.apache.axis2.context.externalize.ActivateUtils.java

/**
 * Find the AxisOperation object that matches the criteria
 * /*from  www. j a v  a  2s  .co  m*/
 * @param service    The AxisService object
 * @param opClassName The class name string for the target object
 *                   (could be a derived class)
 * @param opQName    the name associated with the operation
 * @return the AxisOperation object that matches the given criteria
 */
public static AxisOperation findOperation(AxisService service, String opClassName, QName opQName) {
    if (service == null) {
        return null;
    }

    Iterator ito = service.getOperations();

    // Previous versions of Axis2 didn't use a namespace on the operation name, so they wouldn't
    // have externalized a namespace.  If that's the case, only compare the localPart of the
    // operation name
    String namespace = opQName.getNamespaceURI();
    boolean ignoreNamespace = false;
    if (namespace == null || "".equals(namespace)) {
        ignoreNamespace = true;
    }

    while (ito.hasNext()) {
        AxisOperation operation = (AxisOperation) ito.next();

        String tmpOpName = operation.getClass().getName();
        QName tmpOpQName = operation.getName();

        if ((tmpOpName.equals(opClassName))
                && ((ignoreNamespace && (tmpOpQName.getLocalPart().equals(opQName.getLocalPart()))
                        || (tmpOpQName.equals(opQName))))) {

            if (log.isTraceEnabled()) {
                log.trace("ObjectStateUtils:findOperation(service): ignoreNamespace [" + ignoreNamespace
                        + "] returning  [" + opClassName + "]   [" + opQName.toString() + "]");
            }

            return operation;
        }
    }

    // trace point
    if (log.isTraceEnabled()) {
        log.trace("ObjectStateUtils:findOperation(service): ignoreNamespace [" + ignoreNamespace
                + " classname [" + opClassName + "]  QName [" + opQName.toString() + "]  returning  [null]");
    }

    return null;
}

From source file:org.apache.axis2.context.MessageContext.java

/**
 * 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.
 *
 * @param cc The configuration context object representing the active configuration
 *//*from w w  w .  jav a 2  s  .c om*/
public void activate(ConfigurationContext cc) {
    // see if there's any work to do
    if (!needsToBeReconciled) {
        // return quick
        return;
    }

    // use the supplied configuration context
    setConfigurationContext(cc);

    // get the axis configuration
    AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();

    // We previously saved metaAxisService; restore it
    if (metaAxisService != null) {
        this.setAxisService(ActivateUtils.findService(axisConfig, metaAxisService.getClassName(),
                metaAxisService.getQNameAsString(), metaAxisService.getExtraName()));
    }

    // We previously saved metaAxisServiceGroup; restore it
    if (metaAxisServiceGroup != null) {
        this.setAxisServiceGroup(ActivateUtils.findServiceGroup(axisConfig, metaAxisServiceGroup.getClassName(),
                metaAxisServiceGroup.getQNameAsString()));
    }

    // We previously saved metaAxisOperation; restore it
    if (metaAxisOperation != null) {
        AxisService serv = axisService;

        if (serv != null) {
            // TODO: check for the empty name
            this.setAxisOperation(ActivateUtils.findOperation(serv, metaAxisOperation.getClassName(),
                    metaAxisOperation.getQName()));
        } else {
            this.setAxisOperation(ActivateUtils.findOperation(axisConfig, metaAxisOperation.getClassName(),
                    metaAxisOperation.getQName()));
        }
    }

    // We previously saved metaAxisMessage; restore it
    if (metaAxisMessage != null) {
        AxisOperation op = axisOperation;

        if (op != null) {
            // TODO: check for the empty name
            this.setAxisMessage(ActivateUtils.findMessage(op, metaAxisMessage.getQNameAsString(),
                    metaAxisMessage.getExtraName()));
        }
    }

    //---------------------------------------------------------------------
    // operation context
    //---------------------------------------------------------------------
    // this will do a full hierarchy, so do it first
    // then we can re-use its objects

    if (operationContext != null) {
        operationContext.activate(cc);

        // this will be set as the parent of the message context
        // after the other context objects have been activated
    }

    //---------------------------------------------------------------------
    // service context
    //---------------------------------------------------------------------

    if (serviceContext == null) {
        // get the parent serviceContext of the operationContext
        if (operationContext != null) {
            serviceContext = operationContext.getServiceContext();
        }
    }

    // if we have a service context, make sure it is usable
    if (serviceContext != null) {
        // for some reason, the service context might be set differently from
        // the operation context parent
        serviceContext.activate(cc);
    }

    //---------------------------------------------------------------------
    // service group context
    //---------------------------------------------------------------------

    if (serviceGroupContext == null) {
        // get the parent serviceGroupContext of the serviceContext
        if (serviceContext != null) {
            serviceGroupContext = (ServiceGroupContext) serviceContext.getParent();
        }
    }

    // if we have a service group context, make sure it is usable
    if (serviceGroupContext != null) {
        // for some reason, the service group context might be set differently from
        // the service context parent
        serviceGroupContext.activate(cc);
    }

    //---------------------------------------------------------------------
    // other context-related reconciliation
    //---------------------------------------------------------------------

    this.setParent(operationContext);

    //---------------------------------------------------------------------
    // options
    //---------------------------------------------------------------------
    if (options != null) {
        options.activate(cc);
    }

    String tmpID = getMessageID();
    String logCorrelationIDString = getLogIDString();

    if (DEBUG_ENABLED && log.isTraceEnabled()) {
        log.trace(logCorrelationIDString + ":activate():   message ID [" + tmpID + "] for "
                + logCorrelationIDString);
    }

    //---------------------------------------------------------------------
    // transports
    //---------------------------------------------------------------------

    // We previously saved metaTransportIn; restore it
    if (metaTransportIn != null) {
        QName qin = metaTransportIn.getQName();
        TransportInDescription tmpIn = null;
        try {
            tmpIn = axisConfig.getTransportIn(qin.getLocalPart());
        } catch (Exception exin) {
            // if a fault is thrown, log it and continue
            log.trace(logCorrelationIDString
                    + "activate():  exception caught when getting the TransportInDescription [" + qin.toString()
                    + "]  from the AxisConfiguration [" + exin.getClass().getName() + " : " + exin.getMessage()
                    + "]");
        }

        if (tmpIn != null) {
            transportIn = tmpIn;
        } else {
            transportIn = null;
        }
    } else {
        transportIn = null;
    }

    // We previously saved metaTransportOut; restore it
    if (metaTransportOut != null) {
        // TODO : Check if this should really be a QName?
        QName qout = metaTransportOut.getQName();
        TransportOutDescription tmpOut = null;
        try {
            tmpOut = axisConfig.getTransportOut(qout.getLocalPart());
        } catch (Exception exout) {
            // if a fault is thrown, log it and continue
            if (DEBUG_ENABLED && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString
                        + "activate():  exception caught when getting the TransportOutDescription ["
                        + qout.toString() + "]  from the AxisConfiguration [" + exout.getClass().getName()
                        + " : " + exout.getMessage() + "]");
            }
        }

        if (tmpOut != null) {
            transportOut = tmpOut;
        } else {
            transportOut = null;
        }
    } else {
        transportOut = null;
    }

    //-------------------------------------------------------
    // reconcile the execution chain
    //-------------------------------------------------------
    if (metaExecutionChain != null) {
        if (DEBUG_ENABLED && log.isTraceEnabled()) {
            log.trace(logCorrelationIDString + ":activate(): reconciling the execution chain...");
        }

        currentHandlerIndex = metaHandlerIndex;
        currentPhaseIndex = metaPhaseIndex;

        executionChain = restoreHandlerList(metaExecutionChain);

        try {
            deserializeSelfManagedData();
        } catch (Exception ex) {
            // log the exception
            if (DEBUG_ENABLED && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString
                        + ":activate(): *** WARNING *** deserializing the self managed data encountered Exception ["
                        + ex.getClass().getName() + " : " + ex.getMessage() + "]", ex);
            }
        }
    }

    //-------------------------------------------------------
    // reconcile the lists for the executed phases
    //-------------------------------------------------------
    if (metaExecuted != null) {
        if (DEBUG_ENABLED && log.isTraceEnabled()) {
            log.trace(logCorrelationIDString + ":activate(): reconciling the executed chain...");
        }

        if (!(executedPhasesReset)) {
            executedPhases = restoreExecutedList(executedPhases, metaExecuted);
        }
    }

    if (executedPhases == null) {
        executedPhases = new LinkedList<Handler>();
    }

    //-------------------------------------------------------
    // finish up remaining links
    //-------------------------------------------------------
    if (operationContext != null) {
        operationContext.restoreMessageContext(this);
    }

    //-------------------------------------------------------
    // done, reset the flag
    //-------------------------------------------------------
    needsToBeReconciled = false;

}

From source file:org.apache.axis2.context.MessageContext.java

/**
 * 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 an object that gives us
 * a view of the active object graph from the active engine.
 * <p/>/*from ww  w. j  av a 2  s.c  o m*/
 * NOTE: when activating an object, you only need to call
 * one of the activate methods (activate() or activateWithOperationContext())
 * but not both.
 *
 * @param operationCtx The operation context object that is a member of the active object graph
 */
public void activateWithOperationContext(OperationContext operationCtx) {
    // see if there's any work to do
    if (!(needsToBeReconciled)) {
        // return quick
        return;
    }

    String logCorrelationIDString = getLogIDString();
    // trace point
    if (DEBUG_ENABLED && log.isTraceEnabled()) {
        log.trace(logCorrelationIDString + ":activateWithOperationContext():  BEGIN");
    }

    if (operationCtx == null) {
        // won't be able to finish
        if (DEBUG_ENABLED && log.isTraceEnabled()) {
            log.trace(logCorrelationIDString
                    + ":activateWithOperationContext():  *** WARNING ***  No active OperationContext object is available.");
        }
        return;
    }

    //---------------------------------------------------------------------
    // locate the objects in the object graph
    //---------------------------------------------------------------------
    ConfigurationContext configCtx = operationCtx.getConfigurationContext();

    if (configCtx == null) {
        // won't be able to finish
        if (DEBUG_ENABLED && log.isTraceEnabled()) {
            log.trace(logCorrelationIDString
                    + ":activateWithOperationContext():  *** WARNING ***  No active ConfigurationContext object is available.");
        }
        return;
    }

    AxisConfiguration axisCfg = configCtx.getAxisConfiguration();

    AxisOperation axisOp = operationCtx.getAxisOperation();
    ServiceContext serviceCtx = operationCtx.getServiceContext();

    ServiceGroupContext serviceGroupCtx = null;
    AxisService axisSrv = null;
    AxisServiceGroup axisSG = null;

    if (serviceCtx != null) {
        serviceGroupCtx = serviceCtx.getServiceGroupContext();
        axisSrv = serviceCtx.getAxisService();
    }

    if (serviceGroupCtx != null) {
        axisSG = serviceGroupCtx.getDescription();
    }

    //---------------------------------------------------------------------
    // link to the objects in the object graph
    //---------------------------------------------------------------------

    setConfigurationContext(configCtx);

    setAxisOperation(axisOp);
    setAxisService(axisSrv);
    setAxisServiceGroup(axisSG);

    setServiceGroupContext(serviceGroupCtx);
    setServiceContext(serviceCtx);
    setOperationContext(operationCtx);

    //---------------------------------------------------------------------
    // reconcile the remaining objects
    //---------------------------------------------------------------------

    // We previously saved metaAxisMessage; restore it
    if (metaAxisMessage != null) {
        if (axisOp != null) {
            // TODO: check for the empty name
            this.setAxisMessage(ActivateUtils.findMessage(axisOp, metaAxisMessage.getQNameAsString(),
                    metaAxisMessage.getExtraName()));
        }
    }

    //---------------------------------------------------------------------
    // options
    //---------------------------------------------------------------------
    if (options != null) {
        options.activate(configCtx);
    }

    String tmpID = getMessageID();

    if (DEBUG_ENABLED && log.isTraceEnabled()) {
        log.trace(logCorrelationIDString + ":activateWithOperationContext():   message ID [" + tmpID + "]");
    }

    //---------------------------------------------------------------------
    // transports
    //---------------------------------------------------------------------

    // We previously saved metaTransportIn; restore it
    if (metaTransportIn != null) {
        QName qin = metaTransportIn.getQName();
        TransportInDescription tmpIn = null;
        try {
            tmpIn = axisCfg.getTransportIn(qin.getLocalPart());
        } catch (Exception exin) {
            // if a fault is thrown, log it and continue
            if (DEBUG_ENABLED && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString
                        + "activateWithOperationContext():  exception caught when getting the TransportInDescription ["
                        + qin.toString() + "]  from the AxisConfiguration [" + exin.getClass().getName() + " : "
                        + exin.getMessage() + "]");
            }

        }

        if (tmpIn != null) {
            transportIn = tmpIn;
        } else {
            transportIn = null;
        }
    } else {
        transportIn = null;
    }

    // We previously saved metaTransportOut; restore it
    if (metaTransportOut != null) {
        QName qout = metaTransportOut.getQName();
        TransportOutDescription tmpOut = null;
        try {
            tmpOut = axisCfg.getTransportOut(qout.getLocalPart());
        } catch (Exception exout) {
            // if a fault is thrown, log it and continue
            if (DEBUG_ENABLED && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString
                        + "activateWithOperationContext():  exception caught when getting the TransportOutDescription ["
                        + qout.toString() + "]  from the AxisConfiguration [" + exout.getClass().getName()
                        + " : " + exout.getMessage() + "]");
            }
        }

        if (tmpOut != null) {
            transportOut = tmpOut;
        } else {
            transportOut = null;
        }
    } else {
        transportOut = null;
    }

    //-------------------------------------------------------
    // reconcile the execution chain
    //-------------------------------------------------------
    if (metaExecutionChain != null) {
        if (DEBUG_ENABLED && log.isTraceEnabled()) {
            log.trace(logCorrelationIDString
                    + ":activateWithOperationContext(): reconciling the execution chain...");
        }

        currentHandlerIndex = metaHandlerIndex;
        currentPhaseIndex = metaPhaseIndex;

        executionChain = restoreHandlerList(metaExecutionChain);

        try {
            deserializeSelfManagedData();
        } catch (Exception ex) {
            // log the exception
            if (DEBUG_ENABLED && log.isTraceEnabled()) {
                log.trace(logCorrelationIDString
                        + ":activateWithOperationContext(): *** WARNING *** deserializing the self managed data encountered Exception ["
                        + ex.getClass().getName() + " : " + ex.getMessage() + "]", ex);
            }
        }
    }

    //-------------------------------------------------------
    // reconcile the lists for the executed phases
    //-------------------------------------------------------
    if (metaExecuted != null) {
        if (DEBUG_ENABLED && log.isTraceEnabled()) {
            log.trace(logCorrelationIDString
                    + ":activateWithOperationContext(): reconciling the executed chain...");
        }

        if (!(executedPhasesReset)) {
            executedPhases = restoreExecutedList(executedPhases, metaExecuted);
        }
    }

    if (executedPhases == null) {
        executedPhases = new LinkedList<Handler>();
    }

    //-------------------------------------------------------
    // done, reset the flag
    //-------------------------------------------------------
    needsToBeReconciled = false;

    if (DEBUG_ENABLED && log.isTraceEnabled()) {
        log.trace(logCorrelationIDString + ":activateWithOperationContext():  END");
    }
}