git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269065 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -26,11 +26,6 @@ import org.apache.avalon.excalibur.cli.CLOptionDescriptor; | |||
| import org.apache.avalon.excalibur.cli.CLUtil; | |||
| import org.apache.avalon.excalibur.io.ExtensionFileFilter; | |||
| import org.apache.avalon.framework.ExceptionUtil; | |||
| import org.apache.avalon.framework.activity.Disposable; | |||
| import org.apache.avalon.framework.activity.Initializable; | |||
| import org.apache.avalon.framework.camelot.CamelotUtil; | |||
| import org.apache.avalon.framework.camelot.Deployer; | |||
| import org.apache.avalon.framework.camelot.DeploymentException; | |||
| import org.apache.avalon.framework.logger.AbstractLoggable; | |||
| import org.apache.avalon.framework.parameters.Parameters; | |||
| import org.apache.log.Hierarchy; | |||
| @@ -11,21 +11,21 @@ import java.io.File; | |||
| import java.net.MalformedURLException; | |||
| import java.net.URL; | |||
| import org.apache.ant.AntException; | |||
| import org.apache.myrmidon.api.AbstractTask; | |||
| import org.apache.ant.tasklet.engine.TskDeployer; | |||
| import org.apache.myrmidon.components.executor.Executor; | |||
| import org.apache.ant.tasklet.engine.DataTypeEngine; | |||
| import org.apache.avalon.framework.component.ComponentManager; | |||
| import org.apache.avalon.framework.camelot.RegistryException; | |||
| 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.RegistryException; | |||
| import org.apache.myrmidon.api.AbstractTask; | |||
| import org.apache.myrmidon.components.deployer.TskDeployer; | |||
| import org.apache.myrmidon.components.executor.Executor; | |||
| /** | |||
| * Method to register a single tasklet. | |||
| * | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public abstract class AbstractResourceRegisterer | |||
| public abstract class AbstractResourceRegisterer | |||
| extends AbstractTask | |||
| implements Composable | |||
| { | |||
| @@ -43,7 +43,7 @@ public abstract class AbstractResourceRegisterer | |||
| lookup( "org.apache.myrmidon.components.executor.Executor" ); | |||
| m_tskDeployer = (TskDeployer)componentManager. | |||
| lookup( "org.apache.ant.tasklet.engine.TskDeployer" ); | |||
| lookup( "org.apache.myrmidon.components.deployer.TskDeployer" ); | |||
| m_dataTypeEngine = (DataTypeEngine)componentManager. | |||
| lookup( "org.apache.ant.tasklet.engine.DataTypeEngine" ); | |||
| @@ -53,12 +53,12 @@ public abstract class AbstractResourceRegisterer | |||
| { | |||
| m_lib = lib; | |||
| } | |||
| public void setName( final String name ) | |||
| { | |||
| m_name = name; | |||
| } | |||
| public void setClassname( final String classname ) | |||
| { | |||
| m_classname = classname; | |||
| @@ -73,10 +73,10 @@ public abstract class AbstractResourceRegisterer | |||
| } | |||
| else if( null == m_lib && null == m_classname ) | |||
| { | |||
| throw new AntException( "Must specify classname if you don't specify " + | |||
| throw new AntException( "Must specify classname if you don't specify " + | |||
| "lib parameter" ); | |||
| } | |||
| final URL url = getURL( m_lib ); | |||
| try | |||
| @@ -14,7 +14,7 @@ import org.apache.ant.AntException; | |||
| import org.apache.ant.convert.engine.ConverterEngine; | |||
| import org.apache.ant.convert.engine.DefaultConverterInfo; | |||
| import org.apache.myrmidon.api.AbstractTask; | |||
| import org.apache.ant.tasklet.engine.TskDeployer; | |||
| import org.apache.myrmidon.components.deployer.TskDeployer; | |||
| import org.apache.avalon.framework.component.ComponentManager; | |||
| import org.apache.avalon.framework.component.ComponentException; | |||
| import org.apache.avalon.framework.component.Composable; | |||
| @@ -42,7 +42,7 @@ public class RegisterConverter | |||
| throws ComponentException | |||
| { | |||
| m_tskDeployer = (TskDeployer)componentManager. | |||
| lookup( "org.apache.ant.tasklet.engine.TskDeployer" ); | |||
| lookup( "org.apache.myrmidon.components.deployer.TskDeployer" ); | |||
| m_converterEngine = (ConverterEngine)componentManager. | |||
| lookup( "org.apache.ant.convert.engine.ConverterEngine" ); | |||
| @@ -11,25 +11,25 @@ import java.io.File; | |||
| import java.net.MalformedURLException; | |||
| import java.net.URL; | |||
| import org.apache.ant.AntException; | |||
| import org.apache.myrmidon.api.AbstractTask; | |||
| import org.apache.ant.tasklet.engine.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.DeploymentException; | |||
| import org.apache.myrmidon.api.AbstractTask; | |||
| import org.apache.myrmidon.components.deployer.TskDeployer; | |||
| /** | |||
| * Method to register a tasklib. | |||
| * | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public class RegisterTasklib | |||
| public class RegisterTasklib | |||
| extends AbstractTask | |||
| implements Composable | |||
| { | |||
| protected String m_lib; | |||
| protected TskDeployer m_tskDeployer; | |||
| public void compose( final ComponentManager componentManager ) | |||
| throws ComponentException | |||
| { | |||
| @@ -49,7 +49,7 @@ public class RegisterTasklib | |||
| { | |||
| throw new AntException( "Must specify lib parameter" ); | |||
| } | |||
| URL url = null; | |||
| final File lib = getContext().resolveFile( m_lib ); | |||
| @@ -7,7 +7,6 @@ | |||
| */ | |||
| package org.apache.myrmidon.api; | |||
| import org.apache.ant.AntException; | |||
| import org.apache.avalon.framework.activity.Disposable; | |||
| import org.apache.avalon.framework.activity.Initializable; | |||
| import org.apache.avalon.framework.context.Context; | |||
| @@ -46,6 +45,17 @@ public abstract class AbstractTask | |||
| { | |||
| } | |||
| /** | |||
| * Execute task. | |||
| * This method is called to perform actual work associated with task. | |||
| * It is called after Task has been Configured and Initialized and before | |||
| * beig Disposed (If task implements appropriate interfaces). | |||
| * | |||
| * @exception Exception if an error occurs | |||
| */ | |||
| public abstract void execute() | |||
| throws Exception; | |||
| /** | |||
| * This will be called after execute() method. | |||
| * Use this to clean up any resources associated with task. | |||
| @@ -5,7 +5,7 @@ | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.ant.tasklet.engine; | |||
| package org.apache.myrmidon.components.deployer; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| @@ -15,6 +15,7 @@ import java.util.Iterator; | |||
| import java.util.zip.ZipEntry; | |||
| import java.util.zip.ZipException; | |||
| import java.util.zip.ZipFile; | |||
| import org.apache.ant.tasklet.engine.DataTypeEngine; | |||
| import org.apache.ant.convert.engine.ConverterEngine; | |||
| import org.apache.ant.convert.engine.ConverterRegistry; | |||
| import org.apache.ant.convert.engine.DefaultConverterInfo; | |||
| @@ -32,6 +33,7 @@ import org.apache.avalon.framework.component.ComponentManager; | |||
| import org.apache.avalon.framework.component.Composable; | |||
| import org.apache.avalon.framework.configuration.Configuration; | |||
| import org.apache.avalon.framework.configuration.ConfigurationException; | |||
| import org.apache.avalon.framework.logger.Loggable; | |||
| import org.apache.log.Logger; | |||
| import org.apache.myrmidon.components.executor.Executor; | |||
| @@ -42,7 +44,7 @@ import org.apache.myrmidon.components.executor.Executor; | |||
| */ | |||
| public class DefaultTskDeployer | |||
| extends AbstractDeployer | |||
| implements Composable, TskDeployer | |||
| implements Composable, TskDeployer, Loggable | |||
| { | |||
| private final static String TSKDEF_FILE = "TASK-LIB/taskdefs.xml"; | |||
| @@ -253,7 +255,7 @@ public class DefaultTskDeployer | |||
| } | |||
| getLogger().debug( "Registered converter " + name + " that converts from " + | |||
| source + " to " + destination ); | |||
| source + " to " + destination ); | |||
| } | |||
| private void handleTask( final Configuration task, final URL url ) | |||
| @@ -5,12 +5,12 @@ | |||
| * version 1.1, a copy of which has been included with this distribution in | |||
| * the LICENSE file. | |||
| */ | |||
| package org.apache.ant.tasklet.engine; | |||
| package org.apache.myrmidon.components.deployer; | |||
| import java.net.URL; | |||
| import org.apache.avalon.framework.logger.Loggable; | |||
| import org.apache.avalon.framework.camelot.Deployer; | |||
| import org.apache.avalon.framework.camelot.DeploymentException; | |||
| import org.apache.avalon.framework.logger.Loggable; | |||
| import org.apache.log.Logger; | |||
| /** | |||
| @@ -19,13 +19,13 @@ import org.apache.log.Logger; | |||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | |||
| */ | |||
| public interface TskDeployer | |||
| extends Deployer, Loggable | |||
| extends Deployer | |||
| { | |||
| void deployConverter( String name, String location, URL url ) | |||
| throws DeploymentException; | |||
| void deployDataType( String name, String location, URL url ) | |||
| throws DeploymentException; | |||
| throws DeploymentException; | |||
| void deployTask( String name, String location, URL url ) | |||
| throws DeploymentException; | |||
| @@ -11,7 +11,6 @@ import java.io.File; | |||
| import org.apache.ant.AntException; | |||
| import org.apache.ant.convert.engine.ConverterEngine; | |||
| import org.apache.ant.tasklet.engine.DataTypeEngine; | |||
| import org.apache.ant.tasklet.engine.TskDeployer; | |||
| import org.apache.avalon.excalibur.io.FileUtil; | |||
| import org.apache.avalon.framework.activity.Initializable; | |||
| import org.apache.avalon.framework.camelot.CamelotUtil; | |||
| @@ -29,6 +28,7 @@ import org.apache.myrmidon.components.builder.ProjectBuilder; | |||
| import org.apache.myrmidon.components.configurer.Configurer; | |||
| import org.apache.myrmidon.components.executor.Executor; | |||
| import org.apache.myrmidon.components.manager.ProjectManager; | |||
| import org.apache.myrmidon.components.deployer.TskDeployer; | |||
| /** | |||
| * Default implementation of Ant runtime. | |||
| @@ -178,7 +178,7 @@ public class MyrmidonEmbeddor | |||
| defaults.setParameter( "ant.comp.builder", | |||
| "org.apache.myrmidon.components.builder.DefaultProjectBuilder" ); | |||
| defaults.setParameter( "ant.comp.deployer", | |||
| "org.apache.ant.tasklet.engine.DefaultTskDeployer" ); | |||
| "org.apache.myrmidon.components.deployer.DefaultTskDeployer" ); | |||
| defaults.setParameter( "ant.comp.configurer", | |||
| "org.apache.myrmidon.components.configurer.DefaultConfigurer" ); | |||
| @@ -194,15 +194,20 @@ public class MyrmidonEmbeddor | |||
| { | |||
| final DefaultComponentManager componentManager = new DefaultComponentManager(); | |||
| componentManager.put( "org.apache.myrmidon.components.manager.ProjectManager", m_projectEngine ); | |||
| componentManager.put( "org.apache.ant.convert.engine.ConverterEngine", | |||
| m_converterEngine ); | |||
| componentManager.put( "org.apache.ant.convert.Converter", m_converterEngine ); | |||
| componentManager.put( "org.apache.ant.tasklet.engine.DataTypeEngine", m_dataTypeEngine ); | |||
| componentManager.put( "org.apache.myrmidon.components.builder.ProjectBuilder", m_builder ); | |||
| componentManager.put( "org.apache.ant.tasklet.engine.TskDeployer", m_deployer ); | |||
| componentManager.put( "org.apache.avalon.framework.camelot.Factory", m_factory ); | |||
| //Following components required when Myrmidon is used as build tool | |||
| componentManager.put( "org.apache.myrmidon.components.manager.ProjectManager", m_projectEngine ); | |||
| componentManager.put( "org.apache.myrmidon.components.builder.ProjectBuilder", m_builder ); | |||
| //Following components required when Myrmidon allows user deployment of tasks etal. | |||
| componentManager.put( "org.apache.myrmidon.components.deployer.TskDeployer", m_deployer ); | |||
| //Following components required when allowing Container tasks | |||
| componentManager.put( "org.apache.myrmidon.components.configurer.Configurer", m_configurer ); | |||
| componentManager.put( "org.apache.myrmidon.components.executor.Executor", m_executor ); | |||