Commits

jhouse  committed b4ae02f

QUARTZ-766 : Convenience constructors for JobDetail and Trigger classes (with no group name argument).

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

  • Participants
  • Parent commits aa78c38

Comments (0)

Files changed (5)

File src/java/org/quartz/CronTrigger.java

 
     /**
      * <p>
+     * Create a <code>CronTrigger</code> with the given name and default group.
+     * </p>
+     * 
+     * <p>
+     * The start-time will also be set to the current time, and the time zone
+     * will be set the the system's default time zone.
+     * </p>
+     */
+    public CronTrigger(String name) {
+        this(name, null);
+    }
+    
+    /**
+     * <p>
      * Create a <code>CronTrigger</code> with the given name and group.
      * </p>
      * 
         setStartTime(new Date());
         setTimeZone(TimeZone.getDefault());
     }
-
+    
     /**
      * <p>
      * Create a <code>CronTrigger</code> with the given name and group, and

File src/java/org/quartz/JobDetail.java

 
     /**
      * <p>
-     * Create a <code>JobDetail</code> with the given name, and group, and
-     * the default settings of all the other properties.
+     * Create a <code>JobDetail</code> with the given name, given class, default group, 
+     * and the default settings of all the other properties.
+     * </p>
+     * 
+     * @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
+     * 
+     * @exception IllegalArgumentException
+     *              if name is null or empty, or the group is an empty string.
+     */
+    public JobDetail(String name, Class jobClass) {
+        this(name, null, jobClass);
+    }
+
+    /**
+     * <p>
+     * Create a <code>JobDetail</code> with the given name, group and class, 
+     * and the default settings of all the other properties.
      * </p>
      * 
      * @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
      * 
      * @exception IllegalArgumentException
-     *              if nameis null or empty, or the group is an empty string.
+     *              if name is null or empty, or the group is an empty string.
      */
     public JobDetail(String name, String group, Class jobClass) {
         setName(name);
      * @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
      * 
      * @exception IllegalArgumentException
-     *              if nameis null or empty, or the group is an empty string.
+     *              if name is null or empty, or the group is an empty string.
      */
     public JobDetail(String name, String group, Class jobClass,
                      boolean volatility, boolean durability, boolean recover) {

File src/java/org/quartz/NthIncludedDayTrigger.java

 
     /**
      * Create an <CODE>NthIncludedDayTrigger</CODE> with the given name and
+     * default group but no specified <CODE>JobDetail</CODE>. This will result 
+     * initially in a default monthly trigger that fires on the first day of 
+     * every month at 12:00 PM (<CODE>n</CODE>=1, 
+     * <CODE>intervalType={@link #INTERVAL_TYPE_MONTHLY}</CODE>, 
+     * <CODE>fireAtTime="12:00"</CODE>).
+     * <P>
+     * Note that <CODE>setJobName()</CODE> and <CODE>setJobGroup()</CODE> must
+     * be called before the <CODE>NthIncludedDayTrigger</CODE> can be placed 
+     * into a <CODE>Scheduler</CODE>.
+     *  
+     * @param name  the name for the <CODE>NthIncludedDayTrigger</CODE>
+     * @param group the group for the <CODE>NthIncludedDayTrigger</CODE>
+     */
+    public NthIncludedDayTrigger(String name) {
+        this(name, null);
+    }
+    
+    /**
+     * Create an <CODE>NthIncludedDayTrigger</CODE> with the given name and
      * group but no specified <CODE>JobDetail</CODE>. This will result 
      * initially in a default monthly trigger that fires on the first day of 
      * every month at 12:00 PM (<CODE>n</CODE>=1, 

File src/java/org/quartz/SimpleTrigger.java

      * not repeat.
      * </p>
      */
+    public SimpleTrigger(String name) {
+        this(name, (String)null);
+    }
+    
+    /**
+     * <p>
+     * Create a <code>SimpleTrigger</code> that will occur immediately, and
+     * not repeat.
+     * </p>
+     */
     public SimpleTrigger(String name, String group) {
         this(name, group, new Date(), null, 0, 0);
     }
      * repeat at the the given interval the given number of times.
      * </p>
      */
+    public SimpleTrigger(String name, int repeatCount, long repeatInterval) {
+        this(name, null, repeatCount, repeatInterval);
+    }
+
+    /**
+     * <p>
+     * Create a <code>SimpleTrigger</code> that will occur immediately, and
+     * repeat at the the given interval the given number of times.
+     * </p>
+     */
     public SimpleTrigger(String name, String group, int repeatCount,
             long repeatInterval) {
         this(name, group, new Date(), null, repeatCount, repeatInterval);
      * and not repeat.
      * </p>
      */
+    public SimpleTrigger(String name, Date startTime) {
+        this(name, null, startTime);
+    }
+
+    /**
+     * <p>
+     * Create a <code>SimpleTrigger</code> that will occur at the given time,
+     * and not repeat.
+     * </p>
+     */
     public SimpleTrigger(String name, String group, Date startTime) {
         this(name, group, startTime, null, 0, 0);
     }
-
+    
+    /**
+     * <p>
+     * Create a <code>SimpleTrigger</code> that will occur at the given time,
+     * and repeat at the the given interval the given number of times, or until
+     * the given end time.
+     * </p>
+     * 
+     * @param startTime
+     *          A <code>Date</code> set to the time for the <code>Trigger</code>
+     *          to fire.
+     * @param endTime
+     *          A <code>Date</code> set to the time for the <code>Trigger</code>
+     *          to quit repeat firing.
+     * @param repeatCount
+     *          The number of times for the <code>Trigger</code> to repeat
+     *          firing, use {@link #REPEAT_INDEFINITELY} for unlimited times.
+     * @param repeatInterval
+     *          The number of milliseconds to pause between the repeat firing.
+     */
+    public SimpleTrigger(String name, Date startTime,
+            Date endTime, int repeatCount, long repeatInterval) {
+        this(name, null, startTime, endTime, repeatCount, repeatInterval);
+    }
+    
     /**
      * <p>
      * Create a <code>SimpleTrigger</code> that will occur at the given time,

File src/java/org/quartz/Trigger.java

 
     /**
      * <p>
+     * Create a <code>Trigger</code> with the given name, and default group.
+     * </p>
+     * 
+     * <p>
+     * Note that the {@link #setJobName(String)}and
+     * {@link #setJobGroup(String)}methods must be called before the <code>Trigger</code>
+     * can be placed into a {@link Scheduler}.
+     * </p>
+     * 
+     * @param group if <code>null</code>, Scheduler.DEFAULT_GROUP will be used.
+     * 
+     * @exception IllegalArgumentException
+     *              if name is null or empty, or the group is an empty string.
+     */
+    public Trigger(String name) {
+        setName(name);
+        setGroup(null);
+    }
+    
+    /**
+     * <p>
      * Create a <code>Trigger</code> with the given name, and group.
      * </p>
      *