public class IPojoContext extends java.lang.Object implements org.osgi.framework.BundleContext, ServiceContext
| Constructor and Description |
|---|
IPojoContext(org.osgi.framework.BundleContext context)
Creates an iPOJO Context.
|
IPojoContext(org.osgi.framework.BundleContext bundleContext,
ServiceContext serviceContext)
Creates an iPOJO Context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBundleListener(org.osgi.framework.BundleListener listener)
Adds a bundle listener.
|
void |
addFrameworkListener(org.osgi.framework.FrameworkListener listener)
Adds a framework listener.
|
void |
addServiceListener(org.osgi.framework.ServiceListener listener)
Add a service listener.
|
void |
addServiceListener(org.osgi.framework.ServiceListener listener,
java.lang.String filter)
Adds a service listener.
|
org.osgi.framework.Filter |
createFilter(java.lang.String filter)
Creates a filter objects.
|
org.osgi.framework.ServiceReference[] |
getAllServiceReferences(java.lang.String clazz,
java.lang.String filter)
Gets the service references matching with the given query.
|
org.osgi.framework.Bundle |
getBundle()
Gets the current bundle object.
|
org.osgi.framework.Bundle |
getBundle(long bundleId)
Gets the bundle object with the given id.
|
org.osgi.framework.Bundle |
getBundle(java.lang.String s)
Gets a bundle by symbolic name
|
org.osgi.framework.Bundle[] |
getBundles()
Gets installed bundles.
|
java.io.File |
getDataFile(java.lang.String filename)
Gets a data file.
|
org.osgi.framework.BundleContext |
getGlobalContext()
Gets the global context, i.e.
|
java.lang.String |
getProperty(java.lang.String key)
Gets a property value.
|
<S> S |
getService(org.osgi.framework.ServiceReference<S> ref)
Gets a service object.
|
ServiceContext |
getServiceContext()
Gets the service context, i.e.
|
<S> org.osgi.framework.ServiceReference<S> |
getServiceReference(java.lang.Class<S> sClass)
Gets a service reference for the given interface.
|
org.osgi.framework.ServiceReference |
getServiceReference(java.lang.String clazz)
Gets a service reference for the given interface.
|
<S> java.util.Collection<org.osgi.framework.ServiceReference<S>> |
getServiceReferences(java.lang.Class<S> sClass,
java.lang.String filter)
Gets service reference list for the given query.
|
org.osgi.framework.ServiceReference[] |
getServiceReferences(java.lang.String clazz,
java.lang.String filter)
Gets service reference list for the given query.
|
org.osgi.framework.Bundle |
installBundle(java.lang.String location)
Installs a bundle.
|
org.osgi.framework.Bundle |
installBundle(java.lang.String location,
java.io.InputStream input)
Installs a bundle.
|
<S> org.osgi.framework.ServiceRegistration<S> |
registerService(java.lang.Class<S> sClass,
S s,
java.util.Dictionary<java.lang.String,?> stringDictionary)
Registers a service
|
org.osgi.framework.ServiceRegistration |
registerService(java.lang.String[] clazzes,
java.lang.Object service,
java.util.Dictionary properties)
Registers a service.
|
org.osgi.framework.ServiceRegistration |
registerService(java.lang.String clazz,
java.lang.Object service,
java.util.Dictionary properties)
Registers a service.
|
void |
removeBundleListener(org.osgi.framework.BundleListener listener)
Removes a bundle listener.
|
void |
removeFrameworkListener(org.osgi.framework.FrameworkListener listener)
Removes a framework listener.
|
void |
removeServiceListener(org.osgi.framework.ServiceListener listener)
Removes a service listener.
|
boolean |
ungetService(org.osgi.framework.ServiceReference reference)
Ungets the service reference.
|
public IPojoContext(org.osgi.framework.BundleContext context)
context - the bundle contextpublic IPojoContext(org.osgi.framework.BundleContext bundleContext,
ServiceContext serviceContext)
bundleContext - the bundle contextserviceContext - the service contextpublic void addBundleListener(org.osgi.framework.BundleListener listener)
addBundleListener in interface org.osgi.framework.BundleContextlistener - the listener to addBundleContext.addBundleListener(org.osgi.framework.BundleListener)public void addFrameworkListener(org.osgi.framework.FrameworkListener listener)
addFrameworkListener in interface org.osgi.framework.BundleContextlistener - the listener object to addBundleContext.addFrameworkListener(org.osgi.framework.FrameworkListener)public void addServiceListener(org.osgi.framework.ServiceListener listener,
java.lang.String filter)
throws org.osgi.framework.InvalidSyntaxException
match(String)). Finally, if the internal
dispatcher is disabled, it uses the "regular" bundle context.addServiceListener in interface ServiceContextaddServiceListener in interface org.osgi.framework.BundleContextlistener - the service listener to add.filter - the LDAP filterorg.osgi.framework.InvalidSyntaxException - if LDAP filter is malformedBundleContext.addServiceListener(org.osgi.framework.ServiceListener, java.lang.String)public void addServiceListener(org.osgi.framework.ServiceListener listener)
addServiceListener in interface ServiceContextaddServiceListener in interface org.osgi.framework.BundleContextlistener - the service listener to add.BundleContext.addServiceListener(org.osgi.framework.ServiceListener)public org.osgi.framework.Filter createFilter(java.lang.String filter)
throws org.osgi.framework.InvalidSyntaxException
createFilter in interface org.osgi.framework.BundleContextfilter - the string form of the LDAP filter to createorg.osgi.framework.InvalidSyntaxException - if the given filter is malformedBundleContext.createFilter(java.lang.String)public org.osgi.framework.Bundle getBundle(java.lang.String s)
getBundle in interface org.osgi.framework.BundleContexts - the namenull if not foundpublic org.osgi.framework.ServiceReference[] getAllServiceReferences(java.lang.String clazz,
java.lang.String filter)
throws org.osgi.framework.InvalidSyntaxException
getAllServiceReferences in interface ServiceContextgetAllServiceReferences in interface org.osgi.framework.BundleContextclazz - the required interfacefilter - the LDAP filterorg.osgi.framework.InvalidSyntaxException - if the LDAP filter is malformedBundleContext.getAllServiceReferences(java.lang.String, java.lang.String)public org.osgi.framework.Bundle getBundle()
getBundle in interface org.osgi.framework.BundleContextgetBundle in interface org.osgi.framework.BundleReferenceBundleContext.getBundle()public org.osgi.framework.Bundle getBundle(long bundleId)
getBundle in interface org.osgi.framework.BundleContextbundleId - the bundle idBundleContext.getBundle(long)public org.osgi.framework.Bundle[] getBundles()
getBundles in interface org.osgi.framework.BundleContextBundleContext.getBundles()public java.io.File getDataFile(java.lang.String filename)
getDataFile in interface org.osgi.framework.BundleContextfilename - the file name.BundleContext.getDataFile(java.lang.String)public java.lang.String getProperty(java.lang.String key)
getProperty in interface org.osgi.framework.BundleContextkey - the key of the asked propertynull if no
property are associated with the given keyBundleContext.getProperty(java.lang.String)public <S> S getService(org.osgi.framework.ServiceReference<S> ref)
IllegalStateException if the used bundle
context is no more valid (because we're leaving).getService in interface ServiceContextgetService in interface org.osgi.framework.BundleContextref - the required service referencenull if the service reference
is no more valid or if the service object is not accessible.BundleContext.getService(org.osgi.framework.ServiceReference)public org.osgi.framework.ServiceReference getServiceReference(java.lang.String clazz)
getServiceReference in interface ServiceContextgetServiceReference in interface org.osgi.framework.BundleContextclazz - the required interface namenull
if no providers availableBundleContext.getServiceReference(java.lang.String)public <S> org.osgi.framework.ServiceReference<S> getServiceReference(java.lang.Class<S> sClass)
getServiceReference in interface org.osgi.framework.BundleContextS - the service classsClass - the required interface classnull
if no providers availableBundleContext.getServiceReference(java.lang.String)public <S> java.util.Collection<org.osgi.framework.ServiceReference<S>> getServiceReferences(java.lang.Class<S> sClass,
java.lang.String filter)
throws org.osgi.framework.InvalidSyntaxException
getServiceReferences in interface org.osgi.framework.BundleContextS - the service classsClass - the name of the required service interfacefilter - the LDAP filter to apply on service providernull
if no available providersorg.osgi.framework.InvalidSyntaxException - if the LDAP filter is malformedpublic org.osgi.framework.ServiceReference[] getServiceReferences(java.lang.String clazz,
java.lang.String filter)
throws org.osgi.framework.InvalidSyntaxException
getServiceReferences in interface ServiceContextgetServiceReferences in interface org.osgi.framework.BundleContextclazz - the name of the required service interfacefilter - the LDAP filter to apply on service providernull
if no available providersorg.osgi.framework.InvalidSyntaxException - if the LDAP filter is malformedBundleContext.getServiceReferences(java.lang.String, java.lang.String)public org.osgi.framework.Bundle installBundle(java.lang.String location)
throws org.osgi.framework.BundleException
installBundle in interface org.osgi.framework.BundleContextlocation - the URL of the bundle to installorg.osgi.framework.BundleException - if the bundle cannot be installed correctlyBundleContext.installBundle(java.lang.String)public org.osgi.framework.Bundle installBundle(java.lang.String location,
java.io.InputStream input)
throws org.osgi.framework.BundleException
installBundle in interface org.osgi.framework.BundleContextlocation - the URL of the bundle to installinput - the input stream to load the bundle.org.osgi.framework.BundleException - if the bundle cannot be installed correctlyBundleContext.installBundle(java.lang.String, java.io.InputStream)public org.osgi.framework.ServiceRegistration registerService(java.lang.String[] clazzes,
java.lang.Object service,
java.util.Dictionary properties)
registerService in interface ServiceContextregisterService in interface org.osgi.framework.BundleContextclazzes - the interfaces provided by the service.service - the service object.properties - the service properties to publishServiceContext.registerService(java.lang.String[], java.lang.Object, java.util.Dictionary)public org.osgi.framework.ServiceRegistration registerService(java.lang.String clazz,
java.lang.Object service,
java.util.Dictionary properties)
registerService in interface ServiceContextregisterService in interface org.osgi.framework.BundleContextclazz - the interface provided by the service.service - the the service object.properties - the service properties to publish.BundleContext.registerService(java.lang.String, java.lang.Object, java.util.Dictionary)public void removeBundleListener(org.osgi.framework.BundleListener listener)
removeBundleListener in interface org.osgi.framework.BundleContextlistener - the listener to removeBundleContext.removeBundleListener(org.osgi.framework.BundleListener)public void removeFrameworkListener(org.osgi.framework.FrameworkListener listener)
removeFrameworkListener in interface org.osgi.framework.BundleContextlistener - the listener to removeBundleContext.removeFrameworkListener(org.osgi.framework.FrameworkListener)public <S> org.osgi.framework.ServiceRegistration<S> registerService(java.lang.Class<S> sClass,
S s,
java.util.Dictionary<java.lang.String,?> stringDictionary)
registerService in interface org.osgi.framework.BundleContextS - the Service Class (specification)sClass - the service classs - the service object (must implement sClass)stringDictionary - service propertiespublic void removeServiceListener(org.osgi.framework.ServiceListener listener)
removeServiceListener in interface ServiceContextremoveServiceListener in interface org.osgi.framework.BundleContextlistener - the service listener to removeServiceContext.removeServiceListener(org.osgi.framework.ServiceListener),
BundleContext.removeServiceListener(org.osgi.framework.ServiceListener)public boolean ungetService(org.osgi.framework.ServiceReference reference)
ungetService in interface ServiceContextungetService in interface org.osgi.framework.BundleContextreference - the reference to ungettrue if you are the last user of the referenceBundleContext.ungetService(org.osgi.framework.ServiceReference)public org.osgi.framework.BundleContext getGlobalContext()
public ServiceContext getServiceContext()
null if the instance does not live
inside a composite.null.Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved.