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/08/09 17:48:49 UTC

cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define InvokeTag.java InvokeBodyTag.java DefineTagLibrary.java DefineTagLibTag.java

jstrachan    2002/08/09 08:48:49

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/define
                        InvokeBodyTag.java DefineTagLibrary.java
                        DefineTagLibTag.java
  Added:       jelly/src/java/org/apache/commons/jelly/tags/define
                        InvokeTag.java
  Log:
  added an <define:invoke script="${foo}"> tag that allows easy invoking of scripts defined using <define:script var="foo">...</define:script>
  
  This makes it very easy to define blocks of Jelly scripts then invoke them on demand. This can be handy for parameterizing Jelly scripts.
  
  Also patched some of the javadoc documentation for this tag library
  
  Revision  Changes    Path
  1.9       +6 -6      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/InvokeBodyTag.java
  
  Index: InvokeBodyTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/InvokeBodyTag.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- InvokeBodyTag.java	26 Jun 2002 09:24:36 -0000	1.8
  +++ InvokeBodyTag.java	9 Aug 2002 15:48:48 -0000	1.9
  @@ -82,7 +82,7 @@
   public class InvokeBodyTag extends TagSupport {
   
       /** The Log to which logging calls will be made. */
  -    private static final Log log = LogFactory.getLog(JellyContext.class);
  +    private static final Log log = LogFactory.getLog(InvokeBodyTag.class);
   
       public InvokeBodyTag() {
       }
  
  
  
  1.6       +6 -5      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DefineTagLibrary.java
  
  Index: DefineTagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DefineTagLibrary.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefineTagLibrary.java	17 Jul 2002 17:37:58 -0000	1.5
  +++ DefineTagLibrary.java	9 Aug 2002 15:48:48 -0000	1.6
  @@ -79,5 +79,6 @@
           registerTag( "attribute", AttributeTag.class );
           registerTag( "invokeBody", InvokeBodyTag.class );
           registerTag( "script", DefineScriptTag.class );
  +        registerTag( "invoke", InvokeTag.class );
       }
   }
  
  
  
  1.7       +6 -6      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DefineTagLibTag.java
  
  Index: DefineTagLibTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DefineTagLibTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefineTagLibTag.java	26 Jun 2002 09:24:36 -0000	1.6
  +++ DefineTagLibTag.java	9 Aug 2002 15:48:48 -0000	1.7
  @@ -71,7 +71,7 @@
   import org.xml.sax.helpers.AttributesImpl;
   
   /** 
  - * <p><code>DefineTag</code> is used to define a new taglib
  + * The &lt;taglib&gt; tag is used to define a new tag library
    * using a Jelly script..</p>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/InvokeTag.java
  
  Index: InvokeTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/InvokeTag.java,v 1.8 2002/06/26 09:24:36 jstrachan Exp $
   * $Revision: 1.8 $
   * $Date: 2002/06/26 09:24:36 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 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", "Commons", 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/>.
   * 
   * $Id: InvokeTag.java,v 1.8 2002/06/26 09:24:36 jstrachan Exp $
   */
  package org.apache.commons.jelly.tags.define;
  
  import org.apache.commons.jelly.JellyContext;
  import org.apache.commons.jelly.MissingAttributeException;
  import org.apache.commons.jelly.Script;
  import org.apache.commons.jelly.TagSupport;
  import org.apache.commons.jelly.XMLOutput;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /** 
   * The &lt;invoke&gt; tag will invoke a given Script instance.
   * It can be used with the &lt;script&gt; tag which defines scripts
   * as variables that can later be invoked by this &lt;invoke&gt; tag.
   *
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
   * @version $Revision: 1.8 $
   */
  public class InvokeTag extends TagSupport {
  
      /** The Log to which logging calls will be made. */
      private static final Log log = LogFactory.getLog(InvokeTag.class);
  
      private Script script;
      
      
      public InvokeTag() {
      }
      
      /**
       * Sets the Script to be invoked by this tag, which typically has been previously
       * defined by the use of the &lt;script&gt; tag.
       */
      public void setScript(Script script) {
          this.script = script;
      }
  
      // Tag interface
      //-------------------------------------------------------------------------                    
      public void doTag(XMLOutput output) throws Exception {
          if ( script == null ) {
              throw new MissingAttributeException("script");
          }
          script.run(context, output);
      }
  }
  
  
  

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