public void initialiseManagement(Configuration config) throws ConfigurationException
{
try
{
AMQUserManagementMBean _mbean = new AMQUserManagementMBean();
String baseSecurity = "security.jmx";
List<String> principalDBs = config.getList(baseSecurity + ".principal-database");
if (principalDBs.size() == 0)
{
throw new ConfigurationException("No principal-database specified for jmx security(" + baseSecurity + ".principal-database)");
}
String databaseName = principalDBs.get(0);
PrincipalDatabase database = getDatabases().get(databaseName);
if (database == null)
{
throw new ConfigurationException("Principal-database '" + databaseName + "' not found");
}
_mbean.setPrincipalDatabase(database);
List<String> jmxaccesslist = config.getList(baseSecurity + ".access");
if (jmxaccesslist.size() == 0)
{
throw new ConfigurationException("No access control files specified for jmx security(" + baseSecurity + ".access)");
}
String jmxaccesssFile = null;
try
{
jmxaccesssFile = PropertyUtils.replaceProperties(jmxaccesslist.get(0));
}
catch (PropertyException e)
{
throw new ConfigurationException("Unable to parse access control filename '" + jmxaccesssFile + "'");
}
try
{
_mbean.setAccessFile(jmxaccesssFile);
}
catch (IOException e)
{
_logger.warn("Unable to load access file:" + jmxaccesssFile);
}
try
{
_mbean.register();
}
catch (AMQException e)
{
_logger.warn("Unable to register user management MBean");
}