|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.gemini.blueprint.mock.MockBundleContext
public class MockBundleContext
BundleContext mock.
Can be configured to use a predefined Bundle or/and configuration. By default, will create an internal MockBundle. Most of the operations are no-op (as anonymous classes with specific functionality can be created per use basis).
| Field Summary | |
|---|---|
protected Set |
bundleListeners
|
static Properties |
DEFAULT_PROPERTIES
|
protected Set |
serviceListeners
|
| Constructor Summary | |
|---|---|
MockBundleContext()
Constructs a new MockBundleContext instance. |
|
MockBundleContext(org.osgi.framework.Bundle bundle)
Constructs a new MockBundleContext instance. |
|
MockBundleContext(org.osgi.framework.Bundle bundle,
Properties props)
Constructs a new MockBundleContext instance allowing both
the bundle and the context properties to be specified. |
|
| Method Summary | |
|---|---|
void |
addBundleListener(org.osgi.framework.BundleListener listener)
|
void |
addFrameworkListener(org.osgi.framework.FrameworkListener listener)
|
void |
addServiceListener(org.osgi.framework.ServiceListener listener)
|
void |
addServiceListener(org.osgi.framework.ServiceListener listener,
String filter)
|
org.osgi.framework.Filter |
createFilter(String filter)
|
org.osgi.framework.ServiceReference[] |
getAllServiceReferences(String clazz,
String filter)
|
org.osgi.framework.Bundle |
getBundle()
|
org.osgi.framework.Bundle |
getBundle(long id)
|
Set |
getBundleListeners()
Returns a set of registered bundle listeners. |
org.osgi.framework.Bundle[] |
getBundles()
|
File |
getDataFile(String filename)
|
String |
getProperty(String key)
|
Object |
getService(org.osgi.framework.ServiceReference reference)
|
Set |
getServiceListeners()
Returns a set of registered service listeners. |
org.osgi.framework.ServiceReference |
getServiceReference(String clazz)
|
org.osgi.framework.ServiceReference[] |
getServiceReferences(String clazz,
String filter)
|
org.osgi.framework.Bundle |
installBundle(String location)
|
org.osgi.framework.Bundle |
installBundle(String location,
InputStream input)
|
org.osgi.framework.ServiceRegistration |
registerService(String[] clazzes,
Object service,
Dictionary properties)
|
org.osgi.framework.ServiceRegistration |
registerService(String clazz,
Object service,
Dictionary properties)
|
void |
removeBundleListener(org.osgi.framework.BundleListener listener)
|
void |
removeFrameworkListener(org.osgi.framework.FrameworkListener listener)
|
void |
removeServiceListener(org.osgi.framework.ServiceListener listener)
|
void |
setBundle(org.osgi.framework.Bundle bundle)
Sets the bundle associated with this context. |
boolean |
ungetService(org.osgi.framework.ServiceReference reference)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Properties DEFAULT_PROPERTIES
protected Set serviceListeners
protected Set bundleListeners
| Constructor Detail |
|---|
public MockBundleContext()
MockBundleContext instance. The associated
bundle will be created automatically.
public MockBundleContext(org.osgi.framework.Bundle bundle)
MockBundleContext instance.
bundle - associated bundle
public MockBundleContext(org.osgi.framework.Bundle bundle,
Properties props)
MockBundleContext instance allowing both
the bundle and the context properties to be specified.
bundle - associated bundleprops - context properties| Method Detail |
|---|
public void addBundleListener(org.osgi.framework.BundleListener listener)
addBundleListener in interface org.osgi.framework.BundleContextpublic void addFrameworkListener(org.osgi.framework.FrameworkListener listener)
addFrameworkListener in interface org.osgi.framework.BundleContextpublic void addServiceListener(org.osgi.framework.ServiceListener listener)
addServiceListener in interface org.osgi.framework.BundleContext
public void addServiceListener(org.osgi.framework.ServiceListener listener,
String filter)
throws org.osgi.framework.InvalidSyntaxException
addServiceListener in interface org.osgi.framework.BundleContextorg.osgi.framework.InvalidSyntaxException
public org.osgi.framework.Filter createFilter(String filter)
throws org.osgi.framework.InvalidSyntaxException
createFilter in interface org.osgi.framework.BundleContextorg.osgi.framework.InvalidSyntaxException
public org.osgi.framework.ServiceReference[] getAllServiceReferences(String clazz,
String filter)
throws org.osgi.framework.InvalidSyntaxException
getAllServiceReferences in interface org.osgi.framework.BundleContextorg.osgi.framework.InvalidSyntaxExceptionpublic org.osgi.framework.Bundle getBundle()
getBundle in interface org.osgi.framework.BundleContextpublic org.osgi.framework.Bundle getBundle(long id)
getBundle in interface org.osgi.framework.BundleContextpublic org.osgi.framework.Bundle[] getBundles()
getBundles in interface org.osgi.framework.BundleContextpublic File getDataFile(String filename)
getDataFile in interface org.osgi.framework.BundleContextpublic String getProperty(String key)
getProperty in interface org.osgi.framework.BundleContextpublic Object getService(org.osgi.framework.ServiceReference reference)
getService in interface org.osgi.framework.BundleContextpublic org.osgi.framework.ServiceReference getServiceReference(String clazz)
getServiceReference in interface org.osgi.framework.BundleContext
public org.osgi.framework.ServiceReference[] getServiceReferences(String clazz,
String filter)
throws org.osgi.framework.InvalidSyntaxException
getServiceReferences in interface org.osgi.framework.BundleContextorg.osgi.framework.InvalidSyntaxException
public org.osgi.framework.Bundle installBundle(String location)
throws org.osgi.framework.BundleException
installBundle in interface org.osgi.framework.BundleContextorg.osgi.framework.BundleException
public org.osgi.framework.Bundle installBundle(String location,
InputStream input)
throws org.osgi.framework.BundleException
installBundle in interface org.osgi.framework.BundleContextorg.osgi.framework.BundleException
public org.osgi.framework.ServiceRegistration registerService(String[] clazzes,
Object service,
Dictionary properties)
registerService in interface org.osgi.framework.BundleContext
public org.osgi.framework.ServiceRegistration registerService(String clazz,
Object service,
Dictionary properties)
registerService in interface org.osgi.framework.BundleContextpublic void removeBundleListener(org.osgi.framework.BundleListener listener)
removeBundleListener in interface org.osgi.framework.BundleContextpublic void removeFrameworkListener(org.osgi.framework.FrameworkListener listener)
removeFrameworkListener in interface org.osgi.framework.BundleContextpublic void removeServiceListener(org.osgi.framework.ServiceListener listener)
removeServiceListener in interface org.osgi.framework.BundleContextpublic boolean ungetService(org.osgi.framework.ServiceReference reference)
ungetService in interface org.osgi.framework.BundleContextpublic void setBundle(org.osgi.framework.Bundle bundle)
bundle - associated bundlepublic Set getServiceListeners()
public Set getBundleListeners()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||