azkaban-uncached

Details

diff --git a/src/java/azkaban/utils/PropsUtils.java b/src/java/azkaban/utils/PropsUtils.java
index 980bf97..3c720c4 100644
--- a/src/java/azkaban/utils/PropsUtils.java
+++ b/src/java/azkaban/utils/PropsUtils.java
@@ -18,6 +18,7 @@ package azkaban.utils;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -56,11 +57,11 @@ public class PropsUtils {
 	 *            File suffixes to load
 	 * @return The loaded set of schedules
 	 */
-	public static Props loadPropsInDir(Props parent, File dir,
-			String... suffixes) {
+	public static Props loadPropsInDir(Props parent, File dir, String... suffixes) {
 		try {
 			Props props = new Props(parent);
 			File[] files = dir.listFiles();
+			Arrays.sort(files);
 			if (files != null) {
 				for (File f : files) {
 					if (f.isFile() && endsWith(f, suffixes)) {
@@ -74,6 +75,22 @@ public class PropsUtils {
 		}
 	}
 
+	public static Props loadProps(Props parent, File ... propFiles) {
+		try {
+			Props props = new Props(parent);
+			for (File f: propFiles) {
+				if (f.isFile()) {
+					props = new Props(props, f);
+				}
+			}
+			
+			return props;
+		}
+		catch (IOException e) {
+			throw new RuntimeException("Error loading properties.", e);
+		}
+	}
+	
 	/**
 	 * Load job schedules from the given directories
 	 * 
@@ -185,10 +202,8 @@ public class PropsUtils {
 		parentProps.put("azkaban.flow.start.hour", loadTime.toString("HH"));
 		parentProps.put("azkaban.flow.start.minute", loadTime.toString("mm"));
 		parentProps.put("azkaban.flow.start.seconds", loadTime.toString("ss"));
-		parentProps.put("azkaban.flow.start.milliseconds",
-				loadTime.toString("SSS"));
-		parentProps.put("azkaban.flow.start.timezone",
-				loadTime.toString("ZZZZ"));
+		parentProps.put("azkaban.flow.start.milliseconds", loadTime.toString("SSS"));
+		parentProps.put("azkaban.flow.start.timezone", loadTime.toString("ZZZZ"));
 		return parentProps;
 	}
 
diff --git a/src/java/azkaban/webapp/AzkabanWebServer.java b/src/java/azkaban/webapp/AzkabanWebServer.java
index 79a6b63..a11f8cb 100644
--- a/src/java/azkaban/webapp/AzkabanWebServer.java
+++ b/src/java/azkaban/webapp/AzkabanWebServer.java
@@ -467,7 +467,21 @@ public class AzkabanWebServer implements AzkabanServer {
 			File propertiesDir = new File(pluginDir, "conf");
 			Props pluginProps = null;
 			if (propertiesDir.exists() && propertiesDir.isDirectory()) {
-				pluginProps = PropsUtils.loadPropsInDir(propertiesDir, "properties");
+				File propertiesFile = new File(propertiesDir, "plugin.properties");
+				File propertiesOverrideFile = new File(propertiesDir, "override.properties");
+				
+				if (propertiesFile.exists()) {
+					if (propertiesOverrideFile.exists()) {
+						pluginProps = PropsUtils.loadProps(null, propertiesFile, propertiesOverrideFile);
+					}
+					else {
+						pluginProps = PropsUtils.loadProps(null, propertiesFile);
+					}
+				}
+				else {
+					logger.error("Plugin conf file " + propertiesFile + " not found.");
+					continue;
+				}
 			}
 			else {
 				logger.error("Plugin conf path " + propertiesDir + " not found.");
@@ -478,6 +492,8 @@ public class AzkabanWebServer implements AzkabanServer {
 			String pluginWebPath = pluginProps.getString("viewer.path");
 			int pluginOrder = pluginProps.getInt("viewer.order", 0);
 			boolean pluginHidden = pluginProps.getBoolean("viewer.hidden", false);
+			List<String> extLibClasspath = pluginProps.getStringList("viewer.external.classpaths", (List<String>)null);
+			
 			String pluginClass = pluginProps.getString("viewer.servlet.class");
 			if (pluginClass == null) {
 				logger.error("Viewer class is not set.");
@@ -491,16 +507,28 @@ public class AzkabanWebServer implements AzkabanServer {
 			if (libDir.exists() && libDir.isDirectory()) {
 				File[] files = libDir.listFiles();
 				
-				URL[] url = new URL[files.length];
+				ArrayList<URL> urls = new ArrayList<URL>();
 				for (int i=0; i < files.length; ++i) {
 					try {
-						url[i] = files[i].toURI().toURL();
+						URL url = files[i].toURI().toURL();
+						urls.add(url);
 					} catch (MalformedURLException e) {
 						logger.error(e);
 					}
 				}
+				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);
+						}
+					}
+				}
 				
-				urlClassLoader = new URLClassLoader(url, parentLoader);
+				urlClassLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]), parentLoader);
 			}
 			else {
 				logger.error("Library path " + propertiesDir + " not found.");