leif        2003/02/19 04:02:55

  Modified:    fortress/src/java/org/apache/avalon/fortress/impl/handler
                        ComponentFactory.java
  Log:
  Fix the initialization if Initializable components so that the name is set 
before
  any other initialization.  Also allow them to change there own name in
  configuration before being registered with the IM.
  
  Revision  Changes    Path
  1.4       +11 -3     
avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/ComponentFactory.java
  
  Index: ComponentFactory.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler/ComponentFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ComponentFactory.java     10 Feb 2003 15:47:00 -0000      1.3
  +++ ComponentFactory.java     19 Feb 2003 12:02:55 -0000      1.4
  @@ -199,6 +199,13 @@
               }
           }
   
  +        // Set the name of the instrumentable before initialization.
  +        if( component instanceof Instrumentable )
  +        {
  +            final Instrumentable instrumentable = (Instrumentable)component;
  +            instrumentable.setInstrumentableName( m_instrumentableName );
  +        }
  +        
           if( component instanceof InstrumentManageable )
           {
               ( (InstrumentManageable)component ).setInstrumentManager( 
m_instrumentManager );
  @@ -222,9 +229,10 @@
           if( component instanceof Instrumentable )
           {
               final Instrumentable instrumentable = (Instrumentable)component;
  -            instrumentable.setInstrumentableName( m_instrumentableName );
  +            
  +            // Get the name from the instrumentable in case it was changed 
since being set above.
               m_instrumentManager.registerInstrumentable(
  -                instrumentable, m_instrumentableName );
  +                instrumentable, instrumentable.getInstrumentableName() );
           }
   
           ContainerUtil.start( component );
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to