Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/BundleFileWrapperChain.java')
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/BundleFileWrapperChain.java87
1 files changed, 87 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/BundleFileWrapperChain.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/BundleFileWrapperChain.java
new file mode 100644
index 000000000..29f2fd2dc
--- /dev/null
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/baseadaptor/bundlefile/BundleFileWrapperChain.java
@@ -0,0 +1,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