You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2004/01/10 17:41:24 UTC
cvs commit: maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant AntTag.java FileIterator.java FileScanner.java FileScannerTag.java SetPropertyTag.java TaskSource.java package.html
jvanzyl 2004/01/10 08:41:24
Modified: maven-core/src/java/org/apache/maven/jelly/tags/ant
AntTag.java FileIterator.java FileScanner.java
FileScannerTag.java SetPropertyTag.java
TaskSource.java
Removed: maven-core/src/java/org/apache/maven/jelly/tags/ant
package.html
Log:
o scrub a dub dub.
Revision Changes Path
1.2 +22 -78 maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/AntTag.java
Index: AntTag.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/AntTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AntTag.java 8 Jan 2004 22:20:53 -0000 1.1
+++ AntTag.java 10 Jan 2004 16:41:24 -0000 1.2
@@ -1,9 +1,6 @@
-/*
- * $Header$
- * $Revision$
- * $Date$
- *
- * ====================================================================
+package org.apache.maven.jelly.tags.ant;
+
+/* ====================================================================
*
* The Apache Software License, Version 1.1
*
@@ -56,12 +53,8 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
- *
- * $Id$
*/
-package org.apache.maven.jelly.tags.ant;
-
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.MethodUtils;
import org.apache.commons.beanutils.PropertyUtils;
@@ -88,38 +81,18 @@
import java.util.Iterator;
import java.util.Map;
-/**
- * Tag supporting ant's Tasks as well as
- * dynamic runtime behaviour for 'unknown' tags.
- *
- * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a>
- * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
- */
public class AntTag extends MapTagSupport implements TaskSource
{
-
- /** The Log to which logging calls will be made. */
private static final Log log = LogFactory.getLog( AntTag.class );
private static final Class[] addTaskParamTypes = {String.class};
- /** store the name of the manifest tag for special handling */
- private static final String ANT_MANIFEST_TAG = "manifest";
-
- /** The name of this tag. */
protected String tagName;
- /** The general object underlying this tag. */
protected Object object;
- /** Task, if this tag represents a task. */
protected Task task;
-
- /** Construct with a project and tag name.
- *
- * @param tagName The name on the tag.
- */
public AntTag( String tagName )
{
this.tagName = tagName;
@@ -130,21 +103,11 @@
return "[AntTag: name=" + getTagName() + "]";
}
- // TaskSource interface
- //-------------------------------------------------------------------------
-
- /** Retrieve the general object underlying this tag.
- *
- * @return The object underlying this tag.
- */
public Object getTaskObject()
{
return this.object;
}
- /**
- * Allows nested tags to set a property on the task object of this tag
- */
public void setTaskProperty( String name, Object value ) throws JellyTagException
{
Object object = getTaskObject();
@@ -154,9 +117,8 @@
}
}
- // Tag interface
- //-------------------------------------------------------------------------
- public void doTag( XMLOutput output ) throws JellyTagException
+ public void doTag( XMLOutput output )
+ throws JellyTagException
{
Project project = getAntProject();
@@ -290,9 +252,6 @@
{
}
- // now lets invoke the body
- String body = getBodyText();
-
// now lets set any attributes of this tag...
setBeanProperties();
@@ -355,18 +314,11 @@
}
}
-
- // Properties
- //-------------------------------------------------------------------------
public String getTagName()
{
return this.tagName;
}
- /** Set the object underlying this tag.
- *
- * @param object The object.
- */
public void setObject( Object object )
{
this.object = object;
@@ -375,30 +327,31 @@
public Project getAntProject()
{
Project project = AntTagLibrary.getProject( context );
+
if ( project == null )
{
throw new NullPointerException( "No Ant Project object is available" );
}
+
return project;
}
- // Implementation methods
- //-------------------------------------------------------------------------
-
- /**
- * Sets the properties on the Ant task
- */
public void setBeanProperties() throws JellyTagException
{
Object object = getTaskObject();
+
if ( object != null )
{
Map map = getAttributes();
+
for ( Iterator iter = map.entrySet().iterator(); iter.hasNext(); )
{
Map.Entry entry = (Map.Entry) iter.next();
+
String name = (String) entry.getKey();
+
Object value = entry.getValue();
+
setBeanProperty( object, name, value );
}
}
@@ -470,13 +423,10 @@
}
}
-
- /**
- * Creates a nested object of the given object with the specified name
- */
public Object createNestedObject( Object object, String name )
{
Object dataType = null;
+
if ( object != null )
{
IntrospectionHelper ih = IntrospectionHelper.getHelper( object.getClass() );
@@ -592,19 +542,14 @@
return null;
}
- /**
- * @param taskName
- * @return
- * @throws JellyTagException
- */
- public Task createTask( String taskName ) throws JellyTagException
+ public Task createTask( String taskName )
+ throws JellyTagException
{
- return createTask( taskName,
- (Class) getAntProject().getTaskDefinitions().get( taskName ) );
+ return createTask( taskName, (Class) getAntProject().getTaskDefinitions().get( taskName ) );
}
- public Task createTask( String taskName,
- Class taskType ) throws JellyTagException
+ public Task createTask( String taskName, Class taskType )
+ throws JellyTagException
{
if ( taskType == null )
@@ -650,9 +595,11 @@
* BeanSource interface which creates a bean,
* or will return the parent tag, which is also a bean.
*/
- protected Object findBeanAncestor() throws JellyTagException
+ protected Object findBeanAncestor()
+ throws JellyTagException
{
Tag tag = getParent();
+
while ( tag != null )
{
if ( tag instanceof BeanSource )
@@ -667,12 +614,10 @@
}
tag = tag.getParent();
}
+
return getParent();
}
- /**
- * Walks the hierarchy until it finds a parent TaskSource and returns its source or returns null
- */
protected Object findParentTaskObject() throws JellyTagException
{
Tag tag = getParent();
@@ -687,5 +632,4 @@
}
return null;
}
-
}
1.2 +6 -23 maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/FileIterator.java
Index: FileIterator.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/FileIterator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FileIterator.java 8 Jan 2004 22:20:53 -0000 1.1
+++ FileIterator.java 10 Jan 2004 16:41:24 -0000 1.2
@@ -1,9 +1,6 @@
-/*
- * $Header$
- * $Revision$
- * $Date$
- *
- * ====================================================================
+package org.apache.maven.jelly.tags.ant;
+
+/* ====================================================================
*
* The Apache Software License, Version 1.1
*
@@ -56,10 +53,7 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
- *
- * $Id$
*/
-package org.apache.maven.jelly.tags.ant;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
@@ -76,9 +70,9 @@
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @version $Revision$
*/
-public class FileIterator implements Iterator
+public class FileIterator
+ implements Iterator
{
-
/** The iterator over the FileSet objects */
private Iterator fileSetIterator;
@@ -118,10 +112,6 @@
this.iterateDirectories = iterateDirectories;
}
- // Iterator interface
- //-------------------------------------------------------------------------
-
- /** @return true if there is another object that matches the given predicate */
public boolean hasNext()
{
if ( nextObjectSet )
@@ -134,7 +124,6 @@
}
}
- /** @return the next object which matches the given predicate */
public Object next()
{
if ( !nextObjectSet )
@@ -148,16 +137,10 @@
return nextFile;
}
- /**
- * throws UnsupportedOperationException
- */
public void remove()
{
throw new UnsupportedOperationException();
}
-
- // Implementation methods
- //-------------------------------------------------------------------------
/**
* Set nextObject to the next object. If there are no more
1.2 +4 -10 maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/FileScanner.java
Index: FileScanner.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/FileScanner.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FileScanner.java 8 Jan 2004 22:20:53 -0000 1.1
+++ FileScanner.java 10 Jan 2004 16:41:24 -0000 1.2
@@ -1,9 +1,6 @@
-/*
- * $Header$
- * $Revision$
- * $Date$
- *
- * ====================================================================
+package org.apache.maven.jelly.tags.ant;
+
+/* ====================================================================
*
* The Apache Software License, Version 1.1
*
@@ -56,10 +53,7 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
- *
- * $Id$
*/
-package org.apache.maven.jelly.tags.ant;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FileSet;
1.2 +7 -11 maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/FileScannerTag.java
Index: FileScannerTag.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/FileScannerTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FileScannerTag.java 8 Jan 2004 22:20:53 -0000 1.1
+++ FileScannerTag.java 10 Jan 2004 16:41:24 -0000 1.2
@@ -1,9 +1,6 @@
-/*
- * $Header$
- * $Revision$
- * $Date$
- *
- * ====================================================================
+package org.apache.maven.jelly.tags.ant;
+
+/* ====================================================================
*
* The Apache Software License, Version 1.1
*
@@ -56,10 +53,7 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
- *
- * $Id$
*/
-package org.apache.maven.jelly.tags.ant;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.jelly.JellyTagException;
@@ -76,7 +70,9 @@
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @version $Revision$
*/
-public class FileScannerTag extends TagSupport implements TaskSource
+public class FileScannerTag
+ extends TagSupport
+ implements TaskSource
{
/** The file walker that gets created */
1.2 +7 -43 maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/SetPropertyTag.java
Index: SetPropertyTag.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/SetPropertyTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SetPropertyTag.java 8 Jan 2004 22:20:53 -0000 1.1
+++ SetPropertyTag.java 10 Jan 2004 16:41:24 -0000 1.2
@@ -1,9 +1,6 @@
-/*
- * $Header$
- * $Revision$
- * $Date$
- *
- * ====================================================================
+package org.apache.maven.jelly.tags.ant;
+
+/* ====================================================================
*
* The Apache Software License, Version 1.1
*
@@ -57,17 +54,12 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
- * $Id$
*/
-package org.apache.maven.jelly.tags.ant;
-
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
/**
* Tag which sets an attribute on the parent Ant Task if the given value is not null.
@@ -76,14 +68,13 @@
*
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
*/
-public class SetPropertyTag extends TagSupport
+public class SetPropertyTag
+ extends TagSupport
{
-
- /** The Log to which logging calls will be made. */
- private static final Log log = LogFactory.getLog( SetPropertyTag.class );
-
private String name;
+
private Object value;
+
private Object defaultValue;
public SetPropertyTag()
@@ -114,58 +105,31 @@
}
}
-
- // Properties
- //-------------------------------------------------------------------------
-
- /**
- * Returns the name.
- * @return String
- */
public String getName()
{
return name;
}
- /**
- * Returns the value.
- * @return Object
- */
public Object getValue()
{
return value;
}
- /**
- * Sets the name of the Ant task property to set.
- * @param name The name of the Ant task property to set
- */
public void setName( String name )
{
this.name = name;
}
- /**
- * Sets the value of the Ant task property to set.
- * @param value The value of the Ant task property to set
- */
public void setValue( Object value )
{
this.value = value;
}
- /**
- * Returns the defaultValue.
- * @return Object
- */
public Object getDefault()
{
return defaultValue;
}
- /**
- * Sets the default value to be used if the specified value is empty.
- */
public void setDefault( Object defaultValue )
{
this.defaultValue = defaultValue;
1.2 +8 -19 maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/TaskSource.java
Index: TaskSource.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/java/org/apache/maven/jelly/tags/ant/TaskSource.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TaskSource.java 8 Jan 2004 22:20:53 -0000 1.1
+++ TaskSource.java 10 Jan 2004 16:41:24 -0000 1.2
@@ -1,9 +1,6 @@
-/*
- * $Header$
- * $Revision$
- * $Date$
- *
- * ====================================================================
+package org.apache.maven.jelly.tags.ant;
+
+/* ====================================================================
*
* The Apache Software License, Version 1.1
*
@@ -56,10 +53,7 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
- *
- * $Id$
*/
-package org.apache.maven.jelly.tags.ant;
import org.apache.commons.jelly.JellyTagException;
@@ -71,14 +65,9 @@
*/
public interface TaskSource
{
+ public Object getTaskObject()
+ throws JellyTagException;
- /**
- * @return the Ant object which may be an Ant Task or nested element
- */
- public Object getTaskObject() throws JellyTagException;
-
- /**
- * Allows nested tags to set a property on the task object of this tag
- */
- public void setTaskProperty( String name, Object value ) throws JellyTagException;
+ public void setTaskProperty( String name, Object value )
+ throws JellyTagException;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org