Examples of doesExist()


Examples of org.apache.sshd.common.file.SshFile.doesExist()

                String path = buffer.getString();
                log.debug("Received SSH_FXP_MKDIR (path={})", path);
                // attrs
                try {
                    SshFile p = resolveFile(path);
                    if (p.doesExist()) {
                        if (p.isDirectory()) {
                            sendStatus(id, SSH_FX_FAILURE, p.getAbsolutePath());
                        } else {
                            sendStatus(id, SSH_FX_NO_SUCH_FILE, p.getAbsolutePath());
                        }
View Full Code Here

Examples of org.apache.sshd.common.file.SshFile.doesExist()

                log.debug("Received SSH_FXP_RMDIR (path={})", path);
                // attrs
                try {
                    SshFile p = resolveFile(path);
                    if (p.isDirectory()) {
                        if (p.doesExist()) {
                            if (p.listSshFiles().size() == 0) {
                                if (p.delete()) {
                                    sendStatus(id, SSH_FX_OK, "");
                                } else {
                                    sendStatus(id, SSH_FX_FAILURE, "Unable to delete directory " + path);
View Full Code Here

Examples of org.apache.sshd.common.file.SshFile.doesExist()

                try {
                    SshFile o = resolveFile(oldPath);
                    SshFile n = resolveFile(newPath);
                    if (!o.doesExist()) {
                        sendStatus(id, SSH_FX_NO_SUCH_FILE, o.getAbsolutePath());
                    } else if (n.doesExist()) {
                        sendStatus(id, SSH_FX_FAILURE, n.getAbsolutePath());
                    } else if (!o.move(n)) {
                        sendStatus(id, SSH_FX_FAILURE, "Failed to rename file");
                    } else {
                        sendStatus(id, SSH_FX_OK, "");
View Full Code Here

Examples of org.apache.sshd.common.file.SshFile.doesExist()

        String newPath = request.getNewPath();
        SshFile o = resolveFile(oldPath);
        SshFile n = resolveFile(newPath);
        if (!o.doesExist()) {
            return new SshFxpStatusReply(id, SSH_FX_NO_SUCH_FILE, o.getAbsolutePath());
        } else if (n.doesExist()) {
            return new SshFxpStatusReply(id, SSH_FX_FILE_ALREADY_EXISTS, n.getAbsolutePath());
        } else if (!o.move(n)) {
            return new SshFxpStatusReply(id, SSH_FX_FAILURE, "Failed to rename file");
        } else {
            return new SshFxpStatusReply(id, SSH_FX_OK, "");
View Full Code Here

Examples of org.apache.sshd.common.file.SshFile.doesExist()

        }
        p = resolveFile(normalizedPath);
        if (p.getName().length() == 0) {
            p = resolveFile(".");
        }
        boolean exists = (request.getOptions() != SSH_FXP_REALPATH_NO_CHECK) && p.doesExist();
        if (!exists && request.getOptions() == SSH_FXP_REALPATH_STAT_ALWAYS) {
            return new SshFxpStatusReply(id, SSH_FX_NO_SUCH_FILE, p.getAbsolutePath());
        } else if (exists && (request.getOptions() == SSH_FXP_REALPATH_STAT_IF || request.getOptions() == SSH_FXP_REALPATH_STAT_ALWAYS)) {
            SshFxpNameReply reply = new SshFxpNameReply(id);
            int flags = SSH_FILEXFER_ATTR_PERMISSIONS | SSH_FILEXFER_ATTR_SIZE;
View Full Code Here

Examples of org.apache.sshd.common.file.SshFile.doesExist()

        int id = request.getId();
        String path = request.getPath();
        // attrs
        SshFile p = resolveFile(path);
        if (p.isDirectory()) {
            if (p.doesExist()) {
                if (p.listSshFiles().size() == 0) {
                    if (p.delete()) {
                        return new SshFxpStatusReply(id, SSH_FX_OK, "");
                    } else {
                        return new SshFxpStatusReply(id, SSH_FX_FAILURE, "Unable to delete directory " + path);
View Full Code Here

Examples of org.apache.sshd.common.file.SshFile.doesExist()

    private Reply doProcessMkdir(SshFxpMkdirRequest request) throws IOException {
        int id = request.getId();
        String path = request.getPath();
        // attrs
        SshFile p = resolveFile(path);
        if (p.doesExist()) {
            if (p.isDirectory()) {
                return new SshFxpStatusReply(id, SSH_FX_FILE_ALREADY_EXISTS, p.getAbsolutePath());
            } else {
                return new SshFxpStatusReply(id, SSH_FX_NOT_A_DIRECTORY, p.getAbsolutePath());
            }
View Full Code Here

Examples of org.apache.sshd.common.file.SshFile.doesExist()

    private Reply doProcessRemove(SshFxpRemoveRequest request) throws IOException {
        int id = request.getId();
        String path = request.getPath();
        SshFile p = resolveFile(path);
        if (!p.doesExist()) {
            return new SshFxpStatusReply(id, SSH_FX_NO_SUCH_FILE, p.getAbsolutePath());
        } else if (p.isDirectory()) {
            return new SshFxpStatusReply(id, SSH_FX_FILE_IS_A_DIRECTORY, p.getAbsolutePath());
        } else if (!p.delete()) {
            return new SshFxpStatusReply(id, SSH_FX_FAILURE, "Failed to delete file");
View Full Code Here

Examples of org.apache.sshd.common.file.SshFile.doesExist()

    private Reply doProcessOpendir(SshFxpOpendirRequest request) throws IOException {
        int id = request.getId();
        String path = request.getPath();
        SshFile p = resolveFile(path);
        if (!p.doesExist()) {
            return new SshFxpStatusReply(id, SSH_FX_NO_SUCH_FILE, path);
        } else if (!p.isDirectory()) {
            return new SshFxpStatusReply(id, SSH_FX_NOT_A_DIRECTORY, path);
        } else if (!p.isReadable()) {
            return new SshFxpStatusReply(id, SSH_FX_PERMISSION_DENIED, path);
View Full Code Here

Examples of org.apache.sshd.common.file.SshFile.doesExist()

        } else {
            SshFxpStatRequest sshFxpStatRequest = (SshFxpStatRequest) sftpRequest;
            path = sshFxpStatRequest.getPath();
        }
        SshFile p = resolveFile(path);
        if (!p.doesExist()) {
            return new SshFxpStatusReply(id, SSH_FX_NO_SUCH_FILE, p.getAbsolutePath());
        }
        int flags = SSH_FILEXFER_ATTR_PERMISSIONS | SSH_FILEXFER_ATTR_SIZE;
        return new SshFxpAttrsReply(id, new FileAttributes(p, flags));
    }
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.