public class JobInitializationPlugin extends SchedulerPluginWithUserTransactionSupport implements FileScanListener
The periodically scanning of files for changes is not currently supported in a clustered environment.
If using the JobInitializationPlugin with JobStoreCMT, be sure to set the plugin property wrapInUserTransaction to true. Also, if have a positive scanInterval be sure to set org.quartz.scheduler.wrapJobExecutionInUserTransaction to true.
Constructor and Description |
---|
JobInitializationPlugin() |
Modifier and Type | Method and Description |
---|---|
void |
fileUpdated(java.lang.String fileName) |
java.lang.String |
getFileName()
Deprecated.
Use fileNames with just one file.
|
java.lang.String |
getFileNames()
Comma separated list of file names (with paths) to the XML files that should be read.
|
long |
getScanInterval()
The interval (in seconds) at which to scan for changes to the file.
|
void |
initialize(java.lang.String name,
Scheduler scheduler)
Called during creation of the
Scheduler in order to give
the SchedulerPlugin a chance to initialize. |
boolean |
isFailOnFileNotFound()
Whether or not initialization of the plugin should fail (throw an
exception) if the file cannot be found.
|
boolean |
isOverWriteExistingJobs()
Whether or not jobs defined in the XML file should be overwrite existing
jobs with the same name.
|
boolean |
isValidating()
Whether or not the XML should be validated.
|
boolean |
isValidatingSchema()
Whether or not the XML schema should be validated.
|
void |
processFile(java.lang.String filePath) |
void |
setFailOnFileNotFound(boolean failOnFileNotFound)
Whether or not initialization of the plugin should fail (throw an
exception) if the file cannot be found.
|
void |
setFileName(java.lang.String fileName)
Deprecated.
Use fileNames with just one file.
|
void |
setFileNames(java.lang.String fileNames)
The file name (and path) to the XML file that should be read.
|
void |
setOverWriteExistingJobs(boolean overWriteExistingJobs)
Whether or not jobs defined in the XML file should be overwrite existing
jobs with the same name.
|
void |
setScanInterval(long scanInterval)
The interval (in seconds) at which to scan for changes to the file.
|
void |
setValidating(boolean validating)
Whether or not the XML should be validated.
|
void |
setValidatingSchema(boolean validatingSchema)
Whether or not the XML schema should be validated.
|
void |
shutdown()
Overriden to ignore wrapInUserTransaction because shutdown()
does not interact with the
Scheduler . |
void |
start(javax.transaction.UserTransaction userTransaction)
Called when the associated
Scheduler is started, in order
to let the plug-in know it can now make calls into the scheduler if it
needs to. |
getWrapInUserTransaction, setWrapInUserTransaction, start
public java.lang.String getFileName()
public void setFileName(java.lang.String fileName)
public java.lang.String getFileNames()
public void setFileNames(java.lang.String fileNames)
public boolean isOverWriteExistingJobs()
public void setOverWriteExistingJobs(boolean overWriteExistingJobs)
overWriteExistingJobs
- public long getScanInterval()
public void setScanInterval(long scanInterval)
scanInterval
- The scanInterval to set.public boolean isFailOnFileNotFound()
true
.public void setFailOnFileNotFound(boolean failOnFileNotFound)
true
.public boolean isValidating()
false
.public void setValidating(boolean validating)
false
.public boolean isValidatingSchema()
true
.public void setValidatingSchema(boolean validatingSchema)
true
.public void initialize(java.lang.String name, Scheduler scheduler) throws SchedulerException
Called during creation of the Scheduler
in order to give
the SchedulerPlugin
a chance to initialize.
initialize
in interface SchedulerPlugin
initialize
in class SchedulerPluginWithUserTransactionSupport
name
- The name by which the plugin is identified.scheduler
- The scheduler to which the plugin is registered.SchedulerConfigException
- if there is an error initializing.SchedulerException
public void start(javax.transaction.UserTransaction userTransaction)
SchedulerPluginWithUserTransactionSupport
Called when the associated Scheduler
is started, in order
to let the plug-in know it can now make calls into the scheduler if it
needs to.
If UserTransaction is not null, the plugin can call setRollbackOnly() on it to signal that the wrapped transaction should rollback.
userTransaction
- The UserTranaction object used to provide a
transaction around the start() operation. It will be null if
wrapInUserTransaction is false or if the transaction failed
to be started.public void shutdown()
Scheduler
.shutdown
in interface SchedulerPlugin
shutdown
in class SchedulerPluginWithUserTransactionSupport
public void processFile(java.lang.String filePath)
public void fileUpdated(java.lang.String fileName)
fileUpdated
in interface FileScanListener
FileScanListener.fileUpdated(java.lang.String)