ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@locus.apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/manifest taskdefs.xml
Date Mon, 11 Dec 2000 00:33:46 GMT
donaldp     00/12/10 16:33:46

  Modified:    proposal/myrmidon/src/java/org/apache/ant/convert
                        ConverterEngine.java ConverterInfo.java
                        ConverterRegistry.java DefaultConverterEngine.java
                        DefaultConverterInfo.java
                        DefaultConverterRegistry.java
               proposal/myrmidon/src/java/org/apache/ant/tasklet/engine
                        DefaultTaskletEngine.java DefaultTskDeployer.java
                        TaskletConverterEngine.java TaskletEngine.java
                        TskDeployer.java
               proposal/myrmidon/src/java/org/apache/ant/tasks/core
                        AbstractResourceRegisterer.java
                        RegisterConverter.java RegisterTasklet.java
  Added:       proposal/myrmidon/src/java/org/apache/ant/configuration
                        Configurer.java DefaultConfigurer.java
               proposal/myrmidon/src/manifest taskdefs.xml
  Removed:     proposal/myrmidon/src/java/org/apache/ant/convert
                        ConverterFactory.java ConverterLoader.java
                        DefaultConverterFactory.java
                        DefaultConverterLoader.java
               proposal/myrmidon/src/java/org/apache/ant/convert/core
                        converters.properties
               proposal/myrmidon/src/java/org/apache/ant/tasklet/engine
                        DefaultTaskletConfigurer.java
                        DefaultTaskletFactory.java DefaultTaskletInfo.java
                        DefaultTaskletLoader.java
                        DefaultTaskletRegistry.java TaskletConfigurer.java
                        TaskletFactory.java TaskletInfo.java
                        TaskletLoader.java TaskletRegistry.java
               proposal/myrmidon/src/java/org/apache/ant/tasks/core
                        taskdefs.properties
  Log:
  Updated to latest Avalon which involved removing a lot of cruft from Ant.
  
  Revision  Changes    Path
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/configuration/Configurer.java
  
  Index: Configurer.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.ant.configuration;
  
  import org.apache.avalon.Component;
  import org.apache.avalon.ConfigurationException;
  import org.apache.avalon.Context;
  
  /**
   * Class used to configure tasks.
   * 
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public interface Configurer
      extends Component
  {
      /**
       * Configure an object based on a configuration in a particular context.
       * This configuring can be done in different ways for different 
       * configurers.
       *
       * @param object the object
       * @param configuration the configuration
       * @param context the Context
       * @exception ConfigurationException if an error occurs
       */
      void configure( Object object, Configuration configuration, Context context )
          throws ConfigurationException;
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/configuration/DefaultConfigurer.java
  
  Index: DefaultConfigurer.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.ant.configuration;
  
  import java.lang.reflect.InvocationTargetException;
  import java.lang.reflect.Method;
  import java.util.ArrayList;
  import java.util.Iterator;
  import org.apache.ant.convert.Converter;
  import org.apache.ant.convert.ConverterException;
  import org.apache.avalon.ComponentManager;
  import org.apache.avalon.ComponentNotAccessibleException;
  import org.apache.avalon.ComponentNotFoundException;
  import org.apache.avalon.Composer;
  import org.apache.avalon.ConfigurationException;
  import org.apache.avalon.Context;
  import org.apache.avalon.util.PropertyException;
  import org.apache.avalon.util.PropertyUtil;
  
  /**
   * Class used to configure tasks.
   * 
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class DefaultConfigurer
      implements Configurer, Composer
  {
      protected final static String  RESERVED_ATTRIBUTES[] = 
      {
          "id"
      };
  
      protected final static String  RESERVED_ELEMENTS[] = 
      {
          "content"
      };
  
      protected Converter            m_converter;
  
      public void compose( final ComponentManager componentManager )
          throws ComponentNotFoundException, ComponentNotAccessibleException
      {
          m_converter = (Converter)componentManager.lookup( "org.apache.ant.convert.Converter" );
      }
      
      /**
       * Configure a task based on a configuration in a particular context.
       * This configuring can be done in different ways for different 
       * configurers. 
       * This one does it by first checking if object implements Configurable 
       * and if it does will pass the task the configuration - else it will use
       * ants rules to map configuration to types
       *
       * @param tasklet the tasklet
       * @param configuration the configuration
       * @param context the Context
       * @exception ConfigurationException if an error occurs
       */
      public void configure( final Object object, 
                             final Configuration configuration,
                             final Context context )
          throws ConfigurationException
      {
          if( object instanceof Configurable )
          {
              ((Configurable)object).configure( configuration );
          }
          else
          {
              final Iterator attributes = configuration.getAttributeNames();
  
              while( attributes.hasNext() )
              {
                  final String name = (String)attributes.next();
                  final String value = configuration.getAttribute( name );
                  configureAttribute( object, name, value, context );
              }
  
              final Iterator elements = configuration.getChildren();
              
              while( elements.hasNext() )
              {
                  final Configuration element = (Configuration)elements.next();
                  configureElement( object, element, context );
              }
  
              final String content = configuration.getValue( null );
  
              if( null != content )
              {
                  if( !content.trim().equals( "" ) )
                  {
                      configureContent( object, content, context );
                  }
              }
          }
      }
  
      /**
       * Try to configure content of an object.
       *
       * @param object the object
       * @param content the content value to be set
       * @param context the Context
       * @exception ConfigurationException if an error occurs
       */
      protected void configureContent( final Object object, 
                                       final String content,
                                       final Context context )
          throws ConfigurationException
      {
          setValue( object, "addContent", content, context );
      }
  
      protected void configureAttribute( final Object object, 
                                         final String name, 
                                         final String value,
                                         final Context context )
          throws ConfigurationException
      {
          for( int i = 0; i < RESERVED_ATTRIBUTES.length; i++ )
          {
              if( RESERVED_ATTRIBUTES[ i ].equals( name ) ) return;
          }
  
          final String methodName = getMethodNameFor( name );
          setValue( object, methodName, value, context );
      }
  
      protected void setValue( final Object object, 
                               final String methodName,
                               final String value,
                               final Context context )
          throws ConfigurationException
      {
          // OMFG the rest of this is soooooooooooooooooooooooooooooooo
          // slow. Need to cache results per class etc.
  
          final Class clazz = object.getClass();
          final Method methods[] = getMethodsFor( clazz, methodName );
  
          if( 0 == methods.length )
          {
              throw new ConfigurationException( "Unable to set attribute via " + methodName + 
                                                " due to not finding any appropriate " + 
                                                "accessor method" );
          }
  
          setValue( object, value, context, methods );
      }
  
      protected void setValue( final Object object,
                               final String value,
                               final Context context,
                               final Method methods[] )
          throws ConfigurationException
      {
          try
          {
              final Object objectValue = 
                  PropertyUtil.resolveProperty( value, context, false );
  
              setValue( object, objectValue, methods );
          }
          catch( final PropertyException pe )
          {
              throw new ConfigurationException( "Error resolving property " + value,
                                                pe );
          }
      }
  
      protected void setValue( final Object object, Object value, final Method methods[] )
          throws ConfigurationException
      {
          final Class sourceClass = value.getClass();
          final String source = sourceClass.getName();
  
          for( int i = 0; i < methods.length; i++ )
          {
              if( setValue( object, value, methods[ i ], sourceClass, source ) )
              {
                  return;
              }
          }
          
          throw new ConfigurationException( "Unable to set attribute via " + 
                                            methods[ 0 ].getName() + " as could not convert " + 
                                            source + " to a matching type" );
      }
  
      protected boolean setValue( final Object object, 
                                  Object value, 
                                  final Method method,
                                  final Class sourceClass,
                                  final String source )
          throws ConfigurationException
      {
          Class parameterType = method.getParameterTypes()[ 0 ];
          if( parameterType.isPrimitive() )
          {
              parameterType = getComplexTypeFor( parameterType );
          }
          
          if( !parameterType.isAssignableFrom( sourceClass ) )
          {
              try
              {
                  value = m_converter.convert( parameterType, object );
              }
              catch( final ConverterException ce )
              {
                  return false;
              }
              catch( final Exception e )
              {
                  throw new ConfigurationException( "Error converting attribute for " + 
                                                    method.getName(),
                                                    e );
              }
          }
          
          try
          {
              method.invoke( object, new Object[] { value } );
          }
          catch( final IllegalAccessException iae )
          {
              //should never happen ....
              throw new ConfigurationException( "Error retrieving methods with " + 
                                                "correct access specifiers",
                                                iae );
          }
          catch( final InvocationTargetException ite )
          {
              throw new ConfigurationException( "Error calling method attribute " + 
                                                method.getName(),
                                                ite );
          }
  
          return true;
      }
  
      protected Class getComplexTypeFor( final Class clazz )
      {
          if( String.class == clazz ) return String.class;
          else if( Integer.TYPE.equals( clazz ) ) return Integer.class;
          else if( Long.TYPE.equals( clazz ) ) return Long.class;
          else if( Short.TYPE.equals( clazz ) ) return Short.class;
          else if( Byte.TYPE.equals( clazz ) ) return Byte.class;
          else if( Boolean.TYPE.equals( clazz ) ) return Boolean.class;
          else if( Float.TYPE.equals( clazz ) ) return Float.class;
          else if( Double.TYPE.equals( clazz ) ) return Double.class;
          else
          {
              throw new IllegalArgumentException( "Can not get complex type for non-primitive " +
                                                  "type " + clazz.getName() );
          }
      }
  
      protected Method[] getMethodsFor( final Class clazz, final String methodName )
      {
          final Method methods[] = clazz.getMethods();
          final ArrayList matches = new ArrayList();
          
          for( int i = 0; i < methods.length; i++ )
          {
              final Method method = methods[ i ];
              if( methodName.equals( method.getName() ) && 
                  Method.PUBLIC == (method.getModifiers() & Method.PUBLIC) )
              {
                  if( method.getReturnType().equals( Void.TYPE ) )
                  {
                      final Class parameters[] = method.getParameterTypes();
                      if( 1 == parameters.length )
                      {
                          matches.add( method );
                      }
                  }
              }
          }
  
          return (Method[])matches.toArray( new Method[0] );
      }
  
      protected Method[] getCreateMethodsFor( final Class clazz, final String methodName )
      {
          final Method methods[] = clazz.getMethods();
          final ArrayList matches = new ArrayList();
          
          for( int i = 0; i < methods.length; i++ )
          {
              final Method method = methods[ i ];
              if( methodName.equals( method.getName() ) && 
                  Method.PUBLIC == (method.getModifiers() & Method.PUBLIC) )
              {
                  final Class returnType = method.getReturnType();
                  if( !returnType.equals( Void.TYPE ) &&
                      !returnType.isPrimitive() )
                  {
                      final Class parameters[] = method.getParameterTypes();
                      if( 0 == parameters.length )
                      {
                          matches.add( method );
                      }
                  }
              }
          }
          
          return (Method[])matches.toArray( new Method[0] );
      }
  
      protected String getMethodNameFor( final String attribute )
      {
          return "set" + getJavaNameFor( attribute );
      }
  
      protected String getJavaNameFor( final String name )
      {
          final StringBuffer sb = new StringBuffer();
          
          int index = name.indexOf( '-' );
          int last = 0;
          
          while( -1 != index )
          {
              final String word = name.substring( last, index ).toLowerCase();
              sb.append( Character.toUpperCase( word.charAt( 0 ) ) );
              sb.append( word.substring( 1, word.length() ) );
              last = index + 1;
              index = name.indexOf( '-', last );
          }
          
          index = name.length();
          final String word = name.substring( last, index ).toLowerCase();
          sb.append( Character.toUpperCase( word.charAt( 0 ) ) );
          sb.append( word.substring( 1, word.length() ) );
          
          return sb.toString();
      }    
  
      protected void configureElement( final Object object, 
                                       final Configuration configuration,
                                       final Context context )
          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
          // slow. Need to cache results per class etc.
          final Class clazz = object.getClass();
          Method methods[] = getMethodsFor( clazz, "add" + javaName );
          
          if( 0 != methods.length )
          {
              //guess it is first method ????
              addElement( object, methods[ 0 ], configuration, context );
          }
          else
          {
              methods = getCreateMethodsFor( clazz, "create" + javaName );
  
              if( 0 == methods.length )
              {
                  throw new ConfigurationException( "Unable to set attribute " + javaName + 
                                                    " due to not finding any appropriate " + 
                                                    "accessor method" );
              }
  
              //guess it is first method ????
              createElement( object, methods[ 0 ], configuration, context );
          }
      }
  
      protected void createElement( final Object object, 
                                    final Method method,
                                    final Configuration configuration,
                                    final Context context )
          throws ConfigurationException
      {
          try
          {
              final Object created = method.invoke( object, new Object[ 0 ] );
              configure( created, configuration, context );
          }
          catch( final ConfigurationException ce )
          {
              throw ce;
          }
          catch( final Exception e )
          {
              throw new ConfigurationException( "Error creating sub-element", e );
          }
      }
  
      protected void addElement( final Object object, 
                                 final Method method,
                                 final Configuration configuration,
                                 final Context context )
          throws ConfigurationException
      {
          try
          {
              final Class clazz = method.getParameterTypes()[ 0 ];
              final Object created = clazz.newInstance();
  
              configure( created, configuration, context );
              method.invoke( object, new Object[] { created } );
          }
          catch( final ConfigurationException ce )
          {
              throw ce;
          }
          catch( final Exception e )
          {
              throw new ConfigurationException( "Error creating sub-element", e );
          }
      }
  }
  
  
  
  1.2       +4 -4      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/ConverterEngine.java
  
  Index: ConverterEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/ConverterEngine.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConverterEngine.java	2000/12/06 06:11:24	1.1
  +++ ConverterEngine.java	2000/12/11 00:33:39	1.2
  @@ -8,13 +8,13 @@
   package org.apache.ant.convert;
   
   import org.apache.avalon.Component;
  +import org.apache.avalon.Loggable;
  +import org.apache.avalon.camelot.LocatorRegistry;
   import org.apache.log.Logger;
   
   public interface ConverterEngine
  -    extends Component, Converter
  +    extends Component, Converter, Loggable
   {
  -    void setLogger( Logger logger );
  -
  +    LocatorRegistry getLocatorRegistry();
       ConverterRegistry getConverterRegistry();
  -    ConverterFactory getConverterFactory();
   }
  
  
  
  1.2       +0 -16     jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/ConverterInfo.java
  
  Index: ConverterInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/ConverterInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConverterInfo.java	2000/12/04 13:37:28	1.1
  +++ ConverterInfo.java	2000/12/11 00:33:39	1.2
  @@ -7,7 +7,6 @@
    */
   package org.apache.ant.convert;
   
  -import java.net.URL;
   import org.apache.avalon.camelot.Info;
   
   /**
  @@ -33,19 +32,4 @@
        * @return the classname of the produced object
        */
       String getDestination();
  -
  -    /**
  -     * Retrieve classname for concerter.
  -     *
  -     * @return the taskname
  -     */
  -    String getClassname();
  -
  -    /**
  -     * Retrieve location of task library where task is contained.
  -     *
  -     * @return the location of task library
  -     */
  -    URL getLocation();
   }
  -
  
  
  
  1.3       +3 -2      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/ConverterRegistry.java
  
  Index: ConverterRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/ConverterRegistry.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConverterRegistry.java	2000/12/06 00:23:21	1.2
  +++ ConverterRegistry.java	2000/12/11 00:33:39	1.3
  @@ -17,11 +17,12 @@
       extends Registry
   {
       /**
  -     * Retrieve ConverterInfo that describes converter that converts from source to destination.
  +     * Retrieve name of ConverterInfo that describes converter that converts 
  +     * from source to destination.
        *
        * @param source the source classname
        * @param destination the destination classname
        * @return the converter-info or null if none available
        */
  -    ConverterInfo getConverterInfo( String source, String destination );
  +    String getConverterInfoName( String source, String destination );
   }
  
  
  
  1.3       +25 -13    jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/DefaultConverterEngine.java
  
  Index: DefaultConverterEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/DefaultConverterEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultConverterEngine.java	2000/12/06 10:35:58	1.2
  +++ DefaultConverterEngine.java	2000/12/11 00:33:39	1.3
  @@ -10,12 +10,17 @@
   import org.apache.ant.AntException;
   import org.apache.avalon.Component;
   import org.apache.avalon.Initializable;
  +import org.apache.avalon.camelot.DefaultFactory;
  +import org.apache.avalon.camelot.DefaultLocatorRegistry;
  +import org.apache.avalon.camelot.Locator;
  +import org.apache.avalon.camelot.LocatorRegistry;
   import org.apache.log.Logger;
   
   public class DefaultConverterEngine
       implements ConverterEngine, Initializable
   {
  -    protected ConverterFactory     m_converterFactory;
  +    protected DefaultFactory       m_factory;
  +    protected LocatorRegistry      m_locatorRegistry;
       protected ConverterRegistry    m_converterRegistry;
       protected Logger               m_logger;
   
  @@ -24,48 +29,55 @@
           m_logger = logger;
       }
   
  -    public ConverterRegistry getConverterRegistry()
  +    public LocatorRegistry getLocatorRegistry()
       {
  -        return m_converterRegistry;
  +        return m_locatorRegistry;
       }
   
  -    public ConverterFactory getConverterFactory()
  +    public ConverterRegistry getConverterRegistry()
       {
  -        return m_converterFactory;
  +        return m_converterRegistry;
       }
   
       public void init()
           throws Exception
       {
           m_converterRegistry = createConverterRegistry();
  -        m_converterFactory =  createConverterFactory();
  +        m_locatorRegistry = createLocatorRegistry();
  +        m_factory =  createFactory();
       }
       
       protected ConverterRegistry createConverterRegistry()
       {
           return new DefaultConverterRegistry();
       }
  +
  +    protected LocatorRegistry createLocatorRegistry()
  +    {
  +        return new DefaultLocatorRegistry();
  +    }
   
  -    protected ConverterFactory createConverterFactory()
  +    protected DefaultFactory createFactory()
       {
  -        return new DefaultConverterFactory();
  +        return new DefaultFactory();
       }
   
       public Object convert( Class destination, final Object original )
           throws Exception
       {
  -        final ConverterInfo info = 
  -            m_converterRegistry.getConverterInfo( original.getClass().getName(), 
  -                                                  destination.getName() );
  +        final String name = 
  +            m_converterRegistry.getConverterInfoName( original.getClass().getName(), 
  +                                                      destination.getName() );
               
  -        if( null == info ) 
  +        if( null == name ) 
           {
               throw new ConverterException( "Unable to find converter for " + 
                                             original.getClass() + " to " + destination + 
                                             " conversion" );
           }
   
  -        final Converter converter = m_converterFactory.createConverter( info );
  +        final Locator locator = m_locatorRegistry.getLocator( name );
  +        final Converter converter = (Converter)m_factory.create( locator, Converter.class );
           return converter.convert( destination, original );
       }
   }
  
  
  
  1.2       +1 -30     jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/DefaultConverterInfo.java
  
  Index: DefaultConverterInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/DefaultConverterInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultConverterInfo.java	2000/12/04 13:37:28	1.1
  +++ DefaultConverterInfo.java	2000/12/11 00:33:39	1.2
  @@ -7,8 +7,6 @@
    */
   package org.apache.ant.convert;
   
  -import java.net.URL;
  -
   /**
    * This info represents meta-information about a converter.
    *
  @@ -19,18 +17,11 @@
   {
       protected final String            m_source;
       protected final String            m_destination;
  -    protected final String            m_classname;
  -    protected final URL               m_location;
   
  -    public DefaultConverterInfo( final String source, 
  -                                 final String destination,
  -                                 final String classname,
  -                                 final URL location )
  +    public DefaultConverterInfo( final String source, final String destination )
       {
           m_source = source;
           m_destination = destination;
  -        m_classname = classname;
  -        m_location = location;
       } 
   
       /**
  @@ -53,26 +44,6 @@
       public String getDestination()
       {
           return m_destination;
  -    }
  -    
  -    /**
  -     * Retrieve classname for concerter.
  -     *
  -     * @return the taskname
  -     */
  -    public String getClassname()
  -    {
  -        return m_classname;
  -    }
  -
  -    /**
  -     * Retrieve location of task library where task is contained.
  -     *
  -     * @return the location of task library
  -     */
  -    public URL getLocation()
  -    {
  -        return m_location;
       }
   }
   
  
  
  
  1.3       +3 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/DefaultConverterRegistry.java
  
  Index: DefaultConverterRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/convert/DefaultConverterRegistry.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultConverterRegistry.java	2000/12/06 00:23:22	1.2
  +++ DefaultConverterRegistry.java	2000/12/11 00:33:39	1.3
  @@ -30,11 +30,11 @@
        * @param destination the destination classname
        * @return the converter-info or null if none available
        */
  -    public ConverterInfo getConverterInfo( final String source, final String destination )
  +    public String getConverterInfoName( final String source, final String destination )
       {
           final HashMap map = (HashMap)m_mapping.get( source );
           if( null == map ) return null;
  -        return (ConverterInfo)map.get( destination );
  +        return (String)map.get( destination );
       }
   
       protected void checkInfo( final String name, final Info info )
  @@ -53,7 +53,7 @@
               m_mapping.put( source, map );
           }
           
  -        map.put( destination, info );        
  +        map.put( destination, name );        
       }
   
       protected Class getInfoClass()
  
  
  
  1.6       +36 -27    jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DefaultTaskletEngine.java
  
  Index: DefaultTaskletEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DefaultTaskletEngine.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultTaskletEngine.java	2000/12/06 10:36:04	1.5
  +++ DefaultTaskletEngine.java	2000/12/11 00:33:40	1.6
  @@ -11,19 +11,25 @@
   import org.apache.ant.AntException;
   import org.apache.ant.configuration.Configurable;
   import org.apache.ant.configuration.Configuration;
  +import org.apache.ant.configuration.Configurer;
  +import org.apache.ant.configuration.DefaultConfigurer;
   import org.apache.ant.convert.ConverterEngine;
  -import org.apache.ant.convert.ConverterFactory;
   import org.apache.ant.tasklet.Tasklet;
   import org.apache.ant.tasklet.TaskletContext;
   import org.apache.avalon.Component;
  -import org.apache.avalon.Composer;
   import org.apache.avalon.ComponentManager;
  +import org.apache.avalon.Composer;
   import org.apache.avalon.Context;
   import org.apache.avalon.Contextualizable;
   import org.apache.avalon.DefaultComponentManager;
   import org.apache.avalon.Disposable;
  +import org.apache.avalon.Loggable;
   import org.apache.avalon.Initializable;
  +import org.apache.avalon.camelot.DefaultFactory;
   import org.apache.avalon.camelot.FactoryException;
  +import org.apache.avalon.camelot.LocatorRegistry;
  +import org.apache.avalon.camelot.Locator;
  +import org.apache.avalon.camelot.DefaultLocatorRegistry;
   import org.apache.avalon.camelot.RegistryException;
   import org.apache.log.Logger;
   
  @@ -31,9 +37,9 @@
       implements TaskletEngine, Initializable
   {
       protected TskDeployer          m_tskDeployer;
  -    protected TaskletFactory       m_taskletFactory;
  -    protected TaskletRegistry      m_taskletRegistry;
  -    protected TaskletConfigurer    m_configurer;
  +    protected DefaultFactory       m_factory;
  +    protected LocatorRegistry      m_locatorRegistry;
  +    protected Configurer           m_configurer;
       protected Logger               m_logger;
       protected ConverterEngine      m_converterEngine;
   
  @@ -52,22 +58,23 @@
           return m_converterEngine;
       }
   
  -    public TaskletRegistry getTaskletRegistry()
  +    public LocatorRegistry getLocatorRegistry()
       {
  -        return m_taskletRegistry;
  +        return m_locatorRegistry;
       }
   
       public void init()
           throws Exception
       {
  -        m_taskletRegistry = createTaskletRegistry();
  -        m_taskletFactory = createTaskletFactory();
  +        m_locatorRegistry = createLocatorRegistry();
  +        m_factory = createFactory();
  +        setupSubComponent( m_factory );
   
           m_converterEngine = createConverterEngine();
           m_converterEngine.setLogger( m_logger );
           setupSubComponent( m_converterEngine );
   
  -        m_configurer = createTaskletConfigurer();
  +        m_configurer = createConfigurer();
           setupSubComponent( m_configurer );
   
           m_tskDeployer = createTskDeployer();
  @@ -78,6 +85,11 @@
       protected void setupSubComponent( final Component component )
           throws Exception
       {
  +        if( component instanceof Loggable )
  +        {
  +            ((Loggable)component).setLogger( m_logger );
  +        }
  +
           if( component instanceof Composer )
           {
               final DefaultComponentManager componentManager = new DefaultComponentManager();
  @@ -90,7 +102,7 @@
   
               ((Composer)component).compose( componentManager );
           }
  -        
  +
           if( component instanceof Initializable )
           {
               ((Initializable)component).init();
  @@ -102,19 +114,19 @@
           return new DefaultTskDeployer();
       }
   
  -    protected TaskletConfigurer createTaskletConfigurer()
  +    protected Configurer createConfigurer()
       {
  -        return new DefaultTaskletConfigurer();
  +        return new DefaultConfigurer();
       }
       
  -    protected TaskletRegistry createTaskletRegistry()
  +    protected LocatorRegistry createLocatorRegistry()
       {
  -        return new DefaultTaskletRegistry();
  +        return new DefaultLocatorRegistry();
       }
       
  -    protected TaskletFactory createTaskletFactory()
  +    protected DefaultFactory createFactory()
       {
  -        return new DefaultTaskletFactory();
  +        return new DefaultFactory();
       }
       
       protected ConverterEngine createConverterEngine()
  @@ -122,7 +134,7 @@
           //this is done so that the loaders are shared
           //which results in much less overhead
           final TaskletConverterEngine engine = new TaskletConverterEngine();
  -        engine.setConverterFactory( (ConverterFactory)m_taskletFactory );
  +        engine.setFactory( m_factory );
           return engine;
       }
   
  @@ -236,21 +248,18 @@
           throws AntException
       {
           final String name = configuration.getName();
  -        TaskletInfo info = null;
  -
  -        try { info = (TaskletInfo)m_taskletRegistry.getInfo( name ); }
  +        try
  +        {
  +            final Locator locator = m_locatorRegistry.getLocator( name );
  +            return (Tasklet)m_factory.create( locator, Tasklet.class );
  +        }
           catch( final RegistryException re )
           {
               throw new AntException( "Unable to locate task " + name, re );
           }
  -
  -        try { return m_taskletFactory.createTasklet( info ); }
           catch( final FactoryException fe )
           {
  -            throw new AntException( "Unable to create task " + name + 
  -                                    " (of type " + info.getClassname() + " from " +
  -                                    info.getLocation() + ")",
  -                                    fe );
  +            throw new AntException( "Unable to create task " + name, fe );
           }
       }
   }
  
  
  
  1.2       +88 -181   jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DefaultTskDeployer.java
  
  Index: DefaultTskDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/DefaultTskDeployer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultTskDeployer.java	2000/12/06 06:11:26	1.1
  +++ DefaultTskDeployer.java	2000/12/11 00:33:41	1.2
  @@ -11,22 +11,26 @@
   import java.io.IOException;
   import java.net.MalformedURLException;
   import java.net.URL;
  -import java.util.Enumeration;
  -import java.util.Properties;
  +import java.util.Iterator;
   import java.util.zip.ZipEntry;
   import java.util.zip.ZipException;
   import java.util.zip.ZipFile;
   import org.apache.ant.convert.ConverterEngine;
   import org.apache.ant.convert.ConverterRegistry;
   import org.apache.ant.convert.DefaultConverterInfo;
  -import org.apache.ant.tasklet.engine.DefaultTaskletInfo;
   import org.apache.avalon.Component;
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.ComponentNotAccessibleException;
   import org.apache.avalon.ComponentNotFoundException;
   import org.apache.avalon.Composer;
  -import org.apache.avalon.camelot.AbstractDeployer;
  +import org.apache.avalon.Configuration;
  +import org.apache.avalon.ConfigurationException;
  +import org.apache.avalon.camelot.AbstractZipDeployer;
  +import org.apache.avalon.camelot.DefaultLocator;
  +import org.apache.avalon.camelot.DefaultLocatorRegistry;
   import org.apache.avalon.camelot.DeploymentException;
  +import org.apache.avalon.camelot.Loader;
  +import org.apache.avalon.camelot.LocatorRegistry;
   import org.apache.avalon.camelot.RegistryException;
   import org.apache.log.Logger;
   
  @@ -36,20 +40,21 @@
    * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
    */
   public class DefaultTskDeployer
  -    extends AbstractDeployer
  +    extends AbstractZipDeployer
       implements Composer, TskDeployer
   {
  -    protected final static String   TASKDEF_FILE     = "TASK-LIB/taskdefs.properties";
  -    protected final static String   CONVERTER_FILE   = "TASK-LIB/converters.properties";
  +    protected final static String   TSKDEF_FILE     = "TASK-LIB/taskdefs.xml";
   
  -    protected TaskletRegistry       m_taskletRegistry;
  -    protected ConverterRegistry     m_converterRegistry;
  +    protected LocatorRegistry       m_taskletRegistry;
  +    protected LocatorRegistry       m_converterRegistry;
  +    protected ConverterRegistry     m_converterInfoRegistry;
   
       /**
        * Default constructor.
        */
       public DefaultTskDeployer()
       {
  +        super( false );
           m_autoUndeploy = true;
           m_type = "Tasklet";
       }
  @@ -67,12 +72,13 @@
           final ConverterEngine converterEngine = (ConverterEngine)componentManager.
               lookup( "org.apache.ant.convert.ConverterEngine" );
   
  -        m_converterRegistry = converterEngine.getConverterRegistry();
  +        m_converterInfoRegistry = converterEngine.getConverterRegistry();
  +        m_converterRegistry = converterEngine.getLocatorRegistry();
   
           final TaskletEngine taskletEngine = (TaskletEngine)componentManager.
               lookup( "org.apache.ant.tasklet.engine.TaskletEngine" );
   
  -        m_taskletRegistry = taskletEngine.getTaskletRegistry();
  +        m_taskletRegistry = taskletEngine.getLocatorRegistry();
       }
   
       public void setLogger( final Logger logger )
  @@ -80,50 +86,30 @@
           m_logger = logger;
       }
   
  -    protected boolean isValidLocation( final String location )
  -    {
  -        //TODO: Make sure it is valid JavaIdentifier 
  -        //that optionally has '-' embedded in it
  -        return true;
  -    }
  -    
  -    /**
  -     * Deploy Tasklets from a .tsk file.
  -     * Eventually this should be cached for performance reasons.
  -     *
  -     * @param location the location 
  -     * @param file the file
  -     * @exception DeploymentException if an error occurs
  -     */
  -    protected void deployFromFile( final String location, final File file )
  +    protected void loadResources( final ZipFile zipFile, final String location, final URL url )
           throws DeploymentException
       {
  -        m_logger.info( "Deploying .tsk file (" + file + ") as " + location );
  +        final Configuration taskdefs = loadConfiguration( zipFile, TSKDEF_FILE );
   
  -        final ZipFile zipFile = getZipFileFor( file );
  -
           try
           {
  -            final Properties taskdefs = loadProperties( zipFile, TASKDEF_FILE );
  -            final Properties converters = loadProperties( zipFile, CONVERTER_FILE );
  -
  -            try { zipFile.close(); }
  -            catch( final IOException ioe ) {}
  -
  -            URL url = null;
  -
  -            try { url = file.toURL(); }
  -            catch( final MalformedURLException mue ) {}
  -
  -            handleTasklets( taskdefs, url );
  -            handleConverters( converters, url );
  +            final Iterator tasks = taskdefs.getChildren( "task" );
  +            while( tasks.hasNext() )
  +            {
  +                final Configuration task = (Configuration)tasks.next();
  +                handleTasklet( task, url );
  +            }
  +            
  +            final Iterator converters = taskdefs.getChildren( "converter" );
  +            while( converters.hasNext() )
  +            {
  +                final Configuration converter = (Configuration)converters.next();
  +                handleConverter( converter, url );
  +            }
           }
  -        catch( final DeploymentException de )
  +        catch( final ConfigurationException ce )
           {
  -            try { zipFile.close(); }
  -            catch( final IOException ioe ) {}
  -
  -            throw de;
  +            throw new DeploymentException( "Malformed taskdefs.xml", ce );
           }
       }
       
  @@ -132,15 +118,25 @@
       {
           checkDeployment( location, url );
           final ZipFile zipFile = getZipFileFor( url );
  -        final Properties converters = loadProperties( zipFile, CONVERTER_FILE );
  -        final String value = converters.getProperty( name );
  -
  -        if( null == value )
  +        final Configuration taskdefs = loadConfiguration( zipFile, TSKDEF_FILE );
  +        
  +        try
           {
  -            throw new DeploymentException( "Unable to locate converter named " + name );
  +            final Iterator converters = taskdefs.getChildren( "converter" );
  +            while( converters.hasNext() )
  +            {
  +                final Configuration converter = (Configuration)converters.next();
  +                if( converter.getAttribute( "classname" ).equals( name ) )
  +                {
  +                    handleConverter( converter, url );
  +                    break;
  +                }
  +            }
           }
  -            
  -        handleConverter( name, value, url );
  +        catch( final ConfigurationException ce )
  +        {
  +            throw new DeploymentException( "Malformed taskdefs.xml", ce );
  +        }
       }
       
       public void deployTasklet( final String name, final String location, final URL url )
  @@ -148,109 +144,65 @@
       {
           checkDeployment( location, url );
           final ZipFile zipFile = getZipFileFor( url );
  -        final Properties tasklets = loadProperties( zipFile, TASKDEF_FILE );
  -        final String value = tasklets.getProperty( name );
  +        final Configuration taskdefs = loadConfiguration( zipFile, TSKDEF_FILE );
           
  -        if( null == value )
  +        try
           {
  -            throw new DeploymentException( "Unable to locate tasklet named " + name );
  +            final Iterator tasks = taskdefs.getChildren( "task" );
  +            while( tasks.hasNext() )
  +            {
  +                final Configuration task = (Configuration)tasks.next();
  +                if( task.getAttribute( "name" ).equals( name ) )
  +                {
  +                    handleTasklet( task, url );
  +                    break;
  +                }
  +            }
           }
  -        
  -        handleTasklet( name, value, url );
  -    }
  -
  -    protected ZipFile getZipFileFor( final URL url )
  -        throws DeploymentException
  -    {
  -        final File file = getFileFor( url );
  -        return getZipFileFor( file );
  -    }
  -
  -    protected ZipFile getZipFileFor( final File file )
  -        throws DeploymentException
  -    {
  -        try { return new ZipFile( file ); }
  -        catch( final IOException ioe )
  +        catch( final ConfigurationException ce )
           {
  -            throw new DeploymentException( "Error opening " + file + 
  -                                           " due to " + ioe.getMessage(),
  -                                           ioe );
  -        }        
  +            throw new DeploymentException( "Malformed taskdefs.xml", ce );
  +        }
       }
       
  -    /**
  -     * Create and register Infos for all converters stored in deployment.
  -     *
  -     * @param properties the properties
  -     * @param url the url of deployment
  -     * @exception DeploymentException if an error occurs
  -     */
  -    protected void handleConverters( final Properties properties, final URL url )
  -        throws DeploymentException
  +    protected void handleConverter( final Configuration converter, final URL url )
  +        throws DeploymentException, ConfigurationException
       {
  -        final Enumeration enum = properties.propertyNames();
  +        final String name = converter.getAttribute( "classname" );
  +        final String source = converter.getAttribute( "source" );
  +        final String destination = converter.getAttribute( "destination" );
           
  -        while( enum.hasMoreElements() )
  +        final DefaultConverterInfo info = new DefaultConverterInfo( source, destination );
  +       
  +        try { m_converterInfoRegistry.register( name, info ); }
  +        catch( final RegistryException re )
           {
  -            final String key = (String)enum.nextElement();
  -            final String value = (String)properties.get( key );
  -
  -            handleConverter( key, value, url );
  +            throw new DeploymentException( "Error registering converter info " + 
  +                                           name + " due to " + re,
  +                                           re );
           }
  -    }   
   
  -    protected void handleConverter( final String name, final String param, final URL url )
  -        throws DeploymentException
  -    {
  -        final int index = param.indexOf( ',' );
  -        
  -        if( -1 == index )
  -        {
  -            throw new DeploymentException( "Malformed converter definition (" + name + ")" );
  -        }
  -        
  -        final String source = param.substring( 0, index ).trim();
  -        final String destination = param.substring( index + 1 ).trim();
  -        
  -        final DefaultConverterInfo info = 
  -            new DefaultConverterInfo( source, destination, name, url );
  -        
  -        try { m_converterRegistry.register( name, info ); }
  +        final DefaultLocator locator = new DefaultLocator( name, url );
  +
  +        try { m_converterRegistry.register( name, locator ); }
           catch( final RegistryException re )
           {
  -            throw new DeploymentException( "Error registering converter " + 
  +            throw new DeploymentException( "Error registering converter locator " + 
                                              name + " due to " + re,
                                              re );
           }
  -        
  +
           m_logger.debug( "Registered converter " + name + " that converts from " + 
                           source + " to " + destination );
       }
       
  -    /**
  -     * Create and register Infos for all tasklets stored in deployment.
  -     *
  -     * @param properties the properties
  -     * @param url the url of deployment
  -     * @exception DeploymentException if an error occurs
  -     */     
  -    protected void handleTasklets( final Properties properties, final URL url )
  -        throws DeploymentException
  +    protected void handleTasklet( final Configuration task, final URL url )
  +        throws DeploymentException, ConfigurationException
       {
  -        final Enumeration enum = properties.propertyNames();
  -        
  -        while( enum.hasMoreElements() )
  -        {
  -            final String key = (String)enum.nextElement();
  -            final String value = (String)properties.get( key );
  -            handleTasklet( key, value, url );
  -        }
  -    }
  +        final String name = task.getAttribute( "name" );
  +        final String classname = task.getAttribute( "classname" );
   
  -    protected void handleTasklet( final String name, final String classname, final URL url )
  -        throws DeploymentException
  -    {
  -        final DefaultTaskletInfo info = new DefaultTaskletInfo( classname, url );
  +        final DefaultLocator info = new DefaultLocator( classname, url );
           
           try { m_taskletRegistry.register( name, info ); }
           catch( final RegistryException re )
  @@ -260,50 +212,5 @@
           }
           
           m_logger.debug( "Registered tasklet " + name + " as " + classname );
  -    }
  -
  -    /**
  -     * Utility method to load properties from zip.
  -     *
  -     * @param zipFile the zip file
  -     * @param filename the property filename
  -     * @return the Properties
  -     * @exception DeploymentException if an error occurs
  -     */
  -    protected Properties loadProperties( final ZipFile zipFile, final String filename )
  -        throws DeploymentException
  -    {
  -        final ZipEntry entry = zipFile.getEntry( filename );
  -        if( null == entry )
  -        {
  -            throw new DeploymentException( "Unable to locate " + filename + 
  -                                           " in " + zipFile.getName() );
  -        }
  -        
  -        Properties properties = new Properties();
  -        
  -        try
  -        {
  -            properties.load( zipFile.getInputStream( entry ) );
  -        }
  -        catch( final IOException ioe )
  -        {
  -            throw new DeploymentException( "Error reading " + filename + 
  -                                           " from " + zipFile.getName(),
  -                                           ioe );
  -        }
  -
  -        return properties;
  -    }
  -    
  -    protected boolean canUndeploy( final Component component )
  -        throws DeploymentException
  -    {
  -        return true;
  -    }
  -    
  -    protected void shutdownDeployment( final Component component )
  -        throws DeploymentException
  -    {
       }
   }
  
  
  
  1.2       +5 -5      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TaskletConverterEngine.java
  
  Index: TaskletConverterEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TaskletConverterEngine.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TaskletConverterEngine.java	2000/12/06 06:11:26	1.1
  +++ TaskletConverterEngine.java	2000/12/11 00:33:41	1.2
  @@ -7,8 +7,8 @@
    */
   package org.apache.ant.tasklet.engine;
   
  -import org.apache.ant.convert.ConverterFactory;
   import org.apache.ant.convert.DefaultConverterEngine;
  +import org.apache.avalon.camelot.DefaultFactory;
   
   public class TaskletConverterEngine
       extends DefaultConverterEngine
  @@ -17,13 +17,13 @@
        * Set the ConverterFactory.
        * Package access intended.
        */
  -    void setConverterFactory( final ConverterFactory converterFactory )
  +    void setFactory( final DefaultFactory factory )
       {
  -        m_converterFactory = converterFactory;
  +        m_factory = factory;
       }
   
  -    protected ConverterFactory createConverterFactory()
  +    protected DefaultFactory createFactory()
       {
  -        return m_converterFactory;
  +        return m_factory;
       }
   }
  
  
  
  1.5       +6 -6      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TaskletEngine.java
  
  Index: TaskletEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TaskletEngine.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TaskletEngine.java	2000/12/06 06:11:26	1.4
  +++ TaskletEngine.java	2000/12/11 00:33:41	1.5
  @@ -12,7 +12,9 @@
   import org.apache.ant.convert.ConverterEngine;
   import org.apache.ant.tasklet.TaskletContext;
   import org.apache.avalon.Component;
  +import org.apache.avalon.Loggable;
   import org.apache.avalon.ComponentManager;
  +import org.apache.avalon.camelot.LocatorRegistry;
   import org.apache.log.Logger;
    
   /**
  @@ -21,10 +23,8 @@
    * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
    */
   public interface TaskletEngine
  -    extends Component
  +    extends Component, Loggable
   {
  -    void setLogger( Logger logger );
  -
       /**
        * Retrieve deployer for engine.
        *
  @@ -33,11 +33,11 @@
       TskDeployer getTskDeployer();
       
       /**
  -     * Retrieve tasklet registry associated with engine.
  +     * Retrieve locator registry associated with engine.
        *
  -     * @return the TaskletRegistry
  +     * @return the LocatorRegistry
        */
  -    TaskletRegistry getTaskletRegistry();
  +    LocatorRegistry getLocatorRegistry();
   
       /**
        * Retrieve converter engine.
  
  
  
  1.4       +3 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TskDeployer.java
  
  Index: TskDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasklet/engine/TskDeployer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TskDeployer.java	2000/12/06 06:11:26	1.3
  +++ TskDeployer.java	2000/12/11 00:33:41	1.4
  @@ -8,6 +8,7 @@
   package org.apache.ant.tasklet.engine;
   
   import java.net.URL;
  +import org.apache.avalon.Loggable;
   import org.apache.avalon.camelot.Deployer;
   import org.apache.avalon.camelot.DeploymentException;
   import org.apache.log.Logger;
  @@ -18,13 +19,12 @@
    * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
    */
   public interface TskDeployer
  -    extends Deployer
  +    extends Deployer, Loggable
   {
  -    void setLogger( Logger logger );
  -
       void deployConverter( String name, String location, URL url )
           throws DeploymentException;
       
       void deployTasklet( String name, String location, URL url )
           throws DeploymentException;
   }
  +
  
  
  
  1.2       +0 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/AbstractResourceRegisterer.java
  
  Index: AbstractResourceRegisterer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/AbstractResourceRegisterer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractResourceRegisterer.java	2000/12/06 06:11:27	1.1
  +++ AbstractResourceRegisterer.java	2000/12/11 00:33:42	1.2
  @@ -12,7 +12,6 @@
   import java.net.URL;
   import org.apache.ant.AntException;
   import org.apache.ant.tasklet.AbstractTasklet;
  -import org.apache.ant.tasklet.engine.DefaultTaskletInfo;
   import org.apache.ant.tasklet.engine.TaskletEngine;
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.ComponentNotAccessibleException;
  
  
  
  1.2       +6 -2      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterConverter.java
  
  Index: RegisterConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RegisterConverter.java	2000/12/06 06:11:27	1.1
  +++ RegisterConverter.java	2000/12/11 00:33:43	1.2
  @@ -11,8 +11,9 @@
   import java.net.URL;
   import java.net.MalformedURLException;
   import org.apache.ant.AntException;
  -import org.apache.ant.convert.DefaultConverterInfo;
  +import org.apache.avalon.camelot.DefaultLocator;
   import org.apache.ant.convert.ConverterEngine;
  +import org.apache.ant.convert.DefaultConverterInfo;
   import org.apache.ant.tasklet.AbstractTasklet;
   import org.apache.ant.tasklet.engine.TaskletEngine;
   import org.apache.avalon.ComponentManager;
  @@ -106,12 +107,15 @@
           else
           {
               final DefaultConverterInfo info = 
  -                new DefaultConverterInfo( m_sourceType, m_destinationType, m_classname, url );
  +                new DefaultConverterInfo( m_sourceType, m_destinationType );
  +            final DefaultLocator locator = new DefaultLocator( m_classname, url );
   
               try
               {
                   m_engine.getConverterEngine().
                       getConverterRegistry().register( m_classname, info ); 
  +                m_engine.getConverterEngine().
  +                    getLocatorRegistry().register( m_classname, locator ); 
               }
               catch( final RegistryException re )
               {
  
  
  
  1.4       +3 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterTasklet.java
  
  Index: RegisterTasklet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterTasklet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RegisterTasklet.java	2000/12/06 06:11:27	1.3
  +++ RegisterTasklet.java	2000/12/11 00:33:43	1.4
  @@ -9,7 +9,7 @@
   
   import java.net.URL;
   import org.apache.ant.AntException;
  -import org.apache.ant.tasklet.engine.DefaultTaskletInfo;
  +import org.apache.avalon.camelot.DefaultLocator;
   import org.apache.avalon.camelot.DeploymentException;
   import org.apache.avalon.camelot.RegistryException;
   
  @@ -36,8 +36,8 @@
           }
           else
           {
  -            final DefaultTaskletInfo info = new DefaultTaskletInfo( classname, url );
  -            m_engine.getTaskletRegistry().register( name, info ); 
  +            final DefaultLocator locator = new DefaultLocator( classname, url );
  +            m_engine.getLocatorRegistry().register( name, locator ); 
           }
       }
   }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/manifest/taskdefs.xml
  
  Index: taskdefs.xml
  ===================================================================
  <tasklib>
    <task name="echo" classname="org.apache.ant.tasks.core.Echo" />
    <task name="prim-test" classname="org.apache.ant.tasks.core.PrimitiveTypesTest" />
    <task name="sub-elements-test" classname="org.apache.ant.tasks.core.SubElementTest" />
    <task name="conf-test" classname="org.apache.ant.tasks.core.ConfigurationTest" />
    <task name="content-test" classname="org.apache.ant.tasks.core.ContentTest" />
    <task name="property" classname="org.apache.ant.tasks.core.Property" />
    <task name="register-tasklet" classname="org.apache.ant.tasks.core.RegisterTasklet" />
    <task name="register-converter" classname="org.apache.ant.tasks.core.RegisterConverter" />
    <task name="ant-call" classname="org.apache.ant.tasks.core.AntCall" />
  
    <converter classname="org.apache.ant.convert.core.StringToLongConverter" 
               source="java.lang.String" 
               destination="java.lang.Long" />
    <converter classname="org.apache.ant.convert.core.StringToIntegerConverter" 
               source="java.lang.String" 
               destination="java.lang.Integer" />
    <converter classname="org.apache.ant.convert.core.StringToShortConverter" 
               source="java.lang.String" 
               destination="java.lang.Short" />
    <converter classname="org.apache.ant.convert.core.StringToByteConverter" 
               source="java.lang.String" 
               destination="java.lang.Byte" />
    <converter classname="org.apache.ant.convert.core.StringToDoubleConverter" 
               source="java.lang.String" 
               destination="java.lang.Double" />
    <converter classname="org.apache.ant.convert.core.StringToFloatConverter" 
               source="java.lang.String" 
               destination="java.lang.Float" />
    <converter classname="org.apache.ant.convert.core.StringToClassConverter" 
               source="java.lang.String" 
               destination="java.lang.Class" />
    <converter classname="org.apache.ant.convert.core.StringToURLConverter" 
               source="java.lang.String" 
               destination="java.net.URL" />
  </tasklib>
  
  

Mime
View raw message