1 /* 2 * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved. 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.framework.wiring; 18 19 import java.util.List; 20 import org.osgi.annotation.versioning.ProviderType; 21 import org.osgi.framework.Bundle; 22 import org.osgi.framework.BundleReference; 23 24 /** 25 * The {@link BundleRevision bundle revisions} of a bundle. When a bundle is 26 * installed and each time a bundle is updated, a new bundle revision of the 27 * bundle is created. For a bundle that has not been uninstalled, the most 28 * recent bundle revision is defined to be the current bundle revision. A bundle 29 * in the UNINSTALLED state does not have a current revision. An in use bundle 30 * revision is associated with an {@link BundleWiring#isInUse() in use} 31 * {@link BundleWiring}. The current bundle revision, if there is one, and all 32 * in use bundle revisions are returned. 33 * 34 * <p> 35 * The bundle revisions for a bundle can be obtained by calling 36 * {@link Bundle#adapt(Class) bundle.adapt}({@link BundleRevisions}.class). 37 * {@link #getRevisions()} on the bundle. 38 * 39 * @ThreadSafe 40 * @author $Id: 83e7bf03af2150a54af13a319325856e532cefde $ 41 */ 42 @ProviderType 43 public interface BundleRevisions extends BundleReference { 44 /** 45 * Return the bundle revisions for the {@link BundleReference#getBundle() 46 * referenced} bundle. 47 * 48 * <p> 49 * The result is a list containing the current bundle revision, if there is 50 * one, and all in use bundle revisions. The list may also contain 51 * intermediate bundle revisions which are not in use. 52 * 53 * <p> 54 * The list is ordered in reverse chronological order such that the first 55 * item is the most recent bundle revision and last item is the oldest 56 * bundle revision. 57 * 58 * <p> 59 * Generally the list will have at least one bundle revision for the bundle: 60 * the current bundle revision. However, for an uninstalled bundle with no 61 * in use bundle revisions, the list may be empty. 62 * 63 * @return A list containing a snapshot of the {@link BundleRevision}s for 64 * the referenced bundle. 65 */ getRevisions()66 List<BundleRevision> getRevisions(); 67 } 68