Examples of RemoteFile


Examples of io.fathom.cloud.sftp.RemoteFile

        RemoteFile imageDir = new RemoteFile(new File("/var/fathomcloud/images"));
        return imageDir;
    }

    protected RemoteFile getImageTmpdir() {
        RemoteFile imageDir = getImageBaseDir();
        return new RemoteFile(imageDir, "tmp");
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

    }

    public abstract void uploadImage(ImageKey imageId, BlobData imageData) throws IOException, CloudException;

    public boolean hasImage(ImageKey imageId) throws IOException, CloudException {
        RemoteFile imageFile = getImagePath(imageId);

        try (SftpChannel sftp = buildSftp()) {
            return sftp.exists(imageFile.getSshPath());
        }
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

                    return false;
                }
            }

            int mode = 0660;
            sftp.writeAtomic(new RemoteFile(confFile), ByteStreams.asByteSource(data), mode);
        } catch (IOException e) {
            throw new CloudException("Error updating applyd configuration", e);
        }
        return true;
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

            process.Args = args;

            process.Dir = hostFilesystem.getRootFs(containerId).getAbsolutePath();

            String json = new Gson().toJson(process);
            sftp.writeAtomic(new RemoteFile(processFile), json.getBytes(Charsets.UTF_8));
        } catch (IOException e) {
            throw new CloudException("Error starting container", e);
        }
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

    public boolean hasImage(ImageKey imageId) throws IOException, CloudException {
        return hostFilesystem.hasImage(imageId);
    }

    private RemoteFile getSystemTempDir() {
        return new RemoteFile(new File("/tmp"));
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

        super(sshConfig);
    }

    @Override
    public void copyImageToRootfs(ImageKey imageId, File rootfsPath) throws IOException {
        RemoteFile tar = getImagePath(imageId);

        ShellCommand cmd = ShellCommand.create("/bin/tar");
        cmd.literal("--numeric-owner");
        cmd.literal("-f").arg(tar.getSshPath());
        cmd.literal("-C").arg(rootfsPath);
        cmd.literal("-xz");
        cmd.useSudo();

        SshCommand sshCommand = cmd.withSsh(sshConfig);
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

            try (RemoteTempFile tar = sftp.buildRemoteTemp()) {
                try (OutputStream os = sftp.writeFile(tar.getSshPath(), WriteMode.Overwrite)) {
                    imageData.copyTo(os);
                }

                RemoteFile imageFile = getImagePath(imageId);
                tar.renameTo(imageFile);
            }
        }
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

    @Override
    public MessageQueueWriter getWriter(SshConfig sshConfig, String queue) throws IOException {
        if (queue.startsWith("sftp://")) {
            File path = new File(queue.substring(7));
            return new SftpMessageQueueWriter(sshConfig, new RemoteFile(path));
        } else {
            throw new IllegalArgumentException();
        }
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

                char firstChar = name.charAt(0);
                if (firstChar == '_' || firstChar == '.') {
                    continue;
                }
                byte[] data;
                RemoteFile file = new RemoteFile(queueDir, name);
                try (InputStream is = sftp.open(file.getSshPath())) {
                    data = ByteStreams.toByteArray(is);
                }

                sftp.delete(file.getSshPath());

                return data;
            }
        }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

    public SftpMessageQueueWriter(SshConfig sshConfig, RemoteFile queueDir) throws IOException {
        this.sshConfig = sshConfig;
        this.queueDir = queueDir;

        this.tmpDir = new RemoteFile(queueDir, "_tmp");
        try (Sftp sftp = buildSftp()) {
            sftp.mkdirs(tmpDir.getSshPath());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.