Class ModuleDescription

java.lang.Object
org.wildfly.testing.tools.modules.ModuleDescription
All Implemented Interfaces:
AutoCloseable, Comparable<ModuleDescription>

public final class ModuleDescription extends Object implements AutoCloseable, Comparable<ModuleDescription>
Describes a created module. When this is closed the module will be deleted. If the files and directory cannot be deleted, a shutdown hook will be added to delete the module when the JVM exits. This typically happens on Windows as the module loader holds a lock on the resources.
Author:
James R. Perkins
  • Method Details

    • createAlias

      public static ModuleDescription createAlias(String moduleName, String targetName)
      Creates a module-alias with the discovered module path.
      Parameters:
      moduleName - the name of the module
      targetName - the target name for the alias
      Returns:
      the module description for the alias
    • createAlias

      public static ModuleDescription createAlias(Path modulePath, String moduleName, String targetName)
      Creates a module alias based on the module path. If the module path is null an attempt to discover it will be done.
      Parameters:
      modulePath - the path to the base module path
      moduleName - the name of the module
      targetName - the target name for the alias
      Returns:
      the module description for the alias
    • name

      public String name()
      The modules name.
      Returns:
      the modules name
    • modulePath

      public Path modulePath()
      The path to the module.
      Returns:
      the path to the module
    • compareTo

      public int compareTo(ModuleDescription o)
      Specified by:
      compareTo in interface Comparable<ModuleDescription>
    • close

      public void close()
      Deletes the module files and directories. If an error occurs attempting to delete the module, a shutdown hook is added to attempt to delete the resources when the JVM exits.
      Specified by:
      close in interface AutoCloseable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object