use of java.io.FilenameFilter in project tdi-studio-se by Talend.
the class JavaJobExportReArchieveCreator method getLibJarFilenames.
private String[] getLibJarFilenames() {
if (libFolder != null) {
File[] files = libFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(FileConstants.JAR_FILE_SUFFIX) || name.toLowerCase().endsWith(FileConstants.ZIP_FILE_SUFFIX) ? true : false;
}
});
String[] filenames = new String[files.length];
for (int i = 0; i < files.length; i++) {
filenames[i] = files[i].getName();
}
return filenames;
}
return null;
}
use of java.io.FilenameFilter in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class UserHistoryDictionaryTestsHelper method removeAllTestDictFiles.
/**
* Remove all the test dictionary files created for the given locale.
*/
public static void removeAllTestDictFiles(final String filter, final Context context) {
final FilenameFilter filenameFilter = new FilenameFilter() {
@Override
public boolean accept(final File dir, final String filename) {
return filename.startsWith(UserHistoryDictionary.NAME + "." + filter);
}
};
FileUtils.deleteFilteredFiles(context.getFilesDir(), filenameFilter);
}
use of java.io.FilenameFilter in project jangaroo-tools by CoreMedia.
the class ExmlValidator method addXsdMappingsFromFilesInDirectory.
private boolean addXsdMappingsFromFilesInDirectory(Map<String, ExmlSchemaSource> schemas, File xsdsDirectory) {
if (xsdsDirectory != null && xsdsDirectory.exists() && xsdsDirectory.isDirectory()) {
File[] xsds = xsdsDirectory.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".xsd");
}
});
for (final File xsd : xsds) {
String namespace = Exmlc.EXML_CONFIG_URI_PREFIX + CompilerUtils.removeExtension(xsd.getName());
// System.out.println("### adding EXML schema " + namespace + " from " + xsd.getPath());
schemas.put(namespace, new ExmlSchemaFileSource(xsd));
}
return true;
}
return false;
}
use of java.io.FilenameFilter in project atmosphere by Atmosphere.
the class AtmosphereFramework method autoConfigureService.
protected void autoConfigureService(ServletContext sc) throws IOException {
String path = handlersPath != DEFAULT_HANDLER_PATH ? handlersPath : realPath(sc, handlersPath);
try {
annotationProcessor = newClassInstance(AnnotationProcessor.class, (Class<AnnotationProcessor>) IOUtils.loadClass(getClass(), annotationProcessorClassName));
logger.info("Atmosphere is using {} for processing annotation", annotationProcessorClassName);
annotationProcessor.configure(config);
if (!packages.isEmpty()) {
for (String s : packages) {
annotationProcessor.scan(s);
}
}
// Second try.
if (!annotationFound) {
if (path != null) {
annotationProcessor.scan(new File(path));
}
// Always scan library
String pathLibs = libPath != DEFAULT_LIB_PATH ? libPath : realPath(sc, DEFAULT_LIB_PATH);
if (pathLibs != null) {
File libFolder = new File(pathLibs);
File[] jars = libFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File arg0, String arg1) {
return arg1.endsWith(".jar");
}
});
if (jars != null) {
for (File file : jars) {
annotationProcessor.scan(file);
}
}
}
}
if (!annotationFound && allowAllClassesScan) {
logger.debug("Scanning all classes on the classpath");
annotationProcessor.scanAll();
}
} catch (Throwable e) {
logger.error("", e);
return;
} finally {
if (annotationProcessor != null) {
annotationProcessor.destroy();
}
}
}
use of java.io.FilenameFilter in project atmosphere by Atmosphere.
the class DefaultAnnotationProcessor method scanForAnnotation.
private void scanForAnnotation(AtmosphereFramework f) {
List<String> packages = f.customAnnotationPackages();
AnnotationDetector detector = new AnnotationDetector(atmosphereReporter);
try {
if (!packages.isEmpty()) {
for (String p : packages) {
logger.trace("Package {} scanned for @AtmosphereAnnotation", p);
detector.detect(p);
}
}
// Now look for application defined annotation
String path = IOUtils.realPath(f.getServletContext(), f.getHandlersPath());
if (path != null) {
detector.detect(new File(path));
}
String pathLibs = IOUtils.realPath(f.getServletContext(), f.getLibPath());
if (pathLibs != null) {
File libFolder = new File(pathLibs);
File[] jars = libFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File arg0, String arg1) {
return arg1.endsWith(".jar");
}
});
if (jars != null) {
for (File file : jars) {
detector.detect(file);
}
}
}
// https://github.com/Atmosphere/atmosphere/issues/1292
if (!coreAnnotationsFound.get()) {
fallbackToManualAnnotatedClasses(getClass(), f, handler);
}
} catch (IOException e) {
logger.warn("Unable to scan annotation", e);
} finally {
detector.destroy();
}
}
Aggregations