diff --git a/proposal/myrmidon/src/java/org/apache/ant/DefaultAntEngine.java b/proposal/myrmidon/src/java/org/apache/ant/DefaultAntEngine.java index 9319e5efe..41f35ac8b 100644 --- a/proposal/myrmidon/src/java/org/apache/ant/DefaultAntEngine.java +++ b/proposal/myrmidon/src/java/org/apache/ant/DefaultAntEngine.java @@ -11,7 +11,7 @@ import java.io.File; import java.util.Properties; import org.apache.ant.configuration.Configurer; import org.apache.ant.convert.ConverterEngine; -import org.apache.ant.datatypes.DataTypeEngine; +import org.apache.ant.tasklet.engine.DataTypeEngine; import org.apache.ant.project.ProjectBuilder; import org.apache.ant.project.ProjectEngine; import org.apache.ant.tasklet.JavaVersion; @@ -160,7 +160,7 @@ public class DefaultAntEngine defaults.setProperty( "ant.comp.converter", "org.apache.ant.convert.DefaultConverterEngine" ); defaults.setProperty( "ant.comp.datatype", - "org.apache.ant.datatypes.DefaultDataTypeEngine" ); + "org.apache.ant.tasklet.engine.DefaultDataTypeEngine" ); defaults.setProperty( "ant.comp.tasklet", "org.apache.ant.tasklet.engine.DefaultTaskletEngine" ); defaults.setProperty( "ant.comp.project", @@ -188,7 +188,7 @@ public class DefaultAntEngine componentManager.put( "org.apache.ant.project.ProjectEngine", m_projectEngine ); componentManager.put( "org.apache.ant.convert.ConverterEngine", m_converterEngine ); componentManager.put( "org.apache.ant.convert.Converter", m_converterEngine ); - componentManager.put( "org.apache.ant.datatypes.DataTypeEngine", m_dataTypeEngine ); + componentManager.put( "org.apache.ant.tasklet.engine.DataTypeEngine", m_dataTypeEngine ); componentManager.put( "org.apache.ant.project.ProjectBuilder", m_builder ); componentManager.put( "org.apache.ant.tasklet.engine.TskDeployer", m_deployer ); componentManager.put( "org.apache.avalon.camelot.Factory", m_factory ); diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/AbstractResourceRegisterer.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/AbstractResourceRegisterer.java deleted file mode 100644 index 1433f72b1..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/AbstractResourceRegisterer.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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.tasks.core; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import org.apache.ant.AntException; -import org.apache.ant.tasklet.AbstractTasklet; -import org.apache.ant.tasklet.engine.TaskletEngine; -import org.apache.avalon.ComponentManager; -import org.apache.avalon.ComponentManagerException; -import org.apache.avalon.Composer; -import org.apache.avalon.camelot.RegistryException; - -/** - * Method to register a single tasklet. - * - * @author Peter Donald - */ -public abstract class AbstractResourceRegisterer - extends AbstractTasklet - implements Composer -{ - protected String m_lib; - protected String m_name; - protected String m_classname; - protected TaskletEngine m_engine; - - public void compose( final ComponentManager componentManager ) - throws ComponentManagerException - { - m_engine = (TaskletEngine)componentManager. - lookup( "org.apache.ant.tasklet.engine.TaskletEngine" ); - } - - public void setLib( final String lib ) - { - m_lib = lib; - } - - public void setName( final String name ) - { - m_name = name; - } - - public void setClassname( final String classname ) - { - m_classname = classname; - } - - public void run() - throws AntException - { - if( null == m_name ) - { - throw new AntException( "Must specify name parameter" ); - } - else if( null == m_lib && null == m_classname ) - { - throw new AntException( "Must specify classname if you don't specify " + - "lib parameter" ); - } - - final URL url = getURL( m_lib ); - - try - { - registerResource( m_name, m_classname, url ); - } - catch( final RegistryException re ) - { - throw new AntException( "Error registering resource", re ); - } - } - - protected URL getURL( final String libName ) - { - if( null != libName ) - { - final File lib = getContext().resolveFile( libName ); - try { return lib.toURL(); } - catch( final MalformedURLException mue ) - { - throw new AntException( "Malformed task-lib parameter " + m_lib, mue ); - } - } - else - { - return null; - } - } - - protected abstract void registerResource( String name, String classname, URL url ) - throws AntException, RegistryException; -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/AntCall.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/AntCall.java deleted file mode 100644 index c441fd7a9..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/AntCall.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.tasks.core; - -import java.util.ArrayList; -import org.apache.ant.AntException; -import org.apache.ant.project.ProjectEngine; -import org.apache.ant.project.Project; -import org.apache.ant.tasklet.AbstractTasklet; -import org.apache.ant.tasklet.DefaultTaskletContext; -import org.apache.ant.tasklet.TaskletContext; -import org.apache.avalon.ComponentManager; -import org.apache.avalon.Context; -import org.apache.avalon.ComponentManagerException; -import org.apache.avalon.Composer; - -/** - * This is abstract base class for tasklets. - * - * @author Peter Donald - */ -public class AntCall - extends AbstractTasklet - implements Composer -{ - protected ProjectEngine m_projectEngine; - protected Project m_project; - protected String m_target; - protected ArrayList m_properties = new ArrayList(); - protected TaskletContext m_childContext; - protected ComponentManager m_componentManager; - - public void contextualize( final Context context ) - { - super.contextualize( context ); - m_childContext = new DefaultTaskletContext( getContext() ); - } - - public void compose( final ComponentManager componentManager ) - throws ComponentManagerException - { - m_componentManager = componentManager; - m_projectEngine = (ProjectEngine)componentManager. - lookup( "org.apache.ant.project.ProjectEngine" ); - m_project = (Project)componentManager.lookup( "org.apache.ant.project.Project" ); - } - - public void setTarget( final String target ) - { - m_target = target; - } - - public Property createParam() - throws Exception - { - final Property property = new Property(); - property.setLogger( getLogger() ); - property.contextualize( m_childContext ); - property.compose( m_componentManager ); - m_properties.add( property ); - return property; - } - - public void run() - throws AntException - { - if( null == m_target ) - { - throw new AntException( "Target attribute must be specified" ); - } - - final int size = m_properties.size(); - for( int i = 0; i < size; i++ ) - { - final Property property = (Property)m_properties.get( i ); - property.run(); - } - - getLogger().info( "Calling target " + m_target ); - m_projectEngine.execute( m_project, m_target, m_childContext ); - } -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/ConfigurationTest.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/ConfigurationTest.java deleted file mode 100644 index 6b5c30545..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/ConfigurationTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.tasks.core; - -import org.apache.ant.AntException; -import org.apache.ant.configuration.Configurable; -import org.apache.ant.configuration.Configuration; -import org.apache.ant.tasklet.AbstractTasklet; -import org.apache.avalon.ConfigurationException; - -/** - * This is abstract base class for tasklets. - * - * @author Peter Donald - */ -public class ConfigurationTest - extends AbstractTasklet - implements Configurable -{ - protected String m_message; - - public void configure( final Configuration configuration ) - throws ConfigurationException - { - String message = configuration.getAttribute( "message" ); - final Object object = getContext().resolveValue( message ); - if( object instanceof String ) - { - m_message = (String)object; - } - else - { - m_message = object.toString(); - } - } - - public void run() - throws AntException - { - getLogger().warn( m_message ); - } -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/ContentTest.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/ContentTest.java deleted file mode 100644 index 4d2b21cc6..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/ContentTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.tasks.core; - -import org.apache.ant.AntException; -import org.apache.ant.tasklet.AbstractTasklet; - -/** - * This is abstract base class for tasklets. - * - * @author Peter Donald - */ -public class ContentTest - extends AbstractTasklet -{ - public void addContent( final Integer value ) - { - getLogger().warn( "Integer content: " + value ); - } - - /* - public void addContent( final String blah ) - { - System.out.println( "String: " + blah ); - } - */ - - public void run() - throws AntException - { - } -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/Echo.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/Echo.java deleted file mode 100644 index 193fd6c55..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/Echo.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.tasks.core; - -import org.apache.ant.AntException; -import org.apache.ant.tasklet.AbstractTasklet; - -/** - * This is abstract base class for tasklets. - * - * @author Peter Donald - */ -public class Echo - extends AbstractTasklet -{ - protected String m_message; - - public void setMessage( final String message ) - { - m_message = message; - } - - public void run() - throws AntException - { - getLogger().warn( m_message ); - } -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/PrimitiveTypesTest.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/PrimitiveTypesTest.java deleted file mode 100644 index 08509c177..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/PrimitiveTypesTest.java +++ /dev/null @@ -1,90 +0,0 @@ - -/* - * 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.tasks.core; - -import org.apache.ant.AntException; -import org.apache.ant.tasklet.AbstractTasklet; - -/** - * - * @author Peter Donald - */ -public class PrimitiveTypesTest - extends AbstractTasklet -{ - public void setInteger( final Integer value ) - { - getLogger().warn( "setInteger( " + value + " );" ); - } - - public void setInteger2( final int value ) - { - getLogger().warn( "setInteger2( " + value + " );" ); - } - - public void setShort( final Short value ) - { - getLogger().warn( "setShort( " + value + " );" ); - } - - public void setShort2( final short value ) - { - getLogger().warn( "setShort2( " + value + " );" ); - } - - public void setByte( final Byte value ) - { - getLogger().warn( "setByte( " + value + " );" ); - } - - public void setByte2( final byte value ) - { - getLogger().warn( "setByte2( " + value + " );" ); - } - - public void setLong( final Long value ) - { - getLogger().warn( "setLong( " + value + " );" ); - } - - public void setLong2( final long value ) - { - getLogger().warn( "setLong2( " + value + " );" ); - } - - public void setFloat( final Float value ) - { - getLogger().warn( "setFloat( " + value + " );" ); - } - - public void setFloat2( final float value ) - { - getLogger().warn( "setFloat2( " + value + " );" ); - } - - public void setDouble( final Double value ) - { - getLogger().warn( "setDouble( " + value + " );" ); - } - - public void setDouble2( final double value ) - { - getLogger().warn( "setDouble2( " + value + " );" ); - } - - public void setString( final String value ) - { - getLogger().warn( "setString( " + value + " );" ); - } - - public void run() - throws AntException - { - } -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/Property.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/Property.java deleted file mode 100644 index c7bb7ecdc..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/Property.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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.tasks.core; - -import java.util.Iterator; -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.convert.Converter; -import org.apache.ant.datatypes.DataType; -import org.apache.ant.datatypes.DataTypeEngine; -import org.apache.ant.tasklet.AbstractTasklet; -import org.apache.ant.tasklet.TaskletContext; -import org.apache.ant.tasklet.engine.TaskletEngine; -import org.apache.avalon.ComponentManager; -import org.apache.avalon.ComponentManagerException; -import org.apache.avalon.Composer; -import org.apache.avalon.ConfigurationException; -import org.apache.avalon.Resolvable; - -/** - * @author Peter Donald - */ -public class Property - extends AbstractTasklet - implements Configurable, Composer -{ - protected String m_name; - protected Object m_value; - protected boolean m_localScope = true; - protected DataTypeEngine m_engine; - protected Converter m_converter; - protected Configurer m_configurer; - - public void compose( final ComponentManager componentManager ) - throws ComponentManagerException - { - m_configurer = (Configurer)componentManager. - lookup( "org.apache.ant.configuration.Configurer" ); - - m_engine = (DataTypeEngine)componentManager. - lookup( "org.apache.ant.datatypes.DataTypeEngine" ); - - m_converter = (Converter)componentManager.lookup( "org.apache.ant.convert.Converter" ); - } - - public void configure( final Configuration configuration ) - throws ConfigurationException - { - final Iterator attributes = configuration.getAttributeNames(); - - while( attributes.hasNext() ) - { - final String name = (String)attributes.next(); - final String value = configuration.getAttribute( name ); - - final Object object = getContext().resolveValue( value ); - - if( null == object ) - { - throw new AntException( "Value for attribute " + name + "resolved to null" ); - } - - if( name.equals( "name" ) ) - { - try - { - final String convertedValue = - (String)m_converter.convert( String.class, object, getContext() ); - setName( convertedValue ); - } - catch( final Exception e ) - { - throw new ConfigurationException( "Error converting value", e ); - } - } - else if( name.equals( "value" ) ) - { - setValue( object ); - } - else if( name.equals( "local-scope" ) ) - { - try - { - final Boolean localScope = - (Boolean)m_converter.convert( Boolean.class, object, getContext() ); - setLocalScope( Boolean.TRUE == localScope ); - } - catch( final Exception e ) - { - throw new ConfigurationException( "Error converting value", e ); - } - } - else - { - throw new ConfigurationException( "Unknown attribute " + name ); - } - } - - final Iterator children = configuration.getChildren(); - while( children.hasNext() ) - { - final Configuration child = (Configuration)children.next(); - - try - { - final DataType value = m_engine.createDataType( child.getName() ); - setValue( value ); - m_configurer.configure( value, child, getContext() ); - } - catch( final Exception e ) - { - throw new ConfigurationException( "Unable to set datatype", e ); - } - } - } - - public void setName( final String name ) - { - m_name = name; - } - - public void setValue( final Object value ) - throws AntException - { - if( null != m_value ) - { - throw new AntException( "Value can not be set multiple times" ); - } - - m_value = value; - } - - public void setLocalScope( final boolean localScope ) - { - m_localScope = localScope; - } - - public void run() - throws AntException - { - if( null == m_name ) - { - throw new AntException( "Name must be specified" ); - } - - if( null == m_value ) - { - throw new AntException( "Value must be specified" ); - } - - final TaskletContext context = getContext(); - - Object value = m_value; - - if( value instanceof String ) - { - value = context.resolveValue( (String)value ); - } - - while( null != value && value instanceof Resolvable ) - { - value = ((Resolvable)value).resolve( context ); - } - - if( m_localScope ) - { - context.setProperty( m_name, value ); - } - else - { - context.setProperty( m_name, value, TaskletContext.PARENT ); - } - } -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterConverter.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterConverter.java deleted file mode 100644 index fbc2a4ea9..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterConverter.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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.tasks.core; - -import java.io.File; -import java.net.URL; -import java.net.MalformedURLException; -import org.apache.ant.AntException; -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; -import org.apache.avalon.ComponentManagerException; -import org.apache.avalon.Composer; -import org.apache.avalon.camelot.DeploymentException; -import org.apache.avalon.camelot.RegistryException; - -/** - * Method to register a single converter. - * - * @author Peter Donald - */ -public class RegisterConverter - extends AbstractTasklet - implements Composer -{ - protected String m_sourceType; - protected String m_destinationType; - protected String m_lib; - protected String m_classname; - protected TaskletEngine m_engine; - - public void compose( final ComponentManager componentManager ) - throws ComponentManagerException - { - m_engine = (TaskletEngine)componentManager. - lookup( "org.apache.ant.tasklet.engine.TaskletEngine" ); - } - - public void setLib( final String lib ) - { - m_lib = lib; - } - - public void setClassname( final String classname ) - { - m_classname = classname; - } - - public void setSourceType( final String sourceType ) - { - m_sourceType = sourceType; - } - - public void setDestinationType( final String destinationType ) - { - m_destinationType = destinationType; - } - - public void run() - throws AntException - { - if( null == m_classname ) - { - throw new AntException( "Must specify classname parameter" ); - } - - final URL url = getURL( m_lib ); - - boolean isFullyDefined = true; - - if( null == m_sourceType && null == m_destinationType ) - { - isFullyDefined = false; - } - else if( null == m_sourceType || null == m_destinationType ) - { - throw new AntException( "Must specify the source-type and destination-type " + - "parameters when supplying a name" ); - } - - if( !isFullyDefined && null == url ) - { - throw new AntException( "Must supply parameter if not fully specifying converter" ); - } - - if( !isFullyDefined ) - { - try - { - m_engine.getTskDeployer().deployConverter( m_classname, url.toString(), url ); - } - catch( final DeploymentException de ) - { - throw new AntException( "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 ); - - try - { - m_engine.getConverterEngine().getInfoRegistry().register( m_classname, info ); - m_engine.getConverterEngine().getRegistry().register( m_classname, locator ); - } - catch( final RegistryException re ) - { - throw new AntException( "Error registering resource", re ); - } - } - } - - protected URL getURL( final String libName ) - { - if( null != libName ) - { - final File lib = getContext().resolveFile( libName ); - try { return lib.toURL(); } - catch( final MalformedURLException mue ) - { - throw new AntException( "Malformed task-lib parameter " + m_lib, mue ); - } - } - else - { - return null; - } - } -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterDataType.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterDataType.java deleted file mode 100644 index 524cd2ab4..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterDataType.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.tasks.core; - -import java.net.URL; -import org.apache.ant.AntException; -import org.apache.avalon.camelot.DefaultLocator; -import org.apache.avalon.camelot.DeploymentException; -import org.apache.avalon.camelot.RegistryException; - -/** - * Method to register a single datatype. - * - * @author Peter Donald - */ -public class RegisterDataType - extends AbstractResourceRegisterer -{ - protected void registerResource( final String name, - final String classname, - final URL url ) - throws AntException, RegistryException - { - if( null == classname ) - { - try { m_engine.getTskDeployer().deployDataType( name, url.toString(), url ); } - catch( final DeploymentException de ) - { - throw new AntException( "Failed deploying " + name + " from " + url, de ); - } - } - else - { - final DefaultLocator locator = new DefaultLocator( classname, url ); - m_engine.getDataTypeEngine().getRegistry().register( name, locator ); - } - } -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterTasklet.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterTasklet.java deleted file mode 100644 index ddecb0168..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterTasklet.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.tasks.core; - -import java.net.URL; -import org.apache.ant.AntException; -import org.apache.avalon.camelot.DefaultLocator; -import org.apache.avalon.camelot.DeploymentException; -import org.apache.avalon.camelot.RegistryException; - -/** - * Method to register a single tasklet. - * - * @author Peter Donald - */ -public class RegisterTasklet - extends AbstractResourceRegisterer -{ - protected void registerResource( final String name, - final String classname, - final URL url ) - throws AntException, RegistryException - { - if( null == classname ) - { - try { m_engine.getTskDeployer().deployTasklet( name, url.toString(), url ); } - catch( final DeploymentException de ) - { - throw new AntException( "Failed deploying " + name + " from " + url, de ); - } - } - else - { - final DefaultLocator locator = new DefaultLocator( classname, url ); - m_engine.getRegistry().register( name, locator ); - } - } -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterTasklib.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterTasklib.java deleted file mode 100644 index bd7394f47..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/RegisterTasklib.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.tasks.core; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import org.apache.ant.AntException; -import org.apache.ant.tasklet.AbstractTasklet; -import org.apache.ant.tasklet.engine.TaskletEngine; -import org.apache.avalon.ComponentManager; -import org.apache.avalon.ComponentManagerException; -import org.apache.avalon.Composer; -import org.apache.avalon.camelot.DeploymentException; - -/** - * Method to register a tasklib. - * - * @author Peter Donald - */ -public class RegisterTasklib - extends AbstractTasklet - implements Composer -{ - protected String m_lib; - protected TaskletEngine m_engine; - - public void compose( final ComponentManager componentManager ) - throws ComponentManagerException - { - m_engine = (TaskletEngine)componentManager. - lookup( "org.apache.ant.tasklet.engine.TaskletEngine" ); - } - - public void setLib( final String lib ) - { - m_lib = lib; - } - - public void run() - throws AntException - { - if( null == m_lib ) - { - throw new AntException( "Must specify lib parameter" ); - } - - URL url = null; - - final File lib = getContext().resolveFile( m_lib ); - try { url = lib.toURL(); } - catch( final MalformedURLException mue ) - { - throw new AntException( "Malformed task-lib parameter " + m_lib, mue ); - } - - try - { - m_engine.getTskDeployer().deploy( url.toString(), url ); - } - catch( final DeploymentException de ) - { - throw new AntException( "Error registering resource", de ); - } - } -} diff --git a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/SubElementTest.java b/proposal/myrmidon/src/java/org/apache/ant/tasks/core/SubElementTest.java deleted file mode 100644 index e580a35e4..000000000 --- a/proposal/myrmidon/src/java/org/apache/ant/tasks/core/SubElementTest.java +++ /dev/null @@ -1,43 +0,0 @@ - -/* - * 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.tasks.core; - -import org.apache.ant.AntException; -import org.apache.ant.tasklet.AbstractTasklet; - -/** - * @author Peter Donald - */ -public class SubElementTest - extends AbstractTasklet -{ - public static final class Beep - { - public void setMessage( final String string ) - { - System.out.println( string ); - } - } - - public Beep createCreateBeep() - { - System.out.println( "createCreateBeep()" ); - return new Beep(); - } - - public void addAddBeep( final Beep beep ) - { - System.out.println( "addBeeper(" + beep + ");" ); - } - - public void run() - throws AntException - { - } -}