setting : settingValue) {
- if (!StringUtils.isEmpty(setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED))) {
- return setting.get(Setting.SETTING_NAME_RECOVERY_ENABLED);
- }
- }
-
- return null;
- }
-
- /**
- * Get whether the specified service is enabled for credential store use.
- *
- *
- * {@code
- * {
- * "service_settings" : [
- * { "name" : "RANGER",
- * "recovery_enabled" : "true",
- * "credential_store_enabled" : "true"
- * },
- * { "name" : "HIVE",
- * "recovery_enabled" : "true",
- * "credential_store_enabled" : "false"
- * },
- * { "name" : "TEZ",
- * "recovery_enabled" : "false"
- * }
- * ]
- * }
- * }
- *
- *
- * @param serviceName - Service name.
- *
- * @return null if value is not specified; true or false if specified.
- */
- @Override
- public String getCredentialStoreEnabled(String serviceName) {
- if (setting == null)
- return null;
-
- // Look up the service and return the credential_store_enabled value.
- Set> settingValue = setting.getSettingValue(Setting.SETTING_NAME_SERVICE_SETTINGS);
- for (Map setting : settingValue) {
- String name = setting.get(Setting.SETTING_NAME_NAME);
- if (StringUtils.equals(name, serviceName)) {
- if (!StringUtils.isEmpty(setting.get(Setting.SETTING_NAME_CREDENTIAL_STORE_ENABLED))) {
- return setting.get(Setting.SETTING_NAME_CREDENTIAL_STORE_ENABLED);
- }
- break;
- }
- }
-
- return null;
- }
-
- @Override
- public boolean shouldSkipFailure() {
- if (setting == null) {
- return false;
- }
- Set> settingValue = setting.getSettingValue(Setting.SETTING_NAME_DEPLOYMENT_SETTINGS);
- for (Map setting : settingValue) {
- if (setting.containsKey(Setting.SETTING_NAME_SKIP_FAILURE)) {
- return setting.get(Setting.SETTING_NAME_SKIP_FAILURE).equalsIgnoreCase("true");
- }
- }
- return false;
- }
-
- @Override
public Collection getMpacks() {
return mpacks;
}
- public StackDefinition getStack() {
- return stack;
- }
-
- /**
- * Get host groups which contain a component.
- *
- * @param component component name
- *
- * @return collection of host groups which contain the specified component
- */
@Override
public Collection getHostGroupsForComponent(String component) {
Collection resultGroups = new HashSet<>();
@@ -316,24 +148,7 @@ public Collection getHostGroupsForComponent(String component) {
return resultGroups;
}
- /**
- * Get host groups which contain a component for the given service.
- *
- * @param service service name
- *
- * @return collection of host groups which contain a component of the specified service
- */
@Override
- public Collection getHostGroupsForService(String service) {
- Collection resultGroups = new HashSet<>();
- for (HostGroup group : hostGroups.values() ) {
- if (group.getServices().contains(service)) {
- resultGroups.add(group);
- }
- }
- return resultGroups;
- }
-
public BlueprintEntity toEntity() {
BlueprintEntity entity = new BlueprintEntity();
entity.setBlueprintName(name);
@@ -388,7 +203,7 @@ private Collection parseMpacks(BlueprintEntity blueprintEntity) t
private Map parseBlueprintHostGroups(BlueprintEntity entity) {
Map hostGroups = new HashMap<>();
for (HostGroupEntity hostGroupEntity : entity.getHostGroups()) {
- HostGroupImpl hostGroup = new HostGroupImpl(hostGroupEntity, getName(), getStack());
+ HostGroupImpl hostGroup = new HostGroupImpl(hostGroupEntity);
// set the bp configuration as the host group config parent
hostGroup.getConfiguration().setParentConfiguration(configuration);
hostGroups.put(hostGroupEntity.getName(), hostGroup);
@@ -405,15 +220,6 @@ private Configuration processConfiguration(Collection extends BlueprintConfigu
parseAttributes(configs), null);
}
- /**
- * Process blueprint setting.
- */
- private Setting processSetting(Collection blueprintSetting) {
- return blueprintSetting != null
- ? new Setting(parseSetting(blueprintSetting))
- : null;
- }
-
/**
* Obtain configuration as a map of config type to corresponding properties.
*
@@ -436,14 +242,16 @@ private Map> parseConfigurations(Collection extend
*
* @return map of setting name to map of properties
*/
- private Map>> parseSetting(Collection extends BlueprintSettingEntity> blueprintSetting) {
+ private static Map>> parseSetting(Collection extends BlueprintSettingEntity> blueprintSetting) {
+ if (blueprintSetting == null) {
+ return ImmutableMap.of();
+ }
- Map>> properties = new HashMap<>();
+ Map>> properties = new HashMap<>();
Gson gson = new Gson();
for (BlueprintSettingEntity setting : blueprintSetting) {
String settingName = setting.getSettingName();
- Set> settingProperties = gson.>>fromJson(
- setting.getSettingData(), Set.class);
+ Set