avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/handler ComponentFactory.java
Date Fri, 25 Apr 2003 13:31:03 GMT
bloritsch    2003/04/25 06:31:03

  Modified:    fortress/src/java/org/apache/avalon/fortress/impl/handler
                        ComponentFactory.java
  Log:
  add a couple patches to add features to help extensions, and to protect the Paramters.fromConfiguration()
processing from components that are not Parameterizable
  
  Revision  Changes    Path
  1.23      +17 -2     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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ComponentFactory.java	18 Apr 2003 20:02:29 -0000	1.22
  +++ ComponentFactory.java	25 Apr 2003 13:31:03 -0000	1.23
  @@ -62,6 +62,7 @@
   import org.apache.avalon.framework.logger.Loggable;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.parameters.Parameters;
  +import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.excalibur.instrument.AbstractLogEnabledInstrumentable;
   import org.apache.excalibur.instrument.CounterInstrument;
  @@ -134,6 +135,16 @@
           final String name = configuration.getAttribute( "id", componentClass.getName()
);
           ( (DefaultContext) m_context ).put( "component.name", name );
           ( (DefaultContext) m_context ).put( "component.logger", configuration.getAttribute(
"logger", name ) );
  +        // Take each configuration attribute, and make a context entry of form "component.<attribName>"
  +        String[] attribNames = configuration.getAttributeNames();
  +
  +        for ( int index = 0; index < attribNames.length; index++ )
  +        {
  +            String oneName = attribNames[index];
  +            ( (DefaultContext) m_context ).put( "component." + oneName, configuration.getAttribute(
oneName, "" ) );
  +        }
  +
  +        ( (DefaultContext) m_context ).put( "component.configuration", configuration );
           ( (DefaultContext) m_context ).makeReadOnly();
           m_loggerManager = loggerManager;
           m_extManager = extManager;
  @@ -186,7 +197,11 @@
           }
           ContainerUtil.service( component, m_serviceManager );
           ContainerUtil.configure( component, m_configuration );
  -        ContainerUtil.parameterize( component, Parameters.fromConfiguration( m_configuration
) );
  +
  +        if ( component instanceof Parameterizable )
  +        {
  +            ContainerUtil.parameterize( component, Parameters.fromConfiguration( m_configuration
) );
  +        }
   
           m_extManager.executeCreationExtensions( component, m_context );
   
  
  
  

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


Mime
View raw message