jruaux 2003/03/27 07:59:10
Modified:
integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/launcher
CactusLaunchConfiguration.java
Log:
Now takes the Jasper jars from the org.eclipse.tomcat plug-in
Revision Changes Path
1.4 +49 -12
jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/launcher/CactusLaunchConfiguration.java
Index: CactusLaunchConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.runner/src/java/org/apache/cactus/eclipse/runner/launcher/CactusLaunchConfiguration.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CactusLaunchConfiguration.java 27 Mar 2003 14:54:42 -0000 1.3
+++ CactusLaunchConfiguration.java 27 Mar 2003 15:59:10 -0000 1.4
@@ -176,7 +176,16 @@
apacheJarPaths =
concatenateStringArrays(
apacheJarPaths,
- getLibrariesPaths(descriptor));
+ getLibrariesPaths(descriptor, null));
+ }
+ Plugin tomcatPlugin = Platform.getPlugin("org.eclipse.tomcat");
+ if (tomcatPlugin != null)
+ {
+ IPluginDescriptor descriptor = tomcatPlugin.getDescriptor();
+ apacheJarPaths =
+ concatenateStringArrays(
+ apacheJarPaths,
+ getLibrariesPaths(descriptor, "org.apache.jasper"));
}
return concatenateStringArrays(jettyJarPaths, apacheJarPaths);
}
@@ -259,28 +268,56 @@
}
/**
- * @param theDescriptor the plug-in descriptor to get libraries from
+ * @param theDescriptor the plug-in descriptor to get libraries from
+ * @param thePackagePrefix package prefix used to filter libraries
* @return an array of jar paths exposed by the plug-in
*/
- private String[] getLibrariesPaths(IPluginDescriptor theDescriptor)
+ private String[] getLibrariesPaths(
+ IPluginDescriptor theDescriptor,
+ String thePackagePrefix)
{
Vector result = new Vector();
URL root = theDescriptor.getInstallURL();
ILibrary[] libraries = theDescriptor.getRuntimeLibraries();
for (int i = 0; i < libraries.length; i++)
{
- try
+ ILibrary currentLib = libraries[i];
+ if (thePackagePrefix == null
+ || isContained(thePackagePrefix, currentLib))
{
- URL url = new URL(root, libraries[i].getPath().toString());
- result.add(Platform.asLocalURL(url).getFile());
+ try
+ {
+ URL url = new URL(root, currentLib.getPath().toString());
+ result.add(Platform.asLocalURL(url).getFile());
+ }
+ catch (IOException e)
+ {
+ // if the URL is not valid we don't add it
+ CactusPlugin.log(e);
+ continue;
+ }
}
- catch (IOException e)
+ }
+ return (String[]) result.toArray(new String[result.size()]);
+ }
+
+ /**
+ * @param thePackagePrefix prefix which presence is to be tested
+ * @param theCurrentLib the library in which the prefix will be searched
+ * @return true if the library declares the given package prefix
+ */
+ private boolean isContained(
+ String thePackagePrefix,
+ ILibrary theCurrentLib)
+ {
+ String[] prefixes = theCurrentLib.getPackagePrefixes();
+ for (int i = 0; i < prefixes.length; i++)
+ {
+ if (prefixes[i].equals(thePackagePrefix))
{
- // if the URL is not valid we don't add it
- CactusPlugin.log(e);
- continue;
+ return true;
}
}
- return (String[]) result.toArray(new String[result.size()]);
+ return false;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]