public void initialiseManagement(ServerConfiguration config) throws ConfigurationException
{
try
{
AMQUserManagementMBean _mbean = new AMQUserManagementMBean();
List<String> principalDBs = config.getManagementPrincipalDBs();
if (principalDBs.isEmpty())
{
throw new ConfigurationException("No principal-database specified for jmx security");
}
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.getManagementAccessList();
if (jmxaccesslist.isEmpty())
{
throw new ConfigurationException("No access control files specified for jmx security");
}
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);
}
_mbean.register();
}
catch (JMException e)
{
_logger.warn("User management disabled as unable to create MBean:" + e);
}