private BundleTracker bt = null;
335967
@Override
    public void start(BundleContext context) {

        initialContextFactories = initServiceTracker(context, InitialContextFactory.class, ServiceTrackerCustomizers.ICF_CACHE);
        objectFactories = initServiceTracker(context, ObjectFactory.class, ServiceTrackerCustomizers.URL_FACTORY_CACHE);
        icfBuilders = initServiceTracker(context, InitialContextFactoryBuilder.class, ServiceTrackerCustomizers.LAZY);
        urlObjectFactoryFinders = initServiceTracker(context, URLObjectFactoryFinder.class, ServiceTrackerCustomizers.LAZY);
        environmentAugmentors = initServiceTracker(context, EnvironmentAugmentation.class, null);
        environmentUnaugmentors = initServiceTracker(context, EnvironmentUnaugmentation.class, null);

        try {
            OSGiInitialContextFactoryBuilder builder = new OSGiInitialContextFactoryBuilder();
            setField(InitialContextFactoryBuilder.class, builder, true);
            icfBuilder = builder;
        } catch (IllegalStateException e) {
            // Log the problem at info level, but only log the exception at debug level, as in many cases this is not a real issue and people
            // don't want to see stack traces at info level when everything it working as expected.
            LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.ICFB.already.exists", getClassName(InitialContextFactoryBuilder.class)));
            LOGGER.debug(Utils.MESSAGES.getMessage("unable.to.set.static.ICFB.already.exists", getClassName(InitialContextFactoryBuilder.class)), e);
        }

        try {
            OSGiObjectFactoryBuilder builder = new OSGiObjectFactoryBuilder(context);
            setField(ObjectFactoryBuilder.class, builder, true);
            ofBuilder = builder;
        } catch (IllegalStateException e) {
            // Log the problem at info level, but only log the exception at debug level, as in many cases this is not a real issue and people
            // don't want to see stack traces at info level when everything it working as expected.
            LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.OFB.already.exists", getClassName(ObjectFactoryBuilder.class)));
            LOGGER.debug(Utils.MESSAGES.getMessage("unable.to.set.static.OFB.already.exists", getClassName(ObjectFactoryBuilder.class)), e);
        }

        context.registerService(JNDIProviderAdmin.class.getName(),
                                new ProviderAdminServiceFactory(context),
                                null);

        context.registerService(InitialContextFactoryBuilder.class.getName(),
                                new JREInitialContextFactoryBuilder(),
                                null);

        context.registerService(JNDIContextManager.class.getName(),
                                new ContextManagerServiceFactory(),
                                null);

        context.registerService(AugmenterInvoker.class.getName(),
                                AugmenterInvokerImpl.getInstance(),
                                null);

        //Start the bundletracker that clears out the cache. (only interested in stopping events)
        // bt = new BundleTracker(context, Bundle.STOPPING, new ServiceTrackerCustomizers.CacheBundleTrackerCustomizer());
        // bt.open();
    }
835890
public boolean call(Context context, String dataName, Bundle data) {
        boolean useLocalBroadcast = BeaconManager.getInstanceForApplication(context).isMainProcess();
        boolean success = false;

        if(useLocalBroadcast) {
            String action = null;
            if (dataName == "rangingData") {
                action = BeaconLocalBroadcastProcessor.RANGE_NOTIFICATION;
            }
            else {
                action = BeaconLocalBroadcastProcessor.MONITOR_NOTIFICATION;
            }
            Intent intent = new Intent(action);
            intent.putExtra(dataName, data);
            LogManager.d(TAG, "attempting callback via local broadcast intent: %s",action);
            success = LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
        }
        else {
            Intent intent = new Intent();
            intent.setComponent(new ComponentName(context.getPackageName(), "org.altbeacon.beacon.BeaconIntentProcessor"));
            intent.putExtra(dataName, data);
            LogManager.d(TAG, "attempting callback via global broadcast intent: %s",intent.getComponent());
            try {
                context.startService(intent);
                success = true;
            } catch (Exception e) {
                LogManager.e(
                        TAG,
                        "Failed attempting to start service: " + intent.getComponent().flattenToString(),
                        e
                );
            }
        }
        return success;
    }
178925
protected void getServices(BundleContext bundleCtx) {
        context = bundleCtx;

        // OSGi 4.3 uses the bundle.adapt() mechanism as a way to get to
        // behavior that is fundamentally a part of the framework
        frameworkStartLevel = bundleCtx.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkStartLevel.class);
        frameworkStartLevel.setInitialBundleStartLevel(KernelStartLevel.ACTIVE.getLevel());

        serviceTracker = new ServiceTracker<LibertyBootRuntime, LibertyBootRuntime>(context, LibertyBootRuntime.class, null);
        serviceTracker.open();
    }
347281
private void trackHttpContexts(final BundleContext bundleContext, ExtendedHttpServiceRuntime httpServiceRuntime) {
		final ServiceTracker<HttpContext, HttpContextElement> httpContextTracker = HttpContextTracker
				.createTracker(extenderContext, bundleContext, httpServiceRuntime);

		httpContextTracker.open();
		trackers.add(0, httpContextTracker);

		final ServiceTracker<HttpContextMapping, HttpContextElement> httpContextMappingTracker = HttpContextMappingTracker
				.createTracker(extenderContext, bundleContext, httpServiceRuntime);

		httpContextMappingTracker.open();
		trackers.add(0, httpContextMappingTracker);
	}
1121690
@Override
    public void stop(BundleContext bc) throws Exception {
        RuntimeDelegate.setInstance(null);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "stop", bc);
        }
    }
921018
function( bundleJSON, bundlePath, tempName ) {

		// Update path in config
		if (!config['path'])
			config['path'] = path.dirname(bundlePath);

		// Create the JBB bundle
		JBBCompiler.compile(
				bundleJSON,
				tempName,
				config,
				function() {

					// Check for sparse bundles
					if (config['sparse']) {
						resultCallback( null, {
							'basename': tempName,
							'suffix': [
								'.jbbp', '_b16.jbbp', 
							  	'_b32.jbbp', '_b64.jbbp' 
							]
						}); 
					} else {
						// Trigger callback
						resultCallback( null, {
							'basename': tempName,
							'suffix': [ '.jbb' ]
						});
					}

				}
			);

	}
683542
public String getTrack(int type)
	{
		if (allow(type&ID3V1))
		{
			return Integer.toString(id3v1.getTrack());
		}
		if (allow(type&ID3V2))
		{
			return id3v2.getFrameDataString(ID3v2Frames.TRACK_NUMBER);
		}
		return null;
	}
789965
public SoundCloudTrack getCurrentTrack() {
        if (mCurrentTrackIndex > -1 && mCurrentTrackIndex < mSoundCloudPlaylist.getTracks().size()) {
            return mSoundCloudPlaylist.getTracks().get(mCurrentTrackIndex);
        }
        return null;
    }
277292
public void setTracking (boolean track)
    {
        if (track != _tracking) {
            _tracking = track;
            if (track) {
                _seenKeys = new HashSet<K>();
                _misses = _hits = 0;

                // oh boy, but to properly track we need to clear the hash
                clear();
            } else {
                _seenKeys = null;
            }
        }
    }
869295
private TrackType findTrackType() {
        TrackType result = TRACK_TYPE_MAP.get(packetBytes[42]);
        if (result == null) {
            return TrackType.UNKNOWN;
        }
        return result;
    }
564758
public void waitForBundlesActivation(CloseableHttpClient httpClient) {
    if (StringUtils.isBlank(props.getBundleStatusUrl())) {
      log.debug("Skipping check for bundle activation state because no bundleStatusURL is defined.");
      return;
    }

    final int WAIT_INTERVAL_SEC = 3;
    final long CHECK_RETRY_COUNT = props.getBundleStatusWaitLimitSec() / WAIT_INTERVAL_SEC;

    log.info("Check bundle activation status...");
    for (int i = 1; i <= CHECK_RETRY_COUNT; i++) {
      BundleStatusCall call = new BundleStatusCall(httpClient, props.getBundleStatusUrl(), log);
      BundleStatus bundleStatus = executeHttpCallWithRetry(call, 0);

      boolean instanceReady = true;

      // check if bundles are still stopping/staring
      if (!bundleStatus.isAllBundlesRunning()) {
        log.info("Bundles starting/stopping: " + bundleStatus.getStatusLineCompact()
            + " - wait " + WAIT_INTERVAL_SEC + " sec "
            + "(max. " + props.getBundleStatusWaitLimitSec() + " sec) ...");
        sleep(WAIT_INTERVAL_SEC);
        instanceReady = false;
      }

      // check if any of the blacklisted bundles is still present
      if (instanceReady) {
        for (Pattern blacklistBundleNamePattern : props.getBundleStatusBlacklistBundleNames()) {
          String bundleSymbolicName = bundleStatus.getMatchingBundle(blacklistBundleNamePattern);
          if (bundleSymbolicName != null) {
            log.info("Bundle '" + bundleSymbolicName + "' is still deployed "
                + " - wait " + WAIT_INTERVAL_SEC + " sec "
                + "(max. " + props.getBundleStatusWaitLimitSec() + " sec) ...");
            sleep(WAIT_INTERVAL_SEC);
            instanceReady = false;
            break;
          }
        }
      }

      // instance is ready
      if (instanceReady) {
        break;
      }
    }
  }
616205
public void init() throws Exception {
		filter = bundleContext.createFilter(getFilter(dsName));
		
		tracker = new ServiceTracker<DataSource, DataSource>(bundleContext, filter, null);
		tracker.open();
		
		proxy = (DataSource) Proxy.newProxyInstance(
				DataSourceProxyFactory.class.getClassLoader(),
				new Class<?>[] { DataSource.class }, this);
	}
760477
@RequiresPermission(Manifest.permission.BLUETOOTH)
	static void checkAdapterStateOn(@Nullable final BluetoothAdapter adapter) {
		if (adapter == null || adapter.getState() != BluetoothAdapter.STATE_ON) {
			throw new IllegalStateException("BT Adapter is not turned ON");
		}
	}
1363332
public static boolean checkReceiver(Context context, Class<?> receiver) {
    try {
      ActivityInfo info = context.getPackageManager().getReceiverInfo(
          new ComponentName(context, receiver), 0);
      return null != info;
    } catch (PackageManager.NameNotFoundException e) {
      printErrorLog("receiver " + receiver.getName() + " is missing!");
      return false;
    }
  }
903667
public void start(BundleContext bc) throws Exception {
		bundleContext = bc;
		tracker = new ServiceTracker<>(bc,
				HttpService.class, this);
		tracker.open();
	}
715888
@FFDCIgnore({ IllegalStateException.class, Exception.class })
    public BundleLifecycleStatus uninstallBundles(final BundleContext bundleContext,
                                                  final BundleList removeBundles,
                                                  final BundleInstallStatus installStatus,
                                                  ShutdownHookManager shutdownHook) {

        final List<Bundle> bundlesToUninstall = new ArrayList<Bundle>();
        removeBundles.foreach(new FeatureResourceHandler() {

            @Override
            @FFDCIgnore({ Exception.class })
            public boolean handle(FeatureResource fr) {
                try {
                    Bundle b = removeBundles.getBundle(bundleContext, fr);

                    // We found the bundle we want to uninstall
                    if (b != null && b.getBundleId() > 0) {
                        bundlesToUninstall.add(b);
                    }
                } catch (Exception e) {
                    installStatus.addInstallException("UNINSTALL " + fr.getLocation(), e);
                }
                return true;
            }
        });

        // sort the bundle in reverse start-level order so that
        // start-phase is consistently honored
        Collections.sort(bundlesToUninstall, Collections.reverseOrder(BundleInstallStatus.sortByStartLevel));
        for (Bundle bundleToUninstall : bundlesToUninstall) {
            try {
                bundleToUninstall.uninstall();
            } catch (IllegalStateException e) {
                // ok: bundle already uninstalled or the framework is stopping,
                // determine if we should continue on to the next:
                // (if the bundle was uninstalled, but the framework is in perfect health),
                // or not (if the framework is stopping and we should just get done early).
                if (!!!FrameworkState.isValid()) {
                    break;
                }
            } catch (Exception e) {
                installStatus.addInstallException("UNINSTALL " + bundleToUninstall.getLocation(), e);
            }
        }

        // Refresh bundles: provide a listener for notification of when refresh is complete
        RefreshBundlesListener listener = new RefreshBundlesListener(shutdownHook);
        FrameworkWiring wiring = adaptSystemBundle(bundleContext, FrameworkWiring.class);
        if (wiring != null) {
            wiring.refreshBundles(null, listener);

            // wait for refresh operation to complete
            listener.waitForComplete();
        }
        return listener.getStatus();
    }
548707
@Override
    public void start(BundleContext bc) throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "start", bc);
        }
    }