Class ServiceManagerImpl

java.lang.Object
org.codice.ddf.itests.common.ServiceManagerImpl
All Implemented Interfaces:
ServiceManager

public class ServiceManagerImpl extends Object implements ServiceManager
  • Method Details

    • getBundleContext

      public org.osgi.framework.BundleContext getBundleContext()
      Specified by:
      getBundleContext in interface ServiceManager
    • createManagedService

      public org.osgi.service.cm.Configuration createManagedService(String factoryPid, Map<String,Object> properties) throws IOException
      Description copied from interface: ServiceManager
      Creates 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:
      createManagedService in interface ServiceManager
      Parameters:
      factoryPid - the factory pid of the Managed Service Factory
      properties - 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 IOException
      Description copied from interface: ServiceManager
      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 ServiceManager.createManagedService(String, Map) instead.

      Specified by:
      startManagedService in interface ServiceManager
      Parameters:
      servicePid - persistent identifier of the Managed Service to start
      properties - service configuration properties
      Throws:
      IOException - thrown if if access to persistent storage fails
    • stopManagedService

      public void stopManagedService(String servicePid) throws IOException
      Description copied from interface: ServiceManager
      Stops a managed service.
      Specified by:
      stopManagedService in interface ServiceManager
      Parameters:
      servicePid - persistent identifier of the Managed Service to stop
      Throws:
      IOException - thrown if if access to persistent storage fails
    • startFeature

      public void startFeature(boolean wait, String... featureNames) throws Exception
      Description copied from interface: ServiceManager
      Installs and starts one or more features.
      Specified by:
      startFeature in interface ServiceManager
      Parameters:
      wait - if true, this method will wait until the state of all the features is Started and all bundles are Active before returning
      featureNames - names of the features to install and start
      Throws:
      Exception - thrown if one of the features fails to be installed or started
    • stopFeature

      public void stopFeature(boolean wait, String... featureNames) throws Exception
      Description copied from interface: ServiceManager
      Stops and uninstalls one or more features.
      Specified by:
      stopFeature in interface ServiceManager
      Parameters:
      wait - if true, this method will wait until the state of all the features is Uninstalled and all bundles are Active before returning
      featureNames - names of the features to install and start
      Throws:
      Exception - thrown if one of the features fails to be installed or started
    • restartBundles

      public void restartBundles(String... bundleSymbolicNames) throws org.osgi.framework.BundleException
      Description copied from interface: ServiceManager
      Restarts one or more bundles. The bundles will be stopped in the order provided and started in the reverse order.
      Specified by:
      restartBundles in interface ServiceManager
      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

      public void stopBundle(String bundleSymbolicName) throws org.osgi.framework.BundleException
      Specified by:
      stopBundle in interface ServiceManager
      Throws:
      org.osgi.framework.BundleException
    • startBundle

      public void startBundle(String bundleSymbolicName) throws org.osgi.framework.BundleException
      Specified by:
      startBundle in interface ServiceManager
      Throws:
      org.osgi.framework.BundleException
    • installBundle

      public void installBundle(String locationIdentifier) throws org.osgi.framework.BundleException
      Specified by:
      installBundle in interface ServiceManager
      Throws:
      org.osgi.framework.BundleException
    • uninstallBundle

      public void uninstallBundle(String bundleSymbolicName) throws org.osgi.framework.BundleException
      Specified by:
      uninstallBundle in interface ServiceManager
      Throws:
      org.osgi.framework.BundleException
    • waitForAllBundles

      public void waitForAllBundles()
      Specified by:
      waitForAllBundles in interface ServiceManager
    • waitForRequiredBundles

      public void waitForRequiredBundles(String symbolicNamePrefix)
      Specified by:
      waitForRequiredBundles in interface ServiceManager
    • waitForBundleUninstall

      public void waitForBundleUninstall(String... bundleSymbolicNames)
      Description copied from interface: ServiceManager
      Waits for one or more bundle to be uninstalled.
      Specified by:
      waitForBundleUninstall in interface ServiceManager
      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:
      waitForFeature in interface ServiceManager
    • waitForHttpEndpoint

      public void waitForHttpEndpoint(String path)
      Specified by:
      waitForHttpEndpoint in interface ServiceManager
    • waitForSourcesToBeAvailable

      public void waitForSourcesToBeAvailable(String restPath, String... sources)
      Specified by:
      waitForSourcesToBeAvailable in interface ServiceManager
    • getMetatypeDefaults

      public Map<String,Object> getMetatypeDefaults(String symbolicName, String factoryPid)
      Specified by:
      getMetatypeDefaults in interface ServiceManager
    • printInactiveBundles

      public void printInactiveBundles()
      Specified by:
      printInactiveBundles in interface ServiceManager
    • printInactiveBundlesInfo

      public void printInactiveBundlesInfo()
      Specified by:
      printInactiveBundlesInfo in interface ServiceManager
    • getServiceReference

      public <S> org.osgi.framework.ServiceReference<S> getServiceReference(Class<S> aClass)
      Specified by:
      getServiceReference in interface ServiceManager
    • getServiceReferences

      public <S> Collection<org.osgi.framework.ServiceReference<S>> getServiceReferences(Class<S> aClass, String s) throws org.osgi.framework.InvalidSyntaxException
      Specified by:
      getServiceReferences in interface ServiceManager
      Throws:
      org.osgi.framework.InvalidSyntaxException
    • getService

      public <S> S getService(org.osgi.framework.ServiceReference<S> serviceReference)
      Specified by:
      getService in interface ServiceManager
    • getService

      public <S> S getService(Class<S> aClass)
      Specified by:
      getService in interface ServiceManager