You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/11/16 08:27:56 UTC

svn commit: r475605 - in /incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/servicemix/ src/main/java/org/apache/servicemix/qu...

Author: gnodet
Date: Wed Nov 15 23:27:55 2006
New Revision: 475605

URL: http://svn.apache.org/viewvc?view=rev&rev=475605
Log:
SM-747: JBI compliant SE for Quartz

Added:
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/pom.xml   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzComponent.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzEndpoint.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/CronTriggerBean.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/DefaultQuartzMarshaler.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/JobDetailBean.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/QuartzMarshaler.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/ServiceMixJob.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/SimpleTriggerBean.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/resources/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/CustomMarshaler.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzComponentTest.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzSpringTest.java   (with props)
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/apache/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/apache/servicemix/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/apache/servicemix/quartz/
    incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/apache/servicemix/quartz/spring.xml   (with props)

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Nov 15 23:27:55 2006
@@ -0,0 +1,3 @@
+.classpath
+.project
+target

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/pom.xml?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/pom.xml (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/pom.xml Wed Nov 15 23:27:55 2006
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.servicemix</groupId>
+    <artifactId>servicemix</artifactId>
+    <version>3.1-incubating-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>servicemix-quartz</artifactId>
+  <packaging>jbi-component</packaging>
+  <name>ServiceMix :: Quartz</name>
+  <description>Quartz Service Engine</description>
+  
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-shared</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-services</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix</groupId>
+      <artifactId>servicemix-core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>quartz</groupId>
+      <artifactId>quartz</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>jbi-maven-plugin</artifactId>
+        <configuration>
+          <type>service-engine</type>
+          <component>org.apache.servicemix.quartz.QuartzComponent</component>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.xbean</groupId>
+        <artifactId>maven-xbean-plugin</artifactId>
+        <executions>
+          <execution>
+            <configuration>
+              <namespace>http://servicemix.apache.org/quartz/1.0</namespace>
+            </configuration>
+            <goals>
+              <goal>mapping</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzComponent.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzComponent.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzComponent.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzComponent.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz;
+
+import java.util.List;
+
+import org.apache.servicemix.common.DefaultComponent;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerFactory;
+import org.quartz.impl.StdSchedulerFactory;
+
+/**
+ * @org.apache.xbean.XBean element="component"
+ */
+public class QuartzComponent extends DefaultComponent {
+
+    private QuartzEndpoint[] endpoints;
+    private Scheduler scheduler;
+    private SchedulerFactory factory;
+    
+    /**
+     * @return the factory
+     */
+    public SchedulerFactory getFactory() {
+        return factory;
+    }
+
+    /**
+     * @param factory the factory to set
+     */
+    public void setFactory(SchedulerFactory factory) {
+        this.factory = factory;
+    }
+
+    /**
+     * @return the endpoints
+     */
+    public QuartzEndpoint[] getEndpoints() {
+        return endpoints;
+    }
+
+    /**
+     * @param endpoints the endpoints to set
+     */
+    public void setEndpoints(QuartzEndpoint[] endpoints) {
+        this.endpoints = endpoints;
+    }
+
+    /**
+     * @return the scheduler
+     */
+    public Scheduler getScheduler() {
+        return scheduler;
+    }
+
+    /**
+     * @param scheduler the scheduler to set
+     */
+    public void setScheduler(Scheduler scheduler) {
+        this.scheduler = scheduler;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.common.DefaultComponent#getConfiguredEndpoints()
+     */
+    @Override
+    protected List getConfiguredEndpoints() {
+        return asList(endpoints);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.common.DefaultComponent#getEndpointClasses()
+     */
+    @Override
+    protected Class[] getEndpointClasses() {
+        return new Class[] { QuartzEndpoint.class };
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.common.DefaultComponent#doInit()
+     */
+    @Override
+    public void doInit() throws Exception {
+        if (scheduler == null) {
+            if (factory == null) {
+                factory = new StdSchedulerFactory();
+            }
+            scheduler = factory.getScheduler();
+        }
+        scheduler.getContext().setAllowsTransientData(true);
+        scheduler.getContext().put(getComponentName(), this);
+        super.doInit();
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.common.DefaultComponent#doStart()
+     */
+    @Override
+    public void doStart() throws Exception {
+        scheduler.start();
+        super.doStart();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.common.DefaultComponent#doStopt()
+     */
+    @Override
+    public void doStop() throws Exception {
+        super.doStop();
+        scheduler.standby();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.common.DefaultComponent#doShutDown()
+     */
+    @Override
+    public void doShutDown() throws Exception {
+        super.doShutDown();
+        scheduler.shutdown();
+        scheduler = null;
+    }
+
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzComponent.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzComponent.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzEndpoint.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzEndpoint.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzEndpoint.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jbi.management.DeploymentException;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOnly;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+
+import org.apache.servicemix.common.EndpointSupport;
+import org.apache.servicemix.common.endpoints.ConsumerEndpoint;
+import org.apache.servicemix.quartz.support.DefaultQuartzMarshaler;
+import org.apache.servicemix.quartz.support.JobDetailBean;
+import org.apache.servicemix.quartz.support.QuartzMarshaler;
+import org.apache.servicemix.quartz.support.ServiceMixJob;
+import org.quartz.Calendar;
+import org.quartz.JobDetail;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.ObjectAlreadyExistsException;
+import org.quartz.Scheduler;
+import org.quartz.Trigger;
+import org.springframework.scheduling.quartz.JobDetailAwareTrigger;
+
+/**
+ * @org.apache.xbean.XBean element="endpoint"
+ */
+public class QuartzEndpoint extends ConsumerEndpoint {
+
+    private Trigger trigger;
+    private List<Trigger> triggers;
+    private Map<String, Calendar> calendars;
+    private JobDetail jobDetail;
+    private QuartzMarshaler marshaler = new DefaultQuartzMarshaler();
+    
+    /**
+     * @return the triggers
+     */
+    public List<Trigger> getTriggers() {
+        return triggers;
+    }
+
+    /**
+     * @param triggers the triggers to set
+     */
+    public void setTriggers(List<Trigger> triggers) {
+        this.triggers = triggers;
+    }
+
+    /**
+     * @return the trigger
+     */
+    public Trigger getTrigger() {
+        return trigger;
+    }
+
+    /**
+     * @param trigger the trigger to set
+     */
+    public void setTrigger(Trigger trigger) {
+        this.trigger = trigger;
+    }
+
+    /**
+     * @return the calendar
+     */
+    public Map<String, Calendar> getCalendars() {
+        return calendars;
+    }
+
+    /**
+     * @param calendar the calendar to set
+     */
+    public void setCalendars(Map<String, Calendar> calendars) {
+        this.calendars = calendars;
+    }
+
+    /**
+     * @return the job
+     */
+    public JobDetail getJobDetail() {
+        return jobDetail;
+    }
+
+    /**
+     * @param job the job to set
+     */
+    public void setJobDetail(JobDetail job) {
+        this.jobDetail = job;
+    }
+
+    public QuartzMarshaler getMarshaler() {
+        return marshaler;
+    }
+
+    public void setMarshaler(QuartzMarshaler marshaler) {
+        this.marshaler = marshaler;
+    }
+    
+    @Override
+    public String getLocationURI() {
+        return null;
+    }
+
+    public void process(MessageExchange exchange) throws Exception {
+        if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
+            throw new IllegalStateException("Unexpected ACTIVE exchange: " + exchange);
+        }
+    }
+
+    public void onJobExecute(JobExecutionContext context) throws JobExecutionException {
+        if (logger.isDebugEnabled()) {
+            logger.debug("Firing Quartz Job with context: " + context);
+        }
+        try {
+            InOnly exchange = getExchangeFactory().createInOnlyExchange();
+            NormalizedMessage message = exchange.createMessage();
+            getMarshaler().populateNormalizedMessage(message, context);
+            exchange.setInMessage(message);
+            configureExchangeTarget(exchange);
+            send(exchange);
+        }
+        catch (MessagingException e) {
+            throw new JobExecutionException(e);
+        }
+    }
+    
+    public void validate() throws DeploymentException {
+        super.validate();
+        if (trigger instanceof JobDetailAwareTrigger) {
+            if (jobDetail != null) {
+                throw new DeploymentException("jobDetail can not be set on endpoint and trigger at the same time");
+            }
+            jobDetail = ((JobDetailAwareTrigger) trigger).getJobDetail();
+        }
+        if (jobDetail == null) {
+            JobDetailBean j = new JobDetailBean();
+            j.setName(EndpointSupport.getKey(this));
+            jobDetail = j;
+        }
+        if (triggers == null) {
+            triggers = new ArrayList<Trigger>();
+        }
+        if (trigger != null && triggers != null && triggers.size() > 0) {
+            throw new DeploymentException("trigger and triggers can not be set at the same time");
+        }
+        if (trigger != null) {
+            triggers.add(trigger);
+        }
+        if (calendars == null) {
+            calendars = new HashMap<String, Calendar>();
+        }
+        for (Trigger t : triggers) {
+            if (t.getCalendarName() != null && calendars.get(t.getCalendarName()) == null) {
+                throw new DeploymentException("Trigger references an unknown calendar " + t.getCalendarName());
+            }
+            t.setJobName(jobDetail.getName());
+            t.setJobGroup(jobDetail.getGroup());
+        }
+    }
+    
+    public void start() throws Exception {
+        QuartzComponent component = (QuartzComponent) getServiceUnit().getComponent(); 
+        Scheduler scheduler = component.getScheduler();
+        jobDetail.getJobDataMap().put(ServiceMixJob.COMPONENT_NAME, component.getComponentName());
+        jobDetail.getJobDataMap().put(ServiceMixJob.ENDPOINT_NAME, EndpointSupport.getKey(this));
+        for (Map.Entry<String, Calendar> e : getCalendars().entrySet()) {
+            scheduler.addCalendar(e.getKey(), e.getValue(), true, true);
+        }
+        scheduler.addJob(getJobDetail(), true);
+        for (Trigger trigger : getTriggers()) {
+            boolean triggerExists = (scheduler.getTrigger(trigger.getName(), trigger.getGroup()) != null);
+            if (!triggerExists) {
+                try {
+                    scheduler.scheduleJob(trigger);
+                }
+                catch (ObjectAlreadyExistsException ex) {
+                    scheduler.rescheduleJob(trigger.getName(), trigger.getGroup(), trigger);
+                }
+            } else {
+                scheduler.rescheduleJob(trigger.getName(), trigger.getGroup(), trigger);
+            }
+        }
+        super.start();
+    }
+    
+    public void stop() throws Exception {
+        super.stop();
+        Scheduler scheduler = ((QuartzComponent) getServiceUnit().getComponent()).getScheduler();
+        for (Trigger trigger : getTriggers()) {
+            scheduler.unscheduleJob(trigger.getName(), trigger.getGroup());
+        }
+        scheduler.deleteJob(getJobDetail().getName(), getJobDetail().getGroup());
+        for (Map.Entry<String, Calendar> e : getCalendars().entrySet()) {
+            scheduler.deleteCalendar(e.getKey());
+        }
+    }
+
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzEndpoint.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/QuartzEndpoint.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/CronTriggerBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/CronTriggerBean.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/CronTriggerBean.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/CronTriggerBean.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz.support;
+
+/**
+ * 
+ * @org.apache.xbean.XBean element="cron"
+ */
+@SuppressWarnings("serial")
+public class CronTriggerBean extends org.springframework.scheduling.quartz.CronTriggerBean {
+
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/CronTriggerBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/CronTriggerBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/CronTriggerBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/DefaultQuartzMarshaler.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/DefaultQuartzMarshaler.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/DefaultQuartzMarshaler.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/DefaultQuartzMarshaler.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz.support;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.servicemix.components.util.MarshalerSupport;
+import org.apache.servicemix.jbi.util.DOMUtil;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * The default implementation of the Quartz marshaler
+ *
+ * @version $Revision$
+ */
+public class DefaultQuartzMarshaler extends MarshalerSupport implements QuartzMarshaler {
+
+    public void populateNormalizedMessage(NormalizedMessage message, JobExecutionContext context) throws JobExecutionException, MessagingException {
+        JobDetail detail = context.getJobDetail();
+        JobDataMap dataMap = detail.getJobDataMap();
+        for (Iterator iter = dataMap.entrySet().iterator(); iter.hasNext(); ) {
+            Map.Entry entry = (Map.Entry) iter.next();
+            String key = (String) entry.getKey();
+            if (!key.equals(ServiceMixJob.COMPONENT_NAME) && !key.equals(ServiceMixJob.ENDPOINT_NAME)) {
+	            Object value = entry.getValue();
+	            message.setProperty(key, value);
+            }
+        }
+        try {
+            Document document = getTransformer().createDocument();
+            Element root = document.createElement("timer");
+            document.appendChild(root);
+            DOMUtil.addChildElement(root, "name", detail.getName());
+            DOMUtil.addChildElement(root, "group", detail.getGroup());
+            DOMUtil.addChildElement(root, "fullname", detail.getFullName());
+            DOMUtil.addChildElement(root, "description", detail.getDescription());
+            DOMUtil.addChildElement(root, "fireTime", context.getFireTime());
+            message.setContent(new DOMSource(document));
+        }
+        catch (ParserConfigurationException e) {
+            throw new MessagingException("Failed to create content: " + e, e);
+        }
+    }
+
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/DefaultQuartzMarshaler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/DefaultQuartzMarshaler.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/DefaultQuartzMarshaler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/JobDetailBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/JobDetailBean.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/JobDetailBean.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/JobDetailBean.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz.support;
+
+/**
+ * @org.apache.xbean.XBean element="jobDetail"
+ */
+@SuppressWarnings("serial")
+public class JobDetailBean extends org.springframework.scheduling.quartz.JobDetailBean {
+    
+    public JobDetailBean() {
+        setJobClass(ServiceMixJob.class);
+    }
+
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/JobDetailBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/JobDetailBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/JobDetailBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/QuartzMarshaler.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/QuartzMarshaler.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/QuartzMarshaler.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/QuartzMarshaler.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz.support;
+
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+import javax.jbi.messaging.NormalizedMessage;
+import javax.jbi.messaging.MessagingException;
+
+/**
+ * @version $Revision$
+ */
+public interface QuartzMarshaler {
+
+    /**
+     * Populates the given normalized message from the Quartz context
+     *
+     * @param message the normalized message to populate
+     * @param context the Quartz context
+     * @throws JobExecutionException
+     * @throws MessagingException
+     */
+    void populateNormalizedMessage(NormalizedMessage message, JobExecutionContext context) throws JobExecutionException, MessagingException;
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/QuartzMarshaler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/QuartzMarshaler.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/QuartzMarshaler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/ServiceMixJob.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/ServiceMixJob.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/ServiceMixJob.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/ServiceMixJob.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz.support;
+
+import org.apache.servicemix.quartz.QuartzComponent;
+import org.apache.servicemix.quartz.QuartzEndpoint;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.SchedulerException;
+
+/**
+ * A Quartz Job which dispatches a message to a component.
+ *
+ * @version $Revision$
+ */
+public class ServiceMixJob implements Job {
+    
+    public static String COMPONENT_NAME = "org.apache.servicemix.quartz.ComponentName";
+    public static String ENDPOINT_NAME = "org.apache.servicemix.quartz.EndpointName";
+    
+    public void execute(JobExecutionContext context) throws JobExecutionException {
+        try {
+            String componentName = (String) context.getJobDetail().getJobDataMap().get(COMPONENT_NAME);
+            if (componentName == null) {
+                throw new JobExecutionException("No property '" + COMPONENT_NAME + "' defined. Bad job data map");
+            }
+            QuartzComponent component = (QuartzComponent) context.getScheduler().getContext().get(componentName);
+            if (component == null) {
+                throw new JobExecutionException("No quartz JBI component available for key: " + componentName + ". Bad job data map");
+            }
+            String endpointName = (String) context.getJobDetail().getJobDataMap().get(ENDPOINT_NAME);
+            if (endpointName == null) {
+                throw new JobExecutionException("No property '" + ENDPOINT_NAME + "' defined. Bad job data map");
+            }
+            QuartzEndpoint endpoint = (QuartzEndpoint) component.getRegistry().getEndpoint(endpointName);
+            if (endpoint == null) {
+                throw new JobExecutionException("No quartz JBI endpoint available for key: " + endpointName + ". Bad job data map");
+            }
+            endpoint.onJobExecute(context);
+        } catch (SchedulerException e) {
+            throw new JobExecutionException(e);
+        }
+    }
+    
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/ServiceMixJob.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/ServiceMixJob.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/ServiceMixJob.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/SimpleTriggerBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/SimpleTriggerBean.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/SimpleTriggerBean.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/SimpleTriggerBean.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz.support;
+
+/**
+ * @org.apache.xbean.XBean element="simple"
+ */
+@SuppressWarnings("serial")
+public class SimpleTriggerBean extends org.springframework.scheduling.quartz.SimpleTriggerBean {
+
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/SimpleTriggerBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/SimpleTriggerBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/main/java/org/apache/servicemix/quartz/support/SimpleTriggerBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/CustomMarshaler.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/CustomMarshaler.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/CustomMarshaler.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/CustomMarshaler.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz;
+
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.quartz.support.DefaultQuartzMarshaler;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+public class CustomMarshaler extends DefaultQuartzMarshaler {
+
+    /* (non-Javadoc)
+     * @see org.apache.servicemix.quartz.support.DefaultQuartzMarshaler#populateNormalizedMessage(javax.jbi.messaging.NormalizedMessage, org.quartz.JobExecutionContext)
+     */
+    @Override
+    public void populateNormalizedMessage(NormalizedMessage message, JobExecutionContext context) throws JobExecutionException, MessagingException {
+        super.populateNormalizedMessage(message, context);
+        message.setContent(new StringSource((String) context.getJobDetail().getJobDataMap().get("xml"))); 
+    }
+
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/CustomMarshaler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/CustomMarshaler.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/CustomMarshaler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzComponentTest.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzComponentTest.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzComponentTest.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.servicemix.jbi.container.JBIContainer;
+import org.apache.servicemix.tck.ReceiverComponent;
+import org.quartz.Trigger;
+import org.springframework.scheduling.quartz.SimpleTriggerBean;
+
+public class QuartzComponentTest extends TestCase {
+
+    public void test() throws Exception {
+        JBIContainer jbi = new JBIContainer();
+        jbi.setEmbedded(true);
+        jbi.init();
+        
+        QuartzComponent quartz = new QuartzComponent();
+        QuartzEndpoint endpoint = new QuartzEndpoint();
+        endpoint.setService(new QName("quartz"));
+        endpoint.setEndpoint("endpoint");
+        endpoint.setTargetService(new QName("receiver"));
+        SimpleTriggerBean trigger = new SimpleTriggerBean();
+        trigger.setRepeatInterval(100);
+        trigger.setName("trigger");
+        trigger.afterPropertiesSet();
+        endpoint.setTrigger(trigger);
+        quartz.setEndpoints(new QuartzEndpoint[] { endpoint });
+        jbi.activateComponent(quartz, "servicemix-quartz");
+        
+        ReceiverComponent receiver = new ReceiverComponent(new QName("receiver"), "endpoint");
+        jbi.activateComponent(receiver, "receiver");
+        
+        jbi.start();
+
+        Thread.sleep(200);
+        assertTrue(receiver.getMessageList().flushMessages().size() > 0);
+        
+        quartz.stop();
+        receiver.getMessageList().flushMessages();
+        Thread.sleep(200);
+        assertEquals(0, receiver.getMessageList().flushMessages().size());
+        
+        quartz.start();
+        Thread.sleep(200);
+        assertTrue(receiver.getMessageList().flushMessages().size() > 0);
+
+        jbi.shutDown();
+    }
+    
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzComponentTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzComponentTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzSpringTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzSpringTest.java?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzSpringTest.java (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzSpringTest.java Wed Nov 15 23:27:55 2006
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.quartz;
+
+import javax.jbi.messaging.NormalizedMessage;
+
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.tck.Receiver;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.w3c.dom.Element;
+
+public class QuartzSpringTest extends SpringTestSupport {
+
+    public void test() throws Exception {
+        Receiver r1 = (Receiver) getBean("receiver1");
+        Receiver r2 = (Receiver) getBean("receiver2");
+        Receiver r3 = (Receiver) getBean("receiver3");
+        r1.getMessageList().assertMessagesReceived(1);
+        r2.getMessageList().assertMessagesReceived(1);
+        r3.getMessageList().assertMessagesReceived(1);
+        NormalizedMessage nm = (NormalizedMessage) r3.getMessageList().flushMessages().get(0);
+        Element e = new SourceTransformer().toDOMElement(nm);
+        System.err.println(new SourceTransformer().contentToString(nm));
+        assertEquals("hello", e.getNodeName());
+    }
+    
+    @Override
+    protected AbstractXmlApplicationContext createBeanFactory() {
+        return new ClassPathXmlApplicationContext("org/apache/servicemix/quartz/spring.xml");
+    }
+
+}

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzSpringTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzSpringTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/java/org/apache/servicemix/quartz/QuartzSpringTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/apache/servicemix/quartz/spring.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/apache/servicemix/quartz/spring.xml?view=auto&rev=475605
==============================================================================
--- incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/apache/servicemix/quartz/spring.xml (added)
+++ incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/apache/servicemix/quartz/spring.xml Wed Nov 15 23:27:55 2006
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  
+-->
+<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
+       xmlns:quartz="http://servicemix.apache.org/quartz/1.0"
+       xmlns:test="urn:test">
+  
+  <sm:container id="jbi" embedded="true">
+    <sm:activationSpecs>
+      <sm:activationSpec id="servicemix-quartz">
+        <sm:component>
+          <quartz:component>
+            <quartz:endpoints>
+              
+              <quartz:endpoint service="test:service" endpoint="endpoint1" targetService="test:receiver1">
+                <quartz:trigger>
+                  <quartz:cron cronExpression="0/5 * * * * ?" />
+                </quartz:trigger>
+              </quartz:endpoint>
+
+              <quartz:endpoint service="test:service" endpoint="endpoint2" targetService="test:receiver2">
+                <quartz:trigger>
+                  <quartz:simple repeatCount="0" repeatInterval="1000" />
+                </quartz:trigger>
+              </quartz:endpoint>
+
+              <quartz:endpoint service="test:service" endpoint="endpoint3" targetService="test:receiver3">
+                <quartz:jobDetail>
+                  <quartz:jobDetail>
+                    <quartz:jobDataAsMap>
+                      <quartz:property key="xml"><![CDATA[
+                         <hello>world</hello>
+                      ]]></quartz:property>
+                    </quartz:jobDataAsMap>
+                  </quartz:jobDetail>
+                </quartz:jobDetail>
+                <quartz:triggers>
+                  <quartz:simple repeatCount="0" repeatInterval="1000" />
+                  <quartz:cron cronExpression="0 * 1 * * ?" />
+                </quartz:triggers>
+                <quartz:marshaler>
+                  <bean class="org.apache.servicemix.quartz.CustomMarshaler" />
+                </quartz:marshaler>
+              </quartz:endpoint>
+              
+            </quartz:endpoints>
+          </quartz:component>
+        </sm:component>
+      </sm:activationSpec>
+      <sm:activationSpec id="receiver1" service="test:receiver1">
+        <sm:component>
+          <bean class="org.apache.servicemix.tck.ReceiverComponent" />
+        </sm:component>
+      </sm:activationSpec>
+      <sm:activationSpec id="receiver2" service="test:receiver2">
+        <sm:component>
+          <bean class="org.apache.servicemix.tck.ReceiverComponent" />
+        </sm:component>
+      </sm:activationSpec>
+      <sm:activationSpec id="receiver3" service="test:receiver3">
+        <sm:component>
+          <bean class="org.apache.servicemix.tck.ReceiverComponent" />
+        </sm:component>
+      </sm:activationSpec>
+    </sm:activationSpecs>
+    
+  </sm:container>
+  
+</beans>

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/apache/servicemix/quartz/spring.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/deployables/serviceengines/servicemix-quartz/src/test/resources/org/apache/servicemix/quartz/spring.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml