Clover coverage report - JFox Service-Oriented Application Framework - 1.0-RC3
Coverage timestamp: 星期三 二月 15 2006 18:10:22 CST
file stats: LOC: 110   Methods: 5
NCLOC: 39   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
QuartzServiceImpl.java - 41.7% 40% 41.2%
coverage coverage
 1   
 /**
 2   
  * @(#)QuartzServiceImpl.java
 3   
  * 
 4   
  * JFoxSOAF, Service-Oriented Application Framework
 5   
  * 
 6   
  * Copyright(c) JFoxSOAF Team
 7   
  * 
 8   
  * Licensed under the GNU LGPL, Version 2.1 (the "License"); 
 9   
  * you may not use this file except in compliance with the License. 
 10   
  * You may obtain a copy of the License at  
 11   
  * 
 12   
  * http://www.gnu.org/copyleft/lesser.html
 13   
  * 
 14   
  * Unless required by applicable law or agreed to in writing, software
 15   
  * distributed under the License is distributed on an "AS IS" BASIS, 
 16   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 17   
  * See the License for the specific language governing permissions and 
 18   
  * limitations under the License. 
 19   
  * 
 20   
  * For more information, please visit:
 21   
  * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
 22   
  * http://www.huihoo.org/jfox/jfoxsoaf
 23   
  */
 24   
 package org.huihoo.jfox.soaf.services.timer;
 25   
 
 26   
 import org.apache.commons.logging.Log;
 27   
 import org.apache.commons.logging.LogFactory;
 28   
 import org.picocontainer.Startable;
 29   
 import org.quartz.JobDetail;
 30   
 import org.quartz.Scheduler;
 31   
 import org.quartz.SchedulerException;
 32   
 import org.quartz.Trigger;
 33   
 import org.quartz.impl.StdSchedulerFactory;
 34   
 
 35   
 /**
 36   
  * <p>
 37   
  * Quartz service implementation.
 38   
  * </p>
 39   
  * 
 40   
  * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
 41   
  * @version $Revision: 1.1 $ $Date: 2006/02/15 08:45:45 $
 42   
  * @version Revision: 1.0
 43   
  */
 44   
 
 45   
 public class QuartzServiceImpl implements QuartzService, Startable {
 46   
 
 47   
     private static final Log log = LogFactory.getLog(QuartzServiceImpl.class);
 48   
 
 49   
     private Scheduler scheduler;
 50   
 
 51   
     /**
 52   
      * Retrieve scheduler.
 53   
      * 
 54   
      * @return scheduler.
 55   
      */
 56  1
     public Scheduler getScheduler() {
 57  1
         return this.scheduler;
 58   
     }
 59   
 
 60   
     /**
 61   
      * Schedule job with job detail.
 62   
      * 
 63   
      * @param jobDetail
 64   
      * @param trigger
 65   
      */
 66  0
     public void schedule(JobDetail jobDetail, Trigger trigger)
 67   
             throws SchedulerException {
 68  0
         scheduler.scheduleJob(jobDetail, trigger);
 69   
     }
 70   
 
 71   
     /**
 72   
      * Schedule job with trigger.
 73   
      * 
 74   
      * @param trigger
 75   
      * @throws SchedulerException
 76   
      */
 77  0
     public void schedule(Trigger trigger) throws SchedulerException {
 78  0
         scheduler.scheduleJob(trigger);
 79   
     }
 80   
 
 81   
     /**
 82   
      * Start quartz service.
 83   
      * 
 84   
      * @see org.picocontainer.Startable#start()
 85   
      */
 86  10
     public void start() {
 87  10
         log.info("Starting quartz service");
 88  10
         try {
 89  10
             scheduler = StdSchedulerFactory.getDefaultScheduler();
 90  10
             scheduler.start();
 91   
         } catch (SchedulerException e) {
 92  0
             log.error("Cannot start quartz scheduler.", e);
 93   
         }
 94   
     }
 95   
 
 96   
     /**
 97   
      * Stopping quartz service.
 98   
      * 
 99   
      * @see org.picocontainer.Startable#stop()
 100   
      */
 101  0
     public void stop() {
 102  0
         log.info("Stopping quartz service");
 103  0
         try {
 104  0
             scheduler.shutdown();
 105   
         } catch (SchedulerException se) {
 106  0
             log.error("Cannot shutdown quartz scheduler.", se);
 107   
         }
 108   
     }
 109   
 
 110   
 }