|
||||||||||
| 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. |
org.osgi.framework.BundleContext |
m_global
The global service registry. |
ServiceContext |
m_local
The local (Composite) Service Registry. |
private int |
m_policy
The resolving policy to use to resolve dependencies. |
| Constructor Summary | |
|---|---|
PolicyServiceContext(org.osgi.framework.BundleContext global,
ServiceContext local,
int policy)
Creates a PolicyServiceContext. |
|
| Method Summary | |
|---|---|
void |
addBundleListener(org.osgi.framework.BundleListener arg0)
Adds a bundle listener. |
void |
addFrameworkListener(org.osgi.framework.FrameworkListener arg0)
Adds a framework listener. |
void |
addServiceListener(org.osgi.framework.ServiceListener listener)
Adds a service listener according to the policy. |
void |
addServiceListener(org.osgi.framework.ServiceListener listener,
java.lang.String filter)
Adds a service listener according to the policy. |
private org.osgi.framework.ServiceReference[] |
computeServiceReferencesFromBoth(org.osgi.framework.ServiceReference[] refLocal,
org.osgi.framework.ServiceReference[] refGlobal)
Computes the service reference array from the two given set of service references according to the policy. |
org.osgi.framework.Filter |
createFilter(java.lang.String arg0)
Creates a LDAP filter. |
org.osgi.framework.ServiceReference[] |
getAllServiceReferences(java.lang.String clazz,
java.lang.String filter)
Gets all service references. |
org.osgi.framework.Bundle |
getBundle()
Gets the current bundle. |
org.osgi.framework.Bundle |
getBundle(long bundleId)
Gets the bundle object with the given id. |
org.osgi.framework.Bundle[] |
getBundles()
Gets installed bundles. |
java.io.File |
getDataFile(java.lang.String filename)
Gets a data file. |
java.lang.String |
getProperty(java.lang.String key)
Gets a property value. |
java.lang.Object |
getService(org.osgi.framework.ServiceReference ref)
Gets the service object for the given references. |
org.osgi.framework.ServiceReference |
getServiceReference(java.lang.String clazz)
Gets a service reference for the required service specification. |
org.osgi.framework.ServiceReference[] |
getServiceReferences(java.lang.String clazz,
java.lang.String filter)
Get a service reference for the required service specification. |
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. |
org.osgi.framework.ServiceRegistration |
registerService(java.lang.String[] clazzes,
java.lang.Object service,
java.util.Dictionary properties)
This method is not supported. |
org.osgi.framework.ServiceRegistration |
registerService(java.lang.String clazz,
java.lang.Object service,
java.util.Dictionary properties)
This method is not supported. |
void |
removeBundleListener(org.osgi.framework.BundleListener listener)
Removes the 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. |
| 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 org.osgi.framework.BundleContext m_global
public ServiceContext m_local
private int m_policy
| Constructor Detail |
|---|
public PolicyServiceContext(org.osgi.framework.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(org.osgi.framework.ServiceListener listener,
java.lang.String filter)
throws org.osgi.framework.InvalidSyntaxException
LOCAL_AND_GLOBAL is used.
addServiceListener in interface ServiceContextaddServiceListener in interface org.osgi.framework.BundleContextlistener - the listener to addfilter - the LDAP filter
org.osgi.framework.InvalidSyntaxException - if the filter is malformed.ServiceContext.addServiceListener(org.osgi.framework.ServiceListener, java.lang.String)public void addServiceListener(org.osgi.framework.ServiceListener listener)
LOCAL_AND_GLOBAL is used.
addServiceListener in interface ServiceContextaddServiceListener in interface org.osgi.framework.BundleContextlistener - the listener to addServiceContext.addServiceListener(org.osgi.framework.ServiceListener)
public 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 service specification.filter - the LDAP filter
null if no service available
org.osgi.framework.InvalidSyntaxException - if the LDAP filter is malformedServiceContext.getAllServiceReferences(java.lang.String, java.lang.String)public java.lang.Object getService(org.osgi.framework.ServiceReference ref)
getService in interface ServiceContextgetService in interface org.osgi.framework.BundleContextref - the service reference
ServiceContext.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 service specification
null if no matching service availableServiceContext.getServiceReference(java.lang.String)
public 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 required service specificationfilter - the LDAP filter
null if not consistent service available
org.osgi.framework.InvalidSyntaxException - if the LDAP filter is malformedServiceContext.getServiceReference(java.lang.String)
private org.osgi.framework.ServiceReference[] computeServiceReferencesFromBoth(org.osgi.framework.ServiceReference[] refLocal,
org.osgi.framework.ServiceReference[] refGlobal)
refLocal - the set of local referencesrefGlobal - the set of global references
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 specificationsservice - the service objectproperties - the service properties
ServiceContext.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 specificationservice - the service objectproperties - the service properties to publish
ServiceContext.registerService(java.lang.String, java.lang.Object, java.util.Dictionary)public 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)public boolean ungetService(org.osgi.framework.ServiceReference reference)
ungetService in interface ServiceContextungetService in interface org.osgi.framework.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(org.osgi.framework.BundleListener arg0)
addBundleListener in interface org.osgi.framework.BundleContextarg0 - : bundle listener to addBundleContext.addBundleListener(org.osgi.framework.BundleListener)public void addFrameworkListener(org.osgi.framework.FrameworkListener arg0)
addFrameworkListener in interface org.osgi.framework.BundleContextarg0 - : 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.BundleContextarg0 - the String-form of the filter
org.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()
getBundle in interface org.osgi.framework.BundleContextBundleContext.getBundle()public org.osgi.framework.Bundle getBundle(long bundleId)
getBundle in interface org.osgi.framework.BundleContextbundleId - the bundle id
BundleContext.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 property
null if no property
are associated with the given keyBundleContext.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.BundleContextlocation - the URL of the bundle to install
org.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 content
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.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)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||