Index: src/java/org/apache/maven/app/GrantPropsHandler.java =================================================================== RCS file: src/java/org/apache/maven/app/GrantPropsHandler.java diff -N src/java/org/apache/maven/app/GrantPropsHandler.java --- src/java/org/apache/maven/app/GrantPropsHandler.java 11 Aug 2002 16:09:00 -0000 1.7 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,195 +0,0 @@ -package org.apache.maven.app; - -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 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 acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache Maven" 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", - * "Apache Maven", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * 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 - * . - * - * ==================================================================== - */ - -import org.apache.commons.grant.PropsHandler; - -import java.util.Hashtable; - -/** Implementation of a Commons Grant propsHandler - * to resolve through Jelly's context. - * - * @author bob mcwhirter - */ -public class GrantPropsHandler implements PropsHandler -{ - /** The JellyContext. */ - private MavenJellyContext context; - - /** Construct with a backing-store JellyContext - * - * @param context The backing-store JellyContext. - */ - public GrantPropsHandler(MavenJellyContext context) - { - this.context = context; - } - - /** Set an ant property. - * - * @param name The property name. - * @param value The property value. - */ - public void setProperty(String name, String value) - { - context.setVariable(name, value); - } - - /** Retrieve an ant property. - * - * @param name The property name. - * - * @return The property value. - */ - public String getProperty(String name) - { - Object value = context.getVariable(name); - - if (value == null) - { - return null; - } - - return value.toString(); - } - - /** Set a new ant property. - * - *

- * Following the ant spec, this sets a property - * only if it has not been previously set. If - * the property has already been set, this returns - * silently. - *

- * - * @param name The property name. - * @param value The property value. - */ - public void setNewProperty(String name, String value) - { - if (context.getVariable(name) == null) - { - context.setVariable(name, value); - } - } - - public void setInheritedProperty(String name, String value) - { - setUserProperty(name, value); - } - - /** Set an ant user property. - * - * @param name The property name. - * @param value The property value. - */ - public void setUserProperty(String name, String value) - { - context.setVariable(name, value); - } - - /** Retrieve an ant user property. - * - * @param name The property name. - * - * @return The property value. - */ - public String getUserProperty(String name) - { - Object value = context.getVariable(name); - - if (value == null) - { - return null; - } - - return value.toString(); - } - - /** Internal ant property-setting implementation. - * - * @param name The property name. - * @param value The property value. - */ - public void setPropertyInternal(String name, String value) - { - if (null != getUserProperty(name)) - { - return; - } - setProperty(name, value); - } - - /** Retrieve all ant properties. - * - * @return A Hashtable of all properties. - */ - public Hashtable getProperties() - { - return this.context.asProperties(); - } - - /** Retrieve all ant user properties. - * - * @return A Hashtable of all user properties. - */ - public Hashtable getUserProperties() - { - return this.context.asProperties(); - } -} - Index: src/java/org/apache/maven/app/Maven.java =================================================================== RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/Maven.java,v retrieving revision 1.104 diff -u -r1.104 Maven.java --- src/java/org/apache/maven/app/Maven.java 4 Sep 2002 18:47:20 -0000 1.104 +++ src/java/org/apache/maven/app/Maven.java 12 Sep 2002 20:59:00 -0000 @@ -80,6 +80,7 @@ import org.apache.commons.jelly.expression.ConstantExpression; import org.apache.commons.jelly.expression.Expression; import org.apache.commons.jelly.expression.jexl.JexlExpressionFactory; +import org.apache.commons.jelly.tags.ant.JellyPropsHandler; import org.apache.commons.jelly.tags.ant.AntTagLibrary; import org.apache.commons.jelly.tags.jeez.JeezTagLibrary; import org.apache.commons.jelly.tags.werkz.JellyBuildListener; @@ -698,8 +699,6 @@ */ private void initializeTagLibs() { - // JeezTagLibrary jeezTagLib = new JeezTagLibrary(getAntProject()); - JeezTagLibrary jeezTagLib = new JeezTagLibrary(); getJellyContext().registerTagLibrary("jelly:jeez", jeezTagLib); @@ -716,12 +715,13 @@ { this.antProject = new GrantProject(); - antProject.setPropsHandler(new GrantPropsHandler(getJellyContext())); + this.antProject.setPropsHandler(new JellyPropsHandler(getJellyContext())); getJellyContext().setAntProject(antProject); - antProject.setBaseDir(getDir()); antProject.init(); + antProject.setBaseDir(getDir()); + antProject.getBaseDir(); PrintStream demuxOut = new PrintStream(new DemuxOutputStream(antProject, false)); Index: src/java/org/apache/maven/app/MavenJellyContext.java =================================================================== RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/MavenJellyContext.java,v retrieving revision 1.16 diff -u -r1.16 MavenJellyContext.java --- src/java/org/apache/maven/app/MavenJellyContext.java 23 Aug 2002 04:14:37 -0000 1.16 +++ src/java/org/apache/maven/app/MavenJellyContext.java 12 Sep 2002 20:59:00 -0000 @@ -59,6 +59,7 @@ import org.apache.commons.jelly.JellyContext; import org.apache.commons.jelly.TagLibrary; import org.apache.commons.jelly.expression.Expression; +import org.apache.commons.jelly.tags.ant.AntTagLibrary; import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectHelper; @@ -104,9 +105,6 @@ /** Ant project. */ private Project antProject; - /** This MavenJellyContext wrapped as a Hashtable. */ - private Hashtable asProps; - /** Construct. * * @param rootContext The root context. @@ -114,8 +112,6 @@ public MavenJellyContext(URL rootContext) { super(rootContext); - - this.asProps = new JellyProps(); } /** Construct. @@ -125,7 +121,6 @@ public MavenJellyContext(MavenJellyContext parent) { super(parent); - this.asProps = parent.asProps; } protected JellyContext createChildContext() @@ -140,6 +135,7 @@ public void setAntProject(Project antProject) { this.antProject = antProject; + AntTagLibrary.setProject(this, this.antProject); } /** Retrieve the Ant project. @@ -156,7 +152,7 @@ return this.antProject; } - /** Register a n ew tag library. + /** Register a new tag library. * *

* This implementation calls the superclass @@ -215,7 +211,7 @@ { value = ProjectHelper.replaceProperties(getAntProject(), (String) value, - this.asProps); + (Hashtable) getVariables()); value = booleanPassthroughConverter((String)value); } @@ -250,55 +246,5 @@ return s; } - /** Retrieve this context as a Hashtable. - * - * @return This context as a Hashtable. - */ - public Hashtable asProperties() - { - return this.asProps; - } - - /** Wrapper to allow a JellyContext to - * masquerade as a Hashtable. - */ - class JellyProps extends Hashtable - { - /** Determine if an object is bound to a specific key. - * - * @param key The key to test. - * - * @return true if an object is bound to the - * specific key, otherwise false. - */ - public boolean containsKey(Object key) - { - return (getVariable((String) key) != null); - } - - /** Retrieve the object bound to a specific key. - * - * @param key The key index of the object. - * - * @return The object bound to the key index, or - * null if no object has been - * bound to the key. - */ - public Object get(Object key) - { - return getVariable((String) key); - } - - /** Produce output suitable for debugging. - * - * @return Output suitable for debugging. - */ - public String toString() - { - return "[GrantPropsHandler.JellyProps: context=" - + MavenJellyContext.this - + "]"; - } - } }