final Target target = TargetBuilder.INSTANCE.createTarget(VALID_TYPES, targetName,
configContext);
if (target.getType().equals(TargetType.DOMAIN)) {
//create domain property
final Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);
final SystemProperty sysProp = domain.getSystemPropertyByName(propertyName);
//Ensure that the property specified exists
if (sysProp == null) {
throw new ConfigException(_strMgr.getString("propertyDoesNotExist",
propertyName, target.getName()));
}
//Remove the property
domain.removeSystemProperty(sysProp, OVERWRITE);
} else if (target.getType().equals(TargetType.CONFIG)){
//create configuration property
final Config config = ConfigAPIHelper.getConfigByName(configContext,
target.getName());
final SystemProperty sysProp = config.getSystemPropertyByName(propertyName);
//Ensure that the property specified exists
if (sysProp == null) {
throw new ConfigException(_strMgr.getString("propertyDoesNotExist",
propertyName, target.getName()));
}
//Remove the property
config.removeSystemProperty(sysProp, OVERWRITE);
} else if (target.getType().equals(TargetType.CLUSTER)) {
//create instance property
final Cluster cluster = ClusterHelper.getClusterByName(configContext,
target.getName());
final SystemProperty sysProp = cluster.getSystemPropertyByName(propertyName);
//Ensure that the property specified exists
if (sysProp == null) {
throw new ConfigException(_strMgr.getString("propertyDoesNotExist",
propertyName, target.getName()));
}
//Remove the property
cluster.removeSystemProperty(sysProp, OVERWRITE);
} else if (target.getType().equals(TargetType.SERVER) ||
target.getType().equals(TargetType.DAS)) {
//create instance property
final Server server = ServerHelper.getServerByName(configContext, target.getName());
final SystemProperty sysProp = server.getSystemPropertyByName(propertyName);
//Ensure that the property specified exists
if (sysProp == null) {
throw new ConfigException(_strMgr.getString("propertyDoesNotExist",
propertyName, target.getName()));
}
SystemProperty removedProp = new SystemProperty();
removedProp.setName(sysProp.getName());
removedProp.setValue(sysProp.getValue());
//Remove the property
server.removeSystemProperty(sysProp, OVERWRITE);
/*
*Fix for bug 6303353
*We do not have to check if the system-property being deleted in this server-instance