Interface ServiceManager

All Known Implementing Classes:
ServiceManagerImpl

public interface ServiceManager
  • Method Details

    • getBundleContext

      org.osgi.framework.BundleContext getBundleContext()
    • createManagedService

      org.osgi.service.cm.Configuration createManagedService(String factoryPid, Map<String,Object> properties) throws IOException
      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 startManagedService(String, Map) instead.

      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

      void startManagedService(String servicePid, Map<String,Object> properties) throws IOException
      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 start
      properties - service configuration properties
      Throws:
      IOException - thrown if if access to persistent storage fails
    • stopManagedService

      void stopManagedService(String servicePid) throws IOException
      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

      void startFeature(boolean wait, String... featureNames) throws Exception
      Installs and starts one or more features.
      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

      void stopFeature(boolean wait, String... featureNames) throws Exception
      Stops and uninstalls one or more features.
      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

      void restartBundles(String... bundleSymbolicNames) throws org.osgi.framework.BundleException
      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

      void stopBundle(String bundleSymbolicName) throws org.osgi.framework.BundleException
      Throws:
      org.osgi.framework.BundleException
    • startBundle

      void startBundle(String bundleSymbolicName) throws org.osgi.framework.BundleException
      Throws:
      org.osgi.framework.BundleException
    • installBundle

      void installBundle(String locationIdentifier) throws org.osgi.framework.BundleException
      Throws:
      org.osgi.framework.BundleException
    • uninstallBundle

      void uninstallBundle(String bundleSymbolicName) throws org.osgi.framework.BundleException
      Throws:
      org.osgi.framework.BundleException
    • waitForAllBundles

      void waitForAllBundles() throws InterruptedException
      Throws:
      InterruptedException
    • waitForRequiredBundles

      void waitForRequiredBundles(String symbolicNamePrefix) throws InterruptedException
      Throws:
      InterruptedException
    • waitForBundleUninstall

      void waitForBundleUninstall(String... bundleSymbolicNames)
      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

      void waitForHttpEndpoint(String path) throws InterruptedException
      Throws:
      InterruptedException
    • waitForSourcesToBeAvailable

      void waitForSourcesToBeAvailable(String restPath, String... sources) throws InterruptedException
      Throws:
      InterruptedException
    • getMetatypeDefaults

      Map<String,Object> getMetatypeDefaults(String symbolicName, String factoryPid)
    • printInactiveBundles

      void printInactiveBundles()
    • printInactiveBundlesInfo

      void printInactiveBundlesInfo()
    • getServiceReference

      <S> org.osgi.framework.ServiceReference<S> getServiceReference(Class<S> aClass)
    • 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

      <S> S getService(Class<S> aClass)