//Delete the resource reference only if the resource is referenced
//by the target server only
if (!ServerHelper.serverReferencesResource(getConfigContext(),
tgtName, resRef)) {
throw new ConfigException(localStrings.getString("serverResourceRefDoesNotExist",
tgtName, resRef));
} else if (ResourceHelper.isResourceReferencedByServerOnly(getConfigContext(),
resRef, tgtName)) {
getResourceReferenceHelper().deleteResourceReference(tgtName, resRef);
} else {
throw new ConfigException(localStrings.getString("resourceHasMultipleRefs",
tgtName, resRef, ResourceHelper.getResourceReferenceesAsString(
getConfigContext(), resRef)));
}
} else if (target.getType() == TargetType.CLUSTER) {
//Delete the resource reference only if the resource is referenced
//by the target cluster only
if (!ClusterHelper.clusterReferencesResource(getConfigContext(),
tgtName, resRef)) {
throw new ConfigException(localStrings.getString("clusterResourceRefDoesNotExist",
tgtName, resRef));
} else if (ResourceHelper.isResourceReferencedByClusterOnly(getConfigContext(),
resRef, tgtName)) {
getResourceReferenceHelper().deleteResourceReference(tgtName, resRef);
} else {
throw new ConfigException(localStrings.getString("resourceHasMultipleRefs",
tgtName, resRef, ResourceHelper.getResourceReferenceesAsString(
getConfigContext(), resRef)));
}
}
//As a sanity check ensure that the resource has no references; otherwise
//it cannot be deleted from the domain
if (ResourceHelper.isResourceReferenced(getConfigContext(), resRef)) {
throw new ConfigException(localStrings.getString("resourceIsReferenced",
resRef, ResourceHelper.getResourceReferenceesAsString(
getConfigContext(), resRef)));
}
/* }
catch (javax.management.MalformedObjectNameException mone) {}