Package org.jboss.modules
Class LocalModuleFinder
- java.lang.Object
-
- org.jboss.modules.LocalModuleFinder
-
- All Implemented Interfaces:
ModuleFinder
public final class LocalModuleFinder extends java.lang.Object implements ModuleFinder
A module finder which locates module specifications which are stored in a local module repository on the filesystem, which usesmodule.xml
descriptors.
-
-
Field Summary
Fields Modifier and Type Field Description private java.security.AccessControlContext
accessControlContext
private static java.io.File[]
NO_FILES
private PathFilter
pathFilter
private java.io.File[]
repoRoots
-
Constructor Summary
Constructors Modifier Constructor Description LocalModuleFinder()
Construct 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(java.io.File[] repoRoots)
Construct a new instance.LocalModuleFinder(java.io.File[] repoRoots, PathFilter pathFilter)
Construct a new instance.private
LocalModuleFinder(java.io.File[] repoRoots, PathFilter pathFilter, boolean cloneRoots)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ModuleSpec
findModule(ModuleIdentifier identifier, ModuleLoader delegateLoader)
Find a module specification for the given identifier.private static java.io.File[]
getFiles(java.lang.String modulePath, int stringIdx, int arrayIdx)
private static java.io.File[]
getModulePathFiles()
(package private) static java.io.File[]
getRepoRoots(boolean supportLayersAndAddOns)
static ModuleSpec
parseModuleXmlFile(ModuleIdentifier identifier, ModuleLoader delegateLoader, java.io.File... roots)
Parse amodule.xml
file and return the corresponding module specification.private static java.lang.String
toPathString(ModuleIdentifier moduleIdentifier)
java.lang.String
toString()
-
-
-
Field Detail
-
NO_FILES
private static final java.io.File[] NO_FILES
-
repoRoots
private final java.io.File[] repoRoots
-
pathFilter
private final PathFilter pathFilter
-
accessControlContext
private final java.security.AccessControlContext accessControlContext
-
-
Constructor Detail
-
LocalModuleFinder
private LocalModuleFinder(java.io.File[] repoRoots, PathFilter pathFilter, boolean cloneRoots)
-
LocalModuleFinder
public LocalModuleFinder(java.io.File[] repoRoots, PathFilter pathFilter)
Construct a new instance.- Parameters:
repoRoots
- the repository roots to usepathFilter
- the path filter to use
-
LocalModuleFinder
public LocalModuleFinder(java.io.File[] repoRoots)
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 Detail
-
getRepoRoots
static java.io.File[] getRepoRoots(boolean supportLayersAndAddOns)
-
getModulePathFiles
private static java.io.File[] getModulePathFiles()
-
getFiles
private static java.io.File[] getFiles(java.lang.String modulePath, int stringIdx, int arrayIdx)
-
toPathString
private static java.lang.String toPathString(ModuleIdentifier moduleIdentifier)
-
findModule
public ModuleSpec findModule(ModuleIdentifier identifier, ModuleLoader delegateLoader) throws ModuleLoadException
Description copied from interface:ModuleFinder
Find a module specification for the given identifier.- Specified by:
findModule
in interfaceModuleFinder
- Parameters:
identifier
- the module identifierdelegateLoader
- 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
public static ModuleSpec parseModuleXmlFile(ModuleIdentifier identifier, ModuleLoader delegateLoader, java.io.File... roots) throws java.io.IOException, ModuleLoadException
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:
java.io.IOException
- if reading the module file failedModuleLoadException
- if creating the module specification failed (e.g. due to a parse error)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-