Top Description Fields Constructors Methods
org.jboss.modules

public final Class LocalModuleFinder

extends Object
implements IterableModuleFinder, AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable, org.jboss.modules.IterableModuleFinder, org.jboss.modules.ModuleFinder
Imports
java.io.File, .FilePermission, .IOException, .InputStream, java.lang.reflect.UndeclaredThrowableException, java.nio.file.Files, .Path, java.security.AccessControlContext, .AccessController, .PrivilegedActionException, .PrivilegedExceptionAction, java.util.ArrayList, .Arrays, .Collection, .HashSet, .Iterator, .List, .NoSuchElementException, .Set, java.util.function.Predicate, org.jboss.modules.filter.PathFilter, .PathFilters, org.jboss.modules.xml.ModuleXmlParser

A module finder which locates module specifications which are stored in a local module repository on the filesystem, which uses module.xml descriptors.
Authors
David M. Lloyd, Richard Opalka

Field Summary

Modifier and TypeField and Description
private final AccessControlContext
accessControlContext

Deprecated as a consequence of AccessControlContext being deprecated.
private static final Predicate<Path>
private static final Path
private static final File[]
private final PathFilter
private final File[]
private final List<ResourceLoader>
private final ModuleXmlParser.ResourceRootFactory
private static final ResourceLoader

Constructor Summary

AccessConstructor and Description
private
LocalModuleFinder(final File[] repoRoots, final PathFilter pathFilter, final boolean cloneRoots)

public
LocalModuleFinder(final File[]
the repository roots to use
repoRoots
,
final PathFilter
the path filter to use
pathFilter
)

Construct a new instance.

public
LocalModuleFinder(final File[]
the repository roots to use
repoRoots
)

Construct a new instance.

public
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.

public
LocalModuleFinder(boolean
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.
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.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.lang.AutoCloseable.close.

Close this module loader and release all backing files.
public ModuleSpec
findModule(final String
the module name
name
,
final ModuleLoader
the module loader from which dependencies should be resolved
delegateLoader
)

Overrides default org.jboss.modules.ModuleFinder.findModule.

Find a module specification for the given name.
private static File[]
getFiles(final String modulePath, final int stringIdx, final int arrayIdx)

private static File[]
pack-priv static File[]
getRepoRoots(final boolean supportLayersAndAddOns)

public Iterator<String>
iterateModules(final String baseName, final boolean recursive, final ModuleLoader delegateLoader)

Overrides default org.jboss.modules.IterableModuleFinder.iterateModules.

public static ModuleSpec

Returns:

the module specification
parseModuleXmlFile
(final ModuleIdentifier
the identifier to load
identifier
,
final ModuleLoader
the delegate module loader to use for module specifications
delegateLoader
,
final File...
the repository root paths to search
roots
)

Parse a module.xml file and return the corresponding module specification.
public static ModuleSpec

Returns:

the module specification
parseModuleXmlFile
(final String
the name of the module to load
name
,
final ModuleLoader
the delegate module loader to use for module specifications
delegateLoader
,
final File...
the repository root paths to search
roots
)

Parse a module.xml file and return the corresponding module specification.

pack-priv static ModuleSpec
parseModuleXmlFile(final ModuleXmlParser.ResourceRootFactory factory, final String name, final ModuleLoader delegateLoader, final File... roots)

private static void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

accessControlContextback to summary
private final AccessControlContext accessControlContext

Deprecated

as a consequence of AccessControlContext being deprecated. See corresponding docs for further information.

ITER_FILTERback to summary
private static final Predicate<Path> ITER_FILTER
MODULE_FILE_PATHback to summary
private static final Path MODULE_FILE_PATH
NO_FILESback to summary
private static final File[] NO_FILES
pathFilterback to summary
private final PathFilter pathFilter
repoRootsback to summary
private final File[] repoRoots
resourceLoaderListback to summary
private final List<ResourceLoader> resourceLoaderList
resourceRootFactoryback to summary
private final ModuleXmlParser.ResourceRootFactory resourceRootFactory
TERMINATED_MARKERback to summary
private static final ResourceLoader TERMINATED_MARKER

Constructor Detail

LocalModuleFinderback to summary
private LocalModuleFinder(final File[] repoRoots, final PathFilter pathFilter, final boolean cloneRoots)
LocalModuleFinderback to summary
public LocalModuleFinder(final File[] repoRoots, final PathFilter pathFilter)

Construct a new instance.

Parameters
repoRoots:File[]

the repository roots to use

pathFilter:PathFilter

the path filter to use

LocalModuleFinderback to summary
public LocalModuleFinder(final File[] repoRoots)

Construct a new instance.

Parameters
repoRoots:File[]

the repository roots to use

LocalModuleFinderback to summary
public 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.

This is equivalent to a call to LocalModuleFinder(true).

LocalModuleFinderback to summary
public 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.

Parameters
supportLayersAndAddOns:boolean

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.

Method Detail

closeback to summary
public void close()

Implements java.lang.AutoCloseable.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.

findModuleback to summary
public ModuleSpec findModule(final String name, final ModuleLoader delegateLoader) throws ModuleLoadException

Overrides default org.jboss.modules.ModuleFinder.findModule.

Doc from org.jboss.modules.ModuleFinder.findModule.

Find a module specification for the given name. The default implementation delegates to the legacy findModule(ModuleIdentifier, ModuleLoader) method.

Parameters
name:String

the module name

delegateLoader:ModuleLoader

the module loader from which dependencies should be resolved

Returns:ModuleSpec

the module specification, or null if no specification is found for this identifier

getFilesback to summary
private static File[] getFiles(final String modulePath, final int stringIdx, final int arrayIdx)
getModulePathFilesback to summary
private static File[] getModulePathFiles()
getRepoRootsback to summary
pack-priv static File[] getRepoRoots(final boolean supportLayersAndAddOns)
iterateModulesback to summary
public Iterator<String> iterateModules(final String baseName, final boolean recursive, final ModuleLoader delegateLoader)

Overrides default org.jboss.modules.IterableModuleFinder.iterateModules.

parseModuleXmlFileback to summary
public static ModuleSpec parseModuleXmlFile(final ModuleIdentifier identifier, final ModuleLoader delegateLoader, final File... roots) throws IOException, ModuleLoadException

Parse a module.xml file and return the corresponding module specification.

Parameters
identifier:ModuleIdentifier

the identifier to load

delegateLoader:ModuleLoader

the delegate module loader to use for module specifications

roots:File[]

the repository root paths to search

Returns:ModuleSpec

the module specification

Annotations
@Deprecated
Exceptions
IOException:
if reading the module file failed
ModuleLoadException:
if creating the module specification failed (e.g. due to a parse error)
parseModuleXmlFileback to summary
public static ModuleSpec parseModuleXmlFile(final String name, final ModuleLoader delegateLoader, final File... roots) throws IOException, ModuleLoadException

Parse a module.xml file and return the corresponding module specification.

Parameters
name:String

the name of the module to load

delegateLoader:ModuleLoader

the delegate module loader to use for module specifications

roots:File[]

the repository root paths to search

Returns:ModuleSpec

the module specification

Exceptions
IOException:
if reading the module file failed
ModuleLoadException:
if creating the module specification failed (e.g. due to a parse error)
parseModuleXmlFileback to summary
pack-priv static ModuleSpec parseModuleXmlFile(final ModuleXmlParser.ResourceRootFactory factory, final String name, final ModuleLoader delegateLoader, final File... roots) throws IOException, ModuleLoadException
safeCloseback to summary
private static void safeClose(AutoCloseable closeable)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.