Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 29f2fd2dce1783d81fad506c69653c825eb94450 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*******************************************************************************
 * Copyright (c) 2008 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.baseadaptor.bundlefile;

import org.eclipse.osgi.baseadaptor.hooks.BundleFileWrapperFactoryHook;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
import org.eclipse.osgi.baseadaptor.BaseData;

/**
 * Used to chain the BundleFile objects returned from {@link BundleFileWrapperFactoryHook}.  
 * This class is useful for traversing the chain of wrapped bundle files.
 */
public class BundleFileWrapperChain extends BundleFile {
	private final BundleFile wrapped;
	private final BundleFileWrapperChain next;

	public BundleFileWrapperChain(BundleFile wrapped, BundleFileWrapperChain next) {
		this.wrapped = wrapped;
		this.next = next;
	}

	public void close() throws IOException {
		wrapped.close();
	}

	public boolean containsDir(String dir) {
		return wrapped.containsDir(dir);
	}

	public BundleEntry getEntry(String path) {
		return wrapped.getEntry(path);
	}

	public Enumeration getEntryPaths(String path) {
		return wrapped.getEntryPaths(path);
	}

	public File getFile(String path, boolean nativeCode) {
		return wrapped.getFile(path, nativeCode);
	}

	public void open() throws IOException {
		wrapped.open();
	}

	public File getBaseFile() {
		return wrapped.getBaseFile();
	}

	public URL getResourceURL(String path, BaseData hostData, int index) {
		return wrapped.getResourceURL(path, hostData, index);
	}

	public String toString() {
		return wrapped.toString();
	}

	/**
	 * The BundleFile that is wrapped
	 * @return the BunldeFile that is wrapped
	 */
	public BundleFile getWrapped() {
		return wrapped;
	}

	/**
	 * The next WrapperBundleFile in the chain.  A <code>null</code> value
	 * is returned if this is the end of the chain.
	 * @return the next WrapperBundleFile
	 */
	public BundleFileWrapperChain getNext() {
		return next;
	}
}

Back to the top