java.lang.Object
com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl
com.sun.enterprise.module.impl.ModulesRegistryImpl
- All Implemented Interfaces:
ModuleChangeListener,ModulesRegistry
- Direct Known Subclasses:
ClassPathBasedModulesRegistry,SingleModulesRegistry
- Author:
- Jerome Dochez, Sanjeeb.Sahoo@Sun.COM
-
Field Summary
Fields inherited from class com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl
modules, parent, providers, repositories -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new childModulesRegistryImplin thisModulesRegistryImpl.voidDetaches all the modules from this registry.Finds theHK2Modulethat owns the given class.getModulesClassLoader(ClassLoader parent, Collection<ModuleDefinition> defs) Returns a ClassLoader capable of loading classes from a set of modules identified by their module definitiongetModulesClassLoader(ClassLoader parent, Collection<ModuleDefinition> defs, URL[] urls) Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition and also load new urls.Returns the parent class loader parenting the class loaders created by modules associated with this registry.getProvidingModule(String providerClassName) Gets theHK2Modulethat provides the provider of the given name.protected HK2ModulenewModule(ModuleDefinition moduleDef) Factory method for creating new instances of HK2Module.protected List<org.glassfish.hk2.api.ActiveDescriptor>parseInhabitants(HK2Module module, String name, org.glassfish.hk2.api.ServiceLocator serviceLocator, List<org.glassfish.hk2.api.PopulatorPostProcessor> postProcessors) voidregister(ModuleLifecycleListener listener) Add aModuleLifecycleListenerto this registry.voidsetParentClassLoader(ClassLoader parent) Sets the classloader parenting the class loaders created by the modules associated with this registry.voidshutdown()Shuts down this module's registry, apply housekeeping tasksvoidunregister(ModuleLifecycleListener listener) Removes anModuleLifecycleListenerfrom this registry.Methods inherited from class com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl
add, add, add, addRepository, addRepository, changed, createServiceLocator, createServiceLocator, createServiceLocator, dumpState, getAllServiceLocators, getModules, getModules, getModulesProvider, getProvidersClass, getRepository, getRunningServices, initializeServiceLocator, loadFromRepository, makeModuleFor, makeModuleFor, makeModuleFor, newServiceLocator, newServiceLocator, populateConfig, populateServiceLocator, print, registerRunningService, remove, removeRepository, unregisterRunningService
-
Constructor Details
-
ModulesRegistryImpl
-
-
Method Details
-
createChild
Creates a new childModulesRegistryImplin thisModulesRegistryImpl. -
newModule
Description copied from class:AbstractModulesRegistryImplFactory method for creating new instances of HK2Module.- Specified by:
newModulein classAbstractModulesRegistryImpl- Parameters:
moduleDef- module definition of the new module to be created- Returns:
- a new HK2Module instance
-
parseInhabitants
protected List<org.glassfish.hk2.api.ActiveDescriptor> parseInhabitants(HK2Module module, String name, org.glassfish.hk2.api.ServiceLocator serviceLocator, List<org.glassfish.hk2.api.PopulatorPostProcessor> postProcessors) throws IOException - Specified by:
parseInhabitantsin classAbstractModulesRegistryImpl- Throws:
IOException
-
getProvidingModule
Description copied from interface:ModulesRegistryGets theHK2Modulethat provides the provider of the given name.- Specified by:
getProvidingModulein interfaceModulesRegistry- Overrides:
getProvidingModulein classAbstractModulesRegistryImpl
-
setParentClassLoader
Sets the classloader parenting the class loaders created by the modules associated with this registry.- Parameters:
parent- parent class loader
-
getParentClassLoader
Returns the parent class loader parenting the class loaders created by modules associated with this registry.- Returns:
- the parent classloader
-
getModulesClassLoader
public ClassLoader getModulesClassLoader(ClassLoader parent, Collection<ModuleDefinition> defs, URL[] urls) throws ResolveError Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition and also load new urls.- Parameters:
parent- the parent class loader for the returned class loader instancedefs- module definitions for all modules this classloader should be capable of loadingurls- urls to be added to the module classloader- Returns:
- class loader instance
- Throws:
ResolveError- if one of the provided module definition cannot be resolved
-
getModulesClassLoader
public ClassLoader getModulesClassLoader(ClassLoader parent, Collection<ModuleDefinition> defs) throws ResolveError Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition- Parameters:
parent- the parent class loader for the returned class loader instancedefs- module definitions for all modules this classloader should be capable of loading classes from- Returns:
- class loader instance
- Throws:
ResolveError- if one of the provided module definition cannot be resolved
-
find
Description copied from interface:ModulesRegistryFinds theHK2Modulethat owns the given class.- Returns:
- null if the class is loaded outside the module system.
-
register
Add aModuleLifecycleListenerto this registry. The listener will be notified for each module startup and shutdown.- Parameters:
listener- the listener implementation
-
unregister
Removes anModuleLifecycleListenerfrom this registry. Notification of module startup and shutdown will not be emitted to this listener any longer.- Parameters:
listener- the listener to unregister
-
getLifecycleListeners
-
detachAll
public void detachAll()Detaches all the modules from this registry. The modules are not deconstructed when calling this method. -
shutdown
public void shutdown()Shuts down this module's registry, apply housekeeping tasks
-