You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2017/11/17 15:43:27 UTC
ambari git commit: AMBARI-22297. Fix possible ClassCastException
(adoroszlai)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-14714-blueprintv2 7a7766115 -> e364cfd76
AMBARI-22297. Fix possible ClassCastException (adoroszlai)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e364cfd7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e364cfd7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e364cfd7
Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: e364cfd769aa6a71c6f0531179b6656542f67357
Parents: 7a77661
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Fri Nov 17 16:32:18 2017 +0100
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Fri Nov 17 16:32:18 2017 +0100
----------------------------------------------------------------------
.../apache/ambari/server/topology/BlueprintImplV2.java | 4 ++--
.../org/apache/ambari/server/topology/BlueprintV2.java | 6 +++---
.../server/topology/ClusterConfigurationRequest.java | 11 ++++-------
3 files changed, 9 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e364cfd7/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
index ad98adc..93dba0c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
@@ -291,8 +291,8 @@ public class BlueprintImplV2 implements BlueprintV2 {
@Nonnull
@Override
- public Collection<String> getComponentNames(ServiceId serviceId) {
- return getComponents(serviceId).stream().map(ComponentV2::getName).collect(toList());
+ public Set<String> getComponentNames(ServiceId serviceId) {
+ return getComponents(serviceId).stream().map(ComponentV2::getName).collect(toSet());
}
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/e364cfd7/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
index f6314be..eed0b68 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
@@ -21,6 +21,7 @@ package org.apache.ambari.server.topology;
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.annotation.Nonnull;
@@ -124,11 +125,10 @@ public interface BlueprintV2 {
* Get the components that are included in the blueprint for the specified service.
*
* @param serviceId serviceId
- *
- * @return collection of component names for the service. Will not return null.
+ * @return set of component names for the service. Will not return null.
*/
@Nonnull
- Collection<String> getComponentNames(ServiceId serviceId);
+ Set<String> getComponentNames(ServiceId serviceId);
/**
* Get the component names s that are included in the blueprint for the specified service.
http://git-wip-us.apache.org/repos/asf/ambari/blob/e364cfd7/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
index 379a69c..96550d5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
@@ -179,7 +179,7 @@ public class ClusterConfigurationRequest {
// generate principals & keytabs for headless identities
AmbariContext.getController().getKerberosHelper()
.ensureHeadlessIdentities(cluster, existingConfigurations,
- new HashSet(blueprint.getAllServices()));
+ new HashSet<>(blueprint.getAllServiceNames()));
// apply Kerberos specific configurations
Map<String, Map<String, String>> updatedConfigs = AmbariContext.getController().getKerberosHelper()
@@ -238,13 +238,10 @@ public class ClusterConfigurationRequest {
Map<String, Set<String>> serviceComponents = new HashMap<>();
Collection<Service> services = blueprint.getAllServices();
- if(services != null) {
+ if (services != null) {
for (Service service : services) {
- Collection<ComponentV2> components = blueprint.getComponents(service);
- serviceComponents.put(service.getType(),
- (components == null)
- ? Collections.emptySet()
- : new HashSet(blueprint.getComponents(service)));
+ ServiceId serviceId = service.getId();
+ serviceComponents.put(service.getType(), blueprint.getComponentNames(serviceId));
}
}