|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@Contract public interface ModulesRegistry
Method Summary | ||
---|---|---|
Module |
add(ModuleDefinition info)
Registers a new DefaultModuleDefinition in this registry. |
|
Module |
add(ModuleDefinition info,
boolean resolve)
Registers a new DefaultModuleDefinition in this registry. |
|
void |
addRepository(Repository repository)
Add a new Repository to this registry. |
|
void |
addRepository(Repository repository,
int weight)
Add a new Repository to this registry. |
|
ModulesRegistry |
createChild()
Creates a new child ModulesRegistry in this ModulesRegistry . |
|
ServiceLocator |
createServiceLocator(String name)
Creates a ServiceLocator from all the modules in this registry
Cal;ling this method has the same effect of calling newServiceLocator() followed by
populateServiceLocator(String, ServiceLocator) . |
|
void |
detachAll()
Detaches all the modules from this registry. |
|
void |
dumpState(PrintStream writer)
|
|
Module |
find(Class clazz)
Finds the Module that owns the given class. |
|
Collection<Module> |
getModules()
Returns the list of shared Modules registered in this instance. |
|
Collection<Module> |
getModules(String moduleName)
Returns the list of shared Modules registered in this instance whose name matches the given name |
|
ClassLoader |
getModulesClassLoader(ClassLoader parent,
Collection<ModuleDefinition> defs)
Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition |
|
ClassLoader |
getModulesClassLoader(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. |
|
Iterable<Module> |
getModulesProvider(Class serviceClass)
Returns a collection of Module containing at least one implementation of the passed service interface class. |
|
ClassLoader |
getParentClassLoader()
|
|
|
getProvidersClass(Class<T> serviceClass)
|
|
Module |
getProvidingModule(String providerClassName)
Gets the Module that provides the provider of the given name. |
|
Repository |
getRepository(String name)
Get a repository from the list of attached repositories |
|
|
getRunningServices(Class<T> serviceClass)
Returns all running services implementation of the passed service interface |
|
Module |
makeModuleFor(String packageName)
Find and return a loaded Module that has the package name in its list of exported interfaces. |
|
Module |
makeModuleFor(String name,
String version)
Returns the Module instance giving a name and version
constraints. |
|
Module |
makeModuleFor(String name,
String version,
boolean resolve)
Returns the Module instance giving a name and version
constraints. |
|
ServiceLocator |
newServiceLocator()
Creates an uninitialized ServiceLocator |
|
void |
populateServiceLocator(String name,
ServiceLocator h)
Populates a ServiceLocator from all the modules in this registry. |
|
void |
print(Logger logger)
Print a Registry dump to the logger |
|
void |
register(ModuleLifecycleListener listener)
Add a ModuleLifecycleListener to this registry. |
|
|
registerRunningService(Class<T> serviceClass,
T provider)
Registers a running service, this is useful when other components need to have access to a provider of a service without having to create a new instance and initialize it. |
|
void |
removeRepository(String name)
Remove a repository from the list of attached repositories to this instances. |
|
void |
setParentClassLoader(ClassLoader parent)
|
|
void |
shutdown()
Shuts down this module's registry, apply housekeeping tasks |
|
void |
unregister(ModuleLifecycleListener listener)
Removes an ModuleLifecycleListener from this registry. |
|
|
unregisterRunningService(Class<T> serviceClass,
T provider)
Removes a running service, this is useful when a service instance is no longer available as a provider of a service. |
Methods inherited from interface com.sun.enterprise.module.ModuleChangeListener |
---|
changed |
Method Detail |
---|
ModulesRegistry createChild()
ModulesRegistry
in this ModulesRegistry
.
ServiceLocator newServiceLocator() throws ComponentException
ServiceLocator
ComponentException
ServiceLocator createServiceLocator(String name) throws ComponentException
ServiceLocator
from all the modules in this registry
Cal;ling this method has the same effect of calling newServiceLocator()
followed by
populateServiceLocator(String, ServiceLocator)
.
name
- Determines which inhabitants descriptors are loaded.
(so that different parallel habitats can be
created over the same modules registry.)
ComponentException
void populateServiceLocator(String name, ServiceLocator h) throws ComponentException
ServiceLocator
from all the modules in this registry.
Default InhabitantsParser
is used.
name
- Determines which inhabitants descriptors are loaded.
(so that different parallel habitats can be
created over the same modules registry.)h
- Habitat to initialize, null if it should be created
ComponentException
void addRepository(Repository repository, int weight)
Repository
to this registry. From now on
the repository will be used to procure requested module not yet registered
in this registry instance. Repository can be searched in a particular
order (to accomodate performance requirements like looking at local
repositories first), a search order (1 to 100) can be specified when
adding a repository to the registry (1 is highest priority).
repository
- new repository to attach to this registryweight
- int value from 1 to 100 to specify the search ordervoid addRepository(Repository repository)
Repository
to this registry. From now on
the repository will be used to procure requested nodule not
registered in this instance.
repository
- new repository to attach to this registryvoid removeRepository(String name)
Repository
name will not be used to procure missing modules any
longer
name
- name of the repository to removeRepository getRepository(String name)
name
- name of the repository to return
Module makeModuleFor(String name, String version) throws ResolveError
Module
instance giving a name and version
constraints.
name
- the module nameversion
- the module version. Caller should specify a correct version.
ResolveError
- if the module dependencies cannot be resolvedModule makeModuleFor(String name, String version, boolean resolve) throws ResolveError
Module
instance giving a name and version
constraints.
name
- the module nameversion
- the module version. Caller should specify a correct version.resolve
- should the module be resolved or not
ResolveError
- if the module dependencies cannot be resolvedModule makeModuleFor(String packageName) throws ResolveError
packageName
- the requested implementation package name.
Module
instance implementing the package
name or null if not found.
ResolveError
- if the module dependencies cannot be resolvedCollection<Module> getModules()
The returned list will not include the modules defined in the ancestor
ModulesRegistry
s.
Collection<Module> getModules(String moduleName)
The returned list will not include the modules defined in the ancestor
ModulesRegistry
s.
void detachAll()
Module add(ModuleDefinition info) throws ResolveError
Module
instances.
ResolveError
Module add(ModuleDefinition info, boolean resolve) throws ResolveError
Module
instances.
info
- ModuleDefinition representing the new module contentresolve
- should the new module be resolved or not
ResolveError
void print(Logger logger)
logger
- the logger to dump onvoid register(ModuleLifecycleListener listener)
ModuleLifecycleListener
to this registry. The listener
will be notified for each module startup and shutdown.
listener
- the listener implementationvoid 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 unregistervoid shutdown()
void dumpState(PrintStream writer)
<T> Iterable<Class<? extends T>> getProvidersClass(Class<T> serviceClass)
Iterable<Module> getModulesProvider(Class serviceClass)
serviceClass
- the service interface class
<T> void registerRunningService(Class<T> serviceClass, T provider)
serviceClass
- the service interfaceprovider
- the provider of that service.<T> boolean unregisterRunningService(Class<T> serviceClass, T provider)
<T> List<T> getRunningServices(Class<T> serviceClass)
serviceClass
- the service interface
void setParentClassLoader(ClassLoader parent)
ClassLoader getParentClassLoader()
ClassLoader getModulesClassLoader(ClassLoader parent, 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 from
ResolveError
- if one of the provided module
definition cannot be resolvedClassLoader getModulesClassLoader(ClassLoader parent, Collection<ModuleDefinition> defs, 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 classloader
ResolveError
- if one of the provided module
definition cannot be resolvedModule find(Class clazz)
Module
that owns the given class.
Module getProvidingModule(String providerClassName)
Module
that provides the provider of the given name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |