String stackVersion = clusterInfo.get("stackVersion");
List<ClusterServiceEntity> clusterServiceEntities = clusterServiceDAO.findAll();
for (final ClusterServiceEntity clusterServiceEntity : clusterServiceEntities) {
String serviceName = clusterServiceEntity.getServiceName();
ServiceInfo serviceInfo = null;
try {
serviceInfo = ambariMetaInfo.getService(stackName, stackVersion, serviceName);
} catch (AmbariException e) {
LOG.error("Service " + serviceName + " not found for " + stackName + stackVersion);
continue;
}
List<String> configTypes = serviceInfo.getConfigDependencies();
if (configTypes != null) {
for (String configType : configTypes) {
if (configType.contains(log4jConfigTypeContains)) {
ClusterConfigEntityPK configEntityPK = new ClusterConfigEntityPK();
configEntityPK.setClusterId(clusterId);
configEntityPK.setType(configType);
configEntityPK.setTag(defaultVersionTag);
ClusterConfigEntity configEntity = clusterDAO.findConfig(configEntityPK);
if (configEntity == null) {
String filename = configType + ".xml";
Map<String, String> properties = new HashMap<String, String>();
for (PropertyInfo propertyInfo : serviceInfo.getProperties()) {
if (filename.equals(propertyInfo.getFilename())) {
properties.put(propertyInfo.getName(), propertyInfo.getValue());
}
}
if (!properties.isEmpty()) {