|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.modules.ModuleLoader
public abstract class ModuleLoader
A repository for modules, from which a module may be loaded by identifier. Module loaders may additionally delegate to one or more other module loaders.
Constructor Summary | |
---|---|
protected |
ModuleLoader()
Construct a new instance. |
Method Summary | |
---|---|
protected Module |
findLoadedModuleLocal(ModuleIdentifier identifier)
Find an already-loaded module, returning null if the module isn't currently loaded. |
protected abstract ModuleSpec |
findModule(ModuleIdentifier moduleIdentifier)
Find a Module's specification in this ModuleLoader by its identifier. |
static ModuleLoader |
forClass(Class<?> clazz)
Get the module loader for a class. |
static ModuleLoader |
forClassLoader(ClassLoader classLoader)
Get the module loader for a class loader. |
Module |
loadModule(ModuleIdentifier identifier)
Load a module based on an identifier. |
protected Module |
loadModuleLocal(ModuleIdentifier identifier)
Try to load a module from this module loader. |
protected Module |
preloadExportedModule(ModuleIdentifier identifier)
Preload an "exported" module based on an identifier. |
protected Module |
preloadModule(ModuleIdentifier identifier)
Preload a module based on an identifier. |
protected static Module |
preloadModule(ModuleIdentifier identifier,
ModuleLoader moduleLoader)
Utility method to delegate to another module loader, accessible from subclasses. |
protected void |
refreshResourceLoaders(Module module)
Refreshes the paths provided by resource loaders associated with the specified Module. |
protected void |
relink(Module module)
Relinks the dependencies associated with the specified Module. |
protected void |
setAndRefreshResourceLoaders(Module module,
Collection<ResourceLoaderSpec> loaders)
Replaces the resources loaders for the specified module and refreshes the internal path list that is derived from the loaders. |
protected void |
setAndRelinkDependencies(Module module,
List<DependencySpec> dependencies)
Replaces the dependencies for the specified module and relinks against the new modules This is an advanced method that should be used carefully, since it alters a live module. |
abstract String |
toString()
Get the string representation of this module loader. |
protected void |
unloadModuleLocal(Module module)
Unload a module from this module loader. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected ModuleLoader()
Method Detail |
---|
public static ModuleLoader forClass(Class<?> clazz)
clazz
- the class
public static ModuleLoader forClassLoader(ClassLoader classLoader)
classLoader
- the class loader
public abstract String toString()
toString
in class Object
public final Module loadModule(ModuleIdentifier identifier) throws ModuleLoadException
preloadModule(ModuleIdentifier)
and then
links the returned module if necessary.
identifier
- The module identifier
ModuleLoadException
- if the Module can not be loadedprotected Module preloadModule(ModuleIdentifier identifier) throws ModuleLoadException
loadModuleLocal(ModuleIdentifier)
. A delegating module loader may delegate to the appropriate module
loader based on loader-specific criteria (via the preloadModule(ModuleIdentifier, ModuleLoader)
method).
identifier
- the module identifier
null
if the module is not found
ModuleLoadException
- if an error occursprotected Module preloadExportedModule(ModuleIdentifier identifier) throws ModuleLoadException
preloadModule(ModuleIdentifier)
.
identifier
- the module identifier
null
if the module is not found
ModuleLoadException
- if an error occursprotected static Module preloadModule(ModuleIdentifier identifier, ModuleLoader moduleLoader) throws ModuleLoadException
identifier
- the module identifiermoduleLoader
- the module loader to delegate to
ModuleLoadException
- if an error occursprotected final Module loadModuleLocal(ModuleIdentifier identifier) throws ModuleLoadException
null
if the module is not found. The returned
module may not yet be resolved.
identifier
- the module identifier
ModuleLoadException
- if an error occurs while loading the moduleprotected final Module findLoadedModuleLocal(ModuleIdentifier identifier)
null
if the module isn't currently loaded. May block
while the loaded state of the module is in question (if the module is being concurrently loaded from another
thread, for example).
identifier
- the module identifier
null
if it wasn't foundprotected final void unloadModuleLocal(Module module) throws SecurityException
module
- the module to unload
SecurityException
- if an attempt is made to unload a module which does not belong to this module loaderprotected abstract ModuleSpec findModule(ModuleIdentifier moduleIdentifier) throws ModuleLoadException
null
.
If the module is found but some problem occurred (for example, a transitive dependency failed to load) then this
method should throw a ModuleLoadException
of the relevant type.
moduleIdentifier
- The modules Identifier
null
if no module is found with the given identifier
ModuleLoadException
- if any problems occur finding the moduleprotected void refreshResourceLoaders(Module module)
module
- the module to refreshprotected void setAndRefreshResourceLoaders(Module module, Collection<ResourceLoaderSpec> loaders)
relink(Module)
must be called on all of them.
module
- the module to update and refreshloaders
- the new collection of loaders the module should useprotected void relink(Module module) throws ModuleLoadException
setAndRelinkDependencies(Module, java.util.List)
.
module
- the module to relink
ModuleLoadException
- if relinking failedprotected void setAndRelinkDependencies(Module module, List<DependencySpec> dependencies) throws ModuleLoadException
relink(Module)
must be
called on all of them.
module
- the module to update and relinkdependencies
- the new dependency list
ModuleLoadException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |