Package org.jboss.modules
Class LocalModuleFinder
java.lang.Object
org.jboss.modules.LocalModuleFinder
- All Implemented Interfaces:
AutoCloseable
,IterableModuleFinder
,ModuleFinder
A module finder which locates module specifications which are stored in a local module
repository on the filesystem, which uses
module.xml
descriptors.- Author:
- David M. Lloyd, Richard Opalka
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance, using themodule.path
system property or theJAVA_MODULEPATH
environment variable to get the list of module repository roots.LocalModuleFinder
(boolean supportLayersAndAddOns) Construct a new instance, using themodule.path
system property or theJAVA_MODULEPATH
environment variable to get the list of module repository roots.LocalModuleFinder
(File[] repoRoots) Construct a new instance.LocalModuleFinder
(File[] repoRoots, PathFilter pathFilter) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this module loader and release all backing files.findModule
(String name, ModuleLoader delegateLoader) Find a module specification for the given name.iterateModules
(String baseName, boolean recursive, ModuleLoader delegateLoader) static ModuleSpec
parseModuleXmlFile
(String name, ModuleLoader delegateLoader, File... roots) Parse amodule.xml
file and return the corresponding module specification.static ModuleSpec
parseModuleXmlFile
(ModuleIdentifier identifier, ModuleLoader delegateLoader, File... roots) Deprecated, for removal: This API element is subject to removal in a future version.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jboss.modules.IterableModuleFinder
iterateModules, iterateModules
Methods inherited from interface org.jboss.modules.ModuleFinder
findModule
-
Constructor Details
-
LocalModuleFinder
Construct a new instance.- Parameters:
repoRoots
- the repository roots to usepathFilter
- the path filter to use
-
LocalModuleFinder
Construct a new instance.- Parameters:
repoRoots
- the repository roots to use
-
LocalModuleFinder
public LocalModuleFinder()Construct a new instance, using themodule.path
system property or theJAVA_MODULEPATH
environment variable to get the list of module repository roots.This is equivalent to a call to
LocalModuleFinder(true)
. -
LocalModuleFinder
public LocalModuleFinder(boolean supportLayersAndAddOns) Construct a new instance, using themodule.path
system property or theJAVA_MODULEPATH
environment variable to get the list of module repository roots.- Parameters:
supportLayersAndAddOns
-true
if the identified module repository roots should be checked for an internal structure of child "layer" and "add-on" directories that may also be treated as module roots lower in precedence than the parent root. Any "layers" subdirectories whose names are specified in alayers.conf
file found in the module repository root will be added in the precedence of order specified in thelayers.conf
file; all "add-on" subdirectories will be added at a lower precedence than all "layers" and with no guaranteed precedence order between them. Iffalse
no check for "layer" and "add-on" directories will be performed.
-
-
Method Details
-
findModule
Description copied from interface:ModuleFinder
Find a module specification for the given name. The default implementation delegates to the legacyModuleFinder.findModule(ModuleIdentifier, ModuleLoader)
method for now, however this behavior will be discontinued in the future.- Specified by:
findModule
in interfaceModuleFinder
- Parameters:
name
- the module namedelegateLoader
- the module loader from which dependencies should be resolved- Returns:
- the module specification, or
null
if no specification is found for this identifier - Throws:
ModuleLoadException
-
parseModuleXmlFile
@Deprecated(forRemoval=true) public static ModuleSpec parseModuleXmlFile(ModuleIdentifier identifier, ModuleLoader delegateLoader, File... roots) throws IOException, ModuleLoadException Deprecated, for removal: This API element is subject to removal in a future version.UseparseModuleXmlFile(String, ModuleLoader, File...)
instead.Parse amodule.xml
file and return the corresponding module specification.- Parameters:
identifier
- the identifier to loaddelegateLoader
- the delegate module loader to use for module specificationsroots
- the repository root paths to search- Returns:
- the module specification
- Throws:
IOException
- if reading the module file failedModuleLoadException
- if creating the module specification failed (e.g. due to a parse error)
-
parseModuleXmlFile
public static ModuleSpec parseModuleXmlFile(String name, ModuleLoader delegateLoader, File... roots) throws IOException, ModuleLoadException Parse amodule.xml
file and return the corresponding module specification.- Parameters:
name
- the name of the module to loaddelegateLoader
- the delegate module loader to use for module specificationsroots
- the repository root paths to search- Returns:
- the module specification
- Throws:
IOException
- if reading the module file failedModuleLoadException
- if creating the module specification failed (e.g. due to a parse error)
-
iterateModules
public Iterator<String> iterateModules(String baseName, boolean recursive, ModuleLoader delegateLoader) - Specified by:
iterateModules
in interfaceIterableModuleFinder
-
toString
-
close
public void close()Close this module loader and release all backing files. Note that subsequent load attempts will fail with an error after this method is called.- Specified by:
close
in interfaceAutoCloseable
-
parseModuleXmlFile(String, ModuleLoader, File...)
instead.