code: @SuppressWarnings("unchecked")
      public static <T> T getService(Class<T> type) {
          Bundle serviceBundle = FrameworkUtil.getBundle(type);
          BundleContext serviceBundleContext = serviceBundle.getBundleContext();
          ServiceReference serviceReference = serviceBundleContext.getServiceReference(type.getName());
          return (T) serviceBundleContext.getService(serviceReference);
      }
docs: retrieve a service during setup