Class PluginBundleTracker

java.lang.Object
org.osgi.util.tracker.BundleTracker<PluginRuntime>
com.xebialabs.xlrelease.osgi.spring.PluginBundleTracker
All Implemented Interfaces:
org.osgi.util.tracker.BundleTrackerCustomizer<PluginRuntime>

public class PluginBundleTracker extends org.osgi.util.tracker.BundleTracker<PluginRuntime>
Discovers Spring plugin bundles via the PluginManifest contract, builds their child context via PluginContextFactory, and guarantees deterministic teardown on removedBundle - including plain bundle.stop() with no uninstall, the gap a ServiceTracker-only approach cannot close (see .opencode/tech/osgi.md:58-62: removedBundle fires synchronously, on the calling thread, with a fully usable bundle classloader, for uninstall, stop-alone, and framework shutdown alike).

Every removal path - normal teardown and the rollback of a failed install alike - funnels through the single PluginTeardown.teardown(com.xebialabs.xlrelease.osgi.spring.PluginRuntime) procedure, so there is exactly one place that knows how to tear a plugin down completely.

  • Field Summary

    Fields inherited from class org.osgi.util.tracker.BundleTracker

    context
  • Constructor Summary

    Constructors
    Constructor
    Description
    PluginBundleTracker(org.osgi.framework.BundleContext context, org.springframework.context.support.GenericApplicationContext parent)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    addingBundle(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event)
     
    void
     
    void
    modifiedBundle(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event, PluginRuntime runtime)
     
    void
    removedBundle(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event, PluginRuntime runtime)
     

    Methods inherited from class org.osgi.util.tracker.BundleTracker

    getBundles, getObject, getTracked, getTrackingCount, isEmpty, open, remove, size

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PluginBundleTracker

      public PluginBundleTracker(org.osgi.framework.BundleContext context, org.springframework.context.support.GenericApplicationContext parent)
  • Method Details

    • addingBundle

      public PluginRuntime addingBundle(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event)
      Specified by:
      addingBundle in interface org.osgi.util.tracker.BundleTrackerCustomizer<PluginRuntime>
      Overrides:
      addingBundle in class org.osgi.util.tracker.BundleTracker<PluginRuntime>
    • modifiedBundle

      public void modifiedBundle(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event, PluginRuntime runtime)
      Specified by:
      modifiedBundle in interface org.osgi.util.tracker.BundleTrackerCustomizer<PluginRuntime>
      Overrides:
      modifiedBundle in class org.osgi.util.tracker.BundleTracker<PluginRuntime>
    • removedBundle

      public void removedBundle(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event, PluginRuntime runtime)
      Specified by:
      removedBundle in interface org.osgi.util.tracker.BundleTrackerCustomizer<PluginRuntime>
      Overrides:
      removedBundle in class org.osgi.util.tracker.BundleTracker<PluginRuntime>
    • close

      public void close()
      Overrides:
      close in class org.osgi.util.tracker.BundleTracker<PluginRuntime>