diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java index 738d1cd84..b58eb2d66 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/runtime/ConverterDef.java @@ -20,8 +20,27 @@ import org.apache.myrmidon.interfaces.deployer.TypeDefinition; 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 ); } } diff --git a/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java b/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java index f67de0b8e..b65fdfaa2 100644 --- a/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java +++ b/proposal/myrmidon/src/java/org/apache/antlib/runtime/TypeDef.java @@ -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 @@ import org.apache.myrmidon.interfaces.deployer.TypeDefinition; 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() ); } } diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractTypeDef.java b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractTypeDef.java index 859b92721..f7656e035 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractTypeDef.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/framework/AbstractTypeDef.java @@ -10,9 +10,6 @@ package org.apache.myrmidon.framework; 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 @@ import org.apache.myrmidon.interfaces.deployer.TypeDeployer; */ 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 @@ public abstract class AbstractTypeDef // 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 ) {