blob: 2434dcec569adf755e5742124f7d265ae5bae27c [file] [log] [blame]
Richard S. Hall2532cf82010-03-24 09:51:11 +00001/*
Carsten Ziegeler3314f912014-07-30 07:22:32 +00002 * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
Richard S. Hall2532cf82010-03-24 09:51:11 +00003 *
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
17package org.osgi.service.packageadmin;
18
19import org.osgi.framework.Bundle;
20import 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. Halld0dca9b2011-05-18 14:52:16 +000028 * 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. Hall2532cf82010-03-24 09:51:11 +000032 *
33 * <p>
34 * The information about a required bundle provided by this object may change. A
Richard S. Halld0dca9b2011-05-18 14:52:16 +000035 * {@code RequiredBundle} object becomes stale if an exported package of
Richard S. Hall2532cf82010-03-24 09:51:11 +000036 * the bundle it references has been updated or removed as a result of calling
Richard S. Halld0dca9b2011-05-18 14:52:16 +000037 * {@code PackageAdmin.refreshPackages()}).
Richard S. Hall2532cf82010-03-24 09:51:11 +000038 *
Richard S. Halld0dca9b2011-05-18 14:52:16 +000039 * 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. Hall2532cf82010-03-24 09:51:11 +000043 *
44 * @since 1.2
45 * @ThreadSafe
Richard S. Halld0dca9b2011-05-18 14:52:16 +000046 * @noimplement
47 * @deprecated The PackageAdmin service has been replaced by the
48 * <code>org.osgi.framework.wiring</code> package.
Carsten Ziegeler3314f912014-07-30 07:22:32 +000049 * @author $Id: 08ab9c1a6f4a9af2060293d2c2972e4e07e2a238 $
Richard S. Hall2532cf82010-03-24 09:51:11 +000050 */
51public 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. Halld0dca9b2011-05-18 14:52:16 +000062 * @return The bundle, or {@code null} if this
63 * {@code RequiredBundle} object has become stale.
Richard S. Hall2532cf82010-03-24 09:51:11 +000064 */
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. Halld0dca9b2011-05-18 14:52:16 +000076 * {@code null} if this {@code RequiredBundle} object
Richard S. Hall2532cf82010-03-24 09:51:11 +000077 * 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. Halld0dca9b2011-05-18 14:52:16 +000092 * Returns {@code true} if the bundle associated with this
93 * {@code RequiredBundle} object has been updated or uninstalled.
Richard S. Hall2532cf82010-03-24 09:51:11 +000094 *
Richard S. Halld0dca9b2011-05-18 14:52:16 +000095 * @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. Hall2532cf82010-03-24 09:51:11 +000098 */
99 public boolean isRemovalPending();
100}