Package com.asakusafw.vocabulary.windgate

Examples of com.asakusafw.vocabulary.windgate.WindGateImporterDescription


        LOG.debug("Validating WindGate Vocabularies (batch={}, flow={})",
                getEnvironment().getBatchId(),
                getEnvironment().getFlowId());
        boolean valid = true;
        for (InputDescription input : inputs) {
            WindGateImporterDescription desc = extract(input);
            try {
                validateCommonProperties(desc);
                if (desc.getDriverScript() == null) {
                    throw new IllegalStateException(MessageFormat.format(
                            "Driver script is not defined: {0}",
                            desc.getClass().getName()));
                }
            } catch (IllegalStateException e) {
                getEnvironment().error(
                        "Importer description \"{0}\" is invalid (batch={1}, flow={2}): {3}",
                        input.getName(),
                        getEnvironment().getBatchId(),
                        getEnvironment().getFlowId(),
                        e.getMessage());
                valid = false;
            }
        }
        for (OutputDescription output : outputs) {
            WindGateExporterDescription desc = extract(output);
            try {
                validateCommonProperties(desc);
                if (desc.getDriverScript() == null) {
                    throw new IllegalStateException(MessageFormat.format(
                            "Driver script is not defined: {0}",
                            desc.getClass().getName()));
                }
            } catch (IllegalStateException e) {
                getEnvironment().error(
                        "Exporter description \"{0}\" is invalid (batch={1}, flow={2}): {3}",
                        output.getName(),
View Full Code Here


        return toGateScripts(processes);
    }

    private ProcessScript<?> toProcessScript(Input input) {
        assert input != null;
        WindGateImporterDescription desc = extract(input.getDescription());
        String location = getInputLocation(input.getDescription()).toPath('/');
        DriverScript drain = new DriverScript(
                Constants.HADOOP_FILE_RESOURCE_NAME,
                Collections.singletonMap(FileProcess.FILE.key(), location));
        return createProcessScript(
                input.getDescription().getName(),
                desc.getModelType(),
                desc.getDriverScript(),
                drain);
    }
View Full Code Here

    @Override
    public ExternalIoCommandProvider createCommandProvider(IoContext context) {
        Map<String, IoContextBuilder> importers = Maps.create();
        for (Input input : context.getInputs()) {
            WindGateImporterDescription desc = extract(input.getDescription());
            add(importers, desc.getProfileName(), input);
        }
        Map<String, IoContextBuilder> exporters = Maps.create();
        for (Output output : context.getOutputs()) {
            WindGateExporterDescription desc = extract(output.getDescription());
            add(exporters, desc.getProfileName(), output);
        }
        return new CommandProvider(
                getEnvironment().getBatchId(),
                getEnvironment().getFlowId(),
                build(importers),
View Full Code Here

            throw new IOException(MessageFormat.format(
                    "Failed to create object: {0}",
                    rest), e);
        }
        if (instance instanceof WindGateImporterDescription) {
            WindGateImporterDescription description = (WindGateImporterDescription) instance;
            ProcessScript<T> process = WindGateTestHelper.createProcessScript(
                    definition.getModelClass(),
                    description);
            ParameterList parameterList = new ParameterList(context.getArguments());
            ResourceManipulator manipulator =
View Full Code Here

    public void createImporterProcessScript() throws Exception {
        File file = folder.newFile("file");
        DriverScript driver = new DriverScript(
                "file",
                Collections.singletonMap(FileProcess.FILE.key(), file.getAbsolutePath()));
        WindGateImporterDescription description = new MockImporterDescription(String.class, "dummy", driver);
        ProcessScript<String> script = WindGateTestHelper.createProcessScript(String.class, description);

        assertThat(script.getDataClass(), equalTo(String.class));
        assertThat(script.getSourceScript().getResourceName(), is("file"));
        assertThat(script.getSourceScript().getConfiguration(), is(driver.getConfiguration()));
View Full Code Here

        File file = folder.newFile("file");
        DriverScript driver = new DriverScript(
                "file",
                Collections.singletonMap(FileProcess.FILE.key(), file.getAbsolutePath()));
        WindGateImporterDescription description = new MockImporterDescription(
                String.class,
                "testing",
                driver);

        ResourceManipulator manipulator = WindGateTestHelper.createResourceManipulator(
View Full Code Here

    public void createResourceManipulator_missing_profile() throws Exception {
        File file = folder.newFile("file");
        DriverScript driver = new DriverScript(
                "file",
                Collections.singletonMap(FileProcess.FILE.key(), file.getAbsolutePath()));
        WindGateImporterDescription description = new MockImporterDescription(
                String.class,
                "__MISSING__",
                driver);

        try {
View Full Code Here

        File file = folder.newFile("file");
        DriverScript driver = new DriverScript(
                "file",
                Collections.singletonMap(FileProcess.FILE.key(), file.getAbsolutePath()));
        WindGateImporterDescription description = new MockImporterDescription(
                String.class,
                "testing",
                driver);

        try {
View Full Code Here

        File file = folder.newFile("file");
        DriverScript driver = new DriverScript(
                "missing",
                Collections.singletonMap(FileProcess.FILE.key(), file.getAbsolutePath()));
        WindGateImporterDescription description = new MockImporterDescription(
                String.class,
                "testing",
                driver);

        try {
View Full Code Here

        File file = folder.newFile("file");
        DriverScript driver = new DriverScript(
                "file",
                Collections.singletonMap(FileProcess.FILE.key(), file.getAbsolutePath()));
        WindGateImporterDescription description = new MockImporterDescription(
                String.class,
                "testing",
                driver);
        WindGateImporterPreparator preparator = new WindGateImporterPreparator();
View Full Code Here

TOP

Related Classes of com.asakusafw.vocabulary.windgate.WindGateImporterDescription

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.