Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.axis.tools.ant.foreach
Class ForeachTask  view ForeachTask download ForeachTask.java

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.apache.axis.tools.ant.foreach.ForeachTask

public class ForeachTask
extends org.apache.tools.ant.Task

Call a target foreach entry in a set of parameters based on a fileset.

For Axis development; there is no support or stability associated with this task

    <target name="target1">
      <foreach target="target2">
        <param name="param1">
            <fileset refid="fset1"/>
        </param>
        <param name="param2">
          <item value="jar" />
          <item value="zip" />
        </param>
       </foreach>
    </target>

    <target name="target2">
      <echo message="prop is ${param1}.${param2}" />
    </target>  
 

Really this just a wrapper around "AntCall"
Added a "type" attribute that works precisely like its equivalent in ExecuteOn. It allows the user to specify whether directories, files, or both directories and files from the filesets are included as entries in the parameter set.


Field Summary
private  org.apache.tools.ant.taskdefs.Ant callee
           
private  org.apache.tools.ant.taskdefs.Java callee2
           
private  boolean fork
           
private  boolean inheritAll
           
private  boolean inheritRefs
           
private  java.util.Vector params
           
private  java.util.Hashtable properties
           
private  java.lang.String subTarget
           
private  boolean verbose
           
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
ForeachTask()
           
 
Method Summary
private  void buildProperty(java.lang.String propName, java.lang.String propValue)
           
 ParamSet createParam()
           
 void execute()
          Called by the project to let the task do its work.
private  void executeAntTask()
           
private  void executeForkedAntTask()
           
private  void executeParameters(int paramNumber)
          This method is used to recursively iterate through each parameter set.
private  void executeTarget()
           
 void init()
          Called by the project to let the task initialize properly.
 void setFork(boolean f)
          If true, forks the ant invocation.
 void setInheritAll(boolean inherit)
          If true, pass all properties to the new Ant project.
 void setInheritRefs(boolean inheritRefs)
          If true, pass all references to the new Ant project.
 void setTarget(java.lang.String target)
          Target to execute, required.
 void setVerbose(boolean verbose)
          Enable verbose output when signing ; optional: default false
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callee

private org.apache.tools.ant.taskdefs.Ant callee

callee2

private org.apache.tools.ant.taskdefs.Java callee2

subTarget

private java.lang.String subTarget

params

private java.util.Vector params

properties

private java.util.Hashtable properties

inheritAll

private boolean inheritAll

inheritRefs

private boolean inheritRefs

fork

private boolean fork

verbose

private boolean verbose
Constructor Detail

ForeachTask

public ForeachTask()
Method Detail

init

public void init()
Description copied from class: org.apache.tools.ant.Task
Called by the project to let the task initialize properly. The default implementation is a no-op.


setInheritAll

public void setInheritAll(boolean inherit)
If true, pass all properties to the new Ant project. Defaults to true.


setInheritRefs

public void setInheritRefs(boolean inheritRefs)
If true, pass all references to the new Ant project. Defaults to false


setTarget

public void setTarget(java.lang.String target)
Target to execute, required.


setFork

public void setFork(boolean f)
If true, forks the ant invocation.


setVerbose

public void setVerbose(boolean verbose)
Enable verbose output when signing ; optional: default false


createParam

public ParamSet createParam()

buildProperty

private void buildProperty(java.lang.String propName,
                           java.lang.String propValue)

executeTarget

private void executeTarget()

executeForkedAntTask

private void executeForkedAntTask()

executeAntTask

private void executeAntTask()

executeParameters

private void executeParameters(int paramNumber)
This method is used to recursively iterate through each parameter set. It ends up being something like:
    for( i=0; i< params[0].size ; i++ )
       for( j=0; j < params[1].size ; j++ )
          for( k=0; k < params[2].size ; k++ )
             executeTarget( params[0][i], params[1][j] , params[2][k] ) ;
 


execute

public void execute()
Description copied from class: org.apache.tools.ant.Task
Called by the project to let the task do its work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 target2" will run all tasks in target3 twice.