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


Java UserDatabase.createRole方法代码示例

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


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

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

示例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:how2j,项目名称:lazycat,代码行数:24,代码来源:MemoryUserDatabaseMBean.java

示例3: start

import org.apache.catalina.UserDatabase; //导入方法依赖的package包/类
public void start(final StandardServer server) {
    if (SystemInstance.get().isDefaultProfile()) { // add user tomee is no user are specified
        try {
            final NamingResourcesImpl resources = server.getGlobalNamingResources();
            final ContextResource userDataBaseResource = resources.findResource("UserDatabase");
            final UserDatabase db = (UserDatabase) server.getGlobalNamingContext().lookup(userDataBaseResource.getName());
            if (!db.getUsers().hasNext() && db instanceof MemoryUserDatabase) {
                final MemoryUserDatabase mudb = (MemoryUserDatabase) db;
                final boolean oldRo = mudb.getReadonly();
                try {
                    ((MemoryUserDatabase) db).setReadonly(false);

                    db.createRole("tomee-admin", "tomee admin role");
                    db.createUser("tomee", "tomee", "TomEE");
                    db.findUser("tomee").addRole(db.findRole("tomee-admin"));
                } finally {
                    mudb.setReadonly(oldRo);
                }
            }
        } catch (final Throwable t) {
            // no-op
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:25,代码来源:TomcatWebAppBuilder.java

示例4: 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) {
        throw new IllegalArgumentException("Exception creating role " +
                                           role + " MBean: " + e);
    }
    return (findRole(rolename));

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


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