You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by sg...@apache.org on 2005/05/19 10:51:04 UTC
cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/avaloncomponent TurbineAvalonComponentService.java
sgoeschl 2005/05/19 01:51:04
Modified: src/java/org/apache/turbine/services/avaloncomponent
TurbineAvalonComponentService.java
Log:
Implements the Avalon ServiceManager interface
Revision Changes Path
1.21 +28 -10 jakarta-turbine-2/src/java/org/apache/turbine/services/avaloncomponent/TurbineAvalonComponentService.java
Index: TurbineAvalonComponentService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/avaloncomponent/TurbineAvalonComponentService.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- TurbineAvalonComponentService.java 6 Dec 2004 17:47:12 -0000 1.20
+++ TurbineAvalonComponentService.java 19 May 2005 08:51:04 -0000 1.21
@@ -34,6 +34,7 @@
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.turbine.Turbine;
@@ -59,7 +60,7 @@
* If you want to initialize Torque by using the AvalonComponentService, you
* must activate Torque at initialization time by specifying
*
- * services.AvalonComponentService.lookup = org.apache.torque.Torque
+ * services.AvalonComponentService.lookup = org.apache.torque.Torque
*
* in your TurbineResources.properties.
*
@@ -127,7 +128,7 @@
*/
public void initialize() throws Exception
{
- org.apache.commons.configuration.Configuration conf
+ org.apache.commons.configuration.Configuration conf
= getConfiguration();
// get the filenames and expand them relative to webapp root
@@ -183,7 +184,7 @@
List lookupComponents = conf.getList(COMPONENT_LOOKUP_KEY,
new ArrayList());
-
+
for (Iterator it = lookupComponents.iterator(); it.hasNext();)
{
String component = (String) it.next();
@@ -215,10 +216,17 @@
* @return an instance of the named component
* @throws ComponentException generic exception
*/
- public Component lookup(String roleName)
- throws ComponentException
+ public Object lookup(String roleName)
+ throws ServiceException
{
- return manager.lookup(roleName);
+ try
+ {
+ return manager.lookup(roleName);
+ }
+ catch (ComponentException e)
+ {
+ throw new ServiceException(name, e.getMessage());
+ }
}
/**
@@ -226,9 +234,19 @@
*
* @param component the component to release
*/
- public void release(Component component)
+ public void release(Object component)
{
- manager.release(component);
+ if( component instanceof Component )
+ {
+ manager.release((Component)component);
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.service.ServiceManager#hasService(java.lang.String)
+ */
+ public boolean hasService(String roleName)
+ {
+ return manager.hasComponent(roleName);
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org