//referencing its config
String configName = ServerHelper.getConfigForServer(getConfigContext(),
target.getName()).getName();
if (!ConfigAPIHelper.isConfigurationReferencedByServerOnly(getConfigContext(),
configName, target.getName())) {
throw new ConfigException(localStrings.getString(
"configurationHasMultipleRefs", target.getName(), configName,
ConfigAPIHelper.getConfigurationReferenceesAsString(
getConfigContext(), configName)));
}
} else if (target.getType() == TargetType.CLUSTER) {
//If we are operating on a cluster, ensure that the cluster is the only entity
//referencing its config
String configName = ClusterHelper.getConfigForCluster(getConfigContext(),
target.getName()).getName();
if (!ConfigAPIHelper.isConfigurationReferencedByClusterOnly(getConfigContext(),
configName, target.getName())) {
throw new ConfigException(localStrings.getString(
"configurationHasMultipleRefs", target.getName(), configName,
ConfigAPIHelper.getConfigurationReferenceesAsString(
getConfigContext(), configName)));
}
}