Sha256: 3e0819c90158c8dc5dc321ab7d17267f26c9c07fa2662fed2db7d6e910562d37

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

package org.embulk.output.s3v2.strategy;

import org.embulk.output.s3v2.PluginTask;
import org.embulk.output.s3v2.s3.S3ClientManager;
import org.embulk.output.s3v2.s3.S3MultiPartStatus;
import org.embulk.spi.TransactionalFileOutput;

abstract class AbstractStrategy implements TransactionalFileOutput
{
    protected S3ClientManager s3;
    protected PluginTask task;
    protected int taskIndex;

    public AbstractStrategy(PluginTask task, int taskIndex)
    {
        s3 = new S3ClientManager(task.getRegion(), task.getEnableProfile(), task.getProfile());
        this.task = task;
        this.taskIndex = taskIndex;

        if (!validate()) {
            throw new IllegalArgumentException("Unsupported parameters combination");
        }
    }

    /**
     * Validation for PluginTask parameters combination.
     * @see PluginTask
     */
    protected abstract boolean validate();

    protected final String getFileExtension()
    {
        return task.getExtension().startsWith(".") ? task.getExtension() : "." + task.getExtension();
    }

    protected final S3MultiPartStatus setUpS3MultiPartStatus()
    {
        return new S3MultiPartStatus(task.getMaxConcurrentRequests(), task.getMultipartChunksize(),
                task.getMultipartThreshold());
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
embulk-output-s3v2-0.3.0 src/main/java/org/embulk/output/s3v2/strategy/AbstractStrategy.java
embulk-output-s3v2-0.2.1 src/main/java/org/embulk/output/s3v2/strategy/AbstractStrategy.java
embulk-output-s3v2-0.2.0 src/main/java/org/embulk/output/s3v2/strategy/AbstractStrategy.java