Package org.codice.ddf.itests.common
Class ServiceManagerImpl
java.lang.Object
org.codice.ddf.itests.common.ServiceManagerImpl
- All Implemented Interfaces:
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
public org.osgi.framework.BundleContext getBundleContext()- Specified by:
getBundleContextin interfaceServiceManager
-
createManagedService
public org.osgi.service.cm.Configuration createManagedService(String factoryPid, Map<String, Object> properties) throws IOExceptionDescription copied from interface:ServiceManagerCreates 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
ServiceManager.startManagedService(String, Map)instead.- Specified by:
createManagedServicein interfaceServiceManager- 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
public void startManagedService(String servicePid, Map<String, Object> properties) throws IOExceptionDescription copied from interface:ServiceManagerStarts 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
ServiceManager.createManagedService(String, Map)instead.- Specified by:
startManagedServicein interfaceServiceManager- Parameters:
servicePid- persistent identifier of the Managed Service to startproperties- service configuration properties- Throws:
IOException- thrown if if access to persistent storage fails
-
stopManagedService
Description copied from interface:ServiceManagerStops a managed service.- Specified by:
stopManagedServicein interfaceServiceManager- Parameters:
servicePid- persistent identifier of the Managed Service to stop- Throws:
IOException- thrown if if access to persistent storage fails
-
startFeature
Description copied from interface:ServiceManagerInstalls and starts one or more features.- Specified by:
startFeaturein interfaceServiceManager- 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
Description copied from interface:ServiceManagerStops and uninstalls one or more features.- Specified by:
stopFeaturein interfaceServiceManager- 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
Description copied from interface:ServiceManagerRestarts one or more bundles. The bundles will be stopped in the order provided and started in the reverse order.- Specified by:
restartBundlesin interfaceServiceManager- 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
- Specified by:
stopBundlein interfaceServiceManager- Throws:
org.osgi.framework.BundleException
-
startBundle
- Specified by:
startBundlein interfaceServiceManager- Throws:
org.osgi.framework.BundleException
-
installBundle
- Specified by:
installBundlein interfaceServiceManager- Throws:
org.osgi.framework.BundleException
-
uninstallBundle
- Specified by:
uninstallBundlein interfaceServiceManager- Throws:
org.osgi.framework.BundleException
-
waitForAllBundles
public void waitForAllBundles()- Specified by:
waitForAllBundlesin interfaceServiceManager
-
waitForRequiredBundles
- Specified by:
waitForRequiredBundlesin interfaceServiceManager
-
waitForBundleUninstall
Description copied from interface:ServiceManagerWaits for one or more bundle to be uninstalled.- Specified by:
waitForBundleUninstallin interfaceServiceManager- Parameters:
bundleSymbolicNames- symbolic names of the bundles to wait for
-
waitForFeature
public void waitForFeature(String featureName, Predicate<org.apache.karaf.features.FeatureState> predicate) - Specified by:
waitForFeaturein interfaceServiceManager
-
waitForHttpEndpoint
- Specified by:
waitForHttpEndpointin interfaceServiceManager
-
waitForSourcesToBeAvailable
- Specified by:
waitForSourcesToBeAvailablein interfaceServiceManager
-
getMetatypeDefaults
- Specified by:
getMetatypeDefaultsin interfaceServiceManager
-
printInactiveBundles
public void printInactiveBundles()- Specified by:
printInactiveBundlesin interfaceServiceManager
-
printInactiveBundlesInfo
public void printInactiveBundlesInfo()- Specified by:
printInactiveBundlesInfoin interfaceServiceManager
-
getServiceReference
- Specified by:
getServiceReferencein interfaceServiceManager
-
getServiceReferences
public <S> Collection<org.osgi.framework.ServiceReference<S>> getServiceReferences(Class<S> aClass, String s) throws org.osgi.framework.InvalidSyntaxException - Specified by:
getServiceReferencesin interfaceServiceManager- Throws:
org.osgi.framework.InvalidSyntaxException
-
getService
public <S> S getService(org.osgi.framework.ServiceReference<S> serviceReference) - Specified by:
getServicein interfaceServiceManager
-
getService
- Specified by:
getServicein interfaceServiceManager
-