Permalink
Browse files

update plugin to use quartz 2.1.x. This allows use of latest version …

…of Terracotta and Tomcat 7.
  • Loading branch information...
1 parent 369a417 commit 5f656188298f55d39d5075279b7df763fb8c16bd @rvanderwerf rvanderwerf committed Dec 21, 2012
Showing with 2,263 additions and 1,355 deletions.
  1. +5 −1 .idea/compiler.xml
  2. +2 −3 .idea/misc.xml
  3. +1 −0 .idea/modules.xml
  4. +99 −49 QuartzGrailsPlugin.groovy
  5. +8 −1 README.rdoc
  6. +4 −3 application.properties
  7. +8 −2 grails-app/conf/BuildConfig.groovy
  8. +13 −0 grails-app/conf/UrlMappings.groovy
  9. +125 −2 grails-quartz.iml
  10. +18 −9 plugin.xml
  11. +5 −5 src/groovy/grails/plugins/quartz/config/TriggersConfigBuilder.groovy
  12. +43 −8 src/java/grails/plugins/quartz/CustomTriggerFactoryBean.java
  13. +0 −5 src/java/grails/plugins/quartz/DefaultGrailsJobClass.java
  14. +0 −7 src/java/grails/plugins/quartz/GrailsJobClass.java
  15. +0 −4 src/java/grails/plugins/quartz/GrailsJobClassConstants.java
  16. +36 −14 src/java/grails/plugins/quartz/JobDetailFactoryBean.java
  17. +1 −1 src/java/grails/plugins/quartz/listeners/ExceptionPrinterJobListener.java
  18. +73 −66 src/templates/sql/tables_cloudscape.sql
  19. +49 −42 src/templates/sql/tables_db2.sql
  20. +50 −44 src/templates/sql/tables_db2_v72.sql
  21. +49 −43 src/templates/sql/tables_db2_v8.sql
  22. +140 −0 src/templates/sql/tables_db2_v95.sql
  23. +124 −84 src/templates/sql/tables_derby.sql
  24. +140 −0 src/templates/sql/tables_derby_previous.sql
  25. +54 −50 src/templates/sql/tables_firebird.sql
  26. +248 −0 src/templates/sql/tables_h2.sql
  27. +94 −87 src/templates/sql/tables_hsqldb.sql
  28. +54 −52 src/templates/sql/tables_hsqldb_old.sql
  29. +61 −73 src/templates/sql/tables_informix.sql
  30. +82 −82 src/templates/sql/tables_mysql.sql
  31. +107 −80 src/templates/sql/tables_mysql_innodb.sql
  32. +104 −90 src/templates/sql/tables_oracle.sql
  33. +58 −57 src/templates/sql/tables_pointbase.sql
  34. +103 −79 src/templates/sql/tables_postgres.sql
  35. +74 −70 src/templates/sql/tables_sapdb.sql
  36. +71 −64 src/templates/sql/tables_solid.sql
  37. +82 −86 src/templates/sql/tables_sqlServer.sql
  38. +76 −78 src/templates/sql/tables_sybase.sql
  39. +0 −2 test/integration/QuartzPluginTests.groovy
  40. +2 −2 test/unit/grails/plugins/quartz/QuartzConfigTests.groovy
  41. +0 −10 test/unit/grails/plugins/quartz/config/TriggersConfigBuilderTests.groovy
View
6 .idea/compiler.xml
@@ -15,7 +15,11 @@
<entry name="?*.tld" />
<entry name="?*.ftl" />
</wildcardResourcePatterns>
- <annotationProcessing enabled="false" useClasspath="true" />
+ <annotationProcessing>
+ <profile default="true" name="Default" enabled="false">
+ <processorPath useClasspath="true" />
+ </profile>
+ </annotationProcessing>
</component>
</project>
View
5 .idea/misc.xml
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="DependencyValidationManager">
- <option name="SKIP_IMPORT_STATEMENTS" value="false" />
- </component>
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
+ <component name="IdProvider" IDEtalkID="83E48FECE4FBB0E6BDB630026D24F2B1" />
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
<option name="OPTION_SCOPE" value="protected" />
@@ -29,6 +27,7 @@
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
+ <component name="RegexUtilComponent" text="1900-01-01 2007/08/13 1900.01.01 1900 01 01 1900-01.01 1900 13 01 1900 02 31" flags="0" regex="(19|20)\d\d([- /.])(0[1-9]|1[012])\2(0[1-9]|[12][0-9]|3[01])" mode="0" />
<component name="WebServicesPlugin" addRequiredLibraries="true" />
</project>
View
1 .idea/modules.xml
@@ -3,6 +3,7 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/grails-quartz.iml" filepath="$PROJECT_DIR$/grails-quartz.iml" />
+ <module fileurl="file://$PROJECT_DIR$/grails-quartz-grailsPlugins.iml" filepath="$PROJECT_DIR$/grails-quartz-grailsPlugins.iml" />
</modules>
</component>
</project>
View
148 QuartzGrailsPlugin.groovy
@@ -25,6 +25,9 @@ import org.springframework.context.ApplicationContext
import org.springframework.scheduling.quartz.SchedulerFactoryBean
import grails.plugins.quartz.*
import org.quartz.*
+import static org.quartz.TriggerBuilder.newTrigger;
+import static org.quartz.CronScheduleBuilder.cronSchedule;
+import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
/**
* A plug-in that configures Quartz job support for Grails.
@@ -33,14 +36,15 @@ import org.quartz.*
* @author Graeme Rocher
* @author Marcel Overdijk
* @author Sergey Nebolsin
+ * @author Ryan Vanderwerf
*/
class QuartzGrailsPlugin {
- def version = "1.0-RC2"
+ def version = "1.0-RC3"
def grailsVersion = "1.2 > *"
- def author = "Sergey Nebolsin, Graeme Rocher"
- def authorEmail = "nebolsin@gmail.com"
+ def author = "Sergey Nebolsin, Graeme Rocher, Ryan Vanderwerf"
+ def authorEmail = "rvanderwerf@gmail.com"
def title = "Quartz plugin for Grails"
def description = '''\
This plugin adds Quartz job scheduling features to Grails application.
@@ -60,13 +64,13 @@ This plugin adds Quartz job scheduling features to Grails application.
def artefacts = [new JobArtefactHandler()]
- def doWithSpring = {
+ def doWithSpring = { context ->
def config = loadQuartzConfig()
- application.jobClasses.each {jobClass ->
+ application.jobClasses.each { jobClass ->
configureJobBeans.delegate = delegate
- configureJobBeans(jobClass, manager?.hasGrailsPlugin("hibernate"))
+ configureJobBeans(jobClass, manager.hasGrailsPlugin("hibernate"))
}
if (manager?.hasGrailsPlugin("hibernate")) {
@@ -95,10 +99,13 @@ This plugin adds Quartz job scheduling features to Grails application.
exposeSchedulerInRepository = config.exposeSchedulerInRepository
jobFactory = quartzJobFactory
if (manager?.hasGrailsPlugin("hibernate")) {
- jobListeners = [ref("${SessionBinderJobListener.NAME}")]
+ globalJobListeners = [ref("${SessionBinderJobListener.NAME}")]
+ } else {
+ globalJobListeners = [ref("${ExceptionPrinterJobListener.NAME}"),ref("${SessionBinderJobListener.NAME}")]
}
- globalJobListeners = [ref("${ExceptionPrinterJobListener.NAME}")]
+
}
+
}
def doWithDynamicMethods = {ctx ->
@@ -115,29 +122,58 @@ This plugin adds Quartz job scheduling features to Grails application.
r = -r;
}
return "GRAILS_" + Long.toString(r, 30 + (int) (System.currentTimeMillis() % 7));
-
}
mc.'static'.schedule = { String cronExpression, Map params = null ->
- Trigger trigger = new CronTrigger(generateTriggerName(), Constants.DEFAULT_TRIGGERS_GROUP, jobName, jobGroup, cronExpression)
- if (tc.getVolatility()) trigger.setVolatility(true)
+ Trigger trigger = newTrigger()
+ .withIdentity(generateTriggerName(),Constants.DEFAULT_TRIGGERS_GROUP)
+ .withPriority(6)
+ .forJob(jobName,jobGroup)
+ .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression))
+ .build();
+
+
if (params) trigger.jobDataMap.putAll(params)
quartzScheduler.scheduleJob(trigger)
}
+
mc.'static'.schedule = {Long interval, Integer repeatCount = SimpleTrigger.REPEAT_INDEFINITELY, Map params = null ->
- Trigger trigger = new SimpleTrigger(generateTriggerName(), Constants.DEFAULT_TRIGGERS_GROUP, jobName, jobGroup, new Date(), null, repeatCount, interval)
- if (tc.getVolatility()) trigger.setVolatility(true)
+
+ Trigger trigger = newTrigger()
+ .withIdentity(generateTriggerName(),Constants.DEFAULT_TRIGGERS_GROUP)
+ .withPriority(6)
+ .forJob(jobName,jobGroup)
+ .withSchedule(simpleSchedule()
+ .withIntervalInMilliseconds(interval)
+ .repeatForever())
+ .build();
+
+
if (params) trigger.jobDataMap.putAll(params)
quartzScheduler.scheduleJob(trigger)
}
mc.'static'.schedule = {Date scheduleDate ->
- Trigger trigger = new SimpleTrigger(generateTriggerName(), Constants.DEFAULT_TRIGGERS_GROUP, jobName, jobGroup, scheduleDate, null, 0, 0)
- if (tc.getVolatility()) trigger.setVolatility(true)
+
+ Trigger trigger = newTrigger()
+ .withIdentity(generateTriggerName(),Constants.DEFAULT_TRIGGERS_GROUP)
+ .withPriority(6)
+ .forJob(jobName,jobGroup)
+ .startAt(scheduleDate)
+ .build();
+
quartzScheduler.scheduleJob(trigger)
}
mc.'static'.schedule = {Date scheduleDate, Map params ->
- Trigger trigger = new SimpleTrigger(generateTriggerName(), Constants.DEFAULT_TRIGGERS_GROUP, jobName, jobGroup, scheduleDate, null, 0, 0)
- if (tc.getVolatility()) trigger.setVolatility(true)
+
+ Trigger trigger = newTrigger()
+ .withIdentity(generateTriggerName(),Constants.DEFAULT_TRIGGERS_GROUP)
+ .withPriority(6)
+ .forJob(jobName,jobGroup)
+ .startAt(scheduleDate)
+ .build();
+
+
+
if (params) trigger.jobDataMap.putAll(params)
quartzScheduler.scheduleJob(trigger)
}
@@ -147,23 +183,21 @@ This plugin adds Quartz job scheduling features to Grails application.
quartzScheduler.scheduleJob(trigger)
}
mc.'static'.triggerNow = { Map params = null ->
- if (tc.getVolatility()) {
- quartzScheduler.triggerJobWithVolatileTrigger(jobName, jobGroup, params ? new JobDataMap(params) : null)
- } else {
+
quartzScheduler.triggerJob(jobName, jobGroup, params ? new JobDataMap(params) : null)
- }
+
}
mc.'static'.removeJob = {
quartzScheduler.deleteJob(jobName, jobGroup)
}
- mc.'static'.reschedule = {Trigger trigger ->
+ mc.'static'.reschedule = { Trigger trigger ->
trigger.jobName = jobName
trigger.jobGroup = jobGroup
quartzScheduler.rescheduleJob(trigger.name, trigger.group, trigger)
}
- mc.'static'.unschedule = {String triggerName, String triggerGroup = Constants.DEFAULT_TRIGGERS_GROUP ->
+ mc.'static'.unschedule = { String triggerName, String triggerGroup = Constants.DEFAULT_TRIGGERS_GROUP ->
quartzScheduler.unscheduleJob(triggerName, triggerGroup)
}
}
@@ -174,6 +208,7 @@ This plugin adds Quartz job scheduling features to Grails application.
scheduleJob.delegate = delegate
scheduleJob(jobClass, applicationContext)
}
+ log.debug("Scheduled Job Classes Count:"+application.jobClasses.size())
}
def onChange = {event ->
@@ -220,57 +255,72 @@ This plugin adds Quartz job scheduling features to Grails application.
if (scheduler) {
def fullName = jobClass.fullName
// add job to scheduler, and associate triggers with it
+ if (ctx.getBean("${fullName}Detail")) {
scheduler.addJob(ctx.getBean("${fullName}Detail"), true)
jobClass.triggers.each {key, trigger ->
+ TriggerKey triggerKey = new TriggerKey(trigger.triggerAttributes.name,trigger.triggerAttributes.group)
log.debug("Scheduling $fullName with trigger $key: ${trigger}")
- if (scheduler.getTrigger(trigger.triggerAttributes.name, trigger.triggerAttributes.group)) {
- scheduler.rescheduleJob(trigger.triggerAttributes.name, trigger.triggerAttributes.group, ctx.getBean("${key}Trigger"))
+ if (scheduler.getTrigger(triggerKey)) {
+ scheduler.rescheduleJob(triggerKey, ctx.getBean("${key}Trigger"))
} else {
scheduler.scheduleJob(ctx.getBean("${key}Trigger"))
}
}
log.debug("Job ${jobClass.fullName} scheduled")
+ } else {
+ log.error("Error scheduling job, ${fullName}Detail not found in ApplicationContext!")
+ }
} else {
log.error("Failed to register job triggers: scheduler not found")
}
}
def configureJobBeans = {GrailsJobClass jobClass, boolean hasHibernate = true ->
+
def fullName = jobClass.fullName
- "${fullName}Class"(MethodInvokingFactoryBean) {
- targetObject = ref("grailsApplication", true)
- targetMethod = "getArtefact"
- arguments = [JobArtefactHandler.TYPE, jobClass.fullName]
- }
+ try {
- "${fullName}"(ref("${fullName}Class")) {bean ->
- bean.factoryMethod = "newInstance"
- bean.autowire = "byName"
- bean.scope = "prototype"
- }
- "${fullName}Detail"(JobDetailFactoryBean) {
- name = fullName
- group = jobClass.group
- concurrent = jobClass.concurrent
- volatility = jobClass.volatility
- durability = jobClass.durability
- requestsRecovery = jobClass.requestsRecovery
+ "${fullName}Class"(MethodInvokingFactoryBean) {
+ targetObject = ref("grailsApplication", true)
+ targetMethod = "getArtefact"
+ arguments = [JobArtefactHandler.TYPE, jobClass.fullName]
+ }
+
+ "${fullName}"(ref("${fullName}Class")) {bean ->
+ bean.factoryMethod = "newInstance"
+ bean.autowire = "byName"
+ bean.scope = "prototype"
+ }
+
+ "${fullName}Detail"(JobDetailFactoryBean) {
+ name = fullName
+ group = jobClass.group
+ concurrent = jobClass.concurrent
+ durability = jobClass.durability
+ requestsRecovery = jobClass.requestsRecovery
- if (hasHibernate && jobClass.sessionRequired) {
- jobListenerNames = ["${SessionBinderJobListener.NAME}"] as String[]
+ if (hasHibernate && jobClass.sessionRequired) {
+ jobListenerNames = ["${SessionBinderJobListener.NAME}"] as String[]
+ }
}
+ } catch (Exception e) {
+ log.error("Error declaring ${fullName}Detail bean in context",e)
}
// registering triggers
- jobClass.triggers.each {name, trigger ->
- "${name}Trigger"(trigger.clazz) {
- jobDetail = ref("${fullName}Detail")
- trigger.properties.findAll {it.key != 'clazz'}.each {
- delegate["${it.key}"] = it.value
+ try {
+ jobClass.triggers.each {name, trigger ->
+ "${name}Trigger"(trigger.clazz) {
+ jobDetail = ref("${fullName}Detail")
+ trigger.properties.findAll {it.key != 'clazz'}.each {
+ delegate["${it.key}"] = it.value
+ }
}
}
+ } catch (Exception te) {
+ log.error("Error registering triggers",te)
}
}
View
9 README.rdoc
@@ -1,5 +1,12 @@
= Grails Quartz Plugin http://stillmaintained.com/nebolsin/grails-quartz.png
+This plugin has been updated to run on Quartz 2.1.x and no longer runs on Quartz 1.8.x. The newer
+version of Quartz will also allow it to be used With Terrcotta 3.6 or later (I tested on 3.7) - Ryan
+
+This is different than the quartz2 plugin others maintain, because it does not use JobDetailsImpl, that one will
+not work with Terracotta due to bug https://jira.terracotta.org/jira/browse/QTZ-310). This plugin was the last holdback
+to allow a full Terracotta 3.7, Tomcat 7, Quartz 2.1.x, and Ehcache and Hibernate Cache solution all working at once!
+
Quartz plugin allows your Grails application to schedule jobs to be executed using a specified interval or cron
expression. The underlying system uses the {Quartz Enterprise Job Scheduler}[http://www.opensymphony.com/quartz/]
configured via {Spring}[http://www.springsource.org/about], but is made simpler by the coding by convention paradigm.
@@ -65,5 +72,5 @@ Three kinds of triggers are supported with the following parameters:
* <tt>startDelay</tt> — delay (in milliseconds) between scheduler startup and first job's execution;
* <tt>cronExpression</tt> — {cron expression}[http://www.opensymphony.com/quartz/api/org/quartz/CronExpression.html]
* <tt>custom</tt>:
- * <tt>triggerClass</tt> — your class which implements {Trigger}[http://www.opensymphony.com/quartz/api/org/quartz/Trigger.html] interface;
+ * <tt>triggerClass</tt> — your class which implements {CalendarIntervalTriggerImpl}[http://www.quartz-scheduler.org/api/2.0.0/org/quartz/impl/triggers/CalendarIntervalTriggerImpl.html] impl;
* any params needed by your trigger.
View
7 application.properties
@@ -1,7 +1,8 @@
#Grails Metadata file
-#Thu May 24 09:42:12 CEST 2012
-app.grails.version=2.0.4
+#Thu Dec 20 21:52:17 CST 2012
+app.grails.version=2.1.3
app.name=quartz
+plugins.hibernate=2.1.3
plugins.release=2.0.2
plugins.rest-client-builder=1.0.2
-plugins.tomcat=2.0.4
+plugins.tomcat=2.1.3
View
10 grails-app/conf/BuildConfig.groovy
@@ -15,16 +15,22 @@ grails.project.dependency.resolution = {
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
if(grailsVersion.startsWith("1.")) {
- compile('org.hibernate:hibernate-core:3.3.1.GA', "org.quartz-scheduler:quartz:1.8.4") {
+ compile('org.hibernate:hibernate-core:3.3.1.GA', "org.quartz-scheduler:quartz:2.1.5") {
excludes 'ehcache', 'xml-apis', 'commons-logging', 'slf4j-api'
}
}
else {
- compile('org.hibernate:hibernate-core:3.6.10.Final', "org.quartz-scheduler:quartz:1.8.4") {
+ compile('org.hibernate:hibernate-core:3.6.10.Final', "org.quartz-scheduler:quartz:2.1.5") {
excludes 'ehcache', 'xml-apis', 'commons-logging', 'slf4j-api'
}
+ runtime "hsqldb:hsqldb:1.8.0.10"
}
+ // the following library makes accomodations for quartz2 but this is not packaged with Grails yet
+ //compile('org.springframework:org.springframework.context.support:3.2.0.RELEASE')
}
+
+
+
}
View
13 grails-app/conf/UrlMappings.groovy
@@ -0,0 +1,13 @@
+class UrlMappings {
+
+ static mappings = {
+ "/$controller/$action?/$id?" {
+ constraints {
+ // apply constraints here
+ }
+ }
+
+ "/"(view: "/index")
+ "500"(view: '/error')
+ }
+}
View
127 grails-quartz.iml
@@ -17,6 +17,11 @@
</fileset>
</configuration>
</facet>
+ <facet type="hibernate" name="Hibernate">
+ <configuration>
+ <datasource-map />
+ </configuration>
+ </facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
@@ -27,6 +32,7 @@
<sourceFolder url="file://$MODULE_DIR$/test/unit" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/test/integration" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/grails-app/utils" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/grails-app/i18n" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/grails-app/controllers" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/grails-app/domain" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/grails-app/taglib" isTestSource="false" />
@@ -46,15 +52,132 @@
<orderEntry type="module-library">
<library name="Grails User Library">
<CLASSES>
- <root url="jar://$USER_HOME$/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.0.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.quartz-scheduler/quartz/jars/quartz-1.8.4.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/opensymphony/sitemesh/jars/sitemesh-2.4.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.hibernate.javax.persistence/hibernate-jpa-2.0-api/jars/hibernate-jpa-2.0-api-1.0.1.Final.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/javax.transaction/jta/jars/jta-1.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-lang/commons-lang/jars/commons-lang-2.6.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-io/commons-io/jars/commons-io-2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-collections/commons-collections/jars/commons-collections-3.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-codec/commons-codec/jars/commons-codec-1.5.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/com.googlecode.concurrentlinkedhashmap/concurrentlinkedhashmap-lru/jars/concurrentlinkedhashmap-lru-1.2_jdk5.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/aopalliance/aopalliance/jars/aopalliance-1.0.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-validator/commons-validator/jars/commons-validator-1.3.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-el/commons-el/jars/commons-el-1.0.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-beanutils/commons-beanutils/jars/commons-beanutils-1.8.3.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.codehaus.groovy/groovy-all/jars/groovy-all-1.8.8.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/c3p0/c3p0/jars/c3p0-0.9.1.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.quartz-scheduler/quartz/jars/quartz-2.1.5.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.hibernate/hibernate-commons-annotations/jars/hibernate-commons-annotations-3.2.0.Final.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/dom4j/dom4j/jars/dom4j-1.6.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/antlr/antlr/jars/antlr-2.7.6.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.hibernate/hibernate-core/jars/hibernate-core-3.6.10.Final.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.grails/grails-datastore-simple/jars/grails-datastore-simple-1.1.0.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.grails/grails-datastore-core/jars/grails-datastore-core-1.1.0.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.grails/grails-datastore-gorm/jars/grails-datastore-gorm-1.1.0.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-webmvc/jars/spring-webmvc-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-web/jars/spring-web-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-tx/jars/spring-tx-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-orm/jars/spring-orm-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-jms/jars/spring-jms-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-jdbc/jars/spring-jdbc-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-expression/jars/spring-expression-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-context-support/jars/spring-context-support-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-context/jars/spring-context-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-beans/jars/spring-beans-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-asm/jars/spring-asm-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-aspects/jars/spring-aspects-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-aop/jars/spring-aop-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-core/jars/spring-core-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/javax.servlet/jstl/jars/jstl-1.1.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/com.h2database/h2/jars/h2-1.3.164.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-pool/commons-pool/jars/commons-pool-1.5.6.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-dbcp/commons-dbcp/jars/commons-dbcp-1.4.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/oro/oro/jars/oro-2.0.8.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-fileupload/commons-fileupload/jars/commons-fileupload-1.2.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/cglib/cglib/jars/cglib-2.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.aspectj/aspectjrt/jars/aspectjrt-1.6.10.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.aspectj/aspectjweaver/jars/aspectjweaver-1.6.10.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.slf4j/jul-to-slf4j/jars/jul-to-slf4j-1.6.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.6.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/log4j/log4j/bundles/log4j-1.2.16.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/net.sf.ehcache/ehcache-core/jars/ehcache-core-2.4.6.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/xpp3/xpp3_min/jars/xpp3_min-1.1.4c.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework/spring-test/jars/spring-test-3.1.2.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/junit/junit/jars/junit-4.10.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/xalan/serializer/jars/serializer-2.7.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/net.java.dev.jna/jna/jars/jna-3.2.3.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.fusesource.jansi/jansi/jars/jansi-1.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.ivy/ivy/jars/ivy-2.2.0.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/jline/jline/jars/jline-1.0.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.bouncycastle/bcprov-jdk15/jars/bcprov-jdk15-1.45.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.bouncycastle/bcpg-jdk15/jars/bcpg-jdk15-1.45.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/com.googlecode.json-simple/json-simple/jars/json-simple-1.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/com.google.protobuf/protobuf-java/jars/protobuf-java-2.4.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.springframework.uaa/org.springframework.uaa.client/bundles/org.springframework.uaa.client-1.0.1.RELEASE.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.ant/ant-trax/jars/ant-trax-1.7.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.ant/ant-junit/jars/ant-junit-1.8.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.8.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.ant/ant/jars/ant-1.8.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.tomcat.embed/tomcat-embed-logging-log4j/jars/tomcat-embed-logging-log4j-7.0.30.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.tomcat.embed/tomcat-embed-jasper/jars/tomcat-embed-jasper-7.0.30.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.tomcat.embed/tomcat-embed-core/jars/tomcat-embed-core-7.0.30.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven.wagon/wagon-http-lightweight/jars/wagon-http-lightweight-1.0-beta-6.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven.wagon/wagon-file/jars/wagon-file-1.0-beta-6.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven/maven-error-diagnostics/jars/maven-error-diagnostics-2.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven/maven-plugin-registry/jars/maven-plugin-registry-2.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven/maven-profile/jars/maven-profile-2.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven/maven-settings/jars/maven-settings-2.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven/maven-project/jars/maven-project-2.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven/maven-model/jars/maven-model-2.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/backport-util-concurrent/backport-util-concurrent/jars/backport-util-concurrent-3.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven.wagon/wagon-provider-api/jars/wagon-provider-api-1.0-beta-6.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven/maven-repository-metadata/jars/maven-repository-metadata-2.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven/maven-artifact-manager/jars/maven-artifact-manager-2.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven/maven-artifact/jars/maven-artifact-2.2.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.codehaus.plexus/plexus-interpolation/jars/plexus-interpolation-1.11.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.codehaus.plexus/plexus-utils/jars/plexus-utils-1.5.15.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.codehaus.plexus/plexus-container-default/jars/plexus-container-default-1.0-alpha-9-stable-1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/classworlds/classworlds/jars/classworlds-1.1-alpha-2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/ant/ant/jars/ant-1.6.5.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven/maven-ant-tasks/jars/maven-ant-tasks-2.1.0.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/xml-resolver/xml-resolver/jars/xml-resolver-1.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/xerces/xercesImpl/jars/xercesImpl-2.8.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/net.sourceforge.nekohtml/nekohtml/jars/nekohtml-1.9.9.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/asm/asm-analysis/jars/asm-analysis-3.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/asm/asm-util/jars/asm-util-3.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/asm/asm-tree/jars/asm-tree-3.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/asm/asm-commons/jars/asm-commons-3.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/asm/asm/jars/asm-3.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/antlr/antlr/jars/antlr-2.7.7.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.codehaus.groovy/groovy/jars/groovy-1.7-rc-2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/net.sf.ezmorph/ezmorph/jars/ezmorph-1.0.6.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/net.sf.json-lib/json-lib/jars/json-lib-2.3-jdk15.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/commons-logging/commons-logging/jars/commons-logging-1.1.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.httpcomponents/httpcore/jars/httpcore-4.0.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.httpcomponents/httpclient/jars/httpclient-4.0.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.codehaus.groovy.modules.http-builder/http-builder/jars/http-builder-0.5.0.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/nekohtml/nekohtml/jars/nekohtml-1.9.6.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/nekohtml/xercesMinimal/jars/xercesMinimal-1.9.6.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.maven.wagon/wagon-http-shared/jars/wagon-http-shared-1.0-beta-6.jar!/" />
<root url="file://$MODULE_DIR$/lib" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.eclipse.jdt.core.compiler/ecj/jars/ecj-3.7.2.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.tomcat.embed/tomcat-embed-logging-juli/jars/tomcat-embed-logging-juli-7.0.30.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.apache.tomcat/tomcat-catalina-ant/jars/tomcat-catalina-ant-7.0.30.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/hsqldb/hsqldb/jars/hsqldb-1.8.0.10.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.hibernate/hibernate-ehcache/jars/hibernate-ehcache-3.6.10.Final.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.javassist/javassist/jars/javassist-3.16.1-GA.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/javax.validation/validation-api/jars/validation-api-1.0.0.GA.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.hibernate/hibernate-validator/jars/hibernate-validator-4.1.0.Final.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/javassist/javassist/jars/javassist-3.12.0.GA.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$MODULE_DIR$/lib" recursive="false" />
</library>
</orderEntry>
+ <orderEntry type="library" name="grails-2.1.1" level="application" />
+ <orderEntry type="module" module-name="grails-quartz-grailsPlugins" />
</component>
</module>
View
27 plugin.xml
@@ -1,4 +1,4 @@
-<plugin name='quartz' version='1.0-RC2' grailsVersion='1.2 &gt; *'>
+<plugin name='quartz' version='1.0-RC2' grailsVersion='2.1.3 &gt; *'>
<author>Sergey Nebolsin, Graeme Rocher</author>
<authorEmail>nebolsin@gmail.com</authorEmail>
<title>Quartz plugin for Grails</title>
@@ -12,19 +12,28 @@
<resource>grails.plugins.quartz.JobManagerService</resource>
</resources>
<repositories>
- <repository name='grailsCentral' url='http://plugins.grails.org' />
- <repository name='http://repo.grails.org/grails/plugins' url='http://repo.grails.org/grails/plugins/' />
+ <repository name='grailsCentral' url='http://grails.org/plugins' />
<repository name='http://repo.grails.org/grails/core' url='http://repo.grails.org/grails/core/' />
- <repository name='grailsCore' url='http://svn.codehaus.org/grails/trunk/grails-plugins' />
<repository name='mavenCentral' url='http://repo1.maven.org/maven2/' />
+ <repository name='http://www.terracotta.org/download/reflector/maven2' url='http://www.terracotta.org/download/reflector/maven2/' />
</repositories>
<dependencies>
- <compile>
- <dependency group='org.hibernate' name='hibernate-core' version='3.6.10.Final' />
- <dependency group='org.quartz-scheduler' name='quartz' version='1.8.4' />
- </compile>
+ <runtime>
+ <dependency group='org.terracotta.quartz' name='quartz-terracotta' version='2.3.0' />
+ <dependency group='net.sf.ehcache' name='ehcache-core' version='2.6.0' />
+ <dependency group='net.sf.ehcache' name='ehcache-terracotta' version='2.6.0' />
+ </runtime>
</dependencies>
- <plugins />
+ <plugins>
+ <runtime>
+ <plugin group='org.grails.plugins' name='hibernate' version='2.1.3' />
+ <plugin group='org.grails.plugins' name='jquery' version='1.7.1' />
+ <plugin group='org.grails.plugins' name='resources' version='1.1.6' />
+ </runtime>
+ <build>
+ <plugin group='org.grails.plugins' name='tomcat' version='2.1.3' />
+ </build>
+ </plugins>
<runtimePluginRequirements />
<behavior />
</plugin>
View
10 src/groovy/grails/plugins/quartz/config/TriggersConfigBuilder.groovy
@@ -65,7 +65,7 @@ public class TriggersConfigBuilder extends BuilderSupport {
protected Object createNode(name, Map attributes, Object value) {
def trigger = createTrigger(name, attributes, value)
- triggers[trigger.triggerAttributes.name] = trigger
+ triggers[trigger.triggerAttributes.name.toString()] = trigger
trigger
}
@@ -100,7 +100,7 @@ public class TriggersConfigBuilder extends BuilderSupport {
case 'custom':
if (!triggerAttributes?.triggerClass) throw new Exception("Custom trigger must have 'triggerClass' attribute")
triggerClass = (Class) triggerAttributes.remove('triggerClass')
- if (!Trigger.isAssignableFrom(triggerClass)) throw new Exception("Custom trigger class must extend org.quartz.Trigger class.")
+ if (!Trigger.isAssignableFrom(triggerClass)) throw new Exception("Custom trigger class must implement org.quartz.Trigger class.")
break
default:
throw new Exception("Invalid format")
@@ -110,16 +110,16 @@ public class TriggersConfigBuilder extends BuilderSupport {
}
private prepareCommonTriggerAttributes(HashMap triggerAttributes) {
- if (triggerAttributes[Constants.NAME] == null) triggerAttributes[Constants.NAME] = "${jobName}${triggerNumber++}"
- if (triggerAttributes[Constants.GROUP] == null) triggerAttributes[Constants.GROUP] = Constants.DEFAULT_TRIGGERS_GROUP
+ if (triggerAttributes[Constants.NAME] == null) triggerAttributes[Constants.NAME] = "${jobName}${triggerNumber++}".toString()
+ if (triggerAttributes[Constants.GROUP] == null) triggerAttributes[Constants.GROUP] = Constants.DEFAULT_TRIGGERS_GROUP.toString()
if (triggerAttributes[Constants.START_DELAY] == null) triggerAttributes[Constants.START_DELAY] = Constants.DEFAULT_START_DELAY
if (!(triggerAttributes[Constants.START_DELAY] instanceof Integer || triggerAttributes[Constants.START_DELAY] instanceof Long)) {
throw new IllegalArgumentException("startDelay trigger property in the job class ${jobName} must be Integer or Long");
}
if (((Number) triggerAttributes[Constants.START_DELAY]).longValue() < 0) {
throw new IllegalArgumentException("startDelay trigger property in the job class ${jobName} is negative (possibly integer overflow error)");
}
- if (triggerAttributes[Constants.VOLATILITY] == null) triggerAttributes[Constants.VOLATILITY] = Constants.DEFAULT_VOLATILITY
+
}
private def prepareSimpleTriggerAttributes(HashMap triggerAttributes) {
View
51 src/java/grails/plugins/quartz/CustomTriggerFactoryBean.java
@@ -16,13 +16,21 @@
package grails.plugins.quartz;
+import org.quartz.CalendarIntervalTrigger;
+import org.quartz.DateBuilder;
import org.quartz.JobDetail;
import org.quartz.Trigger;
+import org.quartz.impl.JobDetailImpl;
+import org.quartz.impl.triggers.CalendarIntervalTriggerImpl;
+import org.quartz.impl.triggers.CoreTrigger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.PropertyAccessorFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
+import static org.quartz.DateBuilder.*;
+import static org.quartz.TriggerBuilder.*;
+import static org.quartz.CronScheduleBuilder.*;
import java.beans.PropertyEditorSupport;
import java.text.ParseException;
@@ -37,23 +45,50 @@
public class CustomTriggerFactoryBean implements FactoryBean, InitializingBean {
private Class<Trigger> triggerClass;
private Trigger customTrigger;
- private JobDetail jobDetail;
+ private JobDetailImpl jobDetail;
private Map triggerAttributes;
public void afterPropertiesSet() throws ParseException {
- customTrigger = BeanUtils.instantiateClass(triggerClass);
+ Trigger customTriggerUser;
+
if (triggerAttributes.containsKey(GrailsJobClassConstants.START_DELAY)) {
Number startDelay = (Number) triggerAttributes.remove(GrailsJobClassConstants.START_DELAY);
- customTrigger.setStartTime(new Date(System.currentTimeMillis() + startDelay.longValue()));
- }
- if (jobDetail != null) {
- customTrigger.setJobName(jobDetail.getName());
- customTrigger.setJobGroup(jobDetail.getGroup());
+ if (jobDetail == null) {
+ customTrigger = newTrigger()
+ .withIdentity((String)triggerAttributes.get("name"),(String)triggerAttributes.get("group"))
+ .startAt(new Date(System.currentTimeMillis() + startDelay.longValue()))
+ .forJob((String)triggerAttributes.get("name"))
+ .build();
+ } else {
+ customTrigger = newTrigger()
+ .withIdentity((String)triggerAttributes.get("name"),(String)triggerAttributes.get("group"))
+ .startAt(new Date(System.currentTimeMillis() + startDelay.longValue()))
+ .forJob(jobDetail)
+ .build();
+ }
+
+ } else {
+ if (jobDetail != null) {
+
+ customTrigger = newTrigger()
+ .withIdentity((String)triggerAttributes.get("name"),(String)triggerAttributes.get("group"))
+ .startAt(new Date(System.currentTimeMillis()))
+ .forJob(jobDetail)
+ .build();
+ } else {
+ customTrigger = newTrigger()
+ .withIdentity((String)triggerAttributes.get("name"),(String)triggerAttributes.get("group"))
+ .startAt(new Date(System.currentTimeMillis()))
+ .forJob((String)triggerAttributes.get("name").toString())
+ .build();
+ }
}
+
+
BeanWrapper customTriggerWrapper = PropertyAccessorFactory.forBeanPropertyAccess(customTrigger);
customTriggerWrapper.registerCustomEditor(String.class, new StringEditor());
customTriggerWrapper.setPropertyValues(triggerAttributes);
@@ -86,7 +121,7 @@ public boolean isSingleton() {
return true;
}
- public void setJobDetail(JobDetail jobDetail) {
+ public void setJobDetail(JobDetailImpl jobDetail) {
this.jobDetail = jobDetail;
}
View
5 src/java/grails/plugins/quartz/DefaultGrailsJobClass.java
@@ -143,11 +143,6 @@ public boolean isSessionRequired() {
return sessionRequired == null ? DEFAULT_SESSION_REQUIRED : sessionRequired;
}
- public boolean getVolatility() {
- Boolean volatility = (Boolean) getPropertyValue(VOLATILITY, Boolean.class);
- return volatility == null ? DEFAULT_VOLATILITY : volatility;
- }
-
public boolean getDurability() {
Boolean durability = (Boolean) getPropertyValue(DURABILITY, Boolean.class);
return durability == null ? DEFAULT_DURABILITY : durability;
View
7 src/java/grails/plugins/quartz/GrailsJobClass.java
@@ -93,13 +93,6 @@
public boolean isSessionRequired();
/**
- * If job is volatile (will not be persisted between Quartz runs) returns true.
- *
- * @return true if this job is volatile
- */
- public boolean getVolatility();
-
- /**
* If job is durable returns true.
*
* @return true if this job is durable
View
4 src/java/grails/plugins/quartz/GrailsJobClassConstants.java
@@ -56,8 +56,6 @@ private GrailsJobClassConstants() {}
public static final String REPEAT_COUNT = "repeatCount";
- public static final String VOLATILITY = "volatility";
-
public static final String DURABILITY = "durability";
public static final String REQUESTS_RECOVERY = "requestsRecovery";
@@ -83,8 +81,6 @@ private GrailsJobClassConstants() {}
public static final String DEFAULT_TRIGGERS_GROUP = "GRAILS_TRIGGERS";
- public static final boolean DEFAULT_VOLATILITY = true;
-
public static final boolean DEFAULT_DURABILITY = true;
public static final boolean DEFAULT_REQUESTS_RECOVERY = false;
View
50 src/java/grails/plugins/quartz/JobDetailFactoryBean.java
@@ -16,11 +16,23 @@
package grails.plugins.quartz;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.groovy.grails.commons.ApplicationHolder;
+import org.codehaus.groovy.grails.web.context.ServletContextHolder;
+import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes;
import org.quartz.JobDetail;
+import org.quartz.ListenerManager;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.impl.JobDetailImpl;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Required;
+import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+import static org.quartz.JobBuilder.*;
+import static org.quartz.impl.matchers.EverythingMatcher.allJobs;
/**
* Simplified version of Spring's <a href='http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.html'>MethodInvokingJobDetailFactoryBean</a>
@@ -36,11 +48,11 @@
private String name;
private String group;
private boolean concurrent;
- private boolean volatility;
private boolean durability;
private boolean requestsRecovery;
private String[] jobListenerNames;
private JobDetail jobDetail;
+ private static Log log = LogFactory.getLog(JobDetailFactoryBean.class);
/**
* Set the name of the job.
@@ -67,7 +79,7 @@ public void setGroup(final String group) {
/**
* Set a list of JobListener names for this job, referring to
- * non-global JobListeners registered with the Scheduler.
+ * JobListeners registered with the Scheduler.
* <p>A JobListener name always refers to the name returned
* by the JobListener implementation.
*
@@ -85,11 +97,6 @@ public void setConcurrent(final boolean concurrent) {
}
@Required
- public void setVolatility(boolean volatility) {
- this.volatility = volatility;
- }
-
- @Required
public void setDurability(boolean durability) {
this.durability = durability;
}
@@ -118,16 +125,31 @@ public void afterPropertiesSet() {
Class jobClass = (concurrent ? GrailsJobFactory.GrailsJob.class : GrailsJobFactory.StatefulGrailsJob.class);
// Build JobDetail instance.
- jobDetail = new JobDetail(name, group, jobClass);
- jobDetail.getJobDataMap().put(JOB_NAME_PARAMETER, name);
- jobDetail.setDurability(durability);
- jobDetail.setVolatility(volatility);
- jobDetail.setRequestsRecovery(requestsRecovery);
+ jobDetail = newJob(jobClass)
+ .withIdentity(name,group)
+ .storeDurably(durability)
+ .requestRecovery(requestsRecovery)
+ .usingJobData(JOB_NAME_PARAMETER, name)
+ .build();
+
+
// Register job listener names.
if (jobListenerNames != null) {
- for (String jobListenerName : jobListenerNames) {
- jobDetail.addJobListener(jobListenerName);
+ ApplicationContext ctx =
+ (ApplicationContext) ApplicationHolder.getApplication().getMainContext();
+ Scheduler quartzScheduler = (Scheduler)ctx.getBean("quartzScheduler");
+ try {
+ ListenerManager manager = quartzScheduler.getListenerManager();
+ for (String jobListenerName : jobListenerNames) {
+
+ // no matcher == match all jobs
+
+ manager.addJobListener(manager.getJobListener(jobListenerName),allJobs());
+
+ }
+ } catch (SchedulerException e) {
+ log.error("Error adding job listener to scheduler:",e);
}
}
}
View
2 src/java/grails/plugins/quartz/listeners/ExceptionPrinterJobListener.java
@@ -39,6 +39,6 @@ public String getName() {
public void jobWasExecuted(JobExecutionContext context, JobExecutionException exception) {
if (exception != null)
- LOG.error("Exception occurred in job: " + context.getJobDetail().getFullName(), exception);
+ LOG.error("Exception occurred in job: " + context.getJobDetail().getDescription(), exception);
}
}
View
139 src/templates/sql/tables_cloudscape.sql
@@ -9,126 +9,133 @@
create table qrtz_job_details (
- job_name varchar(80) not null,
- job_group varchar(80) not null,
- description varchar(120) ,
- job_class_name varchar(128) not null,
+ sched_name varchar(120) not null,
+ job_name varchar(200) not null,
+ job_group varchar(200) not null,
+ description varchar(250) ,
+ job_class_name varchar(250) not null,
is_durable varchar(5) not null,
- is_volatile varchar(5) not null,
- is_stateful varchar(5) not null,
+ is_nonconcurrent varchar(5) not null,
+ is_update_data varchar(5) not null,
requests_recovery varchar(5) not null,
job_data long varbinary,
-primary key (job_name,job_group)
-);
-
-create table qrtz_job_listeners(
- job_name varchar(80) not null,
- job_group varchar(80) not null,
- job_listener varchar(80) not null,
-primary key (job_name,job_group,job_listener),
-foreign key (job_name,job_group) references qrtz_job_details(job_name,job_group)
+primary key (sched_name,job_name,job_group)
);
create table qrtz_triggers(
- trigger_name varchar(80) not null,
- trigger_group varchar(80) not null,
- job_name varchar(80) not null,
- job_group varchar(80) not null,
- is_volatile varchar(5) not null,
- description varchar(120) ,
+ sched_name varchar(120) not null,
+ trigger_name varchar(200) not null,
+ trigger_group varchar(200) not null,
+ job_name varchar(200) not null,
+ job_group varchar(200) not null,
+ description varchar(250) ,
next_fire_time longint,
prev_fire_time longint,
priority integer,
trigger_state varchar(16) not null,
trigger_type varchar(8) not null,
start_time longint not null,
end_time longint,
- calendar_name varchar(80),
+ calendar_name varchar(200),
misfire_instr smallint,
job_data long varbinary,
-primary key (trigger_name,trigger_group),
-foreign key (job_name,job_group) references qrtz_job_details(job_name,job_group)
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,job_name,job_group) references qrtz_job_details(sched_name,job_name,job_group)
);
create table qrtz_simple_triggers(
- trigger_name varchar(80) not null,
- trigger_group varchar(80) not null,
+ sched_name varchar(120) not null,
+ trigger_name varchar(200) not null,
+ trigger_group varchar(200) not null,
repeat_count longint not null,
repeat_interval longint not null,
times_triggered longint not null,
-primary key (trigger_name,trigger_group),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
create table qrtz_cron_triggers(
- trigger_name varchar(80) not null,
- trigger_group varchar(80) not null,
- cron_expression varchar(80) not null,
+ sched_name varchar(120) not null,
+ trigger_name varchar(200) not null,
+ trigger_group varchar(200) not null,
+ cron_expression varchar(120) not null,
time_zone_id varchar(80),
-primary key (trigger_name,trigger_group),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
-create table qrtz_blob_triggers(
- trigger_name varchar(80) not null,
- trigger_group varchar(80) not null,
- blob_data long varbinary ,
-primary key (trigger_name,trigger_group),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+CREATE TABLE qrtz_simprop_triggers
+ (
+ sched_name varchar(120) not null,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ STR_PROP_1 VARCHAR(512) NULL,
+ STR_PROP_2 VARCHAR(512) NULL,
+ STR_PROP_3 VARCHAR(512) NULL,
+ INT_PROP_1 INT NULL,
+ INT_PROP_2 INT NULL,
+ LONG_PROP_1 longint NULL,
+ LONG_PROP_2 longint NULL,
+ DEC_PROP_1 NUMERIC(13,4) NULL,
+ DEC_PROP_2 NUMERIC(13,4) NULL,
+ BOOL_PROP_1 varchar(5) NULL,
+ BOOL_PROP_2 varchar(5) NULL,
+ PRIMARY KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES QRTZ_TRIGGERS(sched_name,TRIGGER_NAME,TRIGGER_GROUP)
);
-create table qrtz_trigger_listeners(
- trigger_name varchar(80) not null,
- trigger_group varchar(80) not null,
- trigger_listener varchar(80) not null,
-primary key (trigger_name,trigger_group,trigger_listener),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+create table qrtz_blob_triggers(
+ sched_name varchar(120) not null,
+ trigger_name varchar(200) not null,
+ trigger_group varchar(200) not null,
+ blob_data long varbinary ,
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
create table qrtz_calendars(
- calendar_name varchar(80) not null,
+ sched_name varchar(120) not null,
+ calendar_name varchar(200) not null,
calendar long varbinary not null,
-primary key (calendar_name)
+primary key (sched_name,calendar_name)
);
create table qrtz_paused_trigger_grps
(
- trigger_group varchar(80) not null,
-primary key (trigger_group)
+ sched_name varchar(120) not null,
+ trigger_group varchar(200) not null,
+primary key (sched_name,trigger_group)
);
create table qrtz_fired_triggers(
+ sched_name varchar(120) not null,
entry_id varchar(95) not null,
- trigger_name varchar(80) not null,
- trigger_group varchar(80) not null,
- is_volatile varchar(5) not null,
- instance_name varchar(80) not null,
+ trigger_name varchar(200) not null,
+ trigger_group varchar(200) not null,
+ instance_name varchar(200) not null,
fired_time longint not null,
priority integer not null,
state varchar(16) not null,
- job_name varchar(80) null,
- job_group varchar(80) null,
- is_stateful varchar(5) null,
+ job_name varchar(200) null,
+ job_group varchar(200) null,
+ is_nonconcurrent varchar(5) null,
requests_recovery varchar(5) null,
-primary key (entry_id)
+primary key (sched_name,entry_id)
);
create table qrtz_scheduler_state
(
- instance_name varchar(80) not null,
+ sched_name varchar(120) not null,
+ instance_name varchar(200) not null,
last_checkin_time longint not null,
checkin_interval longint not null,
-primary key (instance_name)
+primary key (sched_name,instance_name)
);
create table qrtz_locks
(
+ sched_name varchar(120) not null,
lock_name varchar(40) not null,
-primary key (lock_name)
+primary key (sched_name,lock_name)
);
-
-insert into qrtz_locks values('TRIGGER_ACCESS');
-insert into qrtz_locks values('JOB_ACCESS');
-insert into qrtz_locks values('CALENDAR_ACCESS');
-insert into qrtz_locks values('STATE_ACCESS');
-insert into qrtz_locks values('MISFIRE_ACCESS');
View
91 src/templates/sql/tables_db2.sql
@@ -16,32 +16,25 @@
create table qrtz_job_details (
+ sched_name varchar(120) not null,
job_name varchar(80) not null,
job_group varchar(80) not null,
description varchar(120) null,
job_class_name varchar(128) not null,
is_durable varchar(1) not null,
- is_volatile varchar(1) not null,
- is_stateful varchar(1) not null,
+ is_nonconcurrent varchar(1) not null,
+ is_update_data varchar(1) not null,
requests_recovery varchar(1) not null,
job_data blob(2000),
- primary key (job_name,job_group)
-)
-
-create table qrtz_job_listeners(
- job_name varchar(80) not null,
- job_group varchar(80) not null,
- job_listener varchar(80) not null,
- primary key (job_name,job_group,job_listener),
- foreign key (job_name,job_group) references qrtz_job_details(job_name,job_group)
+ primary key (sched_name,job_name,job_group)
)
create table qrtz_triggers(
+ sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
job_name varchar(80) not null,
job_group varchar(80) not null,
- is_volatile varchar(1) not null,
description varchar(120) null,
next_fire_time bigint,
prev_fire_time bigint,
@@ -53,88 +46,102 @@ create table qrtz_triggers(
calendar_name varchar(80),
misfire_instr smallint,
job_data blob(2000),
- primary key (trigger_name,trigger_group),
- foreign key (job_name,job_group) references qrtz_job_details(job_name,job_group)
+ primary key (sched_name,trigger_name,trigger_group),
+ foreign key (sched_name,job_name,job_group) references qrtz_job_details(sched_name,job_name,job_group)
)
create table qrtz_simple_triggers(
+ sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
repeat_count bigint not null,
repeat_interval bigint not null,
times_triggered bigint not null,
- primary key (trigger_name,trigger_group),
- foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+ primary key (sched_name,trigger_name,trigger_group),
+ foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
)
create table qrtz_cron_triggers(
+ sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
- cron_expression varchar(80) not null,
+ cron_expression varchar(120) not null,
time_zone_id varchar(80),
- primary key (trigger_name,trigger_group),
- foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+ primary key (sched_name,trigger_name,trigger_group),
+ foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
)
-create table qrtz_blob_triggers(
- trigger_name varchar(80) not null,
- trigger_group varchar(80) not null,
- blob_data blob(2000) null,
- primary key (trigger_name,trigger_group),
- foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+CREATE TABLE qrtz_simprop_triggers
+ (
+ sched_name varchar(120) not null,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ STR_PROP_1 VARCHAR(512) NULL,
+ STR_PROP_2 VARCHAR(512) NULL,
+ STR_PROP_3 VARCHAR(512) NULL,
+ INT_PROP_1 INT NULL,
+ INT_PROP_2 INT NULL,
+ LONG_PROP_1 BIGINT NULL,
+ LONG_PROP_2 BIGINT NULL,
+ DEC_PROP_1 NUMERIC(13,4) NULL,
+ DEC_PROP_2 NUMERIC(13,4) NULL,
+ BOOL_PROP_1 VARCHAR(1) NULL,
+ BOOL_PROP_2 VARCHAR(1) NULL,
+ PRIMARY KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES QRTZ_TRIGGERS(sched_name,TRIGGER_NAME,TRIGGER_GROUP)
)
-create table qrtz_trigger_listeners(
+create table qrtz_blob_triggers(
+ sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
- trigger_listener varchar(80) not null,
- primary key (trigger_name,trigger_group,trigger_listener),
- foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+ blob_data blob(2000) null,
+ primary key (sched_name,trigger_name,trigger_group),
+ foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
)
create table qrtz_calendars(
+ sched_name varchar(120) not null,
calendar_name varchar(80) not null,
calendar blob(2000) not null,
- primary key (calendar_name)
+ primary key (sched_name,calendar_name)
)
create table qrtz_fired_triggers(
+ sched_name varchar(120) not null,
entry_id varchar(95) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
- is_volatile varchar(1) not null,
instance_name varchar(80) not null,
fired_time bigint not null,
priority integer not null,
state varchar(16) not null,
job_name varchar(80) null,
job_group varchar(80) null,
- is_stateful varchar(1) null,
+ is_nonconcurrent varchar(1) null,
requests_recovery varchar(1) null,
- primary key (entry_id)
+ primary key (sched_name,entry_id)
);
create table qrtz_paused_trigger_grps(
+ sched_name varchar(120) not null,
trigger_group varchar(80) not null,
- primary key (trigger_group)
+ primary key (sched_name,trigger_group)
);
create table qrtz_scheduler_state (
+ sched_name varchar(120) not null,
instance_name varchar(80) not null,
last_checkin_time bigint not null,
checkin_interval bigint not null,
- primary key (instance_name)
+ primary key (sched_name,instance_name)
);
create table qrtz_locks
(
+ sched_name varchar(120) not null,
lock_name varchar(40) not null,
- primary key (lock_name)
+ primary key (sched_name,lock_name)
);
-
-insert into qrtz_locks values('TRIGGER_ACCESS');
-insert into qrtz_locks values('JOB_ACCESS');
-insert into qrtz_locks values('CALENDAR_ACCESS');
-insert into qrtz_locks values('STATE_ACCESS');
-insert into qrtz_locks values('MISFIRE_ACCESS');
View
94 src/templates/sql/tables_db2_v72.sql
@@ -18,46 +18,38 @@
-- that blob - i.e. limits the amount of data you can put into your JobDataMap
--
-DROP TABLE QRTZ_JOB_LISTENERS;
-DROP TABLE QRTZ_TRIGGER_LISTENERS;
DROP TABLE QRTZ_FIRED_TRIGGERS;
DROP TABLE QRTZ_PAUSED_TRIGGER_GRPS;
DROP TABLE QRTZ_SCHEDULER_STATE;
DROP TABLE QRTZ_LOCKS;
DROP TABLE QRTZ_SIMPLE_TRIGGERS;
+DROP TABLE QRTZ_SIMPROP_TRIGGERS;
DROP TABLE QRTZ_CRON_TRIGGERS;
DROP TABLE QRTZ_TRIGGERS;
DROP TABLE QRTZ_JOB_DETAILS;
DROP TABLE QRTZ_CALENDARS;
DROP TABLE QRTZ_BLOB_TRIGGERS;
create table qrtz_job_details (
+ sched_name varchar(120) not null,
job_name varchar(80) not null,
job_group varchar(80) not null,
description varchar(120),
job_class_name varchar(128) not null,
is_durable varchar(1) not null,
- is_volatile varchar(1) not null,
- is_stateful varchar(1) not null,
+ is_nonconcurrent varchar(1) not null,
+ is_update_data varchar(1) not null,
requests_recovery varchar(1) not null,
job_data blob(2000),
- primary key (job_name,job_group)
-);
-
-create table qrtz_job_listeners(
- job_name varchar(80) not null,
- job_group varchar(80) not null,
- job_listener varchar(80) not null,
- primary key (job_name,job_group,job_listener),
- foreign key (job_name,job_group) references qrtz_job_details(job_name,job_group)
+ primary key (sched_name,job_name,job_group)
);
create table qrtz_triggers(
+ sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
job_name varchar(80) not null,
job_group varchar(80) not null,
- is_volatile varchar(1) not null,
description varchar(120),
next_fire_time bigint,
prev_fire_time bigint,
@@ -69,88 +61,102 @@ create table qrtz_triggers(
calendar_name varchar(80),
misfire_instr smallint,
job_data blob(2000),
- primary key (trigger_name,trigger_group),
- foreign key (job_name,job_group) references qrtz_job_details(job_name,job_group)
+ primary key (sched_name,trigger_name,trigger_group),
+ foreign key (sched_name,job_name,job_group) references qrtz_job_details(sched_name,job_name,job_group)
);
create table qrtz_simple_triggers(
+ sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
repeat_count bigint not null,
repeat_interval bigint not null,
times_triggered bigint not null,
- primary key (trigger_name,trigger_group),
- foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+ primary key (sched_name,trigger_name,trigger_group),
+ foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
create table qrtz_cron_triggers(
+ sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
- cron_expression varchar(80) not null,
+ cron_expression varchar(120) not null,
time_zone_id varchar(80),
- primary key (trigger_name,trigger_group),
- foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+ primary key (sched_name,trigger_name,trigger_group),
+ foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
-create table qrtz_blob_triggers(
- trigger_name varchar(80) not null,
- trigger_group varchar(80) not null,
- blob_data blob(2000),
- primary key (trigger_name,trigger_group),
- foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+CREATE TABLE qrtz_simprop_triggers
+ (
+ sched_name varchar(120) not null,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ STR_PROP_1 VARCHAR(512) NULL,
+ STR_PROP_2 VARCHAR(512) NULL,
+ STR_PROP_3 VARCHAR(512) NULL,
+ INT_PROP_1 INT NULL,
+ INT_PROP_2 INT NULL,
+ LONG_PROP_1 BIGINT NULL,
+ LONG_PROP_2 BIGINT NULL,
+ DEC_PROP_1 NUMERIC(13,4) NULL,
+ DEC_PROP_2 NUMERIC(13,4) NULL,
+ BOOL_PROP_1 VARCHAR(1) NULL,
+ BOOL_PROP_2 VARCHAR(1) NULL,
+ PRIMARY KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES QRTZ_TRIGGERS(sched_name,TRIGGER_NAME,TRIGGER_GROUP)
);
-create table qrtz_trigger_listeners(
+create table qrtz_blob_triggers(
+ sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
- trigger_listener varchar(80) not null,
- primary key (trigger_name,trigger_group,trigger_listener),
- foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+ blob_data blob(2000),
+ primary key (sched_name,trigger_name,trigger_group),
+ foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
create table qrtz_calendars(
+ sched_name varchar(120) not null,
calendar_name varchar(80) not null,
calendar blob(2000) not null,
- primary key (calendar_name)
+ primary key (sched_name,calendar_name)
);
create table qrtz_fired_triggers(
+ sched_name varchar(120) not null,
entry_id varchar(95) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
- is_volatile varchar(1) not null,
instance_name varchar(80) not null,
fired_time bigint not null,
priority integer not null,
state varchar(16) not null,
job_name varchar(80),
job_group varchar(80),
- is_stateful varchar(1),
+ is_nonconcurrent varchar(1),
requests_recovery varchar(1),
- primary key (entry_id)
+ primary key (sched_name,entry_id)
);
create table qrtz_paused_trigger_grps(
+ sched_name varchar(120) not null,
trigger_group varchar(80) not null,
- primary key (trigger_group)
+ primary key (sched_name,trigger_group)
);
create table qrtz_scheduler_state (
+ sched_name varchar(120) not null,
instance_name varchar(80) not null,
last_checkin_time bigint not null,
checkin_interval bigint not null,
- primary key (instance_name)
+ primary key (sched_name,instance_name)
);
create table qrtz_locks
(
+ sched_name varchar(120) not null,
lock_name varchar(40) not null,
- primary key (lock_name)
+ primary key (sched_name,lock_name)
);
-
-insert into qrtz_locks values('TRIGGER_ACCESS');
-insert into qrtz_locks values('JOB_ACCESS');
-insert into qrtz_locks values('CALENDAR_ACCESS');
-insert into qrtz_locks values('STATE_ACCESS');
-insert into qrtz_locks values('MISFIRE_ACCESS');
View
92 src/templates/sql/tables_db2_v8.sql
@@ -8,46 +8,38 @@
#
-DROP TABLE QRTZ_JOB_LISTENERS;
-DROP TABLE QRTZ_TRIGGER_LISTENERS;
DROP TABLE QRTZ_FIRED_TRIGGERS;
DROP TABLE QRTZ_PAUSED_TRIGGER_GRPS;
DROP TABLE QRTZ_SCHEDULER_STATE;
DROP TABLE QRTZ_LOCKS;
DROP TABLE QRTZ_SIMPLE_TRIGGERS;
+DROP TABLE QRTZ_SIMPROP_TRIGGERS;
DROP TABLE QRTZ_CRON_TRIGGERS;
DROP TABLE QRTZ_TRIGGERS;
DROP TABLE QRTZ_JOB_DETAILS;
DROP TABLE QRTZ_CALENDARS;
DROP TABLE QRTZ_BLOB_TRIGGERS;
create table qrtz_job_details(
+sched_name varchar(120) not null,
job_name varchar(80) not null,
job_group varchar(80) not null,
description varchar(120),
job_class_name varchar(128) not null,
is_durable integer not null,
-is_volatile integer not null,
-is_stateful integer not null,
+is_nonconcurrent integer not null,
+is_update_data integer not null,
requests_recovery integer not null,
job_data blob(2000),
-primary key (job_name,job_group)
-);
-
-create table qrtz_job_listeners(
-job_name varchar(80) not null,
-job_group varchar(80) not null,
-job_listener varchar(80) not null,
-primary key (job_name,job_group,job_listener),
-foreign key (job_name,job_group) references qrtz_job_details(job_name,job_group)
+primary key (sched_name,job_name,job_group)
);
create table qrtz_triggers(
+sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
job_name varchar(80) not null,
job_group varchar(80) not null,
-is_volatile integer not null,
description varchar(120),
next_fire_time bigint,
prev_fire_time bigint,
@@ -59,86 +51,100 @@ end_time bigint,
calendar_name varchar(80),
misfire_instr smallint,
job_data blob(2000),
-primary key (trigger_name,trigger_group),
-foreign key (job_name,job_group) references qrtz_job_details(job_name,job_group)
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,job_name,job_group) references qrtz_job_details(sched_name,job_name,job_group)
);
create table qrtz_simple_triggers(
+sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
repeat_count bigint not null,
repeat_interval bigint not null,
times_triggered bigint not null,
-primary key (trigger_name,trigger_group),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
create table qrtz_cron_triggers(
+sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
-cron_expression varchar(80) not null,
+cron_expression varchar(120) not null,
time_zone_id varchar(80),
-primary key (trigger_name,trigger_group),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
-create table qrtz_blob_triggers(
-trigger_name varchar(80) not null,
-trigger_group varchar(80) not null,
-blob_data blob(2000),
-primary key (trigger_name,trigger_group),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+CREATE TABLE qrtz_simprop_triggers
+ (
+ sched_name varchar(120) not null,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ STR_PROP_1 VARCHAR(512) NULL,
+ STR_PROP_2 VARCHAR(512) NULL,
+ STR_PROP_3 VARCHAR(512) NULL,
+ INT_PROP_1 INT NULL,
+ INT_PROP_2 INT NULL,
+ LONG_PROP_1 BIGINT NULL,
+ LONG_PROP_2 BIGINT NULL,
+ DEC_PROP_1 NUMERIC(13,4) NULL,
+ DEC_PROP_2 NUMERIC(13,4) NULL,
+ BOOL_PROP_1 VARCHAR(1) NULL,
+ BOOL_PROP_2 VARCHAR(1) NULL,
+ PRIMARY KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES QRTZ_TRIGGERS(sched_name,TRIGGER_NAME,TRIGGER_GROUP)
);
-create table qrtz_trigger_listeners(
+create table qrtz_blob_triggers(
+sched_name varchar(120) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
-trigger_listener varchar(80) not null,
-primary key (trigger_name,trigger_group,trigger_listener),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+blob_data blob(2000),
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
create table qrtz_calendars(
+sched_name varchar(120) not null,
calendar_name varchar(80) not null,
calendar blob(2000) not null,
primary key (calendar_name)
);
create table qrtz_fired_triggers(
+sched_name varchar(120) not null,
entry_id varchar(95) not null,
trigger_name varchar(80) not null,
trigger_group varchar(80) not null,
-is_volatile integer not null,
instance_name varchar(80) not null,
fired_time bigint not null,
priority integer not null,
state varchar(16) not null,
job_name varchar(80),
job_group varchar(80),
-is_stateful integer,
+is_nonconcurrent integer,
requests_recovery integer,
-primary key (entry_id)
+primary key (sched_name,entry_id)
);
create table qrtz_paused_trigger_grps(
+sched_name varchar(120) not null,
trigger_group varchar(80) not null,
-primary key (trigger_group)
+primary key (sched_name,trigger_group)
);
create table qrtz_scheduler_state(
+sched_name varchar(120) not null,
instance_name varchar(80) not null,
last_checkin_time bigint not null,
checkin_interval bigint not null,
-primary key (instance_name)
+primary key (sched_name,instance_name)
);
create table qrtz_locks(
+sched_name varchar(120) not null,
lock_name varchar(40) not null,
-primary key (lock_name)
+primary key (sched_name,lock_name)
);
-
-insert into qrtz_locks values('TRIGGER_ACCESS');
-insert into qrtz_locks values('JOB_ACCESS');
-insert into qrtz_locks values('CALENDAR_ACCESS');
-insert into qrtz_locks values('STATE_ACCESS');
-insert into qrtz_locks values('MISFIRE_ACCESS');
View
140 src/templates/sql/tables_db2_v95.sql
@@ -0,0 +1,140 @@
+DROP TABLE QRTZ_FIRED_TRIGGERS;
+DROP TABLE QRTZ_PAUSED_TRIGGER_GRPS;
+DROP TABLE QRTZ_SCHEDULER_STATE;
+DROP TABLE QRTZ_LOCKS;
+DROP TABLE QRTZ_SIMPLE_TRIGGERS;
+DROP TABLE QRTZ_SIMPROP_TRIGGERS;
+DROP TABLE QRTZ_CRON_TRIGGERS;
+DROP TABLE QRTZ_TRIGGERS;
+DROP TABLE QRTZ_JOB_DETAILS;
+DROP TABLE QRTZ_CALENDARS;
+DROP TABLE QRTZ_BLOB_TRIGGERS;
+
+create table qrtz_job_details(
+sched_name varchar(120) not null,
+job_name varchar(80) not null,
+job_group varchar(80) not null,
+description varchar(120),
+job_class_name varchar(128) not null,
+is_durable integer not null,
+is_nonconcurrent integer not null,
+is_update_data integer not null,
+requests_recovery integer not null,
+job_data blob(2000),
+primary key (sched_name,job_name,job_group)
+);
+
+create table qrtz_triggers(
+sched_name varchar(120) not null,
+trigger_name varchar(80) not null,
+trigger_group varchar(80) not null,
+job_name varchar(80) not null,
+job_group varchar(80) not null,
+description varchar(120),
+next_fire_time bigint,
+prev_fire_time bigint,
+priority integer,
+trigger_state varchar(16) not null,
+trigger_type varchar(8) not null,
+start_time bigint not null,
+end_time bigint,
+calendar_name varchar(80),
+misfire_instr smallint,
+job_data blob(2000),
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,job_name,job_group) references qrtz_job_details(sched_name,job_name,job_group)
+);
+
+create table qrtz_simple_triggers(
+sched_name varchar(120) not null,
+trigger_name varchar(80) not null,
+trigger_group varchar(80) not null,
+repeat_count bigint not null,
+repeat_interval bigint not null,
+times_triggered bigint not null,
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
+);
+
+create table qrtz_cron_triggers(
+sched_name varchar(120) not null,
+trigger_name varchar(80) not null,
+trigger_group varchar(80) not null,
+cron_expression varchar(120) not null,
+time_zone_id varchar(80),
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
+);
+
+CREATE TABLE qrtz_simprop_triggers
+ (
+ sched_name varchar(120) not null,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ STR_PROP_1 VARCHAR(512),
+ STR_PROP_2 VARCHAR(512),
+ STR_PROP_3 VARCHAR(512),
+ INT_PROP_1 INT,
+ INT_PROP_2 INT,
+ LONG_PROP_1 BIGINT,
+ LONG_PROP_2 BIGINT,
+ DEC_PROP_1 NUMERIC(13,4),
+ DEC_PROP_2 NUMERIC(13,4),
+ BOOL_PROP_1 VARCHAR(1),
+ BOOL_PROP_2 VARCHAR(1),
+ PRIMARY KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (sched_name,TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES QRTZ_TRIGGERS(sched_name,TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+create table qrtz_blob_triggers(
+sched_name varchar(120) not null,
+trigger_name varchar(80) not null,
+trigger_group varchar(80) not null,
+blob_data blob(2000),
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
+);
+
+create table qrtz_calendars(
+sched_name varchar(120) not null,
+calendar_name varchar(80) not null,
+calendar blob(2000) not null,
+primary key (calendar_name)
+);
+
+create table qrtz_fired_triggers(
+sched_name varchar(120) not null,
+entry_id varchar(95) not null,
+trigger_name varchar(80) not null,
+trigger_group varchar(80) not null,
+instance_name varchar(80) not null,
+fired_time bigint not null,
+priority integer not null,
+state varchar(16) not null,
+job_name varchar(80),
+job_group varchar(80),
+is_nonconcurrent integer,
+requests_recovery integer,
+primary key (sched_name,entry_id)
+);
+
+create table qrtz_paused_trigger_grps(
+sched_name varchar(120) not null,
+trigger_group varchar(80) not null,
+primary key (sched_name,trigger_group)
+);
+
+create table qrtz_scheduler_state(
+sched_name varchar(120) not null,
+instance_name varchar(80) not null,
+last_checkin_time bigint not null,
+checkin_interval bigint not null,
+primary key (sched_name,instance_name)
+);
+
+create table qrtz_locks(
+sched_name varchar(120) not null,
+lock_name varchar(40) not null,
+primary key (sched_name,lock_name)
+);
View
208 src/templates/sql/tables_derby.sql
@@ -1,133 +1,173 @@
--
--- Apache Derby scripts by Steve Stewart.
+-- Apache Derby scripts by Steve Stewart, updated by Ronald Pomeroy
-- Based on Srinivas Venkatarangaiah's file for Cloudscape
--
--- In your Quartz properties file, you'll need to set
--- org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.CloudscapeDelegate
---
--- Known to work with Apache Derby 10.0.2.1
---
+-- Known to work with Apache Derby 10.0.2.1, or 10.6.2.1
+--
+-- Updated by Zemian Deng <saltnlight5@gmail.com> on 08/21/2011
+-- * Fixed nullable fields on qrtz_simprop_triggers table.
+-- * Added Derby QuickStart comments and drop tables statements.
+--
+-- DerbyDB + Quartz Quick Guide:
+-- * Derby comes with Oracle JDK! For Java6, it default install into C:/Program Files/Sun/JavaDB on Windows.
+-- 1. Create a derby.properties file under JavaDB directory, and have the following:
+-- derby.connection.requireAuthentication = true
+-- derby.authentication.provider = BUILTIN
+-- derby.user.quartz2=quartz2123
+-- 2. Start the DB server by running bin/startNetworkServer script.
+-- 3. On a new terminal, run bin/ij tool to bring up an SQL prompt, then run:
+-- connect 'jdbc:derby://localhost:1527/quartz2;user=quartz2;password=quartz2123;create=true';
+-- run 'quartz/docs/dbTables/tables_derby.sql';
+-- Now in quartz.properties, you may use these properties:
+-- org.quartz.dataSource.quartzDataSource.driver = org.apache.derby.jdbc.ClientDriver
+-- org.quartz.dataSource.quartzDataSource.URL = jdbc:derby://localhost:1527/quartz2
+-- org.quartz.dataSource.quartzDataSource.user = quartz2
+-- org.quartz.dataSource.quartzDataSource.password = quartz2123
+--
+
+-- Auto drop and reset tables
+-- Derby doesn't support if exists condition on table drop, so user must manually do this step if needed to.
+-- drop table qrtz_fired_triggers;
+-- drop table qrtz_paused_trigger_grps;
+-- drop table qrtz_scheduler_state;
+-- drop table qrtz_locks;
+-- drop table qrtz_simple_triggers;
+-- drop table qrtz_simprop_triggers;
+-- drop table qrtz_cron_triggers;
+-- drop table qrtz_blob_triggers;
+-- drop table qrtz_triggers;
+-- drop table qrtz_job_details;
+-- drop table qrtz_calendars;
create table qrtz_job_details (
-job_name varchar(80) not null,
-job_group varchar(80) not null,
-description varchar(120) ,
-job_class_name varchar(128) not null,
+sched_name varchar(120) not null,
+job_name varchar(200) not null,
+job_group varchar(200) not null,
+description varchar(250) ,
+job_class_name varchar(250) not null,
is_durable varchar(5) not null,
-is_volatile varchar(5) not null,
-is_stateful varchar(5) not null,
+is_nonconcurrent varchar(5) not null,
+is_update_data varchar(5) not null,
requests_recovery varchar(5) not null,
job_data blob,
-primary key (job_name,job_group)
+primary key (sched_name,job_name,job_group)
);
-create table qrtz_job_listeners (
-job_name varchar(80) not null,
-job_group varchar(80) not null,
-job_listener varchar(80) not null,
-primary key (job_name,job_group,job_listener),
-foreign key (job_name,job_group) references qrtz_job_details(job_name,job_group)
-);
-
-create table qrtz_triggers (
-trigger_name varchar(80) not null,
-trigger_group varchar(80) not null,
-job_name varchar(80) not null,
-job_group varchar(80) not null,
-is_volatile varchar(5) not null,
-description varchar(120) ,
+create table qrtz_triggers(
+sched_name varchar(120) not null,
+trigger_name varchar(200) not null,
+trigger_group varchar(200) not null,
+job_name varchar(200) not null,
+job_group varchar(200) not null,
+description varchar(250),
next_fire_time bigint,
prev_fire_time bigint,
priority integer,
trigger_state varchar(16) not null,
trigger_type varchar(8) not null,
start_time bigint not null,
end_time bigint,
-calendar_name varchar(80),
+calendar_name varchar(200),
misfire_instr smallint,
job_data blob,
-primary key (trigger_name,trigger_group),
-foreign key (job_name,job_group) references qrtz_job_details(job_name,job_group)
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,job_name,job_group) references qrtz_job_details(sched_name,job_name,job_group)
);
-create table qrtz_simple_triggers (
-trigger_name varchar(80) not null,
-trigger_group varchar(80) not null,
+create table qrtz_simple_triggers(
+sched_name varchar(120) not null,
+trigger_name varchar(200) not null,
+trigger_group varchar(200) not null,
repeat_count bigint not null,
repeat_interval bigint not null,
times_triggered bigint not null,
-primary key (trigger_name,trigger_group),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
-create table qrtz_cron_triggers (
-trigger_name varchar(80) not null,
-trigger_group varchar(80) not null,
-cron_expression varchar(80) not null,
+create table qrtz_cron_triggers(
+sched_name varchar(120) not null,
+trigger_name varchar(200) not null,
+trigger_group varchar(200) not null,
+cron_expression varchar(120) not null,
time_zone_id varchar(80),
-primary key (trigger_name,trigger_group),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
-create table qrtz_blob_triggers (
-trigger_name varchar(80) not null,
-trigger_group varchar(80) not null,
-blob_data blob ,
-primary key (trigger_name,trigger_group),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+create table qrtz_simprop_triggers
+ (
+ sched_name varchar(120) not null,
+ trigger_name varchar(200) not null,
+ trigger_group varchar(200) not null,
+ str_prop_1 varchar(512),
+ str_prop_2 varchar(512),
+ str_prop_3 varchar(512),
+ int_prop_1 int,
+ int_prop_2 int,
+ long_prop_1 bigint,
+ long_prop_2 bigint,
+ dec_prop_1 numeric(13,4),
+ dec_prop_2 numeric(13,4),
+ bool_prop_1 varchar(5),
+ bool_prop_2 varchar(5),
+ primary key (sched_name,trigger_name,trigger_group),
+ foreign key (sched_name,trigger_name,trigger_group)
+ references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
-create table qrtz_trigger_listeners (
-trigger_name varchar(80) not null,
-trigger_group varchar(80) not null,
-trigger_listener varchar(80) not null,
-primary key (trigger_name,trigger_group,trigger_listener),
-foreign key (trigger_name,trigger_group) references qrtz_triggers(trigger_name,trigger_group)
+create table qrtz_blob_triggers(
+sched_name varchar(120) not null,
+trigger_name varchar(200) not null,
+trigger_group varchar(200) not null,
+blob_data blob,
+primary key (sched_name,trigger_name,trigger_group),
+foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group)
);
-create table qrtz_calendars (
-calendar_name varchar(80) not null,
+create table qrtz_calendars(
+sched_name varchar(120) not null,
+calendar_name varchar(200) not null,
calendar blob not null,
-primary key (calendar_name)
+primary key (sched_name,calendar_name)
);