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/02/06 17:20:16 UTC
cvs commit: jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum BaseService.java BaseServiceBroker.java BaseUnicastRemoteService.java Service.java ServiceBroker.java ServiceManager.java
mpoeschl 02/02/06 08:20:16
Modified: src/services/java/org/apache/fulcrum/xmlrpc
TurbineXmlRpcService.java
src/services/java/org/apache/fulcrum/velocity
TurbineVelocityService.java
src/core/java/org/apache/fulcrum BaseService.java
BaseServiceBroker.java
BaseUnicastRemoteService.java Service.java
ServiceBroker.java ServiceManager.java
Log:
use stratum.configuration packages instead of ExtendedProperties
Revision Changes Path
1.6 +5 -5 jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/xmlrpc/TurbineXmlRpcService.java
Index: TurbineXmlRpcService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/xmlrpc/TurbineXmlRpcService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TurbineXmlRpcService.java 8 Jan 2002 03:38:47 -0000 1.5
+++ TurbineXmlRpcService.java 6 Feb 2002 16:20:15 -0000 1.6
@@ -75,11 +75,10 @@
import org.apache.xmlrpc.secure.SecureWebServer;
import org.apache.xmlrpc.secure.SecurityTool;
-import org.apache.commons.collections.ExtendedProperties;
+import org.apache.stratum.configuration.Configuration;
/**
- * This is a service which will make an xml-rpc call to a remote
- * server.
+ * This is a service which will make an xml-rpc call to a remote server.
*
* Here's an example of how it would be done:
* <blockquote><code><pre>
@@ -99,7 +98,8 @@
* @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.5 2002/01/08 03:38:47 dlr Exp $
+ * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
+ * @version $Id: TurbineXmlRpcService.java,v 1.6 2002/02/06 16:20:15 mpoeschl Exp $
*/
public class TurbineXmlRpcService
extends BaseService
@@ -136,7 +136,7 @@
// and the URL https connection handler that is
// used in XmlRpcClient.
- ExtendedProperties secureServerOptions =
+ Configuration secureServerOptions =
getConfiguration().subset("secure.server.option");
Iterator i = secureServerOptions.getKeys();
1.14 +13 -10 jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/velocity/TurbineVelocityService.java
Index: TurbineVelocityService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/velocity/TurbineVelocityService.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TurbineVelocityService.java 23 Jan 2002 01:14:19 -0000 1.13
+++ TurbineVelocityService.java 6 Feb 2002 16:20:15 -0000 1.14
@@ -76,6 +76,7 @@
import org.apache.fulcrum.template.TurbineTemplate;
import org.apache.fulcrum.template.TemplateContext;
import org.apache.fulcrum.template.BaseTemplateEngineService;
+import org.apache.stratum.configuration.ConfigurationConverter;
/**
* This is a Service that can process Velocity templates from within a
@@ -98,7 +99,8 @@
* @author <a href="mailto:sean@informage.ent">Sean Legassick</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
- * @version $Id: TurbineVelocityService.java,v 1.13 2002/01/23 01:14:19 jon Exp $
+ * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
+ * @version $Id: TurbineVelocityService.java,v 1.14 2002/02/06 16:20:15 mpoeschl Exp $
*/
public class TurbineVelocityService
extends BaseTemplateEngineService
@@ -129,7 +131,7 @@
* The EventCartridge that is used against all contexts
*/
private EventCartridge eventCartridge;
-
+
/**
* Performs early initialization of this Turbine service.
*/
@@ -243,7 +245,7 @@
* @see org.apache.fulcrum.template.TemplateEngineService#handleRequest(
* Context, String, Writer)
*/
- public void handleRequest(TemplateContext context,
+ public void handleRequest(TemplateContext context,
String template, Writer writer)
throws ServiceException
{
@@ -274,15 +276,15 @@
// need to convert to a VelocityContext because EventCartridges
// need that. this sucks because it seems like unnecessary
// object creation.
- VelocityContext velocityContext = new VelocityContext(context);
-
+ VelocityContext velocityContext = new VelocityContext(context);
+
// Attach the EC to the context
getEventCartridge().attachToContext(velocityContext);
if (encoding != null)
{
// Request scoped encoding first supported by Velocity 1.1.
- Velocity.mergeTemplate(filename, encoding,
+ Velocity.mergeTemplate(filename, encoding,
velocityContext, writer);
}
else
@@ -393,7 +395,7 @@
* <code>
* services.VelocityService.eventCartridge.classes = org.tigris.scarab.util.ReferenceInsertionFilter
* </code>
- * and list out (comma separated) the list of EC's that you want to
+ * and list out (comma separated) the list of EC's that you want to
* initialize.
*/
private void initEventCartridges()
@@ -435,13 +437,13 @@
result = getEventCartridge()
.addEventHandler((MethodExceptionEventHandler)obj);
}
- getCategory().info("Added EventCartridge: " +
+ getCategory().info("Added EventCartridge: " +
obj.getClass().getName() + " : " + result);
}
catch (Exception h)
{
throw new InitializationException(
- "Could not initialize EventCartridge: " +
+ "Could not initialize EventCartridge: " +
className, h);
}
}
@@ -541,7 +543,8 @@
try
{
- Velocity.setExtendedProperties(getConfiguration());
+ Velocity.setExtendedProperties(ConfigurationConverter
+ .getExtendedProperties(getConfiguration()));
Velocity.init();
}
catch(Exception e)
1.10 +10 -20 jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/BaseService.java
Index: BaseService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/BaseService.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- BaseService.java 24 Nov 2001 18:32:40 -0000 1.9
+++ BaseService.java 6 Feb 2002 16:20:15 -0000 1.10
@@ -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
@@ -54,10 +54,9 @@
* <http://www.apache.org/>.
*/
-import java.util.Properties;
import java.util.List;
-import org.apache.commons.collections.ExtendedProperties;
+import org.apache.stratum.configuration.Configuration;
import org.apache.log4j.Category;
/**
@@ -68,10 +67,10 @@
* @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:leonardr@segfault.org">Leonard Richardson</a>
- * @version $Id: BaseService.java,v 1.9 2001/11/24 18:32:40 mpoeschl Exp $
+ * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
+ * @version $Id: BaseService.java,v 1.10 2002/02/06 16:20:15 mpoeschl Exp $
*/
-public abstract class BaseService
- implements Service
+public abstract class BaseService implements Service
{
/**
* Initialization status of this class.
@@ -84,16 +83,9 @@
protected ServiceBroker serviceBroker;
/**
- * The properties of this service. These will
- * soon go away. We will use a Configuration
- * interface.
- */
- protected Properties properties;
-
- /**
* Configuration for this service.
*/
- protected ExtendedProperties configuration;
+ protected Configuration configuration;
/**
* The name of this Service.
@@ -108,8 +100,7 @@
* @see org.apache.fulcrum.Service#init()
* @see org.apache.fulcrum.BaseService#setInit(boolean value)
*/
- public abstract void init()
- throws InitializationException;
+ public abstract void init() throws InitializationException;
/**
* Returns an Initable to uninitialized state.
@@ -141,8 +132,7 @@
*
* @see org.apache.fulcrum.Service#getStatus()
*/
- public String getStatus()
- throws ServiceException
+ public String getStatus() throws ServiceException
{
return (isInitialized() ? "Initialized" : "Uninitialized");
}
@@ -192,7 +182,7 @@
*
* @param broker The ServiceBroker that instantiated this object.
*/
- public void setServiceBroker( ServiceBroker broker )
+ public void setServiceBroker(ServiceBroker broker)
{
this.serviceBroker = broker;
}
@@ -212,7 +202,7 @@
*
* @return The Configuration of this Service.
*/
- public ExtendedProperties getConfiguration()
+ public Configuration getConfiguration()
{
if (name == null)
{
1.14 +23 -23 jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/BaseServiceBroker.java
Index: BaseServiceBroker.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/BaseServiceBroker.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- BaseServiceBroker.java 3 Jan 2002 23:24:53 -0000 1.13
+++ BaseServiceBroker.java 6 Feb 2002 16:20:15 -0000 1.14
@@ -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
@@ -67,7 +67,8 @@
import java.util.Stack;
import org.apache.fulcrum.ServiceException;
-import org.apache.commons.collections.ExtendedProperties;
+import org.apache.stratum.configuration.BaseConfiguration;
+import org.apache.stratum.configuration.Configuration;
import org.apache.log4j.Category;
import org.apache.log4j.helpers.NullEnumeration;
@@ -86,15 +87,15 @@
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @version $Id: BaseServiceBroker.java,v 1.13 2002/01/03 23:24:53 jon Exp $
+ * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
+ * @version $Id: BaseServiceBroker.java,v 1.14 2002/02/06 16:20:15 mpoeschl Exp $
*/
-public abstract class BaseServiceBroker
- implements ServiceBroker
+public abstract class BaseServiceBroker implements ServiceBroker
{
/**
* Mapping of Service names to class names.
*/
- protected ExtendedProperties mapping = new ExtendedProperties();
+ protected Configuration mapping = (Configuration) new BaseConfiguration();
/**
* A repository of Service instances.
@@ -106,7 +107,7 @@
* The configuration should be set by the application
* in which the services framework is running.
*/
- protected ExtendedProperties configuration;
+ protected Configuration configuration;
/**
* A prefix for <code>Service</code> properties in
@@ -160,13 +161,13 @@
protected BaseServiceBroker()
{
}
-
+
/**
* Determine whether log4j has already been configured.
*
* @return boolean Whether log4j is configured.
*/
- protected boolean isLoggingConfigured()
+ protected boolean isLoggingConfigured()
{
// This is a note from Ceki, taken from a message on the log4j
// user list:
@@ -177,28 +178,28 @@
// is the existence of appenders. The correct procedure is to
// first check for appenders in the root category and if that
// returns no appenders to check in other categories.
-
+
Enumeration enum = Category.getRoot().getAllAppenders();
-
+
if (!(enum instanceof NullEnumeration))
{
return true;
- }
- else
- {
+ }
+ else
+ {
Enumeration cats = Category.getCurrentCategories();
- while(cats.hasMoreElements())
+ while(cats.hasMoreElements())
{
Category c = (Category) cats.nextElement();
if (!(c.getAllAppenders() instanceof NullEnumeration))
{
return true;
- }
+ }
}
}
-
+
return false;
- }
+ }
/**
* Set the configuration object for the services broker.
@@ -208,7 +209,7 @@
*
* @param configuration Broker configuration.
*/
- public void setConfiguration(ExtendedProperties configuration)
+ public void setConfiguration(Configuration configuration)
{
this.configuration = configuration;
}
@@ -218,7 +219,7 @@
*
* @return Broker configuration.
*/
- public ExtendedProperties getConfiguration()
+ public Configuration getConfiguration()
{
return configuration;
}
@@ -239,8 +240,7 @@
/**
* Initialize this service manager.
*/
- public void init()
- throws InitializationException
+ public void init() throws InitializationException
{
// Check:
//
@@ -696,7 +696,7 @@
*
* @param name The name of the service.
*/
- public ExtendedProperties getConfiguration( String name )
+ public Configuration getConfiguration( String name )
{
return configuration.subset(SERVICE_PREFIX + name);
}
1.6 +4 -3 jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/BaseUnicastRemoteService.java
Index: BaseUnicastRemoteService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/BaseUnicastRemoteService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BaseUnicastRemoteService.java 16 Aug 2001 16:10:16 -0000 1.5
+++ BaseUnicastRemoteService.java 6 Feb 2002 16:20:15 -0000 1.6
@@ -56,7 +56,7 @@
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
-import org.apache.commons.collections.ExtendedProperties;
+import org.apache.stratum.configuration.Configuration;
import org.apache.log4j.Category;
/**
@@ -67,12 +67,13 @@
* implementation is a RMI server object.
*
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
+ * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
*/
public class BaseUnicastRemoteService
extends UnicastRemoteObject
implements Service
{
- protected ExtendedProperties configuration;
+ protected Configuration configuration;
private boolean isInitialized;
private String name;
private ServiceBroker serviceBroker;
@@ -90,7 +91,7 @@
*
* @return The configuration of this service.
*/
- public ExtendedProperties getConfiguration()
+ public Configuration getConfiguration()
{
if (name == null)
{
1.11 +7 -8 jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/Service.java
Index: Service.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/Service.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Service.java 31 Aug 2001 08:00:28 -0000 1.10
+++ Service.java 6 Feb 2002 16:20:15 -0000 1.11
@@ -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
@@ -54,7 +54,7 @@
* <http://www.apache.org/>.
*/
-import org.apache.commons.collections.ExtendedProperties;
+import org.apache.stratum.configuration.Configuration;
import org.apache.log4j.Category;
/**
@@ -68,7 +68,8 @@
* @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
* @author <a href="mailto:leonardr@collab.net">Leonard Richardson</a>
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
- * @version $Id: Service.java,v 1.10 2001/08/31 08:00:28 jvanzyl Exp $
+ * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
+ * @version $Id: Service.java,v 1.11 2002/02/06 16:20:15 mpoeschl Exp $
*/
public interface Service
{
@@ -108,8 +109,7 @@
* @exception InitializationException, if initialization of this
* class was not successful.
*/
- public void init( )
- throws InitializationException;
+ public void init( ) throws InitializationException;
/**
* Returns a <code>Service</code> to an uninitialized state.
@@ -156,7 +156,7 @@
*
* @return The configuration of this <code>Service</code>.
*/
- public ExtendedProperties getConfiguration();
+ public Configuration getConfiguration();
/**
* Given a relative paths, gets the real path.
@@ -173,6 +173,5 @@
*
* @return Text describing service status.
*/
- public String getStatus()
- throws ServiceException;
+ public String getStatus() throws ServiceException;
}
1.6 +5 -4 jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/ServiceBroker.java
Index: ServiceBroker.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/ServiceBroker.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ServiceBroker.java 12 Dec 2001 08:52:32 -0000 1.5
+++ ServiceBroker.java 6 Feb 2002 16:20:15 -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
@@ -57,7 +57,7 @@
import java.util.List;
import java.util.Hashtable;
-import org.apache.commons.collections.ExtendedProperties;
+import org.apache.stratum.configuration.Configuration;
import org.apache.log4j.Category;
/**
@@ -81,7 +81,8 @@
* @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: ServiceBroker.java,v 1.5 2001/12/12 08:52:32 dlr Exp $
+ * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
+ * @version $Id: ServiceBroker.java,v 1.6 2002/02/06 16:20:15 mpoeschl Exp $
*/
public interface ServiceBroker
{
@@ -141,7 +142,7 @@
* @param name The name of the service.
* @return Configuration of the requested service.
*/
- public ExtendedProperties getConfiguration( String name );
+ public Configuration getConfiguration( String name );
/**
* Set an object for use in the services.
1.6 +8 -9 jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/ServiceManager.java
Index: ServiceManager.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/ServiceManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ServiceManager.java 31 Aug 2001 08:00:28 -0000 1.5
+++ ServiceManager.java 6 Feb 2002 16:20:15 -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
@@ -54,7 +54,7 @@
* <http://www.apache.org/>.
*/
-import org.apache.commons.collections.ExtendedProperties;
+import org.apache.stratum.configuration.Configuration;
import org.apache.log4j.Category;
/**
@@ -66,23 +66,22 @@
* of the manager.
*
* @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
- * @version $Id: ServiceManager.java,v 1.5 2001/08/31 08:00:28 jvanzyl Exp $
+ * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
+ * @version $Id: ServiceManager.java,v 1.6 2002/02/06 16:20:15 mpoeschl Exp $
*/
-public interface ServiceManager
- extends ServiceBroker
+public interface ServiceManager extends ServiceBroker
{
/**
* Initialize this service manager.
*/
- public void init()
- throws InitializationException;
+ public void init() throws InitializationException;
/**
* Get the configuration for this service manager.
*
* @return Manager configuration.
*/
- public ExtendedProperties getConfiguration();
+ public Configuration getConfiguration();
/**
* Set the configuration object for the services broker.
@@ -92,7 +91,7 @@
*
* @param configuration Manager configuration.
*/
- public void setConfiguration(ExtendedProperties configuration);
+ public void setConfiguration(Configuration configuration);
/**
* Set the application root.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>