You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2001/03/26 01:04:53 UTC
cvs commit: jakarta-turbine/src/java/org/apache/turbine/services BaseService.java BaseServiceBroker.java ServiceBroker.java TurbineServices.java
jvanzyl 01/03/25 15:04:53
Modified: src/java/org/apache/turbine/services BaseService.java
BaseServiceBroker.java ServiceBroker.java
TurbineServices.java
Log:
- adding the ability of a service to get their configuration in
the form of a Configuration class instead of having to use
properties. would be nice to use the configuration class
in all the services and get rid of the use of properties.
hopefully the configuration class will move into the commons
projects or somewhere sharable. when that happens i will
change the import statements to something more appropriate
like org.apache.util.configuration.Configuration or something
like that.
Revision Changes Path
1.6 +25 -1 jakarta-turbine/src/java/org/apache/turbine/services/BaseService.java
Index: BaseService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/BaseService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BaseService.java 2001/03/06 06:11:45 1.5
+++ BaseService.java 2001/03/25 23:04:53 1.6
@@ -57,12 +57,14 @@
// Java stuff.
import java.util.*;
+import org.apache.velocity.runtime.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.5 2001/03/06 06:11:45 chrise Exp $
+ * @version $Id: BaseService.java,v 1.6 2001/03/25 23:04:53 jvanzyl Exp $
*/
public class BaseService
extends BaseInitable
@@ -74,6 +76,9 @@
/** The properties of this service. */
protected Properties properties;
+ /** The configuration for this service */
+ protected Configuration configuration;
+
/** The name of this Service. */
protected String name;
@@ -144,5 +149,24 @@
properties = getServiceBroker().getProperties(name);
}
return properties;
+ }
+
+ /**
+ * Returns the configuration of this Service.
+ *
+ * @return The Configuration of this Service.
+ */
+ public Configuration getConfiguration()
+ {
+ if (name == null)
+ {
+ return null;
+ }
+
+ if (configuration == null)
+ {
+ configuration = getServiceBroker().getConfiguration(name);
+ }
+ return configuration;
}
}
1.20 +14 -1 jakarta-turbine/src/java/org/apache/turbine/services/BaseServiceBroker.java
Index: BaseServiceBroker.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/BaseServiceBroker.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- BaseServiceBroker.java 2001/03/18 16:58:16 1.19
+++ BaseServiceBroker.java 2001/03/25 23:04:53 1.20
@@ -77,7 +77,7 @@
*
* @author <a href="mailto:burton@apache.org">Kevin Burton</a>
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
- * @version $Id: BaseServiceBroker.java,v 1.19 2001/03/18 16:58:16 jvanzyl Exp $
+ * @version $Id: BaseServiceBroker.java,v 1.20 2001/03/25 23:04:53 jvanzyl Exp $
*/
public class BaseServiceBroker
extends BaseInitableBroker
@@ -346,5 +346,18 @@
public Properties getProperties( String name )
{
return new Properties();
+ }
+
+ /**
+ * Returns the Configuration of a specific service.
+ *
+ * Generic ServiceBroker returns empty Configuration
+ *
+ * @param name The name of the service.
+ * @return Properties of requested Service.
+ */
+ public Configuration getConfiguration( String name )
+ {
+ return new Configuration();
}
}
1.5 +14 -2 jakarta-turbine/src/java/org/apache/turbine/services/ServiceBroker.java
Index: ServiceBroker.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/ServiceBroker.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ServiceBroker.java 2001/03/06 06:11:48 1.4
+++ ServiceBroker.java 2001/03/25 23:04:53 1.5
@@ -55,8 +55,10 @@
*/
// Java stuff.
-import java.util.*;
+import java.util.Properties;
+import org.apache.velocity.runtime.configuration.Configuration;
+
/**
* Classes that implement this interface can act as a broker for
* <code>Service</code> classes.
@@ -76,7 +78,7 @@
*
* @author <a href="mailto:burton@apache.org">Kevin Burton</a>
* @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
- * @version $Id: ServiceBroker.java,v 1.4 2001/03/06 06:11:48 chrise Exp $
+ * @version $Id: ServiceBroker.java,v 1.5 2001/03/25 23:04:53 jvanzyl Exp $
*/
public interface ServiceBroker
extends InitableBroker
@@ -138,4 +140,14 @@
* @return Properties of requested Service.
*/
public Properties getProperties( String name );
+
+ /**
+ * Returns the configuration of a specific service. Services
+ * use this method to retrieve their configuration.
+ *
+ * @param name The name of the service.
+ * @return Configuration of the requested service.
+ */
+ public Configuration getConfiguration( String name );
+
}
1.25 +11 -1 jakarta-turbine/src/java/org/apache/turbine/services/TurbineServices.java
Index: TurbineServices.java
===================================================================
RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/TurbineServices.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- TurbineServices.java 2001/03/18 16:58:16 1.24
+++ TurbineServices.java 2001/03/25 23:04:53 1.25
@@ -75,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.24 2001/03/18 16:58:16 jvanzyl Exp $
+ * @version $Id: TurbineServices.java,v 1.25 2001/03/25 23:04:53 jvanzyl Exp $
*/
public class TurbineServices
extends BaseServiceBroker
@@ -287,6 +287,16 @@
}
return properties;
+ }
+
+ /**
+ * Returns the Configuration for the specified service.
+ *
+ * @param name The name of the service.
+ */
+ public Configuration getConfiguration( String name )
+ {
+ return TurbineResources.getConfiguration(SERVICE_PREFIX + name);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org