Example usage for org.apache.commons.io.filefilter TrueFileFilter INSTANCE

List of usage examples for org.apache.commons.io.filefilter TrueFileFilter INSTANCE

Introduction

In this page you can find the example usage for org.apache.commons.io.filefilter TrueFileFilter INSTANCE.

Prototype

IOFileFilter INSTANCE

To view the source code for org.apache.commons.io.filefilter TrueFileFilter INSTANCE.

Click Source Link

Document

Singleton instance of true filter.

Usage

From source file:io.cloudslang.lang.commons.services.impl.SlangCompilationServiceImpl.java

@Override
public Collection<File> listSlangFiles(File directory, boolean recursive) {
    Validate.isTrue(directory.isDirectory(),
            "Parameter '" + directory.getPath() + INVALID_DIRECTORY_ERROR_MESSAGE_SUFFIX);
    return FileUtils.listFiles(directory, new IOFileFilter() {
        @Override/*from   www .ja  va 2  s. co  m*/
        public boolean accept(File file) {
            return Extension.SL == Extension.findExtension(file.getName());
        }

        @Override
        public boolean accept(File file, String name) {
            return Extension.SL == Extension.findExtension(name);
        }
    }, recursive ? TrueFileFilter.INSTANCE : null);
}

From source file:fr.paris.lutece.util.jpa.JPAPersistenceUnitPostProcessor.java

/**
 * Search for <code>WEB-INF/conf/plugins/*.orm.xml</code>.
 * @return list of files found/*from   w  w w  . ja va  2s  . c o m*/
 */
private Collection<File> getListORMFiles() {
    String strConfPath = AppPathService.getAbsolutePathFromRelativePath(PATH_CONF);
    File dirConfPlugins = new File(strConfPath);

    return FileUtils.listFiles(dirConfPlugins, FileFilterUtils.suffixFileFilter(SUFFIX_ORM_XML),
            TrueFileFilter.INSTANCE);
}

From source file:io.neba.core.logviewer.LogFiles.java

@SuppressWarnings("unchecked")
public Collection<File> resolveLogFiles() throws IOException {
    File logDir = getLogfileDirectory();
    Collection<File> logFiles = new TreeSet<>((o1, o2) -> {
        return o1.getPath().compareToIgnoreCase(o2.getPath());
    });/*from  w  w w. j  a va2s . com*/

    if (logDir == null) {
        // No configured log file directory exists, assume the default
        logDir = new File(this.slingHomeDirectory, "logs");
    }

    // The log directory may be removed during runtime - always check access.
    if (logDir.exists() && logDir.isDirectory()) {
        logFiles.addAll(listFiles(logDir, LOGFILE_FILTER, TrueFileFilter.INSTANCE));
    }

    for (File logFile : resolveFactoryConfiguredLogFiles()) {
        if (!logFile.getParentFile().getAbsolutePath().startsWith(logDir.getAbsolutePath())) {
            logFiles.addAll(listFiles(logFile.getParentFile(), LOGFILE_FILTER, TrueFileFilter.INSTANCE));
        }
    }
    return logFiles;
}

From source file:com.edsoft.teknosaproject.bean.ReportBean.java

public String reportDirectory() {
    path = Paths.get(DIR, "AnaDepo", family, type, brand, document);
    //path = Paths.get("D:", "Teknosa", family, type, brand, document);
    list = (List<File>) FileUtils.listFiles(path.toFile(), TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
    ConnectBean.list = list;/* ww w .j  a v  a  2  s .  c  om*/
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(path.toString()));
    return "rapor2";
}

From source file:ibeam.maven.plugins.Tools.java

/**
 * List recursively all the files and folder of a given directory.
 * /*ww w .ja  v a  2  s. c  o m*/
 * @param file
 * @return a list of the files and folders contained by the given directory
 */
public static List<File> listFilesAndFolders(final File file) {

    return (List<File>) FileUtils.listFilesAndDirs(file, TrueFileFilter.INSTANCE,
            DirectoryFileFilter.DIRECTORY);
}

From source file:com.przyjaznyplan.utils.CsvConverter.java

private void ifImageGetIt(String value, ContentValues sqlValues) {
    if (value != null && (value.endsWith(JPG_EXT) || value.endsWith(JPEG_EXT) || value.endsWith(PNG_EXT))) {

        Collection files = FileUtils.listFiles(new File(rootFolder), new NameFileFilter(value),
                TrueFileFilter.INSTANCE);
        Iterator<File> iterator = files.iterator();
        if (iterator.hasNext()) {
            File f = iterator.next();
            sqlValues.put(Czynnosc.IMAGE, f.getAbsolutePath());
        }/*from w  w w.j av  a 2 s.c  o  m*/

    }
}

From source file:bioLockJ.module.classifier.r16s.qiime.QiimePreprocessor.java

/**
 * Input files must be initialized.  If first executor, read in input dir from props, otherwise,
 * check for merged files.  Call setModuleInput based on merged files, or files in dir.
 *//*w  w  w .  j  av  a2  s .  c o m*/
@Override
protected void initInputFiles(File dir) throws Exception {
    if (dir == null) // get from prop file
    {
        dir = getInputDirs(dir).get(0);
    }

    setModuleInput(dir, TrueFileFilter.INSTANCE, null);
}

From source file:com.amazonaws.eclipse.dynamodb.testtool.TestToolProcess.java

/**
 * Searches within the install directory for the native libraries required
 * by DyanmoDB Local (i.e. SQLite) and returns the directory containing the
 * native libraries./*from   w ww. j a  va2s.  co  m*/
 *
 * @return The directory within the install directory where native libraries
 *         were found; otherwise, if no native libraries are found, the
 *         install directory is returned.
 */
private File findLibraryDirectory() {
    // Mac and Linux libraries start with "libsqlite4java-" so
    // use that pattern to identify the library directory
    IOFileFilter fileFilter = new AbstractFileFilter() {
        public boolean accept(File dir, String name) {
            return name.startsWith("libsqlite4java-");
        }
    };

    Collection<File> files = FileUtils.listFiles(installDirectory, fileFilter, TrueFileFilter.INSTANCE);

    // Log a warning if we can't identify the library directory,
    // and then just try to use the install directory
    if (files == null || files.isEmpty()) {
        Status status = new Status(IStatus.WARNING, DynamoDBPlugin.PLUGIN_ID,
                "Unable to find DynamoDB Local native libraries in " + installDirectory);
        AwsToolkitCore.getDefault().getLog().log(status);
        return installDirectory;
    }

    return files.iterator().next().getParentFile();
}

From source file:ibeam.maven.plugins.Tools.java

/**
 * List recursively all folder of a given directory.
 * //from w  w  w.j  a  v  a2 s  .  c  o  m
 * @param file
 * @return file a list of the folders and only folders (files are not listed) contained by the given directory
 */
public static List<File> listFolders(final File file) {

    return (List<File>) FileUtils.listFilesAndDirs(file, new NotFileFilter(TrueFileFilter.INSTANCE),
            DirectoryFileFilter.DIRECTORY);
}

From source file:de.extra.client.plugins.outputplugin.mtomws.WsCxfIT.java

/**
 * @return/*from  w ww . j  a va2 s.co m*/
 * @throws XmlMappingException
 * @throws IOException
 */
private List<RequestTransport> createTestsTransportsWithFileAttachment()
        throws XmlMappingException, IOException {
    logger.info("Looking for Inptut into the Directory: " + inputDirectory.getAbsolutePath());
    final List<RequestTransport> transports = new ArrayList<RequestTransport>();
    final Collection<File> listFiles = FileUtils.listFiles(inputDirectory, TrueFileFilter.INSTANCE, null);
    for (final File inputFile : listFiles) {
        final RequestTransport requestTransport = createDummyRequestTransport();
        final RequestTransport filledTransport = fillInputFile(requestTransport, inputFile);
        transports.add(filledTransport);
        logger.info("Find File to send: " + inputFile.getName());
        logger.info("ChecksumCRC32: " + FileUtils.checksumCRC32(inputFile));
        logger.info("Filesize: " + FileUtils.sizeOf(inputFile));
    }
    return transports;
}