Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2013-08-29 09:30:45 -0400
committerThomas Watson2013-08-30 16:23:18 -0400
commit4af4881573f98cb0eab92922c6302908fd56b389 (patch)
tree0c1f40d44882f5e2312453f5120b120fca12e31c /bundles/org.eclipse.osgi.compatibility.plugins/src
parentf71c31ff5bfff75903926ab7448b1f14a8f91c2c (diff)
downloadrt.equinox.framework-4af4881573f98cb0eab92922c6302908fd56b389.tar.gz
rt.equinox.framework-4af4881573f98cb0eab92922c6302908fd56b389.tar.xz
rt.equinox.framework-4af4881573f98cb0eab92922c6302908fd56b389.zip
Bug 416073 - Optimize Storage.listEntryPaths for wildcards and recursion.
The first optimization consisted of adding an additional method to BundleFile with the following signature: abstract public void getEntryPaths(String path, boolean recursive) This allows the bundle file to return all descendants under the specified path rather than only its children. In turn, this allowed for the removal of the loop in Storage.listEntryPaths that made multiple calls to the bundle file for the same data. The second optimization was to replace List with a Set in BundleLoader.listResources and Storage.listEntryPaths to achieve constant lookup time for contains(). A LinkedHashSet was used to maintain the original ordering. As part of this work, a bundle file decorator class (BundleFileWrapper) was introduced in order to shield clients from future changes to BundleFile. As a result of these changes, org.eclipse.equinox.transforms and org.eclipse.equinox.weaving in rt.equinox.bundles required updates. Fixed synthetic access compiler warning in BundleLoader. Removed all @since 3.2 annotations from package org.eclipse.osgi.storage.bundlefile. Refactored SignedBundleFile so that BundleFileWrapper did not need to accept a null bundle file in the constructor. Fixed a failure in DiscardBundleTests caused by not being able to setLastModified on a file locked by the framework.
Diffstat (limited to 'bundles/org.eclipse.osgi.compatibility.plugins/src')
-rw-r--r--bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginConverterHook.java46
1 files changed, 15 insertions, 31 deletions
diff --git a/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginConverterHook.java b/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginConverterHook.java
index 392155ee3..b7fd91719 100644
--- a/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginConverterHook.java
+++ b/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginConverterHook.java
@@ -12,14 +12,23 @@ package org.eclipse.osgi.compatibility.plugins;
import java.io.File;
import java.io.IOException;
-import java.util.Enumeration;
+
import org.eclipse.osgi.framework.util.Headers;
-import org.eclipse.osgi.internal.hookregistry.*;
+import org.eclipse.osgi.internal.hookregistry.ActivatorHookFactory;
+import org.eclipse.osgi.internal.hookregistry.BundleFileWrapperFactoryHook;
+import org.eclipse.osgi.internal.hookregistry.HookConfigurator;
+import org.eclipse.osgi.internal.hookregistry.HookRegistry;
import org.eclipse.osgi.service.pluginconversion.PluginConversionException;
import org.eclipse.osgi.service.pluginconversion.PluginConverter;
import org.eclipse.osgi.storage.BundleInfo.Generation;
-import org.eclipse.osgi.storage.bundlefile.*;
-import org.osgi.framework.*;
+import org.eclipse.osgi.storage.bundlefile.BundleEntry;
+import org.eclipse.osgi.storage.bundlefile.BundleFile;
+import org.eclipse.osgi.storage.bundlefile.BundleFileWrapper;
+import org.eclipse.osgi.storage.bundlefile.FileBundleEntry;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
public class PluginConverterHook implements HookConfigurator {
@Override
@@ -34,26 +43,11 @@ public class PluginConverterHook implements HookConfigurator {
hookRegistry.addBundleFileWrapperFactoryHook(new BundleFileWrapperFactoryHook() {
@Override
- public BundleFile wrapBundleFile(final BundleFile bundleFile, Generation generation, boolean base) {
+ public BundleFileWrapper wrapBundleFile(final BundleFile bundleFile, Generation generation, boolean base) {
if (!base) {
return null;
}
- return new BundleFile(bundleFile.getBaseFile()) {
-
- @Override
- public void open() throws IOException {
- bundleFile.open();
- }
-
- @Override
- public File getFile(String path, boolean nativeCode) {
- return bundleFile.getFile(path, nativeCode);
- }
-
- @Override
- public Enumeration<String> getEntryPaths(String path) {
- return bundleFile.getEntryPaths(path);
- }
+ return new BundleFileWrapper(bundleFile) {
@Override
public BundleEntry getEntry(String path) {
@@ -85,16 +79,6 @@ public class PluginConverterHook implements HookConfigurator {
throw new RuntimeException(e);
}
}
-
- @Override
- public boolean containsDir(String dir) {
- return bundleFile.containsDir(dir);
- }
-
- @Override
- public void close() throws IOException {
- bundleFile.close();
- }
};
}
});

Back to the top