You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by we...@apache.org on 2002/06/13 00:09:47 UTC

cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz PostActionTag.java PreActionTag.java PostGoalTag.java PreGoalTag.java WerkzTagLibrary.java

werken      2002/06/12 15:09:47

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/werkz
                        PostGoalTag.java PreGoalTag.java
                        WerkzTagLibrary.java
  Added:       jelly/src/java/org/apache/commons/jelly/tags/werkz
                        PostActionTag.java PreActionTag.java
  Log:
  Added pre/post-action callback tags.
  Edited javadocs some to get in line with Werkz vocabulary.
  
  Revision  Changes    Path
  1.2       +4 -4      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/PostGoalTag.java
  
  Index: PostGoalTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/PostGoalTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PostGoalTag.java	12 Jun 2002 06:07:29 -0000	1.1
  +++ PostGoalTag.java	12 Jun 2002 22:09:46 -0000	1.2
  @@ -68,8 +68,8 @@
   import org.apache.commons.logging.LogFactory;
   
   /** 
  - * Implements a <postTarget> tag which provides a callback 
  - * which is evaluated after a target has executed.
  + * Implements a <postGoal> tag which provides a callback 
  + * which is evaluated after a goal has executed.
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision$
  @@ -93,7 +93,7 @@
               new PostGoalCallback() {
                   public void firePostGoal(Goal goal) throws Exception {
                       // lets run the body
  -                    log.info( "Running post target: " + getName() );
  +                    log.info( "Running post goal: " + getName() );
                       getBody().run( context, output);                                        
                   }                
               }
  
  
  
  1.3       +4 -4      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/PreGoalTag.java
  
  Index: PreGoalTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/PreGoalTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PreGoalTag.java	12 Jun 2002 17:09:41 -0000	1.2
  +++ PreGoalTag.java	12 Jun 2002 22:09:46 -0000	1.3
  @@ -68,8 +68,8 @@
   import org.apache.commons.logging.LogFactory;
   
   /** 
  - * Implements a &lt;preTarget&gt; tag which provides a callback 
  - * which is evaluated before a target.
  + * Implements a &lt;preGoal&gt; tag which provides a callback 
  + * which is evaluated before a goal.
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision$
  @@ -93,7 +93,7 @@
               new PreGoalCallback() {
                   public void firePreGoal(Goal goal) throws Exception {
                       // lets run the body
  -                    log.debug( "Running pre target: " + getName() );
  +                    log.debug( "Running pre goal: " + getName() );
                       getBody().run( context, output);               
                   }                
               }
  
  
  
  1.3       +2 -0      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/WerkzTagLibrary.java
  
  Index: WerkzTagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/WerkzTagLibrary.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WerkzTagLibrary.java	12 Jun 2002 06:07:29 -0000	1.2
  +++ WerkzTagLibrary.java	12 Jun 2002 22:09:46 -0000	1.3
  @@ -87,6 +87,8 @@
           registerTag("goal", GoalTag.class);
           registerTag("preGoal", PreGoalTag.class);
           registerTag("postGoal", PostGoalTag.class);
  +        registerTag("preAction", PreActionTag.class);
  +        registerTag("postAction", PostActionTag.class);
           registerTag("attain", AttainTag.class);
           registerTag("attainGoal", AttainGoalTag.class);
       }
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/PostActionTag.java
  
  Index: PostActionTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.jelly.tags.werkz;
  
  import com.werken.werkz.Goal;
  import com.werken.werkz.PostActionCallback;
  
  import org.apache.commons.jelly.JellyException;
  import org.apache.commons.jelly.XMLOutput;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /** 
   * Implements a &lt;postAction&gt; tag which provides a callback 
   * which is evaluated after an action.
   *
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
   * @version $Revision: 1.1 $
   */
  public class PostActionTag extends CallbackTagSupport {
  
      public PostActionTag() {
      }
  
  
      // Tag interface
      //------------------------------------------------------------------------- 
      
      /** 
       * Evaluate the body to register all the various goals and pre/post conditions
       * then run all the current targets
       */
      public void doTag(final XMLOutput output) throws Exception {
          
          getGoal(getName()).addPostActionCallback(
              new PostActionCallback() {
                  public void firePostAction(Goal goal) throws Exception {
                      // lets run the body
                      log.info( "Running post action: " + getName() );
                      getBody().run( context, output);                                        
                  }                
              }
          );            
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/werkz/PreActionTag.java
  
  Index: PreActionTag.java
  ===================================================================
  /*
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.jelly.tags.werkz;
  
  import com.werken.werkz.Goal;
  import com.werken.werkz.PreActionCallback;
  
  import org.apache.commons.jelly.JellyException;
  import org.apache.commons.jelly.XMLOutput;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /** 
   * Implements a &lt;preAction&gt; tag which provides a callback 
   * which is evaluated before an action.
   *
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
   * @version $Revision: 1.1 $
   */
  public class PreActionTag extends CallbackTagSupport {
  
      public PreActionTag() {
      }
  
  
      // Tag interface
      //------------------------------------------------------------------------- 
      
      /** 
       * Evaluate the body to register all the various goals and pre/post conditions
       * then run all the current targets
       */
      public void doTag(final XMLOutput output) throws Exception {
          
          getGoal(getName()).addPreActionCallback(
              new PreActionCallback() {
                  public void firePreAction(Goal goal) throws Exception {
                      // lets run the body
                      log.debug( "Running pre action: " + getName() );
                      getBody().run( context, output);               
                  }                
              }
          );            
      }
  }
  
  
  

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