You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2004/02/06 16:27:15 UTC

cvs commit: avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl DefaultFactory.java DefaultKernel.java

mcconnell    2004/02/06 07:27:15

  Modified:    merlin/activation/api/src/java/org/apache/avalon/activation/appliance
                        Appliance.java
               merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl
                        AbstractBlock.java CompositeBlock.java
                        DefaultAppliance.java DefaultBlock.java
                        DefaultServiceManager.java Deployer.java
                        DeploymentRequest.java
               merlin/activation/impl/src/test/org/apache/avalon/activation/appliance
                        AbstractTestCase.java
               merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant
                        CodeSecurityDisabledTestCase.java
                        CodeSecurityEnabledTestCase.java
               merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl
                        CustomErrorDeployable.java
                        CustomExceptionDeployable.java
                        DeploymentTestCase.java DummyDeployable.java
                        DummyDeploymentModel.java
                        InterruptableDeployable.java
                        UninterruptableDeployable.java
               merlin/composition/api/src/java/org/apache/avalon/composition/model
                        ComponentContext.java ContainmentModel.java
                        DeploymentModel.java
               merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
                        DefaultComponentContext.java
                        DefaultContextModel.java
                        DefaultDeploymentModel.java
               merlin/facilities/http README.TXT
               merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl
                        ComponentModelHolder.java DefaultServer.java
               merlin/facilities/http/test/conf test.block
               merlin/kernel/impl project.xml
               merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl
                        DefaultFactory.java DefaultKernel.java
  Added:       merlin/composition/api/src/java/org/apache/avalon/composition/runtime
                        Commissionable.java Resolver.java
               merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl
                        DefaultModelListener.java
               merlin/facilities/http/test/src/java/test/http
                        TestComponent.java
  Removed:     merlin/activation/api/src/java/org/apache/avalon/activation/appliance
                        Deployable.java Home.java
               merlin/facilities/http/listener .cvsignore maven.xml
                        merlin.properties project.xml
               merlin/facilities/http/listener/src/java/org/apache/avalon/http/listener
                        DefaultHTTPModelListener.java
               merlin/facilities/http/test/conf kernel.xml
               merlin/facilities/http/test/src/java/test/http
                        TestServlet.java
  Log:
  First step in bringing runtime control under the control of the model.  Changes include the transfer of a couple of key interfaces from applience to the new composition runtime package.  Also some small updates to context handling to enable facilities to access the containment model.  Updates applied and validated against http facility test case.
  
  Revision  Changes    Path
  1.5       +4 -2      avalon/merlin/activation/api/src/java/org/apache/avalon/activation/appliance/Appliance.java
  
  Index: Appliance.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/api/src/java/org/apache/avalon/activation/appliance/Appliance.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Appliance.java	24 Jan 2004 23:25:20 -0000	1.4
  +++ Appliance.java	6 Feb 2004 15:27:13 -0000	1.5
  @@ -18,6 +18,8 @@
   package org.apache.avalon.activation.appliance;
   
   import org.apache.avalon.composition.model.DeploymentModel;
  +import org.apache.avalon.composition.runtime.Commissionable;
  +import org.apache.avalon.composition.runtime.Resolver;
   
   /**
    * An Appliance is the basic tool merlin wraps around a component to
  @@ -41,7 +43,7 @@
    * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
    * @version $Revision$ $Date$
    */
  -public interface Appliance extends Deployable, Home
  +public interface Appliance extends Commissionable, Resolver
   {
       /**
        * Return the model backing the appliance.
  
  
  
  1.19      +9 -9      avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/AbstractBlock.java
  
  Index: AbstractBlock.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/AbstractBlock.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AbstractBlock.java	24 Jan 2004 23:25:21 -0000	1.18
  +++ AbstractBlock.java	6 Feb 2004 15:27:13 -0000	1.19
  @@ -38,12 +38,8 @@
   import org.apache.avalon.activation.appliance.Engine;
   import org.apache.avalon.activation.appliance.NoProviderDefinitionException;
   
  -import org.apache.avalon.logging.data.CategoriesDirective;
  -import org.apache.avalon.logging.provider.LoggingManager;
  -
   import org.apache.avalon.composition.event.CompositionEvent;
   import org.apache.avalon.composition.event.CompositionEventListener;
  -
   import org.apache.avalon.composition.model.SystemContext;
   import org.apache.avalon.composition.model.ContainmentModel;
   import org.apache.avalon.composition.model.ClassLoaderModel;
  @@ -51,10 +47,14 @@
   import org.apache.avalon.composition.model.ComponentModel;
   import org.apache.avalon.composition.model.DeploymentModel;
   import org.apache.avalon.composition.model.StageModel;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.logger.Logger;
   
  +import org.apache.avalon.logging.data.CategoriesDirective;
  +import org.apache.avalon.logging.provider.LoggingManager;
  +
   import org.apache.avalon.meta.info.DependencyDescriptor;
   import org.apache.avalon.meta.info.StageDescriptor;
   
  @@ -284,7 +284,7 @@
       }
       
       //-------------------------------------------------------------------
  -    // Deployable
  +    // Commissionable
       //-------------------------------------------------------------------
   
      /**
  @@ -293,7 +293,7 @@
       *
       * @exception Exception if a deployment error occurs
       */
  -    public void deploy() throws Exception
  +    public void commission() throws Exception
       {
           if( !getContainmentModel().isAssembled() )
           {
  @@ -368,7 +368,7 @@
               for( int i=0; i<shutdown.length; i++ )
               {
                   final DeploymentModel child = shutdown[i];
  -                final Appliance appliance = getAppliance( child, false );
  +                final Commissionable appliance = child.getHandler();
                   if( null != appliance )
                   {
                       appliance.decommission();
  @@ -380,7 +380,7 @@
       }
   
       //-------------------------------------------------------------------
  -    // Home
  +    // Resolver
       //-------------------------------------------------------------------
   
       /**
  
  
  
  1.9       +1 -15     avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/CompositeBlock.java
  
  Index: CompositeBlock.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/CompositeBlock.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CompositeBlock.java	24 Jan 2004 23:25:21 -0000	1.8
  +++ CompositeBlock.java	6 Feb 2004 15:27:13 -0000	1.9
  @@ -17,21 +17,7 @@
   
   package org.apache.avalon.activation.appliance.impl;
   
  -import java.lang.reflect.InvocationHandler;
  -import java.lang.reflect.InvocationTargetException;
  -import java.lang.reflect.Method;
  -import java.lang.reflect.Proxy;
  -import java.net.URL;
  -import java.net.URLClassLoader;
  -import java.util.ArrayList;
  -
  -import org.apache.avalon.activation.appliance.Appliance;
  -import org.apache.avalon.activation.appliance.ApplianceException;
  -import org.apache.avalon.activation.appliance.ApplianceRuntimeException;
  -import org.apache.avalon.activation.appliance.Home;
  -import org.apache.avalon.composition.data.ServiceDirective;
   import org.apache.avalon.composition.model.ContainmentModel;
  -import org.apache.avalon.framework.logger.Logger;
   
   /**
    * The CompositeBlock is responsible for the management 
  
  
  
  1.27      +10 -4     avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java
  
  Index: DefaultAppliance.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- DefaultAppliance.java	24 Jan 2004 23:25:21 -0000	1.26
  +++ DefaultAppliance.java	6 Feb 2004 15:27:13 -0000	1.27
  @@ -46,15 +46,19 @@
   import org.apache.avalon.activation.lifestyle.impl.SingletonLifestyleHandler;
   import org.apache.avalon.activation.lifestyle.impl.ThreadLifestyleHandler;
   import org.apache.avalon.activation.lifestyle.impl.TransientLifestyleHandler;
  +
   import org.apache.avalon.logging.data.CategoriesDirective;
   import org.apache.avalon.logging.provider.LoggingManager;
  +
   import org.apache.avalon.composition.model.ContextModel;
   import org.apache.avalon.composition.model.DependencyModel;
   import org.apache.avalon.composition.model.ComponentModel;
   import org.apache.avalon.composition.model.DeploymentModel;
   import org.apache.avalon.composition.model.StageModel;
  +
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  +
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.activity.Executable;
   import org.apache.avalon.framework.activity.Initializable;
  @@ -67,8 +71,10 @@
   import org.apache.avalon.framework.logger.LogEnabled;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.Serviceable;
  +
   import org.apache.avalon.lifecycle.Accessor;
   import org.apache.avalon.lifecycle.Creator;
  +
   import org.apache.avalon.meta.info.InfoDescriptor;
   import org.apache.avalon.meta.info.StageDescriptor;
   import org.apache.avalon.util.exception.ExceptionHelper;
  @@ -291,7 +297,7 @@
       }
   
       //-------------------------------------------------------------------
  -    // Deployable
  +    // Commissionable
       //-------------------------------------------------------------------
   
      /**
  @@ -303,7 +309,7 @@
       *
       * @exception Exception if a deployment error occurs
       */
  -    public void deploy() throws Exception
  +    public void commission() throws Exception
       {
           synchronized( m_deployment )
           {
  @@ -395,7 +401,7 @@
       }
   
       //-------------------------------------------------------------------
  -    // Home
  +    // Resolver
       //-------------------------------------------------------------------
   
       /**
  
  
  
  1.13      +4 -4      avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultBlock.java
  
  Index: DefaultBlock.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultBlock.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultBlock.java	24 Jan 2004 23:25:21 -0000	1.12
  +++ DefaultBlock.java	6 Feb 2004 15:27:13 -0000	1.13
  @@ -29,12 +29,12 @@
   import org.apache.avalon.activation.appliance.Appliance;
   import org.apache.avalon.activation.appliance.ApplianceException;
   import org.apache.avalon.activation.appliance.ApplianceRuntimeException;
  -import org.apache.avalon.activation.appliance.Home;
   import org.apache.avalon.activation.appliance.Engine;
   
   import org.apache.avalon.composition.data.ServiceDirective;
   import org.apache.avalon.composition.model.ContainmentModel;
   import org.apache.avalon.composition.model.ServiceModel;
  +import org.apache.avalon.composition.runtime.Resolver;
   
   import org.apache.avalon.framework.logger.Logger;
   
  @@ -48,7 +48,7 @@
    * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
    * @version $Revision$ $Date$
    */
  -public class DefaultBlock extends AbstractBlock implements Home
  +public class DefaultBlock extends AbstractBlock implements Resolver
   {
       //-------------------------------------------------------------------
       // immmutable state
  @@ -104,7 +104,7 @@
       }
   
       //-------------------------------------------------------------------
  -    // Home
  +    // Resolver
       //-------------------------------------------------------------------
   
       /**
  
  
  
  1.7       +5 -7      avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultServiceManager.java
  
  Index: DefaultServiceManager.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultServiceManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultServiceManager.java	24 Jan 2004 23:25:21 -0000	1.6
  +++ DefaultServiceManager.java	6 Feb 2004 15:27:13 -0000	1.7
  @@ -21,14 +21,14 @@
   import java.util.Hashtable;
   
   import org.apache.avalon.activation.appliance.Appliance;
  -import org.apache.avalon.activation.appliance.Home;
  +
  +import org.apache.avalon.composition.runtime.Resolver;
  +
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.framework.service.ServiceManager;
   
  -import org.apache.avalon.util.exception.ExceptionHelper;
  -
   /**
    * Default implementation of the framework {@link ServiceManager} interface.
    * @author Stephen McConnell <mc...@osm.net>
  @@ -162,7 +162,7 @@
               return;
           }
   
  -        final Home provider = (Home) m_map.get( key );
  +        final Resolver provider = (Resolver) m_map.get( key );
           if( provider == null )
           {
               final String error = 
  @@ -183,9 +183,7 @@
           {
               final String error = 
                 "Internal error while attempting to release object from provider: " + provider;
  -            final String warning = 
  -              ExceptionHelper.packException( error, e, true );
  -            getLogger().warn( warning );
  +            getLogger().warn( error, e );
           }
           finally
           {
  
  
  
  1.9       +8 -9      avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/Deployer.java
  
  Index: Deployer.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/Deployer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Deployer.java	24 Jan 2004 23:25:21 -0000	1.8
  +++ Deployer.java	6 Feb 2004 15:27:13 -0000	1.9
  @@ -17,17 +17,16 @@
   
   package org.apache.avalon.activation.appliance.impl;
   
  -import org.apache.avalon.activation.appliance.Deployable;
  -
   import org.apache.avalon.composition.model.DeploymentModel;
   import org.apache.avalon.composition.model.ContainmentModel;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.activity.Disposable;
   
   /**
    * Runnable deployment thread that handles the deployment of an 
  - * arbitary number of deployable instances.  The deployer maintains a 
  + * arbitary number of commissionable instances.  The deployer maintains a 
    * list of deployment requests which are queued on a first come first 
    * serve basis.
    *
  @@ -75,7 +74,7 @@
       //------------------------------------------------------------
   
       /** 
  -     * Deploys the given Deployable, and allows a maximum time
  +     * Deploys the given Commissonable, and allows a maximum time
        * for the deployment to complete.
        *
        * @param deployable the deployable model
  @@ -175,19 +174,19 @@
                         "No handler assigned to model: " + deployable;
                       throw new IllegalStateException( error );
                   }
  -                if( !( deployable.getHandler() instanceof Deployable ) )
  +                if( !( deployable.getHandler() instanceof Commissionable ) )
                   {
                       final String error =
                         "Deployment handler assigned to model: " + deployable
  -                      + " does not implement the deployable contract";
  +                      + " does not implement the Commissionable contract";
                       throw new IllegalStateException( error );
                   }
   
  -                Deployable target = (Deployable) deployable.getHandler();
  +                Commissionable target = (Commissionable) deployable.getHandler();
   
                   try
                   {
  -                    target.deploy();
  +                    target.commission();
                       req.done();
                   } 
                   catch( InterruptedException e )
  
  
  
  1.7       +2 -2      avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DeploymentRequest.java
  
  Index: DeploymentRequest.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DeploymentRequest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DeploymentRequest.java	24 Jan 2004 23:25:21 -0000	1.6
  +++ DeploymentRequest.java	6 Feb 2004 15:27:13 -0000	1.7
  @@ -19,7 +19,7 @@
   
   import java.lang.reflect.InvocationTargetException;
   
  -import org.apache.avalon.activation.appliance.Deployable;
  +import org.apache.avalon.composition.runtime.Commissionable;
   import org.apache.avalon.activation.appliance.DeploymentException;
   import org.apache.avalon.activation.appliance.FatalDeploymentException;
   import org.apache.avalon.composition.model.DeploymentModel;
  
  
  
  1.13      +2 -2      avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/AbstractTestCase.java
  
  Index: AbstractTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/AbstractTestCase.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AbstractTestCase.java	5 Feb 2004 04:05:12 -0000	1.12
  +++ AbstractTestCase.java	6 Feb 2004 15:27:13 -0000	1.13
  @@ -32,12 +32,12 @@
   import org.apache.avalon.composition.model.SystemContext;
   import org.apache.avalon.composition.model.impl.DefaultSystemContext;
   
  +import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
   import org.apache.avalon.framework.logger.ConsoleLogger;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.avalon.framework.activity.Disposable;
   
   import org.apache.avalon.repository.provider.InitialContext;
   import org.apache.avalon.repository.main.DefaultInitialContext;
  @@ -188,7 +188,7 @@
           //    of lazy components
           //
   
  -        block.deploy();
  +        block.commission();
   
           //
           // 4-5. suspend and resume the root block (not implemented yet)
  
  
  
  1.6       +1 -1      avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityDisabledTestCase.java
  
  Index: CodeSecurityDisabledTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityDisabledTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CodeSecurityDisabledTestCase.java	24 Jan 2004 23:25:22 -0000	1.5
  +++ CodeSecurityDisabledTestCase.java	6 Feb 2004 15:27:13 -0000	1.6
  @@ -65,7 +65,7 @@
   
           m_model.assemble();
           m_block = new DefaultBlock( m_model );
  -        m_block.deploy();
  +        m_block.commission();
           m_appliance = m_block.locate( "/Component1/test" );
       }
   
  
  
  
  1.8       +1 -1      avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityEnabledTestCase.java
  
  Index: CodeSecurityEnabledTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityEnabledTestCase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CodeSecurityEnabledTestCase.java	24 Jan 2004 23:25:22 -0000	1.7
  +++ CodeSecurityEnabledTestCase.java	6 Feb 2004 15:27:13 -0000	1.8
  @@ -64,7 +64,7 @@
           super.setUp( "secure.xml" );
           m_model.assemble();
           m_block = new DefaultBlock( m_model );
  -        m_block.deploy();
  +        m_block.commission();
           m_appliance = m_block.locate( "/Component1/test" );
       }
   
  
  
  
  1.3       +3 -3      avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/CustomErrorDeployable.java
  
  Index: CustomErrorDeployable.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/CustomErrorDeployable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CustomErrorDeployable.java	24 Jan 2004 23:25:22 -0000	1.2
  +++ CustomErrorDeployable.java	6 Feb 2004 15:27:13 -0000	1.3
  @@ -17,16 +17,16 @@
   
   package org.apache.avalon.activation.appliance.impl;
   
  -import org.apache.avalon.activation.appliance.Deployable;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   public class CustomErrorDeployable 
  -    implements Deployable
  +    implements Commissionable
   {
       CustomErrorDeployable()
       {
       }
       
  -    public void deploy() 
  +    public void commission() 
           throws Exception
       {
           throw new CustomError();
  
  
  
  1.3       +3 -3      avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/CustomExceptionDeployable.java
  
  Index: CustomExceptionDeployable.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/CustomExceptionDeployable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CustomExceptionDeployable.java	24 Jan 2004 23:25:22 -0000	1.2
  +++ CustomExceptionDeployable.java	6 Feb 2004 15:27:13 -0000	1.3
  @@ -17,16 +17,16 @@
   
   package org.apache.avalon.activation.appliance.impl;
   
  -import org.apache.avalon.activation.appliance.Deployable;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   public class CustomExceptionDeployable 
  -    implements Deployable
  +    implements Commissionable
   {
       CustomExceptionDeployable()
       {
       }
       
  -    public void deploy() 
  +    public void commission() 
           throws Exception
       {
           throw new CustomException();
  
  
  
  1.4       +6 -6      avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/DeploymentTestCase.java
  
  Index: DeploymentTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/DeploymentTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DeploymentTestCase.java	24 Jan 2004 23:25:22 -0000	1.3
  +++ DeploymentTestCase.java	6 Feb 2004 15:27:13 -0000	1.4
  @@ -17,13 +17,13 @@
   
   package org.apache.avalon.activation.appliance.impl;
    
  -import org.apache.avalon.composition.model.DeploymentModel;
  +import java.lang.reflect.InvocationTargetException;
   
  -import org.apache.avalon.activation.appliance.Deployable;
   import org.apache.avalon.activation.appliance.DeploymentException;
   import org.apache.avalon.activation.appliance.FatalDeploymentException;
   
  -import java.lang.reflect.InvocationTargetException;
  +import org.apache.avalon.composition.model.DeploymentModel;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   import junit.framework.TestCase;
   
  @@ -49,7 +49,7 @@
       public void testNormalDeploy()
           throws Exception
       {
  -        Deployable d = new DummyDeployable();
  +        Commissionable d = new DummyDeployable();
           DeploymentModel model = new DummyDeploymentModel( d, 100 );
           m_deployer.deploy( model );
       }
  @@ -100,7 +100,7 @@
       {
           try
           {
  -            Deployable d = new CustomExceptionDeployable();
  +            Commissionable d = new CustomExceptionDeployable();
               DeploymentModel model = new DummyDeploymentModel( d, 100 );
               m_deployer.deploy( model );
               fail( "The Deployment didn't fail with a DeploymentException." );
  @@ -121,7 +121,7 @@
       {
           try
           {
  -            Deployable d = new CustomErrorDeployable();
  +            Commissionable d = new CustomErrorDeployable();
               DeploymentModel model = new DummyDeploymentModel( d, 100 );
               m_deployer.deploy( model );
               fail( "The Deployment didn't fail with a DeploymentException." );
  
  
  
  1.3       +3 -3      avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/DummyDeployable.java
  
  Index: DummyDeployable.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/DummyDeployable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DummyDeployable.java	24 Jan 2004 23:25:22 -0000	1.2
  +++ DummyDeployable.java	6 Feb 2004 15:27:13 -0000	1.3
  @@ -17,16 +17,16 @@
   
   package org.apache.avalon.activation.appliance.impl;
   
  -import org.apache.avalon.activation.appliance.Deployable;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   public class DummyDeployable 
  -    implements Deployable
  +    implements Commissionable
   {
       DummyDeployable()
       {
       }
       
  -    public void deploy() 
  +    public void commission() 
           throws Exception
       {
       }
  
  
  
  1.3       +7 -7      avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/DummyDeploymentModel.java
  
  Index: DummyDeploymentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/DummyDeploymentModel.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DummyDeploymentModel.java	24 Jan 2004 23:25:22 -0000	1.2
  +++ DummyDeploymentModel.java	6 Feb 2004 15:27:13 -0000	1.3
  @@ -17,7 +17,7 @@
   
   package org.apache.avalon.activation.appliance.impl;
   
  -import org.apache.avalon.activation.appliance.Deployable;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   import org.apache.avalon.composition.data.Mode;
   import org.apache.avalon.composition.model.DeploymentModel;
  @@ -34,12 +34,12 @@
       implements DeploymentModel
   {
       private long m_timeout;
  -    private Deployable m_deployable;
  +    private Commissionable m_commissionable;
   
  -    DummyDeploymentModel( Deployable deployable, long timeout )
  +    DummyDeploymentModel( Commissionable commissionable, long timeout )
       {
           m_timeout = timeout;
  -        m_deployable = deployable;
  +        m_commissionable = commissionable;
       }
       
      /**
  @@ -82,7 +82,7 @@
       * Set the runtime handler for the model.
       * @param handler the runtime handler
       */
  -    public void setHandler( Object handler )
  +    public void setHandler( Commissionable handler )
       {
       }
   
  @@ -90,9 +90,9 @@
       * Get the assigned runtime handler for the model.
       * @return the runtime handler
       */
  -    public Object getHandler()
  +    public Commissionable getHandler()
       {
  -        return m_deployable;
  +        return m_commissionable;
       }
   
      /**
  
  
  
  1.3       +3 -3      avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/InterruptableDeployable.java
  
  Index: InterruptableDeployable.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/InterruptableDeployable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InterruptableDeployable.java	24 Jan 2004 23:25:22 -0000	1.2
  +++ InterruptableDeployable.java	6 Feb 2004 15:27:13 -0000	1.3
  @@ -17,16 +17,16 @@
   
   package org.apache.avalon.activation.appliance.impl;
   
  -import org.apache.avalon.activation.appliance.Deployable;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   public class InterruptableDeployable 
  -    implements Deployable
  +    implements Commissionable
   {
       InterruptableDeployable()
       {
       }
       
  -    public void deploy() 
  +    public void commission() 
           throws Exception
       {
           synchronized( this )
  
  
  
  1.3       +3 -3      avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/UninterruptableDeployable.java
  
  Index: UninterruptableDeployable.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/impl/UninterruptableDeployable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UninterruptableDeployable.java	24 Jan 2004 23:25:22 -0000	1.2
  +++ UninterruptableDeployable.java	6 Feb 2004 15:27:13 -0000	1.3
  @@ -17,10 +17,10 @@
   
   package org.apache.avalon.activation.appliance.impl;
   
  -import org.apache.avalon.activation.appliance.Deployable;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   public class UninterruptableDeployable 
  -    implements Deployable
  +    implements Commissionable
   {
       private boolean m_Looping;
       
  @@ -28,7 +28,7 @@
       {
       }
       
  -    public void deploy() 
  +    public void commission() 
           throws Exception
       {
           m_Looping = true;
  
  
  
  1.4       +4 -15     avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ComponentContext.java
  
  Index: ComponentContext.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ComponentContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ComponentContext.java	24 Jan 2004 23:25:25 -0000	1.3
  +++ ComponentContext.java	6 Feb 2004 15:27:14 -0000	1.4
  @@ -119,21 +119,10 @@
       ClassLoader getClassLoader();
   
      /**
  -    * Return a model relative to a supplied dependency.
  -    * @return a matching model or null if the dependency is unresolvable
  -    * @exception ModelRuntimeException if an error occurs during model establishment
  +    * Return the enclosing containment model.
  +    * @return the containment model that component is within
       */
  -    //DeploymentModel getModel( DependencyDescriptor dependency ) 
  -    // throws ModelRuntimeException;
  -
  -   /**
  -    * Return a model relative to a supplied stage descriptor.
  -    * @param stage the stage descriptor
  -    * @return model of a an stage handler or null if the stage is unresolvable
  -    * @exception ModelRuntimeException if an error occurs during model establishment
  -    */
  -    //DeploymentModel getModel( StageDescriptor stage ) 
  -    //  throws ModelRuntimeException;
  +    ContainmentModel getContainmentModel();
   
      /**
       * Add a context entry model to the deployment context.
  
  
  
  1.14      +4 -2      avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ContainmentModel.java
  
  Index: ContainmentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ContainmentModel.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ContainmentModel.java	24 Jan 2004 23:25:25 -0000	1.13
  +++ ContainmentModel.java	6 Feb 2004 15:27:14 -0000	1.14
  @@ -37,8 +37,10 @@
    */
   public interface ContainmentModel extends DeploymentModel
   {
  -    String SECURE_EXECUTION_KEY = "urn:composition:security.enabled";
  +    String KEY = "urn:composition:containment.model";
       
  +    String SECURE_EXECUTION_KEY = "urn:composition:security.enabled";
  +
       /**
        * Get the startup sequence for the model.
        */
  
  
  
  1.12      +4 -3      avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/DeploymentModel.java
  
  Index: DeploymentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/DeploymentModel.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DeploymentModel.java	24 Jan 2004 23:25:25 -0000	1.11
  +++ DeploymentModel.java	6 Feb 2004 15:27:14 -0000	1.12
  @@ -18,6 +18,7 @@
   package org.apache.avalon.composition.model;
   
   import org.apache.avalon.composition.data.Mode;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   import org.apache.avalon.meta.info.DependencyDescriptor;
   import org.apache.avalon.meta.info.ServiceDescriptor;
  @@ -65,13 +66,13 @@
       * Set the runtime handler for the model.
       * @param handler the runtime handler
       */
  -    void setHandler( Object handler );
  +    void setHandler( Commissionable handler );
   
      /**
       * Get the assigned runtime handler for the model.
       * @return the runtime handler
       */
  -    Object getHandler();
  +    Commissionable getHandler();
   
      /**
       * Return the assigned logging channel.
  
  
  
  1.1                  avalon/merlin/composition/api/src/java/org/apache/avalon/composition/runtime/Commissionable.java
  
  Index: Commissionable.java
  ===================================================================
  /* 
   * Copyright 2004 Apache Software Foundation
   * Licensed  under the  Apache License,  Version 2.0  (the "License");
   * you may not use  this file  except in  compliance with the License.
   * You may obtain a copy of the License at 
   * 
   *   http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed  under the  License is distributed on an "AS IS" BASIS,
   * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
   * implied.
   * 
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.avalon.composition.runtime;
  
  /**
   * The Comissionable interface defines the contract for an manager 
   * of deployable components. 
   *
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2004/02/06 15:27:14 $
   */
  public interface Commissionable
  {
     /**
      * Commission the runtime handler. 
      *
      * @exception Exception if a hanfdler commissioning error occurs
      */
      void commission() throws Exception;
  
     /**
      * Invokes the decommissioning phase.  Once a handler is 
      * decommissioned it may be re-commissioned.
      */
      void decommission();
  
  }
  
  
  
  1.1                  avalon/merlin/composition/api/src/java/org/apache/avalon/composition/runtime/Resolver.java
  
  Index: Resolver.java
  ===================================================================
  /* 
   * Copyright 2004 Apache Software Foundation
   * Licensed  under the  Apache License,  Version 2.0  (the "License");
   * you may not use  this file  except in  compliance with the License.
   * You may obtain a copy of the License at 
   * 
   *   http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed  under the  License is distributed on an "AS IS" BASIS,
   * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
   * implied.
   * 
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.avalon.composition.runtime;
  
  /**
   * The Resolver interface defines the contract for instance access and 
   * release.
   *
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2004/02/06 15:27:14 $
   */
  public interface Resolver
  {
      /**
       * Resolve a object to a value.
       *
       * @return the resolved object
       * @throws Exception if an error occurs
       */
      Object resolve() throws Exception;
  
      /**
       * Release an object
       *
       * @param instance the object to be released
       */
      void release( Object instance );
  
  }
  
  
  
  1.4       +13 -23    avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentContext.java
  
  Index: DefaultComponentContext.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultComponentContext.java	24 Jan 2004 23:25:27 -0000	1.3
  +++ DefaultComponentContext.java	6 Feb 2004 15:27:14 -0000	1.4
  @@ -176,27 +176,13 @@
       }
   
      /**
  -    * Return a model relative to a supplied dependency.
  -    * @return a matching model or null if the dependency is unresolvable
  -    * @exception ModelRuntimeException if an error occurs during model establishment
  -    */
  -    //public DeploymentModel getModel( DependencyDescriptor dependency ) 
  -    //  throws ModelRuntimeException
  -    //{
  -    //    return m_model.getModel( dependency );
  -    //}
  -
  -   /**
  -    * Return a model relative to a supplied stage descriptor.
  -    * @param stage the stage descriptor
  -    * @return model of a an stage handler or null if the stage is unresolvable
  -    * @exception ModelRuntimeException if an error occurs during model establishment
  -    */
  -    //public DeploymentModel getModel( StageDescriptor stage ) 
  -    //  throws ModelRuntimeException
  -    //{
  -    //    return m_model.getModel( stage );
  -    //}
  +    * Return the enclosing containment model.
  +    * @return the containment model that component is within
  +    */
  +    public ContainmentModel getContainmentModel() 
  +    {
  +        return m_model;
  +    }
   
      /**
       * Return the working directory.
  @@ -298,7 +284,11 @@
               key = entry.getKey();
           }
           
  -        if( key.startsWith( "urn:composition:" ) )
  +        if( key.equals( ContainmentModel.KEY ) )
  +        {
  +            return getContainmentModel();
  +        }
  +        else if( key.startsWith( "urn:composition:" ) )
           {
               return getSystemContext().get( key );
           }
  
  
  
  1.7       +15 -1     avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContextModel.java
  
  Index: DefaultContextModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContextModel.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultContextModel.java	24 Jan 2004 23:25:27 -0000	1.6
  +++ DefaultContextModel.java	6 Feb 2004 15:27:14 -0000	1.7
  @@ -22,6 +22,8 @@
   import java.lang.reflect.Constructor;
   
   import org.apache.avalon.composition.model.ContextModel;
  +import org.apache.avalon.composition.model.ComponentModel;
  +import org.apache.avalon.composition.model.ContainmentModel;
   import org.apache.avalon.composition.model.ModelException;
   import org.apache.avalon.composition.model.ComponentContext;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
  @@ -91,6 +93,7 @@
       * @param descriptor the contextualization stage descriptor
       * @param directive the contextualization directive
       * @param context the deployment context
  +    * @param componentModel the enclosing component model
       */
       public DefaultContextModel( 
         Logger logger, ContextDescriptor descriptor, 
  @@ -144,6 +147,17 @@
                            throw new ModelException( error );
                       }
                   }
  +            }
  +            else if( key.equals( ContainmentModel.KEY ) )
  +            {
  +                //
  +                // TODO: check that the component has permission
  +                // to access the containment model
  +                //
  +
  +                m_map.put( 
  +                  ContainmentModel.KEY, 
  +                  context.getContainmentModel() );
               }
               else if( key.startsWith( "urn:composition:" ) )
               {
  
  
  
  1.14      +5 -4      avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java
  
  Index: DefaultDeploymentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DefaultDeploymentModel.java	24 Jan 2004 23:25:27 -0000	1.13
  +++ DefaultDeploymentModel.java	6 Feb 2004 15:27:14 -0000	1.14
  @@ -22,6 +22,7 @@
   import org.apache.avalon.composition.model.DependencyGraph;
   import org.apache.avalon.composition.model.SystemContext;
   import org.apache.avalon.composition.data.Mode;
  +import org.apache.avalon.composition.runtime.Commissionable;
   
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.parameters.Parameters;
  @@ -56,7 +57,7 @@
       // muttable state
       //--------------------------------------------------------------
   
  -    private Object m_handler = null;
  +    private Commissionable m_handler = null;
   
       //--------------------------------------------------------------
       // constructor
  @@ -143,7 +144,7 @@
       * Set the runtime handler for the model.
       * @param handler the runtime handler
       */
  -    public void setHandler( Object handler )
  +    public void setHandler( Commissionable handler )
       {
           m_handler = handler;
       }
  @@ -152,7 +153,7 @@
       * Get the assigned runtime handler for the model.
       * @return the runtime handler
       */
  -    public Object getHandler()
  +    public Commissionable getHandler()
       {
           return m_handler;
       }
  
  
  
  1.4       +1 -1      avalon/merlin/facilities/http/README.TXT
  
  Index: README.TXT
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/facilities/http/README.TXT,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- README.TXT	3 Feb 2004 14:49:52 -0000	1.3
  +++ README.TXT	6 Feb 2004 15:27:14 -0000	1.4
  @@ -2,7 +2,7 @@
   After building merlin try the following:
   
     $ cd merlin\facilities\http\test
  -  $ merlin -execute -kernel conf\kernel.xml conf\test.xml
  +  $ merlin conf\test.block
   
   The point you we browser to http://localhost:8080/test/hello
   
  
  
  
  1.3       +8 -15     avalon/merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl/ComponentModelHolder.java
  
  Index: ComponentModelHolder.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl/ComponentModelHolder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ComponentModelHolder.java	5 Feb 2004 18:59:07 -0000	1.2
  +++ ComponentModelHolder.java	6 Feb 2004 15:27:14 -0000	1.3
  @@ -29,8 +29,9 @@
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   
  -import org.apache.avalon.activation.appliance.Appliance;
   import org.apache.avalon.composition.model.ComponentModel;
  +import org.apache.avalon.composition.runtime.Resolver;
  +import org.apache.avalon.composition.runtime.Commissionable;
   import org.apache.avalon.http.HttpRuntimeException;
   import org.apache.avalon.http.Handler;
   import org.apache.avalon.http.HandlerException;
  @@ -109,7 +110,7 @@
       private class ServletAdapter extends GenericServlet
       {
           private final ComponentModel m_model;
  -        private Appliance m_appliance;
  +        private Resolver m_resolver;
    
           public ServletAdapter( final ComponentModel model )
           {
  @@ -118,14 +119,6 @@
   
           public void destroy()
           {
  -            try
  -            {
  -                getAppliance().release( getHandler() );
  -            }
  -            catch( Throwable e )
  -            {
  -                e.printStackTrace();
  -            }
           }
   
           public void service(ServletRequest request, ServletResponse response)
  @@ -145,7 +138,7 @@
           {
               try
               {
  -                return (Handler) getAppliance().resolve();
  +                return (Handler) getResolver().resolve();
               }
               catch( Throwable e )
               {
  @@ -153,13 +146,13 @@
               }
           }
   
  -        private Appliance getAppliance() throws ServletException
  +        private Resolver getResolver() throws ServletException
           {
  -            if( m_appliance != null ) return m_appliance;
  +            if( m_resolver != null ) return m_resolver;
               try
               {
  -                m_appliance = (Appliance)m_model.getHandler();
  -                return m_appliance;
  +                m_resolver = (Resolver) m_model.getHandler();
  +                return m_resolver;
               }
               catch( Throwable e )
               {
  
  
  
  1.5       +2 -29     avalon/merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl/DefaultServer.java
  
  Index: DefaultServer.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl/DefaultServer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultServer.java	2 Feb 2004 19:30:11 -0000	1.4
  +++ DefaultServer.java	6 Feb 2004 15:27:14 -0000	1.5
  @@ -270,7 +270,8 @@
   
           final String path = model.getPath();
           HttpContext context = m_server.getContext( path + "*" );
  -        ContainmentModelHandler handler = getContainmentHandler( context, path );
  +        ContainmentModelHandler handler = 
  +          getContainmentHandler( context, path );
           handler.addComponentModel( model );
           m_server.addContext( context );
           if( m_server.isStarted() )
  @@ -301,34 +302,6 @@
      //---------------------------------------------------------
      // implementation
      //---------------------------------------------------------
  -
  -    /**
  -     * Create a context defined in the component configuration.
  -     * @param config the context configuration
  -     */
  -    //private HttpContext createContext( Configuration config ) 
  -    //  throws Exception 
  -    //{
  -    //    String path = config.getAttribute( PATH_ATTRIBUTE_NAME, "/*" );
  -    //    String base = config.getAttribute( BASE_ATTRIBUTE_NAME, null );
  -    //    return createContext( path, base );
  -    //}
  -
  -    /**
  -     * Create a context using the supplied parameters.
  -     * @param path the context path
  -     * @param base the base directory
  -     */
  -    //private HttpContext createContext( String path, String base ) 
  -    //  throws Exception 
  -    //{
  -    //    HttpContext context = new HttpContext();
  -    //    context.setContextPath( path );
  -    //    String dir = getDerivedPath( base );
  -    //    context.setResourceBase( dir );
  -    //    context.addHandler( new ResourceHandler() );
  -    //    return context;
  -    //}
   
       /**
        * Add a listener defined in the component configuration.
  
  
  
  1.1                  avalon/merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl/DefaultModelListener.java
  
  Index: DefaultModelListener.java
  ===================================================================
  /* 
   * Copyright 2004 Apache Software Foundation
   * Licensed  under the  Apache License,  Version 2.0  (the "License");
   * you may not use  this file  except in  compliance with the License.
   * You may obtain a copy of the License at 
   * 
   *   http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed  under the  License is distributed on an "AS IS" BASIS,
   * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
   * implied.
   * 
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.avalon.http.impl;
  
  import javax.servlet.Servlet;
  
  import org.apache.avalon.composition.event.CompositionEvent;
  import org.apache.avalon.composition.event.CompositionEventListener;
  import org.apache.avalon.composition.model.ContainmentModel;
  import org.apache.avalon.composition.model.ComponentModel;
  import org.apache.avalon.composition.model.DeploymentModel;
  
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.activity.Initializable;
  
  import org.apache.avalon.http.HttpService;
  import org.apache.avalon.http.Handler;
  
  
  /**
   * DefaultModelListener listens to application model events
   * and registeres itself as a factory relative to servlet 
   * components.
   *
   * @avalon.component name="listener" lifestyle="singleton"
   * @avalon.service type="org.apache.avalon.composition.event.CompositionEventListener"
   * @author  <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   */
  public class DefaultModelListener extends AbstractLogEnabled 
    implements Contextualizable, Serviceable, Initializable, 
    CompositionEventListener
  {
     //---------------------------------------------------------
     // state
     //---------------------------------------------------------
  
     /**
      * The http server supplied during the serviceable 
      * lifecycle phase.
      */
      private HttpService m_server;
  
     /**
      * The root application model supplied during the 
      * contextualization phase.
      */
      private ContainmentModel m_model;
  
     //---------------------------------------------------------
     // Contextualizable
     //---------------------------------------------------------
  
    /**
     * Contextulaization of the listener by the container during 
     * which we are supplied with the root composition model for 
     * the application.
     *
     * @param context the supplied listener context
     * @avalon.entry key="urn:composition:containment.model" 
     *    type="org.apache.avalon.composition.model.ContainmentModel" 
     * @exception ContextException if a contextualization error occurs
     */
     public void contextualize( Context context ) throws ContextException
     {
         m_model = 
           (ContainmentModel) context.get( 
             "urn:composition:containment.model" );
     }
  
     //---------------------------------------------------------
     // Serviceable
     //---------------------------------------------------------
  
    /**
     * Assignment of dependent services by the container during which
     * we resolve the HTTP service used to register servlets.
     *
     * @param manager the supplied service manager
     * @avalon.dependency type="org.apache.avalon.http.HttpService" key="http"
     * @exception ServiceException if an error is service assignment occurs
     */
     public void service( ServiceManager manager ) throws ServiceException
     {
         m_server = (HttpService) manager.lookup( "http" );
     }
  
     //---------------------------------------------------------
     // Initializable
     //---------------------------------------------------------
  
     /**
      * Initialization of the component by the container.
      */
      public void initialize() throws Exception
      {
          if( getLogger().isInfoEnabled() )
          {
              getLogger().debug( 
                "registering listener: " + m_model );
          }
  
          synchronized( m_model )
          {
              processModel( m_model, true );
          }
      }
  
      private void processModel( DeploymentModel model, boolean flag )
      {
          if( model instanceof ContainmentModel ) 
          {
              ContainmentModel containment = 
                (ContainmentModel) model;
              if( flag )
              {
                  containment.addCompositionListener( this );
              }
              else
              {
                  containment.removeCompositionListener( this );
              }
              DeploymentModel[] models = containment.getModels();
              for( int i=0; i<models.length; i++ )
              {
                  processModel( models[i], flag );
              }
          }
          else if( model instanceof ComponentModel )
          {
              ComponentModel component = (ComponentModel) model;
              Class clazz = component.getDeploymentClass();
              if( Handler.class.isAssignableFrom( clazz ) )
              {
                  if( flag )
                  {
                      if( getLogger().isInfoEnabled() )
                      {
                          getLogger().info( 
                            "component: " + component + " is a Handler" );
                      }
                      m_server.register( component );
                  }
              }
          }
      }
  
     //---------------------------------------------------------
     // CompositionEventListener
     //---------------------------------------------------------
  
     /**
      * Model addition.
      */
      public void modelAdded( CompositionEvent event )
      {
          DeploymentModel model = event.getChild();
          processModel( model, true );
      }
  
     /**
      * Model removal.
      */
      public void modelRemoved( CompositionEvent event )
      {
          DeploymentModel model = event.getChild();
          processModel( model, false );
      }
  }
  
  
  
  1.3       +12 -2     avalon/merlin/facilities/http/test/conf/test.block
  
  Index: test.block
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/facilities/http/test/conf/test.block,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- test.block	5 Feb 2004 18:59:07 -0000	1.2
  +++ test.block	6 Feb 2004 15:27:14 -0000	1.3
  @@ -10,10 +10,20 @@
            <resource id="avalon-http:avalon-http-api" version="1.0-SNAPSHOT"/>
            <resource id="avalon-http:avalon-http-util" version="1.0-SNAPSHOT"/>
            <resource id="avalon-http:avalon-http-test" version="1.0-SNAPSHOT"/>
  +         <resource id="jetty:org.mortbay.jetty" version="4.2.15"/>
  +         <resource id="avalon-http:avalon-http-spi" version="1.0-SNAPSHOT"/>
  +         <resource id="avalon-http:avalon-http-impl" version="1.0-SNAPSHOT"/>
  +         <resource id="xerces:xerces" version="2.4.0"/>
          </repository>
        </classpath>
      </classloader>
   
  -   <component name="hello" class="test.http.TestServlet"/>
  -   
  +   <component name="hello" class="test.http.TestComponent"/>
  +
  +   <component name="http" 
  +         class="org.apache.avalon.http.impl.DefaultModelListener" 
  +         activation="startup">
  +       <categories priority="INFO"/>
  +   </component>
  +
   </container>
  
  
  
  1.1                  avalon/merlin/facilities/http/test/src/java/test/http/TestComponent.java
  
  Index: TestComponent.java
  ===================================================================
  /* 
   * Copyright 2004 Apache Software Foundation
   * Licensed  under the  Apache License,  Version 2.0  (the "License");
   * you may not use  this file  except in  compliance with the License.
   * You may obtain a copy of the License at 
   * 
   *   http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed  under the  License is distributed on an "AS IS" BASIS,
   * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
   * implied.
   * 
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package test.http;
  
  import java.io.IOException;
  import java.io.PrintWriter;
  import java.util.Date;
  
  import org.apache.avalon.framework.logger.LogEnabled;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.avalon.framework.service.ServiceException;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.avalon.http.HandlerException;
  import org.apache.avalon.http.util.HttpHandler;
  
  /**
   * HTTP Handler component that receives and processes http service 
   * requests.
   * 
   * @avalon.component name="test" lifestyle="thread"
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   * @avalon.service type="org.apache.avalon.http.Handler"
   */
  public class TestComponent extends HttpHandler 
    implements LogEnabled, Serviceable
  {
      //----------------------------------------------------------
      // state
      //----------------------------------------------------------
  
      private Logger m_logger;
  
      private int m_count;
  
      private Counter m_counter;
  
      //----------------------------------------------------------
      // lifecycle
      //----------------------------------------------------------
  
      public void enableLogging( Logger logger )
      {
          m_logger = logger;
      }
  
      protected Logger getLogger()
      {
          return m_logger;
      }
  
     /**
      * Service the servlet.
      * @param manager the service manager
      * @avalon.dependency type="test.http.Counter" key="counter"
      */
      public void service( ServiceManager manager ) throws ServiceException
      {
          getLogger().info( "servicing " + new Date() );
          m_counter = (Counter) manager.lookup( "counter" );
      }
  
      //----------------------------------------------------------
      // Handler
      //----------------------------------------------------------
  
      /**
       * Respond to a GET request for the content produced by
       * this servlet.  This method should be overidden in a
       *
       * @param request The servlet request we are processing
       * @param response The servlet response we are producing
       *
       * @exception IOException if an input/output error occurs
       * @exception ServletException if a servlet error occurs
       */
      public void doGet(HttpServletRequest request,
                        HttpServletResponse response)
        throws IOException, HandlerException {
  
          int count = m_counter.increment();
          
          m_count++;
  
          response.setContentType("text/html");
          PrintWriter writer = response.getWriter();
          String context = request.getContextPath();
          writer.println("<html>");
          writer.println("<head>");
          writer.println("<title>Test HTTP Handler</title>" );
          writer.println("</head>");
          writer.println("<body>" );
          writer.println("<hr/>");
          writer.println("<h3>Hello (" + m_count + "/" + count + ").</h3>");
          writer.println("<hr/>");
          writer.println("<p>I'm an Avalon component.<br/>");
          writer.println("I'm also an HTTP Handler.<br/>");
          writer.println("I exist!!<br/>");
          writer.println("Therefore I am.</p>");
          writer.println("<hr/>");
          writer.println("</body>");
          writer.println("</html>");
      }
  }
  
  
  
  1.23      +4 -21     avalon/merlin/kernel/impl/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/impl/project.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- project.xml	5 Feb 2004 19:12:05 -0000	1.22
  +++ project.xml	6 Feb 2004 15:27:15 -0000	1.23
  @@ -59,7 +59,7 @@
         <artifactId>avalon-repository-api</artifactId>
         <version>1.3-SNAPSHOT</version>
         <properties>
  -        <avalon.classloader>spi</avalon.classloader>
  +        <avalon.classloader>api</avalon.classloader>
         </properties>
       </dependency>
       <dependency>
  @@ -76,7 +76,7 @@
         <artifactId>avalon-logging-api</artifactId>
         <version>1.0-SNAPSHOT</version>
         <properties>
  -        <avalon.classloader>spi</avalon.classloader>
  +        <avalon.classloader>api</avalon.classloader>
         </properties>
       </dependency>
   
  @@ -85,7 +85,7 @@
         <artifactId>avalon-composition-api</artifactId>
         <version>2.0-SNAPSHOT</version>
         <properties>
  -        <avalon.classloader>spi</avalon.classloader>
  +        <avalon.classloader>api</avalon.classloader>
         </properties>
       </dependency>
       <dependency>
  @@ -107,7 +107,7 @@
         <artifactId>avalon-meta-api</artifactId>
         <version>1.3</version>
         <properties>
  -        <avalon.classloader>spi</avalon.classloader>
  +        <avalon.classloader>api</avalon.classloader>
         </properties>
       </dependency>
       <dependency>
  @@ -213,23 +213,6 @@
         <groupId>xerces</groupId>
         <artifactId>xerces</artifactId>
         <version>2.4.0</version>
  -    </dependency>
  -
  -    <dependency>
  -      <groupId>servletapi</groupId>
  -      <artifactId>servletapi</artifactId>
  -      <version>2.3</version>
  -      <properties>
  -        <avalon.classloader>api</avalon.classloader>
  -      </properties>
  -    </dependency>
  -    <dependency>
  -      <groupId>avalon-http</groupId>
  -      <artifactId>avalon-http-api</artifactId>
  -      <version>1.0-SNAPSHOT</version>
  -      <properties>
  -        <avalon.classloader>api</avalon.classloader>
  -      </properties>
       </dependency>
   
     </dependencies>
  
  
  
  1.23      +7 -1      avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java
  
  Index: DefaultFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DefaultFactory.java	2 Feb 2004 00:44:09 -0000	1.22
  +++ DefaultFactory.java	6 Feb 2004 15:27:15 -0000	1.23
  @@ -441,7 +441,7 @@
   
           File anchor = criteria.getAnchorDirectory();
   
  -        return new DefaultSystemContext( 
  +        DefaultSystemContext system = new DefaultSystemContext( 
               logging,
               anchor,
               criteria.getContextDirectory(),
  @@ -451,6 +451,12 @@
               criteria.isDebugEnabled(),
               criteria.getDeploymentTimeout(),
               criteria.isCodeSecurityEnabled() );
  +
  +        system.put( "urn:composition:dir", criteria.getWorkingDirectory() );
  +        system.put( "urn:composition:anchor", criteria.getAnchorDirectory() );
  +        system.makeReadOnly();
  +
  +        return system;
       }
   
       private ContainmentModel createApplicationModel( 
  
  
  
  1.7       +4 -4      avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultKernel.java
  
  Index: DefaultKernel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultKernel.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultKernel.java	2 Feb 2004 11:31:37 -0000	1.6
  +++ DefaultKernel.java	6 Feb 2004 15:27:15 -0000	1.7
  @@ -34,13 +34,13 @@
   import org.apache.avalon.activation.appliance.impl.DefaultBlock;
   
   import org.apache.avalon.composition.data.TargetDirective;
  -import org.apache.avalon.logging.provider.LoggingManager;
   import org.apache.avalon.composition.model.ContainmentContext;
   import org.apache.avalon.composition.model.ContainmentModel;
   import org.apache.avalon.composition.model.ComponentModel;
   import org.apache.avalon.composition.model.SystemContext;
   import org.apache.avalon.composition.util.StringHelper;
   
  +import org.apache.avalon.logging.provider.LoggingManager;
   import org.apache.avalon.util.exception.ExceptionHelper;
   
   import org.apache.avalon.framework.activity.Disposable;
  @@ -95,7 +95,7 @@
               facilities.assemble();
               DefaultBlock system = 
                 new DefaultBlock( facilities );
  -            system.deploy();
  +            system.commission();
               m_system = system;
           }
           catch( Throwable e )
  @@ -228,7 +228,7 @@
               try
               {
                   setState( DEPLOYMENT );
  -                m_application.deploy();
  +                m_application.commission();
               }
               catch( Throwable e )
               {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org