Anonymous avatar Anonymous committed 24955ff

Applying my patch from QUARTZ-600

git-svn-id: http://svn.opensymphony.com/svn/quartz/trunk@752 69f7d36a-ea1c-0410-88ea-9fd03e4c9665

Comments (0)

Files changed (7)

src/java/org/quartz/CronTrigger.java

      */
 
     /**
+     * Required for serialization support. Introduced in Quartz 1.6.1 to 
+     * maintain compatibility after the introduction of hasAdditionalProperties
+     * method. 
+     * 
+     * @see java.io.Serializable
+     */
+    private static final long serialVersionUID = -8644953146451592766L;
+
+    /**
      * <p>
      * Instructs the <code>{@link Scheduler}</code> that upon a mis-fire
      * situation, the <code>{@link CronTrigger}</code> wants to be fired now
         return cronEx == null ? null : cronEx.getExpressionSummary();
     }
 
+    /**
+     * Used by extensions of CronTrigger to imply that there are additional 
+     * properties, specifically so that extensions can choose whether to be 
+     * stored as a serialized blob, or as a flattened CronTrigger table. 
+     */
+    public boolean hasAdditionalProperties() { 
+        return false;
+    }
+
     ////////////////////////////////////////////////////////////////////////////
     //
     // Computation Functions

src/java/org/quartz/SimpleTrigger.java

      */
 
     /**
+     * Required for serialization support. Introduced in Quartz 1.6.1 to 
+     * maintain compatibility after the introduction of hasAdditionalProperties
+     * method. 
+     * 
+     * @see java.io.Serializable
+     */
+    private static final long serialVersionUID = -3735980074222850397L;
+
+    /**
      * <p>
      * Instructs the <code>{@link Scheduler}</code> that upon a mis-fire
      * situation, the <code>{@link SimpleTrigger}</code> wants to be fired
         }
     }
 
+    /**
+     * Used by extensions of SimpleTrigger to imply that there are additional 
+     * properties, specifically so that extensions can choose whether to be 
+     * stored as a serialized blob, or as a flattened SimpleTrigger table. 
+     */
+    public boolean hasAdditionalProperties() {
+        return false;
+    }
+
     public static void main(String[] args) // TODO: remove method after good
             // unit testing
         throws Exception {

src/java/org/quartz/impl/jdbcjobstore/JobStoreSupport.java

             }
             
             if (existingTrigger) {
-                if (newTrigger.getClass() == SimpleTrigger.class) {
+                if (newTrigger instanceof SimpleTrigger && ((SimpleTrigger)newTrigger).hasAdditionalProperties() == false ) {
                     getDelegate().updateSimpleTrigger(conn,
                             (SimpleTrigger) newTrigger);
-                } else if (newTrigger.getClass() == CronTrigger.class) {
+                } else if (newTrigger instanceof CronTrigger && ((CronTrigger)newTrigger).hasAdditionalProperties() == false ) {
                     getDelegate().updateCronTrigger(conn,
                             (CronTrigger) newTrigger);
                 } else {
                 getDelegate().updateTrigger(conn, newTrigger, state, job);
             } else {
                 getDelegate().insertTrigger(conn, newTrigger, state, job);
-                if (newTrigger.getClass() == SimpleTrigger.class) {
+                if (newTrigger instanceof SimpleTrigger && ((SimpleTrigger)newTrigger).hasAdditionalProperties() == false ) {
                     getDelegate().insertSimpleTrigger(conn,
                             (SimpleTrigger) newTrigger);
-                } else if (newTrigger.getClass() == CronTrigger.class) {
+                } else if (newTrigger instanceof CronTrigger && ((CronTrigger)newTrigger).hasAdditionalProperties() == false ) {
                     getDelegate().insertCronTrigger(conn,
                             (CronTrigger) newTrigger);
                 } else {

src/java/org/quartz/impl/jdbcjobstore/PointbaseDelegate.java

             }
             ps.setBigDecimal(8, new BigDecimal(String.valueOf(prevFireTime)));
             ps.setString(9, state);
-            if (trigger.getClass() == SimpleTrigger.class) {
+            if (trigger instanceof SimpleTrigger && ((SimpleTrigger)trigger).hasAdditionalProperties() == false ) {
                 ps.setString(10, TTYPE_SIMPLE);
-            } else if (trigger.getClass() == CronTrigger.class) {
+            } else if (trigger instanceof CronTrigger && ((CronTrigger)trigger).hasAdditionalProperties() == false ) {
                 ps.setString(10, TTYPE_CRON);
             } else {
                 ps.setString(10, TTYPE_BLOB);
             }
             ps.setBigDecimal(6, new BigDecimal(String.valueOf(prevFireTime)));
             ps.setString(7, state);
-            if (trigger.getClass() == SimpleTrigger.class) {
+            if (trigger instanceof SimpleTrigger && ((SimpleTrigger)trigger).hasAdditionalProperties() == false ) {
                 //                updateSimpleTrigger(conn, (SimpleTrigger)trigger);
                 ps.setString(8, TTYPE_SIMPLE);
-            } else if (trigger.getClass() == CronTrigger.class) {
+            } else if (trigger instanceof CronTrigger && ((CronTrigger)trigger).hasAdditionalProperties() == false ) {
                 //                updateCronTrigger(conn, (CronTrigger)trigger);
                 ps.setString(8, TTYPE_CRON);
             } else {

src/java/org/quartz/impl/jdbcjobstore/StdJDBCDelegate.java

             }
             ps.setBigDecimal(8, new BigDecimal(String.valueOf(prevFireTime)));
             ps.setString(9, state);
-            if (trigger.getClass() == SimpleTrigger.class) {
+            if (trigger instanceof SimpleTrigger && ((SimpleTrigger)trigger).hasAdditionalProperties() == false ) {
                 ps.setString(10, TTYPE_SIMPLE);
-            } else if (trigger.getClass() == CronTrigger.class) {
+            } else if (trigger instanceof CronTrigger && ((CronTrigger)trigger).hasAdditionalProperties() == false ) {
                 ps.setString(10, TTYPE_CRON);
             } else {
                 ps.setString(10, TTYPE_BLOB);
             }
             ps.setBigDecimal(6, new BigDecimal(String.valueOf(prevFireTime)));
             ps.setString(7, state);
-            if (trigger.getClass() == SimpleTrigger.class) {
+            if (trigger instanceof SimpleTrigger && ((SimpleTrigger)trigger).hasAdditionalProperties() == false ) {
                 //                updateSimpleTrigger(conn, (SimpleTrigger)trigger);
                 ps.setString(8, TTYPE_SIMPLE);
-            } else if (trigger.getClass() == CronTrigger.class) {
+            } else if (trigger instanceof CronTrigger && ((CronTrigger)trigger).hasAdditionalProperties() == false ) {
                 //                updateCronTrigger(conn, (CronTrigger)trigger);
                 ps.setString(8, TTYPE_CRON);
             } else {

src/oracle/org/quartz/impl/jdbcjobstore/oracle/OracleDelegate.java

             }
             ps.setBigDecimal(8, new BigDecimal(String.valueOf(prevFireTime)));
             ps.setString(9, state);
-            if (trigger.getClass() == SimpleTrigger.class) {
+            if (trigger instanceof SimpleTrigger && ((SimpleTrigger)trigger).hasAdditionalProperties() == false ) {
                 ps.setString(10, TTYPE_SIMPLE);
-            } else if (trigger.getClass() == CronTrigger.class) {
+            } else if (trigger instanceof CronTrigger && ((CronTrigger)trigger).hasAdditionalProperties() == false ) {
                 ps.setString(10, TTYPE_CRON);
             } else {
                 ps.setString(10, TTYPE_BLOB);
             }
             ps.setBigDecimal(6, new BigDecimal(String.valueOf(prevFireTime)));
             ps.setString(7, state);
-            if (trigger.getClass() == SimpleTrigger.class) {
+            if (trigger instanceof SimpleTrigger && ((SimpleTrigger)trigger).hasAdditionalProperties() == false ) {
                 //                updateSimpleTrigger(conn, (SimpleTrigger)trigger);
                 ps.setString(8, TTYPE_SIMPLE);
-            } else if (trigger.getClass() == CronTrigger.class) {
+            } else if (trigger instanceof CronTrigger && ((CronTrigger)trigger).hasAdditionalProperties() == false ) {
                 //                updateCronTrigger(conn, (CronTrigger)trigger);
                 ps.setString(8, TTYPE_CRON);
             } else {

webapp/src/org/quartz/ui/web/Util.java

             return null;
         }
         
-        if (trigger.getClass() == SimpleTrigger.class)
+        if (trigger instanceof SimpleTrigger && ((SimpleTrigger)trigger).hasAdditionalProperties() == false ) {
         {
             type = "simple";
         }
-        else if (trigger.getClass() == CronTrigger.class)
+        else if (trigger instanceof CronTrigger && ((CronTrigger)trigger).hasAdditionalProperties() == false ) {
         {
             type = "cron";
         }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.