You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/06/12 15:54:48 UTC

cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz ProjectTag.java

jstrachan    2002/06/12 06:54:48

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/werkz
                        ProjectTag.java
  Log:
  Minor patch to the <project> tag so that a project could define its own <project> and import the Maven project which also contains a <project> and both will share the same underlying Werkz Project
  
  Revision  Changes    Path
  1.3       +10 -11    jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/ProjectTag.java
  
  Index: ProjectTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/ProjectTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProjectTag.java	12 Jun 2002 04:32:28 -0000	1.2
  +++ ProjectTag.java	12 Jun 2002 13:54:47 -0000	1.3
  @@ -77,7 +77,7 @@
   public class ProjectTag extends TagSupport {
   
       /** the project */
  -    private Project project = new Project();
  +    private Project project;
           
       public ProjectTag() {
       }
  @@ -87,6 +87,14 @@
        * @return the project instance 
        */
       public Project getProject() {
  +        if ( project == null ) {
  +	        // we may be invoked inside a child script, so lets try find the parent project
  +	        project = (Project) context.getVariable( "org.apache.commons.jelly.werkz.Project" );
  +	        if ( project == null ) {
  +	            project = new Project();
  +	            context.setVariable( "org.apache.commons.jelly.werkz.Project", project );
  +	        }
  +        }
           return project;
       }
       
  @@ -98,16 +106,7 @@
        * Evaluate the body to register all the various goals and pre/post conditions
        * then run all the current targets
        */
  -    public void doTag(XMLOutput output) throws Exception {
  -        // project.clear();
  -
  -        context.setVariable( "org.apache.commons.jelly.werkz.Project", project );
  -        
  +    public void doTag(XMLOutput output) throws Exception {        
           getBody().run(context, output);
       }
  -
  -
  -    
  -    // Implementation methods
  -    //-------------------------------------------------------------------------                
   }
  
  
  

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