Top Description Fields Methods
org.osgi.framework.hooks.bundle

public Interface CollisionHook

Annotations
@ConsumerType
Imports
java.util.Collection, org.osgi.annotation.versioning.ConsumerType, org.osgi.framework.Bundle, .BundleContext, .Constants

OSGi Framework Bundle Collision Hook Service.

If the framework was launched with the org.osgi.framework.bsnversion framework launching property set to managed, then all registered collision hook services will be called during framework bundle install and update operations to determine if an install or update operation will result in a bundle symbolic name and version collision.

Author
$Id: b05e0c3819aff6df35c2ec034242596d04f53408 $

Field Summary

Modifier and TypeField and Description
public static final int
INSTALLING

Specifies a bundle install operation is being performed.

public static final int
UPDATING

Specifies a bundle update operation is being performed.

Method Summary

Modifier and TypeMethod and Description
public void
filterCollisions(int
The operation type. Must be the value of installing or updating.
operationType
,
Bundle
The target bundle used to determine what collision candidates to filter.
target
,
Collection<Bundle>
The collection of collision candidates. The collection supports all the optional Collection operations except add and addAll. Attempting to add to the collection will result in an UnsupportedOperationException . The collection is not synchronized.
collisionCandidates
)

Filter bundle collisions hook method.

Field Detail

INSTALLINGback to summary
public static final int INSTALLING

Specifies a bundle install operation is being performed.

UPDATINGback to summary
public static final int UPDATING

Specifies a bundle update operation is being performed.

Method Detail

filterCollisionsback to summary
public void filterCollisions(int operationType, Bundle target, Collection<Bundle> collisionCandidates)

Filter bundle collisions hook method. This method is called during the install or update operation. The operation type will be installing or updating. Depending on the operation type the target bundle and the collision candidate collection are the following:

  • installing - The target is the bundle associated with the BundleContext used to call one of the install methods. The collision candidate collection contains the existing bundles installed which have the same symbolic name and version as the bundle being installed.
  • updating - The target is the bundle used to call one of the update methods. The collision candidate collection contains the existing bundles installed which have the same symbolic name and version as the content the target bundle is being updated to.
This method can filter the collection of collision candidates by removing potential collisions. For the specified operation to succeed, the collection of collision candidates must be empty after all registered collision hook services have been called.
Parameters
operationType:int

The operation type. Must be the value of installing or updating.

target:Bundle

The target bundle used to determine what collision candidates to filter.

collisionCandidates:Collection<Bundle>

The collection of collision candidates. The collection supports all the optional Collection operations except add and addAll. Attempting to add to the collection will result in an UnsupportedOperationException . The collection is not synchronized.