Top Fields Constructors Methods
com.sun.enterprise.module.impl

public Class ModulesRegistryImpl

extends AbstractModulesRegistryImpl
Class Inheritance
Known Direct Subclasses
com.sun.enterprise.module.single.ClassPathBasedModulesRegistry, com.sun.enterprise.module.single.SingleModulesRegistry
Imports
com.sun.enterprise.module.*, com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl, .ModuleId, .AbstractFactory, java.io.IOException, java.util.Collection, .List, .Collections, java.util.logging.Logger, .Level, java.util.concurrent.CopyOnWriteArrayList, java.net.URL, org.glassfish.hk2.api.ActiveDescriptor, .PopulatorPostProcessor, .ServiceLocator

Authors
Jerome Dochez, [email protected]

Field Summary

Modifier and TypeField and Description
pack-priv final List<ModuleLifecycleListener>
private ClassLoader
Inherited from com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl:
modulesparentprovidersrepositories

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ModulesRegistry
public void
detachAll()

Implements com.sun.enterprise.module.ModulesRegistry.detachAll.

Detaches all the modules from this registry.

public HK2Module
find(Class<T> clazz)

Implements com.sun.enterprise.module.ModulesRegistry.find.

Finds the HK2Module that owns the given class.

public List<ModuleLifecycleListener>
public ClassLoader

Returns:

class loader instance
getModulesClassLoader
(ClassLoader
the parent class loader for the returned class loader instance
parent
,
Collection<ModuleDefinition>
module definitions for all modules this classloader should be capable of loading
defs
,
URL[]
urls to be added to the module classloader
urls
)

Implements com.sun.enterprise.module.ModulesRegistry.getModulesClassLoader.

Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition and also load new urls.

public ClassLoader

Returns:

class loader instance
getModulesClassLoader
(ClassLoader
the parent class loader for the returned class loader instance
parent
,
Collection<ModuleDefinition>
module definitions for all modules this classloader should be capable of loading classes from
defs
)

Implements com.sun.enterprise.module.ModulesRegistry.getModulesClassLoader.

Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition

public ClassLoader

Returns:

the parent classloader
getParentClassLoader
()

Implements com.sun.enterprise.module.ModulesRegistry.getParentClassLoader.

Returns the parent class loader parenting the class loaders created by modules associated with this registry.

public ModuleImpl
protected HK2Module
newModule(ModuleDefinition moduleDef)

Implements abstract com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newModule.

Factory method for creating new instances of HK2Module.

pack-priv ModuleImpl

Returns:

the new private module or null if cannot be found
newPrivateModuleFor
(String
the module name
moduleName
,
String
the desired version
version
)

Creates and return a new private module implementation giving a name and version constraints.

protected List<ActiveDescriptor<T>>
public void
register(ModuleLifecycleListener
the listener implementation
listener
)

Implements com.sun.enterprise.module.ModulesRegistry.register.

Add a ModuleLifecycleListener to this registry.

public void
setParentClassLoader(ClassLoader
parent class loader
parent
)

Implements com.sun.enterprise.module.ModulesRegistry.setParentClassLoader.

Sets the classloader parenting the class loaders created by the modules associated with this registry.

public void
shutdown()

Implements com.sun.enterprise.module.ModulesRegistry.shutdown.

Shuts down this module's registry, apply housekeeping tasks

public void
unregister(ModuleLifecycleListener
the listener to unregister
listener
)

Implements com.sun.enterprise.module.ModulesRegistry.unregister.

Removes an ModuleLifecycleListener from this registry.

Inherited from com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl:
addaddaddaddRepositoryaddRepositorychangedcreateServiceLocatorcreateServiceLocatorcreateServiceLocatordumpStategetAllServiceLocatorsgetModulesgetModulesgetModulesProvidergetProvidersClassgetRepositorygetRunningServicesinitializeServiceLocatorloadFromRepositorymakeModuleFormakeModuleFormakeModuleFornewServiceLocatornewServiceLocatorpopulateConfigpopulateServiceLocatorprintregisterRunningServiceremoveremoveRepositoryunregisterRunningService

Field Detail

lifecycleListenersback to summary
pack-priv final List<ModuleLifecycleListener> lifecycleListeners
parentLoaderback to summary
private ClassLoader parentLoader

Constructor Detail

ModulesRegistryImplback to summary
public ModulesRegistryImpl(ModulesRegistry parent)

Method Detail

createChildback to summary
public ModulesRegistry createChild()

Implements com.sun.enterprise.module.ModulesRegistry.createChild.

Creates a new child ModulesRegistryImpl in this ModulesRegistryImpl.

detachAllback to summary
public void detachAll()

Implements com.sun.enterprise.module.ModulesRegistry.detachAll.

Detaches all the modules from this registry. The modules are not deconstructed when calling this method.

findback to summary
public HK2Module find(Class<T> clazz)

Implements com.sun.enterprise.module.ModulesRegistry.find.

Doc from com.sun.enterprise.module.ModulesRegistry.find.

Finds the HK2Module that owns the given class.

getLifecycleListenersback to summary
public List<ModuleLifecycleListener> getLifecycleListeners()
getModulesClassLoaderback to summary
public ClassLoader getModulesClassLoader(ClassLoader parent, Collection<ModuleDefinition> defs, URL[] urls) throws ResolveError

Implements com.sun.enterprise.module.ModulesRegistry.getModulesClassLoader.

Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition and also load new urls.

Parameters
parent:ClassLoader

the parent class loader for the returned class loader instance

defs:Collection<ModuleDefinition>

module definitions for all modules this classloader should be capable of loading

urls:URL[]

urls to be added to the module classloader

Returns:ClassLoader

class loader instance

Exceptions
ResolveError:
if one of the provided module definition cannot be resolved
getModulesClassLoaderback to summary
public ClassLoader getModulesClassLoader(ClassLoader parent, Collection<ModuleDefinition> defs) throws ResolveError

Implements com.sun.enterprise.module.ModulesRegistry.getModulesClassLoader.

Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition

Parameters
parent:ClassLoader

the parent class loader for the returned class loader instance

defs:Collection<ModuleDefinition>

module definitions for all modules this classloader should be capable of loading classes from

Returns:ClassLoader

class loader instance

Exceptions
ResolveError:
if one of the provided module definition cannot be resolved
getParentClassLoaderback to summary
public ClassLoader getParentClassLoader()

Implements com.sun.enterprise.module.ModulesRegistry.getParentClassLoader.

Returns the parent class loader parenting the class loaders created by modules associated with this registry.

Returns:ClassLoader

the parent classloader

getProvidingModuleback to summary
public ModuleImpl getProvidingModule(String providerClassName)

Overrides com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.getProvidingModule.

Implements com.sun.enterprise.module.ModulesRegistry.getProvidingModule.

Doc from com.sun.enterprise.module.ModulesRegistry.getProvidingModule.

Gets the HK2Module that provides the provider of the given name.

Annotations
@Override
newModuleback to summary
protected HK2Module newModule(ModuleDefinition moduleDef)

Implements abstract com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newModule.

Doc from com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newModule.

Factory method for creating new instances of HK2Module.

newPrivateModuleForback to summary
pack-priv ModuleImpl newPrivateModuleFor(String moduleName, String version)

Creates and return a new private module implementation giving a name and version constraints. A private module is like any other module except it is not registered to be shared by other potential module users.

Parameters
moduleName:String

the module name

version:String

the desired version

Returns:ModuleImpl

the new private module or null if cannot be found

Exceptions
ResolveError:
if the module dependencies cannot be resolved
parseInhabitantsback to summary
protected List<ActiveDescriptor<T>> parseInhabitants(HK2Module module, String name, ServiceLocator serviceLocator, List<PopulatorPostProcessor> postProcessors) throws IOException

Implements abstract com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.parseInhabitants.

registerback to summary
public void register(ModuleLifecycleListener listener)

Implements com.sun.enterprise.module.ModulesRegistry.register.

Add a ModuleLifecycleListener to this registry. The listener will be notified for each module startup and shutdown.

Parameters
listener:ModuleLifecycleListener

the listener implementation

setParentClassLoaderback to summary
public void setParentClassLoader(ClassLoader parent)

Implements com.sun.enterprise.module.ModulesRegistry.setParentClassLoader.

Sets the classloader parenting the class loaders created by the modules associated with this registry.

Parameters
parent:ClassLoader

parent class loader

shutdownback to summary
public void shutdown()

Implements com.sun.enterprise.module.ModulesRegistry.shutdown.

Shuts down this module's registry, apply housekeeping tasks

unregisterback to summary
public void unregister(ModuleLifecycleListener listener)

Implements com.sun.enterprise.module.ModulesRegistry.unregister.

Removes an ModuleLifecycleListener from this registry. Notification of module startup and shutdown will not be emitted to this listener any longer.

Parameters
listener:ModuleLifecycleListener

the listener to unregister