Package net.ggtools.grand.ant
Class LinkFinderVisitor
- java.lang.Object
-
- net.ggtools.grand.ant.LinkFinderVisitor
-
public class LinkFinderVisitor extends Object
A task visitor looking for links created by tasks likeant
,antcall
, etc.- Author:
- Christophe Labouisse
-
-
Constructor Summary
Constructors Constructor Description LinkFinderVisitor(AntProject project)
Constructor for LinkFinderVisitor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defaultVisit(org.apache.tools.ant.RuntimeConfigurable wrapper)
Default action for unknown task.String
getAliasForTask(String taskName)
Method getAliasForTask.void
reflectVisit_ant(org.apache.tools.ant.RuntimeConfigurable wrapper)
Process theant
task.void
reflectVisit_antcall(org.apache.tools.ant.RuntimeConfigurable wrapper)
Processantcall
and similar tasks.void
reflectVisit_subant(org.apache.tools.ant.RuntimeConfigurable wrapper)
Processsubant
task.void
setGraph(AntGraph graph)
void
setStartNode(AntTargetNode startNode)
void
visit(org.apache.tools.ant.RuntimeConfigurable wrapper)
Invoke the right method depending on the wrapper's element tag.
-
-
-
Constructor Detail
-
LinkFinderVisitor
public LinkFinderVisitor(AntProject project)
Constructor for LinkFinderVisitor.- Parameters:
project
- AntProject
-
-
Method Detail
-
defaultVisit
public final void defaultVisit(org.apache.tools.ant.RuntimeConfigurable wrapper) throws GrandException
Default action for unknown task. The default behavior is to recurse in the children to find a possible task.- Parameters:
wrapper
- wrapper to check.- Throws:
GrandException
- if an error occurs in visit()- See Also:
ReflectTaskVisitorBase.defaultVisit(org.apache.tools.ant.RuntimeConfigurable)
-
getAliasForTask
public final String getAliasForTask(String taskName)
Method getAliasForTask.- Parameters:
taskName
- String- Returns:
- String
- See Also:
ReflectTaskVisitorBase.getAliasForTask(java.lang.String)
-
reflectVisit_ant
public final void reflectVisit_ant(org.apache.tools.ant.RuntimeConfigurable wrapper) throws DuplicateElementException
Process theant
task. This method will find or create the destination node of the task, create anAntTaskLink
and find the nestedproperty
nodes to set the link properties. Onlyname
,value
property nodes will be processed: thefile
property nodes will be ignored. The called node name will be either the plaintarget
attribute value if it is located in the current build file or[target]
.- Parameters:
wrapper
- the wrapper to process.- Throws:
DuplicateElementException
- if a duplicate node is created, should not happen.
-
reflectVisit_antcall
public final void reflectVisit_antcall(org.apache.tools.ant.RuntimeConfigurable wrapper) throws DuplicateElementException
Processantcall
and similar tasks. The method will create a link between the current start node and the node referenced by thetarget
attribute creating it with theNode.ATTR_MISSING_NODE
if no such node exists. It will then create anAntTaskLink
link and look for nestedparam
elements to set parameters to newly created link.- Parameters:
wrapper
- wrapper to process.- Throws:
DuplicateElementException
- if a duplicate node is created (should not happen).
-
reflectVisit_subant
public final void reflectVisit_subant(org.apache.tools.ant.RuntimeConfigurable wrapper) throws DuplicateElementException
Processsubant
task. Depending of the existence of thegenericantfile
attribute, this method will either create a special link holding a list of directories or a set of ant taskish links. During those creations, the end nodes will be created with theNode.ATTR_MISSING_NODE
attribute if needed.- Parameters:
wrapper
- wrapper to process.- Throws:
DuplicateElementException
- if a duplicate node is created (should not happen).
-
setGraph
public final void setGraph(AntGraph graph)
- Parameters:
graph
- The graph to set.
-
setStartNode
public final void setStartNode(AntTargetNode startNode)
- Parameters:
startNode
- The startNode to set.
-
visit
public void visit(org.apache.tools.ant.RuntimeConfigurable wrapper) throws GrandException
Invoke the right method depending on the wrapper's element tag. The algorithm is:- get the wrapper's element tag name,
- if the cache already contain a method, use it,
- call
getAliasForTask(String)
to find out if there is an alias for this task, - try to get the method called
reflectVisit_task_name
, - call the found method.
defaultVisit(RuntimeConfigurable)
fallback method.- Parameters:
wrapper
- Wrapper to visit.- Throws:
GrandException
- if something goes wrong.- See Also:
TaskVisitor.visit(org.apache.tools.ant.RuntimeConfigurable)
-
-