Package org.apache.ws.commons.om

Examples of org.apache.ws.commons.om.OMElement


        return returnString;
    }

    public int getChildrenCount(String xml) throws XMLStreamException {
        ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
        OMElement documentElement = new StAXOMBuilder(bais).getDocumentElement();
        int omElementCount = 0;
        int omTextCount = 0;
        Iterator childrenIter = documentElement.getChildren();
        while (childrenIter.hasNext()) {
            Object o = childrenIter.next();
            if (o instanceof OMElement) {
                omElementCount++;
            } else if (o instanceof OMText) {
View Full Code Here


        XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(new
                ByteArrayInputStream(schemaTypes.getBytes()));
        OMFactory fac = OMAbstractFactory.getOMFactory();

        StAXOMBuilder staxOMBuilder = new StAXOMBuilder(fac, xmlReader);
        OMElement schemaElement = staxOMBuilder.getDocumentElement();
        schemaElement.serialize(writer);
    }
View Full Code Here

        return operation;
    }

    public static OMElement getParameter(String name, String value, boolean locked) {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMElement parameter = fac.createOMElement("parameter", null);
        parameter.addAttribute("name", name, null);
        parameter.addAttribute("locked", Boolean.toString(locked), null);
        parameter.setText(value);
        return parameter;
    }
View Full Code Here

     *
     * @param moduleRefs <code>java.util.Iterator</code>
     */
    protected void processModuleRefs(Iterator moduleRefs) {
        while (moduleRefs.hasNext()) {
            OMElement moduleref = (OMElement) moduleRefs.next();
            OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(TAG_REFERENCE));
            String refName = moduleRefAttribute.getAttributeValue();

            engine.addModule(new QName(refName));
        }
    }
View Full Code Here

     * @param oservers
     */
    private void processObservers(Iterator oservers) {
        while (oservers.hasNext()) {
            try {
                OMElement observerelement = (OMElement) oservers.next();
                AxisObserver observer;
                OMAttribute trsClas = observerelement.getAttribute(new QName(TAG_CLASS_NAME));
                String clasName;
                if (trsClas != null) {
                    clasName = trsClas.getAttributeValue();
                } else {
                    log.info(Messages.getMessage(DeploymentErrorMsgs.OBSERVER_ERROR));
                    return;
                }

                Class observerclass = Class.forName(clasName, true,
                        Thread.currentThread().getContextClassLoader());
                observer = (AxisObserver) observerclass.newInstance();
                // processing Parameters
                // Processing service level parameters
                Iterator itr = observerelement.getChildrenWithName(new QName(TAG_PARAMETER));
                processParameters(itr, observer, axisConfig);
                // initialization
                observer.init(axisConfig);
                axisConfig.addObservers(observer);
            } catch (Exception e) {
View Full Code Here

    private ArrayList processPhaseList(OMElement phaseOrders) throws DeploymentException {
        ArrayList phaselist = new ArrayList();
        Iterator phases = phaseOrders.getChildrenWithName(new QName(TAG_PHASE));

        while (phases.hasNext()) {
            OMElement phaseelement = (OMElement) phases.next();
            String phaseName =
                    phaseelement.getAttribute(new QName(ATTRIBUTE_NAME)).getAttributeValue();
            String phaseClass = phaseelement.getAttributeValue(new QName(TAG_CLASS_NAME));
            Phase phase;

            try {
                phase = getPhase(phaseClass);
            } catch (Exception e) {
                throw new DeploymentException(
                        Messages.getMessage("phaseclassnotfound", phaseClass, e.getMessage()));
            }

            phase.setName(phaseName);

            Iterator handlers = phaseelement.getChildrenWithName(new QName(TAG_HANDLER));

            while (handlers.hasNext()) {
                OMElement omElement = (OMElement) handlers.next();
                HandlerDescription handler = processHandler(omElement, axisConfig);

                handler.getRules().setPhaseName(phaseName);
                Utils.loadHandler(axisConfig.getSystemClassLoader(), handler);
View Full Code Here

     */
    private void processPhaseOrders(Iterator phaserders) throws DeploymentException {
        PhasesInfo info = engine.getPhasesinfo();

        while (phaserders.hasNext()) {
            OMElement phaseOrders = (OMElement) phaserders.next();
            String flowType = phaseOrders.getAttribute(new QName(TAG_TYPE)).getAttributeValue();

            if (TAG_FLOW_IN.equals(flowType)) {
                info.setINPhases(processPhaseList(phaseOrders));
            } else if (TAG_FLOW_IN_FAULT.equals(flowType)) {
                info.setIN_FaultPhases(processPhaseList(phaseOrders));
View Full Code Here

    }

    private void processDefaultModuleVersions(OMElement defaultVersions) throws DeploymentException {
        Iterator moduleVersions = defaultVersions.getChildrenWithName(new QName(TAG_MODULE));
        while (moduleVersions.hasNext()) {
            OMElement omElement = (OMElement) moduleVersions.next();
            String name = omElement.getAttributeValue(new QName(ATTRIBUTE_NAME));
            if (name == null) {
                throw new DeploymentException(Messages.getMessage("modulenamecannotnull"));
            }
            String defaultVeriosn = omElement.getAttributeValue(new QName(ATTRIBUTE_DEFAULT_VERSION));
            if (defaultVeriosn == null) {
                throw new DeploymentException(Messages.getMessage("modulenamecannotnull"));
            }
            axisConfig.addDefaultModuleVersion(name, defaultVeriosn);
        }
View Full Code Here

    }

    private void processTransportReceivers(Iterator trs_senders) throws DeploymentException {
        while (trs_senders.hasNext()) {
            TransportInDescription transportIN;
            OMElement transport = (OMElement) trs_senders.next();
            // getting transport Name
            OMAttribute trsName = transport.getAttribute(new QName(ATTRIBUTE_NAME));
            if (trsName != null) {
                String name = trsName.getAttributeValue();
                transportIN = new TransportInDescription(new QName(name));
                // transport impl class
                OMAttribute trsClas = transport.getAttribute(new QName(TAG_CLASS_NAME));
                if (trsClas != null) {
                    try {
                        String clasName = trsClas.getAttributeValue();
                        Class receiverClass = Class.forName(clasName, true,
                                Thread.currentThread().getContextClassLoader());
                        TransportListener receiver =
                                (TransportListener) receiverClass.newInstance();
                        transportIN.setReceiver(receiver);
                    } catch (NoClassDefFoundError e) {
                        log.info(Messages.getMessage("classnotfound", trsClas.getAttributeValue()));
                    } catch (ClassNotFoundException e) {
                        throw new DeploymentException(e);
                    } catch (IllegalAccessException e) {
                        throw new DeploymentException(e);
                    } catch (InstantiationException e) {
                        throw new DeploymentException(e);
                    }
                }
                try {
                    Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
                    processParameters(itr, transportIN, axisConfig);
                    OMElement inFlow = transport.getFirstChildWithName(new QName(TAG_FLOW_IN));
                    if (inFlow != null) {
                        throw new DeploymentException(
                                Messages.getMessage(
                                        DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
                    }
                    OMElement outFlow = transport.getFirstChildWithName(new QName(TAG_FLOW_OUT));
                    if (outFlow != null) {
                        transportIN.setInFlow(processFlow(outFlow, axisConfig));
                    }
                    OMElement inFaultFlow =
                            transport.getFirstChildWithName(new QName(TAG_FLOW_IN_FAULT));
                    if (inFaultFlow != null) {
                        transportIN.setFaultFlow(processFlow(inFaultFlow, axisConfig));
                    }
                    OMElement outFaultFlow =
                            transport.getFirstChildWithName(new QName(TAG_FLOW_OUT_FAULT));

                    if (outFaultFlow != null) {
                        throw new DeploymentException(
                                Messages.getMessage(
View Full Code Here

    }

    private void processTransportSenders(Iterator trs_senders) throws DeploymentException {
        while (trs_senders.hasNext()) {
            TransportOutDescription transportout;
            OMElement transport = (OMElement) trs_senders.next();

            // getting transport Name
            OMAttribute trsName = transport.getAttribute(new QName(ATTRIBUTE_NAME));

            if (trsName != null) {
                String name = trsName.getAttributeValue();

                transportout = new TransportOutDescription(new QName(name));

                // transport impl class
                OMAttribute trsClas = transport.getAttribute(new QName(TAG_CLASS_NAME));

                if (trsClas == null) {
                    throw new DeploymentException(
                            Messages.getMessage(DeploymentErrorMsgs.TRANSPORT_SENDER_ERROR, name));
                }

                String clasName = trsClas.getAttributeValue();
                Class sender;

                try {
                    sender = Class.forName(clasName, true,
                            Thread.currentThread().getContextClassLoader());

                    TransportSender transportSender = (TransportSender) sender.newInstance();

                    transportout.setSender(transportSender);

                    // process Parameters
                    // processing Parameters
                    // Processing service level parameters
                    Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));

                    processParameters(itr, transportout, axisConfig);

                    // process INFLOW
                    OMElement inFlow = transport.getFirstChildWithName(new QName(TAG_FLOW_IN));

                    if (inFlow != null) {
                        throw new DeploymentException(
                                Messages.getMessage(
                                        DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
                    }

                    OMElement outFlow = transport.getFirstChildWithName(new QName(TAG_FLOW_OUT));

                    if (outFlow != null) {
                        transportout.setOutFlow(processFlow(outFlow, axisConfig));
                    }

                    OMElement inFaultFlow =
                            transport.getFirstChildWithName(new QName(TAG_FLOW_IN_FAULT));

                    if (inFaultFlow != null) {
                        throw new DeploymentException(
                                Messages.getMessage(
                                        DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
                    }

                    OMElement outFaultFlow =
                            transport.getFirstChildWithName(new QName(TAG_FLOW_OUT_FAULT));

                    if (outFaultFlow != null) {
                        transportout.setFaultFlow(processFlow(outFaultFlow, axisConfig));
                    }
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.om.OMElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.