Class ToolUtils

java.lang.Object
org.infinispan.tools.ToolUtils

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

  • Constructor Details

    • ToolUtils

      public ToolUtils()
  • Method Details

    • getBaseFileName

      public static String getBaseFileName(String absoluteFileName)
    • printDocument

      public static void printDocument(Document doc, OutputStream out) throws TransformerException
      Throws:
      TransformerException
    • 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.
    • findFirstChildByPath

      public static Optional<Node> findFirstChildByPath(Node parent, String fullPath)
      Similar to findFirstChildByTagName(Node, String) but it uses a fullPath to search the first child that matches it.
      Parameters:
      parent - The parent Node.
      fullPath - The path where to search for the child.
      Returns:
      The Optional with the Node instance if found. Otherwise, an empty Optional.
    • 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