public class CompositeServiceContext extends java.lang.Object implements ServiceContext, TrackerCustomizer
Constructor and Description |
---|
CompositeServiceContext(org.osgi.framework.BundleContext context)
Constructor.
|
CompositeServiceContext(org.osgi.framework.BundleContext context,
ComponentInstance instance)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addBundleListener(org.osgi.framework.BundleListener arg0)
Add a bundle listener.
|
void |
addedService(org.osgi.framework.ServiceReference reference)
A matching reference has been added.
|
void |
addFrameworkListener(org.osgi.framework.FrameworkListener arg0)
Add a framework listener.
|
boolean |
addingService(org.osgi.framework.ServiceReference reference)
A new factory is detected.
|
void |
addServiceListener(org.osgi.framework.ServiceListener arg0)
Add a service listener.
|
void |
addServiceListener(org.osgi.framework.ServiceListener arg0,
java.lang.String arg1)
Add a filtered service listener.
|
org.osgi.framework.Filter |
createFilter(java.lang.String arg0)
Create a LDAP filter.
|
org.osgi.framework.ServiceReference[] |
getAllServiceReferences(java.lang.String arg0,
java.lang.String arg1)
Get all service references.
|
org.osgi.framework.Bundle |
getBundle()
Get the current bundle.
|
org.osgi.framework.Bundle |
getBundle(long bundleId)
Get the bundle object with the given id.
|
org.osgi.framework.Bundle |
getBundle(java.lang.String location) |
org.osgi.framework.Bundle[] |
getBundles()
Get installed bundles.
|
java.io.File |
getDataFile(java.lang.String filename)
Get a data file.
|
java.lang.String |
getProperty(java.lang.String key)
Get a property value.
|
java.lang.Object |
getService(org.osgi.framework.ServiceReference arg0)
Get a service object for the given service reference.
|
<S> org.osgi.framework.ServiceReference<S> |
getServiceReference(java.lang.Class<S> clazz) |
org.osgi.framework.ServiceReference |
getServiceReference(java.lang.String arg0)
Get a service reference for the required interface.
|
<S> java.util.Collection<org.osgi.framework.ServiceReference<S>> |
getServiceReferences(java.lang.Class<S> clazz,
java.lang.String filter) |
org.osgi.framework.ServiceReference[] |
getServiceReferences(java.lang.String clazz,
java.lang.String filter)
Get all accessible service reference for the given query.
|
org.osgi.framework.Bundle |
installBundle(java.lang.String location)
Install a bundle.
|
org.osgi.framework.Bundle |
installBundle(java.lang.String location,
java.io.InputStream input)
Install a bundle.
|
void |
modifiedService(org.osgi.framework.ServiceReference reference,
java.lang.Object service)
An imported factory is modified.
|
<S> org.osgi.framework.ServiceRegistration<S> |
registerService(java.lang.Class<S> clazz,
S service,
java.util.Dictionary<java.lang.String,?> properties) |
org.osgi.framework.ServiceRegistration |
registerService(java.lang.String[] arg0,
java.lang.Object arg1,
java.util.Dictionary arg2)
Register a service inside the composite context.
|
org.osgi.framework.ServiceRegistration |
registerService(java.lang.String arg0,
java.lang.Object arg1,
java.util.Dictionary arg2)
Register a service inside the composite context.
|
void |
removeBundleListener(org.osgi.framework.BundleListener listener)
Remove a bundle listener.
|
void |
removedService(org.osgi.framework.ServiceReference reference,
java.lang.Object service)
An imported factory disappears.
|
void |
removeFrameworkListener(org.osgi.framework.FrameworkListener listener)
Remove a framework listener.
|
void |
removeServiceListener(org.osgi.framework.ServiceListener arg0)
Remove a service listener.
|
void |
start()
Start the registry management.
|
void |
stop()
Stop the registry management.
|
boolean |
ungetService(org.osgi.framework.ServiceReference arg0)
Unget a service.
|
public CompositeServiceContext(org.osgi.framework.BundleContext context)
context
- : the bundle contextpublic CompositeServiceContext(org.osgi.framework.BundleContext context, ComponentInstance instance)
context
- : the bundle contextinstance
- : the component instance owning this contextpublic void addServiceListener(org.osgi.framework.ServiceListener arg0)
addServiceListener
in interface ServiceContext
addServiceListener
in interface org.osgi.framework.BundleContext
arg0
- : The service listener to addServiceContext.addServiceListener(org.osgi.framework.ServiceListener)
public void addServiceListener(org.osgi.framework.ServiceListener arg0, java.lang.String arg1) throws org.osgi.framework.InvalidSyntaxException
addServiceListener
in interface ServiceContext
addServiceListener
in interface org.osgi.framework.BundleContext
arg0
- : the service listener object to addarg1
- : the LDAP filter for this listenerorg.osgi.framework.InvalidSyntaxException
- : occurs if the LDAP filter is malformedServiceContext.addServiceListener(org.osgi.framework.ServiceListener,
java.lang.String)
public org.osgi.framework.ServiceReference[] getAllServiceReferences(java.lang.String arg0, java.lang.String arg1) throws org.osgi.framework.InvalidSyntaxException
getAllServiceReferences
in interface ServiceContext
getAllServiceReferences
in interface org.osgi.framework.BundleContext
arg0
- : The required service interface.arg1
- : LDAP filterorg.osgi.framework.InvalidSyntaxException
- : occurs when the given filter is malformedServiceContext.getAllServiceReferences(java.lang.String,
java.lang.String)
public java.lang.Object getService(org.osgi.framework.ServiceReference arg0)
getService
in interface ServiceContext
getService
in interface org.osgi.framework.BundleContext
arg0
- : the service referenceServiceContext.getService(org.osgi.framework.ServiceReference)
public org.osgi.framework.ServiceReference getServiceReference(java.lang.String arg0)
getServiceReference
in interface ServiceContext
getServiceReference
in interface org.osgi.framework.BundleContext
arg0
- : the required interface nameServiceContext.getServiceReference(java.lang.String)
public <S> org.osgi.framework.ServiceReference<S> getServiceReference(java.lang.Class<S> clazz)
getServiceReference
in interface org.osgi.framework.BundleContext
public <S> java.util.Collection<org.osgi.framework.ServiceReference<S>> getServiceReferences(java.lang.Class<S> clazz, java.lang.String filter) throws org.osgi.framework.InvalidSyntaxException
getServiceReferences
in interface org.osgi.framework.BundleContext
org.osgi.framework.InvalidSyntaxException
public org.osgi.framework.ServiceReference[] getServiceReferences(java.lang.String clazz, java.lang.String filter) throws org.osgi.framework.InvalidSyntaxException
getServiceReferences
in interface ServiceContext
getServiceReferences
in interface org.osgi.framework.BundleContext
clazz
- : required interfacefilter
- : LDAP filterorg.osgi.framework.InvalidSyntaxException
- : occurs when the LDAP filter is malformedServiceContext.getServiceReferences(java.lang.String, java.lang.String)
public org.osgi.framework.ServiceRegistration registerService(java.lang.String[] arg0, java.lang.Object arg1, java.util.Dictionary arg2)
registerService
in interface ServiceContext
registerService
in interface org.osgi.framework.BundleContext
arg0
- : list of interfaces to register.arg1
- : service objectarg2
- : properties listServiceContext.registerService(java.lang.String[], java.lang.Object, java.util.Dictionary)
public org.osgi.framework.ServiceRegistration registerService(java.lang.String arg0, java.lang.Object arg1, java.util.Dictionary arg2)
registerService
in interface ServiceContext
registerService
in interface org.osgi.framework.BundleContext
arg0
- : interface to register.arg1
- : service objectarg2
- : properties listServiceContext.registerService(java.lang.String, java.lang.Object, java.util.Dictionary)
public void removeServiceListener(org.osgi.framework.ServiceListener arg0)
removeServiceListener
in interface ServiceContext
removeServiceListener
in interface org.osgi.framework.BundleContext
arg0
- : the service listener to removeServiceContext.removeServiceListener(org.osgi.framework.ServiceListener)
public boolean ungetService(org.osgi.framework.ServiceReference arg0)
ungetService
in interface ServiceContext
ungetService
in interface org.osgi.framework.BundleContext
arg0
- the service reference to ungetServiceContext.ungetService(org.osgi.framework.ServiceReference)
public void start()
public void stop()
public void addBundleListener(org.osgi.framework.BundleListener arg0)
addBundleListener
in interface org.osgi.framework.BundleContext
arg0
- : bundle listener to addBundleContext.addBundleListener(org.osgi.framework.BundleListener)
public void addFrameworkListener(org.osgi.framework.FrameworkListener arg0)
addFrameworkListener
in interface org.osgi.framework.BundleContext
arg0
- : framework listener to add.BundleContext.addFrameworkListener(org.osgi.framework.FrameworkListener)
public org.osgi.framework.Filter createFilter(java.lang.String arg0) throws org.osgi.framework.InvalidSyntaxException
createFilter
in interface org.osgi.framework.BundleContext
arg0
- : String-form of the filterorg.osgi.framework.InvalidSyntaxException
- : if the given argument is not a valid against the LDAP grammar.BundleContext.createFilter(java.lang.String)
public org.osgi.framework.Bundle getBundle(java.lang.String location)
getBundle
in interface org.osgi.framework.BundleContext
public org.osgi.framework.Bundle getBundle()
getBundle
in interface org.osgi.framework.BundleContext
getBundle
in interface org.osgi.framework.BundleReference
BundleContext.getBundle()
public org.osgi.framework.Bundle getBundle(long bundleId)
getBundle
in interface org.osgi.framework.BundleContext
bundleId
- : bundle idBundleContext.getBundle(long)
public org.osgi.framework.Bundle[] getBundles()
getBundles
in interface org.osgi.framework.BundleContext
BundleContext.getBundles()
public java.io.File getDataFile(java.lang.String filename)
getDataFile
in interface org.osgi.framework.BundleContext
filename
- : File name.BundleContext.getDataFile(java.lang.String)
public java.lang.String getProperty(java.lang.String key)
getProperty
in interface org.osgi.framework.BundleContext
key
- : key of the asked propertyBundleContext.getProperty(java.lang.String)
public org.osgi.framework.Bundle installBundle(java.lang.String location) throws org.osgi.framework.BundleException
installBundle
in interface org.osgi.framework.BundleContext
location
- : 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.BundleContext
location
- : URL of the bundle to installinput
- :org.osgi.framework.BundleException
- : if the bundle cannot be installed correctlyBundleContext.installBundle(java.lang.String, java.io.InputStream)
public void removeBundleListener(org.osgi.framework.BundleListener listener)
removeBundleListener
in interface org.osgi.framework.BundleContext
listener
- : the listener to removeBundleContext.removeBundleListener(org.osgi.framework.BundleListener)
public void removeFrameworkListener(org.osgi.framework.FrameworkListener listener)
removeFrameworkListener
in interface org.osgi.framework.BundleContext
listener
- : the listener to removeBundleContext.removeFrameworkListener(org.osgi.framework.FrameworkListener)
public <S> org.osgi.framework.ServiceRegistration<S> registerService(java.lang.Class<S> clazz, S service, java.util.Dictionary<java.lang.String,?> properties)
registerService
in interface org.osgi.framework.BundleContext
public boolean addingService(org.osgi.framework.ServiceReference reference)
addingService
in interface TrackerCustomizer
reference
- : service referenceTrackerCustomizer.addingService(org.osgi.framework.ServiceReference)
public void addedService(org.osgi.framework.ServiceReference reference)
addedService
in interface TrackerCustomizer
reference
- : the added reference.TrackerCustomizer.addedService(org.osgi.framework.ServiceReference)
public void modifiedService(org.osgi.framework.ServiceReference reference, java.lang.Object service)
modifiedService
in interface TrackerCustomizer
reference
- : modified referenceservice
- : factory object.TrackerCustomizer.modifiedService(org.osgi.framework.ServiceReference, java.lang.Object)
public void removedService(org.osgi.framework.ServiceReference reference, java.lang.Object service)
removedService
in interface TrackerCustomizer
reference
- : referenceservice
- : factory object.TrackerCustomizer.removedService(org.osgi.framework.ServiceReference, java.lang.Object)
Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved.