git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269074 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -45,9 +45,8 @@ public class AntCall | |||||
| throws ComponentException | throws ComponentException | ||||
| { | { | ||||
| m_componentManager = componentManager; | m_componentManager = componentManager; | ||||
| m_projectEngine = (ProjectManager)componentManager. | |||||
| lookup( "org.apache.myrmidon.components.manager.ProjectManager" ); | |||||
| m_project = (Project)componentManager.lookup( "org.apache.ant.project.Project" ); | |||||
| m_projectEngine = (ProjectManager)componentManager.lookup( ProjectManager.ROLE ); | |||||
| m_project = (Project)componentManager.lookup( Project.ROLE ); | |||||
| } | } | ||||
| public void setTarget( final String target ) | public void setTarget( final String target ) | ||||
| @@ -42,8 +42,7 @@ public class Property | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| { | { | ||||
| m_configurer = (Configurer)componentManager. | |||||
| lookup( "org.apache.myrmidon.components.configurer.Configurer" ); | |||||
| m_configurer = (Configurer)componentManager.lookup( Configurer.ROLE ); | |||||
| m_engine = (DataTypeEngine)componentManager. | m_engine = (DataTypeEngine)componentManager. | ||||
| lookup( "org.apache.ant.tasklet.engine.DataTypeEngine" ); | lookup( "org.apache.ant.tasklet.engine.DataTypeEngine" ); | ||||
| @@ -39,11 +39,8 @@ public abstract class AbstractResourceRegisterer | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| { | { | ||||
| m_engine = (Executor)componentManager. | |||||
| lookup( "org.apache.myrmidon.components.executor.Executor" ); | |||||
| m_tskDeployer = (TskDeployer)componentManager. | |||||
| lookup( "org.apache.myrmidon.components.deployer.TskDeployer" ); | |||||
| m_engine = (Executor)componentManager.lookup( Executor.ROLE ); | |||||
| m_tskDeployer = (TskDeployer)componentManager.lookup( TskDeployer.ROLE ); | |||||
| m_dataTypeEngine = (DataTypeEngine)componentManager. | m_dataTypeEngine = (DataTypeEngine)componentManager. | ||||
| lookup( "org.apache.ant.tasklet.engine.DataTypeEngine" ); | lookup( "org.apache.ant.tasklet.engine.DataTypeEngine" ); | ||||
| @@ -41,8 +41,7 @@ public class RegisterConverter | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| { | { | ||||
| m_tskDeployer = (TskDeployer)componentManager. | |||||
| lookup( "org.apache.myrmidon.components.deployer.TskDeployer" ); | |||||
| m_tskDeployer = (TskDeployer)componentManager.lookup( TskDeployer.ROLE ); | |||||
| m_converterEngine = (ConverterEngine)componentManager. | m_converterEngine = (ConverterEngine)componentManager. | ||||
| lookup( "org.apache.ant.convert.engine.ConverterEngine" ); | lookup( "org.apache.ant.convert.engine.ConverterEngine" ); | ||||
| @@ -33,8 +33,7 @@ public class RegisterTasklib | |||||
| public void compose( final ComponentManager componentManager ) | public void compose( final ComponentManager componentManager ) | ||||
| throws ComponentException | throws ComponentException | ||||
| { | { | ||||
| m_tskDeployer = (TskDeployer)componentManager. | |||||
| lookup( "org.apache.ant.tasklet.engine.TskDeployer" ); | |||||
| m_tskDeployer = (TskDeployer)componentManager.lookup( TskDeployer.ROLE ); | |||||
| } | } | ||||
| public void setLib( final String lib ) | public void setLib( final String lib ) | ||||
| @@ -41,7 +41,6 @@ import org.apache.myrmidon.components.embeddor.MyrmidonEmbeddor; | |||||
| import org.apache.myrmidon.components.manager.LogTargetToListenerAdapter; | import org.apache.myrmidon.components.manager.LogTargetToListenerAdapter; | ||||
| import org.apache.myrmidon.components.manager.ProjectManager; | import org.apache.myrmidon.components.manager.ProjectManager; | ||||
| import org.apache.myrmidon.components.model.Project; | import org.apache.myrmidon.components.model.Project; | ||||
| import org.apache.myrmidon.launcher.LauncherClassLoader; | |||||
| import org.apache.myrmidon.listeners.ProjectListener; | import org.apache.myrmidon.listeners.ProjectListener; | ||||
| /** | /** | ||||
| @@ -282,8 +281,6 @@ public class Main | |||||
| throw new Exception( "myrmidon-home (" + homeDir + ") is not a directory" ); | throw new Exception( "myrmidon-home (" + homeDir + ") is not a directory" ); | ||||
| } | } | ||||
| final File libDir = new File( homeDir, "lib" ); | |||||
| final String filename = m_parameters.getParameter( "filename", null ); | final String filename = m_parameters.getParameter( "filename", null ); | ||||
| final File buildFile = (new File( filename )).getCanonicalFile(); | final File buildFile = (new File( filename )).getCanonicalFile(); | ||||
| if( !buildFile.isFile() ) | if( !buildFile.isFile() ) | ||||
| @@ -20,6 +20,8 @@ import org.apache.myrmidon.components.model.Project; | |||||
| public interface ProjectBuilder | public interface ProjectBuilder | ||||
| extends Component | extends Component | ||||
| { | { | ||||
| String ROLE = "org.apache.myrmidon.components.builder.ProjectBuilder"; | |||||
| /** | /** | ||||
| * build a project from source. | * build a project from source. | ||||
| * | * | ||||
| @@ -20,6 +20,8 @@ import org.apache.avalon.framework.context.Context; | |||||
| public interface Configurer | public interface Configurer | ||||
| extends Component | extends Component | ||||
| { | { | ||||
| String ROLE = "org.apache.myrmidon.components.configurer.Configurer"; | |||||
| /** | /** | ||||
| * Configure an object based on a configuration in a particular context. | * Configure an object based on a configuration in a particular context. | ||||
| * This configuring can be done in different ways for different | * This configuring can be done in different ways for different | ||||
| @@ -73,8 +73,7 @@ public class DefaultTskDeployer | |||||
| throws ComponentException | throws ComponentException | ||||
| { | { | ||||
| //UGLY HACK alert !!! | //UGLY HACK alert !!! | ||||
| final Executor executor = (Executor)componentManager. | |||||
| lookup( "org.apache.myrmidon.components.executor.Executor" ); | |||||
| final Executor executor = (Executor)componentManager.lookup( Executor.ROLE ); | |||||
| m_taskRegistry = executor.getRegistry(); | m_taskRegistry = executor.getRegistry(); | ||||
| final ConverterEngine converterEngine = (ConverterEngine)componentManager. | final ConverterEngine converterEngine = (ConverterEngine)componentManager. | ||||
| @@ -10,8 +10,6 @@ package org.apache.myrmidon.components.deployer; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import org.apache.avalon.framework.camelot.Deployer; | import org.apache.avalon.framework.camelot.Deployer; | ||||
| import org.apache.avalon.framework.camelot.DeploymentException; | import org.apache.avalon.framework.camelot.DeploymentException; | ||||
| import org.apache.avalon.framework.logger.Loggable; | |||||
| import org.apache.log.Logger; | |||||
| /** | /** | ||||
| * This class deploys a .tsk file into a registry. | * This class deploys a .tsk file into a registry. | ||||
| @@ -21,6 +19,8 @@ import org.apache.log.Logger; | |||||
| public interface TskDeployer | public interface TskDeployer | ||||
| extends Deployer | extends Deployer | ||||
| { | { | ||||
| String ROLE = "org.apache.myrmidon.components.deployer.TskDeployer"; | |||||
| void deployConverter( String name, String location, URL url ) | void deployConverter( String name, String location, URL url ) | ||||
| throws DeploymentException; | throws DeploymentException; | ||||
| @@ -23,6 +23,8 @@ import org.apache.myrmidon.components.manager.ProjectManager; | |||||
| public interface Embeddor | public interface Embeddor | ||||
| extends Component, Parameterizable, Initializable, Startable, Disposable | extends Component, Parameterizable, Initializable, Startable, Disposable | ||||
| { | { | ||||
| String ROLE = "org.apache.myrmidon.components.embeddor.Embeddor"; | |||||
| /** | /** | ||||
| * Retrieve builder for runtime. | * Retrieve builder for runtime. | ||||
| * Valid after initialize() call | * Valid after initialize() call | ||||
| @@ -200,15 +200,15 @@ public class MyrmidonEmbeddor | |||||
| componentManager.put( "org.apache.avalon.framework.camelot.Factory", m_factory ); | componentManager.put( "org.apache.avalon.framework.camelot.Factory", m_factory ); | ||||
| //Following components required when Myrmidon is used as build tool | //Following components required when Myrmidon is used as build tool | ||||
| componentManager.put( "org.apache.myrmidon.components.manager.ProjectManager", m_projectManager ); | |||||
| componentManager.put( "org.apache.myrmidon.components.builder.ProjectBuilder", m_builder ); | |||||
| componentManager.put( ProjectManager.ROLE, m_projectManager ); | |||||
| componentManager.put( ProjectBuilder.ROLE, m_builder ); | |||||
| //Following components required when Myrmidon allows user deployment of tasks etal. | //Following components required when Myrmidon allows user deployment of tasks etal. | ||||
| componentManager.put( "org.apache.myrmidon.components.deployer.TskDeployer", m_deployer ); | |||||
| componentManager.put( TskDeployer.ROLE, m_deployer ); | |||||
| //Following components required when allowing Container tasks | //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 ); | |||||
| componentManager.put( Configurer.ROLE, m_configurer ); | |||||
| componentManager.put( Executor.ROLE, m_executor ); | |||||
| return componentManager; | return componentManager; | ||||
| } | } | ||||
| @@ -64,8 +64,7 @@ public class DefaultExecutor | |||||
| m_factory = (Factory)componentManager.lookup( "org.apache.avalon.framework.camelot.Factory" ); | m_factory = (Factory)componentManager.lookup( "org.apache.avalon.framework.camelot.Factory" ); | ||||
| m_configurer = (Configurer)componentManager. | |||||
| lookup( "org.apache.myrmidon.components.configurer.Configurer" ); | |||||
| m_configurer = (Configurer)componentManager.lookup( Configurer.ROLE ); | |||||
| } | } | ||||
| public void execute( final Configuration taskData, final TaskContext context ) | public void execute( final Configuration taskData, final TaskContext context ) | ||||
| @@ -21,6 +21,8 @@ import org.apache.myrmidon.api.TaskException; | |||||
| public interface Executor | public interface Executor | ||||
| extends Component | extends Component | ||||
| { | { | ||||
| String ROLE = "org.apache.myrmidon.components.executor.Executor"; | |||||
| /** | /** | ||||
| * Retrieve locator registry associated with engine. | * Retrieve locator registry associated with engine. | ||||
| * TODO: Remove this as it violates IOC | * TODO: Remove this as it violates IOC | ||||
| @@ -70,8 +70,7 @@ public class DefaultProjectManager | |||||
| throws ComponentException | throws ComponentException | ||||
| { | { | ||||
| m_componentManager = (DefaultComponentManager)componentManager; | m_componentManager = (DefaultComponentManager)componentManager; | ||||
| m_executor = (Executor)componentManager. | |||||
| lookup( "org.apache.myrmidon.components.executor.Executor" ); | |||||
| m_executor = (Executor)componentManager.lookup( Executor.ROLE ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -86,7 +85,7 @@ public class DefaultProjectManager | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| //HACK: should do this a better way !!!!!! | //HACK: should do this a better way !!!!!! | ||||
| m_componentManager.put( "org.apache.ant.project.Project", project ); | |||||
| m_componentManager.put( Project.ROLE, project ); | |||||
| m_listenerSupport.projectStarted(); | m_listenerSupport.projectStarted(); | ||||
| @@ -22,6 +22,8 @@ import org.apache.myrmidon.listeners.ProjectListener; | |||||
| public interface ProjectManager | public interface ProjectManager | ||||
| extends Component | extends Component | ||||
| { | { | ||||
| String ROLE = "org.apache.myrmidon.components.manager.ProjectManager"; | |||||
| /** | /** | ||||
| * Add a listener to project events. | * Add a listener to project events. | ||||
| * | * | ||||
| @@ -22,6 +22,8 @@ import org.apache.avalon.framework.component.Component; | |||||
| public interface Project | public interface Project | ||||
| extends Component | extends Component | ||||
| { | { | ||||
| String ROLE = "org.apache.myrmidon.components.model.Project"; | |||||
| // the name of currently executing project | // the name of currently executing project | ||||
| String PROJECT = "ant.project.name"; | String PROJECT = "ant.project.name"; | ||||
| @@ -19,6 +19,8 @@ import org.apache.avalon.framework.configuration.Configuration; | |||||
| public interface Target | public interface Target | ||||
| extends Component | extends Component | ||||
| { | { | ||||
| String ROLE = "org.apache.myrmidon.components.model.Target"; | |||||
| /** | /** | ||||
| * Get dependencies of target | * Get dependencies of target | ||||
| * | * | ||||