use of java.io.FileFilter in project ACS by ACS-Community.
the class ConfigFileFinder method run.
/**
* Gets all Files under {@link #baseDir} whose name ends with any of the Strings given in {@link #fileEndings},
* and runs them through the filter chain to suppress files of known and safe content.
* @return
*/
private void run() {
String msg = "Tool " + getClass().getSimpleName() + " will search for configuration files in '" + baseDir + "' and below, suspecting all files ending with ";
for (Iterator<String> iter = fileEndings.iterator(); iter.hasNext(); ) {
msg += "'" + iter.next() + "'";
if (iter.hasNext()) {
msg += ", ";
}
}
msg += " and will then prune those files recognized by any of the filters ";
for (Iterator<ConfigFileRedeemer> iter = redeemers.iterator(); iter.hasNext(); ) {
msg += iter.next().getName();
if (iter.hasNext()) {
msg += ", ";
}
}
msg += ". ";
if (targetDir != null) {
msg += "The remaining potential config files are copied to '" + targetDir + "' with their original directory structure ";
if (targetFilesFlat) {
msg += "flattened.";
} else {
msg += "maintained.";
}
}
logger.info(msg);
FileFilter fileFilter = new FileFilter() {
public boolean accept(File pathname) {
if (pathname.isDirectory()) {
return true;
}
String name = pathname.getName();
for (Iterator iter = fileEndings.iterator(); iter.hasNext(); ) {
String fnEnding = (String) iter.next();
if (name.endsWith(fnEnding)) {
return true;
}
}
return false;
}
};
runRecursive(baseDir, fileFilter);
}
use of java.io.FileFilter in project cubrid-manager by CUBRID.
the class CubridJdbcManager method loadDefaultJdbcs.
/**
* Get JDBC driver from plugins installation directory
*
* @return the JDBC driver
*/
public void loadDefaultJdbcs() {
List<File> fileList = getDefaultJDBCPath();
for (File filePath : fileList) {
if (filePath != null && filePath.exists() && filePath.isDirectory()) {
File[] listFiles = filePath.listFiles(new FileFilter() {
public boolean accept(File file) {
String fileName = file.getName().trim().toLowerCase();
return file.isFile() && (fileName.matches("^JDBC\\S*.jar") || fileName.matches("^jdbc\\S*.jar") || fileName.matches("^CUBRID_JDBC\\S*.jar") || fileName.matches("^cubrid_jdbc\\S*.jar"));
}
});
for (File file : listFiles) {
String path = file.getAbsolutePath();
registerClassLoader(defaultVersion2FileMap, path);
}
}
}
}
use of java.io.FileFilter in project cradle by BingLau7.
the class ClassUtil method addClass.
private static void addClass(Set<Class<?>> classSet, String packagePath, String packageName) {
File[] files = new File(packagePath).listFiles(new FileFilter() {
public boolean accept(File file) {
return (file.isFile() && file.getName().endsWith(".class")) || file.isDirectory();
}
});
for (File file : files) {
String fileName = file.getName();
if (file.isFile()) {
String className = fileName.substring(0, fileName.lastIndexOf("."));
if (StringUtils.isNotEmpty(packageName)) {
className = packagePath + "." + className;
}
doAddClass(classSet, className);
} else {
String subPackagePath = fileName;
if (StringUtils.isNotEmpty(packagePath)) {
subPackagePath = packagePath + "/" + subPackagePath;
}
String subPackageName = fileName;
if (StringUtils.isNotEmpty(packageName)) {
subPackageName = packageName + "." + subPackageName;
}
addClass(classSet, subPackagePath, subPackageName);
}
}
}
use of java.io.FileFilter in project kotlin by JetBrains.
the class AbstractLoadJavaTest method doTestJavaAgainstKotlin.
protected void doTestJavaAgainstKotlin(String expectedFileName) throws Exception {
File expectedFile = new File(expectedFileName);
File sourcesDir = new File(expectedFileName.replaceFirst("\\.txt$", ""));
FileUtil.copyDir(sourcesDir, new File(tmpdir, "test"), new FileFilter() {
@Override
public boolean accept(@NotNull File pathname) {
return pathname.getName().endsWith(".java");
}
});
CompilerConfiguration configuration = KotlinTestUtils.newConfiguration(ConfigurationKind.JDK_ONLY, getJdkKind());
ContentRootsKt.addKotlinSourceRoot(configuration, sourcesDir.getAbsolutePath());
JvmContentRootsKt.addJavaSourceRoot(configuration, new File("compiler/testData/loadJava/include"));
JvmContentRootsKt.addJavaSourceRoot(configuration, tmpdir);
final KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
AnalysisResult result = TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(environment.getProject(), environment.getSourceFiles(), new CliLightClassGenerationSupport.NoScopeRecordCliBindingTrace(), configuration, new Function1<GlobalSearchScope, PackagePartProvider>() {
@Override
public PackagePartProvider invoke(GlobalSearchScope scope) {
return new JvmPackagePartProvider(environment, scope);
}
});
PackageViewDescriptor packageView = result.getModuleDescriptor().getPackage(TEST_PACKAGE_FQNAME);
checkJavaPackage(expectedFile, packageView, result.getBindingContext(), COMPARATOR_CONFIGURATION);
}
use of java.io.FileFilter in project bigbluebutton by bigbluebutton.
the class RecordingService method getDirectories.
private File[] getDirectories(String path) {
File dir = new File(path);
FileFilter fileFilter = new FileFilter() {
public boolean accept(File file) {
return file.isDirectory();
}
};
return dir.listFiles(fileFilter);
}
Aggregations