refactor super class to allow sub adaptors to override function
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleFile.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleFile.java
index 33c6bf7..4f90560 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleFile.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleFile.java
@@ -126,7 +126,7 @@
protected ZipFile zipFile;
protected boolean closed = false;
- protected ZipBundleFile(File basefile, BundleData bundledata) throws IOException {
+ public ZipBundleFile(File basefile, BundleData bundledata) throws IOException {
super(basefile);
this.bundledata = bundledata;
this.closed = true;
@@ -321,7 +321,7 @@
*/
public static class DirBundleFile extends BundleFile {
- protected DirBundleFile(File basefile) throws IOException {
+ public DirBundleFile(File basefile) throws IOException {
super(basefile);
if (!basefile.exists() || !basefile.isDirectory()) {
throw new IOException(AdaptorMsg.formatter.getString("ADAPTOR_DIRECTORY_EXCEPTION", basefile)); //$NON-NLS-1$
@@ -471,4 +471,8 @@
// do nothing
}
}
+
+ public File getBaseFile() {
+ return basefile;
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseClassLoader.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseClassLoader.java
index 6a858fc..3d4b283 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseClassLoader.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseClassLoader.java
@@ -44,7 +44,6 @@
}
public Class findLocalClass(String className) throws ClassNotFoundException {
-
if (StatsManager.MONITOR_CLASSES) //Suport for performance analysis
ClassloaderStats.startLoadingClass(getClassloaderId(), className);
boolean found = true;
@@ -54,11 +53,11 @@
// If the bundle is active, uninstalled or stopping then the bundle has already
// been initialized (though it may have been destroyed) so just return the class.
if ((bundle.getState() & (AbstractBundle.ACTIVE | AbstractBundle.UNINSTALLED | AbstractBundle.STOPPING)) != 0)
- return super.findLocalClass(className);
+ return basicFindLocalClass(className);
// The bundle is not active and does not require activation, just return the class
if (!shouldActivateFor(className))
- return super.findLocalClass(className);
+ return basicFindLocalClass(className);
// The bundle is starting. Note that if the state changed between the tests
// above and this test (e.g., it was not ACTIVE but now is), that's ok, we will
@@ -68,7 +67,7 @@
if (bundle.getState() == AbstractBundle.STARTING) {
// If the thread trying to load the class is the one trying to activate the bundle, then return the class
if (bundle.testStateChanging(Thread.currentThread()) || bundle.testStateChanging(null))
- return super.findLocalClass(className);
+ return basicFindLocalClass(className);
// If it's another thread, we wait and try again. In any case the class is returned.
// The difference is that an exception can be logged.
@@ -99,7 +98,7 @@
String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_CLASSLOADER_CONCURRENT_STARTUP", new Object[] {Thread.currentThread().getName(), className, threadChangingState.getName(), bundleName, Long.toString(delay)}); //$NON-NLS-1$
EclipseAdaptor.getDefault().getFrameworkLog().log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, message, 0, new Exception(EclipseAdaptorMsg.formatter.getString("ECLIPSE_CLASSLOADER_GENERATED_EXCEPTION")), null)); //$NON-NLS-1$
}
- return super.findLocalClass(className);
+ return basicFindLocalClass(className);
}
}
@@ -110,7 +109,7 @@
String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_CLASSLOADER_ACTIVATION", bundle.getSymbolicName(), Long.toString(bundle.getBundleId())); //$NON-NLS-1$
EclipseAdaptor.getDefault().getFrameworkLog().log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, message, 0, e, null));
}
- return super.findLocalClass(className);
+ return basicFindLocalClass(className);
} catch (ClassNotFoundException e) {
found = false;
throw e;
@@ -121,6 +120,18 @@
}
/**
+ * Do the basic work for finding a class. This avoids the activation detection etc
+ * and can be used by subclasses to override the default (from the superclass)
+ * way of finding classes.
+ * @param name the class to look for
+ * @return the found class
+ * @throws ClassNotFoundException if the requested class cannot be found
+ */
+ protected Class basicFindLocalClass(String name) throws ClassNotFoundException {
+ return super.findLocalClass(name);
+ }
+
+ /**
* Determines if for loading the given class we should activate the bundle.
*/
private boolean shouldActivateFor(String className) {