org.apache.commons.io.filefilter.AbstractFileFilter Java Examples

The following examples show how to use org.apache.commons.io.filefilter.AbstractFileFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RunnerUtils.java    From wisdom with Apache License 2.0 5 votes vote down vote up
/**
 * Checks if a file having somewhat the current tested application name is contained in the given directory. This
 * method follows the default maven semantic. The final file is expected to have a name compliant with the
 * following rules: <code>artifactId-version.jar</code>. If the version ends with <code>-SNAPSHOT</code>,
 * it just checks for <code>artifactId-stripped_version</code>, where stripped version is the version without the
 * <code>SNAPSHOT</code> part.
 * <p>
 * The artifactId and version are read from the <code>target/osgi/osgi.properties</code> file,
 * that should have been written by the Wisdom build process.
 *
 * @param directory the directory
 * @return the bundle file if found
 * @throws java.io.IOException if something bad happens.
 */
public static File detectApplicationBundleIfExist(File directory) throws IOException {
    Properties properties = getMavenProperties();
    if (properties == null || directory == null || !directory.isDirectory()) {
        return null;
    }

    final String artifactId = properties.getProperty("project.artifactId");
    final String groupId = properties.getProperty("project.groupId");
    final String bsn = getBundleSymbolicName(groupId, artifactId);
    String version = properties.getProperty("project.version");
    final String strippedVersion;
    if (version.endsWith("-SNAPSHOT")) {
        strippedVersion = version.substring(0, version.length() - "-SNAPSHOT".length());
    } else {
        strippedVersion = version;
    }

    Iterator<File> files = FileUtils.iterateFiles(directory, new AbstractFileFilter() {
        @Override
        public boolean accept(File file) {
            return file.isFile()
                    && file.getName().startsWith(bsn + "-" + strippedVersion)
                    && file.getName().endsWith(".jar");
        }
    }, TrueFileFilter.INSTANCE);

    if (files.hasNext()) {
        return files.next();
    }
    return null;
}
 
Example #2
Source File: VaadinConnectTsGenerator.java    From flow with Apache License 2.0 5 votes vote down vote up
private static Collection<File> getFilesToDelete(Set<File> generatedFiles,
        File outputDirFile) {
    return FileUtils.listFiles(outputDirFile, new AbstractFileFilter() {
        @Override
        public boolean accept(File file) {
            return shouldDelete(generatedFiles, file);
        }
    }, TrueFileFilter.INSTANCE);
}
 
Example #3
Source File: JavaWhitespaceTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	final TokenizerImplementation tok = new TokenizerImplementation();
	return tok.getFileFilter();
}
 
Example #4
Source File: CDTTokenizer.java    From tassal with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return C_CODE_TOKENIZER;
}
 
Example #5
Source File: CppWhitespaceTokenizer.java    From tassal with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return CPP_CODE_FILTER;
}
 
Example #6
Source File: AbstractCdtASTAnnotatedTokenizer.java    From tassal with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return baseTokenizer.getFileFilter();
}
 
Example #7
Source File: CppTokenTypeTokenizer.java    From tassal with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return CPP_CODE_FILTER;
}
 
Example #8
Source File: AbstractPythonTokenizer.java    From tassal with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return pythonCodeFilter;
}
 
Example #9
Source File: JavascriptTokenizer.java    From tassal with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return JAVASCRIPT_CODE_FILTER;
}
 
Example #10
Source File: FormattingTokenizer.java    From tassal with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return baseTokenizer.getFileFilter();
}
 
Example #11
Source File: JavaTypeTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return baseTokenizer.getFileFilter();
}
 
Example #12
Source File: JavaTokenTypeTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return javaCodeFiler;
}
 
Example #13
Source File: JavaWhitespaceTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return javaCodeFilter;
}
 
Example #14
Source File: FormattingTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return baseTokenizer.getFileFilter();
}
 
Example #15
Source File: JavaASTAnnotatedTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return baseTokenizer.getFileFilter();
}
 
Example #16
Source File: JavaTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return javaCodeFileFilter;
}
 
Example #17
Source File: AbstractJygmentsTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return codeFilter;
}
 
Example #18
Source File: CDTTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return C_CODE_TOKENIZER;
}
 
Example #19
Source File: CppWhitespaceTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return CPP_CODE_FILTER;
}
 
Example #20
Source File: AbstractCdtASTAnnotatedTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return baseTokenizer.getFileFilter();
}
 
Example #21
Source File: CppTokenTypeTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return CPP_CODE_FILTER;
}
 
Example #22
Source File: AbstractPythonTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return pythonCodeFilter;
}
 
Example #23
Source File: JavascriptTokenizer.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return JAVASCRIPT_CODE_FILTER;
}
 
Example #24
Source File: CppTokenTypeTokenizer.java    From api-mining with GNU General Public License v3.0 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return CPP_CODE_FILTER;
}
 
Example #25
Source File: JavaTypeTokenizer.java    From api-mining with GNU General Public License v3.0 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return baseTokenizer.getFileFilter();
}
 
Example #26
Source File: JavaTokenTypeTokenizer.java    From api-mining with GNU General Public License v3.0 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return javaCodeFiler;
}
 
Example #27
Source File: JavaWhitespaceTokenizer.java    From api-mining with GNU General Public License v3.0 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return javaCodeFilter;
}
 
Example #28
Source File: JavaWhitespaceTokenizer.java    From api-mining with GNU General Public License v3.0 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	final TokenizerImplementation tok = new TokenizerImplementation();
	return tok.getFileFilter();
}
 
Example #29
Source File: JavaASTAnnotatedTokenizer.java    From api-mining with GNU General Public License v3.0 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return baseTokenizer.getFileFilter();
}
 
Example #30
Source File: JavaTokenizer.java    From api-mining with GNU General Public License v3.0 4 votes vote down vote up
@Override
public AbstractFileFilter getFileFilter() {
	return javaCodeFileFilter;
}