You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by sg...@apache.org on 2010/08/08 19:22:24 UTC
svn commit: r983452 - in /turbine/fulcrum/trunk/quartz: ./
src/java/org/apache/fulcrum/quartz/
src/java/org/apache/fulcrum/quartz/impl/ src/test/
src/test/org/apache/fulcrum/quartz/
src/test/org/apache/fulcrum/quartz/listener/ src/test/org/apache/fulcr...
Author: sgoeschl
Date: Sun Aug 8 17:22:23 2010
New Revision: 983452
URL: http://svn.apache.org/viewvc?rev=983452&view=rev
Log:
Upgrading to quartz-1.8.3 and thereby removing xstream
Added:
turbine/fulcrum/trunk/quartz/fulcrum-quartz.iml
turbine/fulcrum/trunk/quartz/fulcrum-quartz.ipr
turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java
turbine/fulcrum/trunk/quartz/src/test/quartz.xml
turbine/fulcrum/trunk/quartz/xdocs/configuration.xml
turbine/fulcrum/trunk/quartz/xdocs/cronsamples.xml
Removed:
turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/DefaultQuartzScheduler.java
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/SchedulerShutDownTest.java
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/XStreamTest.java
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/listener/FooListener.java
Modified:
turbine/fulcrum/trunk/quartz/pom.xml
turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/QuartzScheduler.java
turbine/fulcrum/trunk/quartz/src/test/TestComponentConfig.xml
turbine/fulcrum/trunk/quartz/src/test/TestRoleConfig.xml
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/BaseQuartzTestCase.java
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/test/NotSoSimpleJob.java
turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/test/SimpleJob.java
turbine/fulcrum/trunk/quartz/xdocs/changes.xml
turbine/fulcrum/trunk/quartz/xdocs/index.xml
Added: turbine/fulcrum/trunk/quartz/fulcrum-quartz.iml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/fulcrum-quartz.iml?rev=983452&view=auto
==============================================================================
--- turbine/fulcrum/trunk/quartz/fulcrum-quartz.iml (added)
+++ turbine/fulcrum/trunk/quartz/fulcrum-quartz.iml Sun Aug 8 17:22:23 2010
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="false" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/apache/avalon/framework/avalon-framework-api/4.3.1/avalon-framework-api-4.3.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/apache/avalon/framework/avalon-framework-api/4.3.1/avalon-framework-api-4.3.1-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/quartz-scheduler/quartz/1.8.3/quartz-1.8.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/quartz-scheduler/quartz/1.8.3/quartz-1.8.3-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/javax/transaction/jta/1.1/jta-1.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/javax/transaction/jta/1.1/jta-1.1-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.5.10/slf4j-api-1.5.10.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.5.10/slf4j-api-1.5.10-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-log4j12/1.5.10/slf4j-log4j12-1.5.10.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-log4j12/1.5.10/slf4j-log4j12-1.5.10-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.14/log4j-1.2.14.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/apache/fulcrum/fulcrum-yaafi/1.0.6/fulcrum-yaafi-1.0.6.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/apache/fulcrum/fulcrum-yaafi/1.0.6/fulcrum-yaafi-1.0.6-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/apache/avalon/framework/avalon-framework-impl/4.3.1/avalon-framework-impl-4.3.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/apache/avalon/framework/avalon-framework-impl/4.3.1/avalon-framework-impl-4.3.1-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/apache/fulcrum/fulcrum-testcontainer/1.0.6/fulcrum-testcontainer-1.0.6.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/org/apache/fulcrum/fulcrum-testcontainer/1.0.6/fulcrum-testcontainer-1.0.6-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MAVEN_REPOSITORY$/junit/junit/3.8.1/junit-3.8.1-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ </component>
+</module>
+
Added: turbine/fulcrum/trunk/quartz/fulcrum-quartz.ipr
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/fulcrum-quartz.ipr?rev=983452&view=auto
==============================================================================
--- turbine/fulcrum/trunk/quartz/fulcrum-quartz.ipr (added)
+++ turbine/fulcrum/trunk/quartz/fulcrum-quartz.ipr Sun Aug 8 17:22:23 2010
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="AntConfiguration">
+ <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
+ <option name="FILTER_TARGETS" value="false" />
+ </component>
+ <component name="CodeStyleManager">
+ <option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true" />
+ <option name="CODE_STYLE_SCHEME" value="" />
+ </component>
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions />
+ <wildcardResourcePatterns>
+ <entry name="!?*.java" />
+ </wildcardResourcePatterns>
+ <annotationProcessing enabled="false" useClasspath="true" />
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+ <component name="EntryPointsManager">
+ <entry_points />
+ </component>
+ <component name="ExportToHTMLSettings">
+ <option name="PRINT_LINE_NUMBERS" value="false" />
+ <option name="OPEN_IN_BROWSER" value="false" />
+ <option name="OUTPUT_DIRECTORY" />
+ </component>
+ <component name="ImportConfiguration">
+ <option name="VENDOR" />
+ <option name="RELEASE_TAG" />
+ <option name="LOG_MESSAGE" />
+ <option name="CHECKOUT_AFTER_IMPORT" value="true" />
+ </component>
+ <component name="JUnitProjectSettings">
+ <option name="TEST_RUNNER" value="UI" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="false" />
+ <option name="OPTION_NAVIGATOR" value="false" />
+ <option name="OPTION_INDEX" value="false" />
+ <option name="OPTION_SEPARATE_INDEX" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="false" />
+ <option name="OPTION_DEPRECATED_LIST" value="false" />
+ <option name="OTHER_OPTIONS" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="false" />
+ </component>
+ <component name="JikesSettings">
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="DEPRECATION" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="false" />
+ <option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false" />
+ <option name="DO_FULL_DEPENDENCE_CHECK" value="false" />
+ <option name="IS_INCREMENTAL_MODE" value="false" />
+ <option name="IS_EMACS_ERRORS_MODE" value="true" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ <option name="MAXIMUM_HEAP_SIZE" value="128" />
+ </component>
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/fulcrum-quartz.iml" filepath="$PROJECT_DIR$/fulcrum-quartz.iml" />
+ </modules>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" assert-keyword="false" jdk-15="false" project-jdk-name="1.6" />
+ <component name="SvnBranchConfigurationManager">
+ <option name="mySupportsUserInfoFilter" value="true" />
+ </component>
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="svn" />
+ </component>
+ <component name="WebServicesPlugin" addRequiredLibraries="true" />
+</project>
+
Modified: turbine/fulcrum/trunk/quartz/pom.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/pom.xml?rev=983452&r1=983451&r2=983452&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/pom.xml (original)
+++ turbine/fulcrum/trunk/quartz/pom.xml Sun Aug 8 17:22:23 2010
@@ -57,6 +57,13 @@
<role>Java Developer</role>
</roles>
</developer>
+ <developer>
+ <name>Siegfried Goeschl</name>
+ <id>sgoeschl</id>
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
</developers>
<dependencies>
@@ -66,27 +73,6 @@
<version>3.8.1</version>
<scope>test</scope>
</dependency>
- <!-- Service -->
- <dependency>
- <groupId>xstream</groupId>
- <artifactId>xstream</artifactId>
- <version>1.1.3</version>
- </dependency>
- <dependency>
- <groupId>quartz</groupId>
- <artifactId>quartz</artifactId>
- <version>1.5.2</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.avalon.framework</groupId>
- <artifactId>avalon-framework-impl</artifactId>
- <version>4.3.1</version>
- </dependency>
<dependency>
<groupId>org.apache.fulcrum</groupId>
<artifactId>fulcrum-testcontainer</artifactId>
@@ -99,6 +85,17 @@
<version>1.0.6</version>
<scope>test</scope>
</dependency>
+ <!-- Service Dependencies -->
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ <version>1.8.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.avalon.framework</groupId>
+ <artifactId>avalon-framework-api</artifactId>
+ <version>4.3.1</version>
+ </dependency>
</dependencies>
<build>
Modified: turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/QuartzScheduler.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/QuartzScheduler.java?rev=983452&r1=983451&r2=983452&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/QuartzScheduler.java (original)
+++ turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/QuartzScheduler.java Sun Aug 8 17:22:23 2010
@@ -19,30 +19,18 @@
package org.apache.fulcrum.quartz;
-import java.util.Map;
-
import org.quartz.Scheduler;
/**
- * @author <a href="mailto:leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
*
+ * @author <a href="mailto:leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
*/
public interface QuartzScheduler
{
- /** avalon idion */
- public static final String ROLE = QuartzScheduler.class.getName();
-
+ /**
+ * Get the underlying Quartz scheduler.
+ *
+ * @return the Quartz scheduler
+ */
Scheduler getScheduler();
-
- /**
- * Map containing JobDetail objects. Key is group.name
- * @return
- */
- Map getJobDetailsMap();
-
- /**
- * Map containing Trigger objects. Key is group.name
- * @return
- */
- Map getTriggersMap();
}
Added: turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java?rev=983452&view=auto
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java (added)
+++ turbine/fulcrum/trunk/quartz/src/java/org/apache/fulcrum/quartz/impl/QuartzSchedulerImpl.java Sun Aug 8 17:22:23 2010
@@ -0,0 +1,267 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.fulcrum.quartz.impl;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.activity.Startable;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.fulcrum.quartz.QuartzScheduler;
+import org.quartz.Job;
+import org.quartz.JobDetail;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.JobListener;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+import org.quartz.impl.StdSchedulerFactory;
+
+import java.util.Properties;
+
+/**
+ * Avalon service wrapping the QuartzScheduler.
+ */
+public class QuartzSchedulerImpl
+ extends AbstractLogEnabled
+ implements QuartzScheduler, Configurable, Serviceable, Disposable, Initializable, ThreadSafe, JobListener, Startable
+{
+ /**
+ * the Avalon service serviceManager
+ */
+ private ServiceManager serviceManager;
+
+ /**
+ * the Quartz scheduler instance
+ */
+ private Scheduler scheduler;
+
+ /**
+ * the quartz property file
+ */
+ private String quartzPropertyFile;
+
+ /**
+ * the quartz properties loaded from the XML configuration
+ */
+ private Properties quartzProperties;
+
+ // === Avalon Lifecycle =================================================
+
+ /**
+ * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+ */
+ public void configure(Configuration conf) throws ConfigurationException
+ {
+ Configuration quartzConf = conf.getChild("configuration", true);
+
+ if(quartzConf.getChild("properties", false) != null)
+ {
+ this.quartzProperties = Parameters.toProperties(Parameters.fromConfiguration(quartzConf.getChild("properties")));
+ }
+ else if(quartzConf.getChild("quartzPropertyFile", false) != null)
+ {
+ this.quartzPropertyFile = quartzConf.getChild("quartzPropertyFile").getValue();
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+ */
+ public void service(ServiceManager manager) throws ServiceException
+ {
+ this.serviceManager = manager;
+ }
+
+ /**
+ * @see org.apache.avalon.framework.activity.Initializable#initialize()
+ */
+ public void initialize() throws Exception
+ {
+ // instantiating a specific scheduler from a property file or properties
+ StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
+ if(this.quartzProperties != null)
+ {
+ getLogger().info("Pulling quartz configuration from the container XML configuration");
+ schedulerFactory.initialize(this.quartzProperties);
+ }
+ else if(this.quartzPropertyFile != null)
+ {
+ getLogger().info("Pulling quartz configuration from the following property file : " + this.quartzPropertyFile);
+ schedulerFactory.initialize(this.quartzPropertyFile);
+ }
+ else
+ {
+ getLogger().info("Using Quartz default configuration since no user-supplied configuration was found");
+ schedulerFactory.initialize();
+ }
+
+ this.scheduler = schedulerFactory.getScheduler();
+
+ // add this service instance as JobListener to allow basic monitoring
+ getScheduler().addGlobalJobListener(this);
+ }
+
+ public void start() throws Exception
+ {
+ getScheduler().start();
+
+ if(getLogger().isInfoEnabled())
+ {
+ logSchedulerConfiguration();
+ }
+
+ }
+
+ public void stop() throws Exception
+ {
+ getScheduler().standby();
+ }
+
+ /**
+ * @see org.apache.avalon.framework.activity.Disposable#dispose()
+ */
+ public void dispose()
+ {
+ try
+ {
+ // shutdown() does not return until executing Jobs complete execution
+ this.scheduler.shutdown(true);
+ }
+ catch (SchedulerException e)
+ {
+ this.getLogger().warn("Problem shutting down quartz scheduler ", e);
+ }
+
+ this.scheduler = null;
+ this.serviceManager = null;
+ }
+
+ // === Service Interface Implementation =================================
+
+ /**
+ * @see org.apache.fulcrum.quartz.QuartzScheduler#getScheduler()
+ */
+ public Scheduler getScheduler()
+ {
+ return scheduler;
+ }
+
+ /**
+ * Calls getName() on jobListener
+ *
+ * @see org.quartz.JobListener#getName()
+ */
+ public String getName()
+ {
+ return getClass().getName();
+ }
+
+ /**
+ * Calls service() on Job instance if it implements Serviceable
+ *
+ * @see org.quartz.JobListener#jobToBeExecuted(org.quartz.JobExecutionContext)
+ */
+ public void jobToBeExecuted(JobExecutionContext context)
+ {
+ Job job = context.getJobInstance();
+ if (job instanceof Serviceable)
+ {
+ try
+ {
+ ((Serviceable) job).service(serviceManager);
+ }
+ catch (ServiceException e)
+ {
+ getLogger().error("Error servicing Job[" + job + "]", e);
+ }
+ }
+ }
+
+ /**
+ * @see org.quartz.JobListener#jobWasExecuted(org.quartz.JobExecutionContext, org.quartz.JobExecutionException)
+ */
+ public void jobWasExecuted(JobExecutionContext context, JobExecutionException ex)
+ {
+ if (ex != null)
+ {
+ String msg = "Executing the job '" + context.getJobDetail().getFullName() + "' failed";
+ getLogger().error(msg, ex.getCause());
+ }
+ else
+ {
+ if (getLogger().isDebugEnabled())
+ {
+ getLogger().debug("Executing the job '" + context.getJobDetail().getFullName() + "' took " + context.getJobRunTime() + " ms");
+ }
+ }
+ }
+
+ /**
+ * @see org.quartz.JobListener#jobExecutionVetoed(org.quartz.JobExecutionContext)
+ */
+ public void jobExecutionVetoed(JobExecutionContext context)
+ {
+ // nothing to do
+ }
+
+ // === Service Implementation ===========================================
+
+ private void logSchedulerConfiguration() throws SchedulerException
+ {
+ String[] jobGroups = getScheduler().getJobGroupNames();
+ for (int i = 0; i < jobGroups.length; i++)
+ {
+ String jobGroup = jobGroups[i];
+ String[] jobsInGroup = getScheduler().getJobNames(jobGroup);
+ getLogger().info("Job Group: " + jobGroup + " contains the following number of jobs : " + jobsInGroup.length);
+ for (int j = 0; j < jobsInGroup.length; j++)
+ {
+ StringBuffer buffer = new StringBuffer();
+ String jobName = jobsInGroup[j];
+ JobDetail jobDetail = getScheduler().getJobDetail(jobName, jobGroup);
+ Trigger[] jobTriggers = getScheduler().getTriggersOfJob(jobName, jobGroup);
+ buffer.append(jobDetail.getFullName());
+ buffer.append(" => ");
+ if(jobTriggers != null && jobTriggers.length > 0)
+ {
+ buffer.append(jobTriggers[0].getFullName());
+ buffer.append(" (");
+ buffer.append(jobTriggers[0].getNextFireTime());
+ buffer.append(")");
+ }
+ else
+ {
+ buffer.append("unknown");
+ }
+
+ getLogger().info(buffer.toString());
+ }
+ }
+ }
+}
Modified: turbine/fulcrum/trunk/quartz/src/test/TestComponentConfig.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/test/TestComponentConfig.xml?rev=983452&r1=983451&r2=983452&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/test/TestComponentConfig.xml (original)
+++ turbine/fulcrum/trunk/quartz/src/test/TestComponentConfig.xml Sun Aug 8 17:22:23 2010
@@ -19,56 +19,34 @@
-->
<componentConfig>
+ <!--
+ Quartz Scheduler Service
+
+ configuration := contains either a property file or properties (optional)
+ configuration/propertyFile := a property file to configure Quartz
+ configuration/properties := a set of properties to configure Quartz
+ configuration/properties/parameter := a single configuration
+ configuration/properties/parameter@name := the name of the property
+ configuration/properties/parameter@value := the value of the property
+ -->
+
<quartz>
- <globalJobListener className="org.apache.fulcrum.quartz.listener.FooListener" />
- <scheduled jobName="simpleJob" jobGroup="DEFAULT_GROUP" triggerName="cron" triggerGroup="OTHER_GROUP"/>
- <jobDetails>
- <list>
- <org.quartz.JobDetail>
- <name>simpleJob</name>
- <group>DEFAULT_GROUP</group>
- <jobClass>org.apache.fulcrum.quartz.test.SimpleJob</jobClass>
- <volatility>false</volatility>
- <durability>false</durability>
- <shouldRecover>false</shouldRecover>
- <jobListeners/>
- </org.quartz.JobDetail>
- <org.quartz.JobDetail>
- <name>notSoSimpleJob</name>
- <group>DEFAULT_GROUP</group>
- <jobClass>org.apache.fulcrum.quartz.test.NotSoSimpleJob</jobClass>
- <volatility>false</volatility>
- <durability>false</durability>
- <shouldRecover>false</shouldRecover>
- <jobListeners/>
- </org.quartz.JobDetail>
- </list>
- </jobDetails>
- <triggers>
- <list>
- <org.quartz.CronTrigger>
- <startTime>2005-10-20 11:10:45.0 EDT</startTime>
- <misfireInstruction>0</misfireInstruction>
- <volatility>false</volatility>
- <group>OTHER_GROUP</group>
- <jobGroup>DEFAULT_GROUP</jobGroup>
- <jobName>notSoSimpleJob</jobName>
- <name>cron</name>
- <triggerListeners/>
- <cronEx serialization="custom">
- <org.quartz.CronExpression>
- <default>
- <cronExpression>0 0 12 * * ?</cronExpression>
- </default>
- </org.quartz.CronExpression>
- </cronEx>
- </org.quartz.CronTrigger>
- <org.quartz.SimpleTrigger>
- <name>simpleTrigger</name>
- <group>DEFAULT_GROUP</group>
- <description>test</description>
- </org.quartz.SimpleTrigger>
- </list>
- </triggers>
+ <configuration>
+ <properties>
+ <parameter name="org.quartz.scheduler.instanceName" value="TestScheduler"/>
+ <parameter name="org.quartz.scheduler.instanceId " value="AUTO"/>
+ <parameter name="org.quartz.scheduler.skipUpdateCheck" value="true"/>
+ <parameter name="org.quartz.threadPool.class" value="org.quartz.simpl.SimpleThreadPool"/>
+ <parameter name="org.quartz.threadPool.threadCount" value="3"/>
+ <parameter name="org.quartz.threadPool.threadPriority" value="5"/>
+ <parameter name="org.quartz.jobStore.misfireThreshold" value="60000"/>
+ <parameter name="org.quartz.jobStore.class" value="org.quartz.simpl.RAMJobStore"/>
+ <parameter name="org.quartz.plugin.jobInitializer.class" value="org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin"/>
+ <parameter name="org.quartz.plugin.jobInitializer.fileNames" value="./src/test/quartz.xml"/>
+ <parameter name="org.quartz.plugin.jobInitializer.failOnFileNotFound" value="true"/>
+ <parameter name="org.quartz.plugin.jobInitializer.scanInterval" value="120"/>
+ <parameter name="org.quartz.plugin.jobInitializer.wrapInUserTransaction" value="false"/>
+ </properties>
+ </configuration>
</quartz>
</componentConfig>
Modified: turbine/fulcrum/trunk/quartz/src/test/TestRoleConfig.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/test/TestRoleConfig.xml?rev=983452&r1=983451&r2=983452&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/test/TestRoleConfig.xml (original)
+++ turbine/fulcrum/trunk/quartz/src/test/TestRoleConfig.xml Sun Aug 8 17:22:23 2010
@@ -17,11 +17,9 @@
specific language governing permissions and limitations
under the License.
-->
-<!-- This configuration file for Avalon components is used for testing the TestComponent -->
<role-list>
<role
name="org.apache.fulcrum.quartz.QuartzScheduler"
shorthand="quartz"
- default-class="org.apache.fulcrum.quartz.impl.DefaultQuartzScheduler"/>
-
+ default-class="org.apache.fulcrum.quartz.impl.QuartzSchedulerImpl"/>
</role-list>
Modified: turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/BaseQuartzTestCase.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/BaseQuartzTestCase.java?rev=983452&r1=983451&r2=983452&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/BaseQuartzTestCase.java (original)
+++ turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/BaseQuartzTestCase.java Sun Aug 8 17:22:23 2010
@@ -19,7 +19,7 @@
package org.apache.fulcrum.quartz;
-import org.apache.fulcrum.quartz.impl.DefaultQuartzScheduler;
+import org.apache.fulcrum.quartz.test.NotSoSimpleJob;
import org.apache.fulcrum.quartz.test.SimpleJob;
import org.apache.fulcrum.testcontainer.BaseUnitTest;
@@ -28,9 +28,10 @@ import org.apache.fulcrum.testcontainer.
*
* @author <a href="mailto:epughNOSPAM@opensourceconnections.com">Eric Pugh </a>
*/
-public class BaseQuartzTestCase extends BaseUnitTest {
+public abstract class BaseQuartzTestCase extends BaseUnitTest {
protected QuartzScheduler quartz;
+
public BaseQuartzTestCase(String arg0) {
super(arg0);
}
@@ -41,16 +42,17 @@ public class BaseQuartzTestCase extends
public void setUp() throws Exception {
- quartz = (QuartzScheduler) lookup(QuartzScheduler.ROLE);
-
SimpleJob.reset();
+ NotSoSimpleJob.reset();
+ quartz = (QuartzScheduler) lookup(QuartzScheduler.class.getName());
+ System.out.println(">>> " + getName() + ">>>");
}
public void tearDown() {
- release(QuartzScheduler.ROLE);
+ release(QuartzScheduler.class.getName());
SimpleJob.reset();
+ NotSoSimpleJob.reset();
super.tearDown();
}
-
}
Modified: turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java?rev=983452&r1=983451&r2=983452&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java (original)
+++ turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/DefaultQuartzSchedulerImplTest.java Sun Aug 8 17:22:23 2010
@@ -19,98 +19,100 @@
package org.apache.fulcrum.quartz;
-import java.util.Date;
-import java.util.Map;
-
import org.apache.fulcrum.quartz.test.NotSoSimpleJob;
import org.apache.fulcrum.quartz.test.SimpleJob;
-import org.quartz.CronTrigger;
-import org.quartz.JobListener;
+import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SimpleTrigger;
import org.quartz.Trigger;
+import org.quartz.TriggerUtils;
+
+import java.util.Date;
/**
* @author <a href="mailto:leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
* @author <a href="mailto:epughNOSPAM@opensourceconnections.com">Eric Pugh </a>
*/
-public class DefaultQuartzSchedulerImplTest extends BaseQuartzTestCase {
-
+public class DefaultQuartzSchedulerImplTest extends BaseQuartzTestCase
+{
- public void testGetJobs() throws Exception {
- Scheduler sched = quartz.getScheduler();
- assertNotNull(sched);
- String[] jobNames = sched.getJobNames("DEFAULT_GROUP");
- assertEquals(2, jobNames.length);
- }
-
- public void testJobListener() throws Exception {
- Scheduler sched = quartz.getScheduler();
- //ExecutionManager tb conta
- assertEquals(2, sched.getGlobalJobListeners().size());
- JobListener listener = (JobListener) sched.getGlobalJobListeners().get(1);
- assertEquals("Foo", listener.getName());
- }
-
- public void testJobExecutionWithManager() throws Exception {
- Scheduler sched = quartz.getScheduler();
- Trigger rightNow = new SimpleTrigger("someTrigger", Scheduler.DEFAULT_GROUP, "notSoSimpleJob", "DEFAULT_GROUP",
- new Date(), null, 0, 0L);
- sched.scheduleJob(rightNow);
- Thread.sleep(500);
- assertTrue(NotSoSimpleJob.executed);
- assertTrue(NotSoSimpleJob.serviced);
- }
-
- public void testJobExecution() throws Exception {
- Scheduler sched = quartz.getScheduler();
- Trigger rightNow = new SimpleTrigger("someTrigger", Scheduler.DEFAULT_GROUP, "simpleJob", "DEFAULT_GROUP",
- new Date(), null, 0, 0L);
- sched.scheduleJob(rightNow);
- Thread.sleep(500);
- assertTrue(SimpleJob.executed);
- //can't compose
- assertFalse(SimpleJob.composed);
- }
-
- public void testJobExecutionWithCron() throws Exception {
- assertFalse(SimpleJob.executed);
- Scheduler sched = quartz.getScheduler();
- Trigger cronTrigger = new CronTrigger("someTriggerCron", Scheduler.DEFAULT_GROUP, "simpleJob", "DEFAULT_GROUP",
- "* * * * * ?");
- sched.scheduleJob(cronTrigger);
- Thread.sleep(500);
- assertTrue(SimpleJob.executed);
- //can't compose
- assertFalse(SimpleJob.composed);
- }
-
- public void testJobDetailMap() {
- Map map = quartz.getJobDetailsMap();
- assertEquals(2, map.size());
- assertTrue(map.containsKey("DEFAULT_GROUP.simpleJob"));
- assertTrue(map.containsKey("DEFAULT_GROUP.notSoSimpleJob"));
- }
-
- public void testTriggerMap() {
- Map map = quartz.getTriggersMap();
- assertEquals(2, map.size());
- assertTrue(map.containsKey("DEFAULT_GROUP.simpleTrigger"));
-
- SimpleTrigger simpleTrigger = (SimpleTrigger) map.get("DEFAULT_GROUP.simpleTrigger");
- assertEquals("DEFAULT_GROUP", simpleTrigger.getGroup());
- assertEquals("simpleTrigger", simpleTrigger.getName());
-
- assertTrue(map.containsKey("OTHER_GROUP.cron"));
- CronTrigger cronTrigger = (CronTrigger) map.get("OTHER_GROUP.cron");
- assertEquals("0 0 12 * * ?", cronTrigger.getCronExpression());
- }
-
- public void testPreScheduled() throws Exception {
- Trigger triggers[] = quartz.getScheduler().getTriggersOfJob("notSoSimpleJob", "DEFAULT_GROUP");
+ /**
+ * Make sure that the Quartz sheduler is up and running
+ */
+ public void testService() throws Exception
+ {
+ Scheduler scheduler = quartz.getScheduler();
+ assertNotNull(scheduler);
+ assertNotNull(scheduler.getContext());
+ }
+
+ /**
+ * Get all scheduled jobs for "TURBINE" to make sure that
+ * the registration worked.
+ */
+ public void testGetJobs() throws Exception
+ {
+ Scheduler scheduler = quartz.getScheduler();
+ assertNotNull(scheduler);
+ String[] jobNames = scheduler.getJobNames("TURBINE");
+ assertEquals("Expected two registered jobs", 2, jobNames.length);
+ }
+
+ /**
+ * Get the job details and job data map of an existing job to
+ * make sure that the XStream configuration works.
+ */
+ public void testJobDetailMap() throws Exception
+ {
+ JobDetail jobDetail = quartz.getScheduler().getJobDetail("simpleJob", "TURBINE");
+ assertNotNull(jobDetail);
+ assertEquals("simpleJob", jobDetail.getName());
+ assertNotNull(jobDetail.getJobDataMap());
+ assertEquals(2, jobDetail.getJobDataMap().size());
+ }
+
+ /**
+ * Make sure the "notSoSimpleJob" is triggered by the CronTrigger.
+ */
+ public void testGetTriggersOfJob() throws Exception
+ {
+ Trigger triggers[] = quartz.getScheduler().getTriggersOfJob("notSoSimpleJob", "TURBINE");
assertEquals(1, triggers.length);
-
+ assertEquals("cronTrigger", triggers[0].getName());
}
-
+ /**
+ * Test adding/removing a scheduled job which would be executed
+ * in the future.
+ */
+ public void testAddRemoveTrigger() throws Exception
+ {
+ Scheduler scheduler = quartz.getScheduler();
+ Date date = TriggerUtils.getDateOf(0, 0, 0, 1, 1, 2099);
+ Trigger someDay = new SimpleTrigger("someTrigger", "TURBINE", "simpleJob", "TURBINE", date, null, 0, 0L);
+ scheduler.scheduleJob(someDay);
+ Trigger trigger = scheduler.getTrigger("someTrigger", "TURBINE");
+ assertNotNull(trigger);
+ scheduler.unscheduleJob("someTrigger", "TURBINE");
+ trigger = scheduler.getTrigger("someTrigger", "TURBINE");
+ assertNull(trigger);
+ }
+
+ /**
+ * Make sure that our two registered jobs are executed after
+ * one second.
+ */
+ public void testJobExecution() throws Exception
+ {
+ Thread.sleep(2000);
+ assertTrue("SimpleJob was not executed", SimpleJob.wasExecuted);
+ assertTrue("NotSoSimpleJob was not executed", NotSoSimpleJob.wasExecuted);
+ assertTrue("NotSoSimpleJob was not serviced", NotSoSimpleJob.wasServiced);
+ SimpleJob.reset();
+ NotSoSimpleJob.reset();
+ Thread.sleep(2000);
+ assertTrue("SimpleJob was not executed", SimpleJob.wasExecuted);
+ assertTrue("NotSoSimpleJob was not executed", NotSoSimpleJob.wasExecuted);
+ assertTrue("NotSoSimpleJob was not serviced", NotSoSimpleJob.wasServiced);
+ }
}
Modified: turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/test/NotSoSimpleJob.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/test/NotSoSimpleJob.java?rev=983452&r1=983451&r2=983452&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/test/NotSoSimpleJob.java (original)
+++ turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/test/NotSoSimpleJob.java Sun Aug 8 17:22:23 2010
@@ -33,9 +33,9 @@ import org.quartz.JobExecutionException;
public class NotSoSimpleJob
implements Job,Serviceable
{
- public static boolean executed = false;
+ public static boolean wasExecuted = false;
- public static boolean serviced = false;
+ public static boolean wasServiced = false;
private ServiceManager manager;
@@ -53,7 +53,15 @@ public class NotSoSimpleJob
public void execute(JobExecutionContext context)
throws JobExecutionException
{
- executed = true;
+ try
+ {
+ Thread.sleep(100);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ wasExecuted = true;
}
/**
@@ -65,6 +73,11 @@ public class NotSoSimpleJob
throws ServiceException
{
this.manager = manager;
- serviced = true;
+ wasServiced = true;
}
+
+ public static void reset()
+ {
+ wasExecuted = false;
+ }
}
Modified: turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/test/SimpleJob.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/test/SimpleJob.java?rev=983452&r1=983451&r2=983452&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/test/SimpleJob.java (original)
+++ turbine/fulcrum/trunk/quartz/src/test/org/apache/fulcrum/quartz/test/SimpleJob.java Sun Aug 8 17:22:23 2010
@@ -24,37 +24,25 @@ import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
- * @author <a href="mailto:leandro@ibnetwork.com.br">Leandro Rodrigo Saad Cruz</a>
- *
+ * A stateless job triggered by Quartz scheduler which keeps track
+ * if it was wasExecuted
*/
public class SimpleJob
- implements Job
+ implements Job
{
- public static boolean executed = false;
-
- public static boolean composed = false;
-
-
- /**
- *
- */
- public SimpleJob()
- {
- super();
- }
+ public static boolean wasExecuted = false;
/**
* @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
*/
public void execute(JobExecutionContext context)
- throws JobExecutionException
+ throws JobExecutionException
{
- executed = true;
+ wasExecuted = true;
}
- public static void reset(){
- executed=false;
- composed=false;
+ public static void reset()
+ {
+ wasExecuted = false;
}
-
}
Added: turbine/fulcrum/trunk/quartz/src/test/quartz.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/src/test/quartz.xml?rev=983452&view=auto
==============================================================================
--- turbine/fulcrum/trunk/quartz/src/test/quartz.xml (added)
+++ turbine/fulcrum/trunk/quartz/src/test/quartz.xml Sun Aug 8 17:22:23 2010
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+ <job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd" version="1.8">
+ <pre-processing-commands>
+ <delete-jobs-in-group>*</delete-jobs-in-group>
+ <!-- clear all jobs in scheduler -->
+ <delete-triggers-in-group>*</delete-triggers-in-group>
+ <!-- clear all triggers in scheduler -->
+ </pre-processing-commands>
+ <processing-directives>
+ <!-- if there are any jobs/trigger in scheduler of same name (as in this file), overwrite them -->
+ <overwrite-existing-data>true</overwrite-existing-data>
+ <!-- if there are any jobs/trigger in scheduler of same name (as in this file), and over-write is false, ignore them rather then generating an error -->
+ <ignore-duplicates>false</ignore-duplicates>
+ </processing-directives>
+ <schedule>
+ <job>
+ <name>simpleJob</name>
+ <group>TURBINE</group>
+ <description>A simple job</description>
+ <job-class>org.apache.fulcrum.quartz.test.SimpleJob</job-class>
+ <job-data-map>
+ <entry>
+ <key>dressing-list</key>
+ <value>ketchup,mayo</value>
+ </entry>
+ <entry>
+ <key>burger-type</key>
+ <value>hotdog</value>
+ </entry>
+ </job-data-map>
+ </job>
+ <job>
+ <name>notSoSimpleJob</name>
+ <group>TURBINE</group>
+ <description>A not so simple job using a service manager</description>
+ <job-class>org.apache.fulcrum.quartz.test.NotSoSimpleJob</job-class>
+ </job>
+ <trigger>
+ <cron>
+ <!-- define a Cron trigger firing every second from now on -->
+ <name>cronTrigger</name>
+ <group>TURBINE</group>
+ <job-name>notSoSimpleJob</job-name>
+ <job-group>TURBINE</job-group>
+ <cron-expression>* * * * * ?</cron-expression>
+ </cron>
+ </trigger>
+ <trigger>
+ <simple>
+ <!-- define a simple trigger firing every second -->
+ <name>simpleTrigger</name>
+ <group>TURBINE</group>
+ <job-name>simpleJob</job-name>
+ <job-group>TURBINE</job-group>
+ <volatility>true</volatility>
+ <start-time>2010-08-01T00:00:00</start-time>
+ <misfire-instruction>MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT</misfire-instruction>
+ <repeat-count>-1</repeat-count>
+ <repeat-interval>1000</repeat-interval>
+ </simple>
+ </trigger>
+ </schedule>
+</job-scheduling-data>
Modified: turbine/fulcrum/trunk/quartz/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/xdocs/changes.xml?rev=983452&r1=983451&r2=983452&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/xdocs/changes.xml (original)
+++ turbine/fulcrum/trunk/quartz/xdocs/changes.xml Sun Aug 8 17:22:23 2010
@@ -25,6 +25,10 @@
<body>
<release version="1.1.0" date="in svn">
+ <action dev="sgoeschl" type="update" date="2010-08-08">
+ Complete rewrite of the service thereby using quartz-1.8.3 and
+ dropping xstream.
+ </action>
<action dev="sgoeschl" type="update" date="2010-03-22">
Improved the M2 build to cut a release candidate
</action>
Added: turbine/fulcrum/trunk/quartz/xdocs/configuration.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/xdocs/configuration.xml?rev=983452&view=auto
==============================================================================
--- turbine/fulcrum/trunk/quartz/xdocs/configuration.xml (added)
+++ turbine/fulcrum/trunk/quartz/xdocs/configuration.xml Sun Aug 8 17:22:23 2010
@@ -0,0 +1,128 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<document>
+ <properties>
+ <title>Fulcrum Quartz Service</title>
+ <author email="siegfried.goeschl@it20one.at">Siegfried Goeschl</author>
+ </properties>
+ <body>
+ <section name="Configuration">
+
+ <subsection name="Role Configuration">
+ <p>
+ First you have to instantiate the Quartz service.
+ </p>
+ <source>
+<![CDATA[<role
+ name="org.apache.fulcrum.quartz.QuartzScheduler"
+ shorthand="quartz"
+ default-class="org.apache.fulcrum.quartz.impl.QuartzSchedulerImpl"
+/>
+ ]]></source>
+ </subsection>
+
+ <subsection name="Component Configuration">
+ <table>
+ <tr>
+ <th>Item</th>
+ <th>Datatype</th>
+ <th>Cardinality</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>configuration</td>
+ <td>Complex</td>
+ <td>[0|1]</td>
+ <td>
+ Contains the Quartz configuration either as property file or
+ a set of properties.
+ </td>
+ </tr>
+ <tr>
+ <td>configuration/propertyFile</td>
+ <td>String</td>
+ <td>[0|1]</td>
+ <td>
+ Contains the location of a Quartz configuration file. The configuration
+ is loaded from the file system or from the classpath.
+ </td>
+ </tr>
+ <tr>
+ <td>configuration/properties</td>
+ <td>Complex</td>
+ <td>[0|1]</td>
+ <td>
+ Contains a list of properties used for configuring Quartz
+ </td>
+ </tr>
+ <tr>
+ <td>configuration/properties/parameter</td>
+ <td>String</td>
+ <td>Simple</td>
+ <td>
+ Contains a single configuration parameter consisting of 'name'
+ and 'value' attribute.
+ </td>
+ </tr>
+ </table>
+ </subsection>
+
+ <subsection name="Component Configuration Example 1">
+ <p>
+ A simple component configuration based on the XML configuration file
+ </p>
+ <source><![CDATA[
+<quartz>
+ <configuration>
+ <properties>
+ <parameter name="org.quartz.scheduler.instanceName" value="TestScheduler"/>
+ <parameter name="org.quartz.scheduler.instanceId " value="AUTO"/>
+ <parameter name="org.quartz.scheduler.skipUpdateCheck" value="true"/>
+ <parameter name="org.quartz.threadPool.class" value="org.quartz.simpl.SimpleThreadPool"/>
+ <parameter name="org.quartz.threadPool.threadCount" value="3"/>
+ <parameter name="org.quartz.threadPool.threadPriority" value="5"/>
+ <parameter name="org.quartz.jobStore.misfireThreshold" value="60000"/>
+ <parameter name="org.quartz.jobStore.class" value="org.quartz.simpl.RAMJobStore"/>
+ <parameter name="org.quartz.plugin.jobInitializer.class" value="org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin"/>
+ <parameter name="org.quartz.plugin.jobInitializer.fileNames" value="./src/test/quartz.xml"/>
+ <parameter name="org.quartz.plugin.jobInitializer.failOnFileNotFound" value="true"/>
+ <parameter name="org.quartz.plugin.jobInitializer.scanInterval" value="120"/>
+ <parameter name="org.quartz.plugin.jobInitializer.wrapInUserTransaction" value="false"/>
+ </properties>
+ </configuration>
+</quartz>
+ ]]></source>
+ </subsection>
+
+ <subsection name="Component Configuration Example 2">
+ <p>
+ A component configuration using an external property file
+ </p>
+ <source><![CDATA[
+<quartz>
+ <configuration>
+ <propertyFile>./src/test/quartz.properties</propertyFile>
+ </configuration>
+</quartz>
+ ]]></source>
+ </subsection>
+ </section>
+ </body>
+</document>
Added: turbine/fulcrum/trunk/quartz/xdocs/cronsamples.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/xdocs/cronsamples.xml?rev=983452&view=auto
==============================================================================
--- turbine/fulcrum/trunk/quartz/xdocs/cronsamples.xml (added)
+++ turbine/fulcrum/trunk/quartz/xdocs/cronsamples.xml Sun Aug 8 17:22:23 2010
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<document>
+ <properties>
+ <title>Fulcrum Quartz Service</title>
+ <author email="siegfried.goeschl@it20one.at">Siegfried Goeschl</author>
+ </properties>
+ <body>
+ <section name="Cron Expression Samples">
+ <p>
+ Using cron expressions allow a great deal of flexibility but are
+ sometimes tricky to write. A detailed description about the cron
+ expression supported by Quartz can be found
+ <a href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html">here</a>.
+ </p>
+ <table>
+ <tr>
+ <th>Description</th>
+ <th>Cron Expression</th>
+ </tr>
+ <tr>
+ <td>Fire every second</td>
+ <td>* * * * * ?</td>
+ </tr>
+ <tr>
+ <td>Fire every minute</td>
+ <td>0 * * * * ?</td>
+ </tr>
+ <tr>
+ <td>Fire every five minutes</td>
+ <td>"0 0/5 * * * ?" </td>
+ </tr>
+ <tr>
+ <td>Fire 23:00 every weekday night</td>
+ <td>0 0 23 ? * MON-FRI</td>
+ </tr>
+ </table>
+ </section>
+ </body>
+</document>
Modified: turbine/fulcrum/trunk/quartz/xdocs/index.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/quartz/xdocs/index.xml?rev=983452&r1=983451&r2=983452&view=diff
==============================================================================
--- turbine/fulcrum/trunk/quartz/xdocs/index.xml (original)
+++ turbine/fulcrum/trunk/quartz/xdocs/index.xml Sun Aug 8 17:22:23 2010
@@ -30,102 +30,8 @@
<section name="Overview">
<p>
- This Service functions as a wrapper around the Quartz Scheduler
- </p>
-
- <p>
- It is written for use in any Avalon compatible container.
- </p>
- </section>
-
-<section name="Configuration">
-
- <p>
- First, here is the role configuration.
- </p>
-
- <source>
- <![CDATA[
- <role
- name="org.apache.fulcrum.quartz.QuartzService"
- shorthand="quartz"
- default-class="org.apache.fulcrum.quartz.DefaultQuartzService"/>
- ]]>
- </source>
-
- <p>
- Now comes the job configuration:
- </p>
-
- <source>
- <![CDATA[
- <quartz>
- <globalJobListener className="org.apache.fulcrum.quartz.listener.FooListener" />
- <scheduled jobName="simpleJob" jobGroup="DEFAULT_GROUP" triggerName="cron" triggerGroup="OTHER_GROUP"/>
- <jobDetails>
- <list>
- <org.quartz.JobDetail>
- <name>simpleJob</name>
- <group>DEFAULT_GROUP</group>
- <jobClass>org.apache.fulcrum.quartz.test.SimpleJob</jobClass>
- <volatility>false</volatility>
- <durability>false</durability>
- <shouldRecover>false</shouldRecover>
- <jobListeners/>
- </org.quartz.JobDetail>
- <org.quartz.JobDetail>
- <name>notSoSimpleJob</name>
- <group>DEFAULT_GROUP</group>
- <jobClass>org.apache.fulcrum.quartz.test.NotSoSimpleJob</jobClass>
- <volatility>false</volatility>
- <durability>false</durability>
- <shouldRecover>false</shouldRecover>
- <jobListeners/>
- </org.quartz.JobDetail>
- </list>
- </jobDetails>
- <triggers>
- <list>
- <org.quartz.CronTrigger>
- <startTime>2005-10-20 11:10:45.0 EDT</startTime>
- <misfireInstruction>0</misfireInstruction>
- <volatility>false</volatility>
- <group>OTHER_GROUP</group>
- <jobGroup>DEFAULT_GROUP</jobGroup>
- <jobName>notSoSimpleJob</jobName>
- <name>cron</name>
- <triggerListeners/>
- <cronEx serialization="custom">
- <org.quartz.CronExpression>
- <default>
- <cronExpression>0 0 12 * * ?</cronExpression>
- </default>
- </org.quartz.CronExpression>
- </cronEx>
- </org.quartz.CronTrigger>
- <org.quartz.SimpleTrigger>
- <name>simpleTrigger</name>
- <group>DEFAULT_GROUP</group>
- <description>test</description>
- </org.quartz.SimpleTrigger>
- </list>
- </triggers>
- </quartz>
- ]]>
- </source>
-
- <p>
- <b>Note:</b> The section for CronTrigger has to date varied with Quartz
- releases (the one above is suitable for Quartz 1.5.2). The format depends
- on how <a href="http://xstream.codehaus.org/">XStream</a> processes the
- <a href="http://www.opensymphony.com/quartz/api/serialized-form.html#org.quartz.CronTrigger">
- serialized form</a> of
- <a href="http://www.opensymphony.com/quartz/api/org/quartz/CronTrigger.html">CronTrigger</a>.
- </p>
-
- <p>
- Refer to the <a href="http://www.opensymphony.com/quartz/api/">Quartz JavaDoc</a>
- for details of the serialized form of the other configuration elements.
+ This Service functions as a wrapper around the <a href="http://www.quartz-scheduler.org/">
+ Quartz Scheduler</a>. It is written for use in any Avalon compatible container.
</p>
</section>
@@ -133,24 +39,25 @@
<section name="Usage">
<p>
- Scheduled tasks are quite straightforward to create. The only requirement
- is that the interface
- <a href="http://www.opensymphony.com/quartz/api/org/quartz/Job.html">org.quartz.Job</a>
- be implemented. This requires just that one method be defined, execute(), whose
- <a href="http://www.opensymphony.com/quartz/api/org/quartz/JobExecutionContext.html">
- org.quartz.JobExecutionContext</a> argument provides you with details of the
- execution context when the task is triggered.
+ Scheduled jobs can be either created programmatically (using the Quartz API) or by
+ using an XML configuration based on the 'XMLSchedulingDataProcessorPlugin'. A
+ scheduled job consists of a class implementing the interface
+ <a href="http://www.quartz-scheduler.org/docs/api/1.8.1/org/quartz/Job.html">org.quartz.Job</a>
+ This requires just that one method be defined, execute(), whose
+ <a href="http://www.opensymphony.com/quartz/api/org/quartz/JobExecutionContext.html">
+ org.quartz.JobExecutionContext</a> argument provides you with details of the
+ execution context when the task is triggered.
</p>
<source>
- <![CDATA[
+<![CDATA[
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class SimpleJob implements Job
{
- public static boolean executed = false;
+ public static boolean executed = false;
public SimpleJob()
{
@@ -162,15 +69,49 @@ public class SimpleJob implements Job
{
executed = true;
}
-}
- ]]>
+}]]>
</source>
- <p>
- An additional example can be found in the unit tests for this component.
- </p>
-
+ <p>
+ In order to invoke the SimpleJob we have to tell Quartz when to invoke
+ the 'execute' method. In this case we create a CRON trigger firing every
+ second to invoke SimpleJob#execute() on a newly created instance. Please
+ note that we definea set of parameters using the <job-data-map>
+ which are available using 'JobExecutionContext'.
+ </p>
+
+ <source>
+<![CDATA[
+<schedule>
+ <job>
+ <name>simpleJob</name>
+ <group>TURBINE</group>
+ <description>A simple job</description>
+ <job-class>org.apache.fulcrum.quartz.test.SimpleJob</job-class>
+ <job-data-map>
+ <entry>
+ <key>dressing-list</key>
+ <value>ketchup,mayo</value>
+ </entry>
+ <entry>
+ <key>burger-type</key>
+ <value>hotdog</value>
+ </entry>
+ </job-data-map>
+ </job>
+ <trigger>
+ <cron>
+ <!-- define a Cron trigger firing every second from now on -->
+ <name>cronTrigger</name>
+ <group>TURBINE</group>
+ <job-name>simpleJob</job-name>
+ <job-group>TURBINE</job-group>
+ <cron-expression>* * * * * ?</cron-expression>
+ </cron>
+ </trigger>
+</schedule>
+]]>
+ </source>
</section>
-
</body>
</document>