instance, ServerInformation.class, false);
int major = simb.getManagementApiMajorVersion();
int minor = simb.getManagementApiMinorVersion();
serverRegistry.setManagementApiVersion(new ApiVersion(major, minor));
}
return;
}
//ServerInformation mbean was not present, so this is a older pre-v1.3 API server.
//Detect the value of the 'version' key property on the UserManagement MBean ObjectName.
//If present, we have a v1.2 API server. If null, we have a v1.1 API server.
ObjectName umMBeanObjectName = null;
List<ManagedBean> mbeans = getManagedObjectsForDomain(server, serverRegistry, Constants.DEFAULT_DOMAIN);
for(ManagedBean mbean: mbeans)
{
if("UserManagement".equalsIgnoreCase(mbean.getType()))
{
umMBeanObjectName = ((JMXManagedObject) mbean).getObjectName();
break;
}
}
if(umMBeanObjectName != null)
{
//UserManagement MBean was present, determine if it has a version key
if(umMBeanObjectName.getKeyProperty("version") != null)
{
serverRegistry.setManagementApiVersion(new ApiVersion(1, 2));
}
else
{
//no version key,
serverRegistry.setManagementApiVersion(new ApiVersion(1, 1));
}
return;
}
//UserManagement MBean was not present, connected to an old server: classify as v1.0 API
serverRegistry.setManagementApiVersion(new ApiVersion(1, 0));
}