"configurationSourceInvalid", sourceConfigName));
}
//Ensure that a configuration with the standalone configuration name
//does not already exist.
Domain domain = ConfigAPIHelper.getDomainConfigBean(configContext);
Configs configs = domain.getConfigs();
Config newConfig = configs.getConfigByName(newConfigName);
if (newConfig != null) {
throw new ConfigException(_strMgr.getString(
"configurationAlreadyExists", newConfigName));
}
//"domain" is a restricted name
if ("domain".equals(newConfigName)) {
throw new ConfigException(_strMgr.getString(
"configurationNameRestricted", newConfigName));
}
// Ensure that the name is a valid target meaning that there are no
// servers and clusters with the same name
Servers servers = domain.getServers();
Server server = servers.getServerByName(newConfigName);
if (server != null) {
throw new ConfigException(_strMgr.getString(
"configurationNameAlreadyExistsAsServer", newConfigName));
}
Clusters clusters = domain.getClusters();
Cluster cluster = clusters.getClusterByName(newConfigName);
if (cluster != null) {
throw new ConfigException(_strMgr.getString(
"configurationNameAlreadyExistsAsCluster", newConfigName));
}
NodeAgents nas = domain.getNodeAgents();
NodeAgent na = nas.getNodeAgentByName(newConfigName);
if (na != null) {
throw new ConfigException(_strMgr.getString(
"configurationNameAlreadyExistsAsNodeAgent", newConfigName));
}