use of org.apache.commons.io.filefilter.WildcardFileFilter in project hudson-2.x by hudson.
the class LogRecorderManager method load.
/**
* Loads the configuration from disk.
*/
public void load() throws IOException {
logRecorders.clear();
File dir = new File(Hudson.getInstance().getRootDir(), "log");
File[] files = dir.listFiles((FileFilter) new WildcardFileFilter("*.xml"));
if (files == null)
return;
for (File child : files) {
String name = child.getName();
// cut off ".xml"
name = name.substring(0, name.length() - 4);
LogRecorder lr = new LogRecorder(name);
lr.load();
logRecorders.put(name, lr);
}
}
use of org.apache.commons.io.filefilter.WildcardFileFilter in project gocd by gocd.
the class DevelopmentAgent method copyActivatorJarToClassPath.
private static void copyActivatorJarToClassPath() throws IOException {
File activatorJar = new File("../plugin-infra/go-plugin-activator/target/libs/").listFiles((FileFilter) new WildcardFileFilter("go-plugin-activator-*.jar"))[0];
new SystemEnvironment().set(SystemEnvironment.PLUGIN_ACTIVATOR_JAR_PATH, activatorJar.getName());
SystemEnvironment systemEnvironment = new SystemEnvironment();
systemEnvironment.set(SystemEnvironment.PLUGIN_ACTIVATOR_JAR_PATH, "go-plugin-activator.jar");
systemEnvironment.set(SystemEnvironment.PLUGIN_LOCATION_MONITOR_INTERVAL_IN_SECONDS, 5);
if (activatorJar.exists()) {
FileUtils.copyFile(activatorJar, new File(classpath(), "go-plugin-activator.jar"));
} else {
System.err.println("Could not find plugin activator jar, Plugin framework will not be loaded.");
}
}
use of org.apache.commons.io.filefilter.WildcardFileFilter in project asterixdb by apache.
the class AsterixYARNClient method getAsterixDistributableLocation.
/**
* Find the distributable asterix bundle, be it in the default location or in a user-specified location.
*
* @return
*/
private File getAsterixDistributableLocation() {
//Look in the PWD for the "asterix" folder
File tarDir = new File("asterix");
if (!tarDir.exists()) {
throw new IllegalArgumentException("Default directory structure not in use- please specify an asterix zip and base config file to distribute");
}
FileFilter tarFilter = new WildcardFileFilter("asterix-server*.zip");
File[] tarFiles = tarDir.listFiles(tarFilter);
if (tarFiles.length != 1) {
throw new IllegalArgumentException("There is more than one canonically named asterix distributable in the default directory. Please leave only one there.");
}
return tarFiles[0];
}
use of org.apache.commons.io.filefilter.WildcardFileFilter in project oxTrust by GluuFederation.
the class ViewLogFileAction method prepareLogFiles.
private Map<Integer, String> prepareLogFiles() {
Map<Integer, String> logFiles = new HashMap<Integer, String>();
int fileIndex = 0;
for (SimpleCustomProperty logTemplate : this.logViewerConfiguration.getLogTemplates()) {
String logTemplatePattern = logTemplate.getValue2();
if (StringHelper.isEmpty(logTemplatePattern)) {
continue;
}
String logTemplatePath = FilenameUtils.getFullPath(logTemplatePattern);
String logTemplateFile = FilenameUtils.getName(logTemplatePattern);
File logTemplateBaseDir = new File(logTemplatePath);
FileFilter fileFilter = new AndFileFilter(FileFileFilter.FILE, new WildcardFileFilter(logTemplateFile));
File[] files = logTemplateBaseDir.listFiles(fileFilter);
if (files == null) {
continue;
}
for (int i = 0; i < files.length; i++) {
logFiles.put(fileIndex++, files[i].getPath());
}
}
return logFiles;
}
use of org.apache.commons.io.filefilter.WildcardFileFilter in project oxTrust by GluuFederation.
the class CacheRefreshSnapshotFileService method getSnapshotsList.
private String[] getSnapshotsList(CacheRefreshConfiguration cacheRefreshConfiguration) {
File file = new File(cacheRefreshConfiguration.getSnapshotFolder());
String[] files = file.list(new WildcardFileFilter(String.format(SNAPSHOT_FILE_NAME_PATTERN, "*")));
Arrays.sort(files);
return files;
}
Aggregations