|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.osgi.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 bundlepublic MockBundleContext(Bundle bundle, Properties props)
MockBundleContext
instance allowing both
the bundle and the context properties to be specified.
bundle
- associated bundleprops
- context propertiesMethod Detail |
---|
public void addBundleListener(BundleListener listener)
addBundleListener
in interface BundleContext
public void addFrameworkListener(FrameworkListener listener)
addFrameworkListener
in interface BundleContext
public void addServiceListener(ServiceListener listener)
addServiceListener
in interface BundleContext
public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException
addServiceListener
in interface BundleContext
InvalidSyntaxException
public Filter createFilter(String filter) throws InvalidSyntaxException
createFilter
in interface BundleContext
InvalidSyntaxException
public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
getAllServiceReferences
in interface BundleContext
InvalidSyntaxException
public Bundle getBundle()
getBundle
in interface BundleContext
public Bundle getBundle(long id)
getBundle
in interface BundleContext
public Bundle[] getBundles()
getBundles
in interface BundleContext
public File getDataFile(String filename)
getDataFile
in interface BundleContext
public String getProperty(String key)
getProperty
in interface BundleContext
public Object getService(ServiceReference reference)
getService
in interface BundleContext
public ServiceReference getServiceReference(String clazz)
getServiceReference
in interface BundleContext
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException
getServiceReferences
in interface BundleContext
InvalidSyntaxException
public Bundle installBundle(String location) throws BundleException
installBundle
in interface BundleContext
BundleException
public Bundle installBundle(String location, InputStream input) throws BundleException
installBundle
in interface BundleContext
BundleException
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 BundleContext
public void removeBundleListener(BundleListener listener)
removeBundleListener
in interface BundleContext
public void removeFrameworkListener(FrameworkListener listener)
removeFrameworkListener
in interface BundleContext
public void removeServiceListener(ServiceListener listener)
removeServiceListener
in interface BundleContext
public boolean ungetService(ServiceReference reference)
ungetService
in interface BundleContext
public 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 |