Class<? extends AbstractFactory<?>> abstractFactoryClass) {
return abstractFactories.get(abstractFactoryClass) != null;
}
private static IPlugInFinder initBySearch(Set<String> ps) {
DiscPlugInFinder cr = new DiscPlugInFinder();
// remember the start path for using it later on
String startPath = System.getProperty("user.dir");
// compute the default directory to look for plug-ins in
String pathToDefaultDirectory =
customPluginDirectory != null ? customPluginDirectory : startPath
+ java.io.File.separatorChar + DEFAULT_PLUGIN_DIRECTORY;
if (pathToDefaultDirectory.endsWith(java.io.File.separator)) {
pathToDefaultDirectory =
pathToDefaultDirectory.substring(0,
pathToDefaultDirectory.length() - 1);
}
// first add the default directory/directories
if (pathToDefaultDirectory != null) {
Set<String> paths =
new HashSet<>(
org.jamesii.core.util.misc.Files
.getListOfPaths(pathToDefaultDirectory));
ps.addAll(paths);
}
// add the class path entries
if (!excludeClassPathOnSearch) {
SimSystem.report(Level.INFO,
"Includig classpath into the search for plug-ins (Classpath used is: "
+ System.getProperty(JavaInfo.CLASSPATH) + ")");
ps.addAll(org.jamesii.core.util.misc.Files.getListOfPaths(System
.getProperty(JavaInfo.CLASSPATH)));
}
// If the environment variable is set we'll parse any paths given
// in there
// as well
String envPlugInDirectory = System.getenv("JAMES_PLUGINPATH");
if (envPlugInDirectory != null) {
SimSystem
.report(
Level.INFO,
"Searching for plug-ins in dirs defined in the environment variable: JAMES_PLUGINPATH");
List<String> paths =
org.jamesii.core.util.misc.Files.getListOfPaths(envPlugInDirectory);
ps.addAll(paths);
}
for (String p : ps) {
SimSystem.report(Level.INFO, "Searching for plug-ins in: " + p);
cr.parseDirectory(p);
}
return cr;
}