Commit a8dc9d2f authored by patrick's avatar patrick

better dev env for plugins


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1726 b35dd754-fafc-0310-a699-88a17e54d16e
parent db723749
...@@ -25,15 +25,7 @@ import java.io.File; ...@@ -25,15 +25,7 @@ import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -65,6 +57,7 @@ public class PluginManager { ...@@ -65,6 +57,7 @@ public class PluginManager {
private Map<Plugin, PluginDevEnvironment> pluginDevelopment; private Map<Plugin, PluginDevEnvironment> pluginDevelopment;
private Map<Plugin, List<String>> parentPluginMap; private Map<Plugin, List<String>> parentPluginMap;
private Map<Plugin, String> childPluginMap; private Map<Plugin, String> childPluginMap;
private Set<String> devPlugins;
/** /**
* Constructs a new plugin manager. * Constructs a new plugin manager.
...@@ -79,6 +72,7 @@ public class PluginManager { ...@@ -79,6 +72,7 @@ public class PluginManager {
pluginDevelopment = new HashMap<Plugin, PluginDevEnvironment>(); pluginDevelopment = new HashMap<Plugin, PluginDevEnvironment>();
parentPluginMap = new HashMap<Plugin, List<String>>(); parentPluginMap = new HashMap<Plugin, List<String>>();
childPluginMap = new HashMap<Plugin, String>(); childPluginMap = new HashMap<Plugin, String>();
devPlugins = new HashSet<String>();
} }
/** /**
...@@ -250,12 +244,22 @@ public class PluginManager { ...@@ -250,12 +244,22 @@ public class PluginManager {
String wrd = webRoot.getTextTrim(); String wrd = webRoot.getTextTrim();
File webRootDir = new File(wrd); File webRootDir = new File(wrd);
if (!webRootDir.exists()) {
// ok, let's try it relative from this plugin dir?
webRootDir = new File(pluginDir, wrd);
}
if (webRootDir.exists()) { if (webRootDir.exists()) {
dev.setWebRoot(webRootDir); dev.setWebRoot(webRootDir);
} }
String cd = classesDir.getTextTrim(); String cd = classesDir.getTextTrim();
File classes = new File(cd); File classes = new File(cd);
if (!classes.exists()) {
// ok, let's try it relative from this plugin dir?
classes = new File(pluginDir, cd);
}
if (classes.exists()) { if (classes.exists()) {
dev.setClassesDir(classes); dev.setClassesDir(classes);
pluginLoader.addURL(classes.getAbsoluteFile().toURL()); pluginLoader.addURL(classes.getAbsoluteFile().toURL());
...@@ -516,6 +520,19 @@ public class PluginManager { ...@@ -516,6 +520,19 @@ public class PluginManager {
public void run() { public void run() {
try { try {
// look for plugin directories specified as a system property
String pluginDirs = System.getProperty("pluginDirs");
if (pluginDirs != null) {
StringTokenizer st = new StringTokenizer(pluginDirs, ", ");
while (st.hasMoreTokens()) {
String dir = st.nextToken();
if (!devPlugins.contains(dir)) {
loadPlugin(new File(dir));
devPlugins.add(dir);
}
}
}
File[] jars = pluginDirectory.listFiles(new FileFilter() { File[] jars = pluginDirectory.listFiles(new FileFilter() {
public boolean accept(File pathname) { public boolean accept(File pathname) {
String fileName = pathname.getName().toLowerCase(); String fileName = pathname.getName().toLowerCase();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment