commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morg...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/jelly-tags/quartz/src/java/org/apache/commons/jelly/tags/quartz CronTriggerTag.java JobTag.java WaitForSchedulerTag.java
Date Sun, 26 Jan 2003 07:01:35 GMT
morgand     2003/01/25 23:01:35

  Modified:    jelly/jelly-tags/quartz/src/java/org/apache/commons/jelly/tags/quartz
                        CronTriggerTag.java JobTag.java
                        WaitForSchedulerTag.java
  Log:
  converted quartz taglib from Exception to JellyTagException
  
  Revision  Changes    Path
  1.2       +22 -8     jakarta-commons-sandbox/jelly/jelly-tags/quartz/src/java/org/apache/commons/jelly/tags/quartz/CronTriggerTag.java
  
  Index: CronTriggerTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/quartz/src/java/org/apache/commons/jelly/tags/quartz/CronTriggerTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CronTriggerTag.java	7 Jan 2003 14:54:15 -0000	1.1
  +++ CronTriggerTag.java	26 Jan 2003 07:01:35 -0000	1.2
  @@ -61,11 +61,15 @@
    *
    */
   
  +import java.text.ParseException;
  + 
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.XMLOutput;
   import org.apache.commons.jelly.MissingAttributeException;
   
   import org.quartz.CronTrigger;
   import org.quartz.Scheduler;
  +import org.quartz.SchedulerException;
   
   import java.util.Date;
   
  @@ -208,7 +212,7 @@
        *
        *  @throws Exception If an error occurs.
        */
  -    public void doTag(XMLOutput output) throws Exception
  +    public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException
       {
           if ( getSpec() == null )
           {
  @@ -237,12 +241,22 @@
   
           CronTrigger trigger = new CronTrigger( getName(),
                                                  getGroup() );
  -
  -        trigger.setCronExpression( getSpec() );
  +        try {
  +            trigger.setCronExpression( getSpec() );
  +        }
  +        catch (ParseException e) {
  +            throw new JellyTagException(e);
  +        }
           trigger.setJobName( getJobName() );
           trigger.setJobGroup( getJobGroup() );
           trigger.setStartTime( new Date() );
  -        Scheduler sched = getScheduler();
  -        sched.scheduleJob( trigger );
  +        
  +        try {
  +            Scheduler sched = getScheduler();
  +            sched.scheduleJob( trigger );
  +        }
  +        catch (SchedulerException e) {
  +            throw new JellyTagException(e);
  +        }
       }
   }
  
  
  
  1.2       +14 -8     jakarta-commons-sandbox/jelly/jelly-tags/quartz/src/java/org/apache/commons/jelly/tags/quartz/JobTag.java
  
  Index: JobTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/quartz/src/java/org/apache/commons/jelly/tags/quartz/JobTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JobTag.java	7 Jan 2003 14:54:15 -0000	1.1
  +++ JobTag.java	26 Jan 2003 07:01:35 -0000	1.2
  @@ -61,10 +61,12 @@
    *
    */
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.XMLOutput;
   import org.apache.commons.jelly.MissingAttributeException;
   
   import org.quartz.Scheduler;
  +import org.quartz.SchedulerException;
   import org.quartz.JobDetail;
   import org.quartz.JobDataMap;
   
  @@ -145,7 +147,7 @@
        *
        *  @throws Exception If an error occurs.
        */
  -    public void doTag(XMLOutput output) throws Exception
  +    public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException
       {
           if ( getName() == null )
           {
  @@ -157,8 +159,6 @@
               throw new MissingAttributeException( "group" );
           }
   
  -        Scheduler sched = getScheduler();
  -
           JobDetail detail = new JobDetail( getName(),
                                             getGroup(),
                                             JellyJob.class );
  @@ -178,8 +178,14 @@
   
           detail.setJobDataMap( data );
   
  -        sched.addJob( detail,
  -                      true );
  +        try {
  +            Scheduler sched = getScheduler();
  +            sched.addJob( detail,
  +                          true );
  +        }
  +        catch (SchedulerException e) {
  +            throw new JellyTagException(e);
  +        }
       }
   }
   
  
  
  
  1.2       +21 -13    jakarta-commons-sandbox/jelly/jelly-tags/quartz/src/java/org/apache/commons/jelly/tags/quartz/WaitForSchedulerTag.java
  
  Index: WaitForSchedulerTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/quartz/src/java/org/apache/commons/jelly/tags/quartz/WaitForSchedulerTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WaitForSchedulerTag.java	7 Jan 2003 14:54:15 -0000	1.1
  +++ WaitForSchedulerTag.java	26 Jan 2003 07:01:35 -0000	1.2
  @@ -63,7 +63,10 @@
   
   import org.apache.commons.jelly.XMLOutput;
   
  +import org.apache.commons.jelly.JellyTagException;
  +
   import org.quartz.Scheduler;
  +import org.quartz.SchedulerException;
   
   /** Block and wait for the Quartz scheduler to shutdown.
    *
  @@ -96,20 +99,25 @@
        *
        *  @throws Exception If an error occurs.
        */
  -    public void doTag(XMLOutput output) throws Exception
  +    public void doTag(XMLOutput output) throws JellyTagException
       {
  -        Scheduler sched = getScheduler();
  +        try {
  +            Scheduler sched = getScheduler();
   
  -        while ( ! sched.isShutdown() )
  -        {
  -            try
  -            {
  -                Thread.sleep( 500 );
  -            }
  -            catch (InterruptedException e)
  +            while ( ! sched.isShutdown() )
               {
  -                break;
  +                try
  +                {
  +                    Thread.sleep( 500 );
  +                }
  +                catch (InterruptedException e)
  +                {
  +                    break;
  +                }
               }
  +        }
  +        catch (SchedulerException e) {
  +            throw new JellyTagException(e);
           }
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message