public interface ServiceManager
Modifier and Type | Method and Description |
---|---|
org.osgi.service.cm.Configuration |
createManagedService(String factoryPid,
Map<String,Object> properties)
Creates a Managed Service that is created from a Managed Service Factory.
|
org.osgi.framework.BundleContext |
getBundleContext() |
Map<String,Object> |
getMetatypeDefaults(String symbolicName,
String factoryPid) |
<S> S |
getService(Class<S> aClass) |
<S> S |
getService(org.osgi.framework.ServiceReference<S> serviceReference) |
<S> org.osgi.framework.ServiceReference<S> |
getServiceReference(Class<S> aClass) |
<S> Collection<org.osgi.framework.ServiceReference<S>> |
getServiceReferences(Class<S> aClass,
String s) |
void |
printInactiveBundles() |
void |
printInactiveBundlesInfo() |
void |
restartBundles(String... bundleSymbolicNames)
Restarts one or more bundles.
|
void |
startBundle(String bundleSymbolicName) |
void |
startFeature(boolean wait,
String... featureNames)
Installs and starts one or more features.
|
void |
startManagedService(String servicePid,
Map<String,Object> properties)
Starts a Managed Service.
|
void |
stopBundle(String bundleSymbolicName) |
void |
stopFeature(boolean wait,
String... featureNames)
Stops and uninstalls one or more features.
|
void |
stopManagedService(String servicePid)
Stops a managed service.
|
void |
waitForAllBundles() |
void |
waitForBundleUninstall(String... bundleSymbolicNames)
Waits for one or more bundle to be uninstalled.
|
void |
waitForFeature(String featureName,
Predicate<org.apache.karaf.features.FeatureState> predicate) |
void |
waitForHttpEndpoint(String path) |
void |
waitForRequiredApps(String... appNames) |
void |
waitForRequiredBundles(String symbolicNamePrefix) |
void |
waitForSourcesToBeAvailable(String restPath,
String... sources) |
org.osgi.framework.BundleContext getBundleContext()
org.osgi.service.cm.Configuration createManagedService(String factoryPid, Map<String,Object> properties) throws IOException
For Managed Services not created from a Managed Service Factory, use startManagedService(String, Map)
instead.
factoryPid
- the factory pid of the Managed Service Factoryproperties
- the service properties for the Managed ServiceIOException
- if access to persistent storage failsvoid startManagedService(String servicePid, Map<String,Object> properties) throws IOException
For Managed Services created from a Managed Service Factory, use createManagedService(String, Map)
instead.
servicePid
- persistent identifier of the Managed Service to startproperties
- service configuration propertiesIOException
- thrown if if access to persistent storage failsvoid stopManagedService(String servicePid) throws IOException
servicePid
- persistent identifier of the Managed Service to stopIOException
- thrown if if access to persistent storage failsvoid startFeature(boolean wait, String... featureNames) throws Exception
wait
- if true
, this method will wait until the state of all the features is
Started
and all bundles are Active
before returningfeatureNames
- names of the features to install and startException
- thrown if one of the features fails to be installed or startedvoid stopFeature(boolean wait, String... featureNames) throws Exception
wait
- if true
, this method will wait until the state of all the features is
Uninstalled
and all bundles are Active
before returningfeatureNames
- names of the features to install and startException
- thrown if one of the features fails to be installed or startedvoid restartBundles(String... bundleSymbolicNames) throws org.osgi.framework.BundleException
bundleSymbolicNames
- list of bundle symbolic names to restartorg.osgi.framework.BundleException
- if one of the bundles fails to stop or startvoid stopBundle(String bundleSymbolicName) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
void startBundle(String bundleSymbolicName) throws org.osgi.framework.BundleException
org.osgi.framework.BundleException
void waitForRequiredApps(String... appNames) throws InterruptedException
InterruptedException
void waitForAllBundles() throws InterruptedException
InterruptedException
void waitForRequiredBundles(String symbolicNamePrefix) throws InterruptedException
InterruptedException
void waitForBundleUninstall(String... bundleSymbolicNames)
bundleSymbolicNames
- symbolic names of the bundles to wait forvoid waitForFeature(String featureName, Predicate<org.apache.karaf.features.FeatureState> predicate) throws Exception
Exception
void waitForHttpEndpoint(String path) throws InterruptedException
InterruptedException
void waitForSourcesToBeAvailable(String restPath, String... sources) throws InterruptedException
InterruptedException
void printInactiveBundles()
void printInactiveBundlesInfo()
<S> org.osgi.framework.ServiceReference<S> getServiceReference(Class<S> aClass)
<S> Collection<org.osgi.framework.ServiceReference<S>> getServiceReferences(Class<S> aClass, String s) throws org.osgi.framework.InvalidSyntaxException
org.osgi.framework.InvalidSyntaxException
<S> S getService(org.osgi.framework.ServiceReference<S> serviceReference)
<S> S getService(Class<S> aClass)
This work is licensed under a Creative Commons Attribution 4.0 International License.