target.getTarget().getType() == TargetType.DAS) {
// make sure we have the reference before we delete it
if (isDeleting) {
if (!ServerHelper.serverReferencesApplication(
getConfigContext(), targetName, appName)) {
throw new IASDeploymentException(localStrings.getString("serverApplicationRefDoesNotExist", targetName, appName));
}
// make sure we don't have the reference already before
// we create it again
} else {
if (ServerHelper.serverReferencesApplication(
getConfigContext(), targetName, appName)) {
throw new IASDeploymentException(localStrings.getString("serverApplicationRefAlreadyExists", appName, targetName));
}
}
} else if (target.getTarget().getType() == TargetType.CLUSTER){
// make sure we have the reference before we delete it
if (isDeleting) {
if (!ClusterHelper.clusterReferencesApplication(
getConfigContext(), targetName, appName)) {
throw new IASDeploymentException(localStrings.getString("clusterApplicationRefDoesNotExist", targetName, appName));
}
// make sure we don't have the reference already before
// we create it again
} else {
if (ClusterHelper.clusterReferencesApplication(
getConfigContext(), targetName, appName)) {
throw new IASDeploymentException(localStrings.getString("clusterApplicationRefAlreadyExists", appName, targetName));
}
}
}
return target;
} catch (IASDeploymentException ex) {
throw (ex);
} catch (Exception ex) {
throw new IASDeploymentException(ex);
}
}