Package org.jboss.modules
Class ClassifyingModuleLoader
java.lang.Object
org.jboss.modules.ModuleLoader
org.jboss.modules.ClassifyingModuleLoader
A module loader which selects a delegate module loader based upon the prefix of the module name. Longer
names are matched first always.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jboss.modules.ModuleLoader
ModuleLoader.MXBeanImpl -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ModuleLoaderprivate Map<String, ModuleLoader> private final StringFields inherited from class org.jboss.modules.ModuleLoader
NO_FINDERS -
Constructor Summary
ConstructorsConstructorDescriptionClassifyingModuleLoader(String name, Map<String, ModuleLoader> delegates, ModuleLoader defaultLoader) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected ModuleSpecfindModule(ModuleIdentifier moduleIdentifier) Find a Module's specification in this ModuleLoader by its identifier.protected ModulepreloadModule(ModuleIdentifier moduleIdentifier) Preload a module based on an identifier.voidsetDelegates(Map<String, ModuleLoader> delegates) Change the delegates map.toString()Get the string representation of this module loader.Methods inherited from class org.jboss.modules.ModuleLoader
addClassLoadTime, addLinkTime, findLoadedModuleLocal, forClass, forClassLoader, getDependencies, getFinders, incClassCount, incRaceCount, incScanCount, installMBeanServer, iterateModules, loadModule, loadModuleLocal, preloadExportedModule, preloadModule, refreshResourceLoaders, relink, setAndRefreshResourceLoaders, setAndRelinkDependencies, unloadModuleLocal
-
Field Details
-
delegates
-
defaultLoader
-
name
-
-
Constructor Details
-
ClassifyingModuleLoader
public ClassifyingModuleLoader(String name, Map<String, ModuleLoader> delegates, ModuleLoader defaultLoader) Construct a new instance. The given delegates map is copied.- Parameters:
delegates- the default delegates map to usedefaultLoader- the default loader to use if no delegate mapping exists
-
-
Method Details
-
preloadModule
Preload a module based on an identifier. By default, no delegation is done and this method simply invokesModuleLoader.loadModuleLocal(ModuleIdentifier). A delegating module loader may delegate to the appropriate module loader based on loader-specific criteria (via theModuleLoader.preloadModule(ModuleIdentifier, ModuleLoader)method).- Overrides:
preloadModulein classModuleLoader- Parameters:
moduleIdentifier- the module identifier- Returns:
- the load result, or
nullif the module is not found - Throws:
ModuleLoadException- if an error occurs
-
findModule
Find a Module's specification in this ModuleLoader by its identifier. 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 returnnull. If the module is found but some problem occurred (for example, a transitive dependency failed to load) then this method should throw aModuleLoadExceptionof the relevant type.- Overrides:
findModulein classModuleLoader- Parameters:
moduleIdentifier- the module identifier- Returns:
- the module specification, or
nullif no module is found with the given identifier - Throws:
ModuleLoadException- if any problems occur finding the module
-
setDelegates
Change the delegates map. A copy is made of the given map.- Parameters:
delegates- the new delegates map to use
-
toString
Description copied from class:ModuleLoaderGet the string representation of this module loader.- Overrides:
toStringin classModuleLoader- Returns:
- the string representation
-