public final class OSGiContainer extends Object implements Container, org.osgi.framework.ServiceListener
Container for OSGi.| Modifier and Type | Field and Description |
|---|---|
static OSGiContainer |
THE_CONTAINER |
| Modifier and Type | Method and Description |
|---|---|
Object |
fetchSharedObject(ModuleContext requester,
Object[] fetchParams)
Returns an object previously shared by another module for usage within
this container.
|
Object[] |
fetchSharedObject(ModuleContext requester,
Object[] fetchParams,
SharedObjectListener listener)
Returns an object previously shared by another module for usage within
this container.
|
ModuleContext |
installModule(ModuleContext requester,
Object[] installParams)
Provides possibility for programmatically installing (downloaded)
modules.
|
Iterator<LogListener> |
logListeners()
Returns an
Iterator object over all registered
instances of LogListener. |
ModuleContext |
registerModule(Object[] regParams)
Provides possibility for wrapping container-specific context for a module
in terms of an instance of the universAAL
ModuleContext. |
void |
removeSharedObject(ModuleContext requester,
Object objToRemove,
Object[] shareParams)
Removes an object previously shared by a module for usage within this
container.
|
void |
removeSharedObjectListener(SharedObjectListener listener)
This method allows a SharedObjectListener instance to be removed from the
list of listeners managed by this container
|
void |
serviceChanged(org.osgi.framework.ServiceEvent se) |
void |
shareObject(ModuleContext requester,
Object objToShare,
Object[] shareParams)
Makes a given object accessible for the other modules hosted by this
container.
|
public static final OSGiContainer THE_CONTAINER
public Object fetchSharedObject(ModuleContext requester, Object[] fetchParams)
ContainerfetchSharedObject in interface ContainerfetchParams - StringBundleContext.getServiceReference(String) will be used
to fetch a service objectBundleContext.getServiceReferences(String, String)
will be used to fetch the first service object from the
returned arrayrequester - The module in the context of which the shared object is going
to be used.OSGiModuleContext and a ServiceReference has been
found according to the explanations given for
fetchParams, then the result of calling
BundleContext.getService(ServiceReference) will be
returned.Container.fetchSharedObject(ModuleContext,
Object[], SharedObjectListener)public Object[] fetchSharedObject(ModuleContext requester, Object[] fetchParams, SharedObjectListener listener)
ContainerfetchSharedObject in interface Containerrequester - The module in the context of which the shared object is going
to be used.fetchParams - Container-specific parameters for fetching shared objects.listener - If not null, the listener will be notified asynchronously each
time a new matching object is shared within this container.public ModuleContext installModule(ModuleContext requester, Object[] installParams)
ContainerinstallModule in interface ContainerinstallParams - String
(mandatory)InputStreamBundleContext.installBundle(String) will be used to
install the given bundleBundleContext.installBundle(String, java.io.InputStream)
will be used to install the given bundlerequester - The module requesting the installation; only an certain
modules should be allowed to install modules on the flyOSGiModuleContext that wraps
the newly installed bundle if the given requester is an instance
of OSGiModuleContext, the conditions on
installParams hold, and the installation is
successful, null otherwise.Container.installModule(org.universAAL.middleware.container.ModuleContext,
java.lang.Object[])public Iterator<LogListener> logListeners()
ContainerIterator object over all registered
instances of LogListener.logListeners in interface ContainerContainer.logListeners()public ModuleContext registerModule(Object[] regParams)
ContainerModuleContext.registerModule in interface ContainerregParams - element @ index 0 must exist and be an instance of
BundleContextOSGiModuleContext if the conditions for
regParams hold, null otherwiseContainer.registerModule(java.lang.Object[])public void serviceChanged(org.osgi.framework.ServiceEvent se)
serviceChanged in interface org.osgi.framework.ServiceListenerServiceListener.serviceChanged(org.osgi.framework.ServiceEvent)public void shareObject(ModuleContext requester, Object objToShare, Object[] shareParams)
ContainershareObject in interface ContainershareParams - String; these
strings specify the interfaces that the
objToShare has implemented (cf.
BundleContext.registerService(String[], Object, java.util.Dictionary)
).Dictionary; it can be used for
property-based search of shared objects (cf.
BundleContext.registerService(String[], Object, java.util.Dictionary)
).requester - The module in the context of which the shared object is going
to be used.objToShare - The actual object to be shared.Container.shareObject(org.universAAL.middleware.container.ModuleContext,
java.lang.Object, java.lang.Object[])public void removeSharedObject(ModuleContext requester, Object objToRemove, Object[] shareParams)
ContainerremoveSharedObject in interface Containerrequester - The module in the context of which the shared object was
shared.public void removeSharedObjectListener(SharedObjectListener listener)
ContainerremoveSharedObjectListener in interface Containerlistener - the SharedObjectListener to be removedCopyright © 2018 universAAL Consortium. All rights reserved.