Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e04273c337768363398da8c84d6b96e1a23bbab0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*******************************************************************************
 * Copyright (c) 2005, 2017 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.osgi.internal.loader.classpath;

import java.io.IOException;
import org.eclipse.osgi.container.ModuleContainerAdaptor.ContainerEvent;
import org.eclipse.osgi.storage.BundleInfo.Generation;

/**
 * A FragmentClasspath contains all the <code>ClasspathEntry</code> objects for a fragment
 * <code>BaseData</code>.
 * @since 3.2
 */
public class FragmentClasspath {
	private final Generation generation;
	// Note that PDE has internal dependency on this field type/name (bug 267238)
	private final ClasspathEntry[] entries;

	public FragmentClasspath(Generation generation, ClasspathEntry[] entries) {
		this.generation = generation;
		this.entries = entries;
	}

	/**
	 * Returns the fragment Generation for this FragmentClasspath
	 * @return the fragment Generation for this FragmentClasspath
	 */
	public Generation getGeneration() {
		return generation;
	}

	/**
	 * Returns the fragment classpath entries for this FragmentClasspath
	 * @return the fragment classpath entries for this FragmentClasspath
	 */
	public ClasspathEntry[] getEntries() {
		return entries;
	}

	/**
	 * Closes all the classpath entry resources for this FragmentClasspath.
	 *
	 */
	public void close() {
		for (int i = 0; i < entries.length; i++) {
			try {
				entries[i].close();
			} catch (IOException e) {
				generation.getBundleInfo().getStorage().getAdaptor().publishContainerEvent(ContainerEvent.ERROR, generation.getRevision().getRevisions().getModule(), e);
			}
		}
	}

}

Back to the top