Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 334582 | Differences between
and this patch

Collapse All | Expand All

(-)core/framework/org/eclipse/osgi/framework/internal/core/BundleFragment.java (-5 / +5 lines)
Lines 22-28 Link Here
22
import org.eclipse.osgi.util.NLS;
22
import org.eclipse.osgi.util.NLS;
23
import org.osgi.framework.*;
23
import org.osgi.framework.*;
24
import org.osgi.framework.wiring.BundleWiring;
24
import org.osgi.framework.wiring.BundleWiring;
25
import org.osgi.framework.wiring.BundleWirings;
25
import org.osgi.framework.wiring.FragmentWirings;
26
26
27
public class BundleFragment extends AbstractBundle {
27
public class BundleFragment extends AbstractBundle {
28
28
Lines 338-351 Link Here
338
338
339
	@SuppressWarnings("unchecked")
339
	@SuppressWarnings("unchecked")
340
	public <A> A adapt(Class<A> adapterType) {
340
	public <A> A adapt(Class<A> adapterType) {
341
		if (BundleWirings.class.equals(adapterType)) {
341
		if (FragmentWirings.class.equals(adapterType)) {
342
			return (A) new BundleWirings() {
342
			return (A) new FragmentWirings() {
343
				public Bundle getBundle() {
343
				public Bundle getBundle() {
344
					return BundleFragment.this;
344
					return BundleFragment.this;
345
				}
345
				}
346
346
347
				public List<BundleWiring> getWirings() {
347
				public Collection<BundleWiring> getWirings() {
348
					List<BundleWiring> wirings = new ArrayList<BundleWiring>();
348
					Collection<BundleWiring> wirings = new ArrayList<BundleWiring>();
349
					BundleDescription current = getBundleDescription();
349
					BundleDescription current = getBundleDescription();
350
					BundleDescription[] removed = framework.adaptor.getState().getRemovalPending();
350
					BundleDescription[] removed = framework.adaptor.getState().getRemovalPending();
351
351
(-)osgi/src/org/osgi/framework/wiring/BundleWirings.java (-13 / +9 lines)
Lines 1-5 Link Here
1
/*
1
/*
2
 * Copyright (c) OSGi Alliance (2010). All Rights Reserved.
2
 * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
3
 * 
3
 * 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
5
 * you may not use this file except in compliance with the License.
Lines 29-36 Link Here
29
 * 
29
 * 
30
 * <p>
30
 * <p>
31
 * The in use bundle wirings for a bundle can be obtained by calling
31
 * The in use bundle wirings for a bundle can be obtained by calling
32
 * {@link Bundle#adapt(Class) bundle.adapt}({@link BundleWirings}.class).
32
 * {@link Bundle#adapt(Class) bundle.adapt}({@link BundleWirings}.class) on the
33
 * {@link BundleWirings#getWirings() getWirings()}.
33
 * bundle. {@link BundleWirings#getWirings() getWirings()}. A fragment does not
34
 * itself have bundle wirings. So calling {@link Bundle#adapt(Class)
35
 * bundle.adapt}({@link BundleWirings}.class) on a fragment must return
36
 * {@code null}. See {@link FragmentWirings} for the bundle wirings in which a
37
 * fragment participates.
34
 * 
38
 * 
35
 * @ThreadSafe
39
 * @ThreadSafe
36
 * @noimplement
40
 * @noimplement
Lines 42-61 Link Here
42
	 * {@link BundleReference#getBundle() referenced} bundle.
46
	 * {@link BundleReference#getBundle() referenced} bundle.
43
	 * 
47
	 * 
44
	 * <p>
48
	 * <p>
45
	 * If the referenced bundle is a non-fragment bundle, then the result is a
49
	 * The result is a list of in use bundle wirings. The list is ordered in
46
	 * list of in use bundle wirings. The list is ordered in reverse
50
	 * reverse chronological order such that the first bundle wiring is the
47
	 * chronological order such that the first bundle wiring is the
48
	 * {@link BundleWiring#isCurrent() current} bundle wiring and last wiring is
51
	 * {@link BundleWiring#isCurrent() current} bundle wiring and last wiring is
49
	 * the oldest in use bundle wiring.
52
	 * the oldest in use bundle wiring.
50
	 * 
53
	 * 
51
	 * <p>
54
	 * <p>
52
	 * If the referenced bundle is a fragment bundle, then the result is a list
53
	 * of in use bundle wirings to which the referenced fragment bundle is
54
	 * attached. The ordering of the list is unspecified. If the fragment bundle
55
	 * is not attached to any bundle wiring, then the returned list will be
56
	 * empty.
57
	 * 
58
	 * <p>
59
	 * The list must only contain in use bundle wirings. Generally the list will
55
	 * The list must only contain in use bundle wirings. Generally the list will
60
	 * have at least one bundle wiring for the bundle: the current bundle
56
	 * have at least one bundle wiring for the bundle: the current bundle
61
	 * wiring. However, for an uninstalled bundle with no in use bundle wirings
57
	 * wiring. However, for an uninstalled bundle with no in use bundle wirings
(-)osgi/src/org/osgi/framework/wiring/FragmentWirings.java (+59 lines)
Added Link Here
1
/*
2
 * Copyright (c) OSGi Alliance (2011). 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.Collection;
20
21
import org.osgi.framework.Bundle;
22
import org.osgi.framework.BundleReference;
23
24
/**
25
 * The {@link BundleWiring#isInUse() in use} bundle wirings for a fragment. Each
26
 * time a bundle is resolved, a new bundle wiring of the bundle is created. A
27
 * bundle wiring consists of a bundle and its attached fragments and represents
28
 * the dependencies with other bundle wirings.
29
 * 
30
 * <p>
31
 * The in use bundle wirings for a fragment can be obtained by calling
32
 * {@link Bundle#adapt(Class) bundle.adapt}({@link FragmentWirings}.class).
33
 * {@link FragmentWirings#getWirings() getWirings()} on the fragment's
34
 * {@code Bundle} object. Calling {@link Bundle#adapt(Class) bundle.adapt}(
35
 * {@link FragmentWirings} .class) on a non-fragment bundle must return
36
 * {@code null}.
37
 * 
38
 * @ThreadSafe
39
 * @noimplement
40
 * @version $Id$
41
 */
42
public interface FragmentWirings extends BundleReference {
43
	/**
44
	 * Return the {@link BundleWiring#isInUse() in use} wirings for the
45
	 * {@link BundleReference#getBundle() referenced} fragment.
46
	 * 
47
	 * <p>
48
	 * The result is a list of in use bundle wirings to which the referenced
49
	 * fragment is attached. If the fragment is not attached to any bundle
50
	 * wiring, then the returned collection will be empty.
51
	 * 
52
	 * <p>
53
	 * The collection must only contain in use bundle wirings.
54
	 * 
55
	 * @return A collection containing a snapshot of the {@link BundleWiring}s
56
	 *         for the referenced fragment.
57
	 */
58
	Collection<BundleWiring> getWirings();
59
}

Return to bug 334582