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/java/org/apache/myrmidon/components/builder DefaultProjectBuilder.java DefaultProject.java
Date Tue, 21 May 2002 01:03:02 GMT
donaldp     02/05/20 18:03:02

  Modified:    container/src/java/org/apache/myrmidon/components/builder
                        DefaultProjectBuilder.java DefaultProject.java
  Log:
  Make each project contain its own URI
  
  Also set various immutable attributes in constructor and thus remove setters from DefaultProject
  
  Revision  Changes    Path
  1.53      +23 -7     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.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- DefaultProjectBuilder.java	21 May 2002 00:31:00 -0000	1.52
  +++ DefaultProjectBuilder.java	21 May 2002 01:03:02 -0000	1.53
  @@ -8,6 +8,7 @@
   package org.apache.myrmidon.components.builder;
   
   import java.io.File;
  +import java.io.IOException;
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Map;
  @@ -33,7 +34,7 @@
    * Default implementation to construct project from a build file.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.52 $ $Date: 2002/05/21 00:31:00 $
  + * @version $Revision: 1.53 $ $Date: 2002/05/21 01:03:02 $
    *
    * @ant.type type="project-builder" name="ant2"
    */
  @@ -153,6 +154,7 @@
           final String baseDirectoryName = model.getAttribute( "basedir" );
           final String defaultTarget = model.getAttribute( "default", "main" );
           final Version version = getVersion( model );
  +        final String uri = getURI( file );
   
           if( !VERSION.complies( version ) )
           {
  @@ -177,13 +179,27 @@
               getLogger().debug( message );
           }
   
  -        //create project and ...
  -        final DefaultProject project = new DefaultProject();
  -        project.setProjectName( projectName );
  -        project.setDefaultTargetName( defaultTarget );
  -        project.setBaseDirectory( baseDirectory );
  +        return new DefaultProject( projectName, uri, baseDirectory, defaultTarget );
  +    }
   
  -        return project;
  +    /**
  +     * Get the URI for specified file.
  +     *
  +     * @param file the file
  +     * @return  the URI for file
  +     * @throws ProjectException on error
  +     */
  +    private String getURI( final File file )
  +        throws ProjectException
  +    {
  +        try
  +        {
  +            return file.getCanonicalFile().toURL().toExternalForm();
  +        }
  +        catch( final IOException ioe )
  +        {
  +            throw new ProjectException( ioe.getMessage(), ioe );
  +        }
       }
   
       /**
  
  
  
  1.8       +19 -26    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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultProject.java	12 May 2002 11:18:39 -0000	1.7
  +++ DefaultProject.java	21 May 2002 01:03:02 -0000	1.8
  @@ -18,7 +18,7 @@
    * Default project implementation.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.7 $ $Date: 2002/05/12 11:18:39 $
  + * @version $Revision: 1.8 $ $Date: 2002/05/21 01:03:02 $
    */
   public class DefaultProject
       implements Project
  @@ -45,6 +45,22 @@
       private String m_name;
   
       /**
  +     * The URI of this project file.
  +     */
  +    private String m_uri;
  +
  +    public DefaultProject( final String name,
  +                           final String uri,
  +                           final File baseDirectory,
  +                           final String defaultTarget )
  +    {
  +        m_name = name;
  +        m_uri = uri;
  +        m_baseDirectory = baseDirectory;
  +        m_defaultTarget = defaultTarget;
  +    }
  +
  +    /**
        * @return the project name.
        */
       public String getProjectName()
  @@ -52,13 +68,9 @@
           return m_name;
       }
   
  -    /**
  -     * Sets the project name.
  -     * @param name the project name
  -     */
  -    public void setProjectName( String name )
  +    public String getURI()
       {
  -        m_name = name;
  +        return m_uri;
       }
   
       /**
  @@ -142,25 +154,6 @@
       public final String[] getTargetNames()
       {
           return (String[])m_targets.keySet().toArray( new String[ 0 ] );
  -    }
  -
  -    /**
  -     * Set DefaultTargetName.
  -     *
  -     * @param defaultTarget the default target name
  -     */
  -    public final void setDefaultTargetName( final String defaultTarget )
  -    {
  -        m_defaultTarget = defaultTarget;
  -    }
  -
  -    /**
  -     * Sets the project base directory.
  -     * @param baseDirectory the base directory for the project
  -     */
  -    public final void setBaseDirectory( final File baseDirectory )
  -    {
  -        m_baseDirectory = baseDirectory;
       }
   
       /**
  
  
  

--
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