Examples of OMFactory


Examples of org.apache.axiom.om.OMFactory

        if (log.isDebugEnabled()) {
            log.debug("Start building the hessian message in to a HessianDataSource");
        }

        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace(HessianConstants.HESSIAN_NAMESPACE_URI,
                HessianConstants.HESSIAN_NS_PREFIX);
        OMElement element = factory.createOMElement(
                HessianConstants.HESSIAN_ELEMENT_LOCAL_NAME, ns);

        try {

            Parameter synEnv = messageContext.getConfigurationContext().getAxisConfiguration()
                    .getParameter(SynapseConstants.SYNAPSE_ENV);

            PushbackInputStream pis = detectAndMarkMessageFault(messageContext, inputStream);

            DataHandler dataHandler;
            if (synEnv != null && synEnv.getValue() != null) {
                dataHandler = new DataHandler(new SynapseBinaryDataSource(pis, contentType,
                        (SynapseEnvironment) synEnv.getValue()));
            } else {
                // add Hessian data inside a data handler
                dataHandler = new DataHandler(new SynapseBinaryDataSource(pis, contentType));
            }
            OMText textData = factory.createOMText(dataHandler, true);
            element.addChild(textData);
           
            // indicate that message faults shall be handled as http 200
            messageContext.setProperty(NhttpConstants.FAULTS_AS_HTTP_200, NhttpConstants.TRUE);
View Full Code Here

Examples of org.apache.axiom.om.OMFactory

    }
    return getBinaryPayload(mc.getEnvelope());
  }

  public static void setBinaryPayload(SOAPEnvelope envelope, DataHandler dh) {
    OMFactory fac = envelope.getOMFactory();
    OMElement binaryElt = envelope.getOMFactory()
        .createOMElement(BINARYELT);
    OMText text = fac.createOMText(dh, true);
    binaryElt.addChild(text);
    setXMLPayload(envelope, binaryElt);
  }
View Full Code Here

Examples of org.apache.axiom.om.OMFactory

    }
    return getTextPayload(mc.getEnvelope());
  }

  public static void setTextPayload(SOAPEnvelope envelope, String text) {
    OMFactory fac = envelope.getOMFactory();
    OMElement textElt = envelope.getOMFactory().createOMElement(TEXTELT);
    OMText textNode = fac.createOMText(text);
    textElt.addChild(textNode);
    setXMLPayload(envelope, textElt);
  }
View Full Code Here

Examples of org.apache.axiom.om.OMFactory

        assertEquals(message, ((OMElement)node).getText());
    }

    public void testHeaderRelativeXPath() throws Exception {
        MessageContext ctx =  TestUtils.getTestContext("<test>" + message + "</test>");
        OMFactory fac = ctx.getEnvelope().getOMFactory();
        OMNamespace ns = fac.createOMNamespace("http://test", "t");
        ctx.getEnvelope().getHeader().addHeaderBlock("test", ns).setText(message);
        ctx.getEnvelope().getHeader().addHeaderBlock("test2", ns);
       
        SynapseXPath xpath = new SynapseXPath("$header/t:test");
        xpath.addNamespace(ns);
View Full Code Here

Examples of org.apache.axiom.om.OMFactory

        SOAPBody body = msgCtx.getEnvelope().getBody();
        SOAPFault fault = body.getFault();
        if (fault != null) {

            OMFactory fac = msgCtx.getEnvelope().getOMFactory();
            OMElement faultPayload = fac.createOMElement(new QName("Exception"));

            if (fault.getDetail() != null && !fault.getDetail().getText().equals("")) {

                String faultDetail = fault.getDetail().getText();
View Full Code Here

Examples of org.apache.axiom.om.OMFactory

        this.overflowBlob = overflowBlob;
        this.charset = charset;
    }
   
    public static OMSourcedElement createOMSourcedElement(OverflowBlob overflowBlob, Charset charset) {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        TextFileDataSource txtFileDS = new TextFileDataSource(overflowBlob, charset);
        return new OMSourcedElementImpl(BaseConstants.DEFAULT_TEXT_WRAPPER, fac, txtFileDS);
    }
View Full Code Here

Examples of org.apache.axiom.om.OMFactory

                                    repo + File.separator + "conf" + File.separator + "axis2.xml");
            serviceClient = new ServiceClient(configContext, null);
        } else {
            serviceClient = new ServiceClient();
        }
        OMFactory factory = OMAbstractFactory.getOMFactory();

        OMNamespace nsaip = factory.createOMNamespace(topicns, "aip");

        // set the target topic
        OMElement topicOm = factory.createOMElement("Topic", nsaip);
        factory.createOMText(topicOm, topic);

        // set addressing, transport and proxy url

        serviceClient.engageModule("addressing");
        options.setTo(new EndpointReference(addUrl));
View Full Code Here

Examples of org.apache.axiom.om.OMFactory

public class PriorityExecutorSerializer {

    public static OMElement serialize(OMElement parent,
                                      PriorityExecutor executor, String namespace) {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace nullNS = fac.createOMNamespace("", "");

        OMElement executorElement = createElement(ExecutorConstants.PRIORITY_EXECUTOR, namespace);
        if (executor.getName() != null) {
            executorElement.addAttribute(fac.createOMAttribute(ExecutorConstants.NAME,
                    nullNS, executor.getName()));
        }

        if (executor.getBeforeExecuteHandler() != null) {
            executorElement.addAttribute(fac.createOMAttribute(
                    ExecutorConstants.BEFORE_EXECUTE_HANDLER, nullNS,
                    executor.getBeforeExecuteHandler().getClass().getName()));
        }

        // create the queues configuration
        MultiPriorityBlockingQueue queue = executor.getQueue();
        NextQueueAlgorithm algo = queue.getNextQueueAlgorithm();
        OMElement queuesEle = createElement(ExecutorConstants.QUEUES, namespace);

        if (!(algo instanceof PRRNextQueueAlgorithm)) {
            queuesEle.addAttribute(fac.createOMAttribute(ExecutorConstants.NEXT_QUEUE, nullNS,
                    algo.getClass().getName()));
        }

        if (!queue.isFixedSizeQueues()) {
            queuesEle.addAttribute(fac.createOMAttribute(ExecutorConstants.IS_FIXED_SIZE,
                    nullNS, Boolean.toString(false)));
        }

        List<InternalQueue> intQueues = queue.getQueues();
        for (InternalQueue intQueue : intQueues) {
            OMElement queueEle = createElement(ExecutorConstants.QUEUE, namespace);

            if (queue.isFixedSizeQueues()) {
                queueEle.addAttribute(fac.createOMAttribute(ExecutorConstants.SIZE, nullNS,
                        Integer.toString(intQueue.getCapacity())));
            }

            queueEle.addAttribute(fac.createOMAttribute(ExecutorConstants.PRIORITY, nullNS,
                    Integer.toString(intQueue.getPriority())));

            queuesEle.addChild(queueEle);
        }
        executorElement.addChild(queuesEle);

        // create the Threads configuration
        OMElement threadsEle = createElement(ExecutorConstants.THREADS, namespace);
        threadsEle.addAttribute(fac.createOMAttribute(
                ExecutorConstants.MAX, nullNS, Integer.toString(executor.getMax())));
        threadsEle.addAttribute(fac.createOMAttribute(
                ExecutorConstants.CORE, nullNS, Integer.toString(executor.getCore())));
        threadsEle.addAttribute(fac.createOMAttribute(
                ExecutorConstants.KEEP_ALIVE, nullNS, Integer.toString(executor.getKeepAlive())));

        executorElement.addChild(threadsEle);

        if (parent != null) {
View Full Code Here

Examples of org.apache.axiom.om.OMFactory

     * @param name name of the element
     * @param namespace if null element won't have a namespace
     * @return created OMElement
     */
    private static OMElement createElement(String name, String namespace) {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        if (namespace == null) {
            return fac.createOMElement(new QName(name));
        }

        OMNamespace omNamespace = fac.createOMNamespace(namespace, "");
        return fac.createOMElement(name, omNamespace);
    }
View Full Code Here

Examples of org.apache.axiom.om.OMFactory

       
        MessageContext mc = new TestMessageContextBuilder()
            .addEntry("xslt-key", getClass().getResource("cdata.xslt"))
            .build();
       
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMElement in = factory.createOMElement(new QName(null, "in"));
        factory.createOMText(in, "test", OMNode.CDATA_SECTION_NODE);
        mc.getEnvelope().getBody().addChild(in);
       
        transformMediator.mediate(mc);
       
        OMElement out = mc.getEnvelope().getBody().getFirstElement();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.