use of javax.management.MalformedObjectNameException in project tomcat70 by apache.
the class MemoryUserDatabaseMBean method findGroup.
/**
* 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;
}
}
use of javax.management.MalformedObjectNameException in project tomcat70 by apache.
the class MemoryUserDatabaseMBean method findUser.
/**
* 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;
}
}
use of javax.management.MalformedObjectNameException in project tomcat70 by apache.
the class UserMBean method getGroups.
// ------------------------------------------------------------- Attributes
/**
* 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()]);
}
use of javax.management.MalformedObjectNameException in project tomcat70 by apache.
the class UserMBean method getRoles.
/**
* 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()]);
}
use of javax.management.MalformedObjectNameException in project tomcat70 by apache.
the class SlowQueryReportJmx method deregisterJmx.
protected void deregisterJmx() {
try {
if (mbeans.remove(poolName) != null) {
ObjectName oname = getObjectName(getClass(), poolName);
ManagementFactory.getPlatformMBeanServer().unregisterMBean(oname);
}
} catch (MBeanRegistrationException e) {
log.debug("Jmx deregistration failed.", e);
} catch (InstanceNotFoundException e) {
log.debug("Jmx deregistration failed.", e);
} catch (MalformedObjectNameException e) {
log.warn("Jmx deregistration failed.", e);
} catch (RuntimeOperationsException e) {
log.warn("Jmx deregistration failed.", e);
}
}
Aggregations