public static ProxyManager getProxyManager() { return proxyManager == null ? null : proxyManager.getService(); } }
public void open() { if (open.compareAndSet(false, true)) { try { ctx.addServiceListener(listener, filterString); findMatchingReference(null); } catch (InvalidSyntaxException e) { // this can never happen. (famous last words :) } } }
@Override public void modifiedBundle(Bundle b, BundleEvent event, Object object) { if (b instanceof CompositeBundle) { customizedProcessBundle(this, b, event, false); } else { // Delegate to our customizer for normal bundles if (customizer != null) { customizer.modifiedBundle(b, event, object); } } }
public ScheduledExecutorServiceWrapper(BundleContext context, String name, ScheduledExecutorServiceFactory sesf) { _name = name; _factory = sesf; try { _tracked = new SingleServiceTracker<ScheduledExecutorService>(context, ScheduledExecutorService.class, "(aries.blueprint.poolName=" + _name + ")", this); _tracked.open(); } catch (InvalidSyntaxException e) { // Just ignore and stick with the default one. } if (_current.get() == null) { _default.set(_factory.create(name)); if (!!!_current.compareAndSet(null, _default.get())) { _default.getAndSet(null).shutdown(); } } }
try { tracker = new BundleHookBundleTracker(context, stateMask, customizer); } catch (Throwable e) { if (areMultipleFrameworksAvailable(context)) { compositeTracker = new InternalRecursiveBundleTracker(context, stateMask, customizer, tracker == null); } else { compositeTracker = null;
if (foundLostReplaced == 0) serviceListener.serviceFound(); else if (foundLostReplaced == 1) serviceListener.serviceLost(); else if (foundLostReplaced == 2) serviceListener.serviceReplaced();
private synchronized void openTracker(BundleTrackerCustomizer btc, CompositeBundle cb, String bundleScope, int stateMask) { // let's process each of the bundle in the CompositeBundle BundleContext compositeBundleContext = cb.getCompositeFramework().getBundleContext(); String bundleId = cb.getSymbolicName()+"/"+cb.getVersion(); if (alreadyRecursedContexts.putIfAbsent(bundleId, bundleId) == null) { // let's track each of the bundle in the CompositeBundle BundleTracker bt = new InternalRecursiveBundleTracker(compositeBundleContext, stateMask, customizer, true); bt.open(); BundleTrackerFactory.registerBundleTracker(bundleScope, bt); } } }
@Override public void stop(BundleContext context) { proxyManager.close(); AriesFrameworkUtil.safeUnregisterService(osgiUrlReg); AriesFrameworkUtil.safeUnregisterService(blueprintUrlReg); }
public void serviceLost() { while (!containers.isEmpty()) { for (Bundle bundle : getBundlesToDestroy()) { destroyContainer(bundle); } } if (bt instanceof BundleTracker) { ((BundleTracker) bt).close(); } else if (bt instanceof RecursiveBundleTracker) { ((RecursiveBundleTracker) bt).close(); } }
public void serviceFound() { LOGGER.debug("Found ProxyManager service, starting to process blueprint bundles"); if (bt instanceof BundleTracker) { ((BundleTracker) bt).open(); } else if (bt instanceof RecursiveBundleTracker) { ((RecursiveBundleTracker) bt).open(); } }
public ScheduledExecutorServiceWrapper(BundleContext context, String name, ScheduledExecutorServiceFactory sesf) { _name = name; _factory = sesf; try { _tracked = new SingleServiceTracker<ScheduledExecutorService>(context, ScheduledExecutorService.class, "(aries.blueprint.poolName=" + _name + ")", this); _tracked.open(); } catch (InvalidSyntaxException e) { // Just ignore and stick with the default one. } if (_current.get() == null) { _default.set(_factory.create(name)); if (!!!_current.compareAndSet(null, _default.get())) { _default.getAndSet(null).shutdown(); } } }
public void serviceReplaced() { _current.set(_tracked.getService()); }
@Override public void removedBundle(Bundle b, BundleEvent event, Object object) { if (b instanceof CompositeBundle) { customizedProcessBundle(this, b, event, true); } else { if (customizer != null) { customizer.removedBundle(b, event, object); } } }
public void serviceLost() { while (!containers.isEmpty()) { for (Bundle bundle : getBundlesToDestroy()) { destroyContainer(bundle); } } if (bt instanceof BundleTracker) { ((BundleTracker) bt).close(); } else if (bt instanceof RecursiveBundleTracker) { ((RecursiveBundleTracker) bt).close(); } }
public void serviceFound() { LOGGER.debug("Found ProxyManager service, starting to process blueprint bundles"); if (bt instanceof BundleTracker) { ((BundleTracker) bt).open(); } else if (bt instanceof RecursiveBundleTracker) { ((RecursiveBundleTracker) bt).open(); } }
public void serviceReplaced() { _current.set(_tracked.getService()); }
@Override public Object addingBundle(Bundle b, BundleEvent event) { Object o = null; if (b instanceof CompositeBundle) { customizedProcessBundle(this, b, event, false); o = b; } else if (nested) { // Delegate to our customizer for normal bundles if (customizer != null) { o = customizer.addingBundle(b, event); } } return o; }
public void serviceFound() { ScheduledExecutorService s = _default.get(); if (_current.compareAndSet(s, _tracked.getService())) { if (s != null) { if (_default.compareAndSet(s, null)) { s.shutdown(); } } } }
public void serviceFound() { ScheduledExecutorService s = _default.get(); if (_current.compareAndSet(s, _tracked.getService())) { if (s != null) { if (_default.compareAndSet(s, null)) { s.shutdown(); } } } }