Examples of FileSystemView


Examples of org.apache.ftpserver.ftplet.FileSystemView

     * Get unique file object.
     */
    protected FtpFile getUniqueFile(FtpIoSession session, FtpFile oldFile)
            throws FtpException {
        FtpFile newFile = oldFile;
        FileSystemView fsView = session.getFileSystemView();
        String fileName = newFile.getAbsolutePath();
        while (newFile.doesExist()) {
            newFile = fsView.getFile(fileName + '.'
                    + System.currentTimeMillis());
            if (newFile == null) {
                break;
            }
        }
View Full Code Here

Examples of org.apache.sshd.common.file.FileSystemView

        assertEquals("Z:/git/foo/bar", view.getFile("foo/bar").getAbsolutePath());
        assertEquals("Z:/foo/bar", view.getFile("../foo/bar").getAbsolutePath());
        assertEquals("A:/temp", view.getFile("A:/./a/../temp").getAbsolutePath());
        assertEquals("A:/temp", view.getFile("A:/../../temp").getAbsolutePath());

        FileSystemView normView = view.getNormalizedView();

        assertEquals("/Z/git/foo/bar", normView.getFile("foo/bar").getAbsolutePath());
        assertEquals("/Z/foo/bar", normView.getFile("../foo/bar").getAbsolutePath());
        assertEquals("/A/temp", normView.getFile("/A/./a/../temp").getAbsolutePath());
        assertEquals("/Z/temp", normView.getFile("/A/../Z/temp").getAbsolutePath());
    }
View Full Code Here

Examples of org.apache.sshd.common.file.FileSystemView

        assertFalse(view.getFile("foo/bar").getParentFile().getParentFile().getParentFile().isRemovable());
        assertEquals("Z:\\foo\\bar", view.getFile("../foo/bar").getAbsolutePath());
        assertEquals("A:\\temp", view.getFile("A:/./a/../temp").getAbsolutePath());
        assertEquals("A:\\temp", view.getFile("A:/../../temp").getAbsolutePath());

        FileSystemView normView = view.getNormalizedView();

        assertEquals("/Z/git/foo/bar", normView.getFile("foo/bar").getAbsolutePath());
        assertEquals("/Z/git/foo", normView.getFile("foo/bar").getParentFile().getAbsolutePath());
        assertEquals("/Z/foo/bar", normView.getFile("../foo/bar").getAbsolutePath());
        assertEquals("/A/temp", normView.getFile("/A/./a/../temp").getAbsolutePath());
        assertEquals("/Z/temp", normView.getFile("/A/../Z/temp").getAbsolutePath());
    }
View Full Code Here

Examples of org.apache.sshd.common.file.FileSystemView

//                    throw new FtpException("Cannot create user home :: "
//                            + homeDirStr);
            }
        }

        FileSystemView fsView = new NativeFileSystemView(userName, caseInsensitive);
        return fsView;
    }
View Full Code Here

Examples of org.apache.sshd.common.file.FileSystemView

    @Test
    public void testNativeFileSystem() throws IOException {
        String homeDir = System.getProperty("user.dir");
        NativeFileSystemFactory vfs = new NativeFileSystemFactory();

        FileSystemView view = vfs.createFileSystemView(new TestSession());

        SshFile file = view.getFile("foo");
        String physicalName = ((NativeSshFile) file).getNativeFile().getAbsolutePath();
        assertEquals(homeDir + File.separator + "foo", physicalName);

        file = view.getFile(view.getFile("foo"), "../bar");
        physicalName = ((NativeSshFile) file).getNativeFile().getAbsolutePath();
        assertEquals(homeDir + File.separator + "bar", physicalName);

        file = view.getFile("../bar");
        physicalName = ((NativeSshFile) file).getNativeFile().getAbsolutePath();
        assertEquals(new File(homeDir, "../bar").getCanonicalPath(), physicalName);
    }
View Full Code Here

Examples of org.apache.sshd.common.file.FileSystemView

    @Test
    public void testVirtualFileSystem() {
        String homeDir = System.getProperty("user.dir");
        VirtualFileSystemFactory vfs = new VirtualFileSystemFactory(homeDir);

        FileSystemView view = vfs.createFileSystemView(new TestSession());

        SshFile file = view.getFile("foo");
        String physicalName = ((NativeSshFile) file).getNativeFile().getAbsolutePath();
        assertEquals(homeDir + File.separator + "foo", physicalName);

        file = view.getFile(view.getFile("foo"), "../bar");
        physicalName = ((NativeSshFile) file).getNativeFile().getAbsolutePath();
        assertEquals(homeDir + File.separator + "bar", physicalName);

        file = view.getFile("../bar");
        physicalName = ((NativeSshFile) file).getNativeFile().getAbsolutePath();
        assertEquals(homeDir + File.separator + "bar", physicalName);
    }
View Full Code Here

Examples of org.apache.sshd.common.file.FileSystemView

        sb.append(" --");
        sb.append(" ");
        sb.append(remote);

        FileSystemFactory factory = clientSession.getFactoryManager().getFileSystemFactory();
        FileSystemView fs = factory.createFileSystemView(clientSession);
        SshFile target = fs.getFile(local);
        if (options.contains(Option.TargetIsDirectory)) {
            if (!target.doesExist()) {
                throw new SshException("Target directory " + target.toString() + " does not exists");
            }
            if (!target.isDirectory()) {
View Full Code Here

Examples of org.apache.sshd.common.file.FileSystemView

        } catch (InterruptedException e) {
            throw (IOException) new InterruptedIOException().initCause(e);
        }

        FileSystemFactory factory = clientSession.getFactoryManager().getFileSystemFactory();
        FileSystemView fs = factory.createFileSystemView(clientSession);
        ScpHelper helper = new ScpHelper(channel.getInvertedOut(), channel.getInvertedIn(), fs);

        helper.send(Arrays.asList(local),
                    options.contains(Option.Recursive),
                    options.contains(Option.PreserveAttributes));
View Full Code Here

Examples of org.apache.sshd.server.FileSystemView

        FileSystemFactory fileSystemFactory = new FileSystemFactory()
        {
            public FileSystemView createFileSystemView( Session session )
                throws IOException
            {
                return new FileSystemView()
                {
                    public SshFile getFile( String file )
                    {
                        file = file.replace( "\\", "" );
                        file = file.replace( "\"", "" );
View Full Code Here

Examples of org.apache.sshd.server.FileSystemView

//                    throw new FtpException("Cannot create user home :: "
//                            + homeDirStr);
            }
        }

        FileSystemView fsView = new NativeFileSystemView(userName, caseInsensitive);
        return fsView;
    }
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.