|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jvnet.hk2.osgiadapter.OSGiModuleImpl
public class OSGiModuleImpl
Constructor Summary | |
---|---|
OSGiModuleImpl(AbstractOSGiModulesRegistryImpl registry,
org.osgi.framework.Bundle bundle,
ModuleDefinition md)
|
Method Summary | ||
---|---|---|
void |
addImport(Module module)
|
|
Module |
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)
|
|
boolean |
equals(Object obj)
|
|
org.osgi.framework.Bundle |
getBundle()
|
|
ClassLoader |
getClassLoader()
Return the ClassLoader instance associated with this module. |
|
List<Module> |
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() . |
|
|
getProvidersClass(Class<T> serviceClass)
|
|
Iterable<Class> |
getProvidersClass(String name)
|
|
ModulesRegistry |
getRegistry()
Returns the registry owning this module |
|
ModuleState |
getState()
Returns the module's state |
|
int |
hashCode()
|
|
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. |
|
boolean |
isTransientlyActive()
|
|
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 . |
|
protected void |
setBundle(org.osgi.framework.Bundle bundle)
|
|
void |
setSticky(boolean sticky)
Sets the sticky flag. |
|
void |
start()
Forces module startup. |
|
boolean |
stop()
Forces module stop. |
|
String |
toString()
|
|
void |
uninstall()
Removes the module from the registry backing store, the module will need be reinstalled to be loaded. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OSGiModuleImpl(AbstractOSGiModulesRegistryImpl registry, org.osgi.framework.Bundle bundle, ModuleDefinition md)
Method Detail |
---|
public ModuleDefinition getModuleDefinition()
Module
getModuleDefinition
in interface Module
public String getName()
Module
getModuleDefinition().getName()
.
getName
in interface Module
public ModulesRegistry getRegistry()
Module
getRegistry
in interface Module
public ModuleState getState()
Module
getState
in interface Module
public void resolve() throws ResolveError
Module
resolved
.
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 Module
ResolveError
- if any of the declared dependency of this module
cannot be satisfiedpublic void start() throws ResolveError
Module
ModuleState.READY
, the
Lifecycle.start
method will be invoked.
start
in interface Module
ResolveError
public boolean stop()
Module
LifecyclePolicy
for this module is defined, the
Lifecycle.stop(Module)
method will be called and finally the module state will be
returned to ModuleState.NEW
.
stop
in interface Module
public void detach()
Module
detach
in interface Module
public void uninstall()
Module
uninstall
in interface Module
public void refresh()
Module
refresh
in interface Module
public ModuleMetadata getMetadata()
Module
getMetadata
in interface Module
public <T> Iterable<Class<? extends T>> getProvidersClass(Class<T> serviceClass)
getProvidersClass
in interface Module
public Iterable<Class> getProvidersClass(String name)
getProvidersClass
in interface Module
public boolean hasProvider(Class serviceClass)
Module
hasProvider
in interface Module
public void addListener(ModuleChangeListener listener)
Module
addListener
in interface Module
listener
- the listenerpublic void removeListener(ModuleChangeListener listener)
Module
removeListener
in interface Module
listener
- the listener to unregisterpublic void dumpState(PrintStream writer)
dumpState
in interface Module
public ClassLoader getClassLoader()
Module
ClassLoader
instance associated with this module.
Only designated public interfaces will be loaded and returned by
this classloader
getClassLoader
in interface Module
ClassLoader
public void addImport(Module module)
addImport
in interface Module
public Module addImport(ModuleDependency dependency)
Module
addImport
in interface Module
dependency
- new module's definitionpublic boolean isSticky()
Module
isSticky
in interface Module
public void setSticky(boolean sticky)
Module
setSticky
in interface Module
sticky
- true if the module should stick aroundpublic List<Module> getImports()
Module
This is the module version of ModuleDefinition.getDependencies()
,
but after fully resolved.
To enforce the stable class visibility, once Module
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 Module
public boolean isShared()
Module
isShared
in interface Module
public org.osgi.framework.Bundle getBundle()
public boolean isTransientlyActive()
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
protected void setBundle(org.osgi.framework.Bundle bundle)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |