Class ToolUtils


  • public class ToolUtils
    extends Object
    Since:
    10.0
    Author:
    Tristan Tarrant <tristan@infinispan.org>
    • Constructor Detail

      • ToolUtils

        public ToolUtils()
    • Method Detail

      • getBaseFileName

        public static String getBaseFileName​(String absoluteFileName)
      • findFirstChildByTagName

        public static Optional<Node> findFirstChildByTagName​(Node parent,
                                                             String tagName)
        Given a parent Node, it search all the children and returns the first one to match the tagName.
        Parameters:
        parent - The parent Node.
        tagName - The tag name to search for.
        Returns:
        The Node of the first child with tagName or null if it does not exist.
      • parseXMLDependencies

        public static List<Dependency> parseXMLDependencies​(Document document)
        Parses the "licenses.xml" files generated by the Wildfly licenses-plugin (maven projects) or license-reporter (nodejs projects).
        Parameters:
        document - The Document to parse.
        Returns:
        A List with all the Dependency found.
      • removeEmptyLinesFromFile

        public static void removeEmptyLinesFromFile​(File file)
                                             throws IOException
        Trims all the empty lines from a file.
        Parameters:
        file - The File to trim.
        Throws:
        IOException - If an i/o error occurs.
      • textFromNode

        public static String textFromNode​(Node node)
        Returns:
        the text context trimmed of Node