ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test DefaultProjectBuilderTestCase.java
Date Tue, 11 Jun 2002 01:40:32 GMT
donaldp     2002/06/10 18:40:32

  Modified:    container/src/java/org/apache/myrmidon/components/builder
                        DefaultProject.java DefaultProjectBuilder.java
               container/src/test/org/apache/myrmidon/components/builder/test
                        DefaultProjectBuilderTestCase.java
  Removed:     container/src/java/org/apache/myrmidon/components/builder
                        Target.java
  Log:
  Zap the Target object in preparation for something else
  
  Revision  Changes    Path
  1.26      +29 -44    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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- DefaultProject.java	9 Jun 2002 04:53:34 -0000	1.25
  +++ DefaultProject.java	11 Jun 2002 01:40:32 -0000	1.26
  @@ -32,7 +32,7 @@
    */
   public class DefaultProject
       extends AbstractLogEnabled
  -    implements Project, TargetMetaData
  +    implements Project
   {
       private static final Resources REZ =
           ResourceManager.getPackageResources( DefaultProject.class );
  @@ -58,10 +58,16 @@
       private final Map m_references = new HashMap();
   
       /**
  -     * The targets contained by this project
  +     * The target meta data contained by this project
        */
       private final Map m_targets = new HashMap();
   
  +    /**
  +     * The targets models by this project
  +     */
  +    private final Map m_models = new HashMap();
  +
  +    private DefaultTargetMetaData m_metaData;
       private final ProjectDescriptor m_descriptor;
   
       public DefaultProject( final String name,
  @@ -83,12 +89,13 @@
           m_references.put( ref.getName(), ref );
       }
   
  -    /**
  -     * Adds a target to this project.
  -     */
  -    public void addTarget( final TargetMetaData target )
  +    public void addTarget( final ModelElement model )
       {
  -        m_targets.put( target.getName(), target );
  +        final String name = model.getAttribute( "name" );
  +        final String description = model.getAttribute( "description" );
  +        final DefaultTargetMetaData metaData = new DefaultTargetMetaData( name, description
);
  +        m_targets.put( metaData.getName(), metaData );
  +        m_models.put( metaData.getName(), model );
       }
   
       public ProjectDescriptor getProjectDescriptor()
  @@ -151,13 +158,13 @@
       public final ModelElement getTargetModel( final String targetName )
           throws TaskException
       {
  -        final Target target = (Target)m_targets.get( targetName );
  +        final ModelElement target = (ModelElement)m_models.get( targetName );
           if( target == null )
           {
               final String message = REZ.getString( "project.unknown-target.error", targetName
);
               throw new TaskException( message );
           }
  -        return target.getModel();
  +        return target;
       }
   
       /**
  @@ -171,39 +178,6 @@
       }
   
       /**
  -     * Retrieve the name of the Target.
  -     *
  -     * @return the name of the Target.
  -     */
  -    public String getName()
  -    {
  -        return m_defaultTarget;
  -    }
  -
  -    /**
  -     * 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.
  @@ -212,7 +186,18 @@
        */
       public TargetMetaData getMetaData()
       {
  -        return this;
  +        if( null == m_metaData )
  +        {
  +            final Collection targets = m_targets.values();
  +            final TargetMetaData[] targetMetaDatas =
  +                (TargetMetaData[])targets.toArray( new TargetMetaData[ targets.size() ]
);
  +
  +            m_metaData =
  +                new DefaultTargetMetaData( m_defaultTarget,
  +                                           null,
  +                                           targetMetaDatas );
  +        }
  +        return m_metaData;
       }
   
       public void execute( final ExecutionFrame frame,
  
  
  
  1.72      +3 -6      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java
  
  Index: DefaultProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- DefaultProjectBuilder.java	9 Jun 2002 04:53:34 -0000	1.71
  +++ DefaultProjectBuilder.java	11 Jun 2002 01:40:32 -0000	1.72
  @@ -23,7 +23,6 @@
   import org.apache.myrmidon.interfaces.builder.ModelBuilder;
   import org.apache.myrmidon.interfaces.builder.ProjectBuilder;
   import org.apache.myrmidon.interfaces.builder.ProjectException;
  -import org.apache.myrmidon.interfaces.embeddor.Embeddor;
   import org.apache.myrmidon.interfaces.oldmodel.Project;
   import org.apache.myrmidon.interfaces.property.NameValidator;
   import org.apache.myrmidon.interfaces.property.NameValidatorManager;
  @@ -55,12 +54,10 @@
       // Use a name validator with the default rules.
       private NameValidator m_nameValidator;
       private ModelBuilder m_modelBuilder;
  -    private Embeddor m_embeddor;
   
       public void service( final ServiceManager manager )
           throws ServiceException
       {
  -        m_embeddor = (Embeddor)manager.lookup( Embeddor.ROLE );
           m_modelBuilder = (ModelBuilder)manager.lookup( ModelBuilder.ROLE );
           final NameValidatorManager validatorManager =
               (NameValidatorManager)manager.lookup( NameValidatorManager.ROLE );
  @@ -363,7 +360,7 @@
   
               if( name.equals( "target" ) )
               {
  -                project.addTarget( new Target( createTargetModel( element ) ) );
  +                project.addTarget( createTargetModel( element ) );
               }
               else
               {
  @@ -373,7 +370,7 @@
                   throw new ProjectException( message );
               }
           }
  -        project.addTarget( new Target( createTargetModel( implicit ) ) );
  +        project.addTarget( createTargetModel( implicit ) );
       }
   
       private ProjectRef buildProjectRef( final File baseDirectory,
  
  
  
  1.16      +2 -3      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java
  
  Index: DefaultProjectBuilderTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DefaultProjectBuilderTestCase.java	9 Jun 2002 04:53:35 -0000	1.15
  +++ DefaultProjectBuilderTestCase.java	11 Jun 2002 01:40:32 -0000	1.16
  @@ -21,7 +21,6 @@
   import org.apache.myrmidon.interfaces.builder.ProjectException;
   import org.apache.myrmidon.interfaces.model.TargetMetaData;
   import org.apache.myrmidon.interfaces.oldmodel.Project;
  -import org.apache.myrmidon.components.builder.Target;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   import org.apache.myrmidon.api.metadata.ModelElement;
  @@ -164,7 +163,7 @@
       {
           final ModelElement model = new ModelElement( "target", "" );
           model.setAttribute( "name", name );
  -        project.addTarget( new Target( model ) );
  +        project.addTarget( model );
       }
   
       private String getNameFor( final File projFile )
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message