Examples of RemoteFile


Examples of io.fathom.cloud.sftp.RemoteFile

    @Override
    public void enqueue(byte[] data) throws IOException {
        String name = System.currentTimeMillis() + "_" + UUID.randomUUID().toString();

        try (Sftp sftp = buildSftp()) {
            RemoteFile remoteFile = new RemoteFile(queueDir, name);

            sftp.writeAtomic(remoteFile, data);
        }
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

        super();
        this.sshConfig = sshConfig;
        this.remoteBaseDir = remoteBaseDir;
        this.localCacheDir = localCacheDir;

        this.tmpDir = new RemoteFile(remoteBaseDir, "_tmp");
        mkdirs(tmpDir);

        localCacheDirTmp = new File(localCacheDir, "_tmp");
        IoUtils.mkdirs(localCacheDirTmp);
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

        return new Sftp(sftp, tmpDir);
    }

    @Override
    public BlobData find(ByteString key) throws IOException {
        RemoteFile remoteFile = buildRemoteFile(key);

        File localCache;
        try {
            localCache = buildCacheFile(key, true);
        } catch (IOException e) {
            throw new IOException("Error creating local cache file", e);
        }

        if (localCache.exists()) {
            // TODO: Verify?
            log.debug("Using local cache file: {}", localCache);
        } else {
            try (TempFile localTemp = TempFile.in(this.localCacheDirTmp)) {
                HashCode md5;

                try (Sftp sftp = buildSftp(); InputStream is = sftp.open(remoteFile.getSshPath())) {
                    try (OutputStream os = new FileOutputStream(localTemp.getFile())) {
                        Hasher hasher = Hashing.md5().newHasher();
                        byte[] buffer = new byte[8192];
                        while (true) {
                            int n = is.read(buffer);
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

            if (localCache.exists()) {
                return true;
            }
        }

        RemoteFile remoteFile = buildRemoteFile(key);

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

Examples of io.fathom.cloud.sftp.RemoteFile

    private static boolean matches(ByteString a, HashCode b) {
        return Arrays.equals(a.toByteArray(), b.asBytes());
    }

    private RemoteFile buildRemoteFile(Sftp sftp, ByteString key, boolean mkdirs) throws IOException {
        RemoteFile file = buildRemoteFile(key);

        if (mkdirs) {
            // TODO: Cache created / not created state?
            sftp.mkdirs(file.getParentFile().getSshPath());
        }

        return file;
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

        return file;
    }

    private RemoteFile buildRemoteFile(ByteString key) {
        File file = buildFile(this.remoteBaseDir.getSshPath(), key);
        RemoteFile remoteFile = new RemoteFile(file);
        return remoteFile;
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

                throw new IOException("Could not rename file to cache file");
            }
        }

        try (Sftp sftp = buildSftp()) {
            RemoteFile remoteFile = buildRemoteFile(sftp, key, true);

            if (sftp.exists(remoteFile.getSshPath())) {
                // TODO: Verify that the file contents match??
                log.warn("TODO: Validate that remote files match for sftp");
                return;
            }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

                    if (!name.startsWith(prefix)) {
                        continue;
                    }
                }

                listWithPrefix(sftp, ret, new RemoteFile(remoteBaseDir, name), prefix);
            }
        }

        return ret;
    }
View Full Code Here

Examples of io.fathom.cloud.sftp.RemoteFile

        @Override
        public BlobStore get(String key) throws IOException {
            Preconditions.checkArgument(!Strings.isNullOrEmpty(key));
            Preconditions.checkArgument(LocalFilesystemBlobStore.isSafeFileName(key));

            return new SftpBlobStore(sshConfig, new RemoteFile(remoteBaseDir, key), new File(localCacheDir, key));
        }
View Full Code Here

Examples of org.cfeclipse.cfml.net.RemoteFile

      public void doubleClick(DoubleClickEvent event) {
        ISelection selection = event.getSelection();
        TreeSelection sel = (TreeSelection)event.getSelection();
        Object firstElement = sel.getFirstElement();
        if (firstElement instanceof RemoteFile) {
          RemoteFile remFile = (RemoteFile) firstElement;
          String absolutePath = remFile.getAbsolutePath();
         
          StructuredSelection selection2 = (StructuredSelection)comboViewer.getSelection();
         
          if (selection2.getFirstElement() instanceof FTPConnection) {
            FTPConnection ftpConn = (FTPConnection) selection2.getFirstElement();
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.