Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-08-08 19:59:53 +0000
committerThomas Watson2011-08-08 19:59:53 +0000
commitfe711b408d3523f680c4e356221369581057e6ce (patch)
tree124f2ba6848b21717ee17e593201d53d7712d8fc /bundles/org.eclipse.osgi/osgi
parenta2cf4324f88e434de94e8904835dfb53fff6916b (diff)
downloadrt.equinox.framework-fe711b408d3523f680c4e356221369581057e6ce.tar.gz
rt.equinox.framework-fe711b408d3523f680c4e356221369581057e6ce.tar.xz
rt.equinox.framework-fe711b408d3523f680c4e356221369581057e6ce.zip
Bug 348967 - Handle new option "managed"v20110808-1537
for org.osgi.framework.bsnversion configuration property
Diffstat (limited to 'bundles/org.eclipse.osgi/osgi')
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java76
1 files changed, 76 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java
new file mode 100644
index 000000000..94dabb724
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.framework.hooks.bundle;
+
+import java.util.Collection;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * OSGi Framework Bundle Collision Hook Service.
+ *
+ * <p>
+ * Bundles registering this service 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.
+ *
+ * @ThreadSafe
+ * @version $Id: 64a98074fa8331b0cd21989f9c8583b99b2370cf $
+ */
+public interface CollisionHook {
+
+ /**
+ * Specifies a bundle install operation is being performed.
+ */
+ public static final int INSTALLING = 0x01;
+ /**
+ * Specifies a bundle update operation is being performed.
+ */
+ public static final int UPDATING = 0x02;
+
+ /**
+ * Filter bundle collisions hook method. This method is called during the
+ * install or update operation. The operation type will be
+ * {@link #INSTALLING installing} or
+ * {@link #UPDATING updating}. Depending on the operation
+ * type the target bundle and the collision candidate collection are the following:
+ * <ul>
+ * <li> {@link #INSTALLING installing} - The target is the bundle associated with the
+ * {@link BundleContext} used to call one of the
+ * {@link BundleContext#installBundle(String) install}
+ * methods. The collision candidate collection contains the existing bundles
+ * installed which have the same symbolic name and version as the bundle being installed.
+ * <li> {@link #UPDATING updating} - The target is the bundle used to call one of the
+ * {@link Bundle#update() 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.
+ * </ul>
+ * This method can filter the list of collision candidates by removing
+ * potential collisions. Removing a collision candidate will allow the
+ * specified operation to succeed as if the collision candidate is not installed.
+ *
+ * @param operationType the operation type. Must be the value of
+ * {@link #INSTALLING installing} or {@link #UPDATING updating}.
+ * @param target the target bundle used to determine what collision candidates to filter.
+ * @param collisionCandidates a collection of collision candidates.
+ * The collection supports all the optional {@code Collection}
+ * operations except {@code add} and {@code addAll}. Attempting
+ * to add to the collection will result in an
+ * {@code UnsupportedOperationException}. The collection is not
+ * synchronized.
+ */
+ void filterCollisions(int operationType, Bundle target, Collection<Bundle> collisionCandidates);
+}

Back to the top