use of java.io.FileFilter in project Openfire by igniterealtime.
the class ClusteringPlugin method initializePlugin.
public void initializePlugin(PluginManager manager, File pluginDirectory) {
// Check if we Enterprise is installed and stop loading this plugin if found
File pluginDir = new File(JiveGlobals.getHomeDirectory(), "plugins");
File[] jars = pluginDir.listFiles(new FileFilter() {
public boolean accept(File pathname) {
String fileName = pathname.getName().toLowerCase();
return (fileName.equalsIgnoreCase("enterprise.jar") || fileName.equalsIgnoreCase("hazelcast.jar"));
}
});
if (jars.length > 0) {
// Do not load this plugin since Enterprise is still installed
System.out.println("Conflicting plugin found. Stopping Clustering Plugin");
throw new IllegalStateException("This plugin cannot run with the Enterprise or Hazelcast plugin");
}
// Make sure that the enteprise folder exists under the home directory
File enterpriseDir = new File(JiveGlobals.getHomeDirectory() + File.separator + "enterprise");
if (!enterpriseDir.exists()) {
enterpriseDir.mkdirs();
}
// Check if Coherence libs are installed and stop loading this plugin if NOT found
// File libDir = new File(JiveGlobals.getHomeDirectory(), "lib");
// jars = libDir.listFiles(new FileFilter() {
// public boolean accept(File pathname) {
// String fileName = pathname.getName().toLowerCase();
// return (fileName.equalsIgnoreCase("coherence.jar"));
// }
// });
// if (jars.length == 0) {
// // Do not load this plugin since Coherence libs are not installed
// System.out.println("Coherence libs not found. Stopping Clustering Plugin. Copy tangosol.jar, " +
// "coherence.jar and coherence-work.jar files to [OPENFIRE_HOME]/lib and restart the server.");
// throw new IllegalStateException("Coherence libs not found. Stopping Clustering Plugin. Copy " +
// "tangosol.jar, coherence.jar and coherence-work.jar files to [OPENFIRE_HOME]/lib and restart the server.");
// }
// Delete no longer used COHERENCE_CONFIG file. Java system properties should be used
// to customize coherence
File configFile = new File(enterpriseDir, COHERENCE_CONFIG + ".xml");
if (configFile.exists()) {
configFile.delete();
}
// Delete no longer used COHERENCE_CACHE_CONFIG file. Admins should use system properties
// to override default values. Same system properties will be used when not using enterprise or not
// using clustering
configFile = new File(enterpriseDir, COHERENCE_CACHE_CONFIG + ".xml");
if (configFile.exists()) {
configFile.delete();
}
try {
// Add openfireHome/enterprise dir to pluginclassloader
// Add enterprise plugin dir to pluginclassloader
URL url = new File(pluginDirectory + File.separator).toURL();
manager.getPluginClassloader(manager.getPlugin(pluginDirectory.getName())).addURLFile(url);
} catch (MalformedURLException e) {
Log.error("Error adding openfireHome/enterprise to the classpath of the enterprise plugin", e);
}
CacheFactory.getClusterConfig();
ClusterManager.startup();
}
use of java.io.FileFilter in project Openfire by igniterealtime.
the class ClientControlPlugin method initializePlugin.
// Plugin Interface
public void initializePlugin(PluginManager manager, File pluginDirectory) {
// Check if we Enterprise is installed and stop loading this plugin if found
File pluginDir = new File(JiveGlobals.getHomeDirectory(), "plugins");
File[] jars = pluginDir.listFiles(new FileFilter() {
public boolean accept(File pathname) {
String fileName = pathname.getName().toLowerCase();
return (fileName.equalsIgnoreCase("enterprise.jar"));
}
});
if (jars.length > 0) {
// Do not load this plugin since Enterprise is still installed
System.out.println("Enterprise plugin found. Stopping Client Control Plugin");
throw new IllegalStateException("This plugin cannot run next to the Enterprise plugin");
}
taskEngine = TaskEngine.getInstance();
sparkManager = new SparkManager(taskEngine);
sparkManager.start();
// Create and start the Spark version manager
sparkVersionManager = new SparkVersionManager();
sparkVersionManager.start();
fileTransferFilterManager = new FileTransferFilterManager();
fileTransferFilterManager.start();
}
use of java.io.FileFilter in project promoted-builds-plugin by jenkinsci.
the class CopyListener method onCopied.
/**
* Copy promotion definitions from existing job.
*/
@Override
public void onCopied(Item src, Item item) {
JobPropertyImpl prop;
if (src instanceof Job && (prop = ((Job<?, ?>) src).getProperty(JobPropertyImpl.class)) != null) {
File[] subdirs = prop.getRootDir().listFiles(new FileFilter() {
public boolean accept(File child) {
return child.isDirectory();
}
});
if (subdirs != null) {
prop = ((Job<?, ?>) item).getProperty(JobPropertyImpl.class);
for (File subdir : subdirs) try {
Util.copyFile(new File(subdir, "config.xml"), new File(prop.getRootDirFor(subdir.getName()), "config.xml"));
} catch (Exception e) {
Logger.getLogger(CopyListener.class.getName()).log(Level.WARNING, "Failed to copy/load promotion " + subdir + " into new job", e);
}
// Trigger loading of these files
prop.setOwner(prop.getOwner());
}
}
}
use of java.io.FileFilter in project promoted-builds-plugin by jenkinsci.
the class JobPropertyImpl method loadAllProcesses.
private void loadAllProcesses(File rootDir) throws IOException {
File[] subdirs = rootDir.listFiles(new FileFilter() {
public boolean accept(File child) {
return child.isDirectory();
}
});
loadProcesses(subdirs);
}
use of java.io.FileFilter in project jphp by jphp-compiler.
the class DocGenerator method main.
public static void main(String[] args) throws IOException {
File root = new File(".").getCanonicalFile();
DocGenerator generator = new DocGenerator();
for (File file : root.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory();
}
})) {
File sdkFile1 = new File(file, "resources/JPHP-INF/sdk/");
File sdkFile2 = new File(file, "src/main/resources/JPHP-INF/sdk/");
if (sdkFile1.isDirectory()) {
generator.addDirectory(sdkFile1, true);
} else if (sdkFile2.isDirectory()) {
generator.addDirectory(sdkFile2, true);
}
}
for (Map.Entry<String, String> entry : languages.entrySet()) {
generator.generate(new File("./docs/api_" + entry.getKey()), entry.getKey());
}
}
Aggregations