You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by th...@apache.org on 2002/06/07 13:41:35 UTC
cvs commit: jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/examplejobs JobOne.java JobTwo.java
thorhauer 2002/06/07 04:41:35
Added: src/java/org/apache/stratum/scheduler JobConfig.java
JobStoreConfig.java LoggerConfig.java
Scheduler.java SchedulerConfig.java
ThreadPoolConfig.java TriggerConfig.java
src/java/org/apache/stratum/scheduler/examplejobs
JobOne.java JobTwo.java
Log:
adding Quartz scheduler component
Revision Changes Path
1.1 jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/JobConfig.java
Index: JobConfig.java
===================================================================
package org.apache.stratum.scheduler;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/**
* This bean represents the settings used to create a JobDetail
* object for use in the Quartz scheduler.
*
* @author <a href="mailto:john@zenplex.com">John Thorhauer</a>
* @version $Id: JobConfig.java,v 1.1 2002/06/07 11:41:34 thorhauer Exp $
*/
public class JobConfig
{
/**
* The name that the Job will use.
*/
private String name;
/**
* The group the job will be associated with
*/
private String group;
/**
* The full package/class name for the Job that will run
*/
private String className;
/**
* Default contructor
*/
public JobConfig()
{
}
/**
* This is the name by which the job will
* be identified in Quartz
*
* @param name of the Job
*/
public void setname(String s)
{
this.name = s;
}
/**
* The name of the job
*
* @return name of the Job
*/
public String getName()
{
return this.name;
}
/**
* This is the group with which the job will
* be associated in Quartz.
*
* @param name of the Group
*/
public void setGroup(String s)
{
this.group = s;
}
/**
* The group name that this job will be
* associated with
*
* @return the group name
*/
public String getGroup()
{
return this.group;
}
/**
* This is the full package/class name of the
* Job that Quartz will run
*/
public void setClassName(String s)
{
this.className = s;
}
/**
*@return the full package/class name
*/
public String getClassName()
{
return this.className;
}
}
1.1 jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/JobStoreConfig.java
Index: JobStoreConfig.java
===================================================================
package org.apache.stratum.scheduler;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/**
* This bean represents the settings used to assign jobstore
* properties for use in the Quartz scheduler.
*
* @author <a href="mailto:john@zenplex.com">John Thorhauer</a>
* @version $Id: JobStoreConfig.java,v 1.1 2002/06/07 11:41:34 thorhauer Exp $
*/
public class JobStoreConfig
{
/**
* The loggername used by the Quartz jobstore
*/
private String loggerName;
/**
* The classname used by the Quartz jobstore
*/
private String className;
/**
* Default contructor
*/
public JobStoreConfig()
{
}
/**
* This is the reference name of the logger
* that has been registered with Quartz that
* will be used by the Quartz jobstore.
*
* @param logger name
*/
public void setLoggerName(String s)
{
this.loggerName = s;
}
/**
* @return the name of the logger
* for the jobstore
*/
public String getLoggerName()
{
return this.loggerName;
}
/**
* This is the full package/class name of the
* class used for the Quartz jobstore.
*
* @param the full package/class name used for the jobstore
*/
public void setClassName(String s)
{
this.className = s;
}
/**
* @return the full package/class name used for the jobstore
*/
public String getClassName()
{
return this.className;
}
}
1.1 jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/LoggerConfig.java
Index: LoggerConfig.java
===================================================================
package org.apache.stratum.scheduler;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/**
* This bean represents the settings used to assign logger
* properties for use in the Quartz scheduler.
*
* @author <a href="mailto:john@zenplex.com">John Thorhauer</a>
* @version $Id: LoggerConfig.java,v 1.1 2002/06/07 11:41:34 thorhauer Exp $
*/
public class LoggerConfig
{
/**
* The name of the logger.
*/
private String name;
/**
* The classname the is the Quartz logger.
*/
private String className;
/**
* The priority for the logger.
*/
private String priority;
/**
* The output file for the Quartz logger.
*/
private String outputFile;
/**
* The category for the Quartz logger.
*/
private String category;
/**
* Default contructor
*/
public LoggerConfig()
{
}
/**
* This is the name of the logger
* that has will registered with Quartz.
*
* @param logger name
*/
public void setName(String s)
{
this.name = s;
}
/**
* @return the name of the logger
*/
public String getName()
{
return this.name;
}
/**
* This is the full package/class name of the
* class used for the Quartz logger.
*
* @param the full package/class name used for the logger
*/
public void setClassName(String s)
{
this.className = s;
}
/**
* @return the full package/class name used for the logger
*/
public String getClassName()
{
return this.className;
}
/**
* The priority of the logger
*
* @param priority
*/
public void setPriority(String s)
{
this.priority = s;
}
/**
* @return the priority of the logger
*/
public String getPriority()
{
return this.priority;
}
/**
* The outputFile of the logger
*
* @param outputFile
*/
public void setOutputFile(String s)
{
this.outputFile = s;
}
/**
* @return the outputFile of the logger
*/
public String getOutputFile()
{
return this.outputFile;
}
/**
* The category of the logger
*
* @param category
*/
public void setCategory(String s)
{
this.category = s;
}
/**
* @return the category of the logger
*/
public String getCategory()
{
return this.category;
}
}
1.1 jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/Scheduler.java
Index: Scheduler.java
===================================================================
package org.apache.stratum.scheduler;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Vector;
import java.util.Date;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.ConfigurationConverter;
import org.apache.stratum.lifecycle.Configurable;
import org.apache.stratum.lifecycle.Startable;
import org.apache.commons.betwixt.io.BeanReader;
import org.apache.commons.betwixt.XMLIntrospector;
import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper;
import org.apache.commons.betwixt.strategy.DefaultPluralStemmer;
import org.apache.commons.lang.exception.NestableException;
import org.quartz.SchedulerException;
import org.quartz.JobDetail;
import org.quartz.CronTrigger;
import org.quartz.impl.StdSchedulerFactory;
import org.quartz.impl.StdScheduler;
import org.apache.stratum.scheduler.examplejobs.*;
/**
* This class is the Scheduler component that implements a
* Quartz scheduler.
*
* @author <a href="mailto:john@zenplex.com">John Thorhauer</a>
* @version $Id: Scheduler.java,v 1.1 2002/06/07 11:41:34 thorhauer Exp $
*/
public class Scheduler
implements Configurable, Startable
{
private static String confLocation = "/projects/jakarta-turbine-stratum/src/test-conf/Scheduler.properties";
private StdSchedulerFactory schedulerFactory ;
protected StdScheduler scheduler;
/**
* Just a command line test tool to start the scheduler from
* the command line. If looks for the properties file in the
* following location:<p/>
* /projects/jakarta-turbine-stratum/src/test-conf/Scheduler.properties
*
*/
public static void main (String args[])
throws Exception
{
Scheduler sched = new Scheduler();
PropertiesConfiguration conf = new PropertiesConfiguration(confLocation);
sched.configure(conf);
sched.start();
}
/**
* start the scheduler.
*/
public void start()
throws Exception
{
scheduler.start();
}
/**
* start the scheduler.
*/
public void stop()
throws Exception
{
scheduler.shutdown();
}
/**
* Configure the Scheduler
*/
public void configure(Configuration configuration)
throws NestableException
{
String xmlLocation = configuration.getString("scheduler.config.location");
try
{
// get scheduler factory and initialize it with
// settings from the .xml file
SchedulerConfig schedConfig = getSchedulerConfig(xmlLocation);
Properties factoryProps;
try
{
factoryProps = getFactoryProps(schedConfig);
}
catch (NullPointerException ex)
{
System.out.println("Error loading properties to initialize" +
" Scheduler Factory. Please make sure the following" +
" elements are properly filled out in the" +
" Scheduler .xml config file:\n" +
" <instanceName></instanceName>\n" +
" <loggerName></loggerName>\n" +
" <threadPoolConfig>\n" +
" <className></className>\n" +
" <threadCount></threadCount>\n" +
" <threadPriority></threadPriority>\n" +
" <loggerName></loggerName>\n" +
" </threadPoolConfig>\n" +
" <jobStoreConfig>\n" +
" <className></className>\n" +
" <loggerName></loggerName>\n" +
" </jobStoreConfig>");
return;
}
schedulerFactory = new StdSchedulerFactory();
schedulerFactory.initialize(factoryProps);
scheduler = (StdScheduler)schedulerFactory.getScheduler();
List jobConfigs = schedConfig.getJobConfigs();
if (!jobConfigs.isEmpty())
{
for (int i=0;i<jobConfigs.size();i++)
{
JobConfig jobConf = (JobConfig)jobConfigs.get(i);
String jobName = (String)jobConf.getName();
String jobPrefix = "scheduler.job." + jobName ;
String jobGroup = jobConf.getGroup();
String jobClassName = jobConf.getClassName();
JobDetail job = new JobDetail(jobName, jobGroup,
Class.forName(jobClassName));
//get the trigger for this job if it exists
TriggerConfig triggerConf =
getTriggerConfig(schedConfig, job.getName());
if (triggerConf != null)
{
job.getName();
String triggerGroup = triggerConf.getGroup();
String triggerName = triggerConf.getName();
String cronExpression =
triggerConf.getSeconds() + " " +
triggerConf.getMinutes() + " " +
triggerConf.getHours() + " " +
triggerConf.getDayOfMonth() + " " +
triggerConf.getMonth() + " " +
triggerConf.getDayOfWeek();
CronTrigger cronTrigger = new CronTrigger(triggerName,
triggerGroup,
jobName,
jobGroup,
cronExpression);
scheduler.scheduleJob(job, cronTrigger);
triggerConf = null;
cronTrigger = null;
}
}
}
}
catch (SchedulerException ex)
{
System.out.println("Error Initializing Scheduler: " +
ex.toString() +
"\n");
ex.printStackTrace();
}
catch (ClassNotFoundException ex)
{
System.out.println("Error Loading Class: " +
ex.toString() +
"\n");
ex.printStackTrace();
}
catch (Exception ex)
{
System.out.println("Error: " +
ex.toString() +
"\n");
ex.printStackTrace();
}
}
/**
*@param Scheduler Config
*/
private Properties getFactoryProps(SchedulerConfig schdConf)
{
Properties props = new Properties();
props.put("org.quartz.scheduler.instanceName",schdConf.getInstanceName());
props.put("org.quartz.scheduler.logger", schdConf.getLoggerName());
// configure loggers
List loggers = schdConf.getLoggerConfigs();
for (int i = 0; i < loggers.size(); i++)
{
LoggerConfig logger = (LoggerConfig)loggers.get(i);
String loggerName = "org.quartz.logger." + logger.getName();
props.put( loggerName + ".class", logger.getClassName());
props.put( loggerName + ".loggingPriority", logger.getPriority());
props.put( loggerName + ".outputFile", logger.getOutputFile());
if (logger.getCategory() != null)
{
props.put( loggerName + ".categoryName", logger.getCategory());
}
}
ThreadPoolConfig threadPool = schdConf.getThreadPoolConfig();
props.put("org.quartz.threadPool.class",
threadPool.getClassName());
props.put("org.quartz.threadPool.threadCount",
threadPool.getThreadCount());
props.put("org.quartz.threadPool.threadPriority",
threadPool.getThreadPriority());
props.put("org.quartz.threadPool.logger",
threadPool.getLoggerName());
JobStoreConfig jobStore = schdConf.getJobStoreConfig();
props.put("org.quartz.jobStore.class",
jobStore.getClassName());
props.put("org.quartz.jobStore.logger",
jobStore.getLoggerName());
return props;
}
/**
* Loads the SchedulerConfig object from the xml file
*@param location of the xml file
*/
private SchedulerConfig getSchedulerConfig(String xmlLocation)
throws Exception
{
FileInputStream in = new FileInputStream(xmlLocation);
// create a new BeanReader
BeanReader reader = createBeanReader();
SchedulerConfig schedConf = (SchedulerConfig) reader.parse(in);
return schedConf;
}
/**
* Creates a beanreader
*
* @return beanreader
*
*/
private BeanReader createBeanReader() throws Exception {
BeanReader reader = new BeanReader();
reader.setXMLIntrospector( createXMLIntrospector() );
reader.registerBeanClass( SchedulerConfig.class );
return reader;
}
/**
* Loads Xml Introspector with needed values
*
* @return introspector
*/
private XMLIntrospector createXMLIntrospector() {
XMLIntrospector introspector = new XMLIntrospector();
// set elements for attributes to true
introspector.setAttributesForPrimitives(false);
// wrap collections in an XML element
//introspector.setWrapCollectionsInElement(true);
// turn bean elements first letter into lower case
introspector.setNameMapper( new DecapitalizeNameMapper() );
introspector.setPluralStemmer( new DefaultPluralStemmer() );
return introspector;
}
private TriggerConfig getTriggerConfig(SchedulerConfig schedConf,
String jobName)
{
TriggerConfig trig = null;
List triggers = schedConf.getTriggerConfigs();
for (int i = 0; i < triggers.size(); i++)
{
TriggerConfig tmpTrig = (TriggerConfig)triggers.get(i);
if (tmpTrig.getJobName().equals(jobName))
{
trig = tmpTrig;
return trig;
}
}
return trig;
}
}
1.1 jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/SchedulerConfig.java
Index: SchedulerConfig.java
===================================================================
package org.apache.stratum.scheduler;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
//java classes
import java.util.List;
import java.util.ArrayList;
import org.apache.commons.betwixt.io.BeanReader;
/**
* This bean represents all of the configuration information
* needed to load the Quartz scheduler.
*
* @author <a href="mailto:john@thorhauer.com">John Thorhauer</a>
* @version $Id: SchedulerConfig.java,v 1.1 2002/06/07 11:41:34 thorhauer Exp $
*/
public class SchedulerConfig
{
/**
* Scheduler reference name
*/
private String instanceName;
/**
* Scheduler logger name
*/
private String loggerName;
/**
* List of job configurations
*/
private List jobConfigs;
/**
* List of loggers
*/
private List loggerConfigs;
/**
* List of triggers
*/
private List triggerConfigs;
/**
* The jobstore for the Scheduler
*/
private JobStoreConfig jobStoreConfig;
/**
* The threadpool for the Scheduler
*/
private ThreadPoolConfig threadPoolConfig;
/**
* Default contructor
*/
public SchedulerConfig()
{
jobConfigs = new ArrayList();
loggerConfigs = new ArrayList();
triggerConfigs = new ArrayList();
}
/**
* Set the reference name given to the scheduler
* that is loaded into Quartz
*
* @param instanceName
*/
public void setInstanceName(String s)
{
this.instanceName = s;
}
/**
* Return the reference name of the scheduler
*
* @return instance name
*/
public String getInstanceName()
{
return this.instanceName;
}
/**
* Set the logger name for the scheduler
*
* @param loggerName
*/
public void setLoggerName(String s)
{
this.loggerName = s;
}
/**
* Return the logger name
*
* @return logger name
*/
public String getLoggerName()
{
return this.loggerName;
}
/**
* Add a Job Configuraton to Scheduler Config
*
* @param jobConfig Job configuration
*/
public void addJobConfig(JobConfig jconf)
{
jobConfigs.add(jconf);
}
/**
* Return a list of Job Configurations
*
* @return List of job configs
*/
public List getJobConfigs()
{
return this.jobConfigs;
}
/**
* Add a logger Scheduler Config
*
* @param logger
*/
public void addLoggerConfig(LoggerConfig logger)
{
loggerConfigs.add(logger);
}
/**
* Return a list of loggers
*
* @return List of job configs
*/
public List getLoggerConfigs()
{
return this.loggerConfigs;
}
/**
* Add a trigger to Scheduler Config
*
* @param trigger
*/
public void addTriggerConfig(TriggerConfig trigger)
{
triggerConfigs.add(trigger);
}
/**
* Return a list of triggers
*
* @return List of triggers
*/
public List getTriggerConfigs()
{
return this.triggerConfigs;
}
/**
* Set the threadPool for the scheduler to use
*
* @param threadPool
*/
public void setThreadPoolConfig(ThreadPoolConfig thdPool) {
this.threadPoolConfig = thdPool;
}
/**
* Return the the ThreadPool object
*
* @return threadPool
*/
public ThreadPoolConfig getThreadPoolConfig() {
return this.threadPoolConfig;
}
/**
* Set the jobstore for the scheduler to use
*
* @param jobstore
*/
public void setJobStoreConfig(JobStoreConfig jobStr) {
this.jobStoreConfig = jobStr;
}
/**
* Return the the JobStore object
*
* @return jobStore
*/
public JobStoreConfig getJobStoreConfig() {
return this.jobStoreConfig;
}
}
1.1 jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/ThreadPoolConfig.java
Index: ThreadPoolConfig.java
===================================================================
package org.apache.stratum.scheduler;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/**
* This bean represents the settings used to assign thread pool
* properties for use in the Quartz scheduler.
*
* @author <a href="mailto:john@zenplex.com">John Thorhauer</a>
* @version $Id: ThreadPoolConfig.java,v 1.1 2002/06/07 11:41:34 thorhauer Exp $
*/
public class ThreadPoolConfig
{
/**
* The loggername used by the Quartz threadpool
*/
private String loggerName;
/**
* The classname used by the Quartz threadpool
*/
private String className;
/**
* The threadcount used by the Quartz threadpool
*/
private String threadCount;
/**
* The thread priority used by the Quartz threadpool
*/
private String threadPriority;
/**
* Default contructor
*/
public ThreadPoolConfig()
{
}
/**
* This is the reference name of the logger
* that has been registered with Quartz that
* will be used by the Quartz threadpool.
*
* @param logger name
*/
public void setLoggerName(String s)
{
this.loggerName = s;
}
/**
* @return the name of the logger for the threadpool
*/
public String getLoggerName()
{
return this.loggerName;
}
/**
* This is the full package/class name of the
* class used for the Quartz threadpool.
*
* @param the full package/class name used for the threadpool
*/
public void setClassName(String s)
{
this.className = s;
}
/**
* @return the full package/class name used for the threadpool
*/
public String getClassName()
{
return this.className;
}
/**
* This is the thread count used for the Quartz threadpool.
*
* @param the thread count used for the Quartz threadpool.
*/
public void setThreadCount(String s)
{
this.threadCount = s;
}
/**
* @return the thread count used for the Quartz threadpool.
*/
public String getThreadCount()
{
return this.threadCount;
}
/**
* This is the thread priority used for the Quartz threadpool.
*
* @param the thread priority for the Quartz threadpool.
*/
public void setThreadPriority(String s)
{
this.threadPriority = s;
}
/**
* @return the thread priority used for the Quartz threadpool.
*/
public String getThreadPriority()
{
return this.threadPriority;
}
}
1.1 jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/TriggerConfig.java
Index: TriggerConfig.java
===================================================================
package org.apache.stratum.scheduler;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/**
* This bean represents the settings used to create a Trigger
* object for use in the Quartz scheduler
*
*
* <pre>
* This trigger is a Quartz trigger that uses a "Cron-Expression" which
* is a string comprised of 6 fields separated by white space. The 6
* fields are as follows:
*
* Field Name Allowed Values Allowed Special Characters
* seconds 0-59 , - * /
* minutes 0-59 , - * /
* hours 0-23 , - * /
* dayOfMonth 0-31 , - * ? / L C
* month 1-12 or JAN-DEC , - * /
* dayOfWeek 1-7 or SUN-SAT , - * ? / L C
*
* -The '*' character is used to specify all values. For example, "*" in
* the minute field means "every minute".
*
* -The '?' character is allowed for the day-of-month and day-of-week
* fields. It is used to specify 'no specific value'. This is useful when
* you need to specify something in one of the two fileds, but not the
* other. See the examples below for clarification.
*
* -The '-' character is used to specify ranges For example "10-12" in
* the hour field means "the hours 10, 11 and 12".
*
* -The ',' character is used to specify additional values. For example
* "MON,WED,FRI" in the day-of-week field means "the days Monday,
* Wednesday, and Friday".
*
* -The '/' character is used to specify increments. For example "0/15"
* in the seconds field means "the seconds 0, 15, 30, and 45". And "5/15"
* in the seconds field means "the seconds 5, 20, 35, and 50". You can \
* also specify '/' after the '*' character - in this case '*' is
* equivalent to having '0' before the '/'.
*
* -The 'L' character is allowed for the day-of-month and day-of-week
* fields. This character is short-hand for "last", but it has different
* meaning in each of the two fields. For example, the value "L" in the
* day-of-month field means "the last day of the month" - day 31 for
* January, day 28 for February on non-leap years. If used in the
* day-of-week field by itself, it simply means "7" or "SAT". But if
* used in the day-of-week field after another value, it means "the
* last xxx day of the month" - for example "6L" or "FRIL" both mean
* "the last friday of the month". When using the 'L' option, it is
* important not to specify lists, or ranges of values, as you'll get
* confusing results.
*
* -The 'C' character is allowed for the day-of-month and day-of-week
* fields. This character is short-hand for "calendar". This means values
* are calculated against the associated calendar, if any. If no calendar
* is associated, then it is equivalent to having an all-inclusive
* calendar. A value of "5C" in the day-of-month field means "the first
* day included by the calendar on or after the 5th". A value of "1C" in
* the day-of-week field means "the first day included by the calendar on
* or after sunday".
* </pre>
*
* @author <a href="mailto:john@zenplex.com">John Thorhauer</a>
* @version $Id: TriggerConfig.java,v 1.1 2002/06/07 11:41:34 thorhauer Exp $
*/
public class TriggerConfig
{
/**
* The type of trigger. Currently the only type supported
* is the cron.
*/
private String type;
/**
* The name of the trigger
*/
private String name;
/**
* The name of the job to associate with this
* this trigger.
*/
private String jobName;
/**
* The name of the group to associate this trigger with
*/
private String group;
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* seconds 0-59 , - * /
* </pre>
*/
private String seconds = "*";
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* minutes 0-59 , - * /
* </pre>
*/
private String minutes = "*";
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* hours 0-23 , - * /
* </pre>
*/
private String hours = "*";
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* dayOfMonth 0-31 , - * ? / L C
* </pre>
*/
private String dayOfMonth = "*";
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* month 1-12 or JAN-DEC , - * /
* </pre>
*/
private String month = "*";
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* dayOfWeek 1-7 or SUN-SAT , - * ? / L C
* </pre>
*/
private String dayOfWeek = "*";
/**
* Default contructor
*/
public TriggerConfig()
{
}
/**
* This is the name of the trigger
*
* @param trigger name
*/
public void setName(String s)
{
this.name = s;
}
/**
* @return the name of the trigger
*/
public String getName()
{
return this.name;
}
/**
* This is the name of group that the trigger
* is associated with
*
* @param group name
*/
public void setGroup(String s)
{
this.group = s;
}
/**
* @return the group name
*/
public String getGroup()
{
return this.group;
}
/**
* This is the name of job that the trigger
* is associated with
*
* @param job name
*/
public void setJobName(String s)
{
this.jobName = s;
}
/**
* @return the job name
*/
public String getJobName()
{
return this.jobName;
}
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* seconds 0-59 , - * /
* </pre>
*
* @param seconds
*/
public void setSeconds(String s)
{
this.seconds = s;
}
/**
* @return seconds
*/
public String getSeconds()
{
return this.seconds;
}
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* minutes 0-59 , - * /
* </pre>
*
* @param minutes
*/
public void setMinutes(String s)
{
this.minutes = s;
}
/**
*@return mintutes
*/
public String getMinutes()
{
return this.minutes;
}
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* hours 0-23 , - * /
* </pre>
*
* @param hours
*/
public void setHours(String s)
{
this.hours = s;
}
/**
* @return hours
*/
public String getHours()
{
return this.hours;
}
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* dayOfMonth 0-31 , - * ? / L C
* </pre>
*
* @param day of month
*/
public void setDayOfMonth(String s)
{
this.dayOfMonth = s;
}
/**
*@return day of month
*/
public String getDayOfMonth()
{
return this.dayOfMonth;
}
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* month 1-12 or JAN-DEC , - * /
* </pre>
*
*@param month
*/
public void setMonth(String s)
{
this.month = s;
}
/**
*@return month
*/
public String getMonth()
{
return this.month;
}
/**
* <pre>
* Field Name Allowed Values Allowed Special Characters
* dayOfWeek 1-7 or SUN-SAT , - * ? / L C
* </pre>
*
* @param day of the week
*/
public void setDayOfWeek(String s)
{
this.dayOfWeek = s;
}
/**
*@return day of the week
*/
public String getDayOfWeek()
{
return this.dayOfWeek;
}
}
1.1 jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/examplejobs/JobOne.java
Index: JobOne.java
===================================================================
package org.apache.stratum.scheduler.examplejobs;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import org.quartz.*;
import org.quartz.simpl.*;
import java.util.Date;
/**
* <p>A dumb implementation of Job, for unittesting purposes.</p>
*
* @author James House
*/
public class JobOne implements Job {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Constructors.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
public JobOne()
{
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Interface.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* <p>Called by the <code>{@link org.quartz.Scheduler}</code> when a
* <code>{@link org.quartz.Trigger}</code> fires that is associated with the
* <code>Job</code>.</p>
*
* @throws JobExecutionException if there is an exception while executing
* the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException
{
System.out.println(" --- Testing Scheduler Component\n --- "
+ context.getJobDetail().getFullName() + " executed.[" + new Date() + "]");
}
}
1.1 jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/examplejobs/JobTwo.java
Index: JobTwo.java
===================================================================
package org.apache.stratum.scheduler.examplejobs;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Turbine" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import org.quartz.*;
import org.quartz.simpl.*;
import java.util.Date;
/**
* <p>A dumb implementation of Job, for unittesting purposes.</p>
*
* @author James House
*/
public class JobTwo implements Job {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Constructors.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
public JobTwo()
{
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Interface.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* <p>Called by the <code>{@link org.quartz.Scheduler}</code> when a
* <code>{@link org.quartz.Trigger}</code> fires that is associated with the
* <code>Job</code>.</p>
*
* @throws JobExecutionException if there is an exception while executing
* the job.
*/
public void execute(JobExecutionContext context)
throws JobExecutionException
{
System.err.println(" --- Testing Scheduler Component\n --- "
+ context.getJobDetail().getFullName() + " executed.[" + new Date() + "]");
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit:
jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/examplejobs
JobOne.java JobTwo.java
Posted by John Thorhauer <jo...@zenplex.com>.
On Mon, 2002-06-10 at 22:43, Daniel Rall wrote:
>
> -1 on System.out error logging. If you really feel that you need
> System logging, please send error conditions to System.err.
>
Will do.
John
--
********************************
** John Thorhauer
** john@zenplex.com
** take a look at:
** http://tambora.zenplex.org
** http://www.zenplex.org
** http://www.zenplex.com
********************************
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-turbine-stratum/src/java/org/apache/stratum/scheduler/examplejobs JobOne.java JobTwo.java
Posted by Daniel Rall <dl...@finemaltcoding.com>.
thorhauer@apache.org writes:
> catch (SchedulerException ex)
> {
> System.out.println("Error Initializing Scheduler: " +
> ex.toString() +
> "\n");
> ex.printStackTrace();
> }
> catch (ClassNotFoundException ex)
> {
> System.out.println("Error Loading Class: " +
> ex.toString() +
> "\n");
> ex.printStackTrace();
> }
> catch (Exception ex)
> {
> System.out.println("Error: " +
> ex.toString() +
> "\n");
> ex.printStackTrace();
> }
> }
-1 on System.out error logging. If you really feel that you need
System logging, please send error conditions to System.err.
Overall, great job.
- Dan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>