[seam-commits] Seam SVN: r11434 - in sandbox/trunk/modules: scheduling and 38 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Aug 26 17:51:23 EDT 2009


Author: peteroyle
Date: 2009-08-26 17:51:22 -0400 (Wed, 26 Aug 2009)
New Revision: 11434

Added:
   sandbox/trunk/modules/scheduling/
   sandbox/trunk/modules/scheduling/pom.xml
   sandbox/trunk/modules/scheduling/src/
   sandbox/trunk/modules/scheduling/src/etc/
   sandbox/trunk/modules/scheduling/src/etc/header.txt
   sandbox/trunk/modules/scheduling/src/main/
   sandbox/trunk/modules/scheduling/src/main/java/
   sandbox/trunk/modules/scheduling/src/main/java/org/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/Every.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/EveryBinding.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/Scheduled.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/ScheduledBinding.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/AbstractTimeEvent.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Event.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Hour.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Minute.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Second.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/exception/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/exception/SchedulerConfigurationException.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/exception/SchedulerInitialisationException.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/QuartzStarter.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/AbstractTimeEventJob.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/HourJob.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/MinuteJob.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/ScheduledEventJob.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/SecondJob.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/util/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/util/SchedulePropertiesManager.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/util/WebBeansManagerUtils.java
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduler/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduler/annotations/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduler/events/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduler/exception/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduler/jobs/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduler/quartz/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduler/quartz/jobs/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduler/util/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduling/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduling/annotations/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduling/events/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduling/exception/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduling/quartz/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduling/quartz/jobs/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/extension/scheduling/util/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/quartz/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/quartz/annotations/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/quartz/events/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/quartz/jobs/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/scheduling/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/scheduling/annotations/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/scheduling/events/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/scheduling/exception/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/scheduling/quartz/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/scheduling/quartz/jobs/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/scheduling/util/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/ticker/
   sandbox/trunk/modules/scheduling/src/main/java/org/jboss/webbeans/ticker/exception/
   sandbox/trunk/modules/scheduling/src/main/resources/
   sandbox/trunk/modules/scheduling/src/main/resources/META-INF/
   sandbox/trunk/modules/scheduling/src/main/resources/META-INF/beans.xml
   sandbox/trunk/modules/scheduling/src/main/resources/log4j.properties
   sandbox/trunk/modules/scheduling/src/main/resources/quartz.properties
   sandbox/trunk/modules/scheduling/src/test/
   sandbox/trunk/modules/scheduling/src/test/java/
   sandbox/trunk/modules/scheduling/src/test/java/org/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduler/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/AbstractCDITest.java
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/AnotherTestBean.java
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/Frequent.java
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/ScheduledEventTest.java
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TestBean.java
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TickerAbsentTest.java
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TickerPresentTest.java
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/webbeans/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/webbeans/environment/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/webbeans/environment/ticker/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/webbeans/extension/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/webbeans/extension/scheduler/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/webbeans/extension/scheduler/test/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/webbeans/extension/scheduler/test/ticker/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/webbeans/extension/schedulertest/
   sandbox/trunk/modules/scheduling/src/test/java/org/jboss/webbeans/quartz/
   sandbox/trunk/modules/scheduling/src/test/resources/
   sandbox/trunk/modules/scheduling/src/test/resources/log4j.properties
   sandbox/trunk/modules/scheduling/src/test/resources/scheduler.properties
Log:
Initial import of Seam Scheduling to sandbox

Added: sandbox/trunk/modules/scheduling/pom.xml
===================================================================
--- sandbox/trunk/modules/scheduling/pom.xml	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/pom.xml	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,128 @@
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.jboss.seam</groupId>
+    <artifactId>scheduling</artifactId>
+    <packaging>jar</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Seam Scheduling Module</name>
+    <url>http://maven.apache.org</url>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.0.2</version>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>jalopy-maven-plugin</artifactId>
+                <version>1.0-alpha-1</version>
+            </plugin>
+            <plugin>
+                <groupId>com.google.code.maven-license-plugin</groupId>
+                <artifactId>maven-license-plugin</artifactId>
+                <version>1.4.0</version>
+                <configuration>
+                    <basedir>${basedir}</basedir>
+                    <header>${basedir}/src/etc/header.txt</header>
+                    <quiet>false</quiet>
+                    <failIfMissing>true</failIfMissing>
+                    <aggregate>false</aggregate>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>format</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.annotation</groupId>
+            <artifactId>jsr250-api</artifactId>
+            <version>1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.webbeans</groupId>
+            <artifactId>jsr299-api</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <!-- TODO: remove this dependency.  -->
+        <dependency>
+            <groupId>org.jboss.webbeans</groupId>
+            <artifactId>webbeans-core</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>opensymphony</groupId>
+            <artifactId>quartz</artifactId>
+            <version>1.6.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.4</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <scope>test</scope>
+            <classifier>jdk15</classifier>
+            <version>5.8</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>junit</artifactId>
+                    <groupId>junit</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.webbeans</groupId>
+            <artifactId>webbeans-logging</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.webbeans</groupId>
+            <artifactId>webbeans-se</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.ejb3</groupId>
+            <artifactId>jboss-ejb3-api</artifactId>
+            <version>3.1.0-Alpha1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.webbeans</groupId>
+            <artifactId>webbeans-core-test</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
+

Added: sandbox/trunk/modules/scheduling/src/etc/header.txt
===================================================================
--- sandbox/trunk/modules/scheduling/src/etc/header.txt	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/etc/header.txt	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,14 @@
+JBoss, Home of Professional Open Source
+Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+contributors by the @authors tag. See the copyright.txt in the
+distribution for a full listing of individual contributors.
+
+Licensed 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.

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/Every.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/Every.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/Every.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,36 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.enterprise.inject.BindingType;
+
+/**
+ * The annotation which accompanies scheduled events which observe
+ * every event in a particular schedule. Eg:
+ * <code>public void doSomething( @Observes @Every Minute min )</code> will
+ * observe the event fired every minute.
+ * @author Peter Royle
+ */
+ at BindingType
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target( { ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE })
+public @interface Every {
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/EveryBinding.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/EveryBinding.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/EveryBinding.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,27 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.annotations;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+
+/**
+ *
+ * @author Peter Royle
+ */
+public class EveryBinding extends AnnotationLiteral<Every> implements Every {
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/Scheduled.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/Scheduled.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/Scheduled.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,64 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.enterprise.inject.BindingType;
+
+/**
+ * A binding annotation for use observing the Event.class event.
+ * <p>
+ * The value can either be a schedule in Cron format, or a 'named schedule', whereby
+ * the cron-formatted schedule appears in the /scheduler.properties file on the classpath
+ * as the value of the property with the given name.
+ * <p>
+ * Example scheduled event observer:
+ * <code>public void doSomething(@Observes @Scheduled("0 * * ? * *") Event e) { ... }</code>
+ * <p>
+ * Example named, scheduled event observer:
+ * <code>public void doSomething(@Observes @Scheduled("after.hours") Event e) { ... }</code>
+ * <p>
+ * Where the 'after.hours' schedule would be specified in /scheduler.properties like so:
+ * <code>after.hours=0 0 * ? * *
+ * <p>
+ * Scheduled bindings may be made typesafe using the following pattern:
+ * <code>
+ * @Scheduled("after.hours")
+ * @BindingType
+ * @Retention(RetentionPolicy.RUNTIME)
+ * public @interface AfterHours { .. }
+ * </code>
+ * The schedule can then be observed like so:
+ * <code>public void doSomething(@Observes @AfterHours Event e) { ... }</code>
+ *
+ * @author Peter Royle
+ */
+ at BindingType
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target( { ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE })
+public @interface Scheduled
+{
+
+    /**
+     * The schedule specification (in cron format) or name.
+     * @return the value.
+     */
+    String value();
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/ScheduledBinding.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/ScheduledBinding.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/annotations/ScheduledBinding.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,61 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.annotations;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+/**
+ *
+ * @author Peter Royle
+ */
+public class ScheduledBinding extends AnnotationLiteral<Scheduled> implements Scheduled {
+
+    private final String value;
+
+    /**
+     * Create a new instance of ScheduledBinding with a default 'value'. Note that
+     * this defaulted 'value' is an invalid scheudle/name and will cause errors
+     * during setting up of the schedules if used.
+     */
+    public ScheduledBinding()
+    {
+        value = "unspecified schedule";
+    }
+
+    /**
+     * Create a new instance of ScheduledBinding using the given value as the schedule
+     * specification/name.
+     * @param value The value to be used as the schedule specification/name.
+     */
+    public ScheduledBinding(String value)
+    {
+        this.value = value;
+    }
+
+
+    /**
+     * The schedule specification (in cron format) or name. If the value is a name,
+     * then the cron-formatted schedule specification will be read from the
+     * /scheduler.properties file on the classpath using the name as the property key.
+     * @return the value.
+     */
+    public String value()
+    {
+        return value;
+    }
+
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/AbstractTimeEvent.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/AbstractTimeEvent.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/AbstractTimeEvent.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,63 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.events;
+
+/**
+ * Superclass of all scheduled events, be they arbitrarily scheduled or one of the
+ * built-in Second, Minute or Hour events. Note that the presence of this superclass
+ * implies that the following observation is possible:
+ * <code>public void doSomething(@Observes @Every AbstractTimeEvent e)</code>
+ * <p>
+ * Such an observation is valid, and will respond to every single scheduled event
+ * fired (including the built in events).
+ *
+ * @author Peter Royle
+ */
+public abstract class AbstractTimeEvent
+{
+
+    private long timeFired;
+
+    /**
+     * Create an instance of some subclass of AbstractTimeEvent using the given timeFired.
+     * @param timeFired Represents the time at which the event represented by this instance fired.
+     */
+    protected AbstractTimeEvent(long timeFired)
+    {
+        this.timeFired = timeFired;
+    }
+
+    /**
+     *
+     * @return The time at which the event was fired.
+     */
+    public long getTimeFired()
+    {
+        return timeFired;
+    }
+
+    /**
+     *
+     * @return a String representation of this instance, showing the event type and the
+     * time at which the event was fired (epoch).
+     */
+    @Override
+    public String toString()
+    {
+        return getClass().getName() + " fired at " + Long.toString(timeFired);
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Event.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Event.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Event.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,35 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.events;
+
+/**
+ * Event which fires for arbitrarily-scheduled events.
+ * @see org.jboss.seam.scheduling.annotations.Scheduled
+ * @author Peter Royle
+ */
+public class Event extends AbstractTimeEvent {
+
+    /**
+     * Creates an instance of Event using the given value of timeFired.
+     * @param timeFired The time at which the event was fired.
+     */
+    public Event(long timeFired)
+    {
+        super(timeFired);
+    }
+
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Hour.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Hour.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Hour.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,35 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.events;
+
+/**
+ * Event that fires every hour.
+ * @author Peter Royle
+ */
+public class Hour extends AbstractTimeEvent
+{
+
+    /**
+     * Creates an instance of Hour using the given value of timeFired.
+     * @param timeFired The time at which the event was fired.
+     */
+    public Hour(long timeFired)
+    {
+        super(timeFired);
+    }
+    
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Minute.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Minute.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Minute.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,34 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.events;
+
+/**
+ * Event that fires every minute.
+ * @author Peter Royle
+ */
+public class Minute extends AbstractTimeEvent
+{
+
+    /**
+     * Creates an instance of Minute using the given value of timeFired.
+     * @param timeFired The time at which the event was fired.
+     */
+    public Minute(long timeFired)
+    {
+        super(timeFired);
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Second.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Second.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/events/Second.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,35 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.events;
+
+/**
+ * Event that fires every second.
+ * @author Peter Royle
+ */
+public class Second extends AbstractTimeEvent
+{
+
+    /**
+     * Creates an instance of Second using the given value of timeFired.
+     * @param timeFired The time at which the event was fired.
+     */
+    public Second(long timeFired)
+    {
+        super(timeFired);
+    }
+    
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/exception/SchedulerConfigurationException.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/exception/SchedulerConfigurationException.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/exception/SchedulerConfigurationException.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,46 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.exception;
+
+/**
+ * Exception which is thrown when there is a problem with the configuration of
+ * the application using Seam Scheduling.
+ *
+ * @author Peter Royle
+ */
+public class SchedulerConfigurationException extends RuntimeException
+{
+
+    /**
+     * Create a new instance of SchedulerConfigurationException with the given error message.
+     * @param message The error message.
+     */
+    public SchedulerConfigurationException(String message)
+    {
+        super(message);
+    }
+
+    /**
+     * Create a new instance of ScheudlerConfigurationException with the given error message and cause.
+     * @param message The error message.
+     * @param cause The orginal cause.
+     */
+    public SchedulerConfigurationException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/exception/SchedulerInitialisationException.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/exception/SchedulerInitialisationException.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/exception/SchedulerInitialisationException.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,44 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.exception;
+
+/**
+ * Exception thrown when there is a problem starting the Seam Scheduling module.
+ * @author Peter Royle
+ */
+public class SchedulerInitialisationException extends RuntimeException
+{
+
+    /**
+     * Create a new instance of SchedulerInitialisationException with the given error message.
+     * @param message The error message.
+     */
+    public SchedulerInitialisationException(String message)
+    {
+        super(message);
+    }
+
+    /**
+     * Create a new instance of SchedulerInitialisationException with the given error message and cause.
+     * @param message The error message.
+     * @param cause The orginal cause of the error.
+     */
+    public SchedulerInitialisationException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/QuartzStarter.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/QuartzStarter.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/QuartzStarter.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,338 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.quartz;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+import javax.enterprise.inject.spi.ObserverMethod;
+import org.jboss.seam.scheduling.events.Second;
+import org.jboss.seam.scheduling.events.Minute;
+import org.jboss.seam.scheduling.events.Hour;
+import org.jboss.seam.scheduling.quartz.jobs.SecondJob;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Observer;
+import java.util.Properties;
+import java.util.Set;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeanManager;
+import org.jboss.seam.scheduling.util.SchedulePropertiesManager;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+import org.jboss.seam.scheduling.annotations.EveryBinding;
+import org.jboss.seam.scheduling.annotations.Scheduled;
+import org.jboss.seam.scheduling.quartz.jobs.HourJob;
+import org.jboss.seam.scheduling.quartz.jobs.MinuteJob;
+import org.jboss.seam.scheduling.quartz.jobs.ScheduledEventJob;
+import org.jboss.seam.scheduling.exception.SchedulerInitialisationException;
+import org.jboss.seam.scheduling.exception.SchedulerConfigurationException;
+import org.quartz.CronTrigger;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.SimpleTrigger;
+import org.quartz.Trigger;
+import org.quartz.impl.StdSchedulerFactory;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Methods of this class are called at various stages of the JSR-299 initialisation
+ * to set up and start the appropriate schedules in line with the scheduled events
+ * being observed by the application.
+ * 
+ * @author Peter Royle
+ */
+ at ApplicationScoped
+public class QuartzStarter
+{
+
+    /**
+     * The name of the property containing the observer method bindings to be used
+     * when storing and retreiving it from the job details.
+     */
+    public static final String BINDINGS = "binding";
+    /**
+     * The name of the property containing the schedule specification (in cron format)
+     * when storing and retreiving it from the job details.
+     */
+    public static final String CRON_SCHEDULE_SPEC = "cronScheduleSpec";
+    /**
+     * The name of the job group for the Second, Minute and Hour events.
+     */
+    public static final String TICKER_JOB_GROUP = "ticker_job_group";
+    /**
+     * The name of the job group for all arbitrarily scheduled events.
+     */
+    public static final String SCHEDULE_JOB_GROUP = "schedule_job_group";
+    /**
+     * The name of the JSR-299 BeanManager instance when a reference to it is
+     * stored and retrieved from the job details.
+     */
+    public static final String MANAGER_NAME = "manager";
+    private static final String BEANMAN_CLASSNAME_WEBBEANS = "org.jboss.webbeans.BeanManagerImpl";
+    private Scheduler scheduler;
+    private Log log = Logging.getLog(QuartzStarter.class);
+
+    /**
+     * Initialises the scheduler.
+     * @param afterDisc The initialisation event being observed.
+     */
+    public void initTicker(@Observes AfterBeanDiscovery afterDisc)
+    {
+        try {
+            scheduler = StdSchedulerFactory.getDefaultScheduler();
+            getScheduler().start();
+
+        } catch (SchedulerException ex) {
+            log.fatal("Error initialising/starting scheduler", ex);
+        }
+
+
+    }
+
+    /**
+     * Initialises schedulers for all of the observed scheduled events.
+     * @param afterValid The observed event.
+     * @param manager The JSR-299 Bean Manager.
+     */
+    public void startJobs(@Observes AfterDeploymentValidation afterValid,
+            BeanManager manager)
+    {
+        try {
+
+            // common Second payload sample and start time
+            GregorianCalendar gc = new GregorianCalendar();
+            gc.add(GregorianCalendar.SECOND, 1);
+            Date startTime = new Date(gc.getTimeInMillis());
+
+            // Start scheduler for Second every second
+            final Trigger secondTrigger = new SimpleTrigger("jcdiTickerTrigger", TICKER_JOB_GROUP, startTime, null, SimpleTrigger.REPEAT_INDEFINITELY, 1000);
+            Set tickObservers = manager.resolveObserverMethods(new Second(0), new EveryBinding());
+            scheduleTicks(tickObservers, "second-trigger", manager, secondTrigger, SecondJob.class);
+
+            // Start scheduler for Minute every minute
+            Set minTickObservers = manager.resolveObserverMethods(new Minute(0), new EveryBinding());
+            final CronTrigger minTrigger = new CronTrigger("jcdiMinutelyTickerTrigger", TICKER_JOB_GROUP, "0 * * ? * *");
+            minTrigger.setStartTime(startTime);
+            scheduleTicks(minTickObservers, "minute-trigger", manager, minTrigger, MinuteJob.class);
+
+            // Start scheduler for Hour every hour
+            Set hrlyTickObservers = manager.resolveObserverMethods(new Hour(0), new EveryBinding());
+            final CronTrigger hrTrigger = new CronTrigger("jcdiHourlyTickerTrigger", TICKER_JOB_GROUP, "0 0 * ? * *");
+            hrTrigger.setStartTime(startTime);
+            scheduleTicks(hrlyTickObservers, "hour-trigger", manager, hrTrigger, HourJob.class);
+
+            // arbitrarily scheduled events.
+            scheduleScheduledEvents(manager, startTime);
+
+        } catch (SchedulerException ex) {
+            throw new SchedulerInitialisationException("Error setting up scheduler.", ex);
+        } catch (ParseException pe) {
+            throw new SchedulerInitialisationException("Error parsing schedule while initialising scheduler.", pe);
+        }
+
+    }
+
+    /**
+     * Shutdown the scheduler on application close.
+     */
+    @PreDestroy
+    public void stopTicker()
+    {
+        try {
+            getScheduler().shutdown();
+        } catch (SchedulerException ex) {
+            log.error("Error shutting down scheduler", ex);
+        }
+    }
+
+    /**
+     * @return the scheduler
+     */
+    public Scheduler getScheduler()
+    {
+        return scheduler;
+    }
+
+    private List<ObserverMethod<?, ?>> getRegisteredObservers(
+            BeanManager manager) throws SchedulerInitialisationException
+    {
+        // TODO(PR): can we remove this compile-time dependency on WebBeans' EventObserver<?> using reflection? Also if we could loose ConcurrentSetMultiMap that would be good.
+        final List<ObserverMethod<?, ?>> registeredObservers;
+        if (manager.getClass().getName().equals(BEANMAN_CLASSNAME_WEBBEANS)) {
+            try {
+                registeredObservers = (List<ObserverMethod<?, ?>>) manager.getClass().
+                        getDeclaredMethod("getObservers").invoke(manager);
+            } catch (Exception ex) {
+                throw new SchedulerInitialisationException("Error gettng list of observers from BeanManager (Web Beans implementstion)", ex);
+            }
+        } else {
+            throw new SchedulerInitialisationException("Unknown BeanManager implementation: " + manager.
+                    getClass() + ". Please raise this as a feature request, stating the JSR-299 implementation in use if possible.");
+        }
+        return registeredObservers;
+    }
+
+    private String lookupNamedScheduleIfNecessary(final String scheduleSpec) throws SchedulerConfigurationException
+    {
+        final String cronScheduleSpec;
+        if (scheduleSpec.contains(" ")) {
+            cronScheduleSpec = scheduleSpec;
+        } else {
+            Properties schedProperties = SchedulePropertiesManager.instance().
+                    getScheduleProperties();
+            cronScheduleSpec = schedProperties.getProperty(scheduleSpec);
+            if (StringUtils.isEmpty(cronScheduleSpec)) {
+                throw new SchedulerConfigurationException("Found empty or missing cron definition for named scheule '" + scheduleSpec + "'. Should be specified in the file " + SchedulePropertiesManager.SCHEDULE_PROPERTIES_PATH + " on the classpath.");
+            }
+        }
+        return cronScheduleSpec;
+    }
+
+    /**
+     * Construct the job details using the given parameter map and chedule the job
+     * to be executed by the given job class using the given trigger.
+     * @param jobName The name of the job to be executed.
+     * @param manager The BeanManager implementation.
+     * @param trigger The trigger representing the schedule of the job.
+     * @param jobKlass The class which will execute the job on schedule.
+     * @param jobParams The parameters to be passed to the job executor.
+     * @throws SchedulerException
+     */
+    private void scheduleJob(final String jobName, BeanManager manager,
+            final Trigger trigger, final Class jobKlass, Map jobParams) throws SchedulerException
+    {
+        JobDetail job = new JobDetail(jobName, trigger.getGroup(), jobKlass);
+        job.setJobDataMap(new JobDataMap());
+        job.getJobDataMap().put(MANAGER_NAME, manager);
+        job.getJobDataMap().putAll(jobParams);
+        getScheduler().scheduleJob(job, trigger);
+        log.info("Scheduler for " + jobName + " initialised");
+    }
+
+    /**
+     * Set up schedule for a given type of tick event (second, minute or hourly) but only if
+     * the given set of observers of that tick is not empty. This will pass an instance
+     * of the @Every binding type as the BINDINGS job parameter to be used when firing
+     * the events.
+     * @param tickObservers The set of observers of this event type (second, minute or hourly).
+     * @param jobName The name of the job.
+     * @param manager The BeanManager implementation.
+     * @param trigger The trigger representing the schedule of the job.
+     * @param jobKlass The class which will handle execution of the job on schedule.
+     * @throws SchedulerException
+     */
+    private void scheduleTicks(Set<Observer> tickObservers,
+            final String jobName, BeanManager manager, final Trigger trigger,
+            final Class jobKlass) throws SchedulerException
+    {
+        if (!tickObservers.isEmpty()) {
+            Map jobParams = new HashMap(1);
+            Set<Annotation> oneEveryBinding = new HashSet<Annotation>(1);
+            oneEveryBinding.add(new EveryBinding());
+            jobParams.put(BINDINGS, oneEveryBinding);
+            scheduleJob(jobName, manager, trigger, jobKlass, jobParams);
+        } else {
+            log.info("Skipping initilization of scheduler for " + jobName + " - No registered observers.");
+        }
+    }
+
+    /**
+     * Set up schedule for an arbitrarily scheduled event. This will pass the given
+     * observerBinding binding type as the BINDINGS job parameter to be used when firing
+     * the events. This binding type will usually be an instance of @Scheduled or
+     * some other binding type with the @Scheduled meta-annotation.
+     * @param scheduleSpec The schedule specification in cron format or the name of a named schedule.
+     * @param observerBindings The set of bindings found on the observers which will therefore be used when firing the events.
+     * @param manager The BeanManager implementation.
+     * @param startTime The time to start the schedule.
+     * @throws SchedulerException
+     */
+    private void scheduleJobForEvent(final String cronScheduleSpec,
+            final Set<Annotation> observerBindings, Date startTime, BeanManager manager)
+            throws ParseException, SchedulerException
+    {
+        final String name = "jcdiScheduledEventTrigger(" + cronScheduleSpec + ")";
+        log.info("Scheduling trigger for " + name);
+
+        final Trigger schedTrigger = new CronTrigger(name, SCHEDULE_JOB_GROUP, cronScheduleSpec);
+        schedTrigger.setStartTime(startTime);
+        final Map jobParams = new HashMap();
+        jobParams.put(CRON_SCHEDULE_SPEC, cronScheduleSpec);
+        jobParams.put(BINDINGS, observerBindings);
+        scheduleJob(name + "-trigger", manager, schedTrigger, ScheduledEventJob.class, jobParams);
+    }
+
+    /**
+     * Start scheduler for Event as per observers found (if any).
+     */
+    private void scheduleScheduledEvents(BeanManager manager, Date startTime) throws SchedulerException, SchedulerInitialisationException, ParseException
+    {
+        final List<ObserverMethod<?, ?>> registeredObservers = getRegisteredObservers(manager);
+        Map<String, Set<Annotation>> schedulesFound = new HashMap<String, Set<Annotation>>();
+        // collect the set of unique schedule specifications
+        for (ObserverMethod<?, ?> obsMeth : registeredObservers) {
+            for (Object bindingObj : obsMeth.getObservedBindings()) {
+
+                Annotation binding = (Annotation) bindingObj;
+                Scheduled schedBinding = null;
+
+                if (binding instanceof Scheduled) {
+                    schedBinding = (Scheduled) binding;
+                } else {
+                    // check for a @Scheduled meta-annotation
+                    Scheduled scheduled = binding.annotationType().
+                            getAnnotation(Scheduled.class);
+                    if (scheduled != null) {
+                        schedBinding = scheduled;
+                    }
+                }
+
+                // if we've found an arbitrarily scheduled event, record it's bindings against
+                // the cron formatted schedule specification so that it can be fired according
+                // to the apropriate schedule.
+                if (schedBinding != null) {
+                    final String cronScheduleSpec = lookupNamedScheduleIfNecessary(schedBinding.value());
+                    Set<Annotation> existingAnnotations = schedulesFound.get(cronScheduleSpec);
+                    if (existingAnnotations == null) {
+                        existingAnnotations = new HashSet<Annotation>();
+                    }
+                    existingAnnotations.add(binding);
+                    schedulesFound.put(cronScheduleSpec, existingAnnotations);
+                }
+            }
+        }
+        
+        if (schedulesFound.size() > 0) {
+            // set up a schedule for each unique schedule spec found
+            for (String cronScheduleSpec : schedulesFound.keySet()) {
+                scheduleJobForEvent(cronScheduleSpec, schedulesFound.get(cronScheduleSpec), startTime, manager);
+            }
+        } else {
+            log.info("Skipping initilization of scheduler for arbitrarily scheduled events - No registered observers.");
+        }
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/AbstractTimeEventJob.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/AbstractTimeEventJob.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/AbstractTimeEventJob.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,65 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.quartz.jobs;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+import javax.enterprise.inject.spi.BeanManager;
+import org.jboss.seam.scheduling.quartz.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.scheduling.events.AbstractTimeEvent;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+/**
+ * Base class for quartz jobs which fire scheduled events (including the built-in
+ * second, minute and hourly events). Implementing classes must define type of the
+ * event to be fired.
+ * 
+ * @author Peter Royle
+ */
+public abstract class AbstractTimeEventJob implements Job
+{
+
+    private Log log = LogFactory.getLog(SecondJob.class);
+
+    /**
+     * Implement this to return an instance of the appropriate event payload
+     * to be used when firing the event.
+     * @return an instance of the appropriate event type.
+     */
+    protected abstract AbstractTimeEvent createEventPayload();
+
+    /**
+     * Executes the internally scheduled job by firing the appropriate event with the
+     * appropriate binding annotation (to in turn execute the application-specific jobs
+     * which observe those events).
+     * @param context Details about the job.
+     * @throws JobExecutionException
+     */
+    public void execute(JobExecutionContext context) throws JobExecutionException
+    {
+        BeanManager manager = (BeanManager) context.getJobDetail().getJobDataMap().get(QuartzStarter.MANAGER_NAME);
+        final AbstractTimeEvent eventPayload = createEventPayload();
+        for (Annotation binding : (Set<Annotation>)context.getJobDetail().getJobDataMap().get(QuartzStarter.BINDINGS)) {
+            log.trace("Firing time event for " + eventPayload + " with binding " + binding);
+            manager.fireEvent(eventPayload, binding);
+        }
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/HourJob.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/HourJob.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/HourJob.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,38 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.quartz.jobs;
+
+import org.jboss.seam.scheduling.events.AbstractTimeEvent;
+import org.jboss.seam.scheduling.events.Hour;
+
+
+/**
+ * Fires the Hour event with the @Every binding.
+ * @author Peter Royle
+ */
+public class HourJob extends AbstractTimeEventJob
+{
+
+    /**
+     * Create an event payload instance of type Hour with the current system time.
+     * @return an instance of Hour.
+     */
+    protected AbstractTimeEvent createEventPayload()
+    {
+        return new Hour(System.currentTimeMillis());
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/MinuteJob.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/MinuteJob.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/MinuteJob.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,37 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.quartz.jobs;
+
+import org.jboss.seam.scheduling.events.AbstractTimeEvent;
+import org.jboss.seam.scheduling.events.Minute;
+
+/**
+ * Fires the Minute event with the @Every binding.
+ * @author Peter Royle
+ */
+public class MinuteJob extends AbstractTimeEventJob
+{
+
+    /**
+     *Create an event payload instance of type Minute with the current system time.
+     * @return an instance of Minute.
+     */
+    protected AbstractTimeEvent createEventPayload()
+    {
+        return new Minute(System.currentTimeMillis());
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/ScheduledEventJob.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/ScheduledEventJob.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/ScheduledEventJob.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,37 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.quartz.jobs;
+
+import org.jboss.seam.scheduling.events.AbstractTimeEvent;
+import org.jboss.seam.scheduling.events.Event;
+
+/**
+ * Fires the 'Event' event with the current system time.
+ * @author Peter Royle
+ */
+public class ScheduledEventJob extends AbstractTimeEventJob
+{
+
+    /**
+     * Create an event payload instance of type Event with the current system time.
+     * @return an instance of Event.
+     */
+    protected AbstractTimeEvent createEventPayload()
+    {
+        return new Event(System.currentTimeMillis());
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/SecondJob.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/SecondJob.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/quartz/jobs/SecondJob.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,37 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.quartz.jobs;
+
+import org.jboss.seam.scheduling.events.AbstractTimeEvent;
+import org.jboss.seam.scheduling.events.Second;
+
+/**
+ * Fires the Second event with the @Every binding.
+ * @author Peter Royle
+ */
+public class SecondJob extends AbstractTimeEventJob
+{
+
+    /**
+     * Create an instance of the Event payload using the current system time.
+     * @return an instance of Event.
+     */
+    protected AbstractTimeEvent createEventPayload()
+    {
+        return new Second(System.currentTimeMillis());
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/util/SchedulePropertiesManager.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/util/SchedulePropertiesManager.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/util/SchedulePropertiesManager.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,86 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * A singleton instance of the properties read from the /schedule.properties
+ * file on the classpath.
+ * @author Peter Royle
+ */
+public class SchedulePropertiesManager
+{
+
+    /**
+     * The path on the classpath at which the properties file cotaining named schedules is expected to be found.
+     */
+    public static final String SCHEDULE_PROPERTIES_PATH = "/scheduler.properties";
+    
+    private Properties scheduleProperties = null;
+    private static SchedulePropertiesManager instance = null;
+    private Log log = Logging.getLog(SchedulePropertiesManager.class);
+
+    /**
+     * Return a singleton instance of this class, creating the instance if necessary.
+     * @return the singleton instance of this class.
+     */
+    public static SchedulePropertiesManager instance()
+    {
+        if (instance == null) {
+            synchronized (SCHEDULE_PROPERTIES_PATH) {
+                if (instance == null) {
+                    instance = new SchedulePropertiesManager();
+                }
+            }
+        }
+        return instance;
+    }
+
+    /**
+     * Creates a new instance of SchedulePropertiesManager, reading the named schedules
+     * properties file if found.
+     */
+    public SchedulePropertiesManager()
+    {
+        scheduleProperties = new Properties();
+        final InputStream schedPropsIS = this.getClass().getResourceAsStream(SCHEDULE_PROPERTIES_PATH);
+        if (schedPropsIS != null) {
+            try {
+                scheduleProperties.load(schedPropsIS);
+            } catch (IOException ex) {
+                log.error("Error loading properties file for named schedules at " + SCHEDULE_PROPERTIES_PATH, ex);
+            }
+        } else {
+            log.warn("No named schedule configurations found (" + SCHEDULE_PROPERTIES_PATH +
+                    " not found on classpath).");
+        }
+    }
+
+    /**
+     *
+     * @return the scheduleProperties.
+     */
+    public Properties getScheduleProperties()
+    {
+        return scheduleProperties;
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/util/WebBeansManagerUtils.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/util/WebBeansManagerUtils.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/java/org/jboss/seam/scheduling/util/WebBeansManagerUtils.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,43 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling.util;
+
+import java.lang.annotation.Annotation;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+/**
+ * Utility methods for JSR-299 related functionality.
+ * @author Peter Royle
+ */
+public class WebBeansManagerUtils
+{
+
+    public static <T> T getInstanceByType(BeanManager manager, Class<T> type, Annotation... bindings)
+    {
+        final Bean<?> bean = manager.getBeans(type).iterator().next();
+        CreationalContext cc = manager.createCreationalContext(bean);
+        return (T) manager.getReference(bean, type, cc);
+    }
+
+    public static <T> T getInstanceByType(BeanManager manager, Class<T> type, CreationalContext cc, Annotation... bindings)
+    {
+        return (T) manager.getReference(
+                manager.getBeans(type).iterator().next(), type, cc);
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/main/resources/META-INF/beans.xml
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/resources/META-INF/beans.xml	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/resources/META-INF/beans.xml	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,19 @@
+<!--
+
+    JBoss, Home of Professional Open Source
+    Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+    contributors by the @authors tag. See the copyright.txt in the
+    distribution for a full listing of individual contributors.
+
+    Licensed 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></beans>

Added: sandbox/trunk/modules/scheduling/src/main/resources/log4j.properties
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/resources/log4j.properties	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/resources/log4j.properties	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,35 @@
+#
+# JBoss, Home of Professional Open Source
+# Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+# contributors by the @authors tag. See the copyright.txt in the
+# distribution for a full listing of individual contributors.
+#
+# Licensed 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.
+#
+# Licensed 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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=TRACE, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Added: sandbox/trunk/modules/scheduling/src/main/resources/quartz.properties
===================================================================
--- sandbox/trunk/modules/scheduling/src/main/resources/quartz.properties	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/main/resources/quartz.properties	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,35 @@
+#
+# JBoss, Home of Professional Open Source
+# Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+# contributors by the @authors tag. See the copyright.txt in the
+# distribution for a full listing of individual contributors.
+#
+# Licensed 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.
+#
+# Licensed 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.
+#
+org.quartz.scheduler.instanceName = Sched1
+org.quartz.scheduler.instanceId = 1
+org.quartz.scheduler.rmi.export = false
+org.quartz.scheduler.rmi.proxy = false
+
+org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
+org.quartz.threadPool.threadCount = 1
+
+org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

Added: sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/AbstractCDITest.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/AbstractCDITest.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/AbstractCDITest.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,105 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling;
+
+import org.jboss.seam.scheduling.quartz.QuartzStarter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.enterprise.inject.spi.Bean;
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.seam.scheduling.util.WebBeansManagerUtils;
+import org.jboss.webbeans.mock.MockDeployment;
+import org.jboss.webbeans.mock.MockServletLifecycle;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author pete
+ */
+public abstract class AbstractCDITest
+{
+
+    MockServletLifecycle lifecycle;
+    BeanManagerImpl manager;
+
+    public AbstractCDITest()
+    {
+    }
+
+    @AfterClass(alwaysRun = true)
+    public void afterClass() throws Exception
+    {
+        lifecycle.endRequest();
+        lifecycle.endSession();
+        lifecycle.endApplication();
+        lifecycle = null;
+    }
+
+    @BeforeClass
+    public void beforeClass() throws Throwable
+    {
+        lifecycle = new MockServletLifecycle();
+        lifecycle.initialize();
+        MockDeployment deployment = lifecycle.getDeployment();
+        final List<Class<? extends Object>> allBeansList = new ArrayList<Class<? extends Object>>(getDefaultWebBeans());
+        allBeansList.addAll(getAdditionalWebBeans());
+        deployment.getArchive().setBeanClasses(allBeansList);
+        lifecycle.beginApplication();
+        lifecycle.beginSession();
+        lifecycle.beginRequest();
+        manager = CurrentManager.rootManager();
+    }
+
+    @Test
+    public void testDefaultBeans()
+    {
+        Map<Class<?>, Bean<?>> beans = new HashMap<Class<?>, Bean<?>>();
+        for (Bean<?> bean : manager.getBeans()) {
+            if (bean instanceof RIBean) {
+                beans.put(((RIBean<?>) bean).getType(), bean);
+            }
+        }
+        for (Class klass : getDefaultWebBeans()) {
+            assert beans.containsKey(klass);
+            assert beans.get(klass) instanceof SimpleBean;
+        }
+        WebBeansManagerUtils.getInstanceByType(manager, TestBean.class).ping();
+    }
+
+    public List<Class<? extends Object>> getDefaultWebBeans()
+    {
+        return Arrays.asList(TestBean.class, AnotherTestBean.class, QuartzStarter.class);
+    }
+
+    /**
+     * Override in your tests to register specific beans with the manager.
+     * @return
+     */
+    public List<Class<? extends Object>> getAdditionalWebBeans()
+    {
+        return Collections.EMPTY_LIST;
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/AnotherTestBean.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/AnotherTestBean.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/AnotherTestBean.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,25 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling;
+
+/**
+ *
+ * @author pete
+ */
+public class AnotherTestBean {
+
+}

Added: sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/Frequent.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/Frequent.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/Frequent.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,41 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.enterprise.inject.BindingType;
+import org.jboss.seam.scheduling.annotations.Scheduled;
+
+/**
+ * A typesafe representation of the schedule named "test.one" for use as a binding
+ * type for observervers of Event (instead of using the @Scheduled annotation directly).
+ * This is achieved by creating an otherwise standard binding type which is also annotated with the
+ * @Scheduled anotation specifying the schedule specification in cron format or the name
+ * of the schedule.
+ * 
+ * @author Peter Royle
+ */
+ at Scheduled("test.one")
+ at BindingType
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target( { ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE })
+public @interface Frequent
+{
+}

Added: sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/ScheduledEventTest.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/ScheduledEventTest.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/ScheduledEventTest.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,146 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling;
+
+import org.jboss.seam.scheduling.quartz.QuartzStarter;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.scheduling.util.WebBeansManagerUtils;
+import org.jboss.seam.scheduling.annotations.Scheduled;
+import org.jboss.seam.scheduling.events.Event;
+import org.quartz.SchedulerException;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author pete
+ */
+ at ApplicationScoped
+public class ScheduledEventTest extends AbstractCDITest implements Serializable
+{
+
+    private static final int MAX_TIME_TO_WAIT = 20000;
+    private static final int SLEEP_TIME = 2000;
+    private boolean scheduledEventObserved = false;
+    private boolean namedEventObserved = false;
+    private boolean typesafeEventObserved = false;
+    private Log log = LogFactory.getLog(ScheduledEventTest.class);
+
+    @Override
+    public List<Class<? extends Object>> getAdditionalWebBeans()
+    {
+        List<Class<? extends Object>> list = new ArrayList<Class<? extends Object>>(1);
+        list.add(ScheduledEventTest.class);
+        return list;
+    }
+
+    /**
+     * Test that the ScheduledEventTest is registered as a WebBean.
+     */
+    @Test
+    public void testTickObserver()
+    {
+        log.info("Testing schedule observer exists as a WebBean");
+        WebBeansManagerUtils.getInstanceByType(manager, ScheduledEventTest.class);
+    }
+
+    @Test
+    public void testScheduleDoesGetRegistered() throws SchedulerException
+    {
+        QuartzStarter qStarter = WebBeansManagerUtils.getInstanceByType(manager, QuartzStarter.class);
+        List jobGroupNames = Arrays.asList(qStarter.getScheduler().
+                getJobGroupNames());
+        assert jobGroupNames.contains(QuartzStarter.SCHEDULE_JOB_GROUP);
+    }
+
+    @Test
+    public void testScheduleDoesFire()
+    {
+        log.info("Testing shedule observer receiving events");
+        ScheduledEventTest schedPresBean = WebBeansManagerUtils.
+                getInstanceByType(manager, ScheduledEventTest.class);
+        assert schedPresBean.isScheduledEventObserved() == false;
+        assert schedPresBean.isNamedEventObserved() == false;
+        assert schedPresBean.isTypesafeEventObserved() == false;
+        int totalTimeWaited = 0;
+        while (!schedPresBean.isScheduledEventObserved() && !schedPresBean.isNamedEventObserved() &&
+                !schedPresBean.isTypesafeEventObserved() && totalTimeWaited < MAX_TIME_TO_WAIT) {
+            try {
+                log.info("Sleeping for a few seconds, waiting for all events to fire. Waited for " + totalTimeWaited + "ms so far ...");
+                totalTimeWaited += SLEEP_TIME;
+                Thread.sleep(SLEEP_TIME);
+            } catch (InterruptedException ex) {
+                log.error("Thread was woken up while sleeping");
+                Assert.fail("Thread was woken up while sleeping. Why?");
+                ex.printStackTrace();
+            }
+        }
+        assert schedPresBean.isScheduledEventObserved() == true;
+        assert schedPresBean.isNamedEventObserved() == true;
+        assert schedPresBean.isTypesafeEventObserved() == true;
+
+    }
+
+    public void onSchedule(@Observes @Scheduled("*/5 * * ? * *") Event event)
+    {
+        log.info("Event observed: " + event.toString());
+        this.scheduledEventObserved = true;
+    }
+
+    public void onNamedSchedule(@Observes @Scheduled("test.one") Event event)
+    {
+        log.info("Event observed: " + event.toString());
+        this.namedEventObserved = true;
+    }
+
+    public void onTypesafeSchedule(@Observes @Frequent Event event)
+    {
+        log.info("Event observed: " + event.toString());
+        this.typesafeEventObserved = true;
+    }
+
+    /**
+     * @return if the unnamed, scheduled event has been observed.
+     */
+    public boolean isScheduledEventObserved()
+    {
+        return scheduledEventObserved;
+    }
+
+    /**
+     * @return if the named event has been observed.
+     */
+    public boolean isNamedEventObserved()
+    {
+        return namedEventObserved;
+    }
+
+    /**
+     * @return if the typesafe event has been observed.
+     */
+    public boolean isTypesafeEventObserved()
+    {
+        return typesafeEventObserved;
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TestBean.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TestBean.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TestBean.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,35 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling;
+
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ *
+ * @author pete
+ */
+public class TestBean {
+
+    private static LogProvider log = Logging.getLogProvider(TestBean.class);
+
+    public void ping() {
+        log.info("Pinging " + this.getClass().getName());
+    }
+
+}

Added: sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TickerAbsentTest.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TickerAbsentTest.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TickerAbsentTest.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,50 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling;
+
+import org.jboss.seam.scheduling.quartz.QuartzStarter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.NoSuchElementException;
+import org.jboss.seam.scheduling.util.WebBeansManagerUtils;
+import org.quartz.SchedulerException;
+import org.testng.annotations.Test;
+
+/**
+ * Test that the Ticker is NOT automatically initialised if there is NOT an observer
+ * of the Tick event present on the claspath.
+ * @author Peter Royle
+ */
+public class TickerAbsentTest extends AbstractCDITest {
+
+    /**
+     * Test that the TickObserverBean is not registered with the test container
+     * by default (ie: unless there are observers found to be listening).
+     */
+    @Test(expectedExceptions={NoSuchElementException.class})
+    public void testTickObserver() throws Exception {
+        WebBeansManagerUtils.getInstanceByType(manager, TickerPresentTest.class);
+    }
+
+    @Test
+    public void testTickDoesntGetRegistered() throws SchedulerException {
+        QuartzStarter qStarter = WebBeansManagerUtils.getInstanceByType(manager, QuartzStarter.class);
+        List jobGroupNames = Arrays.asList(qStarter.getScheduler().getJobGroupNames());
+        assert !jobGroupNames.contains(QuartzStarter.TICKER_JOB_GROUP);
+    }
+
+}

Added: sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TickerPresentTest.java
===================================================================
--- sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TickerPresentTest.java	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/test/java/org/jboss/seam/scheduling/TickerPresentTest.java	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,143 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.seam.scheduling;
+
+import org.jboss.seam.scheduling.quartz.QuartzStarter;
+import org.jboss.seam.scheduling.events.Second;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.scheduling.util.WebBeansManagerUtils;
+import org.jboss.seam.scheduling.annotations.Every;
+import org.jboss.seam.scheduling.events.Minute;
+import org.quartz.SchedulerException;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * Test that the Ticker is automatically initialised if there is an observer
+ * of the Second event present on the classpath. Ditto for Minute.
+ * 
+ * @author Peter Royle
+ */
+ at ApplicationScoped
+public class TickerPresentTest extends AbstractCDITest implements Serializable
+{
+    private static final int MAX_TIME_TO_WAIT = 70000;
+    private static final int SLEEP_TIME = 2000;
+
+    private boolean secondTickObserved = false;
+    private boolean minuteTickObserved = false;
+    private Log log = LogFactory.getLog(TickerPresentTest.class);
+
+    @Override
+    public List<Class<? extends Object>> getAdditionalWebBeans()
+    {
+        List<Class<? extends Object>> list = new ArrayList<Class<? extends Object>>(1);
+        list.add(TickerPresentTest.class);
+        return list;
+    }
+
+    /**
+     * Test that the TickObserverBean is registered as a WebBean.
+     */
+    @Test
+    public void testTickObserver()
+    {
+        log.info("Testing tick observer exists as a WebBean");
+        WebBeansManagerUtils.getInstanceByType(manager, TickerPresentTest.class);
+    }
+
+    @Test
+    public void testTickDoesGetRegistered() throws SchedulerException
+    {
+        QuartzStarter qStarter = WebBeansManagerUtils.getInstanceByType(manager, QuartzStarter.class);
+        List jobGroupNames = Arrays.asList(qStarter.getScheduler().getJobGroupNames());
+        assert jobGroupNames.contains(QuartzStarter.TICKER_JOB_GROUP);
+    }
+
+    @Test
+    public void testSecondTickDoesFire()
+    {
+        log.info("Testing tick observer receiving ticks");
+        TickerPresentTest tickPresTestBean = WebBeansManagerUtils.getInstanceByType(manager, TickerPresentTest.class);
+        try {
+            log.debug("Sleeping for a few seconds, waiting for a Tick event or two ...");
+            Thread.sleep(SLEEP_TIME);
+        } catch (InterruptedException ex) {
+            log.error("Thread was woken up while sleeping");
+            Assert.fail("Thread was woken up while sleeping. Why?");
+            ex.printStackTrace();
+        }
+        assert tickPresTestBean.isSecondTickObserved() == true;
+
+    }
+
+    @Test(groups={"long-running"})
+    public void testMinuteTickDoesFire()
+    {
+        log.info("Testing minute observer fires (could take up to a minute) ... ");
+        TickerPresentTest tickPresTestBean = WebBeansManagerUtils.getInstanceByType(manager, TickerPresentTest.class);
+        int totalTimeWaited = 0;
+        while (!tickPresTestBean.isMinuteTickObserved() && totalTimeWaited < MAX_TIME_TO_WAIT) {
+            try {
+                log.debug("Sleeping for a few seconds, waiting for a Minute Tick event ...");
+                totalTimeWaited += SLEEP_TIME;
+                Thread.sleep(SLEEP_TIME);
+            } catch (InterruptedException ex) {
+                log.error("Thread was woken up while sleeping");
+                Assert.fail("Thread was woken up while sleeping. Why?");
+                ex.printStackTrace();
+            }
+        }
+        assert tickPresTestBean.isMinuteTickObserved() == true;
+
+    }
+
+    public void onTick(@Observes @Every Second second)
+    {
+        log.info("Tick observed (second): " + second.toString());
+        this.secondTickObserved = true;
+    }
+
+    public void onTick(@Observes @Every Minute minute)
+    {
+        log.info("Tick observed (minute): " + minute.toString());
+        this.minuteTickObserved = true;
+    }
+
+    /**
+     * @return the secondTickObserved
+     */
+    public boolean isSecondTickObserved()
+    {
+        return secondTickObserved;
+    }
+
+    /**
+     * @return the minuteTickObserved
+     */
+    public boolean isMinuteTickObserved()
+    {
+        return minuteTickObserved;
+    }
+}

Added: sandbox/trunk/modules/scheduling/src/test/resources/log4j.properties
===================================================================
--- sandbox/trunk/modules/scheduling/src/test/resources/log4j.properties	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/test/resources/log4j.properties	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,35 @@
+#
+# JBoss, Home of Professional Open Source
+# Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+# contributors by the @authors tag. See the copyright.txt in the
+# distribution for a full listing of individual contributors.
+#
+# Licensed 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.
+#
+# Licensed 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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=DEBUG, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Added: sandbox/trunk/modules/scheduling/src/test/resources/scheduler.properties
===================================================================
--- sandbox/trunk/modules/scheduling/src/test/resources/scheduler.properties	                        (rev 0)
+++ sandbox/trunk/modules/scheduling/src/test/resources/scheduler.properties	2009-08-26 21:51:22 UTC (rev 11434)
@@ -0,0 +1,53 @@
+#
+# JBoss, Home of Professional Open Source
+# Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+# contributors by the @authors tag. See the copyright.txt in the
+# distribution for a full listing of individual contributors.
+#
+# Licensed 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.
+#
+# Licensed 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.
+#
+# This file defines the set of available schedules in the form:
+# name=schedule
+# Each schedule may be used for ne or more jobs. If more than one job is
+# is assigned to a single schedule then those jobs will be executed in a
+# round robin style.
+
+# Open issues:
+# 1. For round robin, what if the previous job has not completed? Should it
+# wait until next scheduled time or should it start as soon as the previous
+# job finishes?
+# 2. What is the best interpretation of 12:00/5? For a single job it would
+# most obviously be that the job would run every 5 minutes, starting at 12:00.
+# But if you added multiple jobs, would they continue to round robin around
+# the clock or would they only ru until all the jobs have been executed once,
+# and then wait for 12:00 to come again?
+
+# This schedule is called "test.one" and runs every 5 seconds
+test.one=*/5 * * ? * *
+
+# This schedule is called "test.two" and runs at precisely 1:12 PM every day
+test.two=13:12
+
+# This schedule is called "test.three" and will execute every 5 minutes,
+# starting at 12:00PM.
+test.three=12:00/5
+# could also be per-job,
+test.three.qeueumode=delayed



More information about the seam-commits mailing list