当前位置: 首页>>代码示例>>Java>>正文


Java Utils.recursiveListFiles方法代码示例

本文整理汇总了Java中gov.nih.nci.cagrid.common.Utils.recursiveListFiles方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.recursiveListFiles方法的具体用法?Java Utils.recursiveListFiles怎么用?Java Utils.recursiveListFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gov.nih.nci.cagrid.common.Utils的用法示例。


在下文中一共展示了Utils.recursiveListFiles方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listHistoryFilesByDate

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private List<File> listHistoryFilesByDate() {
    final File historyDir = getHistoryDirectory();
    List<File> historyFiles = Utils.recursiveListFiles(historyDir, new FileFilter() {
           public boolean accept(File pathname) {
               return pathname.getName().endsWith(".xml") || pathname.isDirectory();
           }
       });
    Comparator<File> comp = new Comparator<File>() {
           public int compare(File o1, File o2) {
               int val = 0;
               try {
                   String rel1 = Utils.getRelativePath(historyDir, o1);
                   String rel2 = Utils.getRelativePath(historyDir, o2);
                   val = rel1.compareTo(rel2);
               } catch (Exception ex) {
                   // uhoh
               }
               return val;
           }
       };
       Collections.sort(historyFiles, comp);
       return historyFiles;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:24,代码来源:HistoryManager.java

示例2: getDirectoryClassNames

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * Gets class names from the given directory of .class files
 * @param directory
 * @return
 *      A List of Class names
 */
private List<String> getDirectoryClassNames(File directory) {
    List<File> classFiles = Utils.recursiveListFiles(directory, new FileFilter() {
        public boolean accept(File pathname) {
            return pathname.getName().toLowerCase().endsWith(CLASS_EXTSNSION);
        }
    });
    List classNames = new ArrayList(classFiles.size());
    int baseDirNameLength = directory.getAbsolutePath().length() + 1;
    for (File classFile : classFiles) {
        String rawName = classFile.getAbsolutePath();
        rawName = rawName.substring(baseDirNameLength);
        rawName = rawName.substring(0, rawName.length() - CLASS_EXTSNSION.length());
        rawName = rawName.replace(File.separatorChar, '.');
        classNames.add(rawName);
    }
    return classNames;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:24,代码来源:ServiceTypePanel.java

示例3: main

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
    File base = new File("/Users/ervin/Projects/caGrid/caGrid-1_5_release/Software/core");
    try {
        List<File> classpaths = Utils.recursiveListFiles(base, new FileFilter() {
            
            @Override
            public boolean accept(File pathname) {
                return pathname.getName().equals(".classpath");
            }
        });
        for (File f : classpaths) {
            if (f.isFile()) {
                System.out.println("Editing " + f.getAbsolutePath());
                FileInputStream fis = new FileInputStream(f);
                StringBuffer buf = Utils.inputStreamToStringBuffer(fis);
                fis.close();
                String edited = buf.toString().replace("GT4_LOCATION", "GT4_SHA2_LOCATION");
                Utils.stringBufferToFile(new StringBuffer(edited), f);
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:28,代码来源:ClasspathFixer.java

示例4: listHistoryFilesByDate

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private List<File> listHistoryFilesByDate() {
	final File historyDir = getHistoryDirectory();
	List<File> historyFiles = Utils.recursiveListFiles(historyDir, new FileFilter() {
		public boolean accept(File pathname) {
			return pathname.getName().endsWith(".xml") || pathname.isDirectory();
		}
	});
	Comparator<File> comp = new Comparator<File>() {
		public int compare(File o1, File o2) {
			int val = 0;
			try {
				String rel1 = Utils.getRelativePath(historyDir, o1);
				String rel2 = Utils.getRelativePath(historyDir, o2);
				val = rel1.compareTo(rel2);
			} catch (Exception ex) {
				// uhoh
			}
			return val;
		}
	};
	Collections.sort(historyFiles, comp);
	return historyFiles;
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:24,代码来源:DefaultHistoryManager.java

示例5: copyMetadataSchemas

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private void copyMetadataSchemas(String schemaDir) throws Exception {
    System.out.println("Copying schemas to " + schemaDir);
    File extensionSchemaDir = new File(ExtensionsLoader.EXTENSIONS_DIRECTORY + File.separator
        + MetadataConstants.EXTENSION_NAME + File.separator + "schema");
    List<File> schemaFiles = Utils.recursiveListFiles(extensionSchemaDir, new FileFilters.XSDFileFilter());
    for (int i = 0; i < schemaFiles.size(); i++) {
        File schemaFile = schemaFiles.get(i);
        String subname = schemaFile.getCanonicalPath().substring(
            extensionSchemaDir.getCanonicalPath().length() + File.separator.length());
        copySchema(subname, schemaDir);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:13,代码来源:ServiceMetadataCreationPostProcessor.java

示例6: main

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
    try {
        MappingTool tool = new MappingTool();
        File srcDir = new File("src/java/beans/dcql2");
        List<File> files = Utils.recursiveListFiles(srcDir, new FileFilter() {
            public boolean accept(File pathname) {
                return pathname.getName().endsWith(".java");
            }
        });
        for (File f : files) {
            if (f.isFile() && !f.getName().startsWith("MappingDriver")) {
                String path = Utils.getRelativePath(srcDir, f.getCanonicalFile());
                path = path.substring(0, path.length() - 5);
                String className = path.replace(File.separatorChar, '.');
                System.out.println("Found " + className);
                System.out.flush();
                tool.addClass(className);
            }
        }
        StringWriter writer = new StringWriter();
        tool.write(writer);
        String pretty = XMLUtilities.formatXML(writer.getBuffer().toString());
        System.out.println(pretty);
    } catch (Exception ex) {
        ex.printStackTrace();
    }

}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:32,代码来源:MappingDriver.java

示例7: copyDataServiceSchemas

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private void copyDataServiceSchemas(ServiceInformation serviceInfo) throws CreationExtensionException {
    // grab cql query and result set schemas and move them into the
    // service's directory
    String schemaDir = getServiceSchemaDir(serviceInfo);
    log.debug("Copying schemas to " + schemaDir);
    FileFilter dataXsdFilter = new FileFilter() {
        public boolean accept(File pathname) {
            if (pathname.isDirectory() || pathname.getName().endsWith(".xsd")) {
                return !pathname.getName().equals(WsEnumConstants.ENUMERATION_WSDL_NAME)
                    && !pathname.getName().equals(WsEnumConstants.ENUMERATION_XSD_NAME)
                    && !pathname.getName().equals(WsEnumConstants.ADDRESSING_XSD_NAME);
            }
            return false;
        }
    };
    // get schemas for data services
    File baseSchemaDir = new File(ExtensionsLoader.getInstance().getExtensionsDir(),
        "data" + File.separator + "schema");
    File dataSchemaDir = new File(baseSchemaDir, "Data");
    List<File> dataSchemaFiles = Utils.recursiveListFiles(dataSchemaDir, dataXsdFilter);
    // also copy the WSDLs for data services
    dataSchemaFiles.add(new File(dataSchemaDir, "DataService.wsdl"));
    dataSchemaFiles.add(new File(dataSchemaDir, "Cql2DataService.wsdl"));
    try {
        for (File schemaFile : dataSchemaFiles) {
            String subname = schemaFile.getAbsolutePath().substring(
                dataSchemaDir.getAbsolutePath().length() + File.separator.length());
            File schemaOut = new File(schemaDir + File.separator + subname);
            Utils.copyFile(schemaFile, schemaOut);
        }
    } catch (Exception ex) {
        throw new CreationExtensionException(
            "Error copying data service schemas: " + ex.getMessage(), ex);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:36,代码来源:DataServiceQueryOperationProviderCreator.java

示例8: countXmlDocsInHistory

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
private int countXmlDocsInHistory() {
    List<File> history = Utils.recursiveListFiles(tempHistoryDir, new FileFilter() {
        public boolean accept(File pathname) {
            return pathname.getName().endsWith(".xml");
        }
    });
    int count = 0;
    for (File f : history) {
        if (f.isFile() && f.getName().endsWith(".xml")) {
            count++;
        }
    }
    return count;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:15,代码来源:HistoryManagerTestCase.java

示例9: getAvailableAuditorClasses

import gov.nih.nci.cagrid.common.Utils; //导入方法依赖的package包/类
public static List<Class> getAvailableAuditorClasses(File libDir) throws MalformedURLException, IOException {
    // list jars from the lib dir as URLs
    List jarFiles = Utils.recursiveListFiles(libDir, new FileFilters.JarFileFilter());
    List<URL> jarUrls = new LinkedList<URL>();
    for (int i = 0; i < jarFiles.size(); i++) {
        File jarFile = (File) jarFiles.get(i);
        if (jarFile.isFile()) {
            jarUrls.add(jarFile.toURL());
        }
    }
    URL[] urlArray = new URL[jarUrls.size()];
    jarUrls.toArray(urlArray);
    System.out.println("Looking for data service auditor subclasses");
    // load all subclasses of DataServiceAuditor
    List<Class> subclasses = new LinkedList<Class>();
    for (int i = 0; i < jarFiles.size(); i++) {
        // loader created each time because 
        // iterating over many classes clogs up the cache in the loader
        ClassLoader loader = new URLClassLoader(urlArray);
        JarFile jar = new JarFile((File) jarFiles.get(i));
        Enumeration jarEntries = jar.entries();
        while (jarEntries.hasMoreElements()) {
            JarEntry entry = (JarEntry) jarEntries.nextElement();
            String name = entry.getName();
            if (name.endsWith(".class")) {
                name = name.replace('/', '.');
                name = name.substring(0, name.length() - 6);
                Class loadedClass = null;
                try {
                    loadedClass = loader.loadClass(name);
                } catch (Throwable e) {
                    // theres a lot of these...
                    // System.err.println("Error loading class (" + name
                    // + "):" + e.getMessage());
                }
                if (loadedClass != null && DataServiceAuditor.class.isAssignableFrom(loadedClass)
                    && !DataServiceAuditor.class.getName().equals(loadedClass.getName())) {
                    subclasses.add(loadedClass);
                }
            }
        }
        loader = null;
        jar.close();
    }
    return subclasses;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:47,代码来源:AuditorsLoader.java


注:本文中的gov.nih.nci.cagrid.common.Utils.recursiveListFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。