Coverage report

  %line %branch
org.apache.turbine.services.schedule.SchedulerTool
0% 
0% 

 1  
 package org.apache.turbine.services.schedule;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2005 The Apache Software Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License")
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import java.util.List;
 20  
 
 21  
 import org.apache.commons.logging.Log;
 22  
 import org.apache.commons.logging.LogFactory;
 23  
 import org.apache.turbine.services.TurbineServices;
 24  
 import org.apache.turbine.services.pull.ApplicationTool;
 25  
 import org.apache.turbine.util.TurbineException;
 26  
 
 27  
 /**
 28  
  * This tool is used to retrieve information about the job scheduler.
 29  
  *
 30  
  * @author <a href="mailto:qmccombs@nequalsone.com">Quinton McCombs</a>
 31  
  * @version $Id: SchedulerTool.java 264148 2005-08-29 14:21:04Z henning $
 32  
  */
 33  0
 public class SchedulerTool implements ApplicationTool
 34  
 {
 35  
     /** Used for logging */
 36  0
     private static Log log = LogFactory.getLog(ScheduleService.LOGGER_NAME);
 37  
 
 38  
     /**
 39  
      * Initialize the pull tool
 40  
      */
 41  
     public void init(Object data)
 42  
     {
 43  0
         if (!TurbineServices.getInstance().isRegistered(
 44  
                 ScheduleService.SERVICE_NAME))
 45  
         {
 46  0
             log.error("You can not use the SchedulerTool unless you enable "
 47  
                     +"the Scheduler Service!!!!");
 48  
         }
 49  0
     }
 50  
 
 51  
     /**
 52  
      * Does nothing
 53  
      */
 54  
     public void refresh()
 55  
     {
 56  0
     }
 57  
 
 58  
     /**
 59  
      * Gets the list of scheduled jobs.
 60  
      *
 61  
      * @return List of JobEntry objects.
 62  
      */
 63  
     public List getScheduledJobs()
 64  
     {
 65  0
         return TurbineScheduler.listJobs();
 66  
     }
 67  
 
 68  
     /**
 69  
      * Determines if the scheduler service is currently enabled.
 70  
      */
 71  
     public boolean isEnabled()
 72  
     {
 73  0
         return TurbineScheduler.isEnabled();
 74  
     }
 75  
 
 76  
     /**
 77  
      * Gets the job identified by the jobId.
 78  
      *
 79  
      * @param jobId Id of the job to retreive.
 80  
      * @return The job.  Null if the jobId is not found.
 81  
      */
 82  
     public JobEntry getJob(String jobId)
 83  
     {
 84  0
         JobEntry je = null;
 85  
 
 86  
         try
 87  
         {
 88  0
             je = TurbineScheduler.getJob(Integer.parseInt(jobId));
 89  
         }
 90  0
         catch (TurbineException e)
 91  
         {
 92  0
             log.error("Could not retreive job id #" + jobId, e);
 93  0
         }
 94  
 
 95  0
         return je;
 96  
     }
 97  
 
 98  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.