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


Java User类代码示例

本文整理汇总了Java中org.apache.catalina.User的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getUsers

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Return the MBean Names of all users that are members of this group.
 */
public String[] getUsers() {

    Group group = (Group) this.resource;
    ArrayList<String> results = new ArrayList<String>();
    Iterator<User> users = group.getUsers();
    while (users.hasNext()) {
        User user = null;
        try {
            user = users.next();
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), user);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for user " + user);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:26,代码来源:GroupMBean.java

示例2: getGroups

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Return the MBean Names of all groups this user is a member of.
 */
public String[] getGroups() {

    User user = (User) this.resource;
    ArrayList<String> results = new ArrayList<String>();
    Iterator<Group> groups = user.getGroups();
    while (groups.hasNext()) {
        Group group = null;
        try {
            group = groups.next();
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), group);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for group " + group);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:26,代码来源:UserMBean.java

示例3: getRoles

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Return the MBean Names of all roles assigned to this user.
 */
public String[] getRoles() {

    User user = (User) this.resource;
    ArrayList<String> results = new ArrayList<String>();
    Iterator<Role> roles = user.getRoles();
    while (roles.hasNext()) {
        Role role = null;
        try {
            role = roles.next();
            ObjectName oname =
                MBeanUtils.createObjectName(managed.getDomain(), role);
            results.add(oname.toString());
        } catch (MalformedObjectNameException e) {
            IllegalArgumentException iae = new IllegalArgumentException
                ("Cannot create object name for role " + role);
            iae.initCause(e);
            throw iae;
        }
    }
    return results.toArray(new String[results.size()]);

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:26,代码来源:UserMBean.java

示例4: createUser

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Create a new User and return the corresponding MBean Name.
 *
 * @param username User name of the new user
 * @param password Password for the new user
 * @param fullName Full name for the new user
 */
public String createUser(String username, String password,
                         String fullName) {

    UserDatabase database = (UserDatabase) this.resource;
    User user = database.createUser(username, password, fullName);
    try {
        MBeanUtils.createMBean(user);
    } catch (Exception e) {
        IllegalArgumentException iae = new IllegalArgumentException
            ("Exception creating user [" + username + "] MBean");
        iae.initCause(e);
        throw iae;
    }
    return (findUser(username));

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:MemoryUserDatabaseMBean.java

示例5: findUser

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Return the MBean Name for the specified user name (if any);
 * otherwise return <code>null</code>.
 *
 * @param username User name to look up
 */
public String findUser(String username) {

    UserDatabase database = (UserDatabase) this.resource;
    User user = database.findUser(username);
    if (user == null) {
        return (null);
    }
    try {
        ObjectName oname =
            MBeanUtils.createObjectName(managedUser.getDomain(), user);
        return (oname.toString());
    } catch (MalformedObjectNameException e) {
        IllegalArgumentException iae = new IllegalArgumentException
            ("Cannot create object name for user [" + username + "]");
        iae.initCause(e);
        throw iae;
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:26,代码来源:MemoryUserDatabaseMBean.java

示例6: removeUser

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Remove an existing user and destroy the corresponding MBean.
 *
 * @param username User name to remove
 */
public void removeUser(String username) {

    UserDatabase database = (UserDatabase) this.resource;
    User user = database.findUser(username);
    if (user == null) {
        return;
    }
    try {
        MBeanUtils.destroyMBean(user);
        database.removeUser(user);
    } catch (Exception e) {
        IllegalArgumentException iae = new IllegalArgumentException
            ("Exception destroying user [" + username + "] MBean");
        iae.initCause(e);
        throw iae;
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:MemoryUserDatabaseMBean.java

示例7: createMBean

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Create, register, and return an MBean for this
 * <code>User</code> object.
 *
 * @param user The User to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
static DynamicMBean createMBean(User user)
    throws Exception {

    String mname = createManagedName(user);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    DynamicMBean mbean = managed.createMBean(user);
    ObjectName oname = createObjectName(domain, user);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:30,代码来源:MBeanUtils.java

示例8: destroyMBean

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Deregister the MBean for this
 * <code>User</code> object.
 *
 * @param user The User to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 */
static void destroyMBean(User user)
    throws Exception {

    String mname = createManagedName(user);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, user);
    if( mserver.isRegistered(oname) )
        mserver.unregisterMBean(oname);

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:25,代码来源:MBeanUtils.java

示例9: createUser

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Create and return a new {@link User} defined in this user database.
 *
 * @param username The logon username of the new user (must be unique)
 * @param password The logon password of the new user
 * @param fullName The full name of the new user
 */
@Override
public User createUser(String username, String password,
                       String fullName) {

    if (username == null || username.length() == 0) {
        String msg = sm.getString("memoryUserDatabase.nullUser");
        log.warn(msg);
        throw new IllegalArgumentException(msg);
    }

    MemoryUser user = new MemoryUser(this, username, password, fullName);
    synchronized (users) {
        users.put(user.getUsername(), user);
    }
    return (user);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:MemoryUserDatabase.java

示例10: removeRole

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Remove the specified {@link Role} from this user database.
 *
 * @param role The role to be removed
 */
@Override
public void removeRole(Role role) {

    synchronized (roles) {
        Iterator<Group> groups = getGroups();
        while (groups.hasNext()) {
            Group group = groups.next();
            group.removeRole(role);
        }
        Iterator<User> users = getUsers();
        while (users.hasNext()) {
            User user = users.next();
            user.removeRole(role);
        }
        roles.remove(role.getRolename());
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:MemoryUserDatabase.java

示例11: findUser

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Return the MBean Name for the specified user name (if any);
 * otherwise return <code>null</code>.
 *
 * @param username User name to look up
 */
public String findUser(String username) {

    UserDatabase database = (UserDatabase) this.resource;
    User user = database.findUser(username);
    if (user == null) {
        return (null);
    }
    try {
        ObjectName oname =
            MBeanUtils.createObjectName(managedUser.getDomain(), user);
        return (oname.toString());
    } catch (MalformedObjectNameException e) {
        throw new IllegalArgumentException
            ("Cannot create object name for user " + user);
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:24,代码来源:MemoryUserDatabaseMBean.java

示例12: removeUser

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Remove an existing user and destroy the corresponding MBean.
 *
 * @param username User name to remove
 */
public void removeUser(String username) {

    UserDatabase database = (UserDatabase) this.resource;
    User user = database.findUser(username);
    if (user == null) {
        return;
    }
    try {
        MBeanUtils.destroyMBean(user);
        database.removeUser(user);
    } catch (Exception e) {
        throw new IllegalArgumentException("Exception destroying user " +
                                           user + " MBean: " + e);
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:22,代码来源:MemoryUserDatabaseMBean.java

示例13: createMBean

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Create, register, and return an MBean for this
 * <code>User</code> object.
 *
 * @param user The User to be managed
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public static ModelMBean createMBean(User user)
    throws Exception {

    String mname = createManagedName(user);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        Exception e = new Exception("ManagedBean is not found with "+mname);
        throw new MBeanException(e);
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ModelMBean mbean = managed.createMBean(user);
    ObjectName oname = createObjectName(domain, user);
    mserver.registerMBean(mbean, oname);
    return (mbean);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:27,代码来源:MBeanUtils.java

示例14: destroyMBean

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Deregister the MBean for this
 * <code>User</code> object.
 *
 * @param user The User to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 */
public static void destroyMBean(User user)
    throws Exception {

    String mname = createManagedName(user);
    ManagedBean managed = registry.findManagedBean(mname);
    if (managed == null) {
        return;
    }
    String domain = managed.getDomain();
    if (domain == null)
        domain = mserver.getDefaultDomain();
    ObjectName oname = createObjectName(domain, user);
    mserver.unregisterMBean(oname);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:24,代码来源:MBeanUtils.java

示例15: removeRole

import org.apache.catalina.User; //导入依赖的package包/类
/**
 * Remove the specified {@link Role} from this user database.
 *
 * @param role The role to be removed
 */
public void removeRole(Role role) {

    synchronized (roles) {
        Iterator groups = getGroups();
        while (groups.hasNext()) {
            Group group = (Group) groups.next();
            group.removeRole(role);
        }
        Iterator users = getUsers();
        while (users.hasNext()) {
            User user = (User) users.next();
            user.removeRole(role);
        }
        roles.remove(role.getRolename());
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:23,代码来源:MemoryUserDatabase.java


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