|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.felix.ipojo.PolicyServiceContext
public class PolicyServiceContext
The policy service context is a service context aiming to resolve service dependencies inside different service context according to a policy. So, the policy service context behavior follows one of the three following policy:
| Field Summary | |
|---|---|
static int |
GLOBAL
Resolving policy, resolves services inside the global context only. |
static int |
LOCAL
Resolving policy, resolves services only in the composite context (local). |
static int |
LOCAL_AND_GLOBAL
Resolving policy, resolves services only in the composite (local) and in the global context. |
BundleContext |
m_global
The global service registry. |
ServiceContext |
m_local
The local (Composite) Service Registry. |
| Constructor Summary | |
|---|---|
PolicyServiceContext(BundleContext global,
ServiceContext local,
int policy)
Creates a PolicyServiceContext. |
|
| Method Summary | |
|---|---|
void |
addBundleListener(BundleListener arg0)
Adds a bundle listener. |
void |
addFrameworkListener(FrameworkListener arg0)
Adds a framework listener. |
void |
addServiceListener(ServiceListener listener)
Adds a service listener according to the policy. |
void |
addServiceListener(ServiceListener listener,
String filter)
Adds a service listener according to the policy. |
Filter |
createFilter(String arg0)
Creates a LDAP filter. |
ServiceReference[] |
getAllServiceReferences(String clazz,
String filter)
Gets all service references. |
Bundle |
getBundle()
Gets the current bundle. |
Bundle |
getBundle(long bundleId)
Gets the bundle object with the given id. |
Bundle[] |
getBundles()
Gets installed bundles. |
File |
getDataFile(String filename)
Gets a data file. |
String |
getProperty(String key)
Gets a property value. |
Object |
getService(ServiceReference ref)
Gets the service object for the given references. |
ServiceReference |
getServiceReference(String clazz)
Gets a service reference for the required service specification. |
ServiceReference[] |
getServiceReferences(String clazz,
String filter)
Get a service reference for the required service specification. |
Bundle |
installBundle(String location)
Installs a bundle. |
Bundle |
installBundle(String location,
InputStream input)
Installs a bundle. |
ServiceRegistration |
registerService(String[] clazzes,
Object service,
Dictionary properties)
This method is not supported. |
ServiceRegistration |
registerService(String clazz,
Object service,
Dictionary properties)
This method is not supported. |
void |
removeBundleListener(BundleListener listener)
Removes the bundle listener. |
void |
removeFrameworkListener(FrameworkListener listener)
Removes a framework listener. |
void |
removeServiceListener(ServiceListener listener)
Removes a service listener. |
boolean |
ungetService(ServiceReference reference)
Ungets the service reference. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LOCAL
public static final int LOCAL_AND_GLOBAL
public static final int GLOBAL
public BundleContext m_global
public ServiceContext m_local
| Constructor Detail |
|---|
public PolicyServiceContext(BundleContext global,
ServiceContext local,
int policy)
GLOBAL, else use the
given policy.
global - the global bundle contextlocal - the parent (local) service contextpolicy - the resolution policy| Method Detail |
|---|
public void addServiceListener(ServiceListener listener,
String filter)
throws InvalidSyntaxException
LOCAL_AND_GLOBAL is used.
addServiceListener in interface ServiceContextaddServiceListener in interface BundleContextlistener - the listener to addfilter - the LDAP filter
InvalidSyntaxException - if the filter is malformed.ServiceContext.addServiceListener(org.osgi.framework.ServiceListener, java.lang.String)public void addServiceListener(ServiceListener listener)
LOCAL_AND_GLOBAL is used.
addServiceListener in interface ServiceContextaddServiceListener in interface BundleContextlistener - the listener to addServiceContext.addServiceListener(org.osgi.framework.ServiceListener)
public ServiceReference[] getAllServiceReferences(String clazz,
String filter)
throws InvalidSyntaxException
getAllServiceReferences in interface ServiceContextgetAllServiceReferences in interface BundleContextclazz - the required service specification.filter - the LDAP filter
null if no service available
InvalidSyntaxException - if the LDAP filter is malformedServiceContext.getAllServiceReferences(java.lang.String, java.lang.String)public Object getService(ServiceReference ref)
getService in interface ServiceContextgetService in interface BundleContextref - the service reference
ServiceContext.getService(org.osgi.framework.ServiceReference)public ServiceReference getServiceReference(String clazz)
getServiceReference in interface ServiceContextgetServiceReference in interface BundleContextclazz - the required service specification
null if no matching service availableServiceContext.getServiceReference(java.lang.String)
public ServiceReference[] getServiceReferences(String clazz,
String filter)
throws InvalidSyntaxException
getServiceReferences in interface ServiceContextgetServiceReferences in interface BundleContextclazz - the required service specificationfilter - the LDAP filter
null if not consistent service available
InvalidSyntaxException - if the LDAP filter is malformedServiceContext.getServiceReference(java.lang.String)
public ServiceRegistration registerService(String[] clazzes,
Object service,
Dictionary properties)
registerService in interface ServiceContextregisterService in interface BundleContextclazzes - the specificationsservice - the service objectproperties - the service properties
ServiceContext.registerService(java.lang.String[], java.lang.Object, java.util.Dictionary)
public ServiceRegistration registerService(String clazz,
Object service,
Dictionary properties)
registerService in interface ServiceContextregisterService in interface BundleContextclazz - the specificationservice - the service objectproperties - the service properties to publish
ServiceContext.registerService(java.lang.String, java.lang.Object, java.util.Dictionary)public void removeServiceListener(ServiceListener listener)
removeServiceListener in interface ServiceContextremoveServiceListener in interface BundleContextlistener - the service listener to removeServiceContext.removeServiceListener(org.osgi.framework.ServiceListener)public boolean ungetService(ServiceReference reference)
ungetService in interface ServiceContextungetService in interface BundleContextreference - the service reference to unget.
true if the service release if the reference is no more used.ServiceContext.ungetService(org.osgi.framework.ServiceReference)public void addBundleListener(BundleListener arg0)
addBundleListener in interface BundleContextarg0 - : bundle listener to addBundleContext.addBundleListener(org.osgi.framework.BundleListener)public void addFrameworkListener(FrameworkListener arg0)
addFrameworkListener in interface BundleContextarg0 - : framework listener to add.BundleContext.addFrameworkListener(org.osgi.framework.FrameworkListener)
public Filter createFilter(String arg0)
throws InvalidSyntaxException
createFilter in interface BundleContextarg0 - the String-form of the filter
InvalidSyntaxException - if the given argument is not a valid against the LDAP grammar.BundleContext.createFilter(java.lang.String)public Bundle getBundle()
getBundle in interface BundleContextBundleContext.getBundle()public Bundle getBundle(long bundleId)
getBundle in interface BundleContextbundleId - the bundle id
BundleContext.getBundle(long)public Bundle[] getBundles()
getBundles in interface BundleContextBundleContext.getBundles()public File getDataFile(String filename)
getDataFile in interface BundleContextfilename - the File name.
BundleContext.getDataFile(java.lang.String)public String getProperty(String key)
getProperty in interface BundleContextkey - the key of the asked property
null if no property
are associated with the given keyBundleContext.getProperty(java.lang.String)
public Bundle installBundle(String location)
throws BundleException
installBundle in interface BundleContextlocation - the URL of the bundle to install
BundleException - if the bundle cannot be installed correctlyBundleContext.installBundle(java.lang.String)
public Bundle installBundle(String location,
InputStream input)
throws BundleException
installBundle in interface BundleContextlocation - the URL of the bundle to installinput - the input stream to load the bundle content
BundleException - if the bundle cannot be installed correctlyBundleContext.installBundle(java.lang.String, java.io.InputStream)public void removeBundleListener(BundleListener listener)
removeBundleListener in interface BundleContextlistener - the listener to removeBundleContext.removeBundleListener(org.osgi.framework.BundleListener)public void removeFrameworkListener(FrameworkListener listener)
removeFrameworkListener in interface BundleContextlistener - the listener to removeBundleContext.removeFrameworkListener(org.osgi.framework.FrameworkListener)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||