You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2001/12/19 11:36:24 UTC

cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer DefaultConfigurer.java

donaldp     01/12/19 02:36:24

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer
                        DefaultConfigurer.java
  Log:
  Removed reserved attributes as there is no such thing as setLogger anymore.
  
  Revision  Changes    Path
  1.11      +12 -40    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java
  
  Index: DefaultConfigurer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultConfigurer.java	2001/11/26 11:35:51	1.10
  +++ DefaultConfigurer.java	2001/12/19 10:36:24	1.11
  @@ -10,7 +10,6 @@
   import java.lang.reflect.InvocationTargetException;
   import java.lang.reflect.Method;
   import java.util.ArrayList;
  -import java.util.Iterator;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.excalibur.property.PropertyException;
  @@ -24,11 +23,9 @@
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.LogEnabled;
  -import org.apache.log.Logger;
  -import org.apache.myrmidon.interfaces.converter.MasterConverter;
  -import org.apache.myrmidon.interfaces.configurer.Configurer;
  -import org.apache.myrmidon.converter.Converter;
   import org.apache.myrmidon.converter.ConverterException;
  +import org.apache.myrmidon.interfaces.configurer.Configurer;
  +import org.apache.myrmidon.interfaces.converter.MasterConverter;
   
   /**
    * Class used to configure tasks.
  @@ -43,26 +40,19 @@
           ResourceManager.getPackageResources( DefaultConfigurer.class );
   
       ///Compile time constant to turn on extreme debugging
  -    private final static boolean   DEBUG         = false;
  +    private final static boolean DEBUG = true;
   
       /*
        * TODO: Should reserved names be "configurable" ?
        */
  -
  -    ///Attribute names that are reserved
  -    private final static String  RESERVED_ATTRIBUTES[] =
  -    {
  -        "logger"
  -    };
  -
       ///Element names that are reserved
  -    private final static String  RESERVED_ELEMENTS[] =
  -    {
  -        "content"
  -    };
  +    private final static String[] RESERVED_ELEMENTS =
  +        {
  +            "content"
  +        };
   
       ///Converter to use for converting between values
  -    private MasterConverter        m_converter;
  +    private MasterConverter m_converter;
   
       public void compose( final ComponentManager componentManager )
           throws ComponentException
  @@ -144,7 +134,6 @@
               }
   
               final String content = configuration.getValue( null );
  -
               if( null != content )
               {
                   if( !content.trim().equals( "" ) )
  @@ -204,16 +193,6 @@
                                        final Context context )
           throws ConfigurationException
       {
  -        for( int i = 0; i < RESERVED_ATTRIBUTES.length; i++ )
  -        {
  -            if( RESERVED_ATTRIBUTES[ i ].equals( name ) )
  -            {
  -                final String message =
  -                    REZ.getString( "reserved-attribute.error", name );
  -                throw new ConfigurationException( message );
  -            }
  -        }
  -
           final String methodName = getMethodNameFor( name );
           setValue( object, methodName, value, context );
       }
  @@ -229,7 +208,6 @@
   
           final Class clazz = object.getClass();
           final Method[] methods = getMethodsFor( clazz, methodName );
  -
           if( 0 == methods.length )
           {
               final String message =
  @@ -320,7 +298,7 @@
   
           try
           {
  -            method.invoke( object, new Object[] { value } );
  +            method.invoke( object, new Object[]{value} );
           }
           catch( final IllegalAccessException iae )
           {
  @@ -376,7 +354,7 @@
               }
           }
   
  -        return (Method[])matches.toArray( new Method[0] );
  +        return (Method[])matches.toArray( new Method[ 0 ] );
       }
   
       private Method[] getCreateMethodsFor( final Class clazz, final String methodName )
  @@ -403,7 +381,7 @@
               }
           }
   
  -        return (Method[])matches.toArray( new Method[0] );
  +        return (Method[])matches.toArray( new Method[ 0 ] );
       }
   
       private String getMethodNameFor( final String attribute )
  @@ -441,12 +419,6 @@
           throws ConfigurationException
       {
           final String name = configuration.getName();
  -
  -        for( int i = 0; i < RESERVED_ELEMENTS.length; i++ )
  -        {
  -            if( RESERVED_ATTRIBUTES[ i ].equals( name ) ) return;
  -        }
  -
           final String javaName = getJavaNameFor( name );
   
           // OMFG the rest of this is soooooooooooooooooooooooooooooooo
  @@ -509,7 +481,7 @@
               final Object created = clazz.newInstance();
   
               configure( created, configuration, context );
  -            method.invoke( object, new Object[] { created } );
  +            method.invoke( object, new Object[]{created} );
           }
           catch( final ConfigurationException ce )
           {
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>