Coverage report

  %line %branch
org.apache.turbine.modules.GenericLoader
54% 
100% 

 1  
 package org.apache.turbine.modules;
 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.Hashtable;
 20  
 
 21  
 import org.apache.turbine.Turbine;
 22  
 import org.apache.turbine.TurbineConstants;
 23  
 import org.apache.turbine.util.RunData;
 24  
 
 25  
 /**
 26  
  * This is the base class for the loaders. It contains code that is
 27  
  * used across all of the loaders. It also specifies the interface
 28  
  * that is required to be called a Loader.
 29  
  *
 30  
  * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
 31  
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
 32  
  * @version $Id: GenericLoader.java 264148 2005-08-29 14:21:04Z henning $
 33  
  */
 34  
 public abstract class GenericLoader
 35  
     extends Hashtable
 36  
 {
 37  
     /** @serial This can be serialized */
 38  168
     private boolean reload = false;
 39  
 
 40  
     /** @serial This can be serialized */
 41  168
     private boolean isCaching = true;
 42  
 
 43  
     /** Base packages path for Turbine */
 44  
     private static final String TURBINE_PACKAGE = "org.apache.turbine.modules";
 45  
 
 46  
     /**
 47  
      * Basic constructor for creating a loader.
 48  
      */
 49  
     public GenericLoader()
 50  
     {
 51  0
         super();
 52  0
         isCaching = Turbine.getConfiguration()
 53  
             .getBoolean(TurbineConstants.MODULE_CACHE_KEY,
 54  
                         TurbineConstants.MODULE_CACHE_DEFAULT);
 55  0
     }
 56  
 
 57  
     /**
 58  
      * Basic constructor for creating a loader.
 59  
      */
 60  
     public GenericLoader(int i)
 61  
     {
 62  168
         super(i);
 63  168
         isCaching = Turbine.getConfiguration()
 64  
             .getBoolean(TurbineConstants.MODULE_CACHE_KEY,
 65  
                         TurbineConstants.MODULE_CACHE_DEFAULT);
 66  168
     }
 67  
 
 68  
     /**
 69  
      * If set to true, then cache the Loader objects.
 70  
      *
 71  
      * @return True if the Loader objects are being cached.
 72  
      */
 73  
     public boolean cache()
 74  
     {
 75  162
         return this.isCaching;
 76  
     }
 77  
 
 78  
     /**
 79  
      * Attempts to load and execute the external action that has been
 80  
      * set.
 81  
      *
 82  
      * @exception Exception a generic exception.
 83  
      */
 84  
     public abstract void exec(RunData data, String name)
 85  
             throws Exception;
 86  
 
 87  
     /**
 88  
      * Commented out.
 89  
      * This method should return the complete classpath + name.
 90  
      *
 91  
      * @param name
 92  
      * @return
 93  
      *
 94  
      public abstract String getClassName(String name);
 95  
      */
 96  
 
 97  
     /**
 98  
      * Returns whether or not this external action is reload itself.
 99  
      * This is in cases where the Next button would be clicked, but
 100  
      * since we are checking for that, we would go into an endless
 101  
      * loop.
 102  
      *
 103  
      * @return True if the action is reload.
 104  
      */
 105  
     public boolean reload()
 106  
     {
 107  0
         return this.reload;
 108  
     }
 109  
 
 110  
     /**
 111  
      * Sets whether or not this external action is reload itself.
 112  
      * This is in cases where the Next button would be clicked, but
 113  
      * since we are checking for that, we would go into an endless
 114  
      * loop.
 115  
      *
 116  
      * @param reload True if the action must be marked as reload.
 117  
      * @return Itself.
 118  
      */
 119  
     public GenericLoader setReload(boolean reload)
 120  
     {
 121  0
         this.reload = reload;
 122  0
         return this;
 123  
     }
 124  
 
 125  
     /**
 126  
      * Gets the base package where Turbine should find its default
 127  
      * modules.
 128  
      *
 129  
      * @return A String with the base package name.
 130  
      */
 131  
     public static String getBasePackage()
 132  
     {
 133  156
         return TURBINE_PACKAGE;
 134  
     }
 135  
 }

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