Commits

adib_acsp  committed 5847b56

I. JavaDocs corrections.
II. makeSecondlyTrigger(name, interval, repeat) ignored the repeat count.
III. makeMinutelyTrigger(name, interval, repeat) ignored the repeat count.

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

  • Participants
  • Parent commits a5ee1a4

Comments (0)

Files changed (1)

File src/java/org/quartz/TriggerUtils.java

      * Set the given <code>Trigger</code>'s name to the given value, and its
      * group to the default group (<code>Scheduler.DEFAULT_GROUP</code>).
      * </p>
+     * 
+     * @param trig the tigger to change name to 
+     * @param name the new trigger name
      */
     public static void setTriggerIdentity(Trigger trig, String name) {
-        trig.setName(name);
-        trig.setGroup(Scheduler.DEFAULT_GROUP);
+        setTriggerIdentity(trig, name, Scheduler.DEFAULT_GROUP);
     }
 
     /**
      * Set the given <code>Trigger</code>'s name to the given value, and its
      * group to the given group.
      * </p>
+     * 
+     * @param trig the tigger to change name to 
+     * @param name the new trigger name
+     * @param group the new trigger group
      */
-    public static void setTriggerIdentity(Trigger trig, String name,
-            String group) {
+    public static void setTriggerIdentity(
+            Trigger trig, String name, String group) {
         trig.setName(name);
         trig.setGroup(group);
     }
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param hour
-     *          the hour (0-23) upon which to fire
-     * @param minute
-     *          the minute (0-59) upon which to fire
+     * @param hour the hour (0-23) upon which to fire
+     * @param minute the minute (0-59) upon which to fire
+     * @return the new trigger
      */
     public static Trigger makeDailyTrigger(int hour, int minute) {
         validateHour(hour);
      * The Start time defaults to 'now'.
      * </p>
      * 
-     * @param hour
-     *          the hour (0-23) upon which to fire
-     * @param minute
-     *          the minute (0-59) upon which to fire
+     * @param trigName the trigger's name 
+     * @param hour the hour (0-23) upon which to fire
+     * @param minute the minute (0-59) upon which to fire
+     * @return the newly created trigger
      */
-    public static Trigger makeDailyTrigger(String trigName, int hour, int minute) {
+    public static Trigger makeDailyTrigger(
+            String trigName, int hour, int minute) {
         Trigger trig = makeDailyTrigger(hour, minute);
         trig.setName(trigName);
         return trig;
     
     /**
      * <p>
-     * Make a trigger that will fire every day at the given time.
+     * Make a trigger that will fire every week at the given day and time.
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param dayOfWeek
-     *          (1-7) the day of week upon which to fire
-     * @param hour
-     *          the hour (0-23) upon which to fire
-     * @param minute
-     *          the minute (0-59) upon which to fire
+     * @param dayOfWeek (1-7) the day of week upon which to fire
+     * @param hour the hour (0-23) upon which to fire
+     * @param minute the minute (0-59) upon which to fire
+     * @return the new trigger
      * 
      * @see #SUNDAY
      * @see #MONDAY
      * @see #FRIDAY
      * @see #SATURDAY
      */
-    public static Trigger makeWeeklyTrigger(int dayOfWeek, int hour, int minute) {
+    public static Trigger makeWeeklyTrigger(
+            int dayOfWeek, int hour, int minute) {
         validateDayOfWeek(dayOfWeek);
         validateHour(hour);
         validateMinute(minute);
 
     /**
      * <p>
-     * Make a trigger that will fire every day at the given time.
+     * Make a trigger that will fire every week at the given day and time.
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its group,
+     * The generated trigger will not have its group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param dayOfWeek
-     *          (1-7) the day of week upon which to fire
-     * @param hour
-     *          the hour (0-23) upon which to fire
-     * @param minute
-     *          the minute (0-59) upon which to fire
+     * @param trigName the trigger's name
+     * @param dayOfWeek (1-7) the day of week upon which to fire
+     * @param hour the hour (0-23) upon which to fire
+     * @param minute the minute (0-59) upon which to fire
+     * @return the newly created trigger
      * 
      * @see #SUNDAY
      * @see #MONDAY
      * @see #FRIDAY
      * @see #SATURDAY
      */
-    public static Trigger makeWeeklyTrigger(String trigName, int dayOfWeek, int hour, int minute) {
+    public static Trigger makeWeeklyTrigger(
+            String trigName, int dayOfWeek, int hour, int minute) {
         Trigger trig = makeWeeklyTrigger(dayOfWeek, hour, minute);
         trig.setName(trigName);
         return trig;
     
     /**
      * <p>
-     * Make a trigger that will fire every day at the given time.
+     * Make a trigger that will fire every month at the given day and time.
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
      * days).
      * </p>
      * 
-     * @param dayOfMonth
-     *          (1-31, or -1) the day of week upon which to fire
-     * @param hour
-     *          the hour (0-23) upon which to fire
-     * @param minute
-     *          the minute (0-59) upon which to fire
+     * @param dayOfMonth (1-31, or -1) the day of week upon which to fire
+     * @param hour the hour (0-23) upon which to fire
+     * @param minute the minute (0-59) upon which to fire
+     * @return the newly created trigger
      */
-    public static Trigger makeMonthlyTrigger(int dayOfMonth, int hour,
-            int minute) {
+    public static Trigger makeMonthlyTrigger(
+            int dayOfMonth, int hour, int minute) {
         validateDayOfMonth(dayOfMonth);
         validateHour(hour);
         validateMinute(minute);
 
     /**
      * <p>
-     * Make a trigger that will fire every day at the given time.
+     * Make a trigger that will fire every month at the given day and time.
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its group,
+     * The generated trigger will not have its group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
      * days).
      * </p>
      * 
-     * @param dayOfMonth
-     *          (1-31, or -1) the day of week upon which to fire
-     * @param hour
-     *          the hour (0-23) upon which to fire
-     * @param minute
-     *          the minute (0-59) upon which to fire
+     * @param trigName the trigger's name
+     * @param dayOfMonth (1-31, or -1) the day of week upon which to fire
+     * @param hour the hour (0-23) upon which to fire
+     * @param minute the minute (0-59) upon which to fire
+     * @return the newly created trigger
      */
-    public static Trigger makeMonthlyTrigger(String trigName, int dayOfMonth, int hour,
-            int minute) {
+    public static Trigger makeMonthlyTrigger(
+            String trigName, int dayOfMonth, int hour, int minute) {
         Trigger trig = makeMonthlyTrigger(dayOfMonth, hour, minute);
         trig.setName(trigName);
         return trig;
 
     /**
      * <p>
-     * Make a trigger that will fire every second, indefinitely.
+     * Make a trigger that will fire <code>repeatCount</code> times, waiting
+     * <code>repeatInterval</code> milliseconds between each fire.
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      *  
+     * @param repeatCount the number of times to fire the trigger
+     * @param repeatInterval the number of milliseconds to wait between fires
+     * @return the newly created trigger
      */
-    public static Trigger makeImmediateTrigger(int repeatCount, long repeatInterval) {
+    public static Trigger makeImmediateTrigger(
+            int repeatCount, long repeatInterval) {
         SimpleTrigger trig = new SimpleTrigger();
         trig.setStartTime( new Date() );
         trig.setRepeatCount(repeatCount);
     
     /**
      * <p>
-     * Make a trigger that will fire every second, indefinitely.
+     * Make a trigger that will fire <code>repeatCount</code> times, waiting
+     * <code>repeatInterval</code> milliseconds between each fire.
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
-     *  
+     *
+     * @param trigName the trigger's name 
+     * @param repeatCount the number of times to fire the trigger
+     * @param repeatInterval the number of milliseconds to wait between fires
+     * @return the new trigger
      */
-    public static Trigger makeImmediateTrigger(String trigName, int repeatCount, long repeatInterval) {
+    public static Trigger makeImmediateTrigger(
+            String trigName, int repeatCount, long repeatInterval) {
         Trigger trig = makeImmediateTrigger(repeatCount, repeatInterval);
         trig.setName(trigName);
         return trig;
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
-     *  
+     * @return the new trigger
      */
     public static Trigger makeSecondlyTrigger() {
         return makeSecondlyTrigger(1, SimpleTrigger.REPEAT_INDEFINITELY);
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its group,
+     * The generated trigger will not have its group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
-     *  
+     * 
+     * @param trigName the trigger's name
+     * @return the new trigger
      */
     public static Trigger makeSecondlyTrigger(String trigName) {
-        return makeSecondlyTrigger(trigName, 1, SimpleTrigger.REPEAT_INDEFINITELY);
+        return makeSecondlyTrigger(
+                trigName, 1, SimpleTrigger.REPEAT_INDEFINITELY);
     }
 
     
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param intervalInSeconds
-     *          the number of seconds between firings
+     * @param intervalInSeconds the number of seconds between firings
+     * @return the new trigger
      */
     public static Trigger makeSecondlyTrigger(int intervalInSeconds) {
-        return makeSecondlyTrigger(intervalInSeconds,
-                SimpleTrigger.REPEAT_INDEFINITELY);
+        return makeSecondlyTrigger(
+                intervalInSeconds, SimpleTrigger.REPEAT_INDEFINITELY);
     }
 
     /**
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param intervalInSeconds
-     *          the number of seconds between firings
-     * @param repeatCount
-     *          the number of times to repeat the firing
+     * @param intervalInSeconds the number of seconds between firings
+     * @param repeatCount the number of times to repeat the firing
+     * @return the new trigger
      */
-    public static Trigger makeSecondlyTrigger(int intervalInSeconds,
-            int repeatCount) {
+    public static Trigger makeSecondlyTrigger(
+            int intervalInSeconds, int repeatCount) {
         SimpleTrigger trig = new SimpleTrigger();
 
         trig.setRepeatInterval(intervalInSeconds * 1000l);
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its group,
+     * The generated trigger will not have its group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param intervalInSeconds
-     *          the number of seconds between firings
-     * @param repeatCount
-     *          the number of times to repeat the firing
+     * @param trigName the trigger's name
+     * @param intervalInSeconds the number of seconds between firings
+     * @param repeatCount the number of times to repeat the firing
+     * @return the new trigger
      */
-    public static Trigger makeSecondlyTrigger(String trigName, int intervalInSeconds,
-            int repeatCount) {
-        Trigger trig = makeSecondlyTrigger(intervalInSeconds);
+    public static Trigger makeSecondlyTrigger(
+            String trigName, int intervalInSeconds, int repeatCount) {
+        Trigger trig = makeSecondlyTrigger(intervalInSeconds, repeatCount);
         trig.setName(trigName);
         return trig;
     }
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      *  
+     * @return the new trigger
      */
     public static Trigger makeMinutelyTrigger() {
         return makeMinutelyTrigger(1, SimpleTrigger.REPEAT_INDEFINITELY);
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its group,
+     * The generated trigger will not have its group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
-     *  
+     * 
+     * @param trigName the trigger's name 
+     * @return the new trigger
      */
     public static Trigger makeMinutelyTrigger(String trigName) {
-        return makeMinutelyTrigger(trigName, 1, SimpleTrigger.REPEAT_INDEFINITELY);
+        return makeMinutelyTrigger(
+                trigName, 1, SimpleTrigger.REPEAT_INDEFINITELY);
     }
     
     /**
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param intervalInMinutes
-     *          the number of minutes between firings
+     * @param intervalInMinutes the number of minutes between firings
+     * @return the new trigger
      */
     public static Trigger makeMinutelyTrigger(int intervalInMinutes) {
-        return makeMinutelyTrigger(intervalInMinutes,
-                SimpleTrigger.REPEAT_INDEFINITELY);
+        return makeMinutelyTrigger(
+                intervalInMinutes, SimpleTrigger.REPEAT_INDEFINITELY);
     }
 
     /**
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param intervalInMinutes
-     *          the number of minutes between firings
-     * @param repeatCount
-     *          the number of times to repeat the firing
+     * @param intervalInMinutes the number of minutes between firings
+     * @param repeatCount the number of times to repeat the firing
+     * @return the new trigger
      */
-    public static Trigger makeMinutelyTrigger(int intervalInMinutes,
-            int repeatCount) {
+    public static Trigger makeMinutelyTrigger(
+            int intervalInMinutes, int repeatCount) {
         SimpleTrigger trig = new SimpleTrigger();
 
         trig.setRepeatInterval(intervalInMinutes * MILLISECONDS_IN_MINUTE);
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its group,
+     * The generated trigger will not have its group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param intervalInMinutes
-     *          the number of minutes between firings
-     * @param repeatCount
-     *          the number of times to repeat the firing
+     * @param trigName the trigger's name
+     * @param intervalInMinutes the number of minutes between firings
+     * @param repeatCount the number of times to repeat the firing
+     * @return the new trigger
      */
-    public static Trigger makeMinutelyTrigger(String trigName, int intervalInMinutes,
-            int repeatCount) {
-        Trigger trig = makeMinutelyTrigger(intervalInMinutes);
+    public static Trigger makeMinutelyTrigger(
+            String trigName, int intervalInMinutes, int repeatCount) {
+        Trigger trig = makeMinutelyTrigger(intervalInMinutes, repeatCount);
         trig.setName(trigName);
         return trig;
     }
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      *  
+     * @return the new trigger
      */
     public static Trigger makeHourlyTrigger() {
         return makeHourlyTrigger(1, SimpleTrigger.REPEAT_INDEFINITELY);
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its group,
+     * The generated trigger will not have its group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
-     *  
+     * 
+     * @param trigName the trigger's name
+     * @return the new trigger
      */
     public static Trigger makeHourlyTrigger(String trigName) {
-        return makeHourlyTrigger(trigName, 1, SimpleTrigger.REPEAT_INDEFINITELY);
+        return makeHourlyTrigger(
+                trigName, 1, SimpleTrigger.REPEAT_INDEFINITELY);
     }
 
     /**
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param intervalInHours
-     *          the number of hours between firings
+     * @param intervalInHours the number of hours between firings
+     * @return the new trigger
      */
     public static Trigger makeHourlyTrigger(int intervalInHours) {
-        return makeHourlyTrigger(intervalInHours,
-                SimpleTrigger.REPEAT_INDEFINITELY);
+        return makeHourlyTrigger(
+                intervalInHours, SimpleTrigger.REPEAT_INDEFINITELY);
     }
 
     /**
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its name, group,
+     * The generated trigger will not have its name, group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param intervalInHours
-     *          the number of hours between firings
-     * @param repeatCount
-     *          the number of times to repeat the firing
+     * @param intervalInHours the number of hours between firings
+     * @param repeatCount the number of times to repeat the firing
+     * @return the new trigger
      */
-    public static Trigger makeHourlyTrigger(int intervalInHours, int repeatCount) {
+    public static Trigger makeHourlyTrigger(
+            int intervalInHours, int repeatCount) {
         SimpleTrigger trig = new SimpleTrigger();
 
         trig.setRepeatInterval(intervalInHours * MILLISECONDS_IN_HOUR);
      * </p>
      * 
      * <p>
-     * TThe generated trigger will not have its group,
+     * The generated trigger will not have its group,
      * or end-time set.  The Start time defaults to 'now'.
      * </p>
      * 
-     * @param intervalInHours
-     *          the number of hours between firings
-     * @param repeatCount
-     *          the number of times to repeat the firing
+     * @param trigName the trigger's name
+     * @param intervalInHours the number of hours between firings
+     * @param repeatCount the number of times to repeat the firing
+     * @return the new trigger
      */
-    public static Trigger makeHourlyTrigger(String trigName, int intervalInHours, int repeatCount) {
+    public static Trigger makeHourlyTrigger(
+            String trigName, int intervalInHours, int repeatCount) {
         Trigger trig =makeHourlyTrigger(intervalInHours, repeatCount);
         trig.setName(trigName);
         return trig;
      * @param date
      *          the Date to round, if <code>null</code> the current time will
      *          be used
+     * @return the new rounded date
      */
     public static Date getEvenHourDate(Date date) {
         if (date == null) date = new Date();
      * @param date
      *          the Date to round, if <code>null</code> the current time will
      *          be used
+     * @return the new rounded date
      */
     public static Date getEvenHourDateBefore(Date date) {
         if (date == null) date = new Date();
 
     /**
      * <p>
-     * Returns a date that is rounded to the next even hour above the given
+     * Returns a date that is rounded to the next even minute above the given
      * date.
      * </p>
      * 
      * @param date
      *          the Date to round, if <code>null</code> the current time will
      *          be used
+     * @return the new rounded date
      */
     public static Date getEvenMinuteDate(Date date) {
         if (date == null) date = new Date();
 
     /**
      * <p>
-     * Returns a date that is rounded to the previous even hour below the given
-     * date.
+     * Returns a date that is rounded to the previous even minute below the 
+     * given date.
      * </p>
      * 
      * <p>
      * @param date
      *          the Date to round, if <code>null</code> the current time will
      *          be used
+     * @return the new rounded date
      */
     public static Date getEvenMinuteDateBefore(Date date) {
         if (date == null) date = new Date();
      * @param date
      *          the Date to round, if <code>null</code> the current time will
      *          be used
+     * @return the new rounded date
      */
     public static Date getEvenSecondDate(Date date) {
         if (date == null) date = new Date();
      * @param date
      *          the Date to round, if <code>null</code> the current time will
      *          be used
+     * @return the new rounded date
      */
     public static Date getEvenSecondDateBefore(Date date) {
         if (date == null) date = new Date();
      *          be used
      * @param minuteBase
      *          the base-minute to set the time on
+     * @return the new rounded date
      * 
      * @see #getNextGivenSecondDate(Date, int)
      */
      * 
      * <p>
      * The rules for calculating the second are the same as those for
-     * calculating the minute in the method <code>getNextGivenMinuteDate(..)<code>.</p>
-     *       *
+     * calculating the minute in the method 
+     * <code>getNextGivenMinuteDate(..)<code>.
+     * </p>
+     *
      * @param date the Date to round, if <code>null</code> the current time will
      * be used
      * @param secondBase the base-second to set the time on
+     * @return the new rounded date
      * 
      * @see #getNextGivenMinuteDate(Date, int)
      */
      *          The value (0-59) to give the minutes field of the date
      * @param hour
      *          The value (0-23) to give the hours field of the date
+     * @return the new date
      */
     public static Date getDateOf(int second, int minute, int hour) {
         validateSecond(second);
      *          The value (1-31) to give the day of month field of the date
      * @param month
      *          The value (1-12) to give the month field of the date
+     * @return the new date
      */
     public static Date getDateOf(int second, int minute, int hour,
             int dayOfMonth, int month) {
      *          The value (1-12) to give the month field of the date
      * @param year
      *          The value (1970-2099) to give the year field of the date
+     * @return the new date
      */
     public static Date getDateOf(int second, int minute, int hour,
             int dayOfMonth, int month, int year) {
     }
 
     /**
-     * Returns a list of Dates that are the next fire times of a <code>Trigger</code>.
+     * Returns a list of Dates that are the next fire times of a 
+     * <code>Trigger</code>.
      * The input trigger will be cloned before any work is done, so you need
      * not worry about its state being altered by this method.
      * 
     }
 
     /**
-     * Returns a list of Dates that are the next fire times of a <code>Trigger</code>
+     * Returns a list of Dates that are the next fire times of a 
+     * <code>Trigger</code>
      * that fall within the given date range. The input trigger will be cloned
      * before any work is done, so you need not worry about its state being
      * altered by this method.
      * Translate a date & time from a users timezone to the another
      * (probably server) timezone to assist in creating a simple trigger with 
      * the right date & time.
-     */      
+     * 
+     * @param date the date to translate
+     * @param src the original time-zone
+     * @param dest the destination time-zone
+     * @return the translated date
+     */
     public static Date translateTime(Date date, TimeZone src, TimeZone dest) {
 
         Date newDate = new Date();
 
-        int offset = (getOffset(date.getTime(), dest) - getOffset(date.getTime(), src));
+        int offset = (
+                getOffset(date.getTime(), dest) - getOffset(date.getTime(), src)
+        );
 
         newDate.setTime(date.getTime() - offset);
 
      * Equivalent of TimeZone.getOffset(date) in JDK 1.4, but Quartz is trying
      * to support JDK 1.3.
      * </p>
+     * 
+     * @param date the date (in milliseconds) that is the base for the offset
+     * @param tz the time-zone to calculate to offset to
+     * @return the offset
      */
     public static int getOffset(long date, TimeZone tz) {
         
      * Equivalent of TimeZone.getDSTSavings() in JDK 1.4, but Quartz is trying
      * to support JDK 1.3.
      * </p>
+     * 
+     * @param tz the target time-zone
+     * @return the amount of saving time in milliseconds
      */
     public static int getDSTSavings(TimeZone tz) {