werken 2002/06/13 14:31:14 Modified: jelly project.properties project.xml jelly/src/java/org/apache/commons/jelly JellyContext.java jelly/src/java/org/apache/commons/jelly/expression/jexl JexlExpressionFactory.java jelly/src/java/org/apache/commons/jelly/tags/ant AntTagLibrary.java jelly/src/java/org/apache/commons/jelly/tags/core IncludeTag.java Log: Lots of tweaks to allow for better jelly+ant integration. Revision Changes Path 1.8 +0 -1 jakarta-commons-sandbox/jelly/project.properties Index: project.properties =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/project.properties,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- project.properties 12 Jun 2002 22:53:01 -0000 1.7 +++ project.properties 13 Jun 2002 21:31:13 -0000 1.8 @@ -5,7 +5,6 @@ maven.compile.debug = on maven.compile.optimize = off maven.compile.deprecation = off -maven.repo.remote = http://jakarta.apache.org/turbine/jars/,http://werkz.sf.net/ maven.jarResources.basedir=${basedir}/src/java maven.junit.usefile = false 1.19 +1 -1 jakarta-commons-sandbox/jelly/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/project.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- project.xml 12 Jun 2002 22:01:07 -0000 1.18 +++ project.xml 13 Jun 2002 21:31:13 -0000 1.19 @@ -145,7 +145,7 @@ <dependency> <id>werkz</id> <type>required</type> - <version>1.0-build-2</version> + <version>1.0-dev.20020613.091536</version> </dependency> <!-- 1.11 +27 -4 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/JellyContext.java Index: JellyContext.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/JellyContext.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- JellyContext.java 6 Jun 2002 07:13:41 -0000 1.10 +++ JellyContext.java 13 Jun 2002 21:31:14 -0000 1.11 @@ -206,6 +206,7 @@ if ( getInherit() ) { return getParent().findVariable( name ); } + return variables.get(name); } @@ -290,11 +291,27 @@ taglibs.put(namespaceURI, className); } + public boolean isTagLibraryRegistered(String namespaceURI) { + return taglibs.containsKey( namespaceURI ); + } + /** * @return the TagLibrary for the given namespace URI or null if one could not be found */ public TagLibrary getTagLibrary(String namespaceURI) { - Object answer = taglibs.get(namespaceURI); + + Object answer = null; + + if ( getInherit() + && + getParent() != null ) { + answer = getParent().getTagLibrary( namespaceURI ); + } + + if ( answer == null ) { + answer = taglibs.get(namespaceURI); + } + if ( answer instanceof TagLibrary ) { return (TagLibrary) answer; } @@ -329,6 +346,7 @@ } } } + return null; } @@ -383,10 +401,15 @@ Script script = compileScript(url); URL newJellyContextURL = getJellyContextURL(url); - JellyContext newJellyContext = new JellyContext(this, newJellyContextURL); + JellyContext newJellyContext = null; - newJellyContext.setExport( export ); - newJellyContext.setInherit( inherit ); + if ( inherit ) { + newJellyContext = this; + } else { + newJellyContext = new JellyContext(this, newJellyContextURL); + newJellyContext.setExport( export ); + newJellyContext.setInherit( inherit ); + } script.run(newJellyContext, output); } 1.7 +12 -7 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/expression/jexl/JexlExpressionFactory.java Index: JexlExpressionFactory.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/expression/jexl/JexlExpressionFactory.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- JexlExpressionFactory.java 13 Jun 2002 09:27:14 -0000 1.6 +++ JexlExpressionFactory.java 13 Jun 2002 21:31:14 -0000 1.7 @@ -85,20 +85,25 @@ // ExpressionFactory interface //------------------------------------------------------------------------- public Expression createExpression(final String text) throws Exception { + final Expression jexlExpression = new JexlExpression( org.apache.commons.jexl.ExpressionFactory.createExpression(text) ); if ( isSupportAntVariables() && isValidAntVariableName(text) ) { - return new ExpressionSupport() { + ExpressionSupport expr = new ExpressionSupport() { public Object evaluate(JellyContext context) { Object answer = jexlExpression.evaluate(context); + if ( answer == null ) { - answer = context.getVariable(text); + answer = context.getScopedVariable(text); } + return answer; } }; + + return expr; } return jexlExpression; } 1.8 +2 -1 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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- AntTagLibrary.java 12 Jun 2002 19:28:08 -0000 1.7 +++ AntTagLibrary.java 13 Jun 2002 21:31:14 -0000 1.8 @@ -139,7 +139,6 @@ } public AntTagLibrary() { - this.project = new Project(); BuildLogger logger = new NoBannerLogger(); @@ -151,6 +150,8 @@ project.addBuildListener( logger ); project.init(); + + throw new RuntimeException( "foo" ); } public AntTagLibrary(Project project) { 1.6 +6 -6 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/IncludeTag.java Index: IncludeTag.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/IncludeTag.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- IncludeTag.java 5 Jun 2002 07:00:58 -0000 1.5 +++ IncludeTag.java 13 Jun 2002 21:31:14 -0000 1.6 @@ -89,7 +89,7 @@ public IncludeTag() { this.shouldExport = false; - this.shouldInherit = false; + this.shouldInherit = true; } public void setInherit(String inherit) {
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>