werken 2002/06/13 19:13:25
Modified: src/java/org/apache/maven/app MavenAntProject.java
MavenJellyContext.java
Log:
More javadocs.
Revision Changes Path
1.2 +124 -1
jakarta-turbine-maven/src/java/org/apache/maven/app/MavenAntProject.java
Index: MavenAntProject.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/MavenAntProject.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MavenAntProject.java 13 Jun 2002 21:37:33 -0000 1.1
+++ MavenAntProject.java 14 Jun 2002 02:13:24 -0000 1.2
@@ -1,6 +1,61 @@
-
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 [EMAIL PROTECTED]
+ *
+ * 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
+ * <http://www.apache.org/>.
+ *
+ * ====================================================================
+ */
+
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.BuildException;
@@ -8,44 +63,112 @@
import java.util.Hashtable;
+/** Subclass of Ant's <code>Project</code> class that
+ * uses a <code>JellyContext</code> for property and
+ * reference storage.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">bob mcwhirter</a>
+ */
public class MavenAntProject extends Project
{
+ /** JellyContext wrapped to provide Hashtable interface. */
private Hashtable props;
+
+ /** The JellyContext. */
JellyContext context;
+ /** Construct with a backing-store <code>JellyContext</code>
+ *
+ * @param context The backing-store <code>JellyContext</code>.
+ */
public MavenAntProject(JellyContext context) {
this.context = context;
props = new JellyProps();
}
+ /** Replace ant ${property} tags within a string from
+ * this project's property bindings.
+ *
+ * <p>
+ * Property bindings are resolved directly (and only)
+ * through the backing-store <code>JellyContext</code>.
+ * </p>
+ *
+ * @param value The value in which to perform replacement.
+ * @return The string with ${property} tags replaced by their values.
+ *
+ * @throws BuildException If an error occurs.
+ */
public String replaceProperties(String value) throws BuildException {
return ProjectHelper.replaceProperties(this, value, this.props);
}
+ /** Set a property.
+ *
+ * @param name The name of the property.
+ * @param value The value of the property.
+ */
public void setProperty(String name, String value) {
context.setScopedVariable( name, value );
}
+ /** Set a property if not already set, otherwise, ignore.
+ *
+ * @param name The name of the property.
+ * @param value The value of the property.
+ */
public void setNewProperty(String name, String value) {
if ( context.getScopedVariable( name ) == null ) {
context.setScopedVariable( name, value );
}
}
+ /** Set a user property.
+ *
+ * @param name The name of the property.
+ * @param value The value of the property.
+ */
public void setUserProperty(String name, String value) {
context.setScopedVariable( name, value );
}
+ /** Retrieve a hashtable of all properties.
+ *
+ * <p>
+ * This provides a <code>Hashtable</code> interface
+ * around the backing-store <code>JellyContext</code>.
+ * </p>
+ *
+ * @return The hashtable of all properties.
+ */
public Hashtable getProperties() {
return this.props;
}
+ /** Wrapper to allow a <code>JellyContext</code> to
+ * masquerade as a <code>Hashtable</code>.
+ */
class JellyProps extends Hashtable
{
+ /** Determine if an object is bound to a specific key.
+ *
+ * @param key The key to test.
+ *
+ * @return <code>true</code> if an object is bound to the
+ * specific key, otherwise <code>false</code>.
+ */
public boolean containsKey(Object key) {
return (context.getScopedVariable( (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
+ * <code>null</code> if no object has been
+ * bound to the key.
+ */
public Object get(Object key) {
return context.getScopedVariable( (String) key );
}
1.2 +96 -5
jakarta-turbine-maven/src/java/org/apache/maven/app/MavenJellyContext.java
Index: MavenJellyContext.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/MavenJellyContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MavenJellyContext.java 13 Jun 2002 21:37:33 -0000 1.1
+++ MavenJellyContext.java 14 Jun 2002 02:13:24 -0000 1.2
@@ -1,17 +1,100 @@
-
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 [EMAIL PROTECTED]
+ *
+ * 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
+ * <http://www.apache.org/>.
+ *
+ * ====================================================================
+ */
+
import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.TagLibrary;
import java.net.URL;
+/** Specialized version of a <code>JellyContext</code>.
+ *
+ * <p>
+ * This class simply provides hooks for accessing the jelly
+ * run-time execution. Typical idiom simply includes adding
+ * poor-man's-aspects (PMAs) to a <code>JellyContext</code>
+ * an explicitly invoking the super-class implementation
+ * of a given method.
+ * </p>
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">bob mcwhirter</a>
+ */
public class MavenJellyContext extends JellyContext {
+ /** Construct.
+ *
+ * @param rootContext The root context.
+ */
public MavenJellyContext(URL rootContext) {
super( rootContext );
}
+ /** Register a n ew tag library.
+ *
+ * <p>
+ * This implementation calls the superclass
+ * implementation after determining that there
+ * is no other tag-lib registered for the
+ * given <code>namespaceURI</code>.
+ * </p>
+ *
+ * @param namespaceURI Namespace URI to index the taglib.
+ * @param taglib The tag-lib to register.
+ */
public void registerTagLibrary(String namespaceURI,
TagLibrary taglib) {
@@ -21,15 +104,23 @@
}
}
+ /** Register a n ew tag library.
+ *
+ * <p>
+ * This implementation calls the superclass
+ * implementation after determining that there
+ * is no other tag-lib registered for the
+ * given <code>namespaceURI</code>.
+ * </p>
+ *
+ * @param namespaceURI Namespace URI to index the taglib.
+ * @param className The class name of the tag-lib to register.
+ */
public void registerTagLibrary(String namespaceURI,
String className) {
if ( ! isTagLibraryRegistered( namespaceURI ) ) {
super.registerTagLibrary( namespaceURI,
className );
}
- }
-
- public TagLibrary getTagLibrary(String namespaceURI) {
- return super.getTagLibrary( namespaceURI );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>