Author: cziegeler
Date: Wed Jan  5 07:23:35 2005
New Revision: 124219

URL: http://svn.apache.org/viewcvs?view=rev&rev=124219
Log:
Start propagating service info
Modified:
   
cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java
   
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/acting/ServerPagesAction.java
   
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java
   
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java
   
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractComponentHandler.java
   
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractServiceManager.java
   
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/CoreServiceManager.java
   
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java

Modified: 
cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java
Url: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java?view=diff&rev=124219&p1=cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java&r1=124218&p2=cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java&r2=124219
==============================================================================
--- 
cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java
     (original)
+++ 
cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java
     Wed Jan  5 07:23:35 2005
@@ -21,6 +21,7 @@
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceManager;
 
+import org.apache.cocoon.components.ServiceInfo;
 import org.apache.cocoon.components.language.programming.Program;
 import org.apache.cocoon.components.language.generator.CompiledComponent;
 import org.apache.cocoon.core.container.AbstractComponentHandler;
@@ -70,9 +71,12 @@
         env.serviceManager = manager;
         env.context = context;
         env.logger = this.getLogger();
-
+        final ServiceInfo info = new ServiceInfo();
+        info.setConfiguration(config);
+        info.setServiceClass(clazz);
+        
         return AbstractComponentHandler.getComponentHandler(
-                null, clazz, config, env, null);
+                null, info, env, null);
     }
 
     public CompiledComponent newInstance() throws Exception {

Modified: 
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/acting/ServerPagesAction.java
Url: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/acting/ServerPagesAction.java?view=diff&rev=124219&p1=cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/acting/ServerPagesAction.java&r1=124218&p2=cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/acting/ServerPagesAction.java&r2=124219
==============================================================================
--- 
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/acting/ServerPagesAction.java
    (original)
+++ 
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/acting/ServerPagesAction.java
    Wed Jan  5 07:23:35 2005
@@ -25,6 +25,7 @@
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.thread.ThreadSafe;
 
+import org.apache.cocoon.components.ServiceInfo;
 import org.apache.cocoon.components.sax.XMLByteStreamCompiler;
 import org.apache.cocoon.components.sax.XMLByteStreamFragment;
 import org.apache.cocoon.core.container.AbstractComponentHandler;
@@ -92,10 +93,13 @@
             final ComponentEnvironment env = new ComponentEnvironment();
             env.serviceManager = this.manager;
             env.logger = this.getLogger();
+            final ServiceInfo info = new ServiceInfo();
+            info.setConfiguration(conf);
+            info.setServiceClass(ServerPagesGenerator.class);
+            
             this.generatorHandler = 
AbstractComponentHandler.getComponentHandler(
                 null,  // role
-                ServerPagesGenerator.class,
-                conf,
+                info,
                 env,
                 null   // RoleManager
             );

Modified: 
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java
Url: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java?view=diff&rev=124219&p1=cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java&r1=124218&p2=cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java&r2=124219
==============================================================================
--- 
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java
    (original)
+++ 
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java
    Wed Jan  5 07:23:35 2005
@@ -20,6 +20,7 @@
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceManager;
 
+import org.apache.cocoon.components.ServiceInfo;
 import org.apache.cocoon.components.language.generator.CompiledComponent;
 import org.apache.cocoon.components.language.programming.Program;
 import org.apache.cocoon.core.container.AbstractComponentHandler;
@@ -52,11 +53,13 @@
         env.serviceManager = manager;
         env.context = context;
         env.logger = this.getLogger();
+        final ServiceInfo info = new ServiceInfo();
+        info.setConfiguration(new DefaultConfiguration("", 
"GeneratorSelector"));
+        info.setServiceClass(program);
 
         return AbstractComponentHandler.getComponentHandler(
                 null, // role
-                program,
-                new DefaultConfiguration("", "GeneratorSelector"),
+                info,
                 env, null);
     }
 

Modified: 
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java
Url: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java?view=diff&rev=124219&p1=cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java&r1=124218&p2=cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java&r2=124219
==============================================================================
--- 
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java
        (original)
+++ 
cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java
        Wed Jan  5 07:23:35 2005
@@ -21,6 +21,7 @@
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceManager;
 
+import org.apache.cocoon.components.ServiceInfo;
 import org.apache.cocoon.components.language.generator.CompiledComponent;
 import org.apache.cocoon.components.language.programming.Program;
 import org.apache.cocoon.core.container.AbstractComponentHandler;
@@ -72,9 +73,12 @@
         env.serviceManager = manager;
         env.context = context;
         env.logger = this.getLogger();
+        final ServiceInfo info = new ServiceInfo();
+        info.setConfiguration(this.config);
+        info.setServiceClass(clazz);
 
         return AbstractComponentHandler.getComponentHandler(
-                null, clazz, config, env, null);
+                null, info, env, null);
     }
 
     public CompiledComponent newInstance() throws Exception {

Modified: 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractComponentHandler.java
Url: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractComponentHandler.java?view=diff&rev=124219&p1=cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractComponentHandler.java&r1=124218&p2=cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractComponentHandler.java&r2=124219
==============================================================================
--- 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractComponentHandler.java
   (original)
+++ 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractComponentHandler.java
   Wed Jan  5 07:23:35 2005
@@ -18,7 +18,6 @@
 
 import org.apache.avalon.excalibur.pool.Poolable;
 import org.apache.avalon.framework.component.Composable;
-import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.thread.SingleThreaded;
 import org.apache.avalon.framework.thread.ThreadSafe;
@@ -61,59 +60,55 @@
      * @throws Exception If there were any problems obtaining a 
ComponentHandler
      */
     public static ComponentHandler getComponentHandler( final String role,
-                                                        final Class 
componentClass,
-                                                        final Configuration 
configuration,
+                                                        final ServiceInfo info,
                                                         final 
ComponentEnvironment env,
                                                         final RoleManager 
roleManager)
     throws Exception {
         int numInterfaces = 0;
 
         // FIXME we don't need the class but a classloader
-        final ServiceInfo info = new ServiceInfo();
-        info.setServiceClass(componentClass);
-        info.setServiceClassName(componentClass.getName());
-        info.setConfiguration(configuration);
+        info.setServiceClassName(info.getServiceClass().getName());
         
         // Early check for Composable
-        if ( Composable.class.isAssignableFrom( componentClass ) ) {
+        if ( Composable.class.isAssignableFrom( info.getServiceClass() ) ) {
             throw new Exception("Interface Composable is not supported 
anymore. Please change class "
-                                + componentClass.getName() + " to use 
Serviceable instead.");
+                                + info.getServiceClassName() + " to use 
Serviceable instead.");
         }
 
-        if( SingleThreaded.class.isAssignableFrom( componentClass ) ) {
+        if( SingleThreaded.class.isAssignableFrom( info.getServiceClass() ) ) {
             numInterfaces++;
             info.setModel(ServiceInfo.MODEL_PRIMITIVE);
         }
 
-        if( ThreadSafe.class.isAssignableFrom( componentClass ) ) {
+        if( ThreadSafe.class.isAssignableFrom( info.getServiceClass() ) ) {
             numInterfaces++;
             info.setModel(ServiceInfo.MODEL_SINGLETON);
         }
 
-        if( Poolable.class.isAssignableFrom( componentClass ) ) {
+        if( Poolable.class.isAssignableFrom( info.getServiceClass() ) ) {
             numInterfaces++;
             info.setModel(ServiceInfo.MODEL_POOLED);
         }
 
         if( numInterfaces > 1 ) {
             throw new Exception( "[CONFLICT] More than one lifecycle interface 
in "
-                                 + componentClass.getName() + "  May implement 
no more than one of "
+                                 + info.getServiceClassName() + "  May 
implement no more than one of "
                                  + "SingleThreaded, ThreadSafe, or Poolable" );
         }
 
         if ( numInterfaces == 0 ) {
             // this component does not use avalon interfaces, so get the info 
from the configuration
-            info.fill(configuration);
+            info.fill(info.getConfiguration());
         }
         
         // Create the factory to use to create the instances of the Component.
         ComponentFactory factory;
         
-        if (DefaultServiceSelector.class.isAssignableFrom(componentClass)) {
+        if 
(DefaultServiceSelector.class.isAssignableFrom(info.getServiceClass())) {
             // Special factory for DefaultServiceSelector
             factory = new DefaultServiceSelector.Factory(env, roleManager, 
info, role);
             
-        } else if 
(StandaloneServiceSelector.class.isAssignableFrom(componentClass)) {
+        } else if 
(StandaloneServiceSelector.class.isAssignableFrom(info.getServiceClass())) {
             // Special factory for StandaloneServiceSelector
             factory = new StandaloneServiceSelector.Factory(env, roleManager, 
info, role);
                 
@@ -124,7 +119,7 @@
         ComponentHandler handler;
         
         if( info.getModel() == ServiceInfo.MODEL_POOLED )  {
-            handler = new PoolableComponentHandler( info, env.logger, factory, 
configuration );
+            handler = new PoolableComponentHandler( info, env.logger, factory, 
info.getConfiguration() );
         } else if( info.getModel() == ServiceInfo.MODEL_SINGLETON ) {
             handler = new ThreadSafeComponentHandler( info, env.logger, 
factory );
         } else {

Modified: 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractServiceManager.java
Url: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractServiceManager.java?view=diff&rev=124219&p1=cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractServiceManager.java&r1=124218&p2=cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractServiceManager.java&r2=124219
==============================================================================
--- 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractServiceManager.java
     (original)
+++ 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/AbstractServiceManager.java
     Wed Jan  5 07:23:35 2005
@@ -31,6 +31,7 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.components.ServiceInfo;
 
 /**
  * Base class for all service managers: ServiceManager and ServiceSelector
@@ -93,8 +94,7 @@
      * @throws Exception If there were any problems obtaining a 
ComponentHandler
      */
     protected ComponentHandler getComponentHandler( final String role,
-                                                    final Class componentClass,
-                                                    final Configuration 
configuration,
+                                                    final ServiceInfo info,
                                                     final ServiceManager 
serviceManager)
     throws Exception {
         final ComponentEnvironment env = new ComponentEnvironment();
@@ -103,8 +103,7 @@
         env.logger = this.getLogger();
         env.loggerManager = this.loggerManager;
         return AbstractComponentHandler.getComponentHandler(role,
-                                                     componentClass,
-                                                     configuration,
+                                                     info,
                                                      env,
                                                      this.roleManager);
     }

Modified: 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/CoreServiceManager.java
Url: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/core/container/CoreServiceManager.java?view=diff&rev=124219&p1=cocoon/trunk/src/core/java/org/apache/cocoon/core/container/CoreServiceManager.java&r1=124218&p2=cocoon/trunk/src/core/java/org/apache/cocoon/core/container/CoreServiceManager.java&r2=124219
==============================================================================
--- 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/CoreServiceManager.java
 (original)
+++ 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/CoreServiceManager.java
 Wed Jan  5 07:23:35 2005
@@ -286,12 +286,12 @@
                     try {
                         // FIXME use different class loader
                         final Class componentClass = 
this.getClass().getClassLoader().loadClass( info.getServiceClassName() );
-
                         final Configuration configuration = new 
DefaultConfiguration( "", "-" );
+                        info.setServiceClass(componentClass);
+                        info.setConfiguration(configuration);
 
                         handler = this.getComponentHandler(role,
-                                                       componentClass,
-                                                       configuration,
+                                                       info,
                                                        this);
 
                         handler.initialize();
@@ -423,7 +423,10 @@
             }
         }
         try {
-            handler = this.getComponentHandler(role, component, configuration, 
this);
+            final ServiceInfo info = new ServiceInfo();
+            info.setConfiguration(configuration);
+            info.setServiceClass(component);
+            handler = this.getComponentHandler(role, info, this);
 
             if( this.getLogger().isDebugEnabled() ) {
                 this.getLogger().debug( "Handler type = " + 
handler.getClass().getName() );

Modified: 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java
Url: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java?view=diff&rev=124219&p1=cocoon/trunk/src/core/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java&r1=124218&p2=cocoon/trunk/src/core/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java&r2=124219
==============================================================================
--- 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java
  (original)
+++ 
cocoon/trunk/src/core/java/org/apache/cocoon/core/container/StandaloneServiceSelector.java
  Wed Jan  5 07:23:35 2005
@@ -343,9 +343,11 @@
         }
 
         try {
+            final ServiceInfo info = new ServiceInfo();
+            info.setConfiguration(configuration);
+            info.setServiceClass(component);
             final ComponentHandler handler = getComponentHandler( null,
-                                                                  component,
-                                                                  
configuration,
+                                                                  info,
                                                                   
this.serviceManager);
 
             handler.initialize();

Reply via email to