You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by mp...@apache.org on 2002/03/13 20:43:36 UTC
cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/freemarker TurbineFreeMarkerService.java
mpoeschl 02/03/13 11:43:36
Modified: src/java/org/apache/turbine/services/cache
TurbineGlobalCacheService.java
src/java/org/apache/turbine/services/factory
TurbineFactoryService.java
src/java/org/apache/turbine/services/webmacro
TurbineTemplateProvider.java
TurbineWebMacroService.java
src/java/org/apache/turbine/services
BaseUnicastRemoteService.java Service.java
ServiceBroker.java TurbineServices.java
BaseServiceBroker.java BaseService.java
src/java/org/apache/turbine/services/xmlrpc
TurbineXmlRpcService.java
src/java/org/apache/turbine/services/velocity
TurbineVelocityService.java
src/java/org/apache/turbine/services/resources
TurbineResources.java ResourceService.java
TurbineResourceService.java
src/java/org/apache/turbine/services/jsp
TurbineJspService.java
src/java/org/apache/turbine/services/template
TurbineTemplateService.java
BaseTemplateEngineService.java
src/java/org/apache/turbine/services/pool
TurbinePoolService.java
src/java/org/apache/turbine/services/rundata
TurbineRunDataService.java
src/java/org/apache/turbine/services/db
TurbineMapBrokerService.java
TurbinePoolBrokerService.java
src/java/org/apache/turbine/services/mimetype
TurbineMimeTypeService.java
src/java/org/apache/turbine/services/freemarker
TurbineFreeMarkerService.java
Log:
replace the deprecated Configuration class from velocity with the new one in stratum
Revision Changes Path
1.3 +16 -14 jakarta-turbine-2/src/java/org/apache/turbine/services/cache/TurbineGlobalCacheService.java
Index: TurbineGlobalCacheService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/cache/TurbineGlobalCacheService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TurbineGlobalCacheService.java 30 Jan 2002 16:11:21 -0000 1.2
+++ TurbineGlobalCacheService.java 13 Mar 2002 19:43:34 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -63,7 +63,9 @@
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.TurbineBaseService;
import org.apache.turbine.services.resources.TurbineResources;
-import org.apache.velocity.runtime.configuration.Configuration;
+
+import org.apache.stratum.configuration.Configuration;
+
/**
* This Service functions as a Global Cache. A global cache is a good
@@ -85,15 +87,15 @@
*
* <dl>
* <dt>classname</dt><dd>the classname of this service</dd>
- * <dt>cache.initial.size/dt><dd>Initial size of hash table use to store cached
+ * <dt>cache.initial.size/dt><dd>Initial size of hash table use to store cached
objects. If this property is not present, the default value is 20</dd>
- * <dt>cache.check.frequency</dt><dd>Cache check frequency in Millis (1000
+ * <dt>cache.check.frequency</dt><dd>Cache check frequency in Millis (1000
Millis = 1 second). If this property is not present, the default value is 5000</dd>
* </dl>
* @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
* @author <a href="mailto:jon@clearink.com">Jon S. Stevens</a>
* @author <a href="mailto:john@zenplex.com">John Thorhauer</a>
- * @version $Id: TurbineGlobalCacheService.java,v 1.2 2002/01/30 16:11:21 dlr Exp $
+ * @version $Id: TurbineGlobalCacheService.java,v 1.3 2002/03/13 19:43:34 mpoeschl Exp $
*/
public class TurbineGlobalCacheService
extends TurbineBaseService
@@ -122,7 +124,7 @@
* Value must be > 0.
* Default = 5 seconds
*/
- public static final long DEFAULT_CACHE_CHECK_FREQUENCY =
+ public static final long DEFAULT_CACHE_CHECK_FREQUENCY =
TurbineResources.getLong("cache.check.frequency", 5000 ); // 5 seconds
/** The cache. **/
@@ -130,7 +132,7 @@
/** cacheCheckFrequency (default - 5 seconds) */
private long cacheCheckFrequency = DEFAULT_CACHE_CHECK_FREQUENCY;
-
+
/**
* Constructor.
*/
@@ -161,10 +163,10 @@
"Failed to initialize TurbineGlobalCacheService",x);
}
}
-
+
try {
cache = new Hashtable(cacheInitialSize);
-
+
// Start housekeeping thread.
Thread housekeeping = new Thread(this);
// Indicate that this is a system thread. JVM will quit only when there
@@ -351,12 +353,12 @@
int objectsize = baos.toByteArray().length - 4;
return objectsize;
}
-
+
/**
* Flush the cache of all objects.
*/
public void flushCache() {
-
+
synchronized (this) {
for ( Enumeration e = cache.keys(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
1.2 +24 -24 jakarta-turbine-2/src/java/org/apache/turbine/services/factory/TurbineFactoryService.java
Index: TurbineFactoryService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/factory/TurbineFactoryService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineFactoryService.java 16 Aug 2001 05:08:53 -0000 1.1
+++ TurbineFactoryService.java 13 Mar 2002 19:43:34 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -63,7 +63,7 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.pool.ObjectInputStreamForContext;
@@ -79,9 +79,9 @@
* will be used.
*
* @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
- * @version $Id: TurbineFactoryService.java,v 1.1 2001/08/16 05:08:53 jvanzyl Exp $
+ * @version $Id: TurbineFactoryService.java,v 1.2 2002/03/13 19:43:34 mpoeschl Exp $
*/
-public class TurbineFactoryService
+public class TurbineFactoryService
extends TurbineBaseService
implements FactoryService
{
@@ -116,7 +116,7 @@
* Additional class loaders.
*/
private ArrayList classLoaders = new ArrayList();
-
+
/**
* Customized object factories.
*/
@@ -164,19 +164,19 @@
catch (Exception x)
{
throw new InitializationException(
- "No such class loader '" +
- (String) loaders.get(i) +
+ "No such class loader '" +
+ (String) loaders.get(i) +
"' for TurbinbeFactoryService",x);
}
}
}
-
+
String key,factory;
for (Iterator i = conf.getKeys(OBJECT_FACTORY); i.hasNext();)
{
key = (String) i.next();
factory = conf.getString(key);
-
+
/*
* Store the factory to the table as a string and
* instantiate it by using the service when needed.
@@ -227,10 +227,10 @@
/**
* Gets an instance of a named class using a specified class loader.
- *
+ *
* <p>Class loaders are supported only if the isLoaderSupported
- * method returns true. Otherwise the loader parameter is ignored.
- *
+ * method returns true. Otherwise the loader parameter is ignored.
+ *
* @param className the name of the class.
* @param loader the class loader.
* @return the instance.
@@ -323,8 +323,8 @@
* primitive types must be wrapped with a corresponding class.
*
* <p>Class loaders are supported only if the isLoaderSupported
- * method returns true. Otherwise the loader parameter is ignored.
- *
+ * method returns true. Otherwise the loader parameter is ignored.
+ *
* @param className the name of the class.
* @param loader the class loader.
* @param params an array containing the parameters of the constructor.
@@ -374,16 +374,16 @@
/**
* Tests if specified class loaders are supported for a named class.
- *
+ *
* @param className the name of the class.
- * @return true if class loaders are supported, false otherwise.
+ * @return true if class loaders are supported, false otherwise.
* @throws TurbineException if test fails.
*/
public boolean isLoaderSupported(String className)
throws TurbineException
{
Factory factory = getFactory(className);
- return factory != null ?
+ return factory != null ?
factory.isLoaderSupported() : true;
}
@@ -476,7 +476,7 @@
!tempLoader.equals(params[i].getClass().getClassLoader()))
{
/*
- * The class uses a different class loader,
+ * The class uses a different class loader,
* switch the parameter.
*/
params[i] = switchObjectContext(params[i],loader);
@@ -583,10 +583,10 @@
return loader != null ?
loader.loadClass(className) : loadClass(className);
}
-
+
/**
* Gets a customized factory for a named class.
- *
+ *
* @param className the name of the class to load.
* @return the factory or null if not specified.
* @throws TurbineException if instantiation of the factory fails.
@@ -613,7 +613,7 @@
catch (ClassCastException x)
{
throw new TurbineException(
- "Incorrect factory " + (String) factory +
+ "Incorrect factory " + (String) factory +
" for class " + className,x);
}
factories = (HashMap) factories.clone();
1.2 +2 -2 jakarta-turbine-2/src/java/org/apache/turbine/services/webmacro/TurbineTemplateProvider.java
Index: TurbineTemplateProvider.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/webmacro/TurbineTemplateProvider.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineTemplateProvider.java 16 Aug 2001 05:09:26 -0000 1.1
+++ TurbineTemplateProvider.java 13 Mar 2002 19:43:34 -0000 1.2
@@ -59,7 +59,7 @@
import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.services.template.TurbineTemplate;
import org.apache.turbine.util.Log;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
import org.webmacro.Broker;
import org.webmacro.NotFoundException;
import org.webmacro.Template;
@@ -82,7 +82,7 @@
*
* @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
- * @version $Id: TurbineTemplateProvider.java,v 1.1 2001/08/16 05:09:26 jvanzyl Exp $
+ * @version $Id: TurbineTemplateProvider.java,v 1.2 2002/03/13 19:43:34 mpoeschl Exp $
* @deprecated
*/
public class TurbineTemplateProvider
1.2 +2 -2 jakarta-turbine-2/src/java/org/apache/turbine/services/webmacro/TurbineWebMacroService.java
Index: TurbineWebMacroService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/webmacro/TurbineWebMacroService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineWebMacroService.java 16 Aug 2001 05:09:26 -0000 1.1
+++ TurbineWebMacroService.java 13 Mar 2002 19:43:34 -0000 1.2
@@ -72,7 +72,7 @@
import org.apache.turbine.util.template.TemplateLink;
import org.apache.turbine.util.template.TemplatePageAttributes;
import org.apache.turbine.util.webmacro.WebMacroFormatter;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
import org.webmacro.Broker;
import org.webmacro.Context;
import org.webmacro.FastWriter;
@@ -113,7 +113,7 @@
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @version $Id: TurbineWebMacroService.java,v 1.1 2001/08/16 05:09:26 jvanzyl Exp $
+ * @version $Id: TurbineWebMacroService.java,v 1.2 2002/03/13 19:43:34 mpoeschl Exp $
* @deprecated
*/
public class TurbineWebMacroService extends BaseTemplateEngineService
1.2 +2 -1 jakarta-turbine-2/src/java/org/apache/turbine/services/BaseUnicastRemoteService.java
Index: BaseUnicastRemoteService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/BaseUnicastRemoteService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseUnicastRemoteService.java 16 Aug 2001 05:08:46 -0000 1.1
+++ BaseUnicastRemoteService.java 13 Mar 2002 19:43:34 -0000 1.2
@@ -1,11 +1,12 @@
package org.apache.turbine.services;
+import org.apache.stratum.configuration.Configuration;
+
import java.util.Properties;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import javax.servlet.ServletConfig;
-import org.apache.velocity.runtime.configuration.Configuration;
/**
* A base implementation of an {@link java.rmi.server.UnicastRemoteObject}
1.2 +3 -2 jakarta-turbine-2/src/java/org/apache/turbine/services/Service.java
Index: Service.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/Service.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Service.java 16 Aug 2001 05:08:47 -0000 1.1
+++ Service.java 13 Mar 2002 19:43:34 -0000 1.2
@@ -55,7 +55,8 @@
*/
import java.util.Properties;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
+
/**
* <code>Services</code> are <code>Initables</code> that have a name,
@@ -66,7 +67,7 @@
* @author <a href="mailto:burton@apache.org">Kevin Burton</a>
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
- * @version $Id: Service.java,v 1.1 2001/08/16 05:08:47 jvanzyl Exp $
+ * @version $Id: Service.java,v 1.2 2002/03/13 19:43:34 mpoeschl Exp $
*/
public interface Service
extends Initable
1.2 +8 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/ServiceBroker.java
Index: ServiceBroker.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/ServiceBroker.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceBroker.java 16 Aug 2001 05:08:47 -0000 1.1
+++ ServiceBroker.java 13 Mar 2002 19:43:34 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -55,7 +55,8 @@
*/
import java.util.Properties;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
+
/**
* Classes that implement this interface can act as a broker for
@@ -77,7 +78,7 @@
* @author <a href="mailto:burton@apache.org">Kevin Burton</a>
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
- * @version $Id: ServiceBroker.java,v 1.1 2001/08/16 05:08:47 jvanzyl Exp $
+ * @version $Id: ServiceBroker.java,v 1.2 2002/03/13 19:43:34 mpoeschl Exp $
*/
public interface ServiceBroker
extends InitableBroker
@@ -123,7 +124,7 @@
/**
* Shutdowns all Services.
*
- * This method is used to release resources allocated by
+ * This method is used to release resources allocated by
* Services, and return them to initial (uninitailized) state.
*/
public void shutdownServices( );
1.3 +14 -15 jakarta-turbine-2/src/java/org/apache/turbine/services/TurbineServices.java
Index: TurbineServices.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/TurbineServices.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TurbineServices.java 12 Oct 2001 16:41:22 -0000 1.2
+++ TurbineServices.java 13 Mar 2002 19:43:34 -0000 1.3
@@ -64,7 +64,8 @@
import org.apache.turbine.services.logging.LoggingService;
import org.apache.turbine.services.resources.ResourceService;
import org.apache.turbine.services.resources.TurbineResources;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
+
/**
* This is a singleton utility class that acts as a Services broker.
@@ -74,7 +75,7 @@
* @author <a href="mailto:burton@apache.org">Kevin Burton</a>
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
- * @version $Id: TurbineServices.java,v 1.2 2001/10/12 16:41:22 jvanzyl Exp $
+ * @version $Id: TurbineServices.java,v 1.3 2002/03/13 19:43:34 mpoeschl Exp $
*/
public class TurbineServices
extends BaseServiceBroker
@@ -167,7 +168,7 @@
public void initPrimaryServices(ServletConfig config)
throws InstantiationException, InitializationException
{
- // Resurce service must start as the very first
+ // Resource service must start as the very first
String resourcesClass = config.getInitParameter(RESOURCES_CLASS_KEY);
try
@@ -176,33 +177,31 @@
{
resourcesClass = RESOURCES_CLASS_DEFAULT;
}
- mapping.put(ResourceService.SERVICE_NAME, resourcesClass);
- initService (ResourceService.SERVICE_NAME, config);
-
+ mapping.setProperty(ResourceService.SERVICE_NAME, resourcesClass);
+ initService(ResourceService.SERVICE_NAME, config);
- // Now logging can be initailzed
+ // Now logging can be initialized
String loggingClass = config.getInitParameter(LOGGING_CLASS_KEY);
if (loggingClass == null)
{
loggingClass = LOGGING_CLASS_DEFAULT;
}
- mapping.put(LoggingService.SERVICE_NAME, loggingClass);
+ mapping.setProperty(LoggingService.SERVICE_NAME, loggingClass);
try
{
- initService (LoggingService.SERVICE_NAME, config);
+ initService(LoggingService.SERVICE_NAME, config);
logger = getLogger();
}
catch (InitializationException e)
{
- mapping.remove(LoggingService.SERVICE_NAME);
+ mapping.clearProperty(LoggingService.SERVICE_NAME);
throw e;
}
catch (InstantiationException e)
{
- mapping.remove(LoggingService.SERVICE_NAME);
+ mapping.clearProperty(LoggingService.SERVICE_NAME);
throw e;
}
-
}
finally
{
@@ -245,7 +244,7 @@
{
int pref = SERVICE_PREFIX.length();
int suff = CLASSNAME_SUFFIX.length();
-
+
/*
* These keys returned in an order that corresponds
* to the order the services are listed in
@@ -266,7 +265,7 @@
{
String serviceKey = key.substring(pref, key.length() - suff);
notice ("Added Mapping for Service: " + serviceKey);
-
+
if (! mapping.containsKey(serviceKey))
mapping.setProperty(serviceKey, TurbineResources.getString(key));
}
@@ -410,7 +409,7 @@
System.out.println("(!) ERROR: " + t.getMessage());
}
else
- {
+ {
logger.error("", t);
}
}
1.2 +34 -34 jakarta-turbine-2/src/java/org/apache/turbine/services/BaseServiceBroker.java
Index: BaseServiceBroker.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/BaseServiceBroker.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseServiceBroker.java 16 Aug 2001 05:08:46 -0000 1.1
+++ BaseServiceBroker.java 13 Mar 2002 19:43:35 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -61,8 +61,9 @@
import java.util.Properties;
import org.apache.turbine.util.StringUtils;
+import org.apache.stratum.configuration.BaseConfiguration;
+import org.apache.stratum.configuration.Configuration;
-import org.apache.velocity.runtime.configuration.Configuration;
/**
* A generic implementation of a <code>ServiceBroker</code>.
@@ -83,7 +84,7 @@
* @author <a href="mailto:burton@apache.org">Kevin Burton</a>
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
- * @version $Id: BaseServiceBroker.java,v 1.1 2001/08/16 05:08:46 jvanzyl Exp $
+ * @version $Id: BaseServiceBroker.java,v 1.2 2002/03/13 19:43:35 mpoeschl Exp $
*/
public abstract class BaseServiceBroker
extends BaseInitableBroker
@@ -91,7 +92,7 @@
{
/** Mapping of Service names to class names. */
//protected Hashtable mapping = new Hashtable();
- protected Configuration mapping = new Configuration();
+ protected Configuration mapping = (Configuration) new BaseConfiguration();
/** A repository of Service instances. */
protected Hashtable services = new Hashtable();
@@ -127,15 +128,14 @@
* @exception InitializationException Initilaization of this
* service was not successful.
*/
- public void initService( String name,
- Object data )
+ public void initService( String name, Object data )
throws InitializationException
{
- String className = (String) mapping.get(name);
+ String className = mapping.getString(name);
if (StringUtils.isEmpty(className))
{
throw new InitializationException(
- "ServiceBroker: initialization of unknown service " +
+ "ServiceBroker: initialization of unknown service " +
name + " requested.");
}
initClass(className, data);
@@ -163,7 +163,7 @@
}
/**
- * Performs early initiailzation of all services. You can decide
+ * Performs early initiailzation of all services. You can decide
* to handle failed initizalizations if you wish, but then
* after one service fails, the other will not have the chance
* to initialize.
@@ -174,11 +174,11 @@
public void initServices( Object data, boolean report )
throws InstantiationException, InitializationException
{
- notice("Initializing all services using: " +
+ notice("Initializing all services using: " +
data.getClass().getName());
Iterator names = mapping.getKeys();
- // throw exceptions
- if(report)
+ // throw exceptions
+ if(report)
{
while(names.hasNext())
{
@@ -221,7 +221,7 @@
// Make sure the service has it's name and broker
// reference set before initialization.
getServiceInstance(name);
-
+
// Perform early initialization.
initClass(mapping.getString(name), data);
@@ -238,7 +238,7 @@
*/
public void shutdownService( String name )
{
- String className = (String)mapping.get(name);
+ String className = mapping.getString(name);
if (className != null)
{
shutdownClass(className);
@@ -246,33 +246,33 @@
}
/**
- * Shuts down all Turbine services, releasing allocated resources and
+ * Shuts down all Turbine services, releasing allocated resources and
* returning them to their initial (uninitailized) state.
*/
public void shutdownServices( )
{
notice("Shutting down all services!");
-
+
Iterator serviceNames = mapping.getKeys();
String serviceName = null;
-
+
/*
* Now we want to reverse the order of
- * this list. This functionality should be added to
+ * this list. This functionality should be added to
* the ExtendedProperties in the commons but
* this will fix the problem for now.
*/
-
+
ArrayList reverseServicesList = new ArrayList();
-
+
while (serviceNames.hasNext())
{
serviceName = (String)serviceNames.next();
reverseServicesList.add(0, serviceName);
}
-
+
serviceNames = reverseServicesList.iterator();
-
+
while (serviceNames.hasNext())
{
serviceName = (String)serviceNames.next();
@@ -321,7 +321,7 @@
}
catch( InitializationException e )
{
- throw new InstantiationException("Service " + name +
+ throw new InstantiationException("Service " + name +
" failed to initialize", e);
}
}
@@ -350,7 +350,7 @@
if(service == null)
{
- String className = (String)mapping.get(name);
+ String className = mapping.getString(name);
if(className == null)
{
throw new InstantiationException(
@@ -387,10 +387,10 @@
* @param name The name of the service.
* @return Properties of requested Service.
*/
- public Properties getProperties( String name )
- {
+ public Properties getProperties( String name )
+ {
return new Properties();
- }
+ }
/**
* Returns the Configuration of a specific service.
@@ -400,8 +400,8 @@
* @param name The name of the service.
* @return Properties of requested Service.
*/
- public Configuration getConfiguration( String name )
- {
- return new Configuration();
- }
+ public Configuration getConfiguration( String name )
+ {
+ return (Configuration) new BaseConfiguration();
+ }
}
1.2 +6 -6 jakarta-turbine-2/src/java/org/apache/turbine/services/BaseService.java
Index: BaseService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/BaseService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseService.java 16 Aug 2001 05:08:46 -0000 1.1
+++ BaseService.java 13 Mar 2002 19:43:35 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -55,14 +55,14 @@
*/
import java.util.Properties;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
/**
* This class is a generic implementation of <code>Service</code>.
*
* @author <a href="mailto:burton@apache.org">Kevin Burton</a>
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
- * @version $Id: BaseService.java,v 1.1 2001/08/16 05:08:46 jvanzyl Exp $
+ * @version $Id: BaseService.java,v 1.2 2002/03/13 19:43:35 mpoeschl Exp $
*/
public class BaseService
extends BaseInitable
1.3 +3 -3 jakarta-turbine-2/src/java/org/apache/turbine/services/xmlrpc/TurbineXmlRpcService.java
Index: TurbineXmlRpcService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/xmlrpc/TurbineXmlRpcService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TurbineXmlRpcService.java 10 Oct 2001 14:01:25 -0000 1.2
+++ TurbineXmlRpcService.java 13 Mar 2002 19:43:35 -0000 1.3
@@ -77,8 +77,8 @@
import org.apache.turbine.services.xmlrpc.util.FileTransfer;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.TurbineException;
+import org.apache.stratum.configuration.Configuration;
-import org.apache.velocity.runtime.configuration.Configuration;
/**
* This is a service which will make an xml-rpc call to a remote
@@ -100,7 +100,7 @@
* @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
- * @version $Id: TurbineXmlRpcService.java,v 1.2 2001/10/10 14:01:25 jvanzyl Exp $
+ * @version $Id: TurbineXmlRpcService.java,v 1.3 2002/03/13 19:43:35 mpoeschl Exp $
*/
public class TurbineXmlRpcService
extends TurbineBaseService
@@ -148,7 +148,7 @@
{
String option = (String) i.next();
String value = secureServerOptions.getString(option);
-
+
Log.debug("JSSE option: " + option + " => " + value);
System.setProperty(option, value);
1.6 +10 -6 jakarta-turbine-2/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
Index: TurbineVelocityService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TurbineVelocityService.java 6 Dec 2001 13:58:16 -0000 1.5
+++ TurbineVelocityService.java 13 Mar 2002 19:43:35 -0000 1.6
@@ -68,7 +68,6 @@
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.context.Context;
-import org.apache.velocity.runtime.configuration.Configuration;
import org.apache.turbine.Turbine;
import org.apache.turbine.util.ContentURI;
@@ -87,6 +86,10 @@
import org.apache.turbine.services.template.TurbineTemplate;
import org.apache.turbine.services.template.BaseTemplateEngineService;
+import org.apache.stratum.configuration.Configuration;
+import org.apache.stratum.configuration.ConfigurationConverter;
+
+
/**
* This is a Service that can process Velocity templates from within a
* Turbine Screen. Here's an example of how you might use it from a
@@ -104,7 +107,7 @@
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
* @author <a href="mailto:sean@informage.ent">Sean Legassick</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
- * @version $Id: TurbineVelocityService.java,v 1.5 2001/12/06 13:58:16 jvanzyl Exp $
+ * @version $Id: TurbineVelocityService.java,v 1.6 2002/03/13 19:43:35 mpoeschl Exp $
*/
public class TurbineVelocityService extends BaseTemplateEngineService
implements VelocityService
@@ -129,7 +132,7 @@
* The prefix used for URIs which are of type <code>absolute</code>.
*/
private static final String ABSOLUTE_PREFIX = "file://";
-
+
/**
* The context used to the store the context
* containing the global application tools.
@@ -540,7 +543,7 @@
*/
String path = Turbine.getRealPath
(configuration.getString(Velocity.RUNTIME_LOG, null));
-
+
if (StringUtils.isValid(path))
{
configuration.setProperty(Velocity.RUNTIME_LOG, path);
@@ -549,7 +552,7 @@
{
String msg = VelocityService.SERVICE_NAME + " runtime log file " +
"is misconfigured: '" + path + "' is not a valid log file";
-
+
if (TurbineServlet.getServletConfig() instanceof TurbineConfig)
{
msg += ": TurbineConfig users must use a path relative to " +
@@ -631,7 +634,8 @@
}
try
{
- Velocity.setConfiguration(configuration);
+ Velocity.setExtendedProperties(ConfigurationConverter
+ .getExtendedProperties(configuration));
Velocity.init();
}
catch(Exception e)
1.3 +20 -10 jakarta-turbine-2/src/java/org/apache/turbine/services/resources/TurbineResources.java
Index: TurbineResources.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/resources/TurbineResources.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TurbineResources.java 21 Sep 2001 02:20:51 -0000 1.2
+++ TurbineResources.java 13 Mar 2002 19:43:35 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -58,20 +58,20 @@
import java.util.Vector;
import javax.servlet.ServletConfig;
import org.apache.turbine.services.TurbineServices;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
/**
* <p>This is a static class for defining the default Turbine configuration
* keys used by core Turbine components.</p>
- * <p>It also extends the basic static accessor class to the
- * <code>ResourcesService</code> so that you directly access the
+ * <p>It also extends the basic static accessor class to the
+ * <code>ResourcesService</code> so that you directly access the
* properties through this class</p>
*
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
* @author <a href="mailto:greg@shwoop.com">Greg Ritter</a>
* @author <a href="mailto:luta.raphael@networks.vivendi.net">Rapha�l Luta</a>
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- * @version $Id: TurbineResources.java,v 1.2 2001/09/21 02:20:51 jvanzyl Exp $
+ * @version $Id: TurbineResources.java,v 1.3 2002/03/13 19:43:35 mpoeschl Exp $
*/
public abstract class TurbineResources
{
@@ -100,7 +100,7 @@
public static final String DB_IDBROKER_PREFETCH = "database.idbroker.prefetch";
/**
- * Utility method for accessing the service
+ * Utility method for accessing the service
* implementation
*
* @return a ResourcesService implementation instance
@@ -121,7 +121,7 @@
public static void setProperty(String key, String value)
{
getService().setProperty(key,value);
- }
+ }
/**
* The purpose of this method is to get the configuration resource
@@ -351,6 +351,16 @@
public static ResourceService getResources(String prefix)
{
return getService().getResources(prefix);
+ }
+
+ /**
+ * Get the configuraton.
+ *
+ * @return configuration.
+ */
+ public static Configuration getConfiguration()
+ {
+ return getService().getConfiguration();
}
/**
1.3 +9 -8 jakarta-turbine-2/src/java/org/apache/turbine/services/resources/ResourceService.java
Index: ResourceService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/resources/ResourceService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ResourceService.java 21 Sep 2001 02:20:51 -0000 1.2
+++ ResourceService.java 13 Mar 2002 19:43:35 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -59,12 +59,13 @@
import java.util.Vector;
import javax.servlet.ServletConfig;
import org.apache.turbine.services.Service;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
+
/**
* <p>This service define a resource interface for accessing the configuration
* information of the application.</p>
- * <p>Since implementations of this service are used by Turbine itself and
+ * <p>Since implementations of this service are used by Turbine itself and
* the <code>TurbineServices</code> depends on their proper operation, they
* must respect some specific implementation rules:</p>
* <ul>
@@ -72,7 +73,7 @@
* in their inititialization code. This would create circular services
* dependency
* </li>
- * <li>They must provide an early initialization init method. The
+ * <li>They must provide an early initialization init method. The
* <code>ServletConfig</code> init parameters are the only way
* to retrieve parameters for this service. It's impossible to use
* TurbineServices utility methods for this purpose
@@ -83,7 +84,7 @@
* @author <a href="mailto:greg@shwoop.com">Greg Ritter</a>
* @author <a href="mailto:luta.raphael@networks.vivendi.net">Rapha�l Luta</a>
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- * @version $Id: ResourceService.java,v 1.2 2001/09/21 02:20:51 jvanzyl Exp $
+ * @version $Id: ResourceService.java,v 1.3 2002/03/13 19:43:35 mpoeschl Exp $
*/
public interface ResourceService extends Service
{
1.6 +54 -64 jakarta-turbine-2/src/java/org/apache/turbine/services/resources/TurbineResourceService.java
Index: TurbineResourceService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/resources/TurbineResourceService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TurbineResourceService.java 19 Nov 2001 17:56:01 -0000 1.5
+++ TurbineResourceService.java 13 Mar 2002 19:43:35 -0000 1.6
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -70,7 +70,11 @@
import org.apache.turbine.util.ServletUtils;
import org.apache.turbine.util.TurbineConfig;
import org.apache.turbine.util.TurbineException;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.BaseConfiguration;
+import org.apache.stratum.configuration.Configuration;
+import org.apache.stratum.configuration.ConfigurationConverter;
+import org.apache.stratum.configuration.PropertiesConfiguration;
+
/**
* <p>This implementation of the <code>resourcesService</code> relies
@@ -93,9 +97,9 @@
* @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
* @author <a href="mailto:luta.raphael@networks.vivendi.net">Rapha�l Luta</a>
* @author <a href="mailto:jvanzyl@periapt.com@">Jason van Zyl</a>
- * @version $Id: TurbineResourceService.java,v 1.5 2001/11/19 17:56:01 jvanzyl Exp $
+ * @version $Id: TurbineResourceService.java,v 1.6 2002/03/13 19:43:35 mpoeschl Exp $
*/
-public class TurbineResourceService
+public class TurbineResourceService
extends TurbineBaseService
implements ResourceService
{
@@ -137,12 +141,12 @@
*
* @param config a ServletConfig object
*/
- public void init(ServletConfig config)
+ public void init(ServletConfig config)
throws InitializationException
{
String props = config.getInitParameter(TurbineServices.PROPERTIES_PATH_KEY);
-
- if(props == null)
+
+ if(props == null)
{
props = TurbineServices.PROPERTIES_PATH_DEFAULT;
}
@@ -156,10 +160,10 @@
// shouldn't since WAR files are the future anyways.
//props = ServletUtils.expandRelative(config, props);
props = Turbine.getRealPath(props);
-
+
try
{
- init(new Configuration(props));
+ init((Configuration) new PropertiesConfiguration(props));
}
catch (IOException e)
{
@@ -178,11 +182,11 @@
public static void setPropertiesFileName(String propertiesFileName)
throws TurbineException
{
- Configuration mappings = new Configuration();
-
+ Configuration mappings = (Configuration) new BaseConfiguration();
+
mappings.setProperty(ResourceService.SERVICE_NAME,
TurbineResourceService.class.getName());
-
+
TurbineServices services = (TurbineServices) TurbineServices.getInstance();
services.initMapping(mappings);
services.initServices(new TurbineConfig(".", propertiesFileName), true);
@@ -200,11 +204,11 @@
public static void setProperties(Properties properties)
throws TurbineException
{
- Configuration mappings = new Configuration();
-
+ Configuration mappings = (Configuration) new BaseConfiguration();
+
mappings.setProperty(ResourceService.SERVICE_NAME,
TurbineResourceService.class.getName());
-
+
TurbineServices services = (TurbineServices) TurbineServices.getInstance();
services.initMapping(mappings);
services.initServices(properties, true);
@@ -226,8 +230,8 @@
if (base == null)
{
return null;
- }
-
+ }
+
//Get the full ResourceService (we could be in a subset instance)
ResourceService top = TurbineResources.getService();
@@ -236,21 +240,21 @@
int prec = 0-END_TOKEN.length();
String variable = null;
StringBuffer result = new StringBuffer();
-
+
// FIXME: we should probably allow the escaping of the start token
while ( ((begin=base.indexOf(START_TOKEN,prec+END_TOKEN.length()))>-1)
- && ((end=base.indexOf(END_TOKEN,begin))>-1) )
+ && ((end=base.indexOf(END_TOKEN,begin))>-1) )
{
result.append(base.substring(prec+END_TOKEN.length(),begin));
variable = base.substring(begin+START_TOKEN.length(),end);
- if (top.getString(variable)!=null)
+ if (top.getString(variable)!=null)
{
result.append(top.getString(variable));
}
prec=end;
}
result.append(base.substring(prec+END_TOKEN.length(),base.length()));
-
+
return result.toString();
}
@@ -287,7 +291,8 @@
*/
private void init(Properties props)
{
- Configuration configuration = Configuration.convertProperties(props);
+ Configuration configuration = ConfigurationConverter
+ .getConfiguration(props);
init(configuration);
}
@@ -312,8 +317,7 @@
* @param def The default value of the resource.
* @return The value of the named resource as a boolean.
*/
- public boolean getBoolean(String name,
- boolean def)
+ public boolean getBoolean(String name, boolean def)
{
return getConfiguration().getBoolean(name, def);
}
@@ -338,8 +342,7 @@
* @param def The default value of the resource.
* @return The value of the named resource as a double.
*/
- public double getDouble(String name,
- double def)
+ public double getDouble(String name, double def)
{
return getConfiguration().getDouble(name, def);
}
@@ -364,26 +367,17 @@
* @param def The default value of the resource.
* @return The value of the resource as a float.
*/
- public float getFloat(String name,
- float def)
+ public float getFloat(String name, float def)
{
return getConfiguration().getFloat(name, def);
}
/**
* The purpose of this method is to get the configuration resource
- * with the given name as an Integer.
- *
- * @param name The resource name.
- * @return The value of the resource as an Integer.
- */
-
- /**
- * The purpose of this method is to get the configuration resource
* with the given name as an integer.
*
* @param name The resource name.
- * @return The value of the resource as an integer.
+ * @return The value of the resource as an int.
*/
public int getInt(String name)
{
@@ -398,8 +392,7 @@
* @param def The default value of the resource.
* @return The value of the resource as an integer.
*/
- public int getInt(String name,
- int def)
+ public int getInt(String name, int def)
{
return getConfiguration().getInt(name, def);
}
@@ -448,8 +441,7 @@
* @param def The default value of the resource.
* @return The value of the resource as a long.
*/
- public long getLong(String name,
- long def)
+ public long getLong(String name, long def)
{
return getConfiguration().getLong(name, def);
}
@@ -474,8 +466,7 @@
* @param def The default value of the resource.
* @return The value of the resource as a string.
*/
- public String getString(String name,
- String def)
+ public String getString(String name, String def)
{
return interpolate(getConfiguration().getString(name, def));
}
@@ -491,14 +482,14 @@
{
String[] std = getConfiguration().getStringArray(name);
- if (std != null)
+ if (std != null)
{
- for(int i=0; i<std.length; i++)
+ for(int i=0; i<std.length; i++)
{
std[i]=interpolate(std[i]);
}
}
-
+
return std;
}
@@ -512,18 +503,18 @@
public Vector getVector(String name)
{
Vector std = getConfiguration().getVector(name);
-
- if (std != null)
+
+ if (std != null)
{
Vector newstd = new Vector();
Enumeration en = std.elements();
- while (en.hasMoreElements())
+ while (en.hasMoreElements())
{
newstd.addElement(interpolate((String)en.nextElement()));
}
std = newstd;
}
-
+
return std;
}
@@ -535,17 +526,16 @@
* @param def The default value of the resource.
* @return The value of the resource as a vector.
*/
- public Vector getVector(String name,
- Vector def)
+ public Vector getVector(String name, Vector def)
{
- Vector std = getVector(name);
- if (std == null)
+ Vector std = getVector(name);
+ if (std == null)
{
- if (def != null)
+ if (def != null)
{
std = new Vector();
Enumeration en = def.elements();
- while (en.hasMoreElements())
+ while (en.hasMoreElements())
{
std.addElement(interpolate((String)en.nextElement()));
}
@@ -566,12 +556,12 @@
public ResourceService getResources(String prefix)
{
Configuration config = getConfiguration().subset(prefix);
-
+
if (config == null)
{
return null;
}
-
+
TurbineResourceService res = new TurbineResourceService();
res.init(config);
return (ResourceService)res;
@@ -588,12 +578,12 @@
public Configuration getConfiguration(String prefix)
{
Configuration config = getConfiguration().subset(prefix);
-
+
if (config == null)
{
return null;
}
-
+
return config;
}
}
1.2 +43 -42 jakarta-turbine-2/src/java/org/apache/turbine/services/jsp/TurbineJspService.java
Index: TurbineJspService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/jsp/TurbineJspService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineJspService.java 16 Aug 2001 05:09:01 -0000 1.1
+++ TurbineJspService.java 13 Mar 2002 19:43:35 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -54,7 +54,7 @@
* <http://www.apache.org/>.
*/
-// Java Stuff
+// Java Stuff
import java.io.File;
import java.io.IOException;
@@ -76,10 +76,11 @@
import org.apache.turbine.services.template.BaseTemplateEngineService;
import org.apache.turbine.services.template.TurbineTemplate;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
+
/**
- * This is a Service that can process JSP templates from within a Turbine
+ * This is a Service that can process JSP templates from within a Turbine
* screen.
*
* @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
@@ -91,7 +92,7 @@
{
/** The base path[s] prepended to filenames given in arguments */
private String[] templatePaths;
-
+
/** The relative path[s] prepended to filenames */
private String[] relativeTemplatePaths;
@@ -115,12 +116,12 @@
"TurbineJspService failed to initialize", e);
}
}
-
+
/**
* Adds some convenience objects to the request. For example an instance
* of JspLink which can be used to generate links to other templates.
- *
- * @param RunData the turbine rundata object
+ *
+ * @param RunData the turbine rundata object
*/
public void addDefaultObjects(RunData data)
{
@@ -131,7 +132,7 @@
/**
* The buffer size
- *
+ *
*/
public int getDefaultBufferSize()
{
@@ -139,56 +140,56 @@
}
/**
- * Process the request
- *
- * @param RunData
+ * Process the request
+ *
+ * @param RunData
* @param String the filename of the template.
* @throws TurbineException Any exception trown while processing will be
* wrapped into a TurbineException and rethrown.
*/
- public void handleRequest(RunData data, String filename)
+ public void handleRequest(RunData data, String filename)
throws TurbineException
{
handleRequest(data, filename, false);
}
-
+
/**
- * Process the request
- *
- * @param RunData
+ * Process the request
+ *
+ * @param RunData
* @param String the filename of the template.
* @param boolean whether to perform a forward or include.
* @throws TurbineException Any exception trown while processing will be
* wrapped into a TurbineException and rethrown.
*/
- public void handleRequest(RunData data, String filename, boolean isForward)
+ public void handleRequest(RunData data, String filename, boolean isForward)
throws TurbineException
- {
+ {
/** template name with relative path */
String relativeTemplateName = getRelativeTemplateName(filename);
-
+
if (relativeTemplateName == null)
{
throw new TurbineException(
"Template " + filename + " not found in template paths");
}
-
+
// get the RequestDispatcher for the JSP
RequestDispatcher dispatcher = data.getServletContext()
.getRequestDispatcher(relativeTemplateName);
-
+
try
{
if (isForward)
{
// forward the request to the JSP
- dispatcher.forward( data.getRequest(), data.getResponse() );
+ dispatcher.forward( data.getRequest(), data.getResponse() );
}
else
{
data.getOut().flush();
// include the JSP
- dispatcher.include( data.getRequest(), data.getResponse() );
+ dispatcher.include( data.getRequest(), data.getResponse() );
}
}
catch(Exception e)
@@ -197,12 +198,12 @@
// message to the browser, to speed up debugging
try
{
- data.getOut().print("Error encountered processing a template: "+filename);
+ data.getOut().print("Error encountered processing a template: "+filename);
e.printStackTrace(data.getOut());
}
- catch(IOException ignored)
+ catch(IOException ignored)
{
- }
+ }
// pass the exception to the caller according to the general
// contract for tamplating services in Turbine
@@ -210,7 +211,7 @@
"Error encountered processing a template:" + filename, e);
}
}
-
+
/**
* This method sets up the template cache.
*/
@@ -225,13 +226,13 @@
*/
templatePaths = TurbineTemplate.translateTemplatePaths(
config.getStringArray("templates"));
-
+
/*
* Set relative paths from config.
* Needed for javax.servlet.RequestDispatcher
*/
relativeTemplatePaths = config.getStringArray("templates");
-
+
/*
* Make sure that the relative paths begin with /
*/
@@ -242,9 +243,9 @@
relativeTemplatePaths[i] = "/" + relativeTemplatePaths[i];
}
}
-
+
bufferSize = config.getInt("buffer.size", 8192);
-
+
/*
* Register with the template service.
*/
@@ -263,7 +264,7 @@
public boolean templateExists(String template)
{
return TurbineTemplate.templateExists(template, templatePaths);
- }
+ }
/**
* Searchs for a template in the default.template path[s] and
* returns the template name with a relative path which is
@@ -276,14 +277,14 @@
public String getRelativeTemplateName(String template)
{
- /*
+ /*
* A dummy String[] object used to pass a String to
* TurbineTemplate.templateExists
*/
String[] testTemplatePath = new String[1];
-
- /**
- * Find which template path the template is in
+
+ /**
+ * Find which template path the template is in
*/
for (int i = 0; i < relativeTemplatePaths.length; i++)
{
@@ -293,7 +294,7 @@
return relativeTemplatePaths[i] + template;
}
}
-
+
return null;
- }
+ }
}
1.3 +110 -109 jakarta-turbine-2/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
Index: TurbineTemplateService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/template/TurbineTemplateService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TurbineTemplateService.java 28 Aug 2001 16:33:46 -0000 1.2
+++ TurbineTemplateService.java 13 Mar 2002 19:43:35 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -70,7 +70,8 @@
import org.apache.turbine.services.resources.TurbineResources;
import org.apache.turbine.services.servlet.TurbineServlet;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
+
/**
* This service provides a method for mapping templates to their
@@ -79,38 +80,38 @@
* template structure. It also performs caching if turned on in the
* properties file.
*
- * Since everything is keyed off the template variable,
+ * Since everything is keyed off the template variable,
* if data.getParameters().getString("template") returns
- * /about_us/directions/driving.vm, the search for the
+ * /about_us/directions/driving.vm, the search for the
* Screen class is as follows (in order):
- *
- * 1. about_us.directions.Driving
- * 2. about_us.directions.Default
- * 3. about_us.Default
- * 4. Default
+ *
+ * 1. about_us.directions.Driving
+ * 2. about_us.directions.Default
+ * 3. about_us.Default
+ * 4. Default
* 5. VelocityScreen
*
- * If the template variable does not exist, then VelocityScreen will be
- * executed and templates/screens/index.vm will be executed.
- * If index.vm is not found or if the template is invalid or Velocity
+ * If the template variable does not exist, then VelocityScreen will be
+ * executed and templates/screens/index.vm will be executed.
+ * If index.vm is not found or if the template is invalid or Velocity
* execution throws an exception of any reason, then
- * templates/screens/error.vm will be executed.
- *
- * For the Layouts and Navigations, the following paths will be
+ * templates/screens/error.vm will be executed.
+ *
+ * For the Layouts and Navigations, the following paths will be
* searched in the layouts and navigations template
- * subdirectories (in order):
- *
- * 1./about_us/directions/driving.vm
- * 2./about_us/directions/default.vm
- * 3./about_us/default.vm
- * 4./default.vm
+ * subdirectories (in order):
+ *
+ * 1./about_us/directions/driving.vm
+ * 2./about_us/directions/default.vm
+ * 3./about_us/default.vm
+ * 4./default.vm
*
* @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
* @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
- * @version $Id: TurbineTemplateService.java,v 1.2 2001/08/28 16:33:46 jvanzyl Exp $
+ * @version $Id: TurbineTemplateService.java,v 1.3 2002/03/13 19:43:35 mpoeschl Exp $
*/
public class TurbineTemplateService extends TurbineBaseService
implements TemplateService
@@ -142,24 +143,24 @@
TemplateEngineService.DEFAULT_NAVIGATION,
TemplateEngineService.DEFAULT_LAYOUT_TEMPLATE
};
-
- /**
- * The hashtables used to cache template object names.
+
+ /**
+ * The hashtables used to cache template object names.
*/
private Hashtable[] templateNameCache = new Hashtable[6];
- /**
- * Flag set if cache is to be used.
+ /**
+ * Flag set if cache is to be used.
*/
private boolean useCache = false;
- /**
- * Default extension for templates.
+ /**
+ * Default extension for templates.
*/
private String defaultExtension;
- /**
- * Default template with the default extension.
+ /**
+ * Default template with the default extension.
*/
private String defaultTemplate;
@@ -189,7 +190,7 @@
}
/**
- * Get the default template name extension specified
+ * Get the default template name extension specified
* in the template service properties.
*
* @return The default the extension.
@@ -198,7 +199,7 @@
{
return defaultExtension;
}
-
+
/**
* Get the default page module name of the template engine
* service corresponding to the default template name extension.
@@ -209,7 +210,7 @@
{
return getDefaultPageName(defaultTemplate);
}
-
+
/**
* Get the default screen module name of the template engine
* service corresponding to the default template name extension.
@@ -220,7 +221,7 @@
{
return getDefaultScreenName(defaultTemplate);
}
-
+
/**
* Get the default layout module name of the template engine
* service corresponding to the default template name extension.
@@ -231,7 +232,7 @@
{
return getDefaultLayoutName(defaultTemplate);
}
-
+
/**
* Get the default navigation module name of the template engine
* service corresponding to the default template name extension.
@@ -242,7 +243,7 @@
{
return getDefaultNavigationName(defaultTemplate);
}
-
+
/**
* Get the default layout template name of the template engine
* service corresponding to the default template name extension.
@@ -253,10 +254,10 @@
{
return getDefaultLayoutTemplateName(defaultTemplate);
}
-
+
/**
* Get the default page module name of the template engine
- * service corresponding to the template name extension of
+ * service corresponding to the template name extension of
* the named template.
*
* @param template The template name.
@@ -266,10 +267,10 @@
{
return getDefaultModuleName(template,PAGE_KEY);
}
-
+
/**
* Get the default screen module name of the template engine
- * service corresponding to the template name extension of
+ * service corresponding to the template name extension of
* the named template.
*
* @param template The template name.
@@ -279,10 +280,10 @@
{
return getDefaultModuleName(template,SCREEN_KEY);
}
-
+
/**
* Get the default layout module name of the template engine
- * service corresponding to the template name extension of
+ * service corresponding to the template name extension of
* the named template.
*
* @param template The template name.
@@ -292,10 +293,10 @@
{
return getDefaultModuleName(template,LAYOUT_KEY);
}
-
+
/**
* Get the default navigation module name of the template engine
- * service corresponding to the template name extension of
+ * service corresponding to the template name extension of
* the named template.
*
* @param template The template name.
@@ -305,10 +306,10 @@
{
return getDefaultModuleName(template,NAVIGATION_KEY);
}
-
+
/**
* Get the default layout template name of the template engine
- * service corresponding to the template name extension of
+ * service corresponding to the template name extension of
* the named template.
*
* @param template The template name.
@@ -316,7 +317,7 @@
*/
public String getDefaultLayoutTemplateName(String template)
{
- String layoutTemplate =
+ String layoutTemplate =
getDefaultModuleName(template,LAYOUT_TEMPLATE_KEY);
if ((layoutTemplate != null) &&
(layoutTemplate.indexOf('.') < 0))
@@ -327,7 +328,7 @@
}
return layoutTemplate;
}
-
+
/**
* Find the default page module name for the given request.
*
@@ -341,7 +342,7 @@
return template != null ?
getDefaultPageName(template) : getDefaultPage();
}
-
+
/**
* Find the default layout module name for the given request.
*
@@ -355,7 +356,7 @@
return template != null ?
getDefaultLayoutName(template) : getDefaultLayout();
}
-
+
/**
* Locate and return the name of the screen module to be used
* with the named screen template.
@@ -369,10 +370,10 @@
{
return getCachedName(template,SCREEN_KEY);
}
-
+
/**
* Locate and return the name of the layout module to be used
- * with the named layout template.
+ * with the named layout template.
*
* @param template The layout template name.
* @return The found layout module name.
@@ -383,10 +384,10 @@
{
return getCachedName(template,LAYOUT_KEY);
}
-
+
/**
* Locate and return the name of the navigation module to be used
- * with the named navigation template.
+ * with the named navigation template.
*
* @param template The navigation template name.
* @return The found navigation module name.
@@ -397,7 +398,7 @@
{
return getCachedName(template,NAVIGATION_KEY);
}
-
+
/**
* Locate and return the name of the screen template corresponding
* to the given template name parameter.
@@ -411,7 +412,7 @@
{
return getCachedName(template,SCREEN_TEMPLATE_KEY);
}
-
+
/**
* Locate and return the name of the layout template corresponding
* to the given screen template name parameter.
@@ -425,12 +426,12 @@
{
return getCachedName(template,LAYOUT_TEMPLATE_KEY);
}
-
+
/**
* Translates the supplied template paths into their Turbine-canonical
* equivalent (probably absolute paths).
*
- * @param templatePaths An array of template paths.
+ * @param templatePaths An array of template paths.
* @return An array of translated template paths.
*/
public String[] translateTemplatePaths(String[] templatePaths)
@@ -450,7 +451,7 @@
* @param template The template to check for the existance of.
* @param templatePaths The paths to check for the template.
*/
- public boolean templateExists(String template,
+ public boolean templateExists(String template,
String[] templatePaths)
{
for (int i = 0; i < templatePaths.length; i++)
@@ -472,14 +473,14 @@
public synchronized void registerTemplateEngineService(TemplateEngineService service)
{
/*
- * Clone the registry to write to non-sync'd
+ * Clone the registry to write to non-sync'd
* Map implementations.
*/
HashMap registry = templateEngineRegistry != null ?
(HashMap) templateEngineRegistry.clone() : new HashMap();
-
+
String[] exts = service.getAssociatedFileExtensions();
-
+
for (int i = 0; i < exts.length; i++)
{
registry.put(exts[i], service);
@@ -490,7 +491,7 @@
/**
* The {@link org.apache.turbine.services.template.TemplateEngineService}
* associated with the specified template's file extension.
- *
+ *
* @param template The template name.
* @return The template engine service.
*/
@@ -500,7 +501,7 @@
if (registry != null && template != null)
{
int dotIndex = template.lastIndexOf('.');
- String ext = dotIndex == -1 ?
+ String ext = dotIndex == -1 ?
defaultExtension : template.substring(dotIndex + 1);
return (TemplateEngineService) registry.get(ext);
}
@@ -509,10 +510,10 @@
return null;
}
}
-
+
/**
* Get the default module name of the template engine
- * service corresponding to the template name extension of
+ * service corresponding to the template name extension of
* the named template.
*
* @param template The template name.
@@ -527,12 +528,12 @@
(String) tes.getTemplateEngineServiceConfiguration().
get(defaultNameProperties[key]) : null;
}
-
+
/**
* Get the cached template object name.
* If caching is not in use or the name is not in the cache,
- * try to find the name from the template directories.
- *
+ * try to find the name from the template directories.
+ *
* @param template The template name.
* @param key The object type key.
* @return The cached name.
@@ -549,7 +550,7 @@
{
template += '.' + defaultExtension;
}
-
+
/*
* Check the cache first.
*/
@@ -562,7 +563,7 @@
return found;
}
}
-
+
/*
* Not in the cache, try to find it.
*/
@@ -575,11 +576,11 @@
case LAYOUT_TEMPLATE_KEY:
found = getParsedLayoutTemplateName(template);
break;
-
+
default:
found = getParsedModuleName(template,key);
}
-
+
/*
* Put the found name to the cache.
*/
@@ -587,13 +588,13 @@
{
templateNameCache[key].put(template,found);
}
-
+
return found;
}
/**
* Get the parsed module name for the specified template.
- *
+ *
* @param template The template name.
* @param key The module type key.
* @return The parsed module name.
@@ -623,7 +624,7 @@
}
}
}
-
+
/*
* Remove a possible file extension.
*/
@@ -635,7 +636,7 @@
break;
}
}
-
+
/*
* Try first an exact match for a module having the same
* name as the input template, traverse then upper level
@@ -653,20 +654,20 @@
case SCREEN_KEY:
ScreenLoader.getInstance().getInstance(module);
return module;
-
+
case LAYOUT_KEY:
LayoutLoader.getInstance().getInstance(module);
return module;
-
+
case NAVIGATION_KEY:
NavigationLoader.getInstance().getInstance(module);
return module;
}
}
- catch (Exception x)
- {
+ catch (Exception x)
+ {
}
-
+
pckage.setLength(i + 1);
if (i > 0)
{
@@ -676,7 +677,7 @@
for (i = pckage.length() - 2; i >= 0; i--)
{
if (pckage.charAt(i) == '.')
- {
+ {
break;
}
}
@@ -699,7 +700,7 @@
/**
* Get the parsed screen template name for the specified template.
- *
+ *
* @param template The template name.
* @return The parsed screen template name.
* @exception Exception, a generic exception.
@@ -717,7 +718,7 @@
path.insert(0,'/');
}
path.insert(0,"screens");
-
+
/* Let the template engine service to check its existance. */
TemplateEngineService tes = getTemplateEngineService(template);
if ((tes == null) || !tes.templateExists(path.toString()))
@@ -730,7 +731,7 @@
/**
* Get the parsed layout template name for the specified template.
- *
+ *
* @param template The template name.
* @return The parsed layout template name.
* @exception Exception, a generic exception.
@@ -750,7 +751,7 @@
}
path.insert(0,"layouts");
i += 7;
-
+
/*
* Try first an exact match for a layout template having the same
* name as the input template, traverse then upper level
@@ -775,7 +776,7 @@
defaultLayout = '/' + defaultLayout;
}
}
-
+
int j = 9999;
String layoutTemplate;
while (j-- > 0)
@@ -786,13 +787,13 @@
{
return layoutTemplate.substring(7);
}
-
+
if (defaultLayout == null)
{
throw new Exception(
"Layout template '" + template + "' not found");
}
-
+
path.setLength(i);
if (i > 8)
{
@@ -802,7 +803,7 @@
for (i = path.length() - 2; i >= 8; i--)
{
if (path.charAt(i) == '/')
- {
+ {
break;
}
}
@@ -818,7 +819,7 @@
}
/*
- * Not found, return the default layout
+ * Not found, return the default layout
* template as such.
*/
return defaultLayout;
@@ -830,7 +831,7 @@
* into single ones and commas used as path delemiters in
* URL parameters are changed into slashes. Empty names or
* names without a file part are not accepted.
- *
+ *
* @param template The template name.
* @param buffer A buffer for the result.
* @return The index of the separator between the path and the name.
@@ -879,7 +880,7 @@
}
return ind;
}
-
+
/**
* Initialize the template service.
*/
@@ -889,18 +890,18 @@
* Get the configuration for the template service.
*/
Configuration config = getConfiguration();
-
+
/*
* Get the default extension to use if nothing else is applicable.
*/
defaultExtension = config.getString("default.extension",NO_FILE_EXT);
defaultTemplate = "Default." + defaultExtension;
-
+
/*
* Check to see if we are going to be caching modules.
*/
useCache = TurbineResources.getBoolean("module.cache",true);
-
+
if (useCache)
{
int screenSize = config.getInt("screen.cache.size",5);
@@ -908,21 +909,21 @@
int layoutSize = config.getInt("layout.cache.size",5);
int layoutTemplateSize = config.getInt("layout.cache.size",5);
int navigationSize = config.getInt("navigation.cache.size",10);
-
+
/*
- * Create hashtables for each object type,
+ * Create hashtables for each object type,
* the first one for pages is not used.
- */
+ */
templateNameCache[PAGE_KEY] = null;
- templateNameCache[SCREEN_KEY] =
+ templateNameCache[SCREEN_KEY] =
new Hashtable((int) (1.25 * screenSize) + 1);
- templateNameCache[SCREEN_TEMPLATE_KEY] =
+ templateNameCache[SCREEN_TEMPLATE_KEY] =
new Hashtable((int) (1.25 * screenTemplateSize) + 1);
- templateNameCache[LAYOUT_KEY] =
+ templateNameCache[LAYOUT_KEY] =
new Hashtable((int) (1.25 * layoutSize) + 1);
- templateNameCache[LAYOUT_TEMPLATE_KEY] =
+ templateNameCache[LAYOUT_TEMPLATE_KEY] =
new Hashtable((int) (1.25 * layoutTemplateSize) + 1);
- templateNameCache[NAVIGATION_KEY] =
+ templateNameCache[NAVIGATION_KEY] =
new Hashtable((int) (1.25 * navigationSize) + 1);
}
}
1.2 +13 -11 jakarta-turbine-2/src/java/org/apache/turbine/services/template/BaseTemplateEngineService.java
Index: BaseTemplateEngineService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/template/BaseTemplateEngineService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseTemplateEngineService.java 16 Aug 2001 05:09:22 -0000 1.1
+++ BaseTemplateEngineService.java 13 Mar 2002 19:43:35 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -58,7 +58,9 @@
import java.util.Hashtable;
import org.apache.turbine.services.TurbineBaseService;
-import org.apache.velocity.runtime.configuration.Configuration;
+
+import org.apache.stratum.configuration.Configuration;
+
/**
* The base implementation of Turbine {@link
@@ -66,9 +68,9 @@
*
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @version $Id: BaseTemplateEngineService.java,v 1.1 2001/08/16 05:09:22 jvanzyl Exp $
+ * @version $Id: BaseTemplateEngineService.java,v 1.2 2002/03/13 19:43:35 mpoeschl Exp $
*/
-public abstract class BaseTemplateEngineService extends TurbineBaseService
+public abstract class BaseTemplateEngineService extends TurbineBaseService
implements TemplateEngineService
{
/**
@@ -99,7 +101,7 @@
public Hashtable getTemplateEngineServiceConfiguration()
{
return configuration;
- }
+ }
/**
* @see org.apache.turbine.services.template.TemplateEngineService#getAssociatedFileExtensions
@@ -123,7 +125,7 @@
protected void initConfiguration(String defaultExt)
{
Configuration config = getConfiguration();
-
+
/*
* Should modify the configuration class to take defaults
* here, should have to do this.
@@ -138,9 +140,9 @@
fileExtensionAssociations[0] = config.getString(
DEFAULT_TEMPLATE_EXTENSION, defaultExt);
}
-
+
configuration.put(TEMPLATE_EXTENSIONS, fileExtensionAssociations);
-
+
/*
* We need some better error checking here and should probably
* throw an exception here if these things aren't set
1.2 +19 -19 jakarta-turbine-2/src/java/org/apache/turbine/services/pool/TurbinePoolService.java
Index: TurbinePoolService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/pool/TurbinePoolService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbinePoolService.java 16 Aug 2001 05:09:10 -0000 1.1
+++ TurbinePoolService.java 13 Mar 2002 19:43:35 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -61,7 +61,7 @@
import javax.servlet.ServletConfig;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.pool.Recyclable;
@@ -86,9 +86,9 @@
* a dispose method, when they are returned to the pool.
*
* @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
- * @version $Id: TurbinePoolService.java,v 1.1 2001/08/16 05:09:10 jvanzyl Exp $
+ * @version $Id: TurbinePoolService.java,v 1.2 2002/03/13 19:43:35 mpoeschl Exp $
*/
-public class TurbinePoolService
+public class TurbinePoolService
extends TurbineFactoryService
implements PoolService
{
@@ -133,7 +133,7 @@
/**
* Matches the given signature against
* that of the recycle method of this recycler.
- *
+ *
* @param sign the signature.
* @return the matching recycle method or null.
*/
@@ -217,7 +217,7 @@
{
Object instance = pool.poll();
if (instance != null)
- {
+ {
if (arrayCtorRecyclable)
{
((ArrayCtorRecyclable) instance).recycle(params);
@@ -244,7 +244,7 @@
TurbinePoolService.this.getSignature(
clazz,params,signature));
ArrayList cache = recyclers != null ?
- (ArrayList) recyclers.clone() :
+ (ArrayList) recyclers.clone() :
new ArrayList();
cache.add(
new Recycler(recycle,signature));
@@ -309,11 +309,11 @@
{
return pool.size();
}
-
+
/**
- * Returns a cached recycle method
+ * Returns a cached recycle method
* corresponding to the given signature.
- *
+ *
* @param signature the signature.
* @return the recycle method or null.
*/
@@ -468,9 +468,9 @@
/**
* Tests if specified class loaders are supported for a named class.
- *
+ *
* @param className the name of the class.
- * @return true if class loaders are supported, false otherwise.
+ * @return true if class loaders are supported, false otherwise.
* @throws TurbineException if test fails.
*/
public boolean isLoaderSupported(String className)
@@ -537,8 +537,8 @@
repository = (HashMap) repository.clone();
repository.put(className,pool);
poolRepository = repository;
-
- if (instance instanceof ArrayCtorRecyclable)
+
+ if (instance instanceof ArrayCtorRecyclable)
{
pool.setArrayCtorRecyclable(true);
}
@@ -575,8 +575,8 @@
capacity = poolCapacity;
}
}
- catch (Exception x)
- {
+ catch (Exception x)
+ {
}
}
return capacity;
1.2 +5 -5 jakarta-turbine-2/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java
Index: TurbineRunDataService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineRunDataService.java 16 Aug 2001 05:09:13 -0000 1.1
+++ TurbineRunDataService.java 13 Mar 2002 19:43:35 -0000 1.2
@@ -64,7 +64,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.CookieParser;
@@ -84,9 +84,9 @@
* the implementations should implement the Recyclable interface.
*
* @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
- * @version $Id: TurbineRunDataService.java,v 1.1 2001/08/16 05:09:13 jvanzyl Exp $
+ * @version $Id: TurbineRunDataService.java,v 1.2 2002/03/13 19:43:35 mpoeschl Exp $
*/
-public class TurbineRunDataService
+public class TurbineRunDataService
extends TurbineBaseService
implements RunDataService
{
@@ -253,7 +253,7 @@
{
throw new TurbineException("RunTime configuration '" + key + "' is undefined");
}
-
+
// Use the Pool Service for recycling the implementing objects.
PoolService pool = (PoolService)
TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);
@@ -269,7 +269,7 @@
{
throw new TurbineException("RunData configuration '" + key + "' is illegal",x);
}
-
+
// Set the request and response.
data.setRequest(req);
data.setResponse(res);
1.4 +22 -21 jakarta-turbine-2/src/java/org/apache/turbine/services/db/TurbineMapBrokerService.java
Index: TurbineMapBrokerService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/db/TurbineMapBrokerService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TurbineMapBrokerService.java 27 Sep 2001 05:22:32 -0000 1.3
+++ TurbineMapBrokerService.java 13 Mar 2002 19:43:35 -0000 1.4
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -53,7 +53,7 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-
+
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -66,7 +66,8 @@
import org.apache.turbine.util.db.adapter.DBFactory;
import org.apache.turbine.util.db.map.DatabaseMap;
import org.apache.turbine.util.db.map.TableMap;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
+
/**
* Turbine's default implmentation of {@link MapBrokerService}.
@@ -78,17 +79,17 @@
* @author <a href="mailto:magnus@handtolvur.is">Magn�s ��r Torfason</a>
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
* @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @version $Id: TurbineMapBrokerService.java,v 1.3 2001/09/27 05:22:32 jvanzyl Exp $
+ * @version $Id: TurbineMapBrokerService.java,v 1.4 2002/03/13 19:43:35 mpoeschl Exp $
*/
-public class TurbineMapBrokerService extends BaseService
+public class TurbineMapBrokerService extends BaseService
implements MapBrokerService
{
/** The global cache of database maps */
private Map dbMaps;
-
+
/** Default database map */
private String defaultMap;
-
+
/**
* Initializes the service.
*/
@@ -96,24 +97,24 @@
{
dbMaps = (Map)new HashMap();
Configuration configuration = getConfiguration();
-
+
// Get the value for the default map, but if there
// isn't a value than fall back to the standard
// "default" value.
defaultMap = configuration.getString(DEFAULT_MAP, DEFAULT);
-
+
// indicate that the service initialized correctly
setInit(true);
}
-
+
/**
* Return the default map.
*/
public String getDefaultMap()
{
return defaultMap;
- }
-
+ }
+
/**
* Shuts down the service.
*
@@ -122,7 +123,7 @@
*/
public void shutdown()
{
- Iterator maps = dbMaps.values().iterator();
+ Iterator maps = dbMaps.values().iterator();
while ( maps.hasNext() )
{
DatabaseMap map = (DatabaseMap) maps.next();
@@ -138,7 +139,7 @@
* Returns the default database map information.
*
* @return A DatabaseMap.
- * @throws TurbineException Any exceptions caught during procssing will be
+ * @throws TurbineException Any exceptions caught during procssing will be
* rethrown wrapped into a TurbineException.
*/
public DatabaseMap getDatabaseMap()
@@ -146,7 +147,7 @@
{
return getDatabaseMap(defaultMap);
}
-
+
/**
* Returns the database map information. Name relates to the name
* of the connection pool to associate with the map.
@@ -154,7 +155,7 @@
* @param name The name of the <code>DatabaseMap</code> to
* retrieve.
* @return The named <code>DatabaseMap</code>.
- * @throws TurbineException Any exceptions caught during procssing will be
+ * @throws TurbineException Any exceptions caught during procssing will be
* rethrown wrapped into a TurbineException.
*/
public DatabaseMap getDatabaseMap(String name)
@@ -178,7 +179,7 @@
{
// Still not there. Create and add.
map = new DatabaseMap(name);
-
+
// Add info about IDBroker's table.
setupIdTable(map);
// setup other id generators
@@ -227,7 +228,7 @@
* Setup IDBroker's table information within given database map.
*
* This method should be called on all new database map to ensure that
- * IDBroker functionality is available in all databases userd by the
+ * IDBroker functionality is available in all databases userd by the
* application.
*
* @param map the DataBaseMap to setup.
1.3 +19 -18 jakarta-turbine-2/src/java/org/apache/turbine/services/db/TurbinePoolBrokerService.java
Index: TurbinePoolBrokerService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/db/TurbinePoolBrokerService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TurbinePoolBrokerService.java 27 Sep 2001 05:22:32 -0000 1.2
+++ TurbinePoolBrokerService.java 13 Mar 2002 19:43:35 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -63,7 +63,8 @@
import org.apache.turbine.util.db.adapter.DB;
import org.apache.turbine.util.db.pool.ConnectionPool;
import org.apache.turbine.util.db.pool.DBConnection;
-import org.apache.velocity.runtime.configuration.Configuration;
+import org.apache.stratum.configuration.Configuration;
+
/**
* Turbine's default implementation of {@link PoolBrokerService}.
@@ -75,7 +76,7 @@
* @author <a href="mailto:magnus@handtolvur.is">Magn�s ��r Torfason</a>
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
* @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
- * @version $Id: TurbinePoolBrokerService.java,v 1.2 2001/09/27 05:22:32 jvanzyl Exp $
+ * @version $Id: TurbinePoolBrokerService.java,v 1.3 2002/03/13 19:43:35 mpoeschl Exp $
*/
public class TurbinePoolBrokerService extends BaseService
implements PoolBrokerService
@@ -100,14 +101,14 @@
public void init()
{
pools = (Map) new HashMap();
-
+
Configuration configuration = getConfiguration();
-
+
// Get the value for the default pool, but if there
// isn't a value than fall back to the standard
// "default" value.
defaultPool = configuration.getString(DEFAULT_POOL, DEFAULT);
-
+
// Create monitor thread
Monitor monitor = new Monitor();
// Indicate that this is a system thread. JVM will quit only when there
@@ -127,7 +128,7 @@
public String getDefaultDB()
{
return defaultPool;
- }
+ }
/**
* Release the database connections for all pools on service shutdown.
@@ -229,7 +230,7 @@
}
/**
- * Release a connection back to the database pool. <code>null</code>
+ * Release a connection back to the database pool. <code>null</code>
* references are ignored.
*
* @throws TurbineException Any exceptions caught during processing will be
@@ -270,9 +271,9 @@
{
/**
* Added so that the configuration file can define maxConnections &
- * expiryTime for each database pool that is defined in the
+ * expiryTime for each database pool that is defined in the
* TurbineResources.properties
- * Was defined as: database.expiryTime=3600000
+ * Was defined as: database.expiryTime=3600000
* If you need per database, it is
* now database.helpdesk.expiryTime=3600000
*/
@@ -286,7 +287,7 @@
TurbineResources.getLong(
getProperty(name, "expiryTime"), 3600000));
}
-
+
/**
* This thread-safe method registers a new pool using the given parameters.
*
@@ -318,10 +319,10 @@
{
// Still not there. Create and add.
ConnectionPool pool =
- new ConnectionPool(driver,
- url,
- username,
- password,
+ new ConnectionPool(driver,
+ url,
+ username,
+ password,
maxCons,expiryTime);
pools.put( name, pool );
}
1.2 +2 -2 jakarta-turbine-2/src/java/org/apache/turbine/services/mimetype/TurbineMimeTypeService.java
Index: TurbineMimeTypeService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/mimetype/TurbineMimeTypeService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineMimeTypeService.java 16 Aug 2001 05:09:06 -0000 1.1
+++ TurbineMimeTypeService.java 13 Mar 2002 19:43:35 -0000 1.2
@@ -64,8 +64,8 @@
import org.apache.turbine.services.mimetype.util.MimeType;
import org.apache.turbine.services.mimetype.util.MimeTypeMap;
import org.apache.turbine.services.mimetype.util.CharSetMap;
+import org.apache.stratum.configuration.Configuration;
-import org.apache.velocity.runtime.configuration.Configuration;
/**
* The MimeType Service maintains mappings between MIME types and
@@ -85,7 +85,7 @@
* a set of most common mappings.
*
* @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
- * @version $Id: TurbineMimeTypeService.java,v 1.1 2001/08/16 05:09:06 jvanzyl Exp $
+ * @version $Id: TurbineMimeTypeService.java,v 1.2 2002/03/13 19:43:35 mpoeschl Exp $
*/
public class TurbineMimeTypeService
extends TurbineBaseService
1.2 +3 -2 jakarta-turbine-2/src/java/org/apache/turbine/services/freemarker/TurbineFreeMarkerService.java
Index: TurbineFreeMarkerService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/freemarker/TurbineFreeMarkerService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineFreeMarkerService.java 16 Aug 2001 05:08:54 -0000 1.1
+++ TurbineFreeMarkerService.java 13 Mar 2002 19:43:35 -0000 1.2
@@ -69,12 +69,13 @@
import org.apache.turbine.services.resources.*;
import org.apache.turbine.services.servlet.TurbineServlet;
+import org.apache.stratum.configuration.Configuration;
+
import org.apache.ecs.StringElement;
// FreeMarker Stuff
import freemarker.template.*;
-import org.apache.velocity.runtime.configuration.Configuration;
/*
* This is a Service that can process FreeMarker templates from within
@@ -92,7 +93,7 @@
*
* @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @version $Id: TurbineFreeMarkerService.java,v 1.1 2001/08/16 05:08:54 jvanzyl Exp $
+ * @version $Id: TurbineFreeMarkerService.java,v 1.2 2002/03/13 19:43:35 mpoeschl Exp $
* @deprecated
*/
public class TurbineFreeMarkerService
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>