Java Code Examples for org.apache.catalina.UserDatabase#findGroup()

The following examples show how to use org.apache.catalina.UserDatabase#findGroup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemoryUserDatabaseMBean.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Return the MBean Name for the specified group name (if any);
 * otherwise return <code>null</code>.
 *
 * @param groupname Group name to look up
 * @return the group object name
 */
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;
    }
}
 
Example 2
Source File: MemoryUserDatabaseMBean.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 3
Source File: MemoryUserDatabaseMBean.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
    }

}
 
Example 4
Source File: MemoryUserDatabaseMBean.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
    }

}
 
Example 5
Source File: MemoryUserDatabaseMBean.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
    }

}
 
Example 6
Source File: MemoryUserDatabaseMBean.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
    }

}