List of usage examples for javax.xml.stream XMLInputFactory newInstance
public static XMLInputFactory newInstance() throws FactoryConfigurationError
From source file:org.wso2.am.admin.clients.template.EndpointTemplateAdminServiceClient.java
public void addDynamicEndpointTemplate(String key, 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.addDynamicEndpointTemplate(key, endpointTemplate.toString()); }
From source file:org.wso2.am.admin.clients.template.SequenceTemplateAdminServiceClient.java
public void addSequenceTemplate(DataHandler dh) throws IOException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement template = builder.getDocumentElement(); templateAdminStub.addTemplate(template); }
From source file:org.wso2.am.admin.clients.template.SequenceTemplateAdminServiceClient.java
public void addDynamicSequenceTemplate(String key, DataHandler dh) throws IOException, XMLStreamException { XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement template = builder.getDocumentElement(); templateAdminStub.addDynamicTemplate(key, template); }
From source file:org.wso2.am.integration.test.utils.generic.APIMTestCaseUtils.java
/** * Loads the specified resource from the classpath and returns its content as an OMElement. * * @param path A relative path to the resource file * @return An OMElement containing the resource content */// w ww .j a va2s.co m public static OMElement loadResource(String path) throws FileNotFoundException, XMLStreamException { OMElement documentElement = null; FileInputStream inputStream = null; XMLStreamReader parser = null; StAXOMBuilder builder = null; path = TestConfigurationProvider.getResourceLocation() + path; File file = new File(path); if (file.exists()) { try { inputStream = new FileInputStream(file); parser = XMLInputFactory.newInstance().createXMLStreamReader(inputStream); //create the builder builder = new StAXOMBuilder(parser); //get the root element (in this case the envelope) documentElement = builder.getDocumentElement().cloneOMElement(); } finally { if (builder != null) { builder.close(); } if (parser != null) { try { parser.close(); } catch (XMLStreamException e) { //ignore } } if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { //ignore } } } } else { throw new FileNotFoundException("File Not Exist at " + path); } return documentElement; }
From source file:org.wso2.carbon.admin.service.AdminServiceEndPointAdmin.java
public void addEndPoint(String sessionCookie, DataHandler dh) throws EndpointAdminEndpointAdminException, IOException, XMLStreamException { new AuthenticateStub().authenticateStub(sessionCookie, endpointAdminStub); XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement endPointElem = builder.getDocumentElement(); endpointAdminStub.addEndpoint(endPointElem.toString()); }
From source file:org.wso2.carbon.admin.service.AdminServiceGovernanceService.java
public void addService(String sessionCookie, DataHandler dh) throws RegistryExceptionException, IOException, XMLStreamException { new AuthenticateStub().authenticateStub(sessionCookie, addServicesServiceStub); XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement serviceElem = builder.getDocumentElement(); addServicesServiceStub.addService(serviceElem.toString()); log.info("Service Added"); }
From source file:org.wso2.carbon.admin.service.AdminServiceLocalEntryAdminService.java
public void addLocalEntry(String sessionCookie, DataHandler dh) throws LocalEntryAdminException, IOException, XMLStreamException { new AuthenticateStub().authenticateStub(sessionCookie, localEntryAdminServiceStub); XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement localEntryElem = builder.getDocumentElement(); localEntryAdminServiceStub.addEntry(localEntryElem.toString()); }
From source file:org.wso2.carbon.admin.service.AdminServiceProxyServiceAdmin.java
public void addProxyService(String sessionCookie, DataHandler dh) throws ProxyAdminException, IOException, XMLStreamException { ProxyServiceAdminClient adminServiceProxyServiceAdminClient = new ProxyServiceAdminClient(null, backEndUrl, sessionCookie, Locale.US); new AuthenticateStub().authenticateStub(sessionCookie, proxyServiceAdminStub); 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 = adminServiceProxyServiceAdminClient.getDesignView(documentElement.toString()); proxyServiceAdminStub.addProxy(proxyData); log.info("Proxy Added"); }
From source file:org.wso2.carbon.admin.service.AdminServiceSequenceAdmin.java
public void addSequence(String sessionCookie, DataHandler dh) throws SequenceEditorException, IOException, XMLStreamException { new AuthenticateStub().authenticateStub(sessionCookie, sequenceAdminServiceStub); 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.carbon.admin.service.AdminServiceTaskAdmin.java
public void addTask(String sessionCookie, DataHandler dh) throws TaskManagementException, IOException, XMLStreamException { new AuthenticateStub().authenticateStub(sessionCookie, taskAdminStub); XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(dh.getInputStream()); //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); OMElement scheduleTaskElem = builder.getDocumentElement(); taskAdminStub.addTaskDescription(scheduleTaskElem); }