| Constructor and Description |
|---|
ProxyModule(ModulesRegistry registry,
ModuleDefinition moduleDef,
ClassLoader cl) |
| Modifier and Type | Method and Description |
|---|---|
void |
addImport(HK2Module module) |
HK2Module |
addImport(ModuleDependency dependency)
Create and add a new module to this module's list of
imports.
|
void |
addListener(ModuleChangeListener listener)
Add a new module change listener
|
void |
detach()
Detach this module from its registry.
|
void |
dumpState(PrintStream writer) |
ClassLoader |
getClassLoader()
Return the
ClassLoader instance associated with this module. |
List<HK2Module> |
getImports()
Returns the list of imported modules.
|
ModuleMetadata |
getMetadata()
Gets the metadata of this module.
|
ModuleDefinition |
getModuleDefinition()
Returns the module definition for this module instance
|
String |
getName()
Short-cut for
getModuleDefinition().getName(). |
<T> Iterable<Class<? extends T>> |
getProvidersClass(Class<T> serviceClass) |
Iterable<Class> |
getProvidersClass(String name) |
ModulesRegistry |
getRegistry()
Returns the registry owning this module
|
ModuleState |
getState()
Returns the module's state
|
boolean |
hasProvider(Class serviceClass)
Returns true if this module has any provider for the given service class.
|
boolean |
isShared()
Returns true if this module is sharable.
|
boolean |
isSticky()
Returns true if the module is sticky.
|
void |
refresh()
Trigger manual refresh mechanism, the module will check all its
URLs and generate change events if any of them has changed.
|
void |
removeListener(ModuleChangeListener listener)
Unregister a module change listener
|
void |
resolve()
Ensure that this module is
resolved. |
void |
setSticky(boolean sticky)
Sets the sticky flag.
|
void |
start()
Forces module startup.
|
boolean |
stop()
Forces module stop.
|
void |
uninstall()
Removes the module from the registry backing store, the module will need
be reinstalled to be loaded.
|
public ProxyModule(ModulesRegistry registry, ModuleDefinition moduleDef, ClassLoader cl)
public ModuleDefinition getModuleDefinition()
HK2ModulegetModuleDefinition in interface HK2Modulepublic String getName()
HK2ModulegetModuleDefinition().getName().public ModulesRegistry getRegistry()
HK2ModulegetRegistry in interface HK2Modulepublic ModuleState getState()
HK2Modulepublic void resolve()
throws ResolveError
HK2Moduleresolved.
If the module is already resolved, this method does nothing.
Otherwise, iterate over all declared ModuleDependency instances and use the
associated ModuleRegistry to resolve it. After successful
completion of this method, the module state is
ModuleState.RESOLVED.
resolve in interface HK2ModuleResolveError - if any of the declared dependency of this module
cannot be satisfiedpublic void start()
throws ResolveError
HK2ModuleModuleState.READY, the
Lifecycle.start method will be invoked.start in interface HK2ModuleResolveErrorpublic boolean stop()
HK2ModuleLifecyclePolicy for this module is defined, the
Lifecycle.stop(HK2Module)
method will be called and finally the module state will be
returned to ModuleState.NEW.public void detach()
HK2Modulepublic void refresh()
HK2Modulepublic ModuleMetadata getMetadata()
HK2ModulegetMetadata in interface HK2Modulepublic void addListener(ModuleChangeListener listener)
HK2ModuleaddListener in interface HK2Modulelistener - the listenerpublic void removeListener(ModuleChangeListener listener)
HK2ModuleremoveListener in interface HK2Modulelistener - the listener to unregisterpublic ClassLoader getClassLoader()
HK2ModuleClassLoader instance associated with this module.
Only designated public interfaces will be loaded and returned by
this classloadergetClassLoader in interface HK2ModuleClassLoaderpublic List<HK2Module> getImports()
HK2Module
This is the module version of ModuleDefinition.getDependencies(),
but after fully resolved.
To enforce the stable class visibility, once HK2Module is
created, dependencies cannot be changed — that is, we
don't want "a.b.C" to suddenly mean something different once
the code starts running.
getImports in interface HK2Modulepublic HK2Module addImport(ModuleDependency dependency)
HK2Modulepublic boolean isShared()
HK2Modulepublic boolean isSticky()
HK2Modulepublic void setSticky(boolean sticky)
HK2Modulepublic <T> Iterable<Class<? extends T>> getProvidersClass(Class<T> serviceClass)
getProvidersClass in interface HK2Modulepublic Iterable<Class> getProvidersClass(String name)
getProvidersClass in interface HK2Modulepublic boolean hasProvider(Class serviceClass)
HK2ModulehasProvider in interface HK2Modulepublic void dumpState(PrintStream writer)
Copyright © 2009–2021 Oracle Corporation. All rights reserved.