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


Java FilesDataUnit.Iteration方法代码示例

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


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

示例1: prepareInputFiles

import eu.unifiedviews.dataunit.files.FilesDataUnit; //导入方法依赖的package包/类
private File prepareInputFiles() {
    File filesToProcessList = null;
    FileWriter writer = null;
    try {
        filesToProcessList = new File(new File(URI.create(filesOutput.getBaseFileURIString())), "filesList.txt");
        writer = new FileWriter(filesToProcessList, true);
        FilesDataUnit.Iteration iteration = filesInput.getIteration();
        while (iteration.hasNext()) {
            File inpF = FilesDataUnitUtils.asFile(iteration.next());
            writer.write(inpF.getAbsolutePath() + "\n");
        }
    } catch (DataUnitException | IOException ex) {
        LOG.error("Error preparing input files.", ex);
    } finally {
        IOUtils.closeQuietly(writer);
    }
    return filesToProcessList;
}
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:19,代码来源:ExecuteShellScript.java

示例2: getFilesMap

import eu.unifiedviews.dataunit.files.FilesDataUnit; //导入方法依赖的package包/类
/**
 * Gets file entries from the given {@link eu.unifiedviews.dataunit.files.FilesDataUnit}.
 * This method internally iterates over entries in the {@link eu.unifiedviews.dataunit.files.FilesDataUnit} and stores the entries into one {@link Map} of
 * entries.
 * Only suitable for ~10000 of entries (files) in the given {@link eu.unifiedviews.dataunit.files.FilesDataUnit}, because all entries are stored into a
 * {@link Set}. For bigger amounts of files, it is better to directly use {@link eu.unifiedviews.dataunit.files.FilesDataUnit.Iteration} to iterate over the
 * files and directly process them.
 * 
 * @param filesDataUnit
 *            data unit from which the entries are fetched
 * @return {@link Map} containing all entries in the given data unit, keys are symbolic names
 * @throws DataUnitException
 */
public static Map<String, FilesDataUnit.Entry> getFilesMap(FilesDataUnit filesDataUnit) throws DataUnitException {
    if (filesDataUnit == null) {
        return new LinkedHashMap<>();
    }
    FilesDataUnit.Iteration iteration = filesDataUnit.getIteration();
    Map<String, FilesDataUnit.Entry> resultSet = new LinkedHashMap<>();
    try {
        while (iteration.hasNext()) {
            FilesDataUnit.Entry entry = iteration.next();
            resultSet.put(entry.getSymbolicName(), entry);
        }
    } finally {
        iteration.close();
    }
    return resultSet;
}
 
开发者ID:UnifiedViews,项目名称:Plugin-DevEnv,代码行数:30,代码来源:FilesHelper.java

示例3: getFiles

import eu.unifiedviews.dataunit.files.FilesDataUnit; //导入方法依赖的package包/类
/**
 * Gets file entries from the given {@link eu.unifiedviews.dataunit.files.FilesDataUnit}.
 * This method internally iterates over entries in the {@link eu.unifiedviews.dataunit.files.FilesDataUnit} and stores the entries into one {@link Set} of
 * entries.
 * Only suitable for ~10000 of entries (files) in the given {@link eu.unifiedviews.dataunit.files.FilesDataUnit}, because all entries are stored into a
 * {@link Set}. For bigger amounts of files, it is better to directly use {@link eu.unifiedviews.dataunit.files.FilesDataUnit.Iteration} to iterate over the
 * files and directly process them.
 * 
 * @param filesDataUnit
 *            data unit from which the entries are fetched
 * @return {@link Set} containing all entries in the given data unit
 * @throws DataUnitException
 */
public static Set<FilesDataUnit.Entry> getFiles(FilesDataUnit filesDataUnit) throws DataUnitException {
    if (filesDataUnit == null) {
        return new LinkedHashSet<>();
    }
    FilesDataUnit.Iteration iteration = filesDataUnit.getIteration();
    Set<FilesDataUnit.Entry> resultSet = new LinkedHashSet<>();
    try {
        while (iteration.hasNext()) {
            FilesDataUnit.Entry entry = iteration.next();
            resultSet.add(entry);
        }
    } finally {
        iteration.close();
    }
    return resultSet;
}
 
开发者ID:UnifiedViews,项目名称:Plugin-DevEnv,代码行数:30,代码来源:FilesHelper.java

示例4: test

import eu.unifiedviews.dataunit.files.FilesDataUnit; //导入方法依赖的package包/类
@Test
    public void test() throws Exception {
        ExecuteShellScriptConfig_V1 config = new ExecuteShellScriptConfig_V1();
        config.setConfiguration("Copy-of-");
        URL file = null;
        if (SystemUtils.IS_OS_WINDOWS) {
            file = Thread.currentThread().getContextClassLoader().getResource("pokus.bat");
        } else if (SystemUtils.IS_OS_UNIX) {
            file = Thread.currentThread().getContextClassLoader().getResource("pokus.sh");
        }
        File f = new File(file.toURI());
        config.setScriptName(f.getName());

        // Prepare test environment.
        TestEnvironment environment = new TestEnvironment();
        environment.getContext().getEnvironment().put(ExecuteShellScript.SHELL_SCRIPT_PATH, f.getParent());
        WritableFilesDataUnit filesOutput = environment.createFilesOutput("filesOutput");
        // Prepare data unit.
        WritableFilesDataUnit filesInput = environment.createFilesInput("filesInput");
        filesInput.addExistingFile("t1", Thread.currentThread().getContextClassLoader().getResource("test1.txt").toString());
        filesInput.addExistingFile("t2", Thread.currentThread().getContextClassLoader().getResource("test2.txt").toString());
        filesInput.addExistingFile("t3", Thread.currentThread().getContextClassLoader().getResource("test3.txt").toString());

        // Prepare DPU.
        ExecuteShellScript dpu = new ExecuteShellScript();
        dpu.configure((new ConfigurationBuilder()).setDpuConfiguration(config).toString());

        try {
            // Run.
            environment.run(dpu);

            FilesDataUnit.Iteration iteration = filesInput.getIteration();
            while (iteration.hasNext()) {
                File inpF = FilesDataUnitUtils.asFile(iteration.next());
//                File outF = new File(config.getOutputDir(), config.getConfiguration() + inpF.getName());
                File parentDir = new File(URI.create(filesOutput.getBaseFileURIString() + "tmp"));
                File outF = new File(parentDir.getAbsolutePath(), config.getConfiguration() + inpF.getName());
                Assert.assertTrue(outF.exists());
            }

        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            // Release resources.
            environment.release();
        }
    }
 
开发者ID:UnifiedViews,项目名称:Plugins,代码行数:48,代码来源:ExecuteShellScriptTest.java


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