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


Java User.getName方法代码示例

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


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

import org.apache.ftpserver.ftplet.User; //导入方法依赖的package包/类
/**
 * Get user password. Returns the encrypted value.
 * 
 * <pre>
 * If the password value is not null
 *    password = new password 
 * else 
 *   if user does exist
 *     password = old password
 *   else 
 *     password = &quot;&quot;
 * </pre>
 */
private String getPassword(User usr) {
    String name = usr.getName();
    String password = usr.getPassword();

    if (password != null) {
        password = getPasswordEncryptor().encrypt(password);
    } else {
        String blankPassword = getPasswordEncryptor().encrypt("");

        if (doesExist(name)) {
            String key = PREFIX + name + '.' + ATTR_PASSWORD;
            password = userDataProp.getProperty(key, blankPassword);
        } else {
            password = blankPassword;
        }
    }
    return password;
}
 
开发者ID:lgnlgn,项目名称:feluca,代码行数:32,代码来源:PropertiesUserManager.java

示例4: 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

示例5: notifyLogin

import org.apache.ftpserver.ftplet.User; //导入方法依赖的package包/类
/**
 * Observer login notification.
 */
private void notifyLogin(final FtpIoSession session) {
    StatisticsObserver observer = this.observer;
    if (observer != null) {

        // is anonymous login
        User user = session.getUser();
        boolean anonymous = false;
        if (user != null) {
            String login = user.getName();
            anonymous = (login != null) && login.equals("anonymous");
        }
        observer.notifyLogin(anonymous);
    }
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:18,代码来源:DefaultFtpStatistics.java

示例6: notifyLogout

import org.apache.ftpserver.ftplet.User; //导入方法依赖的package包/类
/**
 * Observer logout notification.
 */
private void notifyLogout(final FtpIoSession session) {
    StatisticsObserver observer = this.observer;
    if (observer != null) {
        // is anonymous login
        User user = session.getUser();
        boolean anonymous = false;
        if (user != null) {
            String login = user.getName();
            anonymous = (login != null) && login.equals("anonymous");
        }
        observer.notifyLogout(anonymous);
    }
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:17,代码来源:DefaultFtpStatistics.java

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