azkaban-uncached

Merge pull request #59 from Erwa/master Added lib/commons-jexl-2.1.1.jar

10/18/2013 6:58:59 PM

Details

.classpath 1(+1 -0)

diff --git a/.classpath b/.classpath
index d032477..c81935d 100644
--- a/.classpath
+++ b/.classpath
@@ -31,5 +31,6 @@
 	<classpathentry kind="lib" path="extlib/mysql-connector-java-5.1.16-bin.jar"/>
 	<classpathentry kind="lib" path="lib/commons-pool-1.6.jar"/>
 	<classpathentry kind="lib" path="lib/h2-1.3.170.jar"/>
+	<classpathentry kind="lib" path="lib/commons-jexl-2.1.1.jar"/>
 	<classpathentry kind="output" path="dist/classes"/>
 </classpath>
diff --git a/src/java/azkaban/webapp/AzkabanWebServer.java b/src/java/azkaban/webapp/AzkabanWebServer.java
index e066be9..6096b68 100644
--- a/src/java/azkaban/webapp/AzkabanWebServer.java
+++ b/src/java/azkaban/webapp/AzkabanWebServer.java
@@ -1029,14 +1029,36 @@ public class AzkabanWebServer extends AzkabanServer {
 						logger.error(e);
 					}
 				}
+				
+				// Load any external libraries.
 				if (extLibClasspath != null) {
 					for (String extLib : extLibClasspath) {
-						try {
-							File file = new File(pluginDir, extLib);
-							URL url = file.toURI().toURL();
-							urls.add(url);
-						} catch (MalformedURLException e) {
-							logger.error(e);
+						File extLibFile = new File(pluginDir, extLib);
+						if (extLibFile.exists()) {
+							if (extLibFile.isDirectory()) {
+								// extLibFile is a directory; load all the files in the directory.
+								File[] extLibFiles = extLibFile.listFiles();
+								for (int i=0; i < extLibFiles.length; ++i) {
+									try {
+										URL url = extLibFiles[i].toURI().toURL();
+										urls.add(url);
+									} catch (MalformedURLException e) {
+										logger.error(e);
+									}
+								}
+							}
+							else { // extLibFile is a file
+								try {
+									URL url = extLibFile.toURI().toURL();
+									urls.add(url);
+								} catch (MalformedURLException e) {
+									logger.error(e);
+								}
+							}
+						}
+						else {
+							logger.error("External library path " + extLibFile.getAbsolutePath() + " not found.");
+							continue;
 						}
 					}
 				}
@@ -1044,7 +1066,7 @@ public class AzkabanWebServer extends AzkabanServer {
 				urlClassLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]), parentLoader);
 			}
 			else {
-				logger.error("Library path " + propertiesDir + " not found.");
+				logger.error("Library path " + libDir.getAbsolutePath() + " not found.");
 				continue;
 			}