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/05/21 03:53:03 UTC

cvs commit: jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test DefaultEmbeddorTest.java

donaldp     02/05/20 18:53:03

  Modified:    container/src/java/org/apache/myrmidon/interfaces/oldmodel
                        Project.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultWorkspace.java
               container/src/java/org/apache/myrmidon/components/builder
                        DefaultProject.java
               container/src/test/org/apache/myrmidon/components/embeddor/test
                        DefaultEmbeddorTest.java
  Log:
  First step at reconciling the new Model and the old model.
  
  Made Project implement Module and Targets implement TargetMetaData. It is an ugly hack but it is a start
  
  Revision  Changes    Path
  1.5       +2 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel/Project.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Project.java	21 May 2002 01:00:29 -0000	1.4
  +++ Project.java	21 May 2002 01:53:03 -0000	1.5
  @@ -14,7 +14,7 @@
    * Implementations may choose to structure it anyway they choose.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.4 $ $Date: 2002/05/21 01:00:29 $
  + * @version $Revision: 1.5 $ $Date: 2002/05/21 01:53:03 $
    */
   public interface Project
   {
  @@ -30,7 +30,7 @@
        * TODO: Determine if projects should carry their own name. Breaks IOC but
        * Can be useful as project files embed own name (or should that be description).
        */
  -    String getProjectName();
  +    String getName();
   
       String getURI();
   
  
  
  
  1.61      +2 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java
  
  Index: DefaultWorkspace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- DefaultWorkspace.java	21 May 2002 01:08:44 -0000	1.60
  +++ DefaultWorkspace.java	21 May 2002 01:53:03 -0000	1.61
  @@ -31,7 +31,7 @@
    * This is the default implementation of Workspace.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.60 $ $Date: 2002/05/21 01:08:44 $
  + * @version $Revision: 1.61 $ $Date: 2002/05/21 01:53:03 $
    */
   public class DefaultWorkspace
       extends AbstractLogEnabled
  @@ -136,7 +136,7 @@
           serviceManager.put( Project.ROLE, project );
   
           final ExecutionFrame frame =
  -            m_frame.createChildFrame( project.getProjectName(),
  +            m_frame.createChildFrame( project.getName(),
                                         project.getBaseDirectory(),
                                         serviceManager,
                                         true );
  
  
  
  1.9       +67 -10    jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProject.java
  
  Index: DefaultProject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProject.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultProject.java	21 May 2002 01:03:02 -0000	1.8
  +++ DefaultProject.java	21 May 2002 01:53:03 -0000	1.9
  @@ -9,19 +9,24 @@
   
   import java.io.File;
   import java.util.HashMap;
  +import java.util.Collection;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.myrmidon.interfaces.oldmodel.Project;
   import org.apache.myrmidon.interfaces.oldmodel.Target;
  +import org.apache.myrmidon.interfaces.model.Module;
  +import org.apache.myrmidon.interfaces.model.TargetMetaData;
  +import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.api.TaskException;
   
   /**
    * Default project implementation.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.8 $ $Date: 2002/05/21 01:03:02 $
  + * @version $Revision: 1.9 $ $Date: 2002/05/21 01:53:03 $
    */
   public class DefaultProject
  -    implements Project
  +    implements Project, Module, TargetMetaData
   {
       private static final Resources REZ =
           ResourceManager.getPackageResources( DefaultProject.class );
  @@ -60,14 +65,6 @@
           m_defaultTarget = defaultTarget;
       }
   
  -    /**
  -     * @return the project name.
  -     */
  -    public String getProjectName()
  -    {
  -        return m_name;
  -    }
  -
       public String getURI()
       {
           return m_uri;
  @@ -194,5 +191,65 @@
           {
               m_projects.put( name, project );
           }
  +    }
  +
  +    /**
  +     * Retrieve the name of the Target.
  +     *
  +     * @return the name of the Target.
  +     */
  +    public String getName()
  +    {
  +        return m_name;
  +    }
  +
  +    /**
  +     * Retrieve a description of the target.
  +     *
  +     * @return a description of the target.
  +     */
  +    public String getDescription()
  +    {
  +        return null;
  +    }
  +
  +    /**
  +     * Return an array of child targets.
  +     * Must return a non-null value, even when there
  +     * are no child targets.
  +     *
  +     * @return a non-null array of child targets.
  +     */
  +    public TargetMetaData[] getTargets()
  +    {
  +        final Collection targets = m_targets.values();
  +        return (TargetMetaData[])targets.toArray( new TargetMetaData[ targets.size() ] );
  +    }
  +
  +    /**
  +     * Retrieve MetaData associated with Module.
  +     * The primary purpose of the MetaData is to
  +     * enable a decent UI to run the Module.
  +     *
  +     * @return the MetaData for Module
  +     */
  +    public TargetMetaData getMetaData()
  +    {
  +        return this;
  +    }
  +
  +    /**
  +     * Execute the specified target in module
  +     * using specified {@link ExecutionFrame}.
  +     *
  +     * @param frame the frame in which to execute
  +     * @param target the target to execute
  +     * @throws TaskException if an error occurs executing module
  +     */
  +    public void execute( ExecutionFrame frame,
  +                         TargetMetaData target )
  +        throws TaskException
  +    {
  +        //DO nothing ... for now
       }
   }
  
  
  
  1.12      +2 -2      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java
  
  Index: DefaultEmbeddorTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultEmbeddorTest.java	18 May 2002 04:07:44 -0000	1.11
  +++ DefaultEmbeddorTest.java	21 May 2002 01:53:03 -0000	1.12
  @@ -24,7 +24,7 @@
    * Test cases for the default embeddor.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.11 $ $Date: 2002/05/18 04:07:44 $
  + * @version $Revision: 1.12 $ $Date: 2002/05/21 01:53:03 $
    */
   public class DefaultEmbeddorTest
       extends AbstractContainerTestCase
  @@ -83,7 +83,7 @@
           final Project project = getEmbeddor().createProject( projectFile.getAbsolutePath(), null, null );
   
           // Verify the project.
  -        assertEquals( "test-project", project.getProjectName() );
  +        assertEquals( "test-project", project.getName() );
           assertEquals( "main-target", project.getDefaultTargetName() );
           assertEquals( projectFile.getParentFile(), project.getBaseDirectory() );
           assertEquals( 0, project.getProjectNames().length );
  
  
  

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