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/antlib/src/java/org/apache/antlib/project ProjectRefTask.java
Date Thu, 04 Jul 2002 07:44:17 GMT
donaldp     2002/07/04 00:44:17

  Modified:    framework/src/java/org/apache/myrmidon/framework/project
                        AbstractWorkspaceTask.java
               antlib/src/test/org/apache/antlib/project/test ant-call.ant
                        projectref.ant
               ant1compat/src/java/org/apache/tools/ant/taskdefs
                        CallTarget.java
               container/src/java/org/apache/myrmidon/components/workspace
                        DefaultWorkspace.java ProjectEntry.java
               container/src/java/org/apache/myrmidon/interfaces/workspace
                        ProjectRef.java
               antlib/src/java/org/apache/antlib/project
                        ProjectRefTask.java
  Removed:     container/src/java/org/apache/myrmidon/interfaces/workspace
                        ProjectRefSet.java
  Log:
  Place ProjectRef directly in PropertyStore rather than in ProjectRefSet
  
  Revision  Changes    Path
  1.7       +7 -5      jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/AbstractWorkspaceTask.java
  
  Index: AbstractWorkspaceTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/AbstractWorkspaceTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractWorkspaceTask.java	2 Jul 2002 14:41:07 -0000	1.6
  +++ AbstractWorkspaceTask.java	4 Jul 2002 07:44:16 -0000	1.7
  @@ -12,7 +12,6 @@
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.framework.AbstractContainerTask;
   import org.apache.myrmidon.interfaces.workspace.ProjectRef;
  -import org.apache.myrmidon.interfaces.workspace.ProjectRefSet;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   import org.apache.myrmidon.interfaces.workspace.Workspace;
   
  @@ -75,9 +74,12 @@
       protected ProjectDescriptor getProjectDescriptor( final String projectName )
           throws TaskException
       {
  -        final ProjectRefSet projectRefs =
  -            (ProjectRefSet)getContext().getProperty( ProjectRefSet.KEY );
  -        final ProjectRef projectRef = projectRefs.getProjectRef( projectName );
  +        String key = ProjectRef.KEY;
  +        if( null != projectName )
  +        {
  +            key += "-" + projectName;
  +        }
  +        final ProjectRef projectRef = (ProjectRef)getContext().getProperty( key );
           if( null == projectRef )
           {
               final String message =
  
  
  
  1.6       +1 -1      jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/project/test/ant-call.ant
  
  Index: ant-call.ant
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/project/test/ant-call.ant,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ant-call.ant	2 Jul 2002 14:41:08 -0000	1.5
  +++ ant-call.ant	4 Jul 2002 07:44:16 -0000	1.6
  @@ -107,7 +107,7 @@
       <target name="ref-unknown-target">
           <expect-error>
               <exc>Execution of target "common/no-such-target" in project "${myrmidon.project/projectDescriptor/uri}"
failed.</exc>
  -            <exc>No target named "no-such-target" in project "${myrmidon.projectrefs/projectRefs/common/project/uri}".</exc>
  +            <exc>No target named "no-such-target" in project "${myrmidon.project-ref-common/project/uri}".</exc>
               <tasks>
                   <ant-call targets="common/no-such-target"/>
               </tasks>
  
  
  
  1.3       +1 -1      jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/project/test/projectref.ant
  
  Index: projectref.ant
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/project/test/projectref.ant,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- projectref.ant	2 Jul 2002 14:41:08 -0000	1.2
  +++ projectref.ant	4 Jul 2002 07:44:16 -0000	1.3
  @@ -52,7 +52,7 @@
       <!-- Use the reference to this project -->
       <target name="self-ref">
           <assert><not><is-set property="target1"/></not></assert>
  -        <depends target="projectref/target1"/>
  +        <depends target="target1"/>
           <assert><is-set property="target1"/></assert>
       </target>
   
  
  
  
  1.10      +2 -3      jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/taskdefs/CallTarget.java
  
  Index: CallTarget.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/taskdefs/CallTarget.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CallTarget.java	2 Jul 2002 10:48:38 -0000	1.9
  +++ CallTarget.java	4 Jul 2002 07:44:16 -0000	1.10
  @@ -36,8 +36,7 @@
        */
       protected void prepare( final ExecuteTarget exe ) throws TaskException
       {
  -        final ProjectRefSet refs = (ProjectRefSet)m_context.getProperty( ProjectRefSet.KEY
);
  -        final ProjectRef thisProject = refs.getProjectRef( null );
  +        final ProjectRef thisProject = (ProjectRef)m_context.getProperty( ProjectRef.KEY
);
           exe.setProject( thisProject.getProject() );
       }
   }
  
  
  
  1.116     +27 -19    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.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- DefaultWorkspace.java	4 Jul 2002 04:31:07 -0000	1.115
  +++ DefaultWorkspace.java	4 Jul 2002 07:44:16 -0000	1.116
  @@ -7,8 +7,6 @@
    */
   package org.apache.myrmidon.components.workspace;
   
  -import java.util.HashMap;
  -import java.util.Map;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  @@ -24,7 +22,6 @@
   import org.apache.myrmidon.interfaces.service.AntServiceKernel;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   import org.apache.myrmidon.interfaces.workspace.ProjectRef;
  -import org.apache.myrmidon.interfaces.workspace.ProjectRefSet;
   import org.apache.myrmidon.interfaces.workspace.TargetSet;
   import org.apache.myrmidon.interfaces.workspace.Workspace;
   
  @@ -46,11 +43,6 @@
        */
       private TaskContext m_taskContext;
   
  -    /**
  -     * Map from ProjectDescriptor to ProjectEntry for that project.
  -     */
  -    private final Map m_entries = new HashMap();
  -
       private AntServiceKernel m_serviceKernel;
   
       /**
  @@ -89,8 +81,10 @@
           if( projectName != null )
           {
               // A target in a referenced project
  -            final ProjectRefSet projectRefSet = entry.getProjectRefSet();
  -            final ProjectRef otherProject = projectRefSet.getProjectRef( projectName );
  +            final String key = ProjectRef.KEY + "-" + projectName;
  +
  +            final ProjectRef otherProject =
  +                (ProjectRef)entry.getContext().getProperty( key );
               if( otherProject == null )
               {
                   final String message = REZ.getString( "no-project.error", projectName );
  @@ -193,15 +187,29 @@
       private ProjectEntry getProjectEntry( final ProjectDescriptor descriptor )
           throws TaskException
       {
  -        ProjectEntry entry = (ProjectEntry)m_entries.get( descriptor );
  -        if( entry == null )
  +        final String key = ProjectEntry.KEY + "-" + descriptor.toKey();
  +
  +        try
           {
  -            final Project project = getProject( descriptor );
  -            entry = createProjectEntry( project, m_taskContext );
  -            m_entries.put( descriptor, entry );
  -        }
  +            final PropertyStore propertyStore =
  +                (PropertyStore)m_serviceKernel.getService( PropertyStore.ROLE );
   
  -        return entry;
  +            if( propertyStore.isPropertySet( key ) )
  +            {
  +                return (ProjectEntry)propertyStore.getProperty( key );
  +            }
  +            else
  +            {
  +                final Project project = getProject( descriptor );
  +                final ProjectEntry entry = createProjectEntry( project, m_taskContext );
  +                propertyStore.setProperty( key, entry );
  +                return entry;
  +            }
  +        }
  +        catch( final ServiceException se )
  +        {
  +            throw new TaskException( se.getMessage(), se );
  +        }
       }
   
       private Project getProject( final ProjectDescriptor descriptor )
  @@ -273,7 +281,7 @@
           final PropertyStore propertyStore =
               (PropertyStore)projectContext.getService( PropertyStore.class );
           propertyStore.setProperty( Project.KEY, project );
  -        propertyStore.setProperty( ProjectRefSet.KEY, entry.getProjectRefSet() );
  +        propertyStore.setProperty( ProjectEntry.KEY, entry );
           propertyStore.setProperty( TargetSet.KEY, entry.getTargetSet() );
   
           return entry;
  
  
  
  1.26      +2 -12     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/ProjectEntry.java
  
  Index: ProjectEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/ProjectEntry.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ProjectEntry.java	4 Jul 2002 04:36:57 -0000	1.25
  +++ ProjectEntry.java	4 Jul 2002 07:44:16 -0000	1.26
  @@ -18,7 +18,6 @@
   import org.apache.myrmidon.interfaces.property.NameValidator;
   import org.apache.myrmidon.interfaces.property.NameValidatorManager;
   import org.apache.myrmidon.interfaces.workspace.ProjectRef;
  -import org.apache.myrmidon.interfaces.workspace.ProjectRefSet;
   import org.apache.myrmidon.interfaces.workspace.TargetSet;
   
   /**
  @@ -43,9 +42,6 @@
   
       private final TargetSet m_targetSet = new TargetSet();
   
  -    /** Map from project ref name -> ProjectRef. */
  -    private final ProjectRefSet m_projectRefSet;
  -
       private TaskContext m_taskContext;
   
       ProjectEntry( final Project project,
  @@ -88,8 +84,7 @@
   
           // Add a reference to self
           final ProjectRef self = new ProjectRef( project.getName(), project.getProjectDescriptor()
);
  -        m_projectRefSet = new ProjectRefSet( self );
  -        m_projectRefSet.addProjectRef( self );
  +        m_taskContext.setProperty( ProjectRef.KEY, self );
       }
   
       Project getProject()
  @@ -115,11 +110,6 @@
       void setTargetState( final Target target, final TargetState state )
       {
           m_targetState.put( target, state );
  -    }
  -
  -    ProjectRefSet getProjectRefSet()
  -    {
  -        return m_projectRefSet;
       }
   
       TargetSet getTargetSet()
  
  
  
  1.6       +3 -1      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/workspace/ProjectRef.java
  
  Index: ProjectRef.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/workspace/ProjectRef.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ProjectRef.java	4 Jul 2002 01:19:56 -0000	1.5
  +++ ProjectRef.java	4 Jul 2002 07:44:16 -0000	1.6
  @@ -17,6 +17,8 @@
    */
   public final class ProjectRef
   {
  +    public final static String KEY = "myrmidon.project-ref";
  +
       private final String m_name;
       private final ProjectDescriptor m_project;
   
  
  
  
  1.5       +5 -6      jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/ProjectRefTask.java
  
  Index: ProjectRefTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/ProjectRefTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProjectRefTask.java	4 Jul 2002 01:18:13 -0000	1.4
  +++ ProjectRefTask.java	4 Jul 2002 07:44:17 -0000	1.5
  @@ -13,7 +13,6 @@
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.interfaces.workspace.ProjectRef;
  -import org.apache.myrmidon.interfaces.workspace.ProjectRefSet;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   import org.apache.myrmidon.interfaces.property.NameValidatorManager;
   import org.apache.myrmidon.interfaces.property.NameValidator;
  @@ -84,9 +83,9 @@
               throw new TaskException( message );
           }
   
  -        final ProjectRefSet projectRefs = (ProjectRefSet)getContext().getProperty( ProjectRefSet.KEY
);
  -
  -        if( null != projectRefs.getProjectRef( m_name ) )
  +        final String key = ProjectRef.KEY + "-" + m_name;
  +        final ProjectRef other = (ProjectRef)getContext().getProperty( key );
  +        if( null != other )
           {
               final String message =
                   REZ.getString( "projectref.duplicate-name.error",
  @@ -98,7 +97,7 @@
           final ProjectDescriptor descriptor = new ProjectDescriptor( uri, m_type );
           final ProjectRef ref = new ProjectRef( m_name, descriptor );
   
  -        projectRefs.addProjectRef( ref );
  +        getContext().setProperty( key, ref );
       }
   
       private void validate() throws TaskException
  
  
  

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