Search in sources :

Example 1 with ModelManager

use of org.embulk.config.ModelManager in project embulk by embulk.

the class EmbulkRunner method previewInternal.

private void previewInternal(final ConfigSource configSource, final String format) throws IOException {
    final PreviewResult previewResult = this.embed.preview(configSource);
    final ModelManager modelManager = this.embed.getModelManager();
    final PreviewPrinter printer;
    switch(format != null ? format : "table") {
        case "table":
            printer = new TablePreviewPrinter(System.out, modelManager, previewResult.getSchema());
            break;
        case "vertical":
            printer = new VerticalPreviewPrinter(System.out, modelManager, previewResult.getSchema());
            break;
        default:
            throw new IllegalArgumentException("Unknown preview output format '" + format + "'. Supported formats: table, vertical");
    }
    printer.printAllPages(previewResult.getPages());
    printer.finish();
}
Also used : PreviewResult(org.embulk.exec.PreviewResult) VerticalPreviewPrinter(org.embulk.command.VerticalPreviewPrinter) TablePreviewPrinter(org.embulk.command.TablePreviewPrinter) VerticalPreviewPrinter(org.embulk.command.VerticalPreviewPrinter) PreviewPrinter(org.embulk.command.PreviewPrinter) TablePreviewPrinter(org.embulk.command.TablePreviewPrinter) ModelManager(org.embulk.config.ModelManager)

Example 2 with ModelManager

use of org.embulk.config.ModelManager in project embulk by embulk.

the class EmbulkRunner method dumpResumeStateInYaml.

private String dumpResumeStateInYaml(final ResumeState modelObject) {
    final ModelManager modelManager = this.embed.getModelManager();
    final Object object = modelManager.readObject(Object.class, modelManager.writeObject(modelObject));
    return (new org.yaml.snakeyaml.Yaml()).dump(object);
}
Also used : ModelManager(org.embulk.config.ModelManager)

Example 3 with ModelManager

use of org.embulk.config.ModelManager in project embulk by embulk.

the class EmbulkRunner method dumpDataSourceInYaml.

private String dumpDataSourceInYaml(final DataSource modelObject) {
    final ModelManager modelManager = this.embed.getModelManager();
    final Object object = modelManager.readObject(Object.class, modelManager.writeObject(modelObject));
    return (new org.yaml.snakeyaml.Yaml()).dump(object);
}
Also used : ModelManager(org.embulk.config.ModelManager)

Aggregations

ModelManager (org.embulk.config.ModelManager)3 PreviewPrinter (org.embulk.command.PreviewPrinter)1 TablePreviewPrinter (org.embulk.command.TablePreviewPrinter)1 VerticalPreviewPrinter (org.embulk.command.VerticalPreviewPrinter)1 PreviewResult (org.embulk.exec.PreviewResult)1