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 voiddefaultVisit(org.apache.tools.ant.RuntimeConfigurable wrapper)Default action for unknown task.StringgetAliasForTask(String taskName)Method getAliasForTask.voidreflectVisit_ant(org.apache.tools.ant.RuntimeConfigurable wrapper)Process theanttask.voidreflectVisit_antcall(org.apache.tools.ant.RuntimeConfigurable wrapper)Processantcalland similar tasks.voidreflectVisit_subant(org.apache.tools.ant.RuntimeConfigurable wrapper)Processsubanttask.voidsetGraph(AntGraph graph)voidsetStartNode(AntTargetNode startNode)voidvisit(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 GrandExceptionDefault 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 DuplicateElementExceptionProcess theanttask. This method will find or create the destination node of the task, create anAntTaskLinkand find the nestedpropertynodes to set the link properties. Onlyname,valueproperty nodes will be processed: thefileproperty nodes will be ignored. The called node name will be either the plaintargetattribute 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 DuplicateElementExceptionProcessantcalland similar tasks. The method will create a link between the current start node and the node referenced by thetargetattribute creating it with theNode.ATTR_MISSING_NODEif no such node exists. It will then create anAntTaskLinklink and look for nestedparamelements 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 DuplicateElementExceptionProcesssubanttask. Depending of the existence of thegenericantfileattribute, 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_NODEattribute 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 GrandExceptionInvoke 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)
-
-