Top Description Fields Constructors Methods
org.jboss.modules

public final Class ClassifyingModuleLoader

extends ModuleLoader
Class Inheritance
Imports
java.util.HashMap, .Map

A module loader which selects a delegate module loader based upon the prefix of the module name. Longer names are matched first always.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private final ModuleLoader
private volatile Map<String, ModuleLoader>
private final String
Inherited from org.jboss.modules.ModuleLoader:
NO_FINDERSNOT_FOUND

Constructor Summary

AccessConstructor and Description
public
ClassifyingModuleLoader(final String name, final Map<String, ModuleLoader>
the default delegates map to use
delegates
,
final ModuleLoader
the default loader to use if no delegate mapping exists
defaultLoader
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
protected ModuleSpec
findModule(final String
the module name
name
)

Overrides org.jboss.modules.ModuleLoader.findModule.

Find a Module's specification in this ModuleLoader by its name.
protected Module
preloadModule(String
the module identifier
name
)

Overrides org.jboss.modules.ModuleLoader.preloadModule.

Preload a module based on an identifier.
public void
setDelegates(Map<String, ModuleLoader>
the new delegates map to use
delegates
)

Change the delegates map.

public String
toString()

Overrides org.jboss.modules.ModuleLoader.toString.

Get the string representation of this module loader.
Inherited from org.jboss.modules.ModuleLoader:
addClassLoadTimeaddLinkTimefindLoadedModuleLocalfindLoadedModuleLocalfindModuleforClassforClassLoadergetDependenciesgetFindersgetModuleDescriptionincClassCountincRaceCountincScanCountinstallMBeanServeriterateModulesiterateModulesloadModuleloadModuleloadModuleLocalloadModuleLocalpreloadExportedModulepreloadExportedModulepreloadModulepreloadModulepreloadModulerefreshResourceLoadersrelinksetAndRefreshResourceLoaderssetAndRelinkDependenciesunloadModuleLocalunloadModuleLocal

Field Detail

defaultLoaderback to summary
private final ModuleLoader defaultLoader
delegatesback to summary
private volatile Map<String, ModuleLoader> delegates
nameback to summary
private final String name

Constructor Detail

ClassifyingModuleLoaderback to summary
public ClassifyingModuleLoader(final String name, final Map<String, ModuleLoader> delegates, final ModuleLoader defaultLoader)

Construct a new instance. The given delegates map is copied.

Parameters
delegates:Map<String, ModuleLoader>

the default delegates map to use

defaultLoader:ModuleLoader

the default loader to use if no delegate mapping exists

Method Detail

findModuleback to summary
protected ModuleSpec findModule(final String name) throws ModuleLoadException

Overrides org.jboss.modules.ModuleLoader.findModule.

Doc from org.jboss.modules.ModuleLoader.findModule.

Find a Module's specification in this ModuleLoader by its name. This can be overriden by sub-classes to implement the Module loading strategy for this loader. The default implementation iterates the module finders provided during construction.

If no module is found in this module loader with the given identifier, then this method should return 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.

Parameters
name:String

the module name

Returns:ModuleSpec

the module specification, or null if no module is found with the given identifier

Exceptions
ModuleLoadException:
if any problems occur finding the module
preloadModuleback to summary
protected Module preloadModule(String name) throws ModuleLoadException

Overrides org.jboss.modules.ModuleLoader.preloadModule.

Doc from org.jboss.modules.ModuleLoader.preloadModule.

Preload a module based on an identifier. By default, delegation is only done for system and this method otherwise simply invokes loadModuleLocal(String). A delegating module loader may delegate to the appropriate module loader based on loader-specific criteria (via the preloadModule(String, ModuleLoader) method).

Parameters
name:String

the module identifier

Returns:Module

the load result, or null if the module is not found

Exceptions
ModuleLoadException:
if an error occurs
setDelegatesback to summary
public void setDelegates(Map<String, ModuleLoader> delegates)

Change the delegates map. A copy is made of the given map.

Parameters
delegates:Map<String, ModuleLoader>

the new delegates map to use

toStringback to summary
public String toString()

Overrides org.jboss.modules.ModuleLoader.toString.

Doc from org.jboss.modules.ModuleLoader.toString.

Get the string representation of this module loader.

Returns:String

the string representation