Class BundleCollisionHook

java.lang.Object
com.yahoo.jdisc.core.BundleCollisionHook
All Implemented Interfaces:
org.osgi.framework.hooks.bundle.CollisionHook, org.osgi.framework.hooks.bundle.EventHook, org.osgi.framework.hooks.bundle.FindHook

public class BundleCollisionHook extends Object implements org.osgi.framework.hooks.bundle.CollisionHook, org.osgi.framework.hooks.bundle.EventHook, org.osgi.framework.hooks.bundle.FindHook
A bundle CollisionHook that contains a set of bundles that are allowed to collide with bundles that are about to be installed. This class also implements a FindHook to provide a consistent view of bundles such that the two sets of duplicate bundles are invisible to each other. In order to clean up when bundles are uninstalled, this is also a bundle EventHook. Thread safe
Author:
gjoranv
  • Field Summary

    Fields inherited from interface org.osgi.framework.hooks.bundle.CollisionHook

    INSTALLING, UPDATING
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    event(org.osgi.framework.BundleEvent event, Collection<org.osgi.framework.BundleContext> contexts)
    Cleans up the allowed duplicates when a bundle is uninstalled.
    void
    filterCollisions(int operationType, org.osgi.framework.Bundle target, Collection<org.osgi.framework.Bundle> collisionCandidates)
    Removes duplicates of the allowed duplicate bundles from the given collision candidates.
    void
    find(org.osgi.framework.BundleContext context, Collection<org.osgi.framework.Bundle> bundles)
    Filters out the set of bundles that should not be visible to the bundle associated with the given context.
    void
    start(org.osgi.framework.BundleContext context)
     
    void
     

    Methods inherited from class java.lang.Object

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

    • BundleCollisionHook

      public BundleCollisionHook()
  • Method Details

    • start

      public void start(org.osgi.framework.BundleContext context)
    • stop

      public void stop()
    • event

      public void event(org.osgi.framework.BundleEvent event, Collection<org.osgi.framework.BundleContext> contexts)
      Cleans up the allowed duplicates when a bundle is uninstalled.
      Specified by:
      event in interface org.osgi.framework.hooks.bundle.EventHook
    • filterCollisions

      public void filterCollisions(int operationType, org.osgi.framework.Bundle target, Collection<org.osgi.framework.Bundle> collisionCandidates)
      Removes duplicates of the allowed duplicate bundles from the given collision candidates.
      Specified by:
      filterCollisions in interface org.osgi.framework.hooks.bundle.CollisionHook
    • find

      public void find(org.osgi.framework.BundleContext context, Collection<org.osgi.framework.Bundle> bundles)
      Filters out the set of bundles that should not be visible to the bundle associated with the given context. If the given context represents one of the allowed duplicates, this method filters out all bundles that are duplicates of the allowed duplicates. Otherwise this method filters out the allowed duplicates, so they are not visible to other bundles.
      Specified by:
      find in interface org.osgi.framework.hooks.bundle.FindHook