Package org.apache.synapse.mediators.template

Examples of org.apache.synapse.mediators.template.TemplateMediator


                        new QName(SynapseConstants.SYNAPSE_NAMESPACE, "sequence"));
                if (element != null) {
                    Mediator mediator = MediatorFactoryFinder.getInstance().
                            getMediator(artifactConfig, properties);
                    if (mediator instanceof TemplateMediator) {
                        TemplateMediator tm = (TemplateMediator) mediator;

                        tm.setFileName((new File(fileName)).getName());
                        if (log.isDebugEnabled()) {
                            log.debug("Sequence Template named '" + tm.getName()
                                    + "' has been built from the file " + fileName);
                        }

                        tm.init(getSynapseEnvironment());
                        if (log.isDebugEnabled()) {
                            log.debug("Initialized the Template : " + tm.getName());
                        }

                        getSynapseConfiguration().addSequenceTemplate(tm.getName(), tm);
                        if (log.isDebugEnabled()) {
                            log.debug("Template Deployment from file : " + fileName + " : Completed");
                        }
                        log.info("Template named '" + tm.getName()
                                + "' has been deployed from file : " + fileName);

                        return tm.getName();
                    }
                }
            }

        } catch (Exception e) {
View Full Code Here


                        new QName(SynapseConstants.SYNAPSE_NAMESPACE, "sequence"));
                if (element != null) {
                    Mediator mediator = MediatorFactoryFinder.getInstance().
                            getMediator(artifactConfig, properties);
                    if (mediator instanceof TemplateMediator) {
                        TemplateMediator tm = (TemplateMediator) mediator;

                        tm.setFileName((new File(fileName)).getName());
                        if (log.isDebugEnabled()) {
                            log.debug("Sequence Template named '" + tm.getName()
                                    + "' has been built from the file " + fileName);
                        }

                        tm.init(getSynapseEnvironment());
                        if (log.isDebugEnabled()) {
                            log.debug("Initialized the Template : " + tm.getName());
                        }

                        TemplateMediator existingSt = getSynapseConfiguration().
                                getSequenceTemplate(existingArtifactName);

                        if (existingArtifactName.equals(tm.getName())) {
                            getSynapseConfiguration().updateSequenceTemplate(tm.getName(), existingSt);
                        } else {
                            getSynapseConfiguration().addSequenceTemplate(tm.getName(), tm);
                            getSynapseConfiguration().removeSequenceTemplate(existingSt.getName());
                            log.info("Template: " + existingArtifactName + " has been undeployed");
                        }

                        existingSt.destroy();
                        log.info("Template: " + tm.getName() + " has been updated from the file: " + fileName);
                        return tm.getName();
                    }
                }
            }
View Full Code Here

            }
        }

        for (Object o : localEntries) {
            if (o instanceof TemplateMediator) {
                TemplateMediator template = (TemplateMediator) o;
                if (template.getFileName() == null) {
                    MediatorSerializerFinder.getInstance().
                            getSerializer(template).serializeMediator(definitions, template);
                }
            } else if (o instanceof SequenceMediator) {
                SequenceMediator seq = (SequenceMediator) o;
View Full Code Here

                    log.debug("Template Undeployment of the template named : "
                            + artifactName + " : Completed");
                }
                log.info("Template named '" + st.getName() + "' has been undeployed");
            } else {
                TemplateMediator tm = getSynapseConfiguration().getSequenceTemplate(artifactName);
                if (tm != null) {
                    getSynapseConfiguration().removeSequenceTemplate(artifactName);
                    if (log.isDebugEnabled()) {
                        log.debug("Destroying the Template named : " + artifactName);
                    }
                    tm.destroy();
                    if (log.isDebugEnabled()) {
                        log.debug("Template Undeployment of the template named : "
                                + artifactName + " : Completed");
                    }
                    log.info("Template named '" + tm.getName() + "' has been undeployed");
                } else {
                    log.debug("Template task " + artifactName + " has already been undeployed");
                }
            }
        } catch (Exception e) {
View Full Code Here

                                artifactName + " : Completed");
                    }
                    log.info("Template named '" + artifactName + "' has been restored");
                }
            } else {
                TemplateMediator mt = getSynapseConfiguration().getSequenceTemplate(artifactName);
                if (mt != null) {
                    TemplateMediatorSerializer ts = new TemplateMediatorSerializer();
                    OMElement stElem = ts.serializeMediator(null, mt);
                    if (mt.getFileName() != null) {
                        String fileName = getServerConfigurationInformation().getSynapseXMLLocation()
                                + File.separator + MultiXMLConfigurationBuilder.TEMPLATES_DIR
                                + File.separator + st.getFileName();
                        writeToFile(stElem, fileName);
                        if (log.isDebugEnabled()) {
View Full Code Here

        Map<String, TemplateMediator> definedTemplates = new HashMap<String, TemplateMediator>();

        synchronized (this) {
            for (Object o : localRegistry.values()) {
                if (o instanceof TemplateMediator) {
                    TemplateMediator template = (TemplateMediator) o;
                    definedTemplates.put(template.getName(), template);
                }
            }
        }
        return definedTemplates;
    }
View Full Code Here

                o = registry.getResource(entry, getProperties());
                if (o != null && o instanceof TemplateMediator) {
                    localRegistry.put(key, entry);
                    return (TemplateMediator) o;
                } else if (o instanceof OMNode) {
                    TemplateMediator m = (TemplateMediator) new TemplateMediatorFactory().createMediator(
                            (OMElement) o, properties);
                    if (m != null) {
                        entry.setValue(m);
                        return m;
                    }
View Full Code Here

                File file = (File) templates.next();
                OMElement document = getOMElement(file);
                OMElement element = document.getFirstChildWithName(
                            new QName(SynapseConstants.SYNAPSE_NAMESPACE, "sequence"));
                if (element != null) {
                    TemplateMediator mediator =
                            (TemplateMediator) SynapseXMLConfigurationFactory.defineMediatorTemplate(
                                    synapseConfig, document, properties);
                    if (mediator != null) {
                        mediator.setFileName(file.getName());
                        synapseConfig.getArtifactDeploymentStore().addArtifact(
                                file.getAbsolutePath(), mediator.getName());
                    }
                    return;

                } else {
                    element = document.getFirstChildWithName(
View Full Code Here

        Map<String, TemplateMediator> definedTemplates = new HashMap<String, TemplateMediator>();

        synchronized (this) {
            for (Object o : localRegistry.values()) {
                if (o instanceof TemplateMediator) {
                    TemplateMediator template = (TemplateMediator) o;
                    definedTemplates.put(template.getName(), template);
                }
            }
        }
        return definedTemplates;
    }
View Full Code Here

                o = registry.getResource(entry, getProperties());
                if (o != null && o instanceof TemplateMediator) {
                    localRegistry.put(key, entry);
                    return (TemplateMediator) o;
                } else if (o instanceof OMNode) {
                    TemplateMediator m = (TemplateMediator) new TemplateMediatorFactory().createMediator(
                            (OMElement) o, properties);
                    if (m != null) {
                        entry.setValue(m);
                        return m;
                    }
View Full Code Here

TOP

Related Classes of org.apache.synapse.mediators.template.TemplateMediator

Copyright © 2018 www.massapicom. 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.