Sha256: 2a787ca57e1b948b54282fc6e0812021b1d574d6aa2de79cf3d39d6a5366a844

Contents?: true

Size: 1.01 KB

Versions: 108

Compression:

Stored size: 1.01 KB

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 directories
        // UNIX/Linux cannot include '/' as file name.
        // Windows cannot include ':' as file name.
        subdir = subdir.replace('/', '-').replace(':', '-');
        return new TempFileSpace(new File(dirs[0], subdir));
    }
}

Version data entries

108 entries across 108 versions & 1 rubygems

Version Path
embulk-0.8.39 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.39-java embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.38 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.38-java embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.37 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.37-java embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.36 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.36-java embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.35 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.35-java embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.34 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.34-java embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.33 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.33-java embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.32 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.32-java embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.31 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.31-java embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.30 embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java
embulk-0.8.30-java embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java