Class LinkFinderVisitor


  • public class LinkFinderVisitor
    extends Object
    A task visitor looking for links created by tasks like ant, antcall, etc.
    Author:
    Christophe Labouisse
    • 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 the ant task. This method will find or create the destination node of the task, create an AntTaskLinkand find the nested property nodes to set the link properties. Only name,value property nodes will be processed: the file property nodes will be ignored. The called node name will be either the plain target 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
        Process antcall and similar tasks. The method will create a link between the current start node and the node referenced by the target attribute creating it with the Node.ATTR_MISSING_NODEif no such node exists. It will then create an AntTaskLinklink and look for nested param 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
        Process subant task. Depending of the existence of the genericantfile 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 the Node.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 GrandException
        Invoke the right method depending on the wrapper's element tag. The algorithm is:
        1. get the wrapper's element tag name,
        2. if the cache already contain a method, use it,
        3. call getAliasForTask(String)to find out if there is an alias for this task,
        4. try to get the method called reflectVisit_task_name,
        5. call the found method.
        If the following algorithm fails then we'll use the defaultVisit(RuntimeConfigurable)fallback method.
        Parameters:
        wrapper - Wrapper to visit.
        Throws:
        GrandException - if something goes wrong.
        See Also:
        TaskVisitor.visit(org.apache.tools.ant.RuntimeConfigurable)