Sha256: 928c8b9e29c06fc2ab694ee8ff375d7c22d8a493e958155420f26071984758be

Contents?: true

Size: 862 Bytes

Versions: 8

Compression:

Stored size: 862 Bytes

Contents

package org.embulk.exec;

import java.io.File;
import com.google.inject.Inject;
import org.embulk.config.ConfigSource;
import org.embulk.spi.TempFileSpace;

// TODO change this class to interface
// TODO don't use this class directly. Use spi.Exec.getTempFileSpace() instead.
public class TempFileAllocator
{
    private final File[] dirs;

    @Inject
    public TempFileAllocator(@ForSystemConfig ConfigSource systemConfig)
    {
        // TODO get `temp_dirs` from system config
        String s = System.getProperty("java.io.tmpdir");
        if (s == null || s.isEmpty()) {
            s = "/tmp";
        }
        this.dirs = new File[] {
            new File(s, "embulk")
        };
    }

    public TempFileSpace newSpace(String subdir)
    {
        // TODO support multiple files
        return new TempFileSpace(new File(dirs[0], subdir));
    }
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
embulk-0.6.23 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.6.22 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.6.21 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.6.20 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.6.19 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.6.18 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.6.17 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.6.16 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java