avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine Engine.java EngineClassLoader.java
Date Tue, 17 Dec 2002 04:55:01 GMT
mcconnell    2002/12/16 20:55:01

  Modified:    assembly/src/java/org/apache/avalon/assembly/engine
                        Engine.java EngineClassLoader.java
  Log:
  Updates appliance factory operations to handle new appliance creation relative to a supplied
partition.
  
  Revision  Changes    Path
  1.8       +22 -2     avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/Engine.java
  
  Index: Engine.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/Engine.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Engine.java	15 Dec 2002 14:08:56 -0000	1.7
  +++ Engine.java	17 Dec 2002 04:55:01 -0000	1.8
  @@ -98,13 +98,24 @@
       Appliance createAppliance( ApplianceContext context, boolean shared ) throws ApplianceException;
   
      /**
  +    * Resolve an appliance capable of supporting a supplied service 
  +    * reference.
  +    *
  +    * @param dependency a service depedency descriptor
  +    * @return the appliance
  +    */
  +    Appliance resolve( DependencyDescriptor dependency ) throws Exception;
  +
  +
  +   /**
       * Resolve an appliance capable of supporting a service 
       * referenced.
       *
       * @param dependency a service depedency descriptor
  +    * @param partition the partition to assign to a new appliance if creation is necessary
       * @return the appliance
       */
  -    Appliance resolve( DependencyDescriptor dependency ) throws Exception;
  +    Appliance resolve( DependencyDescriptor dependency, String partition ) throws Exception;
   
      /**
       * Resolve an appliance capable of supporting a referenced extension.
  @@ -113,5 +124,14 @@
       * @return the appliance
       */
       Appliance resolve( StageDescriptor stage ) throws Exception;
  +
  +   /**
  +    * Resolve an appliance capable of supporting a referenced extension.
  +    *
  +    * @param stage a lifecycle stage descriptor
  +    * @param partition the partition to assign to a new appliance if creation is necessary
  +    * @return the appliance
  +    */
  +    Appliance resolve( StageDescriptor stage, String partition ) throws Exception;
   
   }
  
  
  
  1.10      +52 -8     avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/EngineClassLoader.java
  
  Index: EngineClassLoader.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/EngineClassLoader.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- EngineClassLoader.java	16 Dec 2002 01:08:57 -0000	1.9
  +++ EngineClassLoader.java	17 Dec 2002 04:55:01 -0000	1.10
  @@ -438,9 +438,9 @@
   
           createRepositoryManager();
   
  +        m_assembly = createAssemblyService( m_facilities, m_graph );
           m_lifestyle = createLifestyleService( m_facilities );
           m_appliances = createApplianceManager( m_facilities );
  -        m_assembly = createAssemblyService( m_facilities, m_graph );
                                    
           //
           // install the set of extensions
  @@ -773,6 +773,15 @@
           m_assembly.assemble( appliance );
       }
   
  +   /**
  +    * Disassemble the supplied appliance.
  +    * @param appliance the object to disassembly
  +    */
  +    public void disassemble( Appliance appliance )
  +    {
  +        m_assembly.disassemble( appliance );
  +    }
  +
       //==============================================================
       // Engine
       //==============================================================
  @@ -826,7 +835,6 @@
           }
       }
   
  -
      /**
       * Resolve an appliance capable of supporting a service 
       * referenced.
  @@ -836,6 +844,19 @@
       */
       public Appliance resolve( DependencyDescriptor dependency ) throws Exception
       {
  +        return resolve( dependency, "" );
  +    }
  +
  +   /**
  +    * Resolve an appliance capable of supporting a service 
  +    * referenced.
  +    *
  +    * @param dependency a service depedency descriptor
  +    * @param partition the partition name
  +    * @return the appliance
  +    */
  +    public Appliance resolve( DependencyDescriptor dependency, String partition ) throws
Exception
  +    {
           if( dependency == null )
           {
               throw new IllegalStateException( "dependency" );
  @@ -858,7 +879,10 @@
               }
               else
               {
  -                appliance = createAppliance( new ApplianceContext( profile ), true );
  +                ApplianceContext context = new ApplianceContext( profile );
  +                context.setPartitionName( partition );
  +                appliance = createAppliance( context, true );
  +                assemble( appliance );
               }
           }
           return appliance;
  @@ -872,6 +896,18 @@
       */
       public Appliance resolve( StageDescriptor stage ) throws Exception
       {
  +        return resolve( stage, "" );
  +    }
  +
  +   /**
  +    * Resolve an appliance capable of supporting a referenced extension.
  +    *
  +    * @param stage a lifecycle stage descriptor
  +    * @param partition the partition to assign to a new appliance if creation is necessary
  +    * @return the appliance
  +    */
  +    public Appliance resolve( StageDescriptor stage, String partition ) throws Exception
  +    {
           if( stage == null )
           {
               throw new IllegalStateException( "stage" );
  @@ -895,14 +931,17 @@
               }
               else
               {
  -                appliance = createAppliance( new ApplianceContext( profile ), true );
  +                ApplianceContext context = new ApplianceContext( profile );
  +                context.setPartitionName( partition );
  +                appliance = createAppliance( context, true );
  +                assemble( appliance );
               }
           }
           return appliance;
       }
   
      /**
  -    * Create and assemble a new appliance.
  +    * Create a new appliance.
       * @param context the appliance creation context
       * @param shared TRUE if this appliance can be shared
       * @return the appliance
  @@ -915,12 +954,11 @@
               String name = context.getProfile().getType().getInfo().getName();
               Logger logger = getLogger().getChildLogger( name );
               appliance = buildAppliance( context, getSystemContext(), logger );
  -            assemble( appliance );
           }
           catch( Throwable e )
           {
               final String error = 
  -              "Error while attempting to create standard appliance" 
  +              "Unable to create a standard appliance" 
                 + " from the profile: " 
                 + context.getProfile();
               throw new ApplianceException( error, e );
  @@ -1066,6 +1104,11 @@
       private DeploymentService bootstrapDeploymentService( Map facilities ) 
         throws ServiceException
       {
  +        if( m_assembly == null )
  +        {
  +            throw new IllegalStateException( "assembly" );
  +        }
  +
           try
           {
               DefaultDeploymentService deployment = new DefaultDeploymentService();
  @@ -1073,6 +1116,7 @@
               MappedServiceManager manager = new MappedServiceManager( facilities );
               manager.put("urn:assembly:logging.manager", m_logging );
               manager.put("urn:assembly:engine.classloader", this );
  +            manager.put("urn:assembly:engine.assembly", m_assembly );
               deployment.service( manager );
               deployment.contextualize( new DefaultContext() );
               deployment.initialize();
  
  
  

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


Mime
View raw message