You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2002/02/03 04:40:47 UTC

cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework AbstractTypeDef.java

donaldp     02/02/02 19:40:47

  Modified:    proposal/myrmidon/src/java/org/apache/antlib/runtime
                        ConverterDef.java TypeDef.java
               proposal/myrmidon/src/java/org/apache/myrmidon/framework
                        AbstractTypeDef.java
  Log:
  Reworked TypeDef classes to work with immutable TypeDefinition objects
  
  Revision  Changes    Path
  1.9       +20 -1     jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java
  
  Index: ConverterDef.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ConverterDef.java	2 Feb 2002 15:44:04 -0000	1.8
  +++ ConverterDef.java	3 Feb 2002 03:40:47 -0000	1.9
  @@ -20,8 +20,27 @@
   public class ConverterDef
       extends AbstractTypeDef
   {
  +    private String m_sourceType;
  +    private String m_destinationType;
  +
  +    /**
  +     * Sets the converter's source type.
  +     */
  +    public void setSourceType( final String sourceType )
  +    {
  +        m_sourceType = sourceType;
  +    }
  +
  +    /**
  +     * Sets the converter's destination type.
  +     */
  +    public void setDestinationType( final String destinationType )
  +    {
  +        m_destinationType = destinationType;
  +    }
  +
       protected TypeDefinition createTypeDefinition()
       {
  -        return new ConverterDefinition();
  +        return new ConverterDefinition( getClassname(), m_sourceType, m_destinationType );
       }
   }
  
  
  
  1.7       +16 -2     jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java
  
  Index: TypeDef.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TypeDef.java	2 Feb 2002 15:44:04 -0000	1.6
  +++ TypeDef.java	3 Feb 2002 03:40:47 -0000	1.7
  @@ -8,7 +8,6 @@
   package org.apache.antlib.runtime;
   
   import org.apache.myrmidon.framework.AbstractTypeDef;
  -import org.apache.myrmidon.interfaces.deployer.GeneralTypeDefinition;
   import org.apache.myrmidon.interfaces.deployer.TypeDefinition;
   
   /**
  @@ -20,8 +19,23 @@
   public class TypeDef
       extends AbstractTypeDef
   {
  +    private String m_role;
  +
  +    public void setName( final String name )
  +    {
  +        super.setName( name );
  +    }
  +
  +    /**
  +     * Sets the type's role.
  +     */
  +    public void setRole( final String role )
  +    {
  +        m_role = role;
  +    }
  +
       protected TypeDefinition createTypeDefinition()
       {
  -        return new GeneralTypeDefinition();
  +        return new TypeDefinition( getName(), m_role, getClassname() );
       }
   }
  
  
  
  1.15      +24 -33    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractTypeDef.java
  
  Index: AbstractTypeDef.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractTypeDef.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AbstractTypeDef.java	2 Feb 2002 12:51:59 -0000	1.14
  +++ AbstractTypeDef.java	3 Feb 2002 03:40:47 -0000	1.15
  @@ -10,9 +10,6 @@
   import java.io.File;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.framework.configuration.Configurable;
  -import org.apache.avalon.framework.configuration.Configuration;
  -import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.interfaces.deployer.Deployer;
   import org.apache.myrmidon.interfaces.deployer.DeploymentException;
  @@ -28,45 +25,38 @@
    */
   public abstract class AbstractTypeDef
       extends AbstractContainerTask
  -    implements Configurable
   {
       private final static Resources REZ =
           ResourceManager.getPackageResources( AbstractTypeDef.class );
   
       // TODO - replace lib with class-path
       private File m_lib;
  -    private TypeDefinition m_typeDef;
  +    private String m_name;
  +    private String m_classname;
   
  -    /**
  -     * Configures this task.
  -     */
  -    public void configure( Configuration configuration ) throws ConfigurationException
  +    protected void setName( final String name )
       {
  -        m_typeDef = createTypeDefinition();
  +        m_name = name;
  +    }
   
  -        // Configure attributes
  -        final String[] attrs = configuration.getAttributeNames();
  -        for( int i = 0; i < attrs.length; i++ )
  -        {
  -            final String name = attrs[ i ];
  -            final String value = configuration.getAttribute( name );
  -            if( name.equalsIgnoreCase( "lib" ) )
  -            {
  -                m_lib = (File)convert( File.class, value );
  -            }
  -            else
  -            {
  -                configure( m_typeDef, name, value );
  -            }
  -        }
  +    public void setClassname( final String classname )
  +    {
  +        m_classname = classname;
  +    }
   
  -        // Configure nested elements
  -        final Configuration[] elements = configuration.getChildren();
  -        for( int i = 0; i < elements.length; i++ )
  -        {
  -            Configuration element = elements[ i ];
  -            configure( m_typeDef, element );
  -        }
  +    public void setLib( final File lib )
  +    {
  +        m_lib = lib;
  +    }
  +
  +    protected final String getName()
  +    {
  +        return m_name;
  +    }
  +
  +    protected final String getClassname()
  +    {
  +        return m_classname;
       }
   
       /**
  @@ -86,7 +76,8 @@
               // Locate the deployer, and use it to deploy the type
               final Deployer deployer = (Deployer)getService( Deployer.class );
               final TypeDeployer typeDeployer = deployer.createDeployer( m_lib );
  -            typeDeployer.deployType( m_typeDef );
  +            final TypeDefinition typeDef = createTypeDefinition();
  +            typeDeployer.deployType( typeDef );
           }
           catch( DeploymentException e )
           {
  
  
  

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