Class SisuTracker

  • All Implemented Interfaces:
    BundlePlan, org.osgi.util.tracker.BundleTrackerCustomizer<java.lang.Object>

    public class SisuTracker
    extends org.osgi.util.tracker.BundleTracker<java.lang.Object>
    implements BundlePlan
    OSGi BundleTracker that tracks component bundles and uses BundlePlans to publish them.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Map<java.lang.Long,​java.lang.Object> bundlePublishers  
      protected MutableBeanLocator locator
      Shared locator of bound components.
      private static java.lang.Object PLACEHOLDER  
      protected java.util.List<BundlePlan> plans
      Custom plans; contributed by attaching fragments to the extender bundle.
      protected int stateMask
      Mask of bundle states being tracked.
      private static java.util.Set<java.lang.String> SUPPORT_BUNDLE_NAMES  
      • Fields inherited from class org.osgi.util.tracker.BundleTracker

        context
    • Constructor Summary

      Constructors 
      Constructor Description
      SisuTracker​(org.osgi.framework.BundleContext context, int stateMask, MutableBeanLocator locator)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object addingBundle​(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event)  
      private void addPublisher​(java.lang.Long bundleId, BindingPublisher publisher)  
      protected java.util.List<BundlePlan> discoverPlans()
      Discovers plans listed locally under META-INF/services/org.eclipse.sisu.launch.BundlePlan ; implementations must have a public no-arg constructor or one that accepts a MutableBeanLocator.
      protected boolean evictBundle​(org.osgi.framework.Bundle bundle)
      Determines whether we should remove the BindingPublisher associated with the given bundle.
      void open()  
      BindingPublisher prepare​(org.osgi.framework.Bundle bundle)
      Prepares a BindingPublisher of components for the given bundle.
      void purgeBundles()
      Purges any bundles that are no longer valid.
      void removedBundle​(org.osgi.framework.Bundle bundle, org.osgi.framework.BundleEvent event, java.lang.Object object)  
      private void removePublisher​(java.lang.Long bundleId)  
      • Methods inherited from class org.osgi.util.tracker.BundleTracker

        close, getBundles, getObject, getTracked, getTrackingCount, isEmpty, modifiedBundle, remove, size
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PLACEHOLDER

        private static final java.lang.Object PLACEHOLDER
      • SUPPORT_BUNDLE_NAMES

        private static final java.util.Set<java.lang.String> SUPPORT_BUNDLE_NAMES
      • bundlePublishers

        private static final java.util.Map<java.lang.Long,​java.lang.Object> bundlePublishers
      • stateMask

        protected final int stateMask
        Mask of bundle states being tracked.
      • plans

        protected final java.util.List<BundlePlan> plans
        Custom plans; contributed by attaching fragments to the extender bundle.
    • Constructor Detail

      • SisuTracker

        public SisuTracker​(org.osgi.framework.BundleContext context,
                           int stateMask,
                           MutableBeanLocator locator)
    • Method Detail

      • open

        public final void open()
        Overrides:
        open in class org.osgi.util.tracker.BundleTracker<java.lang.Object>
      • addingBundle

        public final java.lang.Object addingBundle​(org.osgi.framework.Bundle bundle,
                                                   org.osgi.framework.BundleEvent event)
        Specified by:
        addingBundle in interface org.osgi.util.tracker.BundleTrackerCustomizer<java.lang.Object>
        Overrides:
        addingBundle in class org.osgi.util.tracker.BundleTracker<java.lang.Object>
      • removedBundle

        public final void removedBundle​(org.osgi.framework.Bundle bundle,
                                        org.osgi.framework.BundleEvent event,
                                        java.lang.Object object)
        Specified by:
        removedBundle in interface org.osgi.util.tracker.BundleTrackerCustomizer<java.lang.Object>
        Overrides:
        removedBundle in class org.osgi.util.tracker.BundleTracker<java.lang.Object>
      • purgeBundles

        public final void purgeBundles()
        Purges any bundles that are no longer valid.
      • prepare

        public BindingPublisher prepare​(org.osgi.framework.Bundle bundle)
        Description copied from interface: BundlePlan
        Prepares a BindingPublisher of components for the given bundle.
        Specified by:
        prepare in interface BundlePlan
        Parameters:
        bundle - The bundle
        Returns:
        Publisher of bindings; null if the plan doesn't apply
      • discoverPlans

        protected java.util.List<BundlePlan> discoverPlans()
        Discovers plans listed locally under META-INF/services/org.eclipse.sisu.launch.BundlePlan ; implementations must have a public no-arg constructor or one that accepts a MutableBeanLocator.
        Returns:
        List of plans
      • evictBundle

        protected boolean evictBundle​(org.osgi.framework.Bundle bundle)
        Determines whether we should remove the BindingPublisher associated with the given bundle.
        Parameters:
        bundle - The bundle
        Returns:
        true if the publisher should be removed; otherwise false
      • addPublisher

        private void addPublisher​(java.lang.Long bundleId,
                                  BindingPublisher publisher)
      • removePublisher

        private void removePublisher​(java.lang.Long bundleId)