Package org.jboss.modules
Class LocalModuleFinder
- java.lang.Object
-
- org.jboss.modules.LocalModuleFinder
-
- All Implemented Interfaces:
java.lang.AutoCloseable,IterableModuleFinder,ModuleFinder
public final class LocalModuleFinder extends java.lang.Object implements IterableModuleFinder, java.lang.AutoCloseable
A module finder which locates module specifications which are stored in a local module repository on the filesystem, which usesmodule.xmldescriptors.- Author:
- David M. Lloyd, Richard Opalka
-
-
Constructor Summary
Constructors Constructor Description LocalModuleFinder()Construct a new instance, using themodule.pathsystem property or theJAVA_MODULEPATHenvironment variable to get the list of module repository roots.LocalModuleFinder(boolean supportLayersAndAddOns)Construct a new instance, using themodule.pathsystem property or theJAVA_MODULEPATHenvironment 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Close this module loader and release all backing files.ModuleSpecfindModule(java.lang.String name, ModuleLoader delegateLoader)Find a module specification for the given name.java.util.Iterator<java.lang.String>iterateModules(java.lang.String baseName, boolean recursive)Iterate the modules which can be located via this module finder.static ModuleSpecparseModuleXmlFile(java.lang.String name, ModuleLoader delegateLoader, java.io.File... roots)Parse amodule.xmlfile and return the corresponding module specification.static ModuleSpecparseModuleXmlFile(ModuleIdentifier identifier, ModuleLoader delegateLoader, java.io.File... roots)Deprecated.UseparseModuleXmlFile(String, ModuleLoader, File...)instead.java.lang.StringtoString()-
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
-
Methods inherited from interface org.jboss.modules.ModuleFinder
findModule
-
-
-
-
Constructor Detail
-
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.pathsystem property or theJAVA_MODULEPATHenvironment 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.pathsystem property or theJAVA_MODULEPATHenvironment variable to get the list of module repository roots.- Parameters:
supportLayersAndAddOns-trueif 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.conffile found in the module repository root will be added in the precedence of order specified in thelayers.conffile; all "add-on" subdirectories will be added at a lower precedence than all "layers" and with no guaranteed precedence order between them. Iffalseno check for "layer" and "add-on" directories will be performed.
-
-
Method Detail
-
findModule
public ModuleSpec findModule(java.lang.String name, ModuleLoader delegateLoader) throws ModuleLoadException
Description copied from interface:ModuleFinderFind a module specification for the given name. The default implementation delegates to the legacyModuleFinder.findModule(ModuleIdentifier, ModuleLoader)method.- Specified by:
findModulein interfaceModuleFinder- Parameters:
name- the module namedelegateLoader- the module loader from which dependencies should be resolved- Returns:
- the module specification, or
nullif no specification is found for this identifier - Throws:
ModuleLoadException
-
parseModuleXmlFile
@Deprecated public static ModuleSpec parseModuleXmlFile(ModuleIdentifier identifier, ModuleLoader delegateLoader, java.io.File... roots) throws java.io.IOException, ModuleLoadException
Deprecated.UseparseModuleXmlFile(String, ModuleLoader, File...)instead.Parse amodule.xmlfile 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)
-
parseModuleXmlFile
public static ModuleSpec parseModuleXmlFile(java.lang.String name, ModuleLoader delegateLoader, java.io.File... roots) throws java.io.IOException, ModuleLoadException
Parse amodule.xmlfile 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:
java.io.IOException- if reading the module file failedModuleLoadException- if creating the module specification failed (e.g. due to a parse error)
-
iterateModules
public java.util.Iterator<java.lang.String> iterateModules(java.lang.String baseName, boolean recursive)Description copied from interface:IterableModuleFinderIterate the modules which can be located via this module finder.- Specified by:
iterateModulesin interfaceIterableModuleFinder- Parameters:
baseName- the identifier to start with, ornullto iterate all modules; ignored if this module loader does not have a concept of nested modulesrecursive-trueto find recursively nested modules,falseto only find immediately nested modules; ignored if this module finder does not have a concept of nested modules- Returns:
- an iterator for the modules in this module finder
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
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:
closein interfacejava.lang.AutoCloseable
-
-