ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework ItemSet.java Mapper.java
Date Sat, 02 Jun 2001 14:28:43 GMT
donaldp     01/06/02 07:28:43

  Modified:    proposal/myrmidon/src/java/org/apache/ant/modules/basic
                        Pattern.java Property.java
                        StringToByteConverter.java
                        StringToClassConverter.java
                        StringToDoubleConverter.java
                        StringToFileConverter.java
                        StringToFloatConverter.java
                        StringToIntegerConverter.java
                        StringToLongConverter.java
                        StringToShortConverter.java
                        StringToURLConverter.java
               proposal/myrmidon/src/java/org/apache/ant/modules/core
                        RegisterConverter.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer
                        DefaultConfigurer.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer
                        DefaultTskDeployer.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor
                        MyrmidonEmbeddor.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/executor
                        DefaultExecutor.java
               proposal/myrmidon/src/java/org/apache/myrmidon/framework
                        ItemSet.java Mapper.java
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/api
                        DataType.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/converter
                        ConverterInfo.java ConverterRegistry.java
                        DefaultConverterRegistry.java
                        DefaultMasterConverter.java MasterConverter.java
               proposal/myrmidon/src/java/org/apache/myrmidon/converter
                        AbstractConverter.java Converter.java
                        ConverterException.java
  Removed:     proposal/myrmidon/src/java/org/apache/ant/convert
                        AbstractConverter.java Converter.java
                        ConverterException.java
               proposal/myrmidon/src/java/org/apache/ant/convert/engine
                        ConverterEngine.java ConverterInfo.java
                        ConverterRegistry.java DefaultConverterEngine.java
                        DefaultConverterInfo.java
                        DefaultConverterRegistry.java
               proposal/myrmidon/src/java/org/apache/ant/tasklet
                        DataType.java
  Log:
  Reworked Converter component. Made it work with TypeManager + an auxilliary Registry.
  
  Moved client interface of converter code to converter subpackage. Moved "provider" part of converter package to components.converter.*
  
  Cleaned up violations of IOC with ConverterEngine and renamed ConverterEngine to MasterConverter
  
  Revision  Changes    Path
  1.5       +1 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/Pattern.java
  
  Index: Pattern.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/Pattern.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Pattern.java	2001/06/02 08:46:11	1.4
  +++ Pattern.java	2001/06/02 14:28:40	1.5
  @@ -7,7 +7,7 @@
    */
   package org.apache.ant.modules.basic;
   
  -import org.apache.ant.tasklet.DataType;
  +import org.apache.myrmidon.api.DataType;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.components.model.Condition;
   
  
  
  
  1.11      +12 -14    jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/Property.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Property.java	2001/06/02 08:26:52	1.10
  +++ Property.java	2001/06/02 14:28:40	1.11
  @@ -7,10 +7,6 @@
    */
   package org.apache.ant.modules.basic;
   
  -import java.util.Iterator;
  -import org.apache.myrmidon.api.TaskException;
  -import org.apache.ant.convert.Converter;
  -import org.apache.ant.tasklet.DataType;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.ComponentSelector;
  @@ -20,8 +16,11 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.context.Resolvable;
   import org.apache.myrmidon.api.AbstractTask;
  +import org.apache.myrmidon.api.DataType;
   import org.apache.myrmidon.api.TaskContext;
  +import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.components.configurer.Configurer;
  +import org.apache.myrmidon.components.converter.MasterConverter;
   import org.apache.myrmidon.components.type.TypeManager;
   
   /**
  @@ -33,22 +32,21 @@
       extends AbstractTask
       implements Configurable, Composable
   {
  -    protected String              m_name;
  -    protected Object              m_value;
  -    protected boolean             m_localScope     = true;
  -    protected ComponentSelector   m_selector;
  -    protected Converter           m_converter;
  -    protected Configurer          m_configurer;
  +    private String              m_name;
  +    private Object              m_value;
  +    private boolean             m_localScope     = true;
  +    private ComponentSelector   m_selector;
  +    private MasterConverter     m_converter;
  +    private Configurer          m_configurer;
   
       public void compose( final ComponentManager componentManager )
           throws ComponentException
       {
           m_configurer = (Configurer)componentManager.lookup( Configurer.ROLE );
           final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE );
  -        m_selector = 
  -            (ComponentSelector)typeManager.lookup( "org.apache.ant.tasklet.DataTypeSelector" );
  +        m_selector = (ComponentSelector)typeManager.lookup( DataType.ROLE + "Selector" );
   
  -        m_converter = (Converter)componentManager.lookup( "org.apache.ant.convert.Converter" );
  +        m_converter = (MasterConverter)componentManager.lookup( MasterConverter.ROLE );
       }
   
       public void configure( final Configuration configuration )
  @@ -60,8 +58,8 @@
           {
               final String name = attributes[ i ];
               final String value = configuration.getAttribute( name );
  +
   
  -            
               Object object = null;
   
               try { object = getContext().resolveValue( value ); }
  
  
  
  1.3       +9 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToByteConverter.java
  
  Index: StringToByteConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToByteConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringToByteConverter.java	2001/05/28 06:28:08	1.2
  +++ StringToByteConverter.java	2001/06/02 14:28:40	1.3
  @@ -7,7 +7,8 @@
    */
   package org.apache.ant.modules.basic;
   
  -import org.apache.ant.convert.AbstractConverter;
  +import org.apache.myrmidon.converter.AbstractConverter;
  +import org.apache.myrmidon.converter.ConverterException;
   import org.apache.avalon.framework.context.Context;
   
   /**
  @@ -24,9 +25,14 @@
       }
   
       public Object convert( final Object original, final Context context )
  -        throws Exception
  +        throws ConverterException
       {
  -        return new Byte( (String)original );
  +        try { return new Byte( (String)original ); }
  +        catch( final NumberFormatException nfe )
  +        {
  +            throw new ConverterException( "Error formatting object", nfe );
  +        }
  +
       }
   }
   
  
  
  
  1.3       +9 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToClassConverter.java
  
  Index: StringToClassConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToClassConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringToClassConverter.java	2001/05/28 06:28:08	1.2
  +++ StringToClassConverter.java	2001/06/02 14:28:40	1.3
  @@ -7,7 +7,8 @@
    */
   package org.apache.ant.modules.basic;
   
  -import org.apache.ant.convert.AbstractConverter;
  +import org.apache.myrmidon.converter.AbstractConverter;
  +import org.apache.myrmidon.converter.ConverterException;
   import org.apache.avalon.framework.context.Context;
   
   /**
  @@ -24,9 +25,14 @@
       }
   
       public Object convert( final Object original, final Context context )
  -        throws Exception
  +        throws ConverterException
       {
  -        return Class.forName( (String)original );
  +        //TODO: Should we use ContextClassLoader here???
  +        try { return Class.forName( (String)original ); }
  +        catch( final Exception e )
  +        {
  +            throw new ConverterException( "Error converting to class type", e );
  +        }
       }
   }
   
  
  
  
  1.3       +8 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToDoubleConverter.java
  
  Index: StringToDoubleConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToDoubleConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringToDoubleConverter.java	2001/05/28 06:28:08	1.2
  +++ StringToDoubleConverter.java	2001/06/02 14:28:40	1.3
  @@ -7,8 +7,9 @@
    */
   package org.apache.ant.modules.basic;
   
  -import org.apache.ant.convert.AbstractConverter;
   import org.apache.avalon.framework.context.Context;
  +import org.apache.myrmidon.converter.AbstractConverter;
  +import org.apache.myrmidon.converter.ConverterException;
   
   /**
    * String to double converter
  @@ -24,9 +25,13 @@
       }
   
       public Object convert( final Object original, final Context context )
  -        throws Exception
  +        throws ConverterException
       {
  -        return new Double( (String)original );
  +        try { return new Double( (String)original ); }
  +        catch( final NumberFormatException nfe )
  +        {
  +            throw new ConverterException( "Error formatting object", nfe );
  +        }
       }
   }
   
  
  
  
  1.4       +13 -4     jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToFileConverter.java
  
  Index: StringToFileConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToFileConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StringToFileConverter.java	2001/05/28 07:36:42	1.3
  +++ StringToFileConverter.java	2001/06/02 14:28:41	1.4
  @@ -8,9 +8,11 @@
   package org.apache.ant.modules.basic;
   
   import java.io.File;
  -import org.apache.ant.convert.AbstractConverter;
   import org.apache.avalon.framework.context.Context;
   import org.apache.myrmidon.api.TaskContext;
  +import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.converter.AbstractConverter;
  +import org.apache.myrmidon.converter.ConverterException;
   
   /**
    * String to file converter
  @@ -26,10 +28,17 @@
       }
   
       public Object convert( final Object original, final Context context )
  -        throws Exception
  +        throws ConverterException
       {
  -        final TaskContext taskContext = (TaskContext)context;
  -        return taskContext.resolveFile( (String)original );
  +        try
  +        {
  +            final TaskContext taskContext = (TaskContext)context;
  +            return taskContext.resolveFile( (String)original );
  +        }
  +        catch( final TaskException te )
  +        {
  +            throw new ConverterException( "Error resolving file during conversion", te );
  +        }
       }
   }
   
  
  
  
  1.3       +8 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToFloatConverter.java
  
  Index: StringToFloatConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToFloatConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringToFloatConverter.java	2001/05/28 06:28:09	1.2
  +++ StringToFloatConverter.java	2001/06/02 14:28:41	1.3
  @@ -7,7 +7,8 @@
    */
   package org.apache.ant.modules.basic;
   
  -import org.apache.ant.convert.AbstractConverter;
  +import org.apache.myrmidon.converter.AbstractConverter;
  +import org.apache.myrmidon.converter.ConverterException;
   import org.apache.avalon.framework.context.Context;
   
   /**
  @@ -24,9 +25,13 @@
       }
   
       public Object convert( final Object original, final Context context )
  -        throws Exception
  +        throws ConverterException
       {
  -        return new Float( (String)original );
  +        try { return new Float( (String)original ); }
  +        catch( final NumberFormatException nfe )
  +        {
  +            throw new ConverterException( "Error formatting object", nfe );
  +        }
       }
   }
   
  
  
  
  1.3       +8 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToIntegerConverter.java
  
  Index: StringToIntegerConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToIntegerConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringToIntegerConverter.java	2001/05/28 06:28:09	1.2
  +++ StringToIntegerConverter.java	2001/06/02 14:28:41	1.3
  @@ -7,7 +7,8 @@
    */
   package org.apache.ant.modules.basic;
   
  -import org.apache.ant.convert.AbstractConverter;
  +import org.apache.myrmidon.converter.AbstractConverter;
  +import org.apache.myrmidon.converter.ConverterException;
   import org.apache.avalon.framework.context.Context;
   
   /**
  @@ -24,9 +25,13 @@
       }
   
       public Object convert( final Object original, final Context context )
  -        throws Exception
  +        throws ConverterException
       {
  -        return new Integer( (String)original );
  +        try { return new Integer( (String)original ); }
  +        catch( final NumberFormatException nfe )
  +        {
  +            throw new ConverterException( "Error formatting object", nfe );
  +        }
       }
   }
   
  
  
  
  1.3       +8 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToLongConverter.java
  
  Index: StringToLongConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToLongConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringToLongConverter.java	2001/05/28 06:28:09	1.2
  +++ StringToLongConverter.java	2001/06/02 14:28:41	1.3
  @@ -7,8 +7,9 @@
    */
   package org.apache.ant.modules.basic;
   
  -import org.apache.ant.convert.AbstractConverter;
   import org.apache.avalon.framework.context.Context;
  +import org.apache.myrmidon.converter.AbstractConverter;
  +import org.apache.myrmidon.converter.ConverterException;
   
   /**
    * String to long converter
  @@ -24,9 +25,13 @@
       }
   
       public Object convert( final Object original, final Context context )
  -        throws Exception
  +        throws ConverterException
       {
  -        return new Long( (String)original );
  +        try { return new Long( (String)original ); }
  +        catch( final NumberFormatException nfe )
  +        {
  +            throw new ConverterException( "Error formatting object", nfe );
  +        }
       }
   }
   
  
  
  
  1.3       +9 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToShortConverter.java
  
  Index: StringToShortConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToShortConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringToShortConverter.java	2001/05/28 06:28:09	1.2
  +++ StringToShortConverter.java	2001/06/02 14:28:41	1.3
  @@ -7,8 +7,9 @@
    */
   package org.apache.ant.modules.basic;
   
  -import org.apache.ant.convert.AbstractConverter;
   import org.apache.avalon.framework.context.Context;
  +import org.apache.myrmidon.converter.AbstractConverter;
  +import org.apache.myrmidon.converter.ConverterException;
   
   /**
    * String to short converter
  @@ -24,9 +25,14 @@
       }
   
       public Object convert( final Object original, final Context context )
  -        throws Exception
  +        throws ConverterException
       {
  -        return new Short( (String)original );
  +        try { return new Short( (String)original ); }
  +        catch( final NumberFormatException nfe )
  +        {
  +            throw new ConverterException( "Error formatting object", nfe );
  +        }
  +
       }
   }
   
  
  
  
  1.3       +10 -3     jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToURLConverter.java
  
  Index: StringToURLConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/StringToURLConverter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringToURLConverter.java	2001/05/28 06:28:09	1.2
  +++ StringToURLConverter.java	2001/06/02 14:28:41	1.3
  @@ -7,9 +7,11 @@
    */
   package org.apache.ant.modules.basic;
   
  +import java.net.MalformedURLException;
   import java.net.URL;
  -import org.apache.ant.convert.AbstractConverter;
   import org.apache.avalon.framework.context.Context;
  +import org.apache.myrmidon.converter.AbstractConverter;
  +import org.apache.myrmidon.converter.ConverterException;
   
   /**
    * String to url converter
  @@ -25,9 +27,14 @@
       }
   
       public Object convert( final Object original, final Context context )
  -        throws Exception
  +        throws ConverterException
       {
  -        return new URL( (String)original );
  +        try { return new URL( (String)original ); }
  +        catch( final MalformedURLException mue )
  +        {
  +            throw new ConverterException( "Error formatting object", mue );
  +        }
  +
       }
   }
   
  
  
  
  1.10      +42 -41    jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterConverter.java
  
  Index: RegisterConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/core/RegisterConverter.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RegisterConverter.java	2001/05/31 17:19:45	1.9
  +++ RegisterConverter.java	2001/06/02 14:28:41	1.10
  @@ -10,48 +10,50 @@
   import java.io.File;
   import java.net.MalformedURLException;
   import java.net.URL;
  -import org.apache.myrmidon.api.TaskException;
  -import org.apache.ant.convert.engine.ConverterEngine;
  -import org.apache.ant.convert.engine.DefaultConverterInfo;
  -import org.apache.myrmidon.api.AbstractTask;
  -import org.apache.myrmidon.components.deployer.TskDeployer;
  -import org.apache.avalon.framework.component.ComponentManager;
  +import org.apache.avalon.framework.camelot.DeploymentException;
   import org.apache.avalon.framework.component.ComponentException;
  +import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
  -import org.apache.avalon.framework.camelot.DefaultLocator;
  -import org.apache.avalon.framework.camelot.DeploymentException;
  -import org.apache.avalon.framework.camelot.RegistryException;
  +import org.apache.myrmidon.api.AbstractTask;
  +import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.components.converter.ConverterInfo;
  +import org.apache.myrmidon.components.converter.ConverterRegistry;
  +import org.apache.myrmidon.components.deployer.TskDeployer;
  +import org.apache.myrmidon.components.type.DefaultComponentFactory;
  +import org.apache.myrmidon.components.type.TypeManager;
  +import org.apache.myrmidon.converter.Converter;
   
   /**
    * Method to register a single converter.
    *
    * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
    */
  -public class RegisterConverter 
  +public class RegisterConverter
       extends AbstractTask
       implements Composable
   {
  -    protected String              m_sourceType;
  -    protected String              m_destinationType;
  -    protected String              m_lib;
  -    protected String              m_classname;
  -    protected TskDeployer         m_tskDeployer;
  -    protected ConverterEngine     m_converterEngine;
  +    private String              m_sourceType;
  +    private String              m_destinationType;
  +    private String              m_lib;
  +    private String              m_classname;
  +    private TskDeployer         m_tskDeployer;
  +    private ConverterRegistry   m_converterRegistry;
  +    private TypeManager         m_typeManager;
   
       public void compose( final ComponentManager componentManager )
           throws ComponentException
       {
           m_tskDeployer = (TskDeployer)componentManager.lookup( TskDeployer.ROLE );
   
  -        m_converterEngine = (ConverterEngine)componentManager.
  -            lookup( "org.apache.ant.convert.engine.ConverterEngine" );
  +        m_converterRegistry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE );
  +        m_typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE );
       }
   
       public void setLib( final String lib )
       {
           m_lib = lib;
       }
  -    
  +
       public void setClassname( final String classname )
       {
           m_classname = classname;
  @@ -61,12 +63,12 @@
       {
           m_sourceType = sourceType;
       }
  -    
  +
       public void setDestinationType( final String destinationType )
       {
           m_destinationType = destinationType;
       }
  -    
  +
       public void execute()
           throws TaskException
       {
  @@ -74,11 +76,11 @@
           {
               throw new TaskException( "Must specify classname parameter" );
           }
  -        
  +
           final URL url = getURL( m_lib );
   
           boolean isFullyDefined = true;
  -        
  +
           if( null == m_sourceType && null == m_destinationType )
           {
               isFullyDefined = false;
  @@ -86,7 +88,7 @@
           else if( null == m_sourceType || null == m_destinationType )
           {
               throw new TaskException( "Must specify the source-type and destination-type " +
  -                                    "parameters when supplying a name" );
  +                                     "parameters when supplying a name" );
           }
   
           if( !isFullyDefined && null == url )
  @@ -96,35 +98,34 @@
   
           if( !isFullyDefined )
           {
  -            try 
  -            { 
  -                m_tskDeployer.deployConverter( m_classname, url.toString(), url ); 
  +            try
  +            {
  +                m_tskDeployer.deployConverter( m_classname, url.toString(), url );
               }
               catch( final DeploymentException de )
               {
  -                throw new TaskException( "Failed deploying " + m_classname + 
  -                                        " from " + url, de );
  +                throw new TaskException( "Failed deploying " + m_classname +
  +                                         " from " + url, de );
               }
           }
           else
           {
  -            final DefaultConverterInfo info = 
  -                new DefaultConverterInfo( m_sourceType, m_destinationType );
  -            final DefaultLocator locator = new DefaultLocator( m_classname, url );
  +            final ConverterInfo info = new ConverterInfo( m_sourceType, m_destinationType );
  +            m_converterRegistry.registerConverterInfo( m_classname, info );
   
  -            try
  -            {
  -                m_converterEngine.getInfoRegistry().register( m_classname, info ); 
  -                m_converterEngine.getRegistry().register( m_classname, locator ); 
  -            }
  -            catch( final RegistryException re )
  +            final DefaultComponentFactory factory =
  +                new DefaultComponentFactory( new URL[] { url } );
  +
  +            factory.addNameClassMapping( m_classname, m_classname );
  +            try { m_typeManager.registerType( Converter.ROLE, m_classname, factory ); }
  +            catch( final Exception e )
               {
  -                throw new TaskException( "Error registering resource", re );
  +                throw new TaskException( "Failed to register converter " + m_classname, e );
               }
           }
       }
  -    
  -    protected URL getURL( final String libName )
  +
  +    private URL getURL( final String libName )
           throws TaskException
       {
           if( null != libName )
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/DataType.java
  
  Index: DataType.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.myrmidon.api;
  
  import org.apache.avalon.framework.component.Component;
  
  /**
   * Base class for those classes that can appear inside the build file
   * as stand alone data types.  
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public interface DataType
      extends Component
  {
      String ROLE = "org.apache.myrmidon.api.DataType";
  }
  
  
  
  1.3       +5 -4      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultConfigurer.java	2001/05/28 09:06:51	1.2
  +++ DefaultConfigurer.java	2001/06/02 14:28:42	1.3
  @@ -11,8 +11,6 @@
   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.excalibur.property.PropertyException;
   import org.apache.avalon.excalibur.property.PropertyUtil;
   import org.apache.avalon.framework.component.ComponentException;
  @@ -25,6 +23,9 @@
   import org.apache.avalon.framework.logger.AbstractLoggable;
   import org.apache.avalon.framework.logger.Loggable;
   import org.apache.log.Logger;
  +import org.apache.myrmidon.components.converter.MasterConverter;
  +import org.apache.myrmidon.converter.Converter;
  +import org.apache.myrmidon.converter.ConverterException;
   
   /**
    * Class used to configure tasks.
  @@ -55,12 +56,12 @@
       };
   
       ///Converter to use for converting between values
  -    private Converter            m_converter;
  +    private MasterConverter        m_converter;
   
       public void compose( final ComponentManager componentManager )
           throws ComponentException
       {
  -        m_converter = (Converter)componentManager.lookup( "org.apache.ant.convert.Converter" );
  +        m_converter = (MasterConverter)componentManager.lookup( MasterConverter.ROLE );
       }
   
       /**
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/ConverterInfo.java
  
  Index: ConverterInfo.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.myrmidon.components.converter;
  
  /**
   * This info represents meta-information about a converter.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class ConverterInfo
  {
      private final String            m_source;
      private final String            m_destination;
  
      public ConverterInfo( final String source, final String destination )
      {
          m_source = source;
          m_destination = destination;
      } 
  
      /**
       * Retrieve the source type from which it can convert.
       * NB: Should this be an array ????
       *
       * @return the classname from which object produced
       */
      public String getSource()
      {
          return m_source;
      }
  
      /**
       * Retrieve the type to which the converter converts.
       * NB: Should this be an array ????
       *
       * @return the classname of the produced object
       */
      public String getDestination()
      {
          return m_destination;
      }
  }
  
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/ConverterRegistry.java
  
  Index: ConverterRegistry.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.myrmidon.components.converter;
  
  import org.apache.avalon.framework.component.Component;
  
  /**
   * Interface for registry for ConverterInfos.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public interface ConverterRegistry
      extends Component
  {
      String ROLE = "org.apache.myrmidon.components.converter.ConverterRegistry";
  
      /**
       * 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 className of converter or null if none available
       */
      String getConverterInfoName( String source, String destination );
  
      /**
       * Register a converter-info
       *
       * @param className the className of converter
       * @param info the ConverterInfo
       */
      void registerConverterInfo( String className, ConverterInfo info );
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultConverterRegistry.java
  
  Index: DefaultConverterRegistry.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.myrmidon.components.converter;
  
  import java.util.HashMap;
  
  /**
   * Default implementation of ConverterInfo registry.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class DefaultConverterRegistry
      implements ConverterRegistry
  {
      private final HashMap      m_mapping   = new HashMap();
  
      public String getConverterInfoName( final String source, final String destination )
      {
          final HashMap map = (HashMap)m_mapping.get( source );
          if( null == map ) return null;
          return (String)map.get( destination );
      }
  
      public void registerConverterInfo( final String className, final ConverterInfo info )
      {
          final String source = info.getSource();
          final String destination = info.getDestination();
  
          HashMap map = (HashMap)m_mapping.get( source );
          if( null == map )
          {
              map = new HashMap();
              m_mapping.put( source, map );
          }
  
          map.put( destination, className );
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/DefaultMasterConverter.java
  
  Index: DefaultMasterConverter.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.myrmidon.components.converter;
  
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.ComponentSelector;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.logger.AbstractLoggable;
  import org.apache.myrmidon.components.converter.MasterConverter;
  import org.apache.myrmidon.components.type.TypeManager;
  import org.apache.myrmidon.converter.Converter;
  import org.apache.myrmidon.converter.ConverterException;
  
  /**
   * Converter engine to handle converting between types.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class DefaultMasterConverter
      extends AbstractLoggable
      implements MasterConverter, Composable
  {
      private final static boolean DEBUG                = false;
  
      private ConverterRegistry    m_infoRegistry;
      private ComponentSelector    m_selector;
  
      /**
       * Retrieve relevent services needed to deploy.
       *
       * @param componentManager the ComponentManager
       * @exception ComponentException if an error occurs
       */
      public void compose( final ComponentManager componentManager )
          throws ComponentException
      {
          m_infoRegistry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE );
  
          final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE );
          m_selector = (ComponentSelector)typeManager.lookup( Converter.ROLE + "Selector" );
      }
  
      /**
       * Convert object to destination type.
       *
       * @param destination the destination type
       * @param original the original object
       * @param context the context in which to convert
       * @return the converted object
       * @exception Exception if an error occurs
       */
      public Object convert( Class destination, final Object original, final Context context )
          throws ConverterException
      {
          final Class originalClass = original.getClass();
  
          if( destination.isAssignableFrom( originalClass ) )
          {
              return original;
          }
  
          if( DEBUG )
          {
              getLogger().debug( "Looking for converter from " + originalClass.getName() +
                                 " to " + destination.getName() );
          }
  
          //TODO: Start searching inheritance hierarchy for converter
          final String name =
              m_infoRegistry.getConverterInfoName( originalClass.getName(),
                                                   destination.getName() );
  
          if( null == name )
          {
              throw new ConverterException( "Unable to find converter for " +
                                            originalClass.getName() + " to " +
                                            destination.getName() + " conversion" );
          }
  
          try
          {
              //TODO: Start caching converters instead of repeatedly instantiating em.
              final Converter converter = (Converter)m_selector.select( name );
  
  
              if( DEBUG )
              {
                  getLogger().debug( "Found Converter: " + converter );
              }
  
              return converter.convert( destination, original, context );
          }
          catch( final ComponentException ce )
          {
              throw new ConverterException( "Badly configured TypeManager missing " +
                                            "converter definition" );
          }
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/converter/MasterConverter.java
  
  Index: MasterConverter.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.myrmidon.components.converter;
  
  import org.apache.avalon.framework.component.Component;
  import org.apache.myrmidon.converter.Converter;
  
  /**
   * Master Converter to handle converting between types.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public interface MasterConverter
      extends Component, Converter
  {
      String ROLE = "org.apache.myrmidon.components.converter.MasterConverter";
  }
  
  
  
  1.7       +46 -83    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultTskDeployer.java
  
  Index: DefaultTskDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/deployer/DefaultTskDeployer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultTskDeployer.java	2001/06/02 08:40:10	1.6
  +++ DefaultTskDeployer.java	2001/06/02 14:28:42	1.7
  @@ -15,12 +15,8 @@
   import java.util.zip.ZipEntry;
   import java.util.zip.ZipException;
   import java.util.zip.ZipFile;
  -import org.apache.ant.convert.engine.ConverterEngine;
  -import org.apache.ant.convert.engine.ConverterRegistry;
  -import org.apache.ant.convert.engine.DefaultConverterInfo;
   import org.apache.avalon.framework.camelot.AbstractDeployer;
   import org.apache.avalon.framework.camelot.DefaultLocator;
  -import org.apache.avalon.framework.camelot.DefaultRegistry;
   import org.apache.avalon.framework.camelot.DeployerUtil;
   import org.apache.avalon.framework.camelot.DeploymentException;
   import org.apache.avalon.framework.camelot.Loader;
  @@ -35,10 +31,13 @@
   import org.apache.avalon.framework.logger.Loggable;
   import org.apache.log.Logger;
   import org.apache.myrmidon.api.Task;
  +import org.apache.myrmidon.components.converter.ConverterInfo;
  +import org.apache.myrmidon.components.converter.ConverterRegistry;
   import org.apache.myrmidon.components.executor.Executor;
  -import org.apache.myrmidon.components.type.TypeManager;
   import org.apache.myrmidon.components.type.ComponentFactory;
   import org.apache.myrmidon.components.type.DefaultComponentFactory;
  +import org.apache.myrmidon.components.type.TypeManager;
  +import org.apache.myrmidon.converter.Converter;
   
   /**
    * This class deploys a .tsk file into a registry.
  @@ -51,9 +50,6 @@
   {
       private final static String   TSKDEF_FILE     = "TASK-LIB/taskdefs.xml";
   
  -    //private Registry              m_dataTypeRegistry;
  -    //private Registry              m_taskRegistry;
  -    private Registry              m_converterRegistry;
       private ConverterRegistry     m_converterInfoRegistry;
       private TypeManager           m_typeManager;
   
  @@ -75,20 +71,7 @@
       public void compose( final ComponentManager componentManager )
           throws ComponentException
       {
  -        //UGLY HACK alert !!!
  -        //final Executor executor = (Executor)componentManager.lookup( Executor.ROLE );
  -        //m_taskRegistry = executor.getRegistry();
  -
  -        final ConverterEngine converterEngine = (ConverterEngine)componentManager.
  -            lookup( "org.apache.ant.convert.engine.ConverterEngine" );
  -
  -        m_converterInfoRegistry = converterEngine.getInfoRegistry();
  -        m_converterRegistry = converterEngine.getRegistry();
  -
  -        //final DataTypeEngine dataTypeEngine = (DataTypeEngine)componentManager.
  -        //lookup( "org.apache.ant.tasklet.engine.DataTypeEngine" );
  -        //m_dataTypeRegistry = dataTypeEngine.getRegistry();
  -
  +        m_converterInfoRegistry = (ConverterRegistry)componentManager.lookup( ConverterRegistry.ROLE );
           m_typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE );
       }
   
  @@ -128,7 +111,7 @@
       {
           final Configuration taskdefs = DeployerUtil.loadConfiguration( zipFile, TSKDEF_FILE );
   
  -        final DefaultComponentFactory factory = 
  +        final DefaultComponentFactory factory =
               new DefaultComponentFactory( new URL[] { url } );
   
           try
  @@ -142,7 +125,7 @@
               final Configuration[] converters = taskdefs.getChildren( "converter" );
               for( int i = 0; i < converters.length; i++ )
               {
  -                handleConverter( converters[ i ], url );
  +                handleConverter( converters[ i ], url, factory );
               }
   
               final Configuration[] datatypes = taskdefs.getChildren( "datatype" );
  @@ -155,6 +138,10 @@
           {
               throw new DeploymentException( "Malformed taskdefs.xml", ce );
           }
  +        catch( final Exception e )
  +        {
  +            throw new DeploymentException( "Failed to deploy " + location, e );
  +        }
       }
   
       public void deployConverter( String name, String location, URL url )
  @@ -171,7 +158,9 @@
               {
                   if( converters[ i ].getAttribute( "classname" ).equals( name ) )
                   {
  -                    handleConverter( converters[ i ], url );
  +                    final DefaultComponentFactory factory =
  +                        new DefaultComponentFactory( new URL[] { url } );
  +                    handleConverter( converters[ i ], url, factory );
                       break;
                   }
               }
  @@ -180,6 +169,10 @@
           {
               throw new DeploymentException( "Malformed taskdefs.xml", ce );
           }
  +        catch( final Exception e )
  +        {
  +            throw new DeploymentException( "Failed to deploy " + name, e );
  +        }
       }
   
       public void deployDataType( final String name, final String location, final URL url )
  @@ -197,7 +190,7 @@
               {
                   if( datatypes[ i ].getAttribute( "name" ).equals( name ) )
                   {
  -                    final DefaultComponentFactory factory = 
  +                    final DefaultComponentFactory factory =
                           new DefaultComponentFactory( new URL[] { url } );
                       handleDataType( datatypes[ i ], url, factory );
                       break;
  @@ -208,6 +201,10 @@
           {
               throw new DeploymentException( "Malformed taskdefs.xml", ce );
           }
  +        catch( final Exception e )
  +        {
  +            throw new DeploymentException( "Failed to deploy " + name, e );
  +        }
       }
   
       public void deployTask( final String name, final String location, final URL url )
  @@ -224,7 +221,7 @@
               {
                   if( tasks[ i ].getAttribute( "name" ).equals( name ) )
                   {
  -                    final DefaultComponentFactory factory = 
  +                    final DefaultComponentFactory factory =
                           new DefaultComponentFactory( new URL[] { url } );
                       handleTask( tasks[ i ], url, factory );
                       break;
  @@ -235,90 +232,56 @@
           {
               throw new DeploymentException( "Malformed taskdefs.xml", ce );
           }
  +        catch( final Exception e )
  +        {
  +            throw new DeploymentException( "Failed to deploy " + name, e );
  +        }
       }
   
  -    private void handleConverter( final Configuration converter, final URL url )
  -        throws DeploymentException, ConfigurationException
  +    private void handleConverter( final Configuration converter,
  +                                  final URL url,
  +                                  final DefaultComponentFactory factory )
  +        throws Exception
       {
           final String name = converter.getAttribute( "classname" );
           final String source = converter.getAttribute( "source" );
           final String destination = converter.getAttribute( "destination" );
  -
  -        final DefaultConverterInfo info = new DefaultConverterInfo( source, destination );
   
  -        try { m_converterInfoRegistry.register( name, info ); }
  -        catch( final RegistryException re )
  -        {
  -            throw new DeploymentException( "Error registering converter info " +
  -                                           name + " due to " + re,
  -                                           re );
  -        }
  -
  -        final DefaultLocator locator = new DefaultLocator( name, url );
  +        final ConverterInfo info = new ConverterInfo( source, destination );
  +        m_converterInfoRegistry.registerConverterInfo( name, info );
   
  -        try { m_converterRegistry.register( name, locator ); }
  -        catch( final RegistryException re )
  -        {
  -            throw new DeploymentException( "Error registering converter locator " +
  -                                           name + " due to " + re,
  -                                           re );
  -        }
  +        factory.addNameClassMapping( name, name );
  +        m_typeManager.registerType( Converter.ROLE, name, factory );
   
           getLogger().debug( "Registered converter " + name + " that converts from " +
                              source + " to " + destination );
       }
   
  -    private void handleTask( final Configuration task, 
  -                             final URL url, 
  +    private void handleTask( final Configuration task,
  +                             final URL url,
                                final DefaultComponentFactory factory )
  -        throws DeploymentException, ConfigurationException
  +        throws Exception
       {
           final String name = task.getAttribute( "name" );
           final String className = task.getAttribute( "classname" );
  -        /*
  -        final DefaultLocator info = new DefaultLocator( className, url );
   
  -        try { m_taskRegistry.register( name, info ); }
  -        catch( final RegistryException re )
  -        {
  -            throw new DeploymentException( "Error registering " + name + " due to " + re,
  -                                           re );
  -        }
  -        */
           factory.addNameClassMapping( name, className );
  -        
  -        try { m_typeManager.registerType( Task.ROLE, name, factory ); }
  -        catch( final Exception e )
  -        {
  -            throw new DeploymentException( "Error registering " + name + " due to " + e, e );
  -        }
  -        
  +
  +        m_typeManager.registerType( Task.ROLE, name, factory );
  +
           getLogger().debug( "Registered task " + name + " as " + className );
       }
   
  -    private void handleDataType( final Configuration datatype, 
  -                                 final URL url, 
  +    private void handleDataType( final Configuration datatype,
  +                                 final URL url,
                                    final DefaultComponentFactory factory )
  -        throws DeploymentException, ConfigurationException
  +        throws Exception
       {
           final String name = datatype.getAttribute( "name" );
           final String className = datatype.getAttribute( "classname" );
  -/*
  -        final DefaultLocator info = new DefaultLocator( className, url );
   
  -        try { m_dataTypeRegistry.register( name, info ); }
  -        catch( final RegistryException re )
  -        {
  -            throw new DeploymentException( "Error registering " + name + " due to " + re,
  -                                           re );
  -        }
  -*/
           factory.addNameClassMapping( name, className );
  -        try { m_typeManager.registerType( "org.apache.ant.tasklet.DataType", name, factory ); }
  -        catch( final Exception e )
  -        {
  -            throw new DeploymentException( "Error registering " + name + " due to " + e, e );
  -        }
  +        m_typeManager.registerType( "org.apache.ant.tasklet.DataType", name, factory );
   
           getLogger().debug( "Registered datatype " + name + " as " + className );
       }
  
  
  
  1.15      +22 -21    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/MyrmidonEmbeddor.java
  
  Index: MyrmidonEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/MyrmidonEmbeddor.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MyrmidonEmbeddor.java	2001/06/02 08:40:10	1.14
  +++ MyrmidonEmbeddor.java	2001/06/02 14:28:43	1.15
  @@ -8,7 +8,8 @@
   package org.apache.myrmidon.components.embeddor;
   
   import java.io.File;
  -import org.apache.ant.convert.engine.ConverterEngine;
  +import org.apache.myrmidon.components.converter.MasterConverter;
  +import org.apache.myrmidon.components.converter.ConverterRegistry;
   import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.camelot.CamelotUtil;
  @@ -24,10 +25,10 @@
   import org.apache.myrmidon.api.JavaVersion;
   import org.apache.myrmidon.components.builder.ProjectBuilder;
   import org.apache.myrmidon.components.configurer.Configurer;
  +import org.apache.myrmidon.components.deployer.TskDeployer;
   import org.apache.myrmidon.components.executor.Executor;
  -import org.apache.myrmidon.components.type.TypeManager;
   import org.apache.myrmidon.components.manager.ProjectManager;
  -import org.apache.myrmidon.components.deployer.TskDeployer;
  +import org.apache.myrmidon.components.type.TypeManager;
   
   /**
    * Default implementation of Embeddor.
  @@ -44,13 +45,12 @@
       private TskDeployer              m_deployer;
   
       private TypeManager              m_typeManager;
  -    private ConverterEngine          m_converterEngine;
  +    private MasterConverter          m_converter;
  +    private ConverterRegistry        m_converterRegistry;
   
       private Executor                 m_executor;
       private Configurer               m_configurer;
  -    
   
  -    private Factory                  m_factory;
   
       private DefaultComponentManager  m_componentManager;
       private Parameters               m_parameters;
  @@ -106,7 +106,6 @@
           m_defaults = createDefaultParameters();
   
           //create all the components
  -        m_factory = new DefaultFactory();
           createComponents();
   
           //setup the component manager
  @@ -136,13 +135,13 @@
       public void dispose()
           throws Exception
       {
  -        m_converterEngine = null;
  +        m_converterRegistry = null;
  +        m_converter = null;
           m_executor = null;
           m_projectManager = null;
           m_builder = null;
           m_deployer = null;
           m_configurer = null;
  -        m_factory = null;
           m_componentManager = null;
           m_parameters = null;
           m_defaults = null;
  @@ -167,9 +166,10 @@
           defaults.setParameter( "myrmidon.lib.path", "lib" );
   
           //create all the default properties for components
  -        defaults.setParameter( "org.apache.ant.convert.engine.ConverterEngine",
  -                               "org.apache.ant.convert.engine.DefaultConverterEngine" );
  -
  +        defaults.setParameter( MasterConverter.ROLE,
  +                               "org.apache.myrmidon.components.converter.DefaultMasterConverter" );
  +        defaults.setParameter( ConverterRegistry.ROLE,
  +                               "org.apache.myrmidon.components.converter.DefaultConverterRegistry" );
           defaults.setParameter( TypeManager.ROLE,
                                  "org.apache.myrmidon.components.type.DefaultTypeManager" );
           defaults.setParameter( Executor.ROLE,
  @@ -195,10 +195,7 @@
       {
           final DefaultComponentManager componentManager = new DefaultComponentManager();
   
  -        componentManager.put( "org.apache.ant.convert.engine.ConverterEngine",
  -                              m_converterEngine );
  -        componentManager.put( "org.apache.ant.convert.Converter", m_converterEngine );
  -        componentManager.put( "org.apache.avalon.framework.camelot.Factory", m_factory );
  +        componentManager.put( MasterConverter.ROLE, m_converter );
   
           //Following components required when Myrmidon is used as build tool
           componentManager.put( ProjectManager.ROLE, m_projectManager );
  @@ -209,6 +206,7 @@
   
           //Following components used when want to types (ie tasks/mappers etc)
           componentManager.put( TypeManager.ROLE, m_typeManager );
  +        componentManager.put( ConverterRegistry.ROLE, m_converterRegistry );
   
           //Following components required when allowing Container tasks
           componentManager.put( Configurer.ROLE, m_configurer );
  @@ -226,9 +224,12 @@
           throws Exception
       {
           String component = null;
  +
  +        component = getParameter( ConverterRegistry.ROLE );
  +        m_converterRegistry = (ConverterRegistry)createComponent( component, ConverterRegistry.class );
   
  -        component = getParameter( "org.apache.ant.convert.engine.ConverterEngine" );
  -        m_converterEngine = (ConverterEngine)createComponent( component, ConverterEngine.class );
  +        component = getParameter( "org.apache.myrmidon.components.converter.MasterConverter" );
  +        m_converter = (MasterConverter)createComponent( component, MasterConverter.class );
   
           component = getParameter( Configurer.ROLE );
           m_configurer = (Configurer)createComponent( component, Configurer.class );
  @@ -257,8 +258,8 @@
       private void setupComponents()
           throws Exception
       {
  -        setupComponent( m_factory );
  -        setupComponent( m_converterEngine );
  +        setupComponent( m_converterRegistry );
  +        setupComponent( m_converter );
           setupComponent( m_executor );
           setupComponent( m_projectManager );
           setupComponent( m_builder );
  @@ -417,7 +418,7 @@
           }
           catch( final ClassNotFoundException cnfe )
           {
  -            throw new Exception( "Could not find the class for " + clazz + 
  +            throw new Exception( "Could not find the class for " + clazz +
                                    " (" + component + ")" );
           }
       }
  
  
  
  1.7       +0 -2      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java
  
  Index: DefaultExecutor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultExecutor.java	2001/06/02 08:40:10	1.6
  +++ DefaultExecutor.java	2001/06/02 14:28:43	1.7
  @@ -7,7 +7,6 @@
    */
   package org.apache.myrmidon.components.executor;
   
  -import org.apache.ant.convert.engine.ConverterEngine;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.component.Component;
  @@ -50,7 +49,6 @@
       {
           //cache CM so it can be used while executing tasks
           m_componentManager = componentManager;
  -        //m_factory = (Factory)componentManager.lookup( "org.apache.avalon.framework.camelot.Factory" );
   
           m_configurer = (Configurer)componentManager.lookup( Configurer.ROLE );
   
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/converter/AbstractConverter.java
  
  Index: AbstractConverter.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.myrmidon.converter;
  
  import org.apache.avalon.framework.context.Context;
  
  /**
   * Instances of this interface are used to convert between different types.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public abstract class AbstractConverter
      implements Converter
  {
      private final Class         m_source;
      private final Class         m_destination;
  
      /**
       * Constructor for a converter between types source and destination
       *
       * @param source the source type
       * @param destination the destination type
       */
      public AbstractConverter( final Class source, final Class destination )
      {
          m_source = source;
          m_destination = destination;
      }
  
      /**
       * Convert an object from original to destination types
       *
       * @param destination the destination type
       * @param original the original Object
       * @param context the context in which to convert
       * @return the converted object
       * @exception Exception if an error occurs
       */
      public Object convert( final Class destination, final Object original, Context context )
          throws ConverterException
      {
          if( m_destination != destination )
          {
              throw new IllegalArgumentException( "Destination type " + destination.getName() +
                                                  " is not equal to " + m_destination );
          }
  
          if( !m_source.isInstance( original ) )
          {
              throw new IllegalArgumentException( "Object '" + original + "' is not an " +
                                                  "instance of " + m_source.getName() );
          }
  
          return convert( original, context );
      }
  
      /**
       * Overide this in a particular converter to do the conversion.
       *
       * @param original the original Object
       * @param context the context in which to convert
       * @return the converted object
       * @exception Exception if an error occurs
       */
      protected abstract Object convert( Object original, Context context )
          throws ConverterException;
  }
  
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/converter/Converter.java
  
  Index: Converter.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.myrmidon.converter;
  
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.context.Context;
  
  /**
   * Instances of this interface are used to convert between different types.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public interface Converter
      extends Component
  {
      String ROLE = "org.apache.myrmidon.converter.Converter";
  
      /**
       * Convert original to destination type.
       * Destination is passed so that one converter can potentiall
       * convert to multiple different types.
       *
       * @param destination the destinaiton type
       * @param original the original type
       * @param context the context in which to convert
       * @return the converted object
       * @exception Exception if an error occurs
       */
      Object convert( Class destination, Object original, Context context )
          throws ConverterException;
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/converter/ConverterException.java
  
  Index: ConverterException.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.myrmidon.converter;
  
  import org.apache.avalon.framework.CascadingException;
  
  /**
   * ConverterException thrown when a problem occurs during convertion etc.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class ConverterException
      extends CascadingException
  {
      /**
       * Basic constructor with a message
       *
       * @param message the message
       */
      public ConverterException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Constructor that builds cascade so that other exception information can be retained.
       *
       * @param message the message
       * @param throwable the throwable
       */
      public ConverterException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.2       +1 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/ItemSet.java
  
  Index: ItemSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/ItemSet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ItemSet.java	2001/05/28 08:16:13	1.1
  +++ ItemSet.java	2001/06/02 14:28:43	1.2
  @@ -7,7 +7,7 @@
    */
   package org.apache.myrmidon.framework;
   
  -import org.apache.ant.tasklet.DataType;
  +import org.apache.myrmidon.api.DataType;
   
   /**
    * Interface for ItemSet.
  
  
  
  1.2       +1 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Mapper.java
  
  Index: Mapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Mapper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Mapper.java	2001/05/28 08:16:13	1.1
  +++ Mapper.java	2001/06/02 14:28:43	1.2
  @@ -7,7 +7,7 @@
    */
   package org.apache.myrmidon.framework;
   
  -import org.apache.ant.tasklet.DataType;
  +import org.apache.myrmidon.api.DataType;
   
   /**
    * Interface for Mappers.
  
  
  

Mime
View raw message