From deb32cf7bdf3fdd9713b91eb63c80eed2ae03977 Mon Sep 17 00:00:00 2001
From: Oliver Bolte
This class is not yet stable.
+ *This is an internal, unstable class of the Uno Runtime Environment; it + * should not be used by client code.
* * @since UDK 3.2.0 */ @@ -68,48 +69,20 @@ public final class UnoClassLoader extends URLClassLoader { * (java_uno.jar
, juh.jar
, jurt.jar
,
* ridl.jar
) can be found; must not be null
.
*
- * @param parent the parent class loader for delegation.
- *
- * @throws MalformedURLException if the given base
URL is
- * malformed.
- */
- public UnoClassLoader(URL base, ClassLoader parent)
- throws MalformedURLException
- {
- //TODO Get rid of java_uno.jar here:
- super(
- new URL[] {
- new URL(base, "java_uno.jar"), new URL(base, "juh.jar"),
- new URL(base, "jurt.jar"), new URL(base, "ridl.jar") },
- parent);
- }
-
- /**
- * Instantiates the root UNO class loader, passing it locations of
- * additional UNO types.
- *
- * @param base a base URL relative to which the URE JARs
- * (java_uno.jar
, juh.jar
, jurt.jar
,
- * ridl.jar
) can be found; must not be null
.
+ * @param classPath an array of URLs that form the class path of this class
+ * loader; may be null
, which is the same as an empty array.
+ * The URLs are interpreted in the same way as the arguments of a {@link
+ * URLClassLoader}.
*
* @param parent the parent class loader for delegation.
*
- * @param extraTypes a (possibly empty) array of URLs through which Java
- * classes representing additional UNO types can be found; must not be
- * null
.
- *
* @throws MalformedURLException if the given base
URL is
* malformed.
- *
- * @since UDK 3.2.2
*/
- public UnoClassLoader(URL base, ClassLoader parent, URL[] extraTypes)
+ public UnoClassLoader(URL base, URL[] classPath, ClassLoader parent)
throws MalformedURLException
{
- this(base, parent);
- for (int i = 0; i < extraTypes.length; ++i) {
- addURL(extraTypes[i]);
- }
+ super(createUrls(base, classPath), parent);
}
/**
@@ -231,4 +204,19 @@ public final class UnoClassLoader extends URLClassLoader {
}
return mf == null ? null : mf.getMainAttributes();
}
+
+ private static URL[] createUrls(URL base, URL[] classPath)
+ throws MalformedURLException
+ {
+ final int JARS = 4;
+ URL[] urls = new URL[JARS + (classPath == null ? 0 : classPath.length)];
+ urls[0] = new URL(base, "java_uno.jar"); //TODO get rid of it here
+ urls[1] = new URL(base, "juh.jar");
+ urls[2] = new URL(base, "jurt.jar");
+ urls[3] = new URL(base, "ridl.jar");
+ if (classPath != null) {
+ System.arraycopy(classPath, 0, urls, JARS, classPath.length);
+ }
+ return urls;
+ }
}
--
cgit