• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UserDatabase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createGroup

import org.apache.catalina.UserDatabase; //导入依赖的package包/类
/**
 * Create a new Group and return the corresponding MBean Name.
 *
 * @param groupname Group name of the new group
 * @param description Description of the new group
 */
public String createGroup(String groupname, String description) {

    UserDatabase database = (UserDatabase) this.resource;
    Group group = database.createGroup(groupname, description);
    try {
        MBeanUtils.createMBean(group);
    } catch (Exception e) {
        IllegalArgumentException iae = new IllegalArgumentException
            ("Exception creating group [" + groupname + "] MBean");
        iae.initCause(e);
        throw iae;
    }
    return (findGroup(groupname));

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


示例2: createRole

import org.apache.catalina.UserDatabase; //导入依赖的package包/类
/**
 * Create a new Role and return the corresponding MBean Name.
 *
 * @param rolename Group name of the new group
 * @param description Description of the new group
 */
public String createRole(String rolename, String description) {

    UserDatabase database = (UserDatabase) this.resource;
    Role role = database.createRole(rolename, description);
    try {
        MBeanUtils.createMBean(role);
    } catch (Exception e) {
        IllegalArgumentException iae = new IllegalArgumentException
            ("Exception creating role [" + rolename + "] MBean");
        iae.initCause(e);
        throw iae;
    }
    return (findRole(rolename));

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


示例3: createUser

import org.apache.catalina.UserDatabase; //导入依赖的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


示例4: findGroup

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

    UserDatabase database = (UserDatabase) this.resource;
    Group group = database.findGroup(groupname);
    if (group == null) {
        return (null);
    }
    try {
        ObjectName oname =
            MBeanUtils.createObjectName(managedGroup.getDomain(), group);
        return (oname.toString());
    } catch (MalformedObjectNameException e) {
        IllegalArgumentException iae = new IllegalArgumentException
            ("Cannot create object name for group [" + groupname + "]");
        iae.initCause(e);
        throw iae;
    }

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


示例5: findRole

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

    UserDatabase database = (UserDatabase) this.resource;
    Role role = database.findRole(rolename);
    if (role == null) {
        return (null);
    }
    try {
        ObjectName oname =
            MBeanUtils.createObjectName(managedRole.getDomain(), role);
        return (oname.toString());
    } catch (MalformedObjectNameException e) {
        IllegalArgumentException iae = new IllegalArgumentException
            ("Cannot create object name for role [" + rolename + "]");
        iae.initCause(e);
        throw iae;
    }

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


示例6: findUser

import org.apache.catalina.UserDatabase; //导入依赖的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


示例7: removeGroup

import org.apache.catalina.UserDatabase; //导入依赖的package包/类
/**
 * Remove an existing group and destroy the corresponding MBean.
 *
 * @param groupname Group name to remove
 */
public void removeGroup(String groupname) {

    UserDatabase database = (UserDatabase) this.resource;
    Group group = database.findGroup(groupname);
    if (group == null) {
        return;
    }
    try {
        MBeanUtils.destroyMBean(group);
        database.removeGroup(group);
    } catch (Exception e) {
        IllegalArgumentException iae = new IllegalArgumentException
            ("Exception destroying group [" + groupname + "] MBean");
        iae.initCause(e);
        throw iae;
    }

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


示例8: removeRole

import org.apache.catalina.UserDatabase; //导入依赖的package包/类
/**
 * Remove an existing role and destroy the corresponding MBean.
 *
 * @param rolename Role name to remove
 */
public void removeRole(String rolename) {

    UserDatabase database = (UserDatabase) this.resource;
    Role role = database.findRole(rolename);
    if (role == null) {
        return;
    }
    try {
        MBeanUtils.destroyMBean(role);
        database.removeRole(role);
    } catch (Exception e) {
        IllegalArgumentException iae = new IllegalArgumentException
            ("Exception destroying role [" + rolename + "] MBean");
        iae.initCause(e);
        throw iae;
    }

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


示例9: removeUser

import org.apache.catalina.UserDatabase; //导入依赖的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


示例10: createMBean

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

    String mname = createManagedName(userDatabase);
    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(userDatabase);
    ObjectName oname = createObjectName(domain, userDatabase);
    if( mserver.isRegistered( oname ))  {
        mserver.unregisterMBean(oname);
    }
    mserver.registerMBean(mbean, oname);
    return (mbean);

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


示例11: destroyMBean

import org.apache.catalina.UserDatabase; //导入依赖的package包/类
/**
 * Deregister the MBean for this
 * <code>UserDatabase</code> object.
 *
 * @param userDatabase The UserDatabase to be managed
 *
 * @exception Exception if an MBean cannot be deregistered
 * @deprecated  Unused. Will be removed in Tomcat 8.0.x
 */
@Deprecated
static void destroyMBean(UserDatabase userDatabase)
    throws Exception {

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

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


示例12: startInternal

import org.apache.catalina.UserDatabase; //导入依赖的package包/类
/**
 * Prepare for the beginning of active use of the public methods of this
 * component and implement the requirements of
 * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected void startInternal() throws LifecycleException {

    try {
        Context context = getServer().getGlobalNamingContext();
        database = (UserDatabase) context.lookup(resourceName);
    } catch (Throwable e) {
        ExceptionUtils.handleThrowable(e);
        containerLog.error(sm.getString("userDatabaseRealm.lookup",
                                        resourceName),
                           e);
        database = null;
    }
    if (database == null) {
        throw new LifecycleException
            (sm.getString("userDatabaseRealm.noDatabase", resourceName));
    }

    super.startInternal();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:29,代码来源:UserDatabaseRealm.java


示例13: createGroup

import org.apache.catalina.UserDatabase; //导入依赖的package包/类
/**
 * Create a new Group and return the corresponding MBean Name.
 *
 * @param groupname Group name of the new group
 * @param description Description of the new group
 */
public String createGroup(String groupname, String description) {

    UserDatabase database = (UserDatabase) this.resource;
    Group group = database.createGroup(groupname, description);
    /*
    if (roles != null) {
        for (int i = 0; i < roles.length; i++) {
            Role role = database.findRole(roles[i]);
            if (role == null) {
                createRole(roles[i], null);
                role = database.findRole(roles[i]);
            }
            group.addRole(role);
        }
    }
    */
    try {
        MBeanUtils.createMBean(group);
    } catch (Exception e) {
        throw new IllegalArgumentException("Exception creating group " +
                                           group + " MBean: " + e);
    }
    return (findGroup(groupname));

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


示例14: findGroup

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

    UserDatabase database = (UserDatabase) this.resource;
    Group group = database.findGroup(groupname);
    if (group == null) {
        return (null);
    }
    try {
        ObjectName oname =
            MBeanUtils.createObjectName(managedGroup.getDomain(), group);
        return (oname.toString());
    } catch (MalformedObjectNameException e) {
        throw new IllegalArgumentException
            ("Cannot create object name for group " + group);
    }

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


示例15: findRole

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

    UserDatabase database = (UserDatabase) this.resource;
    Role role = database.findRole(rolename);
    if (role == null) {
        return (null);
    }
    try {
        ObjectName oname =
            MBeanUtils.createObjectName(managedRole.getDomain(), role);
        return (oname.toString());
    } catch (MalformedObjectNameException e) {
        throw new IllegalArgumentException
            ("Cannot create object name for role " + role);
    }

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


示例16: findUser

import org.apache.catalina.UserDatabase; //导入依赖的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


示例17: removeGroup

import org.apache.catalina.UserDatabase; //导入依赖的package包/类
/**
 * Remove an existing group and destroy the corresponding MBean.
 *
 * @param groupname Group name to remove
 */
public void removeGroup(String groupname) {

    UserDatabase database = (UserDatabase) this.resource;
    Group group = database.findGroup(groupname);
    if (group == null) {
        return;
    }
    try {
        MBeanUtils.destroyMBean(group);
        database.removeGroup(group);
    } catch (Exception e) {
        throw new IllegalArgumentException("Exception destroying group " +
                                           group + " MBean: " + e);
    }

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


示例18: removeRole

import org.apache.catalina.UserDatabase; //导入依赖的package包/类
/**
 * Remove an existing role and destroy the corresponding MBean.
 *
 * @param rolename Role name to remove
 */
public void removeRole(String rolename) {

    UserDatabase database = (UserDatabase) this.resource;
    Role role = database.findRole(rolename);
    if (role == null) {
        return;
    }
    try {
        MBeanUtils.destroyMBean(role);
        database.removeRole(role);
    } catch (Exception e) {
        throw new IllegalArgumentException("Exception destroying role " +
                                           role + " MBean: " + e);
    }

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


示例19: removeUser

import org.apache.catalina.UserDatabase; //导入依赖的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


示例20: createMBean

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

    String mname = createManagedName(userDatabase);
    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(userDatabase);
    ObjectName oname = createObjectName(domain, userDatabase);
    mserver.registerMBean(mbean, oname);
    return (mbean);

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Quantile类代码示例发布时间:2022-05-22
下一篇:
Java VmStatusChangeEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap