Package org.codice.ddf.itests.common
Interface ServiceManager
- All Known Implementing Classes:
ServiceManagerImpl
public interface ServiceManager
-
Method Summary
Modifier and TypeMethodDescriptionorg.osgi.service.cm.ConfigurationcreateManagedService(String factoryPid, Map<String, Object> properties) Creates a Managed Service that is created from a Managed Service Factory.org.osgi.framework.BundleContextgetMetatypeDefaults(String symbolicName, String factoryPid) <S> SgetService(Class<S> aClass) <S> SgetService(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) voidinstallBundle(String locationIdentifier) voidvoidvoidrestartBundles(String... bundleSymbolicNames) Restarts one or more bundles.voidstartBundle(String bundleSymbolicName) voidstartFeature(boolean wait, String... featureNames) Installs and starts one or more features.voidstartManagedService(String servicePid, Map<String, Object> properties) Starts a Managed Service.voidstopBundle(String bundleSymbolicName) voidstopFeature(boolean wait, String... featureNames) Stops and uninstalls one or more features.voidstopManagedService(String servicePid) Stops a managed service.voiduninstallBundle(String bundleSymbolicName) voidvoidwaitForBundleUninstall(String... bundleSymbolicNames) Waits for one or more bundle to be uninstalled.voidwaitForFeature(String featureName, Predicate<org.apache.karaf.features.FeatureState> predicate) voidwaitForHttpEndpoint(String path) voidwaitForRequiredBundles(String symbolicNamePrefix) voidwaitForSourcesToBeAvailable(String restPath, String... sources)
-
Method Details
-
getBundleContext
org.osgi.framework.BundleContext getBundleContext() -
createManagedService
org.osgi.service.cm.Configuration createManagedService(String factoryPid, Map<String, Object> properties) throws IOExceptionCreates a Managed Service that is created from a Managed Service Factory. Waits for the asynchronous call that the properties have been updated and the service can be used.For Managed Services not created from a Managed Service Factory, use
startManagedService(String, Map)instead.- Parameters:
factoryPid- the factory pid of the Managed Service Factoryproperties- the service properties for the Managed Service- Throws:
IOException- if access to persistent storage fails
-
startManagedService
Starts a Managed Service. Waits for the asynchronous call that the properties have been updated and the service can be used.For Managed Services created from a Managed Service Factory, use
createManagedService(String, Map)instead.- Parameters:
servicePid- persistent identifier of the Managed Service to startproperties- service configuration properties- Throws:
IOException- thrown if if access to persistent storage fails
-
stopManagedService
Stops a managed service.- Parameters:
servicePid- persistent identifier of the Managed Service to stop- Throws:
IOException- thrown if if access to persistent storage fails
-
startFeature
Installs and starts one or more features.- Parameters:
wait- iftrue, this method will wait until the state of all the features isStartedand all bundles areActivebefore returningfeatureNames- names of the features to install and start- Throws:
Exception- thrown if one of the features fails to be installed or started
-
stopFeature
Stops and uninstalls one or more features.- Parameters:
wait- iftrue, this method will wait until the state of all the features isUninstalledand all bundles areActivebefore returningfeatureNames- names of the features to install and start- Throws:
Exception- thrown if one of the features fails to be installed or started
-
restartBundles
Restarts one or more bundles. The bundles will be stopped in the order provided and started in the reverse order.- Parameters:
bundleSymbolicNames- list of bundle symbolic names to restart- Throws:
org.osgi.framework.BundleException- if one of the bundles fails to stop or start
-
stopBundle
- Throws:
org.osgi.framework.BundleException
-
startBundle
- Throws:
org.osgi.framework.BundleException
-
installBundle
- Throws:
org.osgi.framework.BundleException
-
uninstallBundle
- Throws:
org.osgi.framework.BundleException
-
waitForAllBundles
- Throws:
InterruptedException
-
waitForRequiredBundles
- Throws:
InterruptedException
-
waitForBundleUninstall
Waits for one or more bundle to be uninstalled.- Parameters:
bundleSymbolicNames- symbolic names of the bundles to wait for
-
waitForFeature
void waitForFeature(String featureName, Predicate<org.apache.karaf.features.FeatureState> predicate) throws Exception - Throws:
Exception
-
waitForHttpEndpoint
- Throws:
InterruptedException
-
waitForSourcesToBeAvailable
- Throws:
InterruptedException
-
getMetatypeDefaults
-
printInactiveBundles
void printInactiveBundles() -
printInactiveBundlesInfo
void printInactiveBundlesInfo() -
getServiceReference
-
getServiceReferences
<S> Collection<org.osgi.framework.ServiceReference<S>> getServiceReferences(Class<S> aClass, String s) throws org.osgi.framework.InvalidSyntaxException - Throws:
org.osgi.framework.InvalidSyntaxException
-
getService
<S> S getService(org.osgi.framework.ServiceReference<S> serviceReference) -
getService
-