public OMElement serializeTemplate(Template template, SynapseConfiguration synapseConfig, OMElement parent) throws Exception { File seqDir = createDirectory(currentDirectory, MultiXMLConfigurationBuilder.TEMPLATES_DIR); OMElement seqElem = new TemplateSerializer().serializeEndpointTemplate(template, null); String fileName = template.getFileName(); if (fileName != null) { if (currentDirectory == rootDirectory) { handleDeployment(seqDir, fileName, template.getName(), synapseConfig.getArtifactDeploymentStore()); } File seqFile = new File(seqDir, fileName); writeToFile(seqElem, seqFile); } else if (parent != null) { parent.addChild(seqElem); } return seqElem; }
public Template createEndpointTemplate(OMElement element, Properties properties) { Template template = new Template(); template.setName(nameAttribute.getAttributeValue()); } else { handleException("Error loading the configuration from endpointTemplate, '" + template.addParameter(paramName.getAttributeValue().trim()); if (!template.getParameters().contains("name")) { template.addParameter("name"); if (!template.getParameters().contains("uri")) { template.addParameter("uri"); handleException("endpoint element is required in an endpoint template"); template.setElement(endpointElement);
public OMElement serializeEndpointTemplate(Template template, OMElement parent) { OMElement templateElement = fac.createOMElement("template", SynapseConstants.SYNAPSE_OMNAMESPACE); templateElement.addAttribute(fac.createOMAttribute("name", nullNS, template.getName())); List<String> parameters = template.getParameters(); for (String entry : parameters) { OMElement paramElement = fac.createOMElement("parameter", SynapseConstants.SYNAPSE_OMNAMESPACE); paramElement.addAttribute(fac.createOMAttribute("name", nullNS, entry)); templateElement.addChild(paramElement); } templateElement.addChild(template.getElement().cloneOMElement()); if (parent != null) { parent.addChild(templateElement); } return templateElement; } }
private void replaceElement(TemplateEndpoint templateEndpoint, OMElement element) { Iterator attributesItr = element.getAllAttributes(); while (attributesItr.hasNext()) { OMAttribute attribute = (OMAttribute) attributesItr.next(); String replace = replace(attribute.getAttributeValue(), templateEndpoint); if (replace != null) { attribute.setAttributeValue(replace); } } if (element.getText() != null && !"".equals(element.getText())) { String replace = replace(element.getText(), templateEndpoint); if (replace != null) { element.setText(replace); } } Iterator elemItr = element.getChildElements(); while (elemItr.hasNext()) { OMElement childElement = (OMElement) elemItr.next(); replaceElement(templateEndpoint, childElement); } }
tm.setFileName(new File(fileName).getName()); if (log.isDebugEnabled()) { log.debug("Endpoint Template named '" + tm.getName() + "' has been built from the file " + fileName); getSynapseConfiguration().addEndpointTemplate(tm.getName(), tm); if (log.isDebugEnabled()) { log.debug("Template Deployment from file : " + fileName + " : Completed"); log.info("Endpoint Template named '" + tm.getName() + "' has been deployed from file : " + fileName); return tm.getName(); } else { element = artifactConfig.getFirstChildWithName(
/** * Returns the map of defined synapse endpoint templates in the configuration excluding the * fetched sequences from remote registry. * * @return Map of Templates defined in the local configuration */ public Map<String, Template> getEndpointTemplates() { Map<String, Template> definedTemplates = new HashMap<String, Template>(); synchronized (this) { for (Object o : localRegistry.values()) { if (o instanceof Template) { Template template = (Template) o; definedTemplates.put(template.getName(), template); } } } return definedTemplates; }
tm.setFileName(new File(fileName).getName()); tm.setArtifactContainerName(customLogContent); if (log.isDebugEnabled()) { log.debug("Endpoint Template named '" + tm.getName() + "' has been built from the file " + fileName); getSynapseConfiguration().addEndpointTemplate(tm.getName(), tm); if (log.isDebugEnabled()) { log.debug("Template Deployment from file : " + fileName + " : Completed"); log.info("Endpoint Template named '" + tm.getName() + "' has been deployed from file : " + fileName); return tm.getName(); } else { element = artifactConfig.getFirstChildWithName(
TemplateSerializer ts = new TemplateSerializer(); OMElement stElem = ts.serializeEndpointTemplate(st, null); if (st.getFileName() != null) { String fileName = getServerConfigurationInformation().getSynapseXMLLocation() + File.separator + MultiXMLConfigurationBuilder.TEMPLATES_DIR + File.separator + st.getFileName(); writeToFile(stElem, fileName); if (log.isDebugEnabled()) { String fileName = getServerConfigurationInformation().getSynapseXMLLocation() + File.separator + MultiXMLConfigurationBuilder.TEMPLATES_DIR + File.separator + st.getFileName(); writeToFile(stElem, fileName); if (log.isDebugEnabled()) {
public Endpoint create(TemplateEndpoint templateEndpoint, Properties properties) { // first go through all the elements and replace with the parameters OMElement clonedElement = element.cloneOMElement(); replaceElement(templateEndpoint, clonedElement); return EndpointFactory.getEndpointFromElement(clonedElement, false, properties); }
realEndpoint = eprTemplate.create(this, synCfg.getProperties()); } else { log.warn("Couldn't retrieve the endpoint template with the key:" + template);
synapseConfig, document, properties); if (endpointTemplate != null) { endpointTemplate.setFileName(file.getName()); synapseConfig.getArtifactDeploymentStore().addArtifact( file.getAbsolutePath(), endpointTemplate.getName());
/** * Returns the map of defined synapse endpoint templates in the configuration excluding the * fetched sequences from remote registry. * * @return Map of Templates defined in the local configuration */ public Map<String, Template> getEndpointTemplates() { Map<String, Template> definedTemplates = new HashMap<String, Template>(); synchronized (this) { for (Object o : localRegistry.values()) { if (o instanceof Template) { Template template = (Template) o; definedTemplates.put(template.getName(), template); } } } return definedTemplates; }
OMAttribute attribute = (OMAttribute) attributesItr.next(); String replace = replace(attribute.getAttributeValue(), templateEndpoint); if (replace != null && replace.contains("{system.prop")) { String newReplace = new String(replace); String replace = replace(element.getText(), templateEndpoint); OMElement childElement = (OMElement) elemItr.next(); replaceElement(templateEndpoint, childElement);
TemplateSerializer ts = new TemplateSerializer(); OMElement stElem = ts.serializeEndpointTemplate(st, null); if (st.getFileName() != null) { String fileName = getServerConfigurationInformation().getSynapseXMLLocation() + File.separator + MultiXMLConfigurationBuilder.TEMPLATES_DIR + File.separator + st.getFileName(); writeToFile(stElem, fileName); if (log.isDebugEnabled()) {
public Endpoint create(TemplateEndpoint templateEndpoint, Properties properties) { // first go through all the elements and replace with the parameters OMElement clonedElement = element.cloneOMElement(); replaceElement(templateEndpoint, clonedElement); return EndpointFactory.getEndpointFromElement(clonedElement, false, properties); }
realEndpoint = eprTemplate.create(this, synCfg.getProperties());
public Template createEndpointTemplate(OMElement element, Properties properties) { Template template = new Template(); template.setName(nameAttribute.getAttributeValue()); } else { handleException("Error loading the configuration from endpointTemplate, '" + template.addParameter(paramName.getAttributeValue().trim()); if (!template.getParameters().contains("name")) { template.addParameter("name"); if (!template.getParameters().contains("uri")) { template.addParameter("uri"); handleException("endpoint element is required in an endpoint template"); template.setElement(endpointElement);
synapseConfig, document, properties); if (endpointTemplate != null) { endpointTemplate.setFileName(file.getName()); synapseConfig.getArtifactDeploymentStore().addArtifact( file.getAbsolutePath(), endpointTemplate.getName());
public OMElement serializeTemplate(Template template, SynapseConfiguration synapseConfig, OMElement parent) throws Exception { File seqDir = createDirectory(currentDirectory, MultiXMLConfigurationBuilder.TEMPLATES_DIR); OMElement seqElem = new TemplateSerializer().serializeEndpointTemplate(template, null); String fileName = template.getFileName(); if (fileName != null) { if (currentDirectory == rootDirectory) { handleDeployment(seqDir, fileName, template.getName(), synapseConfig.getArtifactDeploymentStore()); } File seqFile = new File(seqDir, fileName); writeToFile(seqElem, seqFile); } else if (parent != null) { parent.addChild(seqElem); } return seqElem; }
public static Template defineEndpointTemplate(SynapseConfiguration config, OMElement elem, Properties properties) { TemplateFactory templateFactory = new TemplateFactory(); String name = elem.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE, "name")); try { Template template = templateFactory.createEndpointTemplate(elem, properties); if (template != null) { config.addEndpointTemplate(template.getName(), template); } return template; } catch (Exception e) { String msg = "Endpoint Template: " + name + "configuration cannot be built"; handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_TEMPLATES, msg, e); } return null; }