Package org.osgi.util.tracker

Examples of org.osgi.util.tracker.ServiceTracker.open()


        flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
      }
      Filter osgiFilter = FrameworkUtil.createFilter(flt);
      tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter,
          null);
      tracker.open();
     
      // add tracker to the list of trackers we close at tear down
      srs.add(tracker);
      Object x = tracker.waitForService(timeout);
      Object svc = type.cast(x);
View Full Code Here


    private ServiceTracker initServiceTracker(BundleContext context,
        Class<?> type, ServiceTrackerCustomizer custom)
    {
      ServiceTracker t = new ServiceTracker(context, type.getName(), custom);
      t.open();
      return t;
    }

    public void stop(BundleContext context) {
        /*
 
View Full Code Here

        flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
      }
      Filter osgiFilter = FrameworkUtil.createFilter(flt);
      tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter,
          null);
      tracker.open();
      // Note that the tracker is not closed to keep the reference
      // This is buggy, has the service reference may change i think
      Object svc = type.cast(tracker.waitForService(timeout));
      if (svc == null) {
        throw new RuntimeException("Gave up waiting for service " + flt);
View Full Code Here

        flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
      }
      Filter osgiFilter = FrameworkUtil.createFilter(flt);
      tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter,
          null);
      tracker.open();
      // Note that the tracker is not closed to keep the reference
      // This is buggy, has the service reference may change i think
      Object svc = type.cast(tracker.waitForService(timeout));
      if (svc == null) {
        throw new RuntimeException("Gave up waiting for service " + flt);
View Full Code Here

    if (result == null) {
      Semaphore s = new Semaphore(0);
      AtomicReference<ServiceReference> bpcRef = new AtomicReference<ServiceReference>();
      ServiceTracker st = new ServiceTracker (b.getBundleContext(), BlueprintContainer.class.getName(),
          new BlueprintContainerServiceTrackerCustomizer (b, s, bpcRef));
      st.open();
     
      // Make another check for the BlueprintContainer service in case it came up just before our tracker engaged
      int graceperiod = getGracePeriod(b);
      result = findBPCRef(b);
      if (result == null && graceperiod >= 0) {
View Full Code Here

            continue;
          }
          // check that the startlevel allows the bundle to be active (111550)
          if (tracker == null) {
            tracker = new ServiceTracker(context, StartLevel.class.getName(), null);
            tracker.open();
          }
          StartLevel sl = (StartLevel) tracker.getService();
          if (sl != null && (sl.getBundleStartLevel(bundles[i]) <= sl.getStartLevel())) {
            log.log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_ACTIVE, bundles[i]), 0, null, null));
          }
View Full Code Here

  }

  private static void updateSplash(Semaphore semaphore, StartupEventListener listener) {
    ServiceTracker monitorTracker = new ServiceTracker(context, StartupMonitor.class.getName(), null);
    monitorTracker.open();
    try {
      while (true) {
        StartupMonitor monitor = (StartupMonitor) monitorTracker.getService();
        if (monitor != null) {
          try {
View Full Code Here

                Object service = super.addingService(sref);
                latch.countDown();
                return service;
            }
        };
        tracker.open();
        try {
            if (!latch.await(timeout, unit))
                throw new IllegalStateException("Giving up waiting for bootstrap service: " + serviceName);
        } catch (InterruptedException e) {
            // ignore
View Full Code Here

            } else {
                flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
            }
            Filter osgiFilter = FrameworkUtil.createFilter(flt);
            tracker = new ServiceTracker(bundleContext, osgiFilter, null);
            tracker.open(true);
            // Note that the tracker is not closed to keep the reference
            // This is buggy, as the service reference may change i think
            Object svc = type.cast(tracker.waitForService(timeout));
            if (svc == null) {
                Dictionary dic = bundleContext.getBundle().getHeaders();
View Full Code Here

    private CredentialStore lookupStore(String type) {
      ServiceTracker credentialStoreTracker = null;
        try {
            credentialStoreTracker = new ServiceTracker(bundleContext, bundleContext.createFilter(String.format(CREDENTIAL_STORE_FILTER, type)), null);
            credentialStoreTracker.open();
            return (CredentialStore) credentialStoreTracker.waitForService(10000);
        } catch (InvalidSyntaxException e) {
            LOGGER.error("Error looking up credential store.", e);
        } catch (InterruptedException e) {
            LOGGER.error("Timed out waiting for store.", e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.