commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define DynamicTagLibrary.java
Date Thu, 25 Apr 2002 19:25:08 GMT
jstrachan    02/04/25 12:25:08

  Modified:    jelly/src/java/org/apache/commons/jelly TagLibrary.java
               jelly/src/java/org/apache/commons/jelly/impl TagScript.java
               jelly/src/java/org/apache/commons/jelly/parser
                        XMLParser.java
               jelly/src/java/org/apache/commons/jelly/tags/define
                        DynamicTagLibrary.java
  Added:       jelly/src/java/org/apache/commons/jelly/impl
                        BeanTagScript.java DynaTagScript.java
  Log:
  DynaTags are now supported properly. This means that template tags can now use their attributes
via EL expressions. Just need to get the invokeBody tag working and dynamic/template tags
are looking good
  
  Revision  Changes    Path
  1.4       +6 -6      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/TagLibrary.java
  
  Index: TagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/TagLibrary.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TagLibrary.java	24 Apr 2002 11:59:12 -0000	1.3
  +++ TagLibrary.java	25 Apr 2002 19:25:08 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/TagLibrary.java,v
1.3 2002/04/24 11:59:12 jstrachan Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/04/24 11:59:12 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/TagLibrary.java,v
1.4 2002/04/25 19:25:08 jstrachan Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/04/25 19:25:08 $
    *
    * ====================================================================
    *
  @@ -57,7 +57,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    * 
  - * $Id: TagLibrary.java,v 1.3 2002/04/24 11:59:12 jstrachan Exp $
  + * $Id: TagLibrary.java,v 1.4 2002/04/25 19:25:08 jstrachan Exp $
    */
   package org.apache.commons.jelly;
   
  @@ -73,7 +73,7 @@
   /** <p><code>Taglib</code> represents the metadata for a Jelly custom
tag library.</p>
     *
     * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  -  * @version $Revision: 1.3 $
  +  * @version $Revision: 1.4 $
     */
   public abstract class TagLibrary {
   
  @@ -86,7 +86,7 @@
       public TagScript createTagScript(String name, Attributes attributes) throws Exception
{
           Class type = (Class) tags.get( name );
           Tag tag = (Tag) type.newInstance();        
  -        return new TagScript( tag );
  +        return TagScript.newInstance( tag );
       }
       
       /** Allows taglibs to use their own expression evaluation mechanism */
  
  
  
  1.7       +27 -104   jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagScript.java
  
  Index: TagScript.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagScript.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TagScript.java	24 Apr 2002 11:59:12 -0000	1.6
  +++ TagScript.java	25 Apr 2002 19:25:08 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagScript.java,v
1.6 2002/04/24 11:59:12 jstrachan Exp $
  - * $Revision: 1.6 $
  - * $Date: 2002/04/24 11:59:12 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagScript.java,v
1.7 2002/04/25 19:25:08 jstrachan Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/04/25 19:25:08 $
    *
    * ====================================================================
    *
  @@ -57,7 +57,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - * $Id: TagScript.java,v 1.6 2002/04/24 11:59:12 jstrachan Exp $
  + * $Id: TagScript.java,v 1.7 2002/04/25 19:25:08 jstrachan Exp $
    */
   package org.apache.commons.jelly.impl;
   
  @@ -76,6 +76,7 @@
   
   import org.apache.commons.jelly.CompilableTag;
   import org.apache.commons.jelly.Context;
  +import org.apache.commons.jelly.DynaTag;
   import org.apache.commons.jelly.Script;
   import org.apache.commons.jelly.Tag;
   import org.apache.commons.jelly.XMLOutput;
  @@ -84,30 +85,23 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  -/** <p><code>TagScript</code> evaluates a custom tag.</p>
  -  *
  -  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  -  * @version $Revision: 1.6 $
  -  */
  -public class TagScript implements Script {
  +/** 
  + * <p><code>TagScript</code> abstract base class for a 
  + * script that evaluates a custom tag.</p>
  + *
  + * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  + * @version $Revision: 1.7 $
  + */
  +public abstract class TagScript implements Script {
       
       /** The Log to which logging calls will be made. */
       private static final Log log = LogFactory.getLog( TagScript.class );
       
       /** the tag to be evaluated */
  -    private Tag tag;
  +    protected Tag tag;
   
       /** The attribute expressions that are created */
  -    private Map attributes = new HashMap();
  -    
  -    /** Expressions for each attribute */
  -    private Expression[] expressions = {};
  -    
  -    /** Write Methods for each attribute */
  -    private Method[] methods = {};
  -    
  -    /** Types of each attribute */
  -    private Class[] types = {};
  +    protected Map attributes = new HashMap();
       
       public TagScript() {
       }
  @@ -120,6 +114,17 @@
           return super.toString() + "[tag=" + tag + "]";
       }
       
  +    /** 
  +     * @return a new TagScript based on whether 
  +     * the tag is a bean tag or DynaTag 
  +     */
  +    public static TagScript newInstance(Tag tag) {
  +        if ( tag instanceof DynaTag ) {
  +            return new DynaTagScript( (DynaTag) tag );
  +        }
  +        return new BeanTagScript( tag );
  +    }
  +    
       /** Add an initialization attribute for the tag.
        * This method must be called after the setTag() method 
        */
  @@ -130,89 +135,6 @@
           attributes.put( name, expression );
       }
       
  -    // Script interface
  -    //-------------------------------------------------------------------------       
        
  -    
  -    /** Compiles the script to a more efficient form. 
  -      * Will only be called once by the parser 
  -      */
  -    public Script compile() throws Exception {
  -        if ( tag instanceof CompilableTag ) {
  -            ((CompilableTag) tag).compile();
  -        }
  -        List typeList = new ArrayList();
  -        List methodList = new ArrayList();
  -        List expressionList = new ArrayList();
  -        
  -        BeanInfo info = Introspector.getBeanInfo( tag.getClass() );
  -        PropertyDescriptor[] descriptors = info.getPropertyDescriptors();
  -        
  -        if ( descriptors != null ) {
  -            for ( int i = 0, size = descriptors.length; i < size; i++ ) {
  -                PropertyDescriptor descriptor = descriptors[i];
  -                String name = descriptor.getName();
  -                Expression expression = (Expression) attributes.get( name );          
     
  -                if ( expression != null ) {
  -                    Method writeMethod = descriptor.getWriteMethod();                 
  
  -                    if ( writeMethod != null) {
  -                        Class type = descriptor.getPropertyType();
  -                        expressionList.add( expression );
  -                        methodList.add( writeMethod );
  -                        typeList.add( type );
  -                        
  -                        if ( log.isDebugEnabled() ) {
  -                            log.debug( "Adding tag property name: " + name + " type: "
+ type.getName() + " expression: " + expression );
  -                        }
  -                    }
  -                }
  -            }
  -        }
  -        
  -        // now create the arrays to avoid object allocation & casting when
  -        // running the script
  -        int size = expressionList.size();
  -        expressions = new Expression[ size ];
  -        methods = new Method[ size ];
  -        types = new Class[ size ];
  -        expressionList.toArray( expressions );
  -        methodList.toArray( methods );
  -        typeList.toArray( types );
  -        
  -        // compile body
  -        tag.setBody( tag.getBody().compile() );        
  -        return this;
  -    }
  -    
  -    /** Evaluates the body of a tag */
  -    public void run(Context context, XMLOutput output) throws Exception {
  -        // initialize all the properties of the tag before its used
  -        // if there is a problem abort this tag
  -        for ( int i = 0, size = expressions.length; i < size; i++ ) {
  -            Expression expression = expressions[i];
  -            Method method =  methods[i];
  -            Class type = types[i];
  -            
  -            // some types are Expression objects so let the tag
  -            // evaluate them
  -            Object value = null;
  -            if ( type.isAssignableFrom( Expression.class ) ) {
  -                value = expression;
  -            }
  -            else {
  -                value = expression.evaluate( context );
  -            }
  -            
  -            // convert value to correct type
  -            if ( value != null ) {
  -                value = convertType( value, type );
  -            }
  -            
  -            Object[] arguments = { value };
  -            method.invoke( tag, arguments );
  -        }        
  -        tag.run( context, output );
  -    }
  -    
       // Properties
       //-------------------------------------------------------------------------       
        
       
  @@ -228,6 +150,7 @@
       
       // Implementation methods
       //-------------------------------------------------------------------------      
  +    
       /** Converts the given value to the required type. 
        *
        * @param value is the value to be converted. This will not be null
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/BeanTagScript.java
  
  Index: BeanTagScript.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/BeanTagScript.java,v
1.1 2002/04/25 19:25:08 jstrachan Exp $
   * $Revision: 1.1 $
   * $Date: 2002/04/25 19:25:08 $
   *
   * ====================================================================
   *
   * 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: BeanTagScript.java,v 1.1 2002/04/25 19:25:08 jstrachan Exp $
   */
  package org.apache.commons.jelly.impl;
  
  import java.beans.BeanInfo;
  import java.beans.Introspector;
  import java.beans.PropertyDescriptor;
  import java.lang.reflect.Method;
  import java.io.Writer;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  
  import org.apache.commons.beanutils.ConvertUtils;
  
  import org.apache.commons.jelly.CompilableTag;
  import org.apache.commons.jelly.Context;
  import org.apache.commons.jelly.Script;
  import org.apache.commons.jelly.Tag;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.expression.Expression;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /** <p><code>TagScript</code> evaluates a custom tag.</p>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class BeanTagScript extends TagScript {
      
      /** The Log to which logging calls will be made. */
      private static final Log log = LogFactory.getLog( TagScript.class );
      
      /** Expressions for each attribute */
      private Expression[] expressions = {};
      
      /** Write Methods for each attribute */
      private Method[] methods = {};
      
      /** Types of each attribute */
      private Class[] types = {};
      
      public BeanTagScript() {
      }
      
      public BeanTagScript(Tag tag) {
          super( tag ); 
      }
  
      // Script interface
      //-------------------------------------------------------------------------        
       
      
      /** Compiles the script to a more efficient form. 
        * Will only be called once by the parser 
        */
      public Script compile() throws Exception {
          if ( tag instanceof CompilableTag ) {
              ((CompilableTag) tag).compile();
          }
          List typeList = new ArrayList();
          List methodList = new ArrayList();
          List expressionList = new ArrayList();
          
          BeanInfo info = Introspector.getBeanInfo( tag.getClass() );
          PropertyDescriptor[] descriptors = info.getPropertyDescriptors();
          
          if ( descriptors != null ) {
              for ( int i = 0, size = descriptors.length; i < size; i++ ) {
                  PropertyDescriptor descriptor = descriptors[i];
                  String name = descriptor.getName();
                  Expression expression = (Expression) attributes.get( name );           
    
                  if ( expression != null ) {
                      Method writeMethod = descriptor.getWriteMethod();                  
 
                      if ( writeMethod != null) {
                          Class type = descriptor.getPropertyType();
                          expressionList.add( expression );
                          methodList.add( writeMethod );
                          typeList.add( type );
                          
                          if ( log.isDebugEnabled() ) {
                              log.debug( "Adding tag property name: " + name + " type: " +
type.getName() + " expression: " + expression );
                          }
                      }
                  }
              }
          }
          
          // now create the arrays to avoid object allocation & casting when
          // running the script
          int size = expressionList.size();
          expressions = new Expression[ size ];
          methods = new Method[ size ];
          types = new Class[ size ];
          expressionList.toArray( expressions );
          methodList.toArray( methods );
          typeList.toArray( types );
          
          // compile body
          tag.setBody( tag.getBody().compile() );        
          return this;
      }
      
      /** Evaluates the body of a tag */
      public void run(Context context, XMLOutput output) throws Exception {
          // initialize all the properties of the tag before its used
          // if there is a problem abort this tag
          for ( int i = 0, size = expressions.length; i < size; i++ ) {
              Expression expression = expressions[i];
              Method method =  methods[i];
              Class type = types[i];
              
              // some types are Expression objects so let the tag
              // evaluate them
              Object value = null;
              if ( type.isAssignableFrom( Expression.class ) ) {
                  value = expression;
              }
              else {
                  value = expression.evaluate( context );
              }
              
              // convert value to correct type
              if ( value != null ) {
                  value = convertType( value, type );
              }
              
              Object[] arguments = { value };
              method.invoke( tag, arguments );
          }        
          tag.run( context, output );
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DynaTagScript.java
  
  Index: DynaTagScript.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DynaTagScript.java,v
1.1 2002/04/25 19:25:08 jstrachan Exp $
   * $Revision: 1.1 $
   * $Date: 2002/04/25 19:25:08 $
   *
   * ====================================================================
   *
   * 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: DynaTagScript.java,v 1.1 2002/04/25 19:25:08 jstrachan Exp $
   */
  package org.apache.commons.jelly.impl;
  
  import java.util.Iterator;
  import java.util.Map;
  
  import org.apache.commons.jelly.CompilableTag;
  import org.apache.commons.jelly.Context;
  import org.apache.commons.jelly.Script;
  import org.apache.commons.jelly.Tag;
  import org.apache.commons.jelly.DynaTag;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.expression.Expression;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /** 
   * <p><code>DynaTagScript</code> is a script evaluates a custom DynaTag.</p>
   *
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
   * @version $Revision: 1.1 $
   */
  public class DynaTagScript extends TagScript {
      
      /** The Log to which logging calls will be made. */
      private static final Log log = LogFactory.getLog( DynaTagScript.class );
      
      public DynaTagScript() {
      }
      
      public DynaTagScript(DynaTag tag) {
          super( tag ); 
      }
  
      // Script interface
      //-------------------------------------------------------------------------        
       
      
      /** Compiles the script to a more efficient form. 
        * Will only be called once by the parser 
        */
      public Script compile() throws Exception {
          if ( tag instanceof CompilableTag ) {
              ((CompilableTag) tag).compile();
          }
          
          // compile body
          tag.setBody( tag.getBody().compile() );        
          return this;
      }
      
      /** Evaluates the body of a tag */
      public void run(Context context, XMLOutput output) throws Exception {
          
          DynaTag dynaTag = (DynaTag) tag;
          
          // ### probably compiling this to 2 arrays might be quicker and smaller
          for ( Iterator iter = attributes.entrySet().iterator(); iter.hasNext(); ) {
              Map.Entry entry = (Map.Entry) iter.next();
              String name = (String) entry.getKey();
              Expression expression = (Expression) entry.getValue();
  
              Object value = expression.evaluate( context );
              
              dynaTag.setAttribute( name, value );
          }        
          tag.run( context, output );
      }
  }
  
  
  
  1.12      +8 -7      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/parser/XMLParser.java
  
  Index: XMLParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/parser/XMLParser.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XMLParser.java	25 Apr 2002 18:58:47 -0000	1.11
  +++ XMLParser.java	25 Apr 2002 19:25:08 -0000	1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/parser/XMLParser.java,v
1.11 2002/04/25 18:58:47 jstrachan Exp $
  - * $Revision: 1.11 $
  - * $Date: 2002/04/25 18:58:47 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/parser/XMLParser.java,v
1.12 2002/04/25 19:25:08 jstrachan Exp $
  + * $Revision: 1.12 $
  + * $Date: 2002/04/25 19:25:08 $
    *
    * ====================================================================
    *
  @@ -57,7 +57,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - * $Id: XMLParser.java,v 1.11 2002/04/25 18:58:47 jstrachan Exp $
  + * $Id: XMLParser.java,v 1.12 2002/04/25 19:25:08 jstrachan Exp $
    */
   package org.apache.commons.jelly.parser;
   
  @@ -89,6 +89,7 @@
   import org.apache.commons.jelly.TagLibrary;
   import org.apache.commons.jelly.impl.ScriptBlock;
   import org.apache.commons.jelly.impl.StaticTag;
  +import org.apache.commons.jelly.impl.DynaTagScript;
   import org.apache.commons.jelly.impl.TagScript;
   import org.apache.commons.jelly.impl.TextScript;
   import org.apache.commons.jelly.expression.ConstantExpression;
  @@ -117,7 +118,7 @@
    * The SAXParser and XMLReader portions of this code come from Digester.</p>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  - * @version $Revision: 1.11 $
  + * @version $Revision: 1.12 $
    */
   public class XMLParser extends DefaultHandler {
   
  @@ -998,9 +999,9 @@
        */
       protected TagScript createStaticTag( String namespaceURI, String localName, Attributes
list ) throws SAXException {
           try {
  -            Tag tag = new StaticTag( namespaceURI, localName );
  +            StaticTag tag = new StaticTag( namespaceURI, localName );
               
  -            TagScript script = new TagScript( tag );
  +            DynaTagScript script = new DynaTagScript( tag );
                   
               // now iterate through through the expressions
               int size = list.getLength();
  
  
  
  1.2       +7 -6      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DynamicTagLibrary.java
  
  Index: DynamicTagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DynamicTagLibrary.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DynamicTagLibrary.java	25 Apr 2002 18:14:09 -0000	1.1
  +++ DynamicTagLibrary.java	25 Apr 2002 19:25:08 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DynamicTagLibrary.java,v
1.1 2002/04/25 18:14:09 jstrachan Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/04/25 18:14:09 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DynamicTagLibrary.java,v
1.2 2002/04/25 19:25:08 jstrachan Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/04/25 19:25:08 $
    *
    * ====================================================================
    *
  @@ -57,7 +57,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    * 
  - * $Id: DynamicTagLibrary.java,v 1.1 2002/04/25 18:14:09 jstrachan Exp $
  + * $Id: DynamicTagLibrary.java,v 1.2 2002/04/25 19:25:08 jstrachan Exp $
    */
   package org.apache.commons.jelly.tags.define;
   
  @@ -66,6 +66,7 @@
   
   import org.apache.commons.jelly.Script;
   import org.apache.commons.jelly.TagLibrary;
  +import org.apache.commons.jelly.impl.DynaTagScript;
   import org.apache.commons.jelly.impl.TagScript;
   
   import org.xml.sax.Attributes;
  @@ -75,7 +76,7 @@
    * gets created by running a Jelly script.</p>
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class DynamicTagLibrary extends TagLibrary {
   
  @@ -97,7 +98,7 @@
               // XXXX: somehow we should find the template's 
               // <invokeBody> tag and associate it with this instance
               
  -            return new TagScript( tag );
  +            return new DynaTagScript( tag );
           }
           return null;
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message