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

The following examples show how to use org.apache.catalina.UserDatabase#removeUser() . 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
/**
 * 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;
    }
}
 
Example 2
Source File: MemoryUserDatabaseMBean.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
    }

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

}