org.quartz.impl
Class StdSchedulerFactory

java.lang.Object
  extended byorg.quartz.impl.StdSchedulerFactory
All Implemented Interfaces:
SchedulerFactory

public class StdSchedulerFactory
extends java.lang.Object
implements SchedulerFactory

An implementation of SchedulerFactory that does all of it's work of creating a QuartzScheduler instance based on the contenents of a Properties file.

By default a properties file named "quartz.properties" is loaded from the 'current working directory'. If that fails, then the "quartz.properties" file located (as a resource) in the org/quartz package is loaded. If you wish to use a file other than these defaults, you must define the system property 'org.quartz.properties' to* point to the file you want.

See the sample properties files that are distributed with Quartz for information about the various settings available within the file.

Alternativly, you can explicitly initialize the factory by calling one of the initialize(xx) methods before calling getScheduler().

Instances of the specified JobStore, ThreadPool, classes will be created by name, and then any additional properties specified for them in the config file will be set on the instance by calling an equivalent 'set' method. For example if the properties file contains the property 'org.quartz.jobStore. myProp = 10' then after the JobStore class has been instantiated, the method 'setMyProp()' will be called on it. Type conversion to primitive Java types (int, long, float, double, boolean, and String) are performed before calling the propertie's setter method.

Author:
James House, Anthony Eden, Mohammad Rezaei

Field Summary
static java.lang.String AUTO_GENERATE_INSTANCE_ID
           
static java.lang.String DEFAULT_INSTANCE_ID
           
static java.lang.String PROP_DATASOURCE_DRIVER
           
static java.lang.String PROP_DATASOURCE_JNDI_ALWAYS_LOOKUP
           
static java.lang.String PROP_DATASOURCE_JNDI_CREDENTIALS
           
static java.lang.String PROP_DATASOURCE_JNDI_INITIAL
           
static java.lang.String PROP_DATASOURCE_JNDI_PRINCIPAL
           
static java.lang.String PROP_DATASOURCE_JNDI_PROVDER
           
static java.lang.String PROP_DATASOURCE_JNDI_URL
           
static java.lang.String PROP_DATASOURCE_MAX_CONNECTIONS
           
static java.lang.String PROP_DATASOURCE_PASSWORD
           
static java.lang.String PROP_DATASOURCE_PREFIX
           
static java.lang.String PROP_DATASOURCE_URL
           
static java.lang.String PROP_DATASOURCE_USER
           
static java.lang.String PROP_DATASOURCE_VALIDATION_QUERY
           
static java.lang.String PROP_JOB_LISTENER_PREFIX
           
static java.lang.String PROP_JOB_STORE_CLASS
           
static java.lang.String PROP_JOB_STORE_PREFIX
           
static java.lang.String PROP_JOB_STORE_USE_PROP
           
static java.lang.String PROP_LISTENER_CLASS
           
static java.lang.String PROP_PLUGIN_CLASS
           
static java.lang.String PROP_PLUGIN_PREFIX
           
static java.lang.String PROP_SCHED_CLASS_LOAD_HELPER_CLASS
           
static java.lang.String PROP_SCHED_CONTEXT_PREFIX
           
static java.lang.String PROP_SCHED_DB_FAILURE_RETRY_INTERVAL
           
static java.lang.String PROP_SCHED_IDLE_WAIT_TIME
           
static java.lang.String PROP_SCHED_INSTANCE_ID
           
static java.lang.String PROP_SCHED_INSTANCE_NAME
           
static java.lang.String PROP_SCHED_RMI_CREATE_REGISTRY
           
static java.lang.String PROP_SCHED_RMI_EXPORT
           
static java.lang.String PROP_SCHED_RMI_HOST
           
static java.lang.String PROP_SCHED_RMI_PORT
           
static java.lang.String PROP_SCHED_RMI_PROXY
           
static java.lang.String PROP_SCHED_THREAD_NAME
           
static java.lang.String PROP_SCHED_USER_TX_URL
           
static java.lang.String PROP_SCHED_WRAP_JOB_IN_USER_TX
           
static java.lang.String PROP_THREAD_POOL_CLASS
           
static java.lang.String PROP_THREAD_POOL_PREFIX
           
static java.lang.String PROP_TRIGGER_LISTENER_PREFIX
           
static java.lang.String PROPERTIES_FILE
           
 
Constructor Summary
StdSchedulerFactory()
           
StdSchedulerFactory(java.util.Properties props)
           
StdSchedulerFactory(java.lang.String fileName)
           
 
Method Summary
 java.util.Collection getAllSchedulers()
           Returns a handle to all known Schedulers (made by any StdSchedulerFactory instance.).
static Scheduler getDefaultScheduler()
           Returns a handle to the default Scheduler, creating it if it does not yet exist.
static org.apache.commons.logging.Log getLog()
           
 Scheduler getScheduler()
           Returns a handle to the Scheduler produced by this factory.
 Scheduler getScheduler(java.lang.String schedName)
           Returns a handle to the Scheduler with the given name, if it exists (if it has already been instantiated).
 void initialize()
           Initialize the SchedulerFactory with the contenents of a Properties file.
 void initialize(java.io.InputStream propertiesStream)
           Initialize the SchedulerFactory with the contenents of the Properties file opened with the given InputStream.
 void initialize(java.util.Properties props)
           Initialize the SchedulerFactory with the contenents of the given Properties object.
 void initialize(java.lang.String filename)
           Initialize the SchedulerFactory with the contenents of the Properties file with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTIES_FILE

public static final java.lang.String PROPERTIES_FILE
See Also:
Constant Field Values

PROP_SCHED_INSTANCE_NAME

public static final java.lang.String PROP_SCHED_INSTANCE_NAME
See Also:
Constant Field Values

PROP_SCHED_INSTANCE_ID

public static final java.lang.String PROP_SCHED_INSTANCE_ID
See Also:
Constant Field Values

PROP_SCHED_THREAD_NAME

public static final java.lang.String PROP_SCHED_THREAD_NAME
See Also:
Constant Field Values

PROP_SCHED_RMI_EXPORT

public static final java.lang.String PROP_SCHED_RMI_EXPORT
See Also:
Constant Field Values

PROP_SCHED_RMI_PROXY

public static final java.lang.String PROP_SCHED_RMI_PROXY
See Also:
Constant Field Values

PROP_SCHED_RMI_HOST

public static final java.lang.String PROP_SCHED_RMI_HOST
See Also:
Constant Field Values

PROP_SCHED_RMI_PORT

public static final java.lang.String PROP_SCHED_RMI_PORT
See Also:
Constant Field Values

PROP_SCHED_RMI_CREATE_REGISTRY

public static final java.lang.String PROP_SCHED_RMI_CREATE_REGISTRY
See Also:
Constant Field Values

PROP_SCHED_WRAP_JOB_IN_USER_TX

public static final java.lang.String PROP_SCHED_WRAP_JOB_IN_USER_TX
See Also:
Constant Field Values

PROP_SCHED_USER_TX_URL

public static final java.lang.String PROP_SCHED_USER_TX_URL
See Also:
Constant Field Values

PROP_SCHED_IDLE_WAIT_TIME

public static final java.lang.String PROP_SCHED_IDLE_WAIT_TIME
See Also:
Constant Field Values

PROP_SCHED_DB_FAILURE_RETRY_INTERVAL

public static final java.lang.String PROP_SCHED_DB_FAILURE_RETRY_INTERVAL
See Also:
Constant Field Values

PROP_SCHED_CLASS_LOAD_HELPER_CLASS

public static final java.lang.String PROP_SCHED_CLASS_LOAD_HELPER_CLASS
See Also:
Constant Field Values

PROP_SCHED_CONTEXT_PREFIX

public static final java.lang.String PROP_SCHED_CONTEXT_PREFIX
See Also:
Constant Field Values

PROP_THREAD_POOL_PREFIX

public static final java.lang.String PROP_THREAD_POOL_PREFIX
See Also:
Constant Field Values

PROP_THREAD_POOL_CLASS

public static final java.lang.String PROP_THREAD_POOL_CLASS
See Also:
Constant Field Values

PROP_JOB_STORE_PREFIX

public static final java.lang.String PROP_JOB_STORE_PREFIX
See Also:
Constant Field Values

PROP_JOB_STORE_CLASS

public static final java.lang.String PROP_JOB_STORE_CLASS
See Also:
Constant Field Values

PROP_JOB_STORE_USE_PROP

public static final java.lang.String PROP_JOB_STORE_USE_PROP
See Also:
Constant Field Values

PROP_DATASOURCE_PREFIX

public static final java.lang.String PROP_DATASOURCE_PREFIX
See Also:
Constant Field Values

PROP_DATASOURCE_DRIVER

public static final java.lang.String PROP_DATASOURCE_DRIVER
See Also:
Constant Field Values

PROP_DATASOURCE_URL

public static final java.lang.String PROP_DATASOURCE_URL
See Also:
Constant Field Values

PROP_DATASOURCE_USER

public static final java.lang.String PROP_DATASOURCE_USER
See Also:
Constant Field Values

PROP_DATASOURCE_PASSWORD

public static final java.lang.String PROP_DATASOURCE_PASSWORD
See Also:
Constant Field Values

PROP_DATASOURCE_MAX_CONNECTIONS

public static final java.lang.String PROP_DATASOURCE_MAX_CONNECTIONS
See Also:
Constant Field Values

PROP_DATASOURCE_VALIDATION_QUERY

public static final java.lang.String PROP_DATASOURCE_VALIDATION_QUERY
See Also:
Constant Field Values

PROP_DATASOURCE_JNDI_URL

public static final java.lang.String PROP_DATASOURCE_JNDI_URL
See Also:
Constant Field Values

PROP_DATASOURCE_JNDI_ALWAYS_LOOKUP

public static final java.lang.String PROP_DATASOURCE_JNDI_ALWAYS_LOOKUP
See Also:
Constant Field Values

PROP_DATASOURCE_JNDI_INITIAL

public static final java.lang.String PROP_DATASOURCE_JNDI_INITIAL
See Also:
Constant Field Values

PROP_DATASOURCE_JNDI_PROVDER

public static final java.lang.String PROP_DATASOURCE_JNDI_PROVDER
See Also:
Constant Field Values

PROP_DATASOURCE_JNDI_PRINCIPAL

public static final java.lang.String PROP_DATASOURCE_JNDI_PRINCIPAL
See Also:
Constant Field Values

PROP_DATASOURCE_JNDI_CREDENTIALS

public static final java.lang.String PROP_DATASOURCE_JNDI_CREDENTIALS
See Also:
Constant Field Values

PROP_PLUGIN_PREFIX

public static final java.lang.String PROP_PLUGIN_PREFIX
See Also:
Constant Field Values

PROP_PLUGIN_CLASS

public static final java.lang.String PROP_PLUGIN_CLASS
See Also:
Constant Field Values

PROP_JOB_LISTENER_PREFIX

public static final java.lang.String PROP_JOB_LISTENER_PREFIX
See Also:
Constant Field Values

PROP_TRIGGER_LISTENER_PREFIX

public static final java.lang.String PROP_TRIGGER_LISTENER_PREFIX
See Also:
Constant Field Values

PROP_LISTENER_CLASS

public static final java.lang.String PROP_LISTENER_CLASS
See Also:
Constant Field Values

DEFAULT_INSTANCE_ID

public static final java.lang.String DEFAULT_INSTANCE_ID
See Also:
Constant Field Values

AUTO_GENERATE_INSTANCE_ID

public static final java.lang.String AUTO_GENERATE_INSTANCE_ID
See Also:
Constant Field Values
Constructor Detail

StdSchedulerFactory

public StdSchedulerFactory()

StdSchedulerFactory

public StdSchedulerFactory(java.util.Properties props)
                    throws SchedulerException

StdSchedulerFactory

public StdSchedulerFactory(java.lang.String fileName)
                    throws SchedulerException
Method Detail

getLog

public static org.apache.commons.logging.Log getLog()

initialize

public void initialize()
                throws SchedulerException

Initialize the SchedulerFactory with the contenents of a Properties file.

By default a properties file named "quartz.properties" is loaded from the 'current working directory'. If that fails, then the "quartz.properties" file located (as a resource) in the org/quartz package is loaded. If you wish to use a file other than these defaults, you must define the system property 'org.quartz.properties' to point to the file you want.

System properties (envrionment variables, and -D definitions on the command-line when running the JVM) over-ride any properties in the loaded file.

Throws:
SchedulerException

initialize

public void initialize(java.lang.String filename)
                throws SchedulerException

Initialize the SchedulerFactory with the contenents of the Properties file with the given name.

Throws:
SchedulerException

initialize

public void initialize(java.io.InputStream propertiesStream)
                throws SchedulerException

Initialize the SchedulerFactory with the contenents of the Properties file opened with the given InputStream.

Throws:
SchedulerException

initialize

public void initialize(java.util.Properties props)
                throws SchedulerException

Initialize the SchedulerFactory with the contenents of the given Properties object.

Throws:
SchedulerException

getScheduler

public Scheduler getScheduler()
                       throws SchedulerException

Returns a handle to the Scheduler produced by this factory.

If one of the initialize methods has not be previously called, then the default (no-arg) initialize() method will be called by this method.

Specified by:
getScheduler in interface SchedulerFactory
Throws:
SchedulerException - if there is a problem with the underlying Scheduler.

getDefaultScheduler

public static Scheduler getDefaultScheduler()
                                     throws SchedulerException

Returns a handle to the default Scheduler, creating it if it does not yet exist.

Throws:
SchedulerException
See Also:
initialize()

getScheduler

public Scheduler getScheduler(java.lang.String schedName)
                       throws SchedulerException

Returns a handle to the Scheduler with the given name, if it exists (if it has already been instantiated).

Specified by:
getScheduler in interface SchedulerFactory
Throws:
SchedulerException

getAllSchedulers

public java.util.Collection getAllSchedulers()
                                      throws SchedulerException

Returns a handle to all known Schedulers (made by any StdSchedulerFactory instance.).

Specified by:
getAllSchedulers in interface SchedulerFactory
Throws:
SchedulerException

Quartz Project Page