void openServices() { BundleContext context = JobActivator.getContext(); if (context == null) { if (JobManager.DEBUG) JobMessages.message("JobsOSGiUtils called before plugin started"); //$NON-NLS-1$ return; } debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null); debugTracker.open(); bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null); bundleTracker.open(); }
void openServices() { BundleContext context = JobActivator.getContext(); if (context == null) { if (JobManager.DEBUG) JobMessages.message("JobsOSGiUtils called before plugin started"); //$NON-NLS-1$ return; } debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null); debugTracker.open(); bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null); bundleTracker.open(); }
public boolean getBooleanDebugOption(String option, boolean defaultValue) { if (debugTracker == null) { if (JobManager.DEBUG) JobMessages.message("Debug tracker is not set"); //$NON-NLS-1$ return defaultValue; } DebugOptions options = (DebugOptions) debugTracker.getService(); if (options != null) { String value = options.getOption(option); if (value != null) return value.equalsIgnoreCase("true"); //$NON-NLS-1$ } return defaultValue; }
public boolean getBooleanDebugOption(String option, boolean defaultValue) { if (debugTracker == null) { if (JobManager.DEBUG) JobMessages.message("Debug tracker is not set"); //$NON-NLS-1$ return defaultValue; } DebugOptions options = (DebugOptions) debugTracker.getService(); if (options != null) { String value = options.getOption(option); if (value != null) return value.equalsIgnoreCase("true"); //$NON-NLS-1$ } return defaultValue; }
/** * Returns the bundle id of the bundle that contains the provided object, or * <code>null</code> if the bundle could not be determined. */ public String getBundleId(Object object) { if (bundleTracker == null) { if (JobManager.DEBUG) JobMessages.message("Bundle tracker is not set"); //$NON-NLS-1$ return null; } PackageAdmin packageAdmin = (PackageAdmin) bundleTracker.getService(); if (object == null) return null; if (packageAdmin == null) return null; Bundle source = packageAdmin.getBundle(object.getClass()); if (source != null && source.getSymbolicName() != null) return source.getSymbolicName(); return null; }
/** * Returns the bundle id of the bundle that contains the provided object, or * <code>null</code> if the bundle could not be determined. */ public String getBundleId(Object object) { if (bundleTracker == null) { if (JobManager.DEBUG) JobMessages.message("Bundle tracker is not set"); //$NON-NLS-1$ return null; } PackageAdmin packageAdmin = (PackageAdmin) bundleTracker.getService(); if (object == null) return null; if (packageAdmin == null) return null; Bundle source = packageAdmin.getBundle(object.getClass()); if (source != null && source.getSymbolicName() != null) return source.getSymbolicName(); return null; }
@SuppressWarnings("unchecked") void openServices() { BundleContext context = JobActivator.getContext(); if (context == null) { if (JobManager.DEBUG) JobMessages.message("JobsOSGiUtils called before plugin started"); //$NON-NLS-1$ return; } // register debug options listener Hashtable<String, String> properties = new Hashtable<String, String>(2); properties.put(DebugOptions.LISTENER_SYMBOLICNAME, JobManager.PI_JOBS); debugRegistration = context.registerService(DebugOptionsListener.class, JobManager.getInstance(), properties); bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null); bundleTracker.open(); }
@SuppressWarnings("unchecked") void openServices() { BundleContext context = JobActivator.getContext(); if (context == null) { if (JobManager.DEBUG) JobMessages.message("JobsOSGiUtils called before plugin started"); //$NON-NLS-1$ return; } // register debug options listener Hashtable<String, String> properties = new Hashtable<>(2); properties.put(DebugOptions.LISTENER_SYMBOLICNAME, JobManager.PI_JOBS); debugRegistration = context.registerService(DebugOptionsListener.class, JobManager.getInstance(), properties); bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null); bundleTracker.open(); }
/** * Returns the bundle id of the bundle that contains the provided object, or * <code>null</code> if the bundle could not be determined. */ public String getBundleId(Object object) { if (bundleTracker == null) { if (JobManager.DEBUG) JobMessages.message("Bundle tracker is not set"); //$NON-NLS-1$ return null; } PackageAdmin packageAdmin = (PackageAdmin) bundleTracker.getService(); if (object == null) return null; if (packageAdmin == null) return null; Bundle source = packageAdmin.getBundle(object.getClass()); if (source != null && source.getSymbolicName() != null) return source.getSymbolicName(); return null; }
/** * Returns the bundle id of the bundle that contains the provided object, or * <code>null</code> if the bundle could not be determined. */ public String getBundleId(Object object) { if (bundleTracker == null) { if (JobManager.DEBUG) JobMessages.message("Bundle tracker is not set"); //$NON-NLS-1$ return null; } PackageAdmin packageAdmin = (PackageAdmin) bundleTracker.getService(); if (object == null) return null; if (packageAdmin == null) return null; Bundle source = packageAdmin.getBundle(object.getClass()); if (source != null && source.getSymbolicName() != null) return source.getSymbolicName(); return null; }