jstrachan 2002/10/16 05:45:53 Modified: jelly/src/java/org/apache/commons/jelly/tags/jeez JeezTagLibrary.java jelly/src/java/org/apache/commons/jelly TagLibrary.java jelly.properties jelly/src/java/org/apache/commons/jelly/tags/define BeanTag.java DynaBeanTag.java jelly/src/java/org/apache/commons/jelly/impl DefaultTagLibraryResolver.java TagScript.java TagFactory.java DefaultTagFactory.java DynamicTagLibrary.java StaticTagScript.java jelly/src/test/org/apache/commons/jelly/ant suite.jelly jelly/src/java/org/apache/commons/jelly/tags/swing SwingTagLibrary.java ConstraintTag.java jelly/src/java/org/apache/commons/jelly/parser XMLParser.java jelly/src/java/org/apache/commons/jelly/tags/ant AntTagLibrary.java jelly/src/test/org/apache/commons/jelly/impl TestTagLibraryResolver.java jelly/src/java/org/apache/commons/jelly/tags/core UseBeanTag.java Log: Patch so that the internal TagFactory used by TagLibrary objects to create Tag instances now takes the name and XML attributes. This makes support for dynamically created tags, like with Ant, a little easier to support as now a TagLibrary can just directly register a TagFactory. Revision Changes Path 1.9 +10 -10 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jeez/JeezTagLibrary.java Index: JeezTagLibrary.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jeez/JeezTagLibrary.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- JeezTagLibrary.java 3 Oct 2002 18:14:43 -0000 1.8 +++ JeezTagLibrary.java 16 Oct 2002 12:45:51 -0000 1.9 @@ -114,7 +114,7 @@ if ( name.equals( "tagdef" ) ) { return new TagScript( new TagFactory() { - public Tag createTag() { + public Tag createTag(String name, Attributes attributes) { return new TagDefTag( JeezTagLibrary.this ); } } @@ -123,7 +123,7 @@ if ( name.equals( "target" ) ) { return new TagScript( new TagFactory() { - public Tag createTag() { + public Tag createTag(String name, Attributes attributes) { return new TargetTag(); } } @@ -135,14 +135,14 @@ if ( script == null ) { return new TagScript( new TagFactory() { - public Tag createTag() throws Exception { + public Tag createTag(String name, Attributes attributes) throws Exception { // lets try create a dynamic tag first - Tag tag = JeezTagLibrary.this.createTag(name); + Tag tag = JeezTagLibrary.this.createTag(name, attributes); if ( tag != null ) { return tag; } else { - return antTagLib.createTag( name ); + return antTagLib.createTag( name, attributes ); } } } 1.15 +36 -12 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.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- TagLibrary.java 24 Sep 2002 16:49:40 -0000 1.14 +++ TagLibrary.java 16 Oct 2002 12:45:51 -0000 1.15 @@ -73,6 +73,7 @@ import org.apache.commons.jelly.expression.ConstantExpression; import org.apache.commons.jelly.expression.Expression; import org.apache.commons.jelly.expression.ExpressionFactory; +import org.apache.commons.jelly.impl.TagFactory; import org.apache.commons.jelly.impl.TagScript; import org.xml.sax.Attributes; @@ -109,16 +110,21 @@ } public TagLibrary() { - } /** Creates a new script to execute the given tag name and attributes */ public TagScript createTagScript(String name, Attributes attributes) throws Exception { - Class type = (Class) tags.get(name); - if ( type != null ) { - return TagScript.newInstance(type); + Object value = tags.get(name); + if (value instanceof Class) { + Class type = (Class) value; + if ( type != null ) { + return TagScript.newInstance(type); + } + } + else if (value instanceof TagFactory) { + return new TagScript( (TagFactory) value ); } return null; @@ -128,15 +134,24 @@ public Tag createTag(String name, Attributes attributes) throws Exception { + Object value = tags.get(name); + if (value instanceof Class) { + Class type = (Class) value; + if ( type != null ) { + return (Tag) type.newInstance(); + } + } + else if (value instanceof TagFactory) { + TagFactory factory = (TagFactory) value; + return factory.createTag(name, attributes); + } Class type = (Class) tags.get(name); if ( type != null ) { return (Tag) type.newInstance(); } return null; - } - /** Allows taglibs to use their own expression evaluation mechanism */ public Expression createExpression( ExpressionFactory factory, @@ -161,9 +176,18 @@ // Implementation methods //------------------------------------------------------------------------- - /** Registers a tag class for a given tag name */ + /** + * Registers a tag implementation Class for a given tag name + */ protected void registerTag(String name, Class type) { tags.put(name, type); + } + + /** + * Registers a tag factory for a given tag name + */ + protected void registerTagFactory(String name, TagFactory tagFactory) { + tags.put(name, tagFactory); } /** Allows derived tag libraries to use their own factory */ 1.26 +1 -0 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/jelly.properties Index: jelly.properties =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/jelly.properties,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- jelly.properties 10 Oct 2002 22:19:18 -0000 1.25 +++ jelly.properties 16 Oct 2002 12:45:51 -0000 1.26 @@ -10,6 +10,7 @@ jeez = org.apache.commons.jelly.tags.jeez.JeezTagLibrary util = org.apache.commons.jelly.tags.util.UtilTagLibrary junit = org.apache.commons.jelly.tags.junit.JUnitTagLibrary +bean = org.apache.commons.jelly.tags.bean.BeanTagLibrary dynabean = org.apache.commons.jelly.tags.dynabean.DynabeanTagLibrary # optional taglibs 1.10 +2 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/BeanTag.java Index: BeanTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/BeanTag.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- BeanTag.java 28 Aug 2002 09:19:30 -0000 1.9 +++ BeanTag.java 16 Oct 2002 12:45:51 -0000 1.10 @@ -77,6 +77,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.xml.sax.Attributes; /** * Binds a Java bean to the given named Jelly tag so that the attributes of @@ -159,7 +160,7 @@ final Map beanAttributes = (attributes != null) ? attributes : EMPTY_MAP; TagFactory factory = new TagFactory() { - public Tag createTag() { + public Tag createTag(String name, Attributes attributes) { return new DynamicBeanTag(beanClass, beanAttributes, varAttribute, invokeMethod); } }; 1.2 +2 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DynaBeanTag.java Index: DynaBeanTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/define/DynaBeanTag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DynaBeanTag.java 28 Aug 2002 09:19:30 -0000 1.1 +++ DynaBeanTag.java 16 Oct 2002 12:45:51 -0000 1.2 @@ -79,6 +79,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.xml.sax.Attributes; /** * Binds a Java bean to the given named Jelly tag so that the attributes of @@ -133,7 +134,7 @@ final Map beanAttributes = (attributes != null) ? attributes : EMPTY_MAP; TagFactory factory = new TagFactory() { - public Tag createTag() { + public Tag createTag(String name, Attributes attributes) { return new DynamicDynaBeanTag(theDynaClass, beanAttributes, varAttribute); } }; 1.3 +20 -3 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DefaultTagLibraryResolver.java Index: DefaultTagLibraryResolver.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DefaultTagLibraryResolver.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DefaultTagLibraryResolver.java 10 Oct 2002 22:17:04 -0000 1.2 +++ DefaultTagLibraryResolver.java 16 Oct 2002 12:45:52 -0000 1.3 @@ -60,6 +60,8 @@ import org.apache.commons.discovery.ResourceClassIterator; import org.apache.commons.discovery.resource.ClassLoaders; import org.apache.commons.discovery.resource.classes.DiscoverClasses; +import org.apache.commons.discovery.tools.DiscoverClass; +import org.apache.commons.discovery.tools.DiscoverSingleton; import org.apache.commons.jelly.TagLibrary; @@ -119,7 +121,24 @@ } log.info( "Looking up service name: " + name ); + +/* + ClassLoaders loaders = ClassLoaders.getAppLoaders(TagLibrary.class, getClass(), false); + DiscoverClass discover = new DiscoverClass(loaders); + Class implClass = discover.find(TestInterface2.class); + + + + TagLibrary answer = null; + try { + answer = (TagLibrary) DiscoverSingleton.find(TagLibrary.class, name); + } + catch (Exception e) { + log.error( "Could not load service: " + name ); + } + return answer; +*/ ResourceClassIterator iter = discovery.findResourceClasses(name); while (iter.hasNext()) { ResourceClass resource = iter.nextResourceClass(); @@ -200,10 +219,8 @@ */ public DiscoverClasses getDiscoverClasses() { if ( discovery == null ) { - ClassLoaders loaders = new ClassLoaders(); - loaders.put( getClassLoader() ); + ClassLoaders loaders = ClassLoaders.getAppLoaders(TagLibrary.class, getClass(), false); discovery = new DiscoverClasses(loaders); - discovery.addClassLoader( getClassLoader() ); } return discovery; } 1.23 +48 -9 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.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- TagScript.java 8 Oct 2002 20:22:13 -0000 1.22 +++ TagScript.java 16 Oct 2002 12:45:52 -0000 1.23 @@ -90,6 +90,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXException; @@ -126,9 +127,12 @@ /** the Jelly file which caused the problem */ private String fileName; - /** the tag name which caused the problem */ + /** the qualified element name which caused the problem */ private String elementName; + /** the local (non-namespaced) tag name */ + private String localName; + /** the line number of the tag */ private int lineNumber = -1; @@ -143,7 +147,10 @@ /** the parent TagScript */ private TagScript parent; - + + /** the SAX attributes */ + private Attributes saxAttributes; + /** * @return a new TagScript based on whether * the given Tag class is a bean tag or DynaTag @@ -397,6 +404,39 @@ public void setColumnNumber(int columnNumber) { this.columnNumber = columnNumber; } + + /** + * Returns the SAX attributes of this tag + * @return Attributes + */ + public Attributes getSaxAttributes() { + return saxAttributes; + } + + /** + * Sets the SAX attributes of this tag + * @param saxAttributes The saxAttributes to set + */ + public void setSaxAttributes(Attributes saxAttributes) { + this.saxAttributes = saxAttributes; + } + + /** + * Returns the local, non namespaced XML name of this tag + * @return String + */ + public String getLocalName() { + return localName; + } + + /** + * Sets the local, non namespaced name of this tag. + * @param localName The localName to set + */ + public void setLocalName(String localName) { + this.localName = localName; + } + // Implementation methods //------------------------------------------------------------------------- @@ -407,7 +447,7 @@ */ protected Tag createTag() throws Exception { if ( tagFactory != null) { - return tagFactory.createTag(); + return tagFactory.createTag(localName, getSaxAttributes()); } return null; } @@ -563,5 +603,4 @@ throw new JellyException(e, fileName, elementName, columnNumber, lineNumber); } - } 1.2 +6 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagFactory.java Index: TagFactory.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TagFactory.java 1 Aug 2002 09:53:17 -0000 1.1 +++ TagFactory.java 16 Oct 2002 12:45:52 -0000 1.2 @@ -61,9 +61,10 @@ */ package org.apache.commons.jelly.impl; - import org.apache.commons.jelly.Tag; +import org.xml.sax.Attributes; + /** * <p><code>TagFactory</code> represents a Factory of {@link Tag} instances.</p> * @@ -75,5 +76,8 @@ */ public interface TagFactory { - public Tag createTag() throws Exception; + /** + * Creates a Tag for the given local name and the SAX attributes + */ + public Tag createTag(String name, Attributes attributes) throws Exception; } 1.2 +3 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DefaultTagFactory.java Index: DefaultTagFactory.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DefaultTagFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DefaultTagFactory.java 1 Aug 2002 09:53:17 -0000 1.1 +++ DefaultTagFactory.java 16 Oct 2002 12:45:52 -0000 1.2 @@ -63,6 +63,8 @@ import org.apache.commons.jelly.Tag; +import org.xml.sax.Attributes; + /** * <p><code>DefaultTagFactory</code> a default implementation of TagFactory * which creates new instances of a given class. @@ -83,8 +85,7 @@ // TagFactory interface //------------------------------------------------------------------------- - - public Tag createTag() throws Exception { + public Tag createTag(String name, Attributes attributes) throws Exception { return (Tag) tagClass.newInstance(); } 1.5 +4 -4 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DynamicTagLibrary.java Index: DynamicTagLibrary.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DynamicTagLibrary.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DynamicTagLibrary.java 3 Oct 2002 18:14:43 -0000 1.4 +++ DynamicTagLibrary.java 16 Oct 2002 12:45:52 -0000 1.5 @@ -97,8 +97,8 @@ return new TagScript( new TagFactory() { - public Tag createTag() throws Exception { - Tag answer = DynamicTagLibrary.this.createTag(name); + public Tag createTag(String name, Attributes attributes) throws Exception { + Tag answer = DynamicTagLibrary.this.createTag(name, attributes); // delegate to my parent instead if ( answer == null && parent != null ) { @@ -111,7 +111,7 @@ } /** Creates a new Tag for the given tag name if it exists */ - public Tag createTag(String name) + public Tag createTag(String name, Attributes attributes) throws Exception { Object value = templates.get(name); @@ -121,7 +121,7 @@ } else if ( value instanceof TagFactory ) { TagFactory factory = (TagFactory) value; - return factory.createTag(); + return factory.createTag(name, attributes); } return null; } 1.10 +1 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/StaticTagScript.java Index: StaticTagScript.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/StaticTagScript.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- StaticTagScript.java 3 Oct 2002 18:14:43 -0000 1.9 +++ StaticTagScript.java 16 Oct 2002 12:45:52 -0000 1.10 @@ -154,7 +154,7 @@ TagLibrary taglib = context.getTagLibrary( tag.getUri() ); if ( taglib instanceof DynamicTagLibrary ) { DynamicTagLibrary dynaLib = (DynamicTagLibrary) taglib; - Tag newTag = dynaLib.createTag( tag.getLocalName() ); + Tag newTag = dynaLib.createTag( tag.getLocalName(), getSaxAttributes() ); if ( newTag != null ) { newTag.setParent( tag.getParent() ); newTag.setBody( tag.getBody() ); 1.3 +10 -10 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/ant/suite.jelly Index: suite.jelly =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/ant/suite.jelly,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- suite.jelly 23 Sep 2002 12:35:42 -0000 1.2 +++ suite.jelly 16 Oct 2002 12:45:52 -0000 1.3 @@ -6,26 +6,26 @@ <j:set var="dir" value="target/test-classes/org/apache/commons/jelly/ant"/> -<test:case name="readWrite"> - - <j:set var="foo1" value="bar1"/> +<test:case name="write"> - <ant:property name="foo1.1" value="${foo1}"/> + <ant:property name="foo2" value="bar2"/> <test:assertEquals - expected="bar1" - actual="${foo1.1}" + expected="bar2" + actual="${foo2}" /> </test:case> -<test:case name="write"> +<test:case name="readWrite"> + + <j:set var="foo1" value="bar1"/> - <ant:property name="foo2" value="bar2"/> + <ant:property name="foo1.1" value="${foo1}"/> <test:assertEquals - expected="bar2" - actual="${foo2}" + expected="bar1" + actual="${foo1.1}" /> </test:case> 1.13 +2 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java Index: SwingTagLibrary.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- SwingTagLibrary.java 3 Oct 2002 18:14:43 -0000 1.12 +++ SwingTagLibrary.java 16 Oct 2002 12:45:52 -0000 1.13 @@ -147,9 +147,9 @@ if ( factory != null ) { return new TagScript( new TagFactory() { - public Tag createTag() throws Exception { + public Tag createTag(String name, Attributes attributes) throws Exception { if ( factory instanceof TagFactory ) { - return ((TagFactory) factory).createTag(); + return ((TagFactory) factory).createTag(name, attributes); } else { return new ComponentTag(factory); 1.3 +2 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/ConstraintTag.java Index: ConstraintTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/swing/ConstraintTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ConstraintTag.java 3 Oct 2002 18:14:43 -0000 1.2 +++ ConstraintTag.java 16 Oct 2002 12:45:52 -0000 1.3 @@ -55,7 +55,7 @@ public static class HereFactory extends BeanFactory implements TagFactory { public HereFactory(Class c) { super(c); } - public Tag createTag ( ) { + public Tag createTag(String name, Attributes attributes) { return new ConstraintTag ( this ); // still scratching my head about "this" usage... } @@ -64,7 +64,7 @@ public ConstantFactory(Object c) { this.constant = c;} private Object constant; public Object newInstance() { return constant; } - public Tag createTag ( ) throws Exception { + public Tag createTag(String name, Attributes attributes) throws Exception { return new ConstraintTag ( this ); } } // class ConstatnStringFactory 1.33 +11 -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.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- XMLParser.java 14 Oct 2002 19:46:22 -0000 1.32 +++ XMLParser.java 16 Oct 2002 12:45:52 -0000 1.33 @@ -116,6 +116,7 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; +import org.xml.sax.helpers.AttributesImpl; /** <p><code>XMLParser</code> parses the XML Jelly format. * The SAXParser and XMLReader portions of this code come from Digester.</p> @@ -628,6 +629,7 @@ // sets the file name element names tagScript.setFileName(fileName); tagScript.setElementName(qName); + tagScript.setLocalName(localName); if (textBuffer.length() > 0) { addTextScript(textBuffer.toString()); @@ -1003,6 +1005,9 @@ if (taglib != null) { TagScript script = taglib.createTagScript(localName, list); if ( script != null ) { + // clone the attributes to keep them around after this parse + script.setSaxAttributes(new AttributesImpl(list)); + // now iterate through through the expressions int size = list.getLength(); for (int i = 0; i < size; i++) { @@ -1051,7 +1056,7 @@ StaticTag tag = new StaticTag( namespaceURI, localName, qName ); StaticTagScript script = new StaticTagScript( new TagFactory() { - public Tag createTag() { + public Tag createTag(String name, Attributes attributes) { return new StaticTag( namespaceURI, localName, qName ); } } @@ -1120,7 +1125,6 @@ script.addScript(new ExpressionScript(expression)); } } - protected Expression createConstantExpression( String tagName, 1.24 +9 -8 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/ant/AntTagLibrary.java Index: AntTagLibrary.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/ant/AntTagLibrary.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- AntTagLibrary.java 3 Oct 2002 18:14:44 -0000 1.23 +++ AntTagLibrary.java 16 Oct 2002 12:45:53 -0000 1.24 @@ -71,12 +71,14 @@ import org.apache.commons.jelly.impl.TagScript; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.tools.ant.BuildLogger; import org.apache.tools.ant.NoBannerLogger; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.optional.junit.FormatterElement; import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.Reference; + import org.xml.sax.Attributes; /** @@ -183,14 +185,13 @@ /** Creates a new script to execute the given tag name and attributes */ - public TagScript createTagScript(final String name, Attributes attributes) throws Exception { - + public TagScript createTagScript(String name, Attributes attributes) throws Exception { TagScript answer = createCustomTagScript(name, attributes); if ( answer == null ) { answer = new TagScript( new TagFactory() { - public Tag createTag() throws Exception { - return AntTagLibrary.this.createTag(name); + public Tag createTag(String name, Attributes attributes) throws Exception { + return AntTagLibrary.this.createTag(name, attributes); } } ); @@ -201,12 +202,12 @@ /** * @return a new TagScript for any custom, statically defined tags, like 'fileScanner' */ - public TagScript createCustomTagScript(final String name, Attributes attributes) throws Exception { + public TagScript createCustomTagScript(String name, Attributes attributes) throws Exception { // custom Ant tags if ( name.equals("fileScanner") ) { return new TagScript( new TagFactory() { - public Tag createTag() throws Exception { + public Tag createTag(String name, Attributes attributes) throws Exception { return new FileScannerTag(new FileScanner()); } } @@ -215,7 +216,7 @@ if ( name.equals("setProperty") ) { return new TagScript( new TagFactory() { - public Tag createTag() throws Exception { + public Tag createTag(String name, Attributes attributes) throws Exception { return new SetPropertyTag(); } } @@ -227,7 +228,7 @@ /** * A helper method which creates an AntTag instance for the given element name */ - public Tag createTag(String name) throws Exception { + public Tag createTag(String name, Attributes attributes) throws Exception { AntTag tag = new AntTag( name ); if ( name.equals( "echo" ) ) { tag.setTrim(false); 1.2 +6 -0 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/impl/TestTagLibraryResolver.java Index: TestTagLibraryResolver.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/impl/TestTagLibraryResolver.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestTagLibraryResolver.java 20 Aug 2002 17:26:10 -0000 1.1 +++ TestTagLibraryResolver.java 16 Oct 2002 12:45:53 -0000 1.2 @@ -98,9 +98,15 @@ } public void testResolver() throws Exception { + /** + * @todo temporary disbled test case until I can figure out how to get + * it to work with commons-discovery + */ +/* TagLibrary library = resolver.resolveTagLibrary("jelly:test-library" ); assertTrue( "Found a tag library", library != null ); assertEquals( "Tag library is of the correct type", "org.apache.commons.jelly.test.impl.DummyTagLibrary", library.getClass().getName() ); +*/ } } 1.4 +9 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/UseBeanTag.java Index: UseBeanTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/UseBeanTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- UseBeanTag.java 30 Sep 2002 17:40:16 -0000 1.3 +++ UseBeanTag.java 16 Oct 2002 12:45:53 -0000 1.4 @@ -86,8 +86,15 @@ /** the current bean instance */ private Object bean; + + /** the default class to use if no Class is specified */ + private Class defaultClass; + + public UseBeanTag() { + } - public UseBeanTag(){ + public UseBeanTag(Class defaultClass) { + this.defaultClass = defaultClass; } // BeanSource interface @@ -199,6 +206,6 @@ * Allows derived classes to provide a default bean implementation class */ protected Class getDefaultClass() { - return null; + return defaultClass; } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>