Sha256: 9e071ad6f2c9098175c802385bf82e3395548838063c34a9e254cbfae04b070c

Contents?: true

Size: 1.75 KB

Versions: 4

Compression:

Stored size: 1.75 KB

Contents

package org.embulk.<%= embulk_category %>;

import java.util.List;
import org.embulk.config.CommitReport;
import org.embulk.config.Config;
import org.embulk.config.ConfigDefault;
import org.embulk.config.ConfigDiff;
import org.embulk.config.ConfigSource;
import org.embulk.config.Task;
import org.embulk.config.TaskSource;
import org.embulk.spi.Exec;
import org.embulk.spi.FileInputPlugin;
import org.embulk.spi.TransactionalFileInput;

public class <%= java_class_name %>
        implements FileInputPlugin
{
    public interface PluginTask
            extends Task
    {
        @Config("property1")
        public String getProperty1();

        @Config("property2")
        @ConfigDefault("0")
        public int getProperty2();
    }

    @Override
    public ConfigDiff transaction(ConfigSource config, FileInputPlugin.Control control)
    {
        PluginTask task = config.loadConfig(PluginTask.class);

        // processorCount is usually number of input files
        int processorCount = 1;  // number of run() method calls

        return resume(task.dump(), processorCount, control);
    }

    @Override
    public ConfigDiff resume(TaskSource taskSource,
            int processorCount,
            FileInputPlugin.Control control)
    {
        control.run(taskSource, processorCount);
        return Exec.newConfigDiff();
    }

    @Override
    public void cleanup(TaskSource taskSource,
            int processorCount,
            List<CommitReport> successCommitReports)
    {
    }

    @Override
    public TransactionalFileInput open(TaskSource taskSource, int processorIndex)
    {
        PluginTask task = taskSource.loadTask(PluginTask.class);

        // TODO
        throw new UnsupportedOperationException("The 'open' method needs to be implemented");
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
embulk-0.4.3 lib/embulk/data/new/java/file_input.java.erb
embulk-0.4.2 lib/embulk/data/new/java/file_input.java.erb
embulk-0.4.1 lib/embulk/data/new/java/file_input.java.erb
embulk-0.4.0 lib/embulk/data/new/java/file_input.java.erb