avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel DefaultKernel.java
Date Tue, 13 Aug 2002 05:12:29 GMT
mcconnell    2002/08/12 22:12:29

  Modified:    assembly/src/java/org/apache/excalibur/merlin/assembly
                        ContainerManager.java
               assembly/src/java/org/apache/excalibur/merlin/kernel
                        DefaultKernel.java
  Log:
  Put in place establishment of a default lifestyle manager at kerenl level that
  can be overrided at root container level - also eliminated redundant creation
  of stardard manager at container level (because a kernel level manager
  will be accessible accross the hierachy).
  
  Revision  Changes    Path
  1.17      +3 -2      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ContainerManager.java
  
  Index: ContainerManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ContainerManager.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ContainerManager.java	13 Aug 2002 04:45:56 -0000	1.16
  +++ ContainerManager.java	13 Aug 2002 05:12:29 -0000	1.17
  @@ -497,7 +497,8 @@
               ContainerManager loader = new ContainerManager( this, name );
               DefaultContext context = new DefaultContext( m_context );
               context.put( TypeManager.CLASSPATH_DESCRIPTOR_KEY, classpath );
  -            context.put( LIFESTYLES_KEY, lifestyles );
  +            if( lifestyles != null )
  +              context.put( LIFESTYLES_KEY, lifestyles );
   
               context.makeReadOnly();
               if( this instanceof KernelManager )
  
  
  
  1.37      +39 -21    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.java
  
  Index: DefaultKernel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- DefaultKernel.java	13 Aug 2002 03:57:56 -0000	1.36
  +++ DefaultKernel.java	13 Aug 2002 05:12:29 -0000	1.37
  @@ -92,6 +92,7 @@
   import org.apache.excalibur.merlin.container.StateEvent;
   import org.apache.excalibur.merlin.container.ContainerFactory;
   import org.apache.excalibur.merlin.resource.LifestyleManager;
  +import org.apache.excalibur.merlin.resource.DefaultLifestyleManager;
   
   /**
    * Default kernel implementation.
  @@ -321,6 +322,19 @@
               m_localLogger = m_logger.getChildLogger("kernel");
   
               //
  +            // Independently of any declare lifestyle manager, make sure
  +            // the default lifestyle manager is declared at the kernel 
  +            // level.  Customized managers may appear at the root container 
  +            // level and override the derault.  If not custom mananager is 
  +            // defined, then system defaults will apply
  +            //
  +
  +            DefaultLifestyleManager dlm = new DefaultLifestyleManager();
  +            dlm.enableLogging( getLogger().getChildLogger("lifestyle") );
  +            dlm.configure( m_config.getChild("lifestyles") );
  +            dlm.initialize();
  +
  +            //
               // Create the kernel type manager.
               // Create a context object container the logging manager and the 
               // categories to be applied relative to the manager's path, include
  @@ -338,6 +352,7 @@
               ctx.put( KernelManager.LOGGING_KEY, m_logging );
               ctx.put( ContainerManager.EXTENSIONS_DESCRIPTOR_KEY, extensions );
               ctx.put( ContainerManager.CLASSPATH_DESCRIPTOR_KEY, classpath );
  +            ctx.put( ContainerManager.LIFESTYLES_KEY, dlm );
               m_manager.contextualize( ctx );
               m_manager.initialize();
   
  @@ -345,29 +360,32 @@
               getLogger().info("kernel established: " + name );
   
               //
  -            // Create the lifestyle manager.
  +            // Create a custom container level lifestyle manager if declared.
               //
   
  -            LifestyleManager lifestyles;
  -            try
  -            {
  -                Configuration lifestyleConfig = m_config.getChild("lifestyles");
  -                String lifestyleClassname = lifestyleConfig.getAttribute(
  -                  "class","org.apache.excalibur.merlin.resource.DefaultLifestyleManager");
  -                Class clazz = m_manager.loadClass( lifestyleClassname );
  -                lifestyles = (LifestyleManager) clazz.newInstance();
  -                if( lifestyles instanceof LogEnabled )
  -                  ((LogEnabled)lifestyles).enableLogging( 
  -                     getLogger().getChildLogger("lifestyles") );
  -                if( lifestyles instanceof Configurable )
  -                  ((Configurable)lifestyles).configure( lifestyleConfig );
  -                if( lifestyles instanceof Initializable )
  -                  ((Initializable)lifestyles).initialize();
  -            }
  -            catch( Throwable e )
  +            LifestyleManager lifestyles = null;
  +            Configuration lifestyleConfig = m_config.getChild("lifestyles", false );
  +            if( lifestyleConfig != null )
               {
  -                final String error = "Lifestyle manager establishment failure.";
  -                throw new KernelException( error, e );
  +                try
  +                {
  +                    String lifestyleClassname = lifestyleConfig.getAttribute(
  +                      "class","org.apache.excalibur.merlin.resource.DefaultLifestyleManager");
  +                    Class clazz = m_manager.loadClass( lifestyleClassname );
  +                    lifestyles = (LifestyleManager) clazz.newInstance();
  +                    if( lifestyles instanceof LogEnabled )
  +                      ((LogEnabled)lifestyles).enableLogging( 
  +                        getLogger().getChildLogger("lifestyles") );
  +                    if( lifestyles instanceof Configurable )
  +                      ((Configurable)lifestyles).configure( lifestyleConfig );
  +                    if( lifestyles instanceof Initializable )
  +                      ((Initializable)lifestyles).initialize();
  +                }
  +                catch( Throwable e )
  +                {
  +                    final String error = "Lifestyle manager establishment failure.";
  +                    throw new KernelException( error, e );
  +                }
               }
   
               // 
  
  
  

--
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