public class ModulesRegistryImpl extends AbstractModulesRegistryImpl
Modifier and Type | Field and Description |
---|---|
(package private) java.util.List<ModuleLifecycleListener> |
lifecycleListeners |
private java.lang.ClassLoader |
parentLoader |
modules, parent, providers, repositories
Constructor and Description |
---|
ModulesRegistryImpl(ModulesRegistry parent) |
Modifier and Type | Method and Description |
---|---|
ModulesRegistry |
createChild()
Creates a new child
ModulesRegistryImpl in this ModulesRegistryImpl . |
void |
detachAll()
Detaches all the modules from this registry.
|
Module |
find(java.lang.Class clazz)
Finds the
Module that owns the given class. |
java.util.List<ModuleLifecycleListener> |
getLifecycleListeners() |
java.lang.ClassLoader |
getModulesClassLoader(java.lang.ClassLoader parent,
java.util.Collection<ModuleDefinition> defs)
Returns a ClassLoader capable of loading classes from a set of modules identified
by their module definition
|
java.lang.ClassLoader |
getModulesClassLoader(java.lang.ClassLoader parent,
java.util.Collection<ModuleDefinition> defs,
java.net.URL[] urls)
Returns a ClassLoader capable of loading classes from a set of modules identified
by their module definition and also load new urls.
|
java.lang.ClassLoader |
getParentClassLoader()
Returns the parent class loader parenting the class loaders created
by modules associated with this registry.
|
ModuleImpl |
getProvidingModule(java.lang.String providerClassName)
Gets the
Module that provides the provider of the given name. |
protected Module |
newModule(ModuleDefinition moduleDef)
Factory method for creating new instances of Module.
|
(package private) ModuleImpl |
newPrivateModuleFor(java.lang.String moduleName,
java.lang.String version)
Creates and return a new private module implementation giving a name and
version constraints.
|
protected java.util.List<ActiveDescriptor> |
parseInhabitants(Module module,
java.lang.String name,
ServiceLocator serviceLocator,
java.util.List<PopulatorPostProcessor> postProcessors) |
void |
register(ModuleLifecycleListener listener)
Add a
ModuleLifecycleListener to this registry. |
void |
setParentClassLoader(java.lang.ClassLoader parent)
Sets the classloader parenting the class loaders created by the modules
associated with this registry.
|
void |
shutdown()
Shuts down this module's registry, apply housekeeping tasks
|
void |
unregister(ModuleLifecycleListener listener)
Removes an
ModuleLifecycleListener from this registry. |
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
private java.lang.ClassLoader parentLoader
final java.util.List<ModuleLifecycleListener> lifecycleListeners
public ModulesRegistryImpl(ModulesRegistry parent)
public ModulesRegistry createChild()
ModulesRegistryImpl
in this ModulesRegistryImpl
.protected Module newModule(ModuleDefinition moduleDef)
AbstractModulesRegistryImpl
newModule
in class AbstractModulesRegistryImpl
moduleDef
- module definition of the new module to be createdprotected java.util.List<ActiveDescriptor> parseInhabitants(Module module, java.lang.String name, ServiceLocator serviceLocator, java.util.List<PopulatorPostProcessor> postProcessors) throws java.io.IOException
parseInhabitants
in class AbstractModulesRegistryImpl
java.io.IOException
ModuleImpl newPrivateModuleFor(java.lang.String moduleName, java.lang.String version)
moduleName
- the module nameversion
- the desired versionResolveError
- if the module dependencies cannot be resolvedpublic ModuleImpl getProvidingModule(java.lang.String providerClassName)
ModulesRegistry
Module
that provides the provider of the given name.getProvidingModule
in interface ModulesRegistry
getProvidingModule
in class AbstractModulesRegistryImpl
public void setParentClassLoader(java.lang.ClassLoader parent)
parent
- parent class loaderpublic java.lang.ClassLoader getParentClassLoader()
public java.lang.ClassLoader getModulesClassLoader(java.lang.ClassLoader parent, java.util.Collection<ModuleDefinition> defs, java.net.URL[] urls) throws ResolveError
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 classloaderResolveError
- if one of the provided module
definition cannot be resolvedpublic java.lang.ClassLoader getModulesClassLoader(java.lang.ClassLoader parent, java.util.Collection<ModuleDefinition> defs) throws ResolveError
parent
- the parent class loader for the returned class loader instancedefs
- module definitions for all modules this classloader should be
capable of loading classes fromResolveError
- if one of the provided module
definition cannot be resolvedpublic Module find(java.lang.Class clazz)
ModulesRegistry
Module
that owns the given class.public void register(ModuleLifecycleListener listener)
ModuleLifecycleListener
to this registry. The listener
will be notified for each module startup and shutdown.listener
- the listener implementationpublic void unregister(ModuleLifecycleListener listener)
ModuleLifecycleListener
from this registry.
Notification of module startup and shutdown will not be emitted to this
listener any longer.listener
- the listener to unregisterpublic java.util.List<ModuleLifecycleListener> getLifecycleListeners()
public void detachAll()
public void shutdown()