Package com.asakusafw.runtime.util

Examples of com.asakusafw.runtime.util.VariableTable


                                targetName, jobflowId, tableName, fileName);
                        return false;
                    } else {
                        try {
                            // 有効なパスかチェック
                            VariableTable variables = Constants.createVariableTable();
                            variables.defineVariable(Constants.HDFS_PATH_VARIABLE_USER, "dummyuser");
                            variables.defineVariable(Constants.HDFS_PATH_VARIABLE_EXECUTION_ID, "dummyid");
                            String dummyPath = variables.parse(element, false);
                            new URI(dummyPath).normalize();
                        } catch (URISyntaxException e) {
                            LOG.error(e, "TG-COMMON-00005",
                                    "HDFS上のディレクトリが有効でない",
                                    targetName, jobflowId, tableName, fileName);
View Full Code Here


    }

    private String resolvePath(String path) {
        assert path != null;
        Map<String, String> arguments = driverContext.getArguments();
        VariableTable variables = new VariableTable();
        variables.defineVariables(arguments);
        return variables.parse(path, false);
    }
View Full Code Here

    }

    @Override
    public void truncate(FileImporterDescription description, TestContext context) throws IOException {
        LOG.info("インポート元をクリアしています: {}", description);
        VariableTable variables = createVariables(context);
        Configuration config = configurations.newInstance();
        FileSystem fs = FileSystem.get(config);
        for (String path : description.getPaths()) {
            String resolved = variables.parse(path, false);
            Path target = fs.makeQualified(new Path(resolved));
            LOG.debug("ファイルを削除しています: {}", target);
            boolean succeed = fs.delete(target, true);
            LOG.debug("ファイルを削除しました (succeed={}): {}", succeed, target);
        }
View Full Code Here

                public void write(V model) throws IOException {
                    return;
                }
            };
        }
        VariableTable variables = createVariables(context);
        String destination = path.iterator().next().replace('*', '_');
        String resolved = variables.parse(destination, false);
        Configuration conf = configurations.newInstance();
        FileOutputFormat output = getOpposite(conf, description.getInputFormat());
        FileDeployer deployer = new FileDeployer(conf);
        return deployer.openOutput(definition, resolved, output);
    }
View Full Code Here

        return deployer.openOutput(definition, resolved, output);
    }

    private VariableTable createVariables(TestContext context) {
        assert context != null;
        VariableTable result = new VariableTable();
        result.defineVariables(context.getArguments());
        return result;
    }
View Full Code Here

    @Override
    public void truncate(
            FileExporterDescription description,
            TestContext context) throws IOException {
        LOG.info("エクスポート先をクリアしています: {}", description);
        VariableTable variables = createVariables(context);
        Configuration config = configurations.newInstance();
        String resolved = variables.parse(description.getPathPrefix(), false);
        Path path = new Path(resolved);
        FileSystem fs = path.getFileSystem(config);
        Path output = path.getParent();
        Path target;
        if (output == null) {
View Full Code Here

            DataModelDefinition<V> definition,
            FileExporterDescription description,
            TestContext context) throws IOException {
        LOG.info("エクスポート先の初期値を設定します: {}", description);
        checkType(definition, description);
        VariableTable variables = createVariables(context);
        String destination = description.getPathPrefix().replace('*', '_');
        String resolved = variables.parse(destination, false);
        Configuration conf = configurations.newInstance();
        FileOutputFormat output = ReflectionUtils.newInstance(description.getOutputFormat(), conf);
        FileDeployer deployer = new FileDeployer(conf);
        return deployer.openOutput(definition, resolved, output);
    }
View Full Code Here

    public <V> DataModelSource createSource(
            DataModelDefinition<V> definition,
            FileExporterDescription description,
            TestContext context) throws IOException {
        LOG.info("エクスポート結果を取得します: {}", description);
        VariableTable variables = createVariables(context);
        checkType(definition, description);
        Configuration conf = configurations.newInstance();
        Job job = JobCompatibility.newJob(conf);
        String resolved = variables.parse(description.getPathPrefix(), false);
        FileInputFormat.setInputPaths(job, new Path(resolved));
        TaskAttemptContext taskContext = JobCompatibility.newTaskAttemptContext(
                job.getConfiguration(),
                JobCompatibility.newTaskAttemptId(JobCompatibility.newTaskId(JobCompatibility.newJobId())));
        FileInputFormat<?, V> format = getOpposite(conf, description.getOutputFormat());
View Full Code Here

        return result;
    }

    private VariableTable createVariables(TestContext context) {
        assert context != null;
        VariableTable result = new VariableTable();
        result.defineVariables(context.getArguments());
        return result;
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.runtime.util.VariableTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.