private Set<String> validateRoleCategoryDependencies(
ApiComponentInfo apiOriginComponentInfo, Set<String> allRoles, List<String> unRecogRoles) {
List<String> masterRoles = new ArrayList<String>();
List<String> slaveRoles = new ArrayList<String>();
Set<String> NotExistDenpendencies = new HashSet<String>();
ComponentCategory componentCategory =
ComponentCategory.valueOf(apiOriginComponentInfo
.getComponentCategory());
if (componentCategory.isMaster()) {
return NotExistDenpendencies;
}
ApiStackService apiTargetService =
apiManager.getStackServiceWithComponents(
apiOriginComponentInfo.getStackName(),
apiOriginComponentInfo.getStackVersion(),
apiOriginComponentInfo.getServiceName());
for (ApiStackComponent apiTargetComponent : apiTargetService
.getServiceComponents()) {
ApiComponentInfo apiTargetComponentInfo =
apiTargetComponent.getApiComponent();
ComponentCategory targetComponentCategory =
ComponentCategory.valueOf(apiTargetComponentInfo
.getComponentCategory());
ComponentName componentName =
ComponentName.valueOf(apiTargetComponentInfo.getComponentName());
if (isNamenodeHa(allRoles, unRecogRoles)) {
if (componentName.isSecondaryNamenode()) {
continue;
}
} else {
if (componentName.isJournalnode() || componentName.isZkfc()) {
continue;
}
}
if (targetComponentCategory.isMaster()) {
masterRoles.add(componentName.toString());
}
if (targetComponentCategory.isSlave()) {
slaveRoles.add(componentName.toString());
}
}
if (componentCategory.isSlave()) {
for (String masterRole : masterRoles) {