You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mr...@apache.org on 2017/10/30 19:04:58 UTC
[22/30] ambari git commit: AMBARI-22253. Add
TopologyConfigurationsEntity (magyari_sandor)
AMBARI-22253. Add TopologyConfigurationsEntity (magyari_sandor)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4b963392
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4b963392
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4b963392
Branch: refs/heads/branch-feature-AMBARI-14714-ui
Commit: 4b963392342c521f376218c761696989fa78344f
Parents: acab46d
Author: Sandor Magyari <sm...@hortonworks.com>
Authored: Tue Oct 24 20:51:54 2017 +0200
Committer: Sandor Magyari <sm...@hortonworks.com>
Committed: Tue Oct 24 22:20:11 2017 +0200
----------------------------------------------------------------------
.../internal/ProvisionClusterRequest.java | 7 +
.../orm/entities/HostGroupComponentEntity.java | 9 +-
.../entities/HostGroupComponentEntityPK.java | 36 +++++
.../entities/TopologyConfigurationsEntity.java | 148 +++++++++++++++++++
.../orm/entities/TopologyRequestEntity.java | 40 ++---
.../ambari/server/topology/BlueprintImplV2.java | 5 +
.../ambari/server/topology/BlueprintV2.java | 12 ++
.../server/topology/BlueprintV2Factory.java | 5 +-
.../topology/ClusterConfigurationRequest.java | 3 +-
.../server/topology/ClusterTopologyImpl.java | 12 +-
.../server/topology/PersistedStateImpl.java | 35 ++++-
.../resources/Ambari-DDL-Postgres-CREATE.sql | 15 ++
.../src/main/resources/META-INF/persistence.xml | 1 +
13 files changed, 285 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
index bfa46d8..0e1753b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
@@ -91,6 +91,11 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
public static final String CONFIGURATIONS_PROPERTY = "configurations";
/**
+ * services property name
+ */
+ public static final String SERVICES_PROPERTY = "services";
+
+ /**
* default password property name
*/
public static final String DEFAULT_PASSWORD_PROPERTY = "default_password";
@@ -184,6 +189,8 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
this.securityConfiguration = securityConfiguration;
+ //TODO parse service configs and mereg with BP service configs
+// Collection<Map<String, String>> services = properties.get(SERVICES_PROPERTY);
// Configuration configuration = configurationFactory.getConfiguration(
// (Collection<Map<String, String>>) properties.get(CONFIGURATIONS_PROPERTY));
// configuration.setParentConfiguration(blueprint.getConfiguration());
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntity.java
index 186180b..bd34d29 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntity.java
@@ -52,14 +52,13 @@ public class HostGroupComponentEntity {
private String serviceName;
@Id
- @Column(name = "instance_name", nullable = true, insertable = true, updatable = false)
- private String name;
-
-
- @Id
@Column(name = "type", nullable = false, insertable = true, updatable = false)
private String type;
+ @Id
+ @Column(name = "instance_name", nullable = true, insertable = true, updatable = false)
+ private String name;
+
@Column(name = "provision_action", nullable = true, insertable = true, updatable = false)
private String provisionAction;
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntityPK.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntityPK.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntityPK.java
index 0898133..812f0d6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntityPK.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntityPK.java
@@ -38,6 +38,18 @@ public class HostGroupComponentEntityPK {
@Column(name = "name", nullable = false, insertable = true, updatable = false, length = 100)
private String name;
+ @Id
+ @Column(name = "service_group", nullable = true, insertable = true, updatable = false)
+ private String serviceGroup;
+
+ @Id
+ @Column(name = "service_name", nullable = true, insertable = true, updatable = false)
+ private String serviceName;
+
+ @Id
+ @Column(name = "type", nullable = false, insertable = true, updatable = false)
+ private String type;
+
/**
* Get the name of the associated host group.
*
@@ -92,6 +104,30 @@ public class HostGroupComponentEntityPK {
this.name = name;
}
+ public String getServiceGroup() {
+ return serviceGroup;
+ }
+
+ public void setServiceGroup(String serviceGroup) {
+ this.serviceGroup = serviceGroup;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyConfigurationsEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyConfigurationsEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyConfigurationsEntity.java
new file mode 100644
index 0000000..a29db99
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyConfigurationsEntity.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.orm.entities;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+
+@Entity
+@Table(name = "topology_configurations")
+@TableGenerator(name = "topology_configurations_id_generator", table = "ambari_sequences",
+ pkColumnName = "sequence_name", valueColumnName = "sequence_value",
+ pkColumnValue = "topology_configurations_id_seq", initialValue = 0)
+public class TopologyConfigurationsEntity {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "topology_configurations_id_generator")
+ private Long id;
+
+ @OneToOne
+ @JoinColumn(name = "request_id", referencedColumnName = "id", nullable = false)
+ private TopologyRequestEntity topologyRequestEntity;
+
+ @Column(name = "service_group_name", length = 100, nullable = false)
+ private String serviceGroupName;
+
+ @Column(name = "service_name", length = 100, nullable = false)
+ private String serviceName;
+
+ @Column(name = "component_name", length = 100, nullable = true)
+ private String componentName;
+
+ @Column(name = "host_group_name", length = 100, nullable = true)
+ private String hostGroupName;
+
+ @Column(name = "cluster_properties")
+ @Basic(fetch = FetchType.LAZY)
+ @Lob
+ private String configProperties;
+
+ @Column(name = "cluster_attributes")
+ @Basic(fetch = FetchType.LAZY)
+ @Lob
+ private String configAttributes;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public TopologyRequestEntity getTopologyRequestEntity() {
+ return topologyRequestEntity;
+ }
+
+ public void setTopologyRequestEntity(TopologyRequestEntity topologyRequestEntity) {
+ this.topologyRequestEntity = topologyRequestEntity;
+ }
+
+ public String getServiceGroupName() {
+ return serviceGroupName;
+ }
+
+ public void setServiceGroupName(String serviceGroupName) {
+ this.serviceGroupName = serviceGroupName;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ public String getHostGroupName() {
+ return hostGroupName;
+ }
+
+ public void setHostGroupName(String hostGroupName) {
+ this.hostGroupName = hostGroupName;
+ }
+
+ public String getConfigProperties() {
+ return configProperties;
+ }
+
+ public void setConfigProperties(String configProperties) {
+ this.configProperties = configProperties;
+ }
+
+ public String getConfigAttributes() {
+ return configAttributes;
+ }
+
+ public void setConfigAttributes(String configAttributes) {
+ this.configAttributes = configAttributes;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ TopologyConfigurationsEntity that = (TopologyConfigurationsEntity) o;
+ if (!id.equals(that.id)) return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
index d281838..4b431f1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
@@ -19,17 +19,14 @@ package org.apache.ambari.server.orm.entities;
import java.util.Collection;
-import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
-import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
@@ -62,16 +59,6 @@ public class TopologyRequestEntity {
@Column(name = "bp_name", length = 100, nullable = false)
private String blueprintName;
- @Column(name = "cluster_properties")
- @Basic(fetch = FetchType.LAZY)
- @Lob
- private String clusterProperties;
-
- @Column(name = "cluster_attributes")
- @Basic(fetch = FetchType.LAZY)
- @Lob
- private String clusterAttributes;
-
@Column(name = "description", length = 1024, nullable = false)
private String description;
@@ -81,6 +68,9 @@ public class TopologyRequestEntity {
@OneToOne(mappedBy = "topologyRequestEntity", cascade = CascadeType.ALL)
private TopologyLogicalRequestEntity topologyLogicalRequestEntity;
+ @OneToMany(mappedBy = "topologyRequestEntity", cascade = CascadeType.ALL)
+ private Collection<TopologyConfigurationsEntity> topologyConfigurationsEntities;
+
@Column(name = "provision_action", length = 255, nullable = true)
@Enumerated(EnumType.STRING)
private ProvisionAction provisionAction;
@@ -117,22 +107,6 @@ public class TopologyRequestEntity {
this.blueprintName = blueprintName;
}
- public String getClusterProperties() {
- return clusterProperties;
- }
-
- public void setClusterProperties(String clusterProperties) {
- this.clusterProperties = clusterProperties;
- }
-
- public String getClusterAttributes() {
- return clusterAttributes;
- }
-
- public void setClusterAttributes(String clusterAttributes) {
- this.clusterAttributes = clusterAttributes;
- }
-
public String getDescription() {
return description;
}
@@ -157,6 +131,14 @@ public class TopologyRequestEntity {
this.topologyLogicalRequestEntity = topologyLogicalRequestEntity;
}
+ public Collection<TopologyConfigurationsEntity> getTopologyConfigurationsEntities() {
+ return topologyConfigurationsEntities;
+ }
+
+ public void setTopologyConfigurationsEntities(Collection<TopologyConfigurationsEntity> topologyConfigurationsEntity) {
+ this.topologyConfigurationsEntities = topologyConfigurationsEntity;
+ }
+
public ProvisionAction getProvisionAction() {
return provisionAction;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/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 044e78a..356a72e 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
@@ -150,6 +150,11 @@ public class BlueprintImplV2 implements BlueprintV2 {
}
@Override
+ public Service getServiceById(ServiceId serviceId) {
+ return null;
+ }
+
+ @Override
@JsonIgnore
public Collection<Service> getServicesFromServiceGroup(ServiceGroup serviceGroup, String serviceType) {
if (serviceType == null) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/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 b5d5430..3925c4f 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
@@ -80,6 +80,18 @@ public interface BlueprintV2 {
*/
Collection<ServiceId> getAllServiceIds();
+ /**
+ * Get service by Id
+ * @param serviceId
+ * @return
+ */
+ Service getServiceById(ServiceId serviceId);
+
+ /**
+ * Get all of the services represented in the blueprint.
+ *
+ * @return collection of all represented service names
+ */
Collection<Service> getAllServices();
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index 3b656e2..ddb7cf8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -73,8 +73,11 @@ public class BlueprintV2Factory {
private static StackDAO stackDao;
private ConfigurationFactory configFactory = new ConfigurationFactory();
- private final StackV2Factory stackFactory;
+ private StackV2Factory stackFactory;
+ protected BlueprintV2Factory() {
+
+ }
protected BlueprintV2Factory(StackV2Factory stackFactory) {
this.stackFactory = stackFactory;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/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 b3ce044..379a69c 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
@@ -78,7 +78,8 @@ public class ClusterConfigurationRequest {
BlueprintV2 blueprint = clusterTopology.getBlueprint();
// set initial configuration (not topology resolved)
//TODO set up proper ConfigurationContext
- ConfigurationContext configurationContext = new ConfigurationContext(blueprint.getStacks().iterator().next(), blueprint.getConfiguration());
+ ConfigurationContext configurationContext = new ConfigurationContext(blueprint.getStacks().iterator().next(), clusterTopology
+ .getConfiguration());
this.configurationProcessor = new BlueprintConfigurationProcessor(clusterTopology, configurationContext);
this.stackAdvisorBlueprintProcessor = stackAdvisorBlueprintProcessor;
removeOrphanConfigTypes();
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
index 4ef5d4c..db3f29b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java
@@ -51,6 +51,7 @@ public class ClusterTopologyImpl implements ClusterTopology {
//todo: this will need to change to allow usage of multiple bp's for the same cluster
//todo: for example: provision using bp1 and scale using bp2
private BlueprintV2 blueprint;
+ private Configuration configuration;
private Collection<Service> serviceConfigs;
private ConfigRecommendationStrategy configRecommendationStrategy;
private ProvisionAction provisionAction = ProvisionAction.INSTALL_AND_START;
@@ -74,6 +75,15 @@ public class ClusterTopologyImpl implements ClusterTopology {
registerHostGroupInfo(topologyRequest.getHostGroupInfo());
+ // merge service configs into global cluster configs
+ Map<String, Map<String, String>> properties = new HashMap<>();
+ Map<String, Map<String, Map<String, String>>> attributes = new HashMap<>();
+ serviceConfigs.forEach(service -> {
+ properties.putAll(service.getConfiguration().getProperties());
+ attributes.putAll(service.getConfiguration().getAttributes());
+ });
+ configuration = new Configuration(properties, attributes);
+
// todo extract validation to specialized service
validateTopology();
this.ambariContext = ambariContext;
@@ -102,7 +112,7 @@ public class ClusterTopologyImpl implements ClusterTopology {
@Override
@Deprecated
public Configuration getConfiguration() {
- return null;
+ return configuration;
}
public Collection<Service> getServiceConfigs() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
index a9a132b..b18915c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
@@ -40,6 +40,7 @@ import org.apache.ambari.server.orm.dao.TopologyLogicalRequestDAO;
import org.apache.ambari.server.orm.dao.TopologyLogicalTaskDAO;
import org.apache.ambari.server.orm.dao.TopologyRequestDAO;
import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
+import org.apache.ambari.server.orm.entities.TopologyConfigurationsEntity;
import org.apache.ambari.server.orm.entities.TopologyHostGroupEntity;
import org.apache.ambari.server.orm.entities.TopologyHostInfoEntity;
import org.apache.ambari.server.orm.entities.TopologyHostRequestEntity;
@@ -255,9 +256,18 @@ public class PersistedStateImpl implements PersistedState {
entity.setBlueprintName(request.getBlueprint().getName());
}
- entity.setClusterAttributes(attributesAsString(request.getConfiguration().getAttributes()));
+ Collection<TopologyConfigurationsEntity> serviceConfigurations = new ArrayList<>();
+ request.getServiceConfigs().forEach(service -> {
+ TopologyConfigurationsEntity topologyConfigurationsEntity = new TopologyConfigurationsEntity();
+ topologyConfigurationsEntity.setServiceGroupName(service.getServiceGroup().getName());
+ topologyConfigurationsEntity.setServiceName(service.getName());
+ topologyConfigurationsEntity.setConfigProperties(propertiesAsString(service.getConfiguration().getProperties()));
+ topologyConfigurationsEntity.setConfigAttributes(attributesAsString(service.getConfiguration().getAttributes()));
+ serviceConfigurations.add(topologyConfigurationsEntity);
+ });
+ entity.setTopologyConfigurationsEntities(serviceConfigurations);
+
entity.setClusterId(request.getClusterId());
- entity.setClusterProperties(propertiesAsString(request.getConfiguration().getProperties()));
entity.setDescription(request.getDescription());
if (request.getProvisionAction() != null) {
@@ -397,11 +407,24 @@ public class PersistedStateImpl implements PersistedState {
} catch (NoSuchStackException e) {
throw new RuntimeException("Unable to load blueprint while replaying topology request: " + e, e);
}
- //TODO load services, merge servie configs from Cluster template with service configs from Blueprint
+ // load Service configurations from db, set Blueprint service config as parent for each
services = new ArrayList<>();
- //configuration = createConfiguration(entity.getClusterProperties(), entity.getClusterAttributes());
- //configuration.setParentConfiguration(blueprint.getConfiguration());
-
+ entity.getTopologyConfigurationsEntities().stream().filter(topologyConfigurationsEntity -> (
+ topologyConfigurationsEntity.getComponentName() == null
+ && topologyConfigurationsEntity.getHostGroupName() == null))
+ .forEach(topologyConfigurationsEntity -> {
+
+ ServiceId serviceId = ServiceId.of(topologyConfigurationsEntity.getServiceGroupName(),
+ topologyConfigurationsEntity.getServiceName());
+ Service service = blueprint.getServiceById(serviceId);
+ Configuration configuration = createConfiguration(topologyConfigurationsEntity.getConfigProperties(),
+ topologyConfigurationsEntity.getConfigAttributes());
+ configuration.setParentConfiguration(service.getConfiguration());
+
+ service.setConfiguration(configuration);
+ services.add(service);
+
+ });
parseHostGroupInfo(entity);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index f48bcd6..482f5e8 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -538,6 +538,9 @@ CREATE TABLE hostgroup_component (
blueprint_name VARCHAR(255) NOT NULL,
hostgroup_name VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
+ service_group VARCHAR(255) NOT NULL,
+ service_name VARCHAR(255) NOT NULL,
+ type VARCHAR(255) NOT NULL,
provision_action VARCHAR(255),
CONSTRAINT PK_hostgroup_component PRIMARY KEY (blueprint_name, hostgroup_name, name),
CONSTRAINT FK_hgc_blueprint_name FOREIGN KEY (blueprint_name, hostgroup_name) REFERENCES hostgroup (blueprint_name, name));
@@ -755,6 +758,18 @@ CREATE TABLE topology_request (
CONSTRAINT PK_topology_request PRIMARY KEY (id),
CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
+CREATE TABLE topology_configurations (
+ id BIGINT NOT NULL,
+ request_id BIGINT NOT NULL,
+ service_group_name VARCHAR(100) NOT NULL,
+ service_name VARCHAR(100) NOT NULL,
+ component_name VARCHAR(100),
+ host_group_name VARCHAR(100),
+ cluster_properties TEXT,
+ cluster_attributes TEXT,
+ CONSTRAINT PK_topology_configurations PRIMARY KEY (id),
+ CONSTRAINT FK_hostgroup_req_id FOREIGN KEY (request_id) REFERENCES topology_request(id));
+
CREATE TABLE topology_hostgroup (
id BIGINT NOT NULL,
name VARCHAR(255) NOT NULL,
http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/META-INF/persistence.xml b/ambari-server/src/main/resources/META-INF/persistence.xml
index 20c95f9..5f56f09 100644
--- a/ambari-server/src/main/resources/META-INF/persistence.xml
+++ b/ambari-server/src/main/resources/META-INF/persistence.xml
@@ -87,6 +87,7 @@
<class>org.apache.ambari.server.orm.entities.WidgetLayoutEntity</class>
<class>org.apache.ambari.server.orm.entities.WidgetLayoutUserWidgetEntity</class>
<class>org.apache.ambari.server.orm.entities.TopologyRequestEntity</class>
+ <class>org.apache.ambari.server.orm.entities.TopologyConfigurationsEntity</class>
<class>org.apache.ambari.server.orm.entities.TopologyLogicalRequestEntity</class>
<class>org.apache.ambari.server.orm.entities.TopologyHostRequestEntity</class>
<class>org.apache.ambari.server.orm.entities.TopologyHostGroupEntity</class>