AutoCloseable
, IterableModuleFinder
, ModuleFinder
public final class LocalModuleFinder extends Object implements IterableModuleFinder, AutoCloseable
module.xml
descriptors.Constructor | Description |
---|---|
LocalModuleFinder() |
Construct a new instance, using the
module.path system property or the JAVA_MODULEPATH environment variable
to get the list of module repository roots. |
LocalModuleFinder(boolean supportLayersAndAddOns) |
Construct a new instance, using the
module.path system property or the JAVA_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.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Close this module loader and release all backing files.
|
ModuleSpec |
findModule(String name,
ModuleLoader delegateLoader) |
Find a module specification for the given name.
|
Iterator<String> |
iterateModules(String baseName,
boolean recursive) |
Iterate the modules which can be located via this module finder.
|
static ModuleSpec |
parseModuleXmlFile(String name,
ModuleLoader delegateLoader,
File... roots) |
Parse a
module.xml file and return the corresponding module specification. |
static ModuleSpec |
parseModuleXmlFile(ModuleIdentifier identifier,
ModuleLoader delegateLoader,
File... roots) |
Deprecated.
Use
parseModuleXmlFile(String, ModuleLoader, File...) instead. |
String |
toString() |
iterateModules
findModule
public LocalModuleFinder(File[] repoRoots, PathFilter pathFilter)
repoRoots
- the repository roots to usepathFilter
- the path filter to usepublic LocalModuleFinder(File[] repoRoots)
repoRoots
- the repository roots to usepublic LocalModuleFinder()
module.path
system property or the JAVA_MODULEPATH
environment variable
to get the list of module repository roots.
This is equivalent to a call to LocalModuleFinder(true)
.
public LocalModuleFinder(boolean supportLayersAndAddOns)
module.path
system property or the JAVA_MODULEPATH
environment variable
to get the list of module repository roots.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 a layers.conf
file found in
the module repository root will be added in the precedence of order specified
in the layers.conf
file; all "add-on" subdirectories will be added at
a lower precedence than all "layers" and with no guaranteed precedence order
between them. If false
no check for "layer" and "add-on" directories
will be performed.public ModuleSpec findModule(String name, ModuleLoader delegateLoader) throws ModuleLoadException
ModuleFinder
ModuleFinder.findModule(ModuleIdentifier, ModuleLoader)
method.findModule
in interface ModuleFinder
name
- the module namedelegateLoader
- the module loader from which dependencies should be resolvednull
if no specification is found for this identifierModuleLoadException
@Deprecated public static ModuleSpec parseModuleXmlFile(ModuleIdentifier identifier, ModuleLoader delegateLoader, File... roots) throws IOException, ModuleLoadException
parseModuleXmlFile(String, ModuleLoader, File...)
instead.module.xml
file and return the corresponding module specification.identifier
- the identifier to loaddelegateLoader
- the delegate module loader to use for module specificationsroots
- the repository root paths to searchIOException
- if reading the module file failedModuleLoadException
- if creating the module specification failed (e.g. due to a parse error)public static ModuleSpec parseModuleXmlFile(String name, ModuleLoader delegateLoader, File... roots) throws IOException, ModuleLoadException
module.xml
file and return the corresponding module specification.name
- the name of the module to loaddelegateLoader
- the delegate module loader to use for module specificationsroots
- the repository root paths to searchIOException
- if reading the module file failedModuleLoadException
- if creating the module specification failed (e.g. due to a parse error)public Iterator<String> iterateModules(String baseName, boolean recursive)
IterableModuleFinder
iterateModules
in interface IterableModuleFinder
baseName
- the identifier to start with, or null
to iterate all modules; ignored if this module
loader does not have a concept of nested modulesrecursive
- true
to find recursively nested modules, false
to only find immediately nested
modules; ignored if this module finder does not have a concept of nested modulespublic void close()
close
in interface AutoCloseable
Copyright © 2022 JBoss by Red Hat. All rights reserved.