当前位置: 首页>>代码示例>>Java>>正文


Java User.getHomeDirectory方法代码示例

本文整理汇总了Java中org.apache.ftpserver.ftplet.User.getHomeDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java User.getHomeDirectory方法的具体用法?Java User.getHomeDirectory怎么用?Java User.getHomeDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ftpserver.ftplet.User的用法示例。


在下文中一共展示了User.getHomeDirectory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFileSystemView

import org.apache.ftpserver.ftplet.User; //导入方法依赖的package包/类
@Override
public FileSystemView createFileSystemView(User user) throws FtpException {
    final String home = user.getHomeDirectory();
    final String owner = user.getName();
    final String group = user.getName();
    final int streamSize = FTPFile.DEFAULT_SIZE;

    synchronized (this) {
        if (mViews.isEmpty()) {
            return new FTPFileSystemView(home, owner, group, streamSize);
        } else {
            final FTPFileSystemView view = mViews.remove(0);
            view.init(home, owner, group, streamSize);
            return view;
        }
    }
}
 
开发者ID:AlexMofer,项目名称:ProjectX,代码行数:18,代码来源:FTPFileSystemFactory.java

示例2: from

import org.apache.ftpserver.ftplet.User; //导入方法依赖的package包/类
static FTPUser from(User user) {
    final String name = user.getName();
    final String password = user.getPassword();
    final String homeDirectory = user.getHomeDirectory();
    final boolean enable = user.getEnabled();
    final int idleSec = user.getMaxIdleTime();
    boolean hasWritePermission = false;
    List<? extends Authority> authorities = user.getAuthorities();
    if (authorities != null) {
        for (Authority authority : authorities) {
            if (authority instanceof WritePermission) {
                hasWritePermission = true;
                break;
            }
        }
    }
    return new FTPUser(name, password, homeDirectory, false,
            enable, idleSec, hasWritePermission,
            0, 0, 10, 10);
}
 
开发者ID:AlexMofer,项目名称:ProjectX,代码行数:21,代码来源:FTPUser.java

示例3: createFileSystemView

import org.apache.ftpserver.ftplet.User; //导入方法依赖的package包/类
/**
 * Create the appropriate user file system view.
 */
public FileSystemView createFileSystemView(User user) throws FtpException {
    synchronized (user) {
        // create home if does not exist
        if (createHome) {
            String homeDirStr = user.getHomeDirectory();
            File homeDir = new File(homeDirStr);
            if (homeDir.isFile()) {
                LOG.warn("Not a directory :: " + homeDirStr);
                throw new FtpException("Not a directory :: " + homeDirStr);
            }
            if ((!homeDir.exists()) && (!homeDir.mkdirs())) {
                LOG.warn("Cannot create user home :: " + homeDirStr);
                throw new FtpException("Cannot create user home :: "
                        + homeDirStr);
            }
        }

        FileSystemView fsView = new NativeFileSystemView(user,
                caseInsensitive);
        return fsView;
    }
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:26,代码来源:NativeFileSystemFactory.java

示例4: NativeFileSystemView

import org.apache.ftpserver.ftplet.User; //导入方法依赖的package包/类
/**
 * Constructor - internal do not use directly, use {@link NativeFileSystemFactory} instead
 */
public NativeFileSystemView(User user, boolean caseInsensitive)
        throws FtpException {
    if (user == null) {
        throw new IllegalArgumentException("user can not be null");
    }
    if (user.getHomeDirectory() == null) {
        throw new IllegalArgumentException(
                "User home directory can not be null");
    }

    this.caseInsensitive = caseInsensitive;

    // add last '/' if necessary
    String rootDir = user.getHomeDirectory();
    rootDir = normalizeSeparateChar(rootDir);
    rootDir = appendSlash(rootDir);
    
    LOG.debug("Native filesystem view created for user \"{}\" with root \"{}\"", user.getName(), rootDir);
    
    this.rootDir = rootDir;

    this.user = user;

    currDir = "/";
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:29,代码来源:NativeFileSystemView.java

示例5: BaseUser

import org.apache.ftpserver.ftplet.User; //导入方法依赖的package包/类
/**
 * Copy constructor.
 */
public BaseUser(User user) {
    name = user.getName();
    password = user.getPassword();
    authorities = user.getAuthorities();
    maxIdleTimeSec = user.getMaxIdleTime();
    homeDir = user.getHomeDirectory();
    isEnabled = user.getEnabled();
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:12,代码来源:BaseUser.java

示例6: save

import org.apache.ftpserver.ftplet.User; //导入方法依赖的package包/类
/**
 * Save user data. Store the properties.
 */
public synchronized void save(User usr) throws FtpException {
    // null value check
    if (usr.getName() == null) {
        throw new NullPointerException("User name is null.");
    }
    String thisPrefix = PREFIX + usr.getName() + '.';

    // set other properties
    userDataProp.setProperty(thisPrefix + ATTR_PASSWORD, getPassword(usr));

    String home = usr.getHomeDirectory();
    if (home == null) {
        home = "/";
    }
    userDataProp.setProperty(thisPrefix + ATTR_HOME, home);
    userDataProp.setProperty(thisPrefix + ATTR_ENABLE, usr.getEnabled());
    userDataProp.setProperty(thisPrefix + ATTR_WRITE_PERM, usr
            .authorize(new WriteRequest()) != null);
    userDataProp.setProperty(thisPrefix + ATTR_MAX_IDLE_TIME, usr
            .getMaxIdleTime());

    TransferRateRequest transferRateRequest = new TransferRateRequest();
    transferRateRequest = (TransferRateRequest) usr
            .authorize(transferRateRequest);

    if (transferRateRequest != null) {
        userDataProp.setProperty(thisPrefix + ATTR_MAX_UPLOAD_RATE,
                transferRateRequest.getMaxUploadRate());
        userDataProp.setProperty(thisPrefix + ATTR_MAX_DOWNLOAD_RATE,
                transferRateRequest.getMaxDownloadRate());
    } else {
        userDataProp.remove(thisPrefix + ATTR_MAX_UPLOAD_RATE);
        userDataProp.remove(thisPrefix + ATTR_MAX_DOWNLOAD_RATE);
    }

    // request that always will succeed
    ConcurrentLoginRequest concurrentLoginRequest = new ConcurrentLoginRequest(
            0, 0);
    concurrentLoginRequest = (ConcurrentLoginRequest) usr
            .authorize(concurrentLoginRequest);

    if (concurrentLoginRequest != null) {
        userDataProp.setProperty(thisPrefix + ATTR_MAX_LOGIN_NUMBER,
                concurrentLoginRequest.getMaxConcurrentLogins());
        userDataProp.setProperty(thisPrefix + ATTR_MAX_LOGIN_PER_IP,
                concurrentLoginRequest.getMaxConcurrentLoginsPerIP());
    } else {
        userDataProp.remove(thisPrefix + ATTR_MAX_LOGIN_NUMBER);
        userDataProp.remove(thisPrefix + ATTR_MAX_LOGIN_PER_IP);
    }

    saveUserData();
}
 
开发者ID:lgnlgn,项目名称:feluca,代码行数:57,代码来源:PropertiesUserManager.java


注:本文中的org.apache.ftpserver.ftplet.User.getHomeDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。