org.apache.ftpserver.ftplet.FileSystemView Java Examples

The following examples show how to use org.apache.ftpserver.ftplet.FileSystemView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FtpProviderUserDirTestCase.java    From commons-vfs with Apache License 2.0 6 votes vote down vote up
/**
 * Gets option file system factory for local FTP server.
 */
@Override
protected FileSystemFactory getFtpFileSystem() throws IOException {
    // simulate a non-root home directory by copying test directory to it
    final File testDir = new File(getTestDirectory());
    final File rootDir = new File(testDir, "homeDirIsRoot");
    final File homesDir = new File(rootDir, "home");
    final File initialDir = new File(homesDir, "test");
    FileUtils.deleteDirectory(rootDir);
    // noinspection ResultOfMethodCallIgnored
    rootDir.mkdir();
    FileUtils.copyDirectory(testDir, initialDir, pathname -> !pathname.getPath().contains(rootDir.getName()));

    return new NativeFileSystemFactory() {
        @Override
        public FileSystemView createFileSystemView(final User user) throws FtpException {
            final FileSystemView fsView = super.createFileSystemView(user);
            fsView.changeWorkingDirectory("home/test");
            return fsView;
        }
    };
}
 
Example #2
Source File: FtpFileSystemFactory.java    From ProjectX with Apache License 2.0 5 votes vote down vote up
@Override
public FileSystemView createFileSystemView(User user) throws FtpException {
    if (!(user instanceof FtpUser))
        throw new FtpException("Unsupported user type.");
    final FileSystemView view =
            ((FtpUser) user).getFileSystemViewAdapter().createFileSystemView();
    if (view == null)
        throw new FtpException("Cannot create file system view.");
    return view;
}
 
Example #3
Source File: DHuSFtpFileSystemFactory.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public FileSystemView createFileSystemView(User user) throws FtpException
{
   return new DHuSFtpProductViewByCollection (user);
}
 
Example #4
Source File: FtpFileSystemViewAdapter.java    From ProjectX with Apache License 2.0 2 votes vote down vote up
/**
 * 获取文件系统视图
 *
 * @return 文件系统视图
 */
FileSystemView createFileSystemView();