Package org.apache.synapse.eventing

Examples of org.apache.synapse.eventing.SynapseEventSource$EventDispatcher


                        + " can not be parsed!");
                System.exit(-1);
            }
            System.out.println(SCXMLWriter.write(doc));
            SCXMLExecutor exec = new SCXMLExecutor(evaluator, null, trc);
            EventDispatcher ed = new SimpleScheduler(exec);
            exec.setEventdispatcher(ed);
            exec.setStateMachine(doc);
            exec.addListener(doc, trc);
            exec.registerInvokerClass("scxml", SimpleSCXMLInvoker.class);
            exec.setRootContext(rootCtx);
View Full Code Here


    }

    public static SynapseEventSource defineEventSource(SynapseConfiguration config,
                                                       OMElement elem, Properties properties) {

        SynapseEventSource eventSource = null;

        try {
            eventSource = EventSourceFactory.createEventSource(elem, properties);
            if (eventSource != null) {
                config.addEventSource(eventSource.getName(), eventSource);
            }
        } catch (Exception e) {
            String msg = "Event Source configuration cannot be built";
            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EVENT_SOURCE, msg, e);
        }
View Full Code Here

     * exist a runtime exception is thrown.
     *
     * @param name name of the event source to be removed
     */
    public synchronized void removeEventSource(String name) {
        SynapseEventSource eventSource = eventSources.get(name);
        if (eventSource == null) {
            handleException("No event source exists by the name : " + name);
        } else {
            try {
                if (getAxisConfiguration().getServiceForActivation(name) != null) {
View Full Code Here

            Iterator events = FileUtils.iterateFiles(eventsDir, extensions, false);
            while (events.hasNext()) {
                File file = (File) events.next();
                OMElement document = getOMElement(file);
                SynapseEventSource eventSource = SynapseXMLConfigurationFactory.
                        defineEventSource(synapseConfig, document, properties);
                if (eventSource != null) {
                    eventSource.setFileName(file.getName());
                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                            file.getAbsolutePath(), eventSource.getName());
                }
            }
        }
    }
View Full Code Here

     * exist a runtime exception is thrown.
     *
     * @param name name of the event source to be removed
     */
    public synchronized void removeEventSource(String name) {
        SynapseEventSource eventSource = eventSources.get(name);
        if (eventSource == null) {
            handleException("No event source exists by the name : " + name);
        } else {
            try {
                if (getAxisConfiguration().getServiceForActivation(name) != null) {
View Full Code Here

    public boolean mediate(MessageContext synCtx) {
        if (log.isDebugEnabled()) {
            log.debug("Mediation for Event Publisher started");
        }
        SynapseEventSource eventSource = synCtx.getConfiguration().getEventSource(eventSourceName);
        eventSource.dispatchEvents(synCtx);
        return true;
    }
View Full Code Here

        synapseConfig.addStartup(startup);
        assertItemAdded(startup.getName(), STARTUP);
        synapseConfig.removeStartup(startup.getName());
        assertItemRemoved(startup.getName(), STARTUP);

        SynapseEventSource eventSrc = new SynapseEventSource("eventSrc1");
        synapseConfig.addEventSource(eventSrc.getName(), eventSrc);
        assertItemAdded(eventSrc.getName(), EVENT_SRC);
        synapseConfig.removeEventSource(eventSrc.getName());
        assertItemRemoved(eventSrc.getName(), EVENT_SRC);

        PriorityExecutor exec = new PriorityExecutor();
        exec.setName("exec1");
        synapseConfig.addPriorityExecutor(exec.getName(), exec);
        assertItemAdded(exec.getName(), EXECUTOR);
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("EventSource Deployment from file : " + fileName + " : Started");
        }

        try {
            SynapseEventSource es = EventSourceFactory.createEventSource(
                    artifactConfig, properties);
            if (es != null) {
                es.setFileName((new File(fileName)).getName());
                if (log.isDebugEnabled()) {
                    log.debug("EventSource named '" + es.getName()
                            + "' has been built from the file " + fileName);
                }
                es.buildService(getSynapseConfiguration().getAxisConfiguration());
                if (log.isDebugEnabled()) {
                    log.debug("Initialized the EventSource : " + es.getName());
                }
                getSynapseConfiguration().addEventSource(es.getName(), es);
                if (log.isDebugEnabled()) {
                    log.debug("EventSource Deployment from file : " + fileName + " : Completed");
                }
                log.info("EventSource named '" + es.getName()
                        + "' has been deployed from file : " + fileName);
                return es.getName();
            } else {
                handleSynapseArtifactDeploymentError("EventSource Deployment Failed. The " +
                        "artifact described in the file " + fileName + " is not an EventSource");
            }
        } catch (Exception e) {
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("EventSource Update from file : " + fileName + " : Started");
        }

        try {
            SynapseEventSource es = EventSourceFactory.createEventSource(
                    artifactConfig, properties);
            if (es != null) {
                es.setFileName((new File(fileName)).getName());
                if (log.isDebugEnabled()) {
                    log.debug("EventSource named '" + es.getName()
                            + "' has been built from the file " + fileName);
                }
                getSynapseConfiguration().removeEventSource(existingArtifactName);
                if (!existingArtifactName.equals(es.getName())) {
                    log.info("EventSource named " + existingArtifactName + " has been Undeployed");
                }
                es.buildService(getSynapseConfiguration().getAxisConfiguration());
                if (log.isDebugEnabled()) {
                    log.debug("Initialized the EventSource : " + es.getName());
                }
                getSynapseConfiguration().addEventSource(es.getName(), es);
                if (log.isDebugEnabled()) {
                    log.debug("EventSource " + (existingArtifactName.equals(es.getName()) ?
                            "update" : "deployment") + " from file : " + fileName + " : Completed");
                }
                log.info("EventSource named '" + es.getName()
                        + "' has been " + (existingArtifactName.equals(es.getName()) ?
                            "update" : "deployed") + " from file : " + fileName);
                return es.getName();
            } else {
                handleSynapseArtifactDeploymentError("EventSource Update Failed. The artifact " +
                        "described in the file " + fileName + " is not a EventSource");
            }
        } catch (DeploymentException e) {
View Full Code Here

            log.debug("EventSource Undeployment of the event source named : "
                    + artifactName + " : Started");
        }
       
        try {
            SynapseEventSource es = getSynapseConfiguration().getEventSource(artifactName);
            if (es != null) {
                getSynapseConfiguration().removeEventSource(artifactName);
                if (log.isDebugEnabled()) {
                    log.debug("EventSource Undyou neeeployment of the EventSource named : "
                            + artifactName + " : Completed");
                }
                log.info("EventSource named '" + es.getName() + "' has been undeployed");
            } else if (log.isDebugEnabled()) {
                log.debug("Event source " + artifactName + " has already been undeployed");
            }
        } catch (Exception e) {
            handleSynapseArtifactDeploymentError("EventSource Undeployement of EventSource named : "
View Full Code Here

TOP

Related Classes of org.apache.synapse.eventing.SynapseEventSource$EventDispatcher

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.