|
||||||||||
| 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(Bundle bundle)
Constructs a new MockBundleContext instance. |
|
MockBundleContext(Bundle bundle,
Properties props)
Constructs a new MockBundleContext instance allowing both
the bundle and the context properties to be specified. |
|
| 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(Bundle bundle)
MockBundleContext instance.
bundle - associated bundle
public MockBundleContext(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(BundleListener listener)
addBundleListener in interface BundleContextpublic void addFrameworkListener(FrameworkListener listener)
addFrameworkListener in interface BundleContextpublic void addServiceListener(ServiceListener listener)
addServiceListener in interface BundleContext
public void addServiceListener(ServiceListener listener,
String filter)
throws InvalidSyntaxException
addServiceListener in interface BundleContextInvalidSyntaxException
public Filter createFilter(String filter)
throws InvalidSyntaxException
createFilter in interface BundleContextInvalidSyntaxException
public ServiceReference[] getAllServiceReferences(String clazz,
String filter)
throws InvalidSyntaxException
getAllServiceReferences in interface BundleContextInvalidSyntaxExceptionpublic Bundle getBundle()
getBundle in interface BundleContextpublic Bundle getBundle(long id)
getBundle in interface BundleContextpublic Bundle[] getBundles()
getBundles in interface BundleContextpublic File getDataFile(String filename)
getDataFile in interface BundleContextpublic String getProperty(String key)
getProperty in interface BundleContextpublic Object getService(ServiceReference reference)
getService in interface BundleContextpublic ServiceReference getServiceReference(String clazz)
getServiceReference in interface BundleContext
public ServiceReference[] getServiceReferences(String clazz,
String filter)
throws InvalidSyntaxException
getServiceReferences in interface BundleContextInvalidSyntaxException
public Bundle installBundle(String location)
throws BundleException
installBundle in interface BundleContextBundleException
public Bundle installBundle(String location,
InputStream input)
throws BundleException
installBundle in interface BundleContextBundleException
public ServiceRegistration registerService(String[] clazzes,
Object service,
Dictionary properties)
registerService in interface BundleContext
public ServiceRegistration registerService(String clazz,
Object service,
Dictionary properties)
registerService in interface BundleContextpublic void removeBundleListener(BundleListener listener)
removeBundleListener in interface BundleContextpublic void removeFrameworkListener(FrameworkListener listener)
removeFrameworkListener in interface BundleContextpublic void removeServiceListener(ServiceListener listener)
removeServiceListener in interface BundleContextpublic boolean ungetService(ServiceReference reference)
ungetService in interface BundleContextpublic void setBundle(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 | |||||||||