Search in sources :

Example 6 with WildcardFileFilter

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);
    }
}
Also used : File(java.io.File) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter)

Example 7 with WildcardFileFilter

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.");
    }
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) FileFilter(java.io.FileFilter) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter) File(java.io.File) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter)

Example 8 with WildcardFileFilter

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];
}
Also used : FileFilter(java.io.FileFilter) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter) File(java.io.File) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter)

Example 9 with WildcardFileFilter

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;
}
Also used : AndFileFilter(org.apache.commons.io.filefilter.AndFileFilter) HashMap(java.util.HashMap) SimpleCustomProperty(org.xdi.model.SimpleCustomProperty) AndFileFilter(org.apache.commons.io.filefilter.AndFileFilter) FileFileFilter(org.apache.commons.io.filefilter.FileFileFilter) FileFilter(java.io.FileFilter) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter) File(java.io.File) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter)

Example 10 with WildcardFileFilter

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;
}
Also used : File(java.io.File) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter)

Aggregations

WildcardFileFilter (org.apache.commons.io.filefilter.WildcardFileFilter)22 File (java.io.File)21 FileFilter (java.io.FileFilter)6 IOException (java.io.IOException)4 HashMap (java.util.HashMap)3 Activity (android.app.Activity)2 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)2 AndFileFilter (org.apache.commons.io.filefilter.AndFileFilter)2 SharedPreferences (android.content.SharedPreferences)1 ConnectivityManager (android.net.ConnectivityManager)1 NetworkInfo (android.net.NetworkInfo)1 HttpResponse (ch.boye.httpclientandroidlib.HttpResponse)1 HttpGet (ch.boye.httpclientandroidlib.client.methods.HttpGet)1 ConnectTimeoutException (ch.boye.httpclientandroidlib.conn.ConnectTimeoutException)1 ButterflyModule (edu.mit.simile.butterfly.ButterflyModule)1 FileIteratingFirehose (io.druid.data.input.impl.FileIteratingFirehose)1 IAE (io.druid.java.util.common.IAE)1 ISE (io.druid.java.util.common.ISE)1 SocketTimeoutException (java.net.SocketTimeoutException)1 URI (java.net.URI)1