private static void serializeAPIs(OMElement definitions, Collection<API> apiSet) { for (API api : apiSet) { OMElement apiElt = APISerializer.serializeAPI(api); definitions.addChild(apiElt); } }
private static void serializeAPIs(OMElement definitions, Collection<API> apiSet) { for (API api : apiSet) { OMElement apiElt = APISerializer.serializeAPI(api); definitions.addChild(apiElt); } }
public static OMElement serializeAPI(OMElement parent, API api) { OMElement apiElt = serializeAPI(api); if (parent != null) { parent.addChild(apiElt); } return apiElt; }
@Override public void restoreSynapseArtifact(String artifactName) { if (log.isDebugEnabled()) { log.debug("Restoring the API with name : " + artifactName + " : Started"); } try { API api = getSynapseConfiguration().getAPI(artifactName); OMElement apiElement = APISerializer.serializeAPI(api); if (api.getFileName() != null) { String fileName = getServerConfigurationInformation().getSynapseXMLLocation() + File.separator + MultiXMLConfigurationBuilder.REST_API_DIR + File.separator + api.getFileName(); writeToFile(apiElement, fileName); if (log.isDebugEnabled()) { log.debug("Restoring the API with name : " + artifactName + " : Completed"); } log.info("API named '" + artifactName + "' has been restored"); } else { handleSynapseArtifactDeploymentError("Couldn't restore the API named '" + artifactName + "', filename cannot be found"); } } catch (Exception e) { handleSynapseArtifactDeploymentError( "Restoring of the API named '" + artifactName + "' has failed", e); } } }
api.setLogSetterValue(); OMElement apiElement = APISerializer.serializeAPI(api); if (api.getFileName() != null) { String fileName = getServerConfigurationInformation().getSynapseXMLLocation()
public OMElement serializeAPI(API api, SynapseConfiguration synapseConfig, OMElement parent) throws Exception { File apiDir = createDirectory(currentDirectory, MultiXMLConfigurationBuilder.REST_API_DIR); OMElement apiElement = APISerializer.serializeAPI(api); String fileName = api.getFileName(); if (fileName != null) { if (currentDirectory == rootDirectory) { handleDeployment(apiDir, fileName, api.getName(), synapseConfig.getArtifactDeploymentStore()); } File apiFile = new File(apiDir, fileName); writeToFile(apiElement, apiFile); } else if (parent != null) { parent.addChild(apiElement); } return apiElement; }
public void testAPISerialization3() throws Exception { String xml = "<api name=\"test\" context=\"/dictionary\" transports=\"https\" hostname=\"apache.org\" port=\"8243\"" + " xmlns=\"http://ws.apache.org/ns/synapse\"><resource url-mapping=\"/admin/view\" " + "inSequence=\"in\"><outSequence><log/><send/></outSequence></resource></api>"; OMElement om = AXIOMUtil.stringToOM(xml); API api = APIFactory.createAPI(om); OMElement out = APISerializer.serializeAPI(api); assertXMLEqual(xml, out.toString()); }
public void testAPISerialization1() throws Exception { String xml = "<api name=\"test\" context=\"/dictionary\" transports=\"https\" xmlns=\"http://ws.apache.org/ns/synapse\">" + "<resource url-mapping=\"/admin/view\" inSequence=\"in\" outSequence=\"out\"/></api>"; OMElement om = AXIOMUtil.stringToOM(xml); API api = APIFactory.createAPI(om); OMElement out = APISerializer.serializeAPI(api); assertXMLEqual(xml, out.toString()); }
public void testAPISerialization4() throws Exception { String xml = "<api name=\"test\" context=\"/dictionary\" transports=\"https\" hostname=\"apache.org\" port=\"8243\"" + " xmlns=\"http://ws.apache.org/ns/synapse\"><resource url-mapping=\"/admin/view\" " + "outSequence=\"out\"><inSequence><log/><send/></inSequence></resource></api>"; OMElement om = AXIOMUtil.stringToOM(xml); API api = APIFactory.createAPI(om); OMElement out = APISerializer.serializeAPI(api); assertXMLEqual(xml, out.toString()); }
public void testAPISerialization2() throws Exception { String xml = "<api name=\"test\" context=\"/dictionary\" transports=\"https\" hostname=\"apache.org\" port=\"8243\"" + " xmlns=\"http://ws.apache.org/ns/synapse\"><resource url-mapping=\"/admin/view\" " + "inSequence=\"in\" outSequence=\"out\"/></api>"; OMElement om = AXIOMUtil.stringToOM(xml); API api = APIFactory.createAPI(om); OMElement out = APISerializer.serializeAPI(api); assertXMLEqual(xml, out.toString()); }
public void testAPISerialization5() throws Exception { String xml = "<api name=\"test\" context=\"/dictionary\" transports=\"https\" hostname=\"apache.org\" port=\"8243\"" + " xmlns=\"http://ws.apache.org/ns/synapse\"><resource url-mapping=\"/admin/view/*\" " + "><inSequence><log/><send/></inSequence><outSequence><log/><send/></outSequence></resource>" + "<resource url-mapping=\"/admin/*\"><inSequence><log/><send/></inSequence><outSequence>" + "<log/><send/></outSequence></resource><resource uri-template=\"/{char}/{word}\">" + "<inSequence><send/></inSequence><faultSequence><log level=\"full\"/></faultSequence>" + "</resource></api>"; OMElement om = AXIOMUtil.stringToOM(xml); API api = APIFactory.createAPI(om); OMElement out = APISerializer.serializeAPI(api); assertXMLEqual(xml, out.toString()); } }
APISerializer.serializeAPI(definitions, api);