Example usage for javax.xml.stream XMLInputFactory newInstance

List of usage examples for javax.xml.stream XMLInputFactory newInstance

Introduction

In this page you can find the example usage for javax.xml.stream XMLInputFactory newInstance.

Prototype

public static XMLInputFactory newInstance() throws FactoryConfigurationError 

Source Link

Document

Creates a new instance of the factory in exactly the same manner as the #newFactory() method.

Usage

From source file:org.wso2.am.admin.clients.endpoint.EndPointAdminClient.java

public boolean addDynamicEndPoint(String key, DataHandler dh)
        throws EndpointAdminEndpointAdminException, IOException, XMLStreamException {
    XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream());
    //create the builder
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    OMElement endPointElem = builder.getDocumentElement();
    return endpointAdminStub.addDynamicEndpoint(key, endPointElem.toString());
}

From source file:org.wso2.am.admin.clients.localentry.LocalEntriesAdminClient.java

/**
 * Add Local entry by DataHandler/*  www.  j a v  a2  s.  c  om*/
 *
 * @param dh
 * @return
 * @throws java.io.IOException
 * @throws LocalEntryAdminException
 * @throws javax.xml.stream.XMLStreamException
 */
public boolean addLocalEntery(DataHandler dh) throws IOException, LocalEntryAdminException, XMLStreamException {
    XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream());
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    OMElement localEntryElem = builder.getDocumentElement();
    return (localEntryAdminServiceStub.addEntry(localEntryElem.toString()));
}

From source file:org.wso2.am.admin.clients.mediation.MessageProcessorClient.java

public void addMessageProcessor(DataHandler dh) throws IOException, XMLStreamException {
    XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream());
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    OMElement messageProcessorElem = builder.getDocumentElement();
    messageProcessorAdminServiceStub.addMessageProcessor(messageProcessorElem.toString());
}

From source file:org.wso2.am.admin.clients.mediation.MessageStoreAdminClient.java

public void addMessageStore(DataHandler dh)
        throws IOException, XMLStreamException, org.wso2.carbon.message.store.stub.Exception {
    XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream());
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    OMElement messageStore = builder.getDocumentElement();
    messageStoreAdminServiceStub.addMessageStore(messageStore.toString());
}

From source file:org.wso2.am.admin.clients.mediation.PriorityMediationAdminClient.java

public void addPriorityMediator(String name, DataHandler dh) throws IOException, XMLStreamException {
    XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream());
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    OMElement messageProcessorElem = builder.getDocumentElement();
    priorityMediationAdmin.add(name, messageProcessorElem);
}

From source file:org.wso2.am.admin.clients.mediation.SynapseConfigAdminClient.java

/**
 * Create OMElement using String this is in ML format
 *
 * @param xml - String that is in XML format to create the OMElement
 * @return OMElement - newly created OMElement
 * @throws XMLStreamException - for the newInstance() method call in XMLInputFactory
 *//*ww w  .  ja v  a 2 s . co  m*/
private static OMElement createOMElement(String xml) throws XMLStreamException {
    XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
    StAXOMBuilder builder = new StAXOMBuilder(reader);
    return builder.getDocumentElement();

}

From source file:org.wso2.am.admin.clients.proxy.admin.ProxyServiceAdminClient.java

/**
 * Adding proxy service//ww  w  .  j a v a2 s  .c om
 *
 * @param dh Data Handler
 * @throws ProxyServiceAdminProxyAdminException Proxy service admin exception
 * @throws java.rmi.RemoteException             Remote exception
 * @throws javax.xml.stream.XMLStreamException  Exception
 */
public void addProxyService(DataHandler dh)
        throws ProxyServiceAdminProxyAdminException, IOException, XMLStreamException {

    XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream());
    //create the builder
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    //get the root element (in this case the envelope)
    OMElement documentElement = builder.getDocumentElement();

    ProxyData proxyData = getProxyData(documentElement.toString());

    log.info("Proxy Added");
}

From source file:org.wso2.am.admin.clients.sequences.SequenceAdminServiceClient.java

/**
 * adding sequence// w ww .ja v a  2s  . c om
 *
 * @param dh
 * @throws SequenceEditorException
 * @throws java.io.IOException
 * @throws javax.xml.stream.XMLStreamException
 */
public void addSequence(DataHandler dh) throws SequenceEditorException, IOException, XMLStreamException {

    XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream());
    //create the builder
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    OMElement sequenceElem = builder.getDocumentElement();
    sequenceAdminServiceStub.addSequence(sequenceElem);
}

From source file:org.wso2.am.admin.clients.tasks.TaskAdminClient.java

public void addTask(DataHandler dh) throws TaskManagementException, IOException, XMLStreamException {

    XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream());
    //create the builder
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    OMElement scheduleTaskElem = builder.getDocumentElement();
    // scheduleTaskElem.setText("test");
    taskAdminStub.addTaskDescription(scheduleTaskElem);
}

From source file:org.wso2.am.admin.clients.template.EndpointTemplateAdminServiceClient.java

public void addEndpointTemplate(DataHandler dh) throws IOException, XMLStreamException {
    XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream());
    //create the builder
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    OMElement endpointTemplate = builder.getDocumentElement();
    endpointTemplateAdminStub.addEndpointTemplate(endpointTemplate.toString());
}