summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2013-08-29 09:37:45 (EDT)
committer Thomas Watson2013-08-30 16:24:08 (EDT)
commit239bf454839d2dd0e0d9e689fa703ca307795890 (patch)
tree57ffaa3ce1965532e534e5bbfd403589b94e9c9b
parent916c5cb71f2689f1e2f2171f65eb88f7e283d8c4 (diff)
downloadrt.equinox.bundles-239bf454839d2dd0e0d9e689fa703ca307795890.zip
rt.equinox.bundles-239bf454839d2dd0e0d9e689fa703ca307795890.tar.gz
rt.equinox.bundles-239bf454839d2dd0e0d9e689fa703ca307795890.tar.bz2
Bug 416073 - Optimize Storage.listEntryPaths for wildcards and recursion.I20130831-1500I20130830-2000
Update Bundle File API clients to use new BundleFileWrapper decorator class.
-rw-r--r--bundles/org.eclipse.equinox.transforms.hook/src/org/eclipse/equinox/internal/transforms/TransformedBundleFile.java24
-rw-r--r--bundles/org.eclipse.equinox.transforms.hook/src/org/eclipse/equinox/internal/transforms/TransformerHook.java3
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AbstractWeavingBundleFile.java80
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java5
4 files changed, 10 insertions, 102 deletions
diff --git a/bundles/org.eclipse.equinox.transforms.hook/src/org/eclipse/equinox/internal/transforms/TransformedBundleFile.java b/bundles/org.eclipse.equinox.transforms.hook/src/org/eclipse/equinox/internal/transforms/TransformedBundleFile.java
index 5a348a2..8667427 100644
--- a/bundles/org.eclipse.equinox.transforms.hook/src/org/eclipse/equinox/internal/transforms/TransformedBundleFile.java
+++ b/bundles/org.eclipse.equinox.transforms.hook/src/org/eclipse/equinox/internal/transforms/TransformedBundleFile.java
@@ -29,7 +29,7 @@ import org.osgi.framework.Bundle;
* This class is capable of providing transformed versions of entries contained within a base bundle file.
* For requests that transform bundle contents into local resources (such as file URLs) the transformed state of the bundle is written to the configuration area.
*/
-public class TransformedBundleFile extends BundleFile {
+public class TransformedBundleFile extends BundleFileWrapper {
private final TransformerHook transformerHook;
private final BundleFile delegate;
@@ -44,7 +44,7 @@ public class TransformedBundleFile extends BundleFile {
* @param delegate the original file
*/
public TransformedBundleFile(TransformerHook transformerHook, Generation generation, BundleFile delegate) {
- super(delegate.getBaseFile());
+ super(delegate);
this.transformerHook = transformerHook;
this.generation = generation;
this.delegate = delegate;
@@ -55,22 +55,10 @@ public class TransformedBundleFile extends BundleFile {
return generation;
}
- public void close() throws IOException {
- delegate.close();
- }
-
- public boolean containsDir(String dir) {
- return delegate.containsDir(dir);
- }
-
public boolean equals(Object obj) {
return delegate.equals(obj);
}
- public File getBaseFile() {
- return delegate.getBaseFile();
- }
-
public BundleEntry getEntry(String path) {
final BundleEntry original = delegate.getEntry(path);
@@ -141,10 +129,6 @@ public class TransformedBundleFile extends BundleFile {
return matcher.matches();
}
- public Enumeration getEntryPaths(String path) {
- return delegate.getEntryPaths(path);
- }
-
/**
* This file is a copy of {@link ZipBundleFile#getFile(String, boolean)}
* with modifications.
@@ -260,10 +244,6 @@ public class TransformedBundleFile extends BundleFile {
return delegate.hashCode();
}
- public void open() throws IOException {
- delegate.open();
- }
-
public String toString() {
return delegate.toString();
}
diff --git a/bundles/org.eclipse.equinox.transforms.hook/src/org/eclipse/equinox/internal/transforms/TransformerHook.java b/bundles/org.eclipse.equinox.transforms.hook/src/org/eclipse/equinox/internal/transforms/TransformerHook.java
index 0ff8701..26197d4 100644
--- a/bundles/org.eclipse.equinox.transforms.hook/src/org/eclipse/equinox/internal/transforms/TransformerHook.java
+++ b/bundles/org.eclipse.equinox.transforms.hook/src/org/eclipse/equinox/internal/transforms/TransformerHook.java
@@ -17,6 +17,7 @@ import org.eclipse.osgi.internal.hookregistry.*;
import org.eclipse.osgi.internal.log.EquinoxLogServices;
import org.eclipse.osgi.storage.BundleInfo.Generation;
import org.eclipse.osgi.storage.bundlefile.BundleFile;
+import org.eclipse.osgi.storage.bundlefile.BundleFileWrapper;
import org.osgi.framework.*;
/**
@@ -30,7 +31,7 @@ public class TransformerHook implements BundleFileWrapperFactoryHook, HookConfig
/**
* @throws IOException
*/
- public BundleFile wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) {
+ public BundleFileWrapper wrapBundleFile(BundleFile bundleFile, Generation generation, boolean base) {
if (transformers == null || templates == null)
return null;
return new TransformedBundleFile(this, generation, bundleFile);
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AbstractWeavingBundleFile.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AbstractWeavingBundleFile.java
index cabd782..86fe9d0 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AbstractWeavingBundleFile.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AbstractWeavingBundleFile.java
@@ -13,17 +13,11 @@
package org.eclipse.equinox.weaving.hooks;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-
import org.eclipse.equinox.weaving.adaptors.IWeavingAdaptor;
-import org.eclipse.osgi.container.Module;
-import org.eclipse.osgi.storage.bundlefile.BundleEntry;
import org.eclipse.osgi.storage.bundlefile.BundleFile;
+import org.eclipse.osgi.storage.bundlefile.BundleFileWrapper;
-public abstract class AbstractWeavingBundleFile extends BundleFile {
+public abstract class AbstractWeavingBundleFile extends BundleFileWrapper {
private final BundleAdaptorProvider adaptorProvider;
@@ -32,83 +26,15 @@ public abstract class AbstractWeavingBundleFile extends BundleFile {
public AbstractWeavingBundleFile(
final BundleAdaptorProvider adaptorProvider,
final BundleFile bundleFile) {
- super(bundleFile.getBaseFile());
+ super(bundleFile);
this.adaptorProvider = adaptorProvider;
this.delegate = bundleFile;
}
/**
- * @see BundleFile#close()
- */
- @Override
- public void close() throws IOException {
- delegate.close();
- }
-
- /**
- * @see BundleFile#containsDir(java.lang.String)
- */
- @Override
- public boolean containsDir(final String dir) {
- return delegate.containsDir(dir);
- }
-
- /**
* @return
*/
public IWeavingAdaptor getAdaptor() {
return this.adaptorProvider.getAdaptor();
}
-
- /**
- * @see BundleFile#getBaseFile()
- */
- @Override
- public File getBaseFile() {
- final File baseFile = delegate.getBaseFile();
- return baseFile;
- }
-
- /**
- * @see BundleFile#getEntry(java.lang.String)
- */
- @Override
- public BundleEntry getEntry(final String path) {
- return delegate.getEntry(path);
- }
-
- /**
- * @see BundleFile#getEntryPaths(java.lang.String)
- */
- @Override
- public Enumeration<String> getEntryPaths(final String path) {
- return delegate.getEntryPaths(path);
- }
-
- /**
- * @see BundleFile#getFile(java.lang.String, boolean)
- */
- @Override
- public File getFile(final String path, final boolean nativeCode) {
- return delegate.getFile(path, nativeCode);
- }
-
- /**
- * @see BundleFile#getResourceURL(java.lang.String,
- * org.eclipse.osgi.container.Module, int)
- */
- @Override
- public URL getResourceURL(final String path, final Module hostModule,
- final int index) {
- return delegate.getResourceURL(path, hostModule, index);
- }
-
- /**
- * @see BundleFile#open()
- */
- @Override
- public void open() throws IOException {
- delegate.open();
- }
-
}
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java
index 39596e7..7d83ee1 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java
@@ -28,6 +28,7 @@ import org.eclipse.osgi.internal.loader.classpath.ClasspathManager;
import org.eclipse.osgi.storage.BundleInfo.Generation;
import org.eclipse.osgi.storage.bundlefile.BundleEntry;
import org.eclipse.osgi.storage.bundlefile.BundleFile;
+import org.eclipse.osgi.storage.bundlefile.BundleFileWrapper;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -211,9 +212,9 @@ public class WeavingHook extends AbstractWeavingHook {
* @see org.eclipse.osgi.internal.hookregistry.BundleFileWrapperFactoryHook#wrapBundleFile(org.eclipse.osgi.storage.bundlefile.BundleFile,
* org.eclipse.osgi.storage.BundleInfo.Generation, boolean)
*/
- public BundleFile wrapBundleFile(final BundleFile bundleFile,
+ public BundleFileWrapper wrapBundleFile(final BundleFile bundleFile,
final Generation generation, final boolean base) {
- BundleFile wrapped = null;
+ BundleFileWrapper wrapped = null;
if (Debug.DEBUG_BUNDLE)
Debug.println("> WeavingHook.wrapBundleFile() bundle="
+ (generation.getRevision() != null ? generation