View Javadoc
1 package org.apache.turbine.modules; 2 3 /* ==================================================================== 4 * The Apache Software License, Version 1.1 5 * 6 * Copyright (c) 2001 The Apache Software Foundation. All rights 7 * reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in 18 * the documentation and/or other materials provided with the 19 * distribution. 20 * 21 * 3. The end-user documentation included with the redistribution, 22 * if any, must include the following acknowledgment: 23 * "This product includes software developed by the 24 * Apache Software Foundation (http://www.apache.org/)." 25 * Alternately, this acknowledgment may appear in the software itself, 26 * if and wherever such third-party acknowledgments normally appear. 27 * 28 * 4. The names "Apache" and "Apache Software Foundation" and 29 * "Apache Turbine" must not be used to endorse or promote products 30 * derived from this software without prior written permission. For 31 * written permission, please contact apache@apache.org. 32 * 33 * 5. Products derived from this software may not be called "Apache", 34 * "Apache Turbine", nor may "Apache" appear in their name, without 35 * prior written permission of the Apache Software Foundation. 36 * 37 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 38 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 39 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 40 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 41 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 42 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 43 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 44 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 45 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 46 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 47 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 48 * SUCH DAMAGE. 49 * ==================================================================== 50 * 51 * This software consists of voluntary contributions made by many 52 * individuals on behalf of the Apache Software Foundation. For more 53 * information on the Apache Software Foundation, please see 54 * <http://www.apache.org/>;. 55 */ 56 57 // Java Core Classes 58 import java.util.Hashtable; 59 60 // Turbine Utility Classes 61 import org.apache.turbine.TurbineConstants; 62 import org.apache.turbine.util.RunData; 63 import org.apache.turbine.services.resources.TurbineResources; 64 65 /*** 66 * This is the base class for the loaders. It contains code that is 67 * used across all of the loaders. It also specifies the interface 68 * that is required to be called a Loader. 69 * 70 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a> 71 * @version $Id: GenericLoader.java,v 1.1.1.1 2001/08/16 05:08:29 jvanzyl Exp $ 72 */ 73 public abstract class GenericLoader extends Hashtable 74 { 75 /*** @serial This can be serialized */ 76 private boolean reload = false; 77 /*** @serial This can be serialized */ 78 private boolean CACHE = true; 79 </*** Base packages path for Turbine *//index/html">color="#AA0000">* Base packages path for Turbine *//index.html">font color="#AA0000">/*** Base packages path for Turbine *//index.html">color="#AA0000">* Base packages path for Turbine */ 80 private static final String TURBINE_PACKAGE = "org.apache.turbine.modules"; 81 82 /*** 83 * Basic constructor for creating a loader. 84 */ 85 public GenericLoader() 86 { 87 super (); 88 CACHE = TurbineResources 89 .getBoolean(TurbineConstants.MODULE_CACHE, true); 90 } 91 92 /*** 93 * Basic constructor for creating a loader. 94 */ 95 public GenericLoader(int i) 96 { 97 super ( i ); 98 CACHE = TurbineResources 99 .getBoolean(TurbineConstants.MODULE_CACHE, true); 100 } 101 102 /*** 103 * If set to true, then cache the Loader objects. 104 * 105 * @return True if the Loader objects are being cached. 106 */ 107 public boolean cache() 108 { 109 return this.CACHE; 110 } 111 112 /*** 113 * Attempts to load and execute the external action that has been 114 * set. 115 * 116 * @exception Exception a generic exception. 117 */ 118 public abstract void exec( RunData data, String name ) 119 throws Exception; 120 121 /*** 122 * Commented out. 123 * This method should return the complete classpath + name. 124 * 125 * @param name 126 * @return 127 * 128 public abstract String getClassName(String name); 129 */ 130 131 /*** 132 * Returns whether or not this external action is reload itself. 133 * This is in cases where the Next button would be clicked, but 134 * since we are checking for that, we would go into an endless 135 * loop. 136 * 137 * @return True if the action is reload. 138 */ 139 public boolean reload() 140 { 141 return this.reload; 142 } 143 144 /*** 145 * Sets whether or not this external action is reload itself. 146 * This is in cases where the Next button would be clicked, but 147 * since we are checking for that, we would go into an endless 148 * loop. 149 * 150 * @param reload True if the action must be marked as reload. 151 * @return Itself. 152 */ 153 public GenericLoader setReload( boolean reload ) 154 { 155 this.reload = reload; 156 return this; 157 } 158 159 /*** 160 * Gets the base package where Turbine should find its default 161 * modules. 162 * 163 * @return A String with the base package name. 164 */ 165 public static String getBasePackage() 166 { 167 return TURBINE_PACKAGE; 168 } 169 }

This page was automatically generated by Maven