Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 1 | /* |
Carsten Ziegeler | 3314f91 | 2014-07-30 07:22:32 +0000 | [diff] [blame^] | 2 | * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved. |
Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.osgi.service.packageadmin; |
| 18 | |
| 19 | import org.osgi.framework.Bundle; |
| 20 | import org.osgi.framework.Version; |
| 21 | |
| 22 | /** |
| 23 | * A required bundle. |
| 24 | * |
| 25 | * Objects implementing this interface are created by the Package Admin service. |
| 26 | * |
| 27 | * <p> |
Richard S. Hall | d0dca9b | 2011-05-18 14:52:16 +0000 | [diff] [blame] | 28 | * The term <i>required bundle</i> refers to a resolved bundle that has a bundle |
| 29 | * symbolic name and is not a fragment. That is, a bundle that may be required |
| 30 | * by other bundles. This bundle may or may not be currently required by other |
| 31 | * bundles. |
Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 32 | * |
| 33 | * <p> |
| 34 | * The information about a required bundle provided by this object may change. A |
Richard S. Hall | d0dca9b | 2011-05-18 14:52:16 +0000 | [diff] [blame] | 35 | * {@code RequiredBundle} object becomes stale if an exported package of |
Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 36 | * the bundle it references has been updated or removed as a result of calling |
Richard S. Hall | d0dca9b | 2011-05-18 14:52:16 +0000 | [diff] [blame] | 37 | * {@code PackageAdmin.refreshPackages()}). |
Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 38 | * |
Richard S. Hall | d0dca9b | 2011-05-18 14:52:16 +0000 | [diff] [blame] | 39 | * If this object becomes stale, its {@code getSymbolicName()} and |
| 40 | * {@code getVersion()} methods continue to return their original values, |
| 41 | * {@code isRemovalPending()} returns true, and {@code getBundle()} |
| 42 | * and {@code getRequiringBundles()} return {@code null}. |
Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 43 | * |
| 44 | * @since 1.2 |
| 45 | * @ThreadSafe |
Richard S. Hall | d0dca9b | 2011-05-18 14:52:16 +0000 | [diff] [blame] | 46 | * @noimplement |
| 47 | * @deprecated The PackageAdmin service has been replaced by the |
| 48 | * <code>org.osgi.framework.wiring</code> package. |
Carsten Ziegeler | 3314f91 | 2014-07-30 07:22:32 +0000 | [diff] [blame^] | 49 | * @author $Id: 08ab9c1a6f4a9af2060293d2c2972e4e07e2a238 $ |
Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 50 | */ |
| 51 | public interface RequiredBundle { |
| 52 | /** |
| 53 | * Returns the symbolic name of this required bundle. |
| 54 | * |
| 55 | * @return The symbolic name of this required bundle. |
| 56 | */ |
| 57 | public String getSymbolicName(); |
| 58 | |
| 59 | /** |
| 60 | * Returns the bundle associated with this required bundle. |
| 61 | * |
Richard S. Hall | d0dca9b | 2011-05-18 14:52:16 +0000 | [diff] [blame] | 62 | * @return The bundle, or {@code null} if this |
| 63 | * {@code RequiredBundle} object has become stale. |
Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 64 | */ |
| 65 | public Bundle getBundle(); |
| 66 | |
| 67 | /** |
| 68 | * Returns the bundles that currently require this required bundle. |
| 69 | * |
| 70 | * <p> |
| 71 | * If this required bundle is required and then re-exported by another |
| 72 | * bundle then all the requiring bundles of the re-exporting bundle are |
| 73 | * included in the returned array. |
| 74 | * |
| 75 | * @return An array of bundles currently requiring this required bundle, or |
Richard S. Hall | d0dca9b | 2011-05-18 14:52:16 +0000 | [diff] [blame] | 76 | * {@code null} if this {@code RequiredBundle} object |
Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 77 | * has become stale. The array will be empty if no bundles require |
| 78 | * this required package. |
| 79 | */ |
| 80 | public Bundle[] getRequiringBundles(); |
| 81 | |
| 82 | /** |
| 83 | * Returns the version of this required bundle. |
| 84 | * |
| 85 | * @return The version of this required bundle, or |
| 86 | * {@link Version#emptyVersion} if no version information is |
| 87 | * available. |
| 88 | */ |
| 89 | public Version getVersion(); |
| 90 | |
| 91 | /** |
Richard S. Hall | d0dca9b | 2011-05-18 14:52:16 +0000 | [diff] [blame] | 92 | * Returns {@code true} if the bundle associated with this |
| 93 | * {@code RequiredBundle} object has been updated or uninstalled. |
Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 94 | * |
Richard S. Hall | d0dca9b | 2011-05-18 14:52:16 +0000 | [diff] [blame] | 95 | * @return {@code true} if the required bundle has been updated or |
| 96 | * uninstalled, or if the {@code RequiredBundle} object has |
| 97 | * become stale; {@code false} otherwise. |
Richard S. Hall | 2532cf8 | 2010-03-24 09:51:11 +0000 | [diff] [blame] | 98 | */ |
| 99 | public boolean isRemovalPending(); |
| 100 | } |