ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject [2/4] ambari git commit: AMBARI-21201. Add ConfigChange event to capture config changes (mpapirkovskyy)
Date Thu, 22 Jun 2017 15:28:13 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/ComponentStatusReports.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/ComponentStatusReports.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/ComponentStatusReports.java
index 2a3e4bc..a53570c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/ComponentStatusReports.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/ComponentStatusReports.java
@@ -19,27 +19,27 @@
 package org.apache.ambari.server.agent.stomp.dto;
 
 import java.util.List;
-import java.util.Map;
+import java.util.TreeMap;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 public class ComponentStatusReports {
 
   @JsonProperty("clustersReports")
-  private Map<String, List<ComponentStatusReport>> componentStatusReports;
+  private TreeMap<String, List<ComponentStatusReport>> componentStatusReports;
 
   public ComponentStatusReports() {
   }
 
-  public ComponentStatusReports(Map<String, List<ComponentStatusReport>> componentStatusReports) {
+  public ComponentStatusReports(TreeMap<String, List<ComponentStatusReport>> componentStatusReports) {
     this.componentStatusReports = componentStatusReports;
   }
 
-  public Map<String, List<ComponentStatusReport>> getComponentStatusReports() {
+  public TreeMap<String, List<ComponentStatusReport>> getComponentStatusReports() {
     return componentStatusReports;
   }
 
-  public void setComponentStatusReports(Map<String, List<ComponentStatusReport>> componentStatusReports) {
+  public void setComponentStatusReports(TreeMap<String, List<ComponentStatusReport>> componentStatusReports) {
     this.componentStatusReports = componentStatusReports;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/Hash.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/Hash.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/Hash.java
new file mode 100644
index 0000000..19f9597
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/Hash.java
@@ -0,0 +1,41 @@
+/**
+ * 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.agent.stomp.dto;
+
+/**
+ * Is used to contain hash code in request from agent
+ */
+public class Hash {
+  private String hash;
+
+  public Hash(String hash) {
+    this.hash = hash;
+  }
+
+  public Hash() {
+  }
+
+  public String getHash() {
+    return hash;
+  }
+
+  public void setHash(String hash) {
+    this.hash = hash;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/Hashable.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/Hashable.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/Hashable.java
new file mode 100644
index 0000000..0035893
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/Hashable.java
@@ -0,0 +1,27 @@
+/**
+ * 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.agent.stomp.dto;
+
+/**
+ * Update event object has hash to identify actual version
+ */
+public interface Hashable {
+  String getHash();
+  void setHash(String hash);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/MetadataCluster.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/MetadataCluster.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/MetadataCluster.java
new file mode 100644
index 0000000..07e85df
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/MetadataCluster.java
@@ -0,0 +1,69 @@
+/**
+ * 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.agent.stomp.dto;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.apache.ambari.server.state.SecurityType;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+public class MetadataCluster {
+  @JsonProperty("status_commands_to_run")
+  private List<String> statusCommandsToRun = new ArrayList<>();
+  private TreeMap<String, MetadataServiceInfo> serviceLevelParams;
+  private TreeMap<String, String> clusterLevelParams;
+
+  public MetadataCluster(SecurityType securityType, TreeMap<String,MetadataServiceInfo> serviceLevelParams,
+                         TreeMap<String, String> clusterLevelParams) {
+    this.statusCommandsToRun.add("STATUS");
+    if (SecurityType.KERBEROS.equals(securityType)) {
+      this.statusCommandsToRun.add("SECURITY_STATUS");
+    }
+    this.serviceLevelParams = serviceLevelParams;
+    this.clusterLevelParams = clusterLevelParams;
+  }
+
+  public List<String> getStatusCommandsToRun() {
+    return statusCommandsToRun;
+  }
+
+  public void setStatusCommandsToRun(List<String> statusCommandsToRun) {
+    this.statusCommandsToRun = statusCommandsToRun;
+  }
+
+  public TreeMap<String, MetadataServiceInfo> getServiceLevelParams() {
+    return serviceLevelParams;
+  }
+
+  public void setServiceLevelParams(TreeMap<String, MetadataServiceInfo> serviceLevelParams) {
+    this.serviceLevelParams = serviceLevelParams;
+  }
+
+  public TreeMap<String, String> getClusterLevelParams() {
+    return clusterLevelParams;
+  }
+
+  public void setClusterLevelParams(TreeMap<String, String> clusterLevelParams) {
+    this.clusterLevelParams = clusterLevelParams;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/MetadataServiceInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/MetadataServiceInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/MetadataServiceInfo.java
new file mode 100644
index 0000000..aea8986
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/MetadataServiceInfo.java
@@ -0,0 +1,71 @@
+/**
+ * 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.agent.stomp.dto;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class MetadataServiceInfo {
+  private String version;
+  private Boolean credentialStoreEnabled;
+  @JsonProperty("status_commands_timeout")
+  private Long statusCommandsTimeout;
+
+  @JsonProperty("service_package_folder")
+  private String servicePackageFolder;
+
+  public MetadataServiceInfo(String version, Boolean credentialStoreEnabled, Long statusCommandsTimeout,
+                             String servicePackageFolder) {
+    this.version = version;
+    this.credentialStoreEnabled = credentialStoreEnabled;
+    this.statusCommandsTimeout = statusCommandsTimeout;
+    this.servicePackageFolder = servicePackageFolder;
+  }
+
+  public String getVersion() {
+    return version;
+  }
+
+  public void setVersion(String version) {
+    this.version = version;
+  }
+
+  public Boolean getCredentialStoreEnabled() {
+    return credentialStoreEnabled;
+  }
+
+  public void setCredentialStoreEnabled(Boolean credentialStoreEnabled) {
+    this.credentialStoreEnabled = credentialStoreEnabled;
+  }
+
+  public Long getStatusCommandsTimeout() {
+    return statusCommandsTimeout;
+  }
+
+  public void setStatusCommandsTimeout(Long statusCommandsTimeout) {
+    this.statusCommandsTimeout = statusCommandsTimeout;
+  }
+
+  public String getServicePackageFolder() {
+    return servicePackageFolder;
+  }
+
+  public void setServicePackageFolder(String servicePackageFolder) {
+    this.servicePackageFolder = servicePackageFolder;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyCluster.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyCluster.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyCluster.java
index 4ddb8a6..7a464df 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyCluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyCluster.java
@@ -18,13 +18,22 @@
 package org.apache.ambari.server.agent.stomp.dto;
 
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Set;
 
+import org.apache.ambari.server.events.TopologyUpdateEvent;
+
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
 
 @JsonInclude(JsonInclude.Include.NON_EMPTY)
 public class TopologyCluster {
+  private String clusterName;
+
+  @JsonProperty("components")
   private Set<TopologyComponent> topologyComponents = new HashSet<>();
+
+  @JsonProperty("hosts")
   private Set<TopologyHost> topologyHosts = new HashSet<>();
 
   public TopologyCluster() {
@@ -35,6 +44,45 @@ public class TopologyCluster {
     this.topologyHosts = topologyHosts;
   }
 
+  public void update(Set<TopologyComponent> componentsToUpdate, Set<TopologyHost> hostsToUpdate,
+                     TopologyUpdateEvent.EventType eventType) {
+    for (TopologyComponent componentToUpdate : componentsToUpdate) {
+      boolean updated = false;
+      for (Iterator<TopologyComponent> iter = getTopologyComponents().iterator(); iter.hasNext() && !updated; ) {
+        TopologyComponent existsComponent = iter.next();
+        if (existsComponent.equals(componentToUpdate)) {
+          //TODO add case removing not all hostcomponents
+          if (eventType.equals(TopologyUpdateEvent.EventType.DELETE)) {
+            iter.remove();
+          } else {
+            existsComponent.updateComponent(componentToUpdate);
+          }
+          updated = true;
+        }
+      }
+      if (!updated && eventType.equals(TopologyUpdateEvent.EventType.UPDATE)) {
+        getTopologyComponents().add(componentToUpdate);
+      }
+    }
+    for (TopologyHost hostToUpdate : hostsToUpdate) {
+      boolean updated = false;
+      for (Iterator<TopologyHost> iter = getTopologyHosts().iterator(); iter.hasNext() && !updated; ) {
+        TopologyHost existsHost = iter.next();
+        if (existsHost.equals(hostToUpdate)) {
+          if (eventType.equals(TopologyUpdateEvent.EventType.DELETE)) {
+            iter.remove();
+          } else {
+            existsHost.updateHost(hostToUpdate);
+          }
+          updated = true;
+        }
+      }
+      if (!updated && eventType.equals(TopologyUpdateEvent.EventType.UPDATE)) {
+        getTopologyHosts().add(hostToUpdate);
+      }
+    }
+  }
+
   public Set<TopologyComponent> getTopologyComponents() {
     return topologyComponents;
   }
@@ -58,4 +106,12 @@ public class TopologyCluster {
   public void addTopologyComponent(TopologyComponent topologyComponent) {
     topologyComponents.add(topologyComponent);
   }
+
+  public String getClusterName() {
+    return clusterName;
+  }
+
+  public void setClusterName(String clusterName) {
+    this.clusterName = clusterName;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyComponent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyComponent.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyComponent.java
index 019c933..dabbe94 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyComponent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyComponent.java
@@ -18,7 +18,13 @@
 
 package org.apache.ambari.server.agent.stomp.dto;
 
+import java.util.HashSet;
 import java.util.Set;
+import java.util.TreeMap;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang.StringUtils;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
 
@@ -26,9 +32,12 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 public class TopologyComponent {
   private String componentName;
   private String serviceName;
+  private String displayName;
   private String version;
   private Set<Long> hostIds;
-  private TopologyStatusCommandParams statusCommandParams;
+  private Set<String> hostNames;
+  private Set<String> publicHostNames;
+  private TreeMap<String, String> componentLevelParams;
 
   private TopologyComponent() {
   }
@@ -52,6 +61,11 @@ public class TopologyComponent {
       return this;
     }
 
+    public Builder setDisplayName(String displayName) {
+      TopologyComponent.this.setDisplayName(displayName);
+      return this;
+    }
+
     public Builder setVersion(String version) {
       TopologyComponent.this.setVersion(version);
       return this;
@@ -62,8 +76,18 @@ public class TopologyComponent {
       return this;
     }
 
-    public Builder setStatusCommandParams(TopologyStatusCommandParams statusCommandParams) {
-      TopologyComponent.this.setStatusCommandParams(statusCommandParams);
+    public Builder setHostNames(Set<String> hostNames) {
+      TopologyComponent.this.setHostNames(hostNames);
+      return this;
+    }
+
+    public Builder setPublicHostNames(Set<String> publicHostNames) {
+      TopologyComponent.this.setPublicHostNames(publicHostNames);
+      return this;
+    }
+
+    public Builder setComponentLevelParams(TreeMap<String, String> componentLevelParams) {
+      TopologyComponent.this.setComponentLevelParams(componentLevelParams);
       return this;
     }
 
@@ -72,6 +96,36 @@ public class TopologyComponent {
     }
   }
 
+  public void updateComponent(TopologyComponent componentToUpdate) {
+    //TODO will be a need to change to multi-instance usage
+    if (componentToUpdate.getComponentName().equals(getComponentName())) {
+      if (StringUtils.isNotEmpty(componentToUpdate.getVersion())) {
+        setVersion(componentToUpdate.getVersion());
+      }
+      if (CollectionUtils.isNotEmpty(componentToUpdate.getHostIds())) {
+        if (hostIds == null) {
+          hostIds = new HashSet<>();
+        }
+        hostIds.addAll(componentToUpdate.getHostIds());
+      }
+      if (CollectionUtils.isNotEmpty(componentToUpdate.getHostNames())) {
+        if (hostNames == null) {
+          hostNames = new HashSet<>();
+        }
+        hostNames.addAll(componentToUpdate.getHostNames());
+      }
+      if (CollectionUtils.isNotEmpty(componentToUpdate.getPublicHostNames())) {
+        if (publicHostNames == null) {
+          publicHostNames = new HashSet<>();
+        }
+        publicHostNames.addAll(componentToUpdate.getPublicHostNames());
+      }
+      if (MapUtils.isNotEmpty(componentToUpdate.getComponentLevelParams())) {
+        componentLevelParams.putAll(componentToUpdate.getComponentLevelParams());
+      }
+    }
+  }
+
   public String getComponentName() {
     return componentName;
   }
@@ -108,14 +162,43 @@ public class TopologyComponent {
     this.hostIds.add(hostId);
   }
 
-  public TopologyStatusCommandParams getStatusCommandParams() {
-    return statusCommandParams;
+  public void addHostName(String hostName) {
+    this.hostNames.add(hostName);
+  }
+
+  public TreeMap<String, String> getComponentLevelParams() {
+    return componentLevelParams;
+  }
+
+  public void setComponentLevelParams(TreeMap<String, String> componentLevelParams) {
+    this.componentLevelParams = componentLevelParams;
+  }
+
+  public Set<String> getHostNames() {
+    return hostNames;
+  }
+
+  public void setHostNames(Set<String> hostNames) {
+    this.hostNames = hostNames;
   }
 
-  public void setStatusCommandParams(TopologyStatusCommandParams statusCommandParams) {
-    this.statusCommandParams = statusCommandParams;
+  public String getDisplayName() {
+    return displayName;
   }
 
+  public void setDisplayName(String displayName) {
+    this.displayName = displayName;
+  }
+
+  public Set<String> getPublicHostNames() {
+    return publicHostNames;
+  }
+
+  public void setPublicHostNames(Set<String> publicHostNames) {
+    this.publicHostNames = publicHostNames;
+  }
+
+
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;
@@ -124,13 +207,13 @@ public class TopologyComponent {
     TopologyComponent that = (TopologyComponent) o;
 
     if (!componentName.equals(that.componentName)) return false;
-    return version.equals(that.version);
+    return serviceName.equals(that.serviceName);
   }
 
   @Override
   public int hashCode() {
     int result = componentName.hashCode();
-    result = 31 * result + version.hashCode();
+    result = 31 * result + serviceName.hashCode();
     return result;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyHost.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyHost.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyHost.java
index 1718711..84e3cff 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyHost.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyHost.java
@@ -17,6 +17,12 @@
  */
 package org.apache.ambari.server.agent.stomp.dto;
 
+import java.util.TreeMap;
+
+import org.apache.ambari.server.agent.RecoveryConfig;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang.StringUtils;
+
 import com.fasterxml.jackson.annotation.JsonInclude;
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
@@ -25,6 +31,8 @@ public class TopologyHost {
   private String hostName;
   private String rackName;
   private String ipv4;
+  private TreeMap<String, String> hostLevelParams;
+  private RecoveryConfig recoveryConfig;
 
   public TopologyHost() {
   }
@@ -33,11 +41,31 @@ public class TopologyHost {
     this.hostId = hostId;
   }
 
-  public TopologyHost(Long hostId, String hostName, String rackName, String ipv4) {
+  public TopologyHost(Long hostId, String hostName, String rackName, String ipv4, RecoveryConfig recoveryConfig,
+                      TreeMap<String, String> hostLevelParams) {
     this.hostId = hostId;
     this.hostName = hostName;
     this.rackName = rackName;
     this.ipv4 = ipv4;
+    this.recoveryConfig = recoveryConfig;
+    this.hostLevelParams = hostLevelParams;
+  }
+
+  public void updateHost(TopologyHost hostToUpdate) {
+    if (hostToUpdate.getHostId().equals(getHostId())) {
+      if (StringUtils.isNotEmpty(hostToUpdate.getHostName())) {
+        setHostName(hostToUpdate.getHostName());
+      }
+      if (StringUtils.isNotEmpty(hostToUpdate.getRackName())) {
+        setRackName(hostToUpdate.getRackName());
+      }
+      if (StringUtils.isNotEmpty(hostToUpdate.getIpv4())) {
+        setIpv4(hostToUpdate.getIpv4());
+      }
+      if (MapUtils.isNotEmpty(hostToUpdate.getHostLevelParams())) {
+        hostLevelParams.putAll(hostToUpdate.getHostLevelParams());
+      }
+    }
   }
 
   public Long getHostId() {
@@ -72,6 +100,22 @@ public class TopologyHost {
     this.ipv4 = ipv4;
   }
 
+  public RecoveryConfig getRecoveryConfig() {
+    return recoveryConfig;
+  }
+
+  public void setRecoveryConfig(RecoveryConfig recoveryConfig) {
+    this.recoveryConfig = recoveryConfig;
+  }
+
+  public TreeMap<String, String> getHostLevelParams() {
+    return hostLevelParams;
+  }
+
+  public void setHostLevelParams(TreeMap<String, String> hostLevelParams) {
+    this.hostLevelParams = hostLevelParams;
+  }
+
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyStatusCommandParams.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyStatusCommandParams.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyStatusCommandParams.java
deleted file mode 100644
index 1574066..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/stomp/dto/TopologyStatusCommandParams.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.agent.stomp.dto;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class TopologyStatusCommandParams {
-  private String script;
-  private String servicePackageFolder;
-
-  public TopologyStatusCommandParams(String script, String servicePackageFolder) {
-    this.script = script;
-    this.servicePackageFolder = servicePackageFolder;
-  }
-
-  public String getScript() {
-    return script;
-  }
-
-  public void setScript(String script) {
-    this.script = script;
-  }
-
-  public String getServicePackageFolder() {
-    return servicePackageFolder;
-  }
-
-  public void setServicePackageFolder(String servicePackageFolder) {
-    this.servicePackageFolder = servicePackageFolder;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertStateSummary.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertStateSummary.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertStateSummary.java
index 9d3ab9d..fe0198b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertStateSummary.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertStateSummary.java
@@ -29,23 +29,27 @@ public final class AlertStateSummary {
    * The {@link AlertState#OK} state information.
    */
   @JsonProperty(value = "OK")
+  @com.fasterxml.jackson.annotation.JsonProperty(value = "OK")
   public final AlertStateValues Ok = new AlertStateValues();
 
   /**
    * The {@link AlertState#WARNING} state information.
    */
   @JsonProperty(value = "WARNING")
+  @com.fasterxml.jackson.annotation.JsonProperty(value = "WARNING")
   public final AlertStateValues Warning = new AlertStateValues();
 
   /**
    * The {@link AlertState#CRITICAL} state information.
    */
   @JsonProperty(value = "CRITICAL")
+  @com.fasterxml.jackson.annotation.JsonProperty(value = "CRITICAL")
   public final AlertStateValues Critical = new AlertStateValues();
 
   /**
    * The {@link AlertState#UNKNOWN} state information.
    */
   @JsonProperty(value = "UNKNOWN")
+  @com.fasterxml.jackson.annotation.JsonProperty(value = "UNKNOWN")
   public final AlertStateValues Unknown = new AlertStateValues();
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertStateValues.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertStateValues.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertStateValues.java
index 261aa21..a99a648 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertStateValues.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertStateValues.java
@@ -20,6 +20,8 @@ package org.apache.ambari.server.api.query.render;
 import org.codehaus.jackson.annotate.JsonProperty;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 
+import com.fasterxml.jackson.annotation.JsonInclude;
+
 /**
  * The {@link AlertStateValues} class holds various information about an alert
  * state, such as the number of instances of that state and the most recent
@@ -30,24 +32,29 @@ public final class AlertStateValues {
    * The total count of non-maintenance mode instances.
    */
   @JsonProperty(value = "count")
+  @com.fasterxml.jackson.annotation.JsonProperty(value = "count")
   public int Count = 0;
 
   /**
    * The time of the last state change.
    */
   @JsonProperty(value = "original_timestamp")
+  @com.fasterxml.jackson.annotation.JsonProperty(value = "original_timestamp")
   public long Timestamp = 0;
 
   /**
    * The total count of instances in maintenance mode.
    */
   @JsonProperty(value = "maintenance_count")
+  @com.fasterxml.jackson.annotation.JsonProperty(value = "maintenance_count")
   public int MaintenanceCount = 0;
 
   /**
    * The most recently received text from any instance of the alert.
    */
   @JsonProperty(value = "latest_text")
+  @com.fasterxml.jackson.annotation.JsonProperty(value = "latest_text")
   @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+  @JsonInclude(JsonInclude.Include.NON_NULL)
   public String AlertText = null;
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java
index 71f82ad..a2664fa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java
@@ -138,69 +138,7 @@ public class AlertSummaryGroupedRenderer extends AlertSummaryRenderer {
       MaintenanceState maintenanceState = (MaintenanceState) resource.getPropertyValue(AlertResourceProvider.ALERT_MAINTENANCE_STATE);
       String alertText = (String) resource.getPropertyValue(AlertResourceProvider.ALERT_TEXT);
 
-      // NPE sanity
-      if (null == state) {
-        state = AlertState.UNKNOWN;
-      }
-
-      // NPE sanity
-      long originalTimestamp = 0;
-      if (null != originalTimestampObject) {
-        originalTimestamp = originalTimestampObject.longValue();
-      }
-
-      // NPE sanity
-      boolean isMaintenanceModeEnabled = false;
-      if (null != maintenanceState && maintenanceState != MaintenanceState.OFF) {
-        isMaintenanceModeEnabled = true;
-      }
-
-      // create the group summary info if it doesn't exist yet
-      AlertDefinitionSummary groupSummaryInfo = summaries.get(definitionName);
-      if (null == groupSummaryInfo) {
-        groupSummaryInfo = new AlertDefinitionSummary();
-        groupSummaryInfo.Id = definitionId;
-        groupSummaryInfo.Name = definitionName;
-
-        summaries.put(definitionName, groupSummaryInfo);
-      }
-
-      // set and increment the correct values based on state
-      final AlertStateValues alertStateValues;
-      switch (state) {
-        case CRITICAL: {
-          alertStateValues = groupSummaryInfo.State.Critical;
-          break;
-        }
-        case OK: {
-          alertStateValues = groupSummaryInfo.State.Ok;
-          break;
-        }
-        case WARNING: {
-          alertStateValues = groupSummaryInfo.State.Warning;
-          break;
-        }
-        default:
-        case UNKNOWN: {
-          alertStateValues = groupSummaryInfo.State.Unknown;
-          break;
-        }
-      }
-
-      // update the maintenance count if in MM is enabled, otherwise the
-      // regular count
-      if (isMaintenanceModeEnabled) {
-        alertStateValues.MaintenanceCount++;
-      } else {
-        alertStateValues.Count++;
-      }
-
-      // check to see if this alerts time is sooner; if so, keep track of it
-      // and of its text
-      if (originalTimestamp > alertStateValues.Timestamp) {
-        alertStateValues.Timestamp = originalTimestamp;
-        alertStateValues.AlertText = alertText;
-      }
+      updateSummary(summaries, definitionId, definitionName, state, originalTimestampObject, maintenanceState, alertText);
     }
 
     Set<Entry<String, AlertDefinitionSummary>> entrySet = summaries.entrySet();
@@ -222,6 +160,74 @@ public class AlertSummaryGroupedRenderer extends AlertSummaryRenderer {
     return groupedSummary;
   }
 
+  public static void updateSummary(Map<String, AlertDefinitionSummary> summaries, Long definitionId, String definitionName,
+                            AlertState state, Long originalTimestampObject, MaintenanceState maintenanceState,
+                            String alertText) {
+    // NPE sanity
+    if (null == state) {
+      state = AlertState.UNKNOWN;
+    }
+
+    // NPE sanity
+    long originalTimestamp = 0;
+    if (null != originalTimestampObject) {
+      originalTimestamp = originalTimestampObject.longValue();
+    }
+
+    // NPE sanity
+    boolean isMaintenanceModeEnabled = false;
+    if (null != maintenanceState && maintenanceState != MaintenanceState.OFF) {
+      isMaintenanceModeEnabled = true;
+    }
+
+    // create the group summary info if it doesn't exist yet
+    AlertDefinitionSummary groupSummaryInfo = summaries.get(definitionName);
+    if (null == groupSummaryInfo) {
+      groupSummaryInfo = new AlertDefinitionSummary();
+      groupSummaryInfo.Id = definitionId;
+      groupSummaryInfo.Name = definitionName;
+
+      summaries.put(definitionName, groupSummaryInfo);
+    }
+
+    // set and increment the correct values based on state
+    final AlertStateValues alertStateValues;
+    switch (state) {
+      case CRITICAL: {
+        alertStateValues = groupSummaryInfo.State.Critical;
+        break;
+      }
+      case OK: {
+        alertStateValues = groupSummaryInfo.State.Ok;
+        break;
+      }
+      case WARNING: {
+        alertStateValues = groupSummaryInfo.State.Warning;
+        break;
+      }
+      default:
+      case UNKNOWN: {
+        alertStateValues = groupSummaryInfo.State.Unknown;
+        break;
+      }
+    }
+
+    // update the maintenance count if in MM is enabled, otherwise the
+    // regular count
+    if (isMaintenanceModeEnabled) {
+      alertStateValues.MaintenanceCount++;
+    } else {
+      alertStateValues.Count++;
+    }
+
+    // check to see if this alerts time is sooner; if so, keep track of it
+    // and of its text
+    if (originalTimestamp > alertStateValues.Timestamp) {
+      alertStateValues.Timestamp = originalTimestamp;
+      alertStateValues.AlertText = alertText;
+    }
+  }
+
   /**
    * {@inheritDoc}
    * <p/>
@@ -245,12 +251,15 @@ public class AlertSummaryGroupedRenderer extends AlertSummaryRenderer {
    */
   public final static class AlertDefinitionSummary {
     @JsonProperty(value = "definition_id")
+    @com.fasterxml.jackson.annotation.JsonProperty(value = "definition_id")
     public long Id;
 
     @JsonProperty(value = "definition_name")
+    @com.fasterxml.jackson.annotation.JsonProperty(value = "definition_name")
     public String Name;
 
     @JsonProperty(value = "summary")
+    @com.fasterxml.jackson.annotation.JsonProperty(value = "summary")
     public final AlertStateSummary State = new AlertStateSummary();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index 4887d52..65e5fd2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -43,7 +43,6 @@ import javax.xml.bind.JAXBException;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ParentObjectNotFoundException;
 import org.apache.ambari.server.StackAccessException;
-import org.apache.ambari.server.agent.stomp.dto.TopologyStatusCommandParams;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
@@ -62,7 +61,6 @@ import org.apache.ambari.server.stack.StackManager;
 import org.apache.ambari.server.stack.StackManagerFactory;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
-import org.apache.ambari.server.state.CommandScriptDefinition;
 import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.DependencyInfo;
 import org.apache.ambari.server.state.ExtensionInfo;
@@ -1487,29 +1485,4 @@ public class AmbariMetaInfo {
 
     return versionDefinitions;
   }
-
-  //TODO will be a need to change to multi-instance usage
-  public TopologyStatusCommandParams getStatusCommandParams(StackId stackId, String serviceName, String componentName) throws AmbariException {
-    ServiceInfo serviceInfo = getService(stackId.getStackName(),
-        stackId.getStackVersion(), serviceName);
-    ComponentInfo componentInfo = getComponent(
-        stackId.getStackName(), stackId.getStackVersion(),
-        serviceName, componentName);
-
-    String scriptName = null;
-    CommandScriptDefinition script = componentInfo.getCommandScript();
-    if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) {
-      if (script != null) {
-        scriptName = script.getScript();
-      } else {
-        String message = String.format("Component %s of service %s has not " +
-            "command script defined", componentName, serviceName);
-        throw new AmbariException(message);
-      }
-    }
-    String servicePackageFolder = serviceInfo.getServicePackageFolder();
-    return new TopologyStatusCommandParams(scriptName, servicePackageFolder);
-  }
-
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 17bc718..c11763c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -755,7 +755,7 @@ public class AmbariCustomCommandExecutionHelper {
       }
     }
 
-    String commandTimeout = configs.getDefaultAgentTaskTimeout(false);
+    String commandTimeout = getStatusCommandTimeout(serviceInfo);
 
     if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) {
       // Service check command is not custom command
@@ -763,9 +763,6 @@ public class AmbariCustomCommandExecutionHelper {
       if (script != null) {
         commandParams.put(SCRIPT, script.getScript());
         commandParams.put(SCRIPT_TYPE, script.getScriptType().toString());
-        if (script.getTimeout() > 0) {
-          commandTimeout = String.valueOf(script.getTimeout());
-        }
       } else {
         String message = String.format("Service %s has no command script " +
             "defined. It is not possible to run service check" +
@@ -775,12 +772,6 @@ public class AmbariCustomCommandExecutionHelper {
       // We don't need package/repo information to perform service check
     }
 
-    // Try to apply overridden service check timeout value if available
-    Long overriddenTimeout = configs.getAgentServiceCheckTaskTimeout();
-    if (!overriddenTimeout.equals(Configuration.AGENT_SERVICE_CHECK_TASK_TIMEOUT.getDefaultValue())) {
-      commandTimeout = String.valueOf(overriddenTimeout);
-    }
-
     commandParams.put(COMMAND_TIMEOUT, commandTimeout);
     String checkType = configHelper.getValueFromDesiredConfigurations(cluster, ConfigHelper.CLUSTER_ENV, ConfigHelper.SERVICE_CHECK_TYPE);
     if (ConfigHelper.SERVICE_CHECK_MINIMAL.equals(checkType)) {
@@ -1485,4 +1476,30 @@ public class AmbariCustomCommandExecutionHelper {
     hosts.removeAll(removedHosts);
     return removedHosts;
   }
+
+  public String getStatusCommandTimeout(ServiceInfo serviceInfo) throws AmbariException {
+    String commandTimeout = configs.getDefaultAgentTaskTimeout(false);
+
+    if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) {
+      // Service check command is not custom command
+      CommandScriptDefinition script = serviceInfo.getCommandScript();
+      if (script != null) {
+        if (script.getTimeout() > 0) {
+          commandTimeout = String.valueOf(script.getTimeout());
+        }
+      } else {
+        String message = String.format("Service %s has no command script " +
+            "defined. It is not possible to run service check" +
+            " for this service", serviceInfo.getName());
+        throw new AmbariException(message);
+      }
+    }
+
+    // Try to apply overridden service check timeout value if available
+    Long overriddenTimeout = configs.getAgentServiceCheckTaskTimeout();
+    if (!overriddenTimeout.equals(Configuration.AGENT_SERVICE_CHECK_TASK_TIMEOUT.getDefaultValue())) {
+      commandTimeout = String.valueOf(overriddenTimeout);
+    }
+    return commandTimeout;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 52497f2..134979e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -18,6 +18,8 @@
 
 package org.apache.ambari.server.controller;
 
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AGENT_STACK_RETRY_COUNT;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AGENT_STACK_RETRY_ON_UNAVAILABILITY;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_DRIVER;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_PASSWORD;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_URL;
@@ -27,10 +29,19 @@ import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_R
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_TIMEOUT;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.CUSTOM_FOLDER;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_DRIVER_FILENAME;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_NAME;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.GROUP_LIST;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOST_SYS_PREPPED;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JAVA_HOME;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JAVA_VERSION;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JCE_NAME;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JDK_LOCATION;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JDK_NAME;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.MAX_DURATION_OF_RETRIES;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.MYSQL_JDBC_URL;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.NOT_MANAGED_HDFS_PATH_LIST;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.ORACLE_JDBC_URL;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.PACKAGE_LIST;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.PACKAGE_VERSION;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.REPO_INFO;
@@ -38,6 +49,8 @@ import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT_TYPE;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_PACKAGE_FOLDER;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_REPO_INFO;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.STACK_NAME;
+import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.STACK_VERSION;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.UNLIMITED_KEY_JCE_REQUIRED;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.USER_GROUPS;
 import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.USER_LIST;
@@ -89,6 +102,8 @@ import org.apache.ambari.server.actionmanager.Stage;
 import org.apache.ambari.server.actionmanager.StageFactory;
 import org.apache.ambari.server.agent.ExecutionCommand;
 import org.apache.ambari.server.agent.ExecutionCommand.KeyNames;
+import org.apache.ambari.server.agent.stomp.dto.MetadataCluster;
+import org.apache.ambari.server.agent.stomp.dto.MetadataServiceInfo;
 import org.apache.ambari.server.agent.stomp.dto.TopologyCluster;
 import org.apache.ambari.server.agent.stomp.dto.TopologyComponent;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
@@ -109,6 +124,7 @@ import org.apache.ambari.server.controller.metrics.MetricsCollectorHAManager;
 import org.apache.ambari.server.controller.metrics.timeline.cache.TimelineMetricCacheProvider;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.customactions.ActionDefinition;
+import org.apache.ambari.server.events.MetadataUpdateEvent;
 import org.apache.ambari.server.events.TopologyUpdateEvent;
 import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
 import org.apache.ambari.server.events.publishers.StateUpdateEventPublisher;
@@ -327,7 +343,10 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
   private StateUpdateEventPublisher stateUpdateEventPublisher;
 
   @Inject
-  TopologyDeleteFormer topologyDeleteFormer;
+  private TopologyDeleteFormer topologyDeleteFormer;
+
+  @Inject
+  private AmbariCustomCommandExecutionHelper ambariCustomCommandExecutionHelper;
 
   /**
    * The KerberosHelper to help setup for enabling for disabling Kerberos
@@ -723,7 +742,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
 
   private TopologyUpdateEvent getAddedComponentsTopologyEvent(Set<ServiceComponentHostRequest> requests)
     throws AmbariException {
-    Map<String, TopologyCluster> topologyUpdates = new HashMap<>();
+    TreeMap<String, TopologyCluster> topologyUpdates = new TreeMap<>();
     for (ServiceComponentHostRequest request : requests) {
       String serviceName = request.getServiceName();
       String componentName = request.getComponentName();
@@ -731,10 +750,15 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       Collection<Host> clusterHosts = cluster.getHosts();
       Service s = cluster.getService(serviceName);
       ServiceComponent sc = s.getServiceComponent(componentName);
-      Set<String> hostNames = cluster.getHosts(serviceName, componentName);
+      String hostName = request.getHostname();
       Set<Long> hostIds = clusterHosts.stream()
-          .filter(h -> hostNames.contains(h.getHostName()))
+          .filter(h -> hostName.equals(h.getHostName()))
           .map(h -> h.getHostId()).collect(Collectors.toSet());
+      Set<String> publicHostNames = clusterHosts.stream()
+          .filter(h -> hostName.equals(h.getHostName()))
+          .map(h -> h.getPublicHostName()).collect(Collectors.toSet());
+      Set<String> hostNames = new HashSet<>();
+      hostNames.add(hostName);
       ServiceComponentHost sch = sc.getServiceComponentHost(request.getHostname());
 
       StackId stackId = cluster.getDesiredStackVersion();
@@ -742,17 +766,27 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       TopologyComponent newComponent = TopologyComponent.newBuilder()
           .setComponentName(sch.getServiceComponentName())
           .setServiceName(sch.getServiceName())
+          .setDisplayName(sc.getDisplayName())
           .setVersion(sch.getVersion())
           .setHostIds(hostIds)
-          .setStatusCommandParams(ambariMetaInfo.getStatusCommandParams(stackId, serviceName, componentName))
+          .setHostNames(hostNames)
+          .setPublicHostNames(publicHostNames)
+          .setComponentLevelParams(getTopologyComponentLevelParams(stackId, serviceName, componentName, cluster.getSecurityType()))
           .build();
       String clusterId = Long.toString(cluster.getClusterId());
       if (!topologyUpdates.containsKey(clusterId)) {
         topologyUpdates.put(clusterId, new TopologyCluster());
       }
-      topologyUpdates.get(clusterId).addTopologyComponent(newComponent);
+      if (topologyUpdates.get(clusterId).getTopologyComponents().contains(newComponent)) {
+        Set<TopologyComponent> newComponents = new HashSet<>();
+        newComponents.add(newComponent);
+        topologyUpdates.get(clusterId).update(newComponents, Collections.emptySet(),
+            TopologyUpdateEvent.EventType.UPDATE);
+      } else {
+        topologyUpdates.get(clusterId).addTopologyComponent(newComponent);
+      }
     }
-    return new TopologyUpdateEvent(topologyUpdates, TopologyUpdateEvent.EventType.ADD);
+    return new TopologyUpdateEvent(topologyUpdates, TopologyUpdateEvent.EventType.UPDATE);
   }
 
   private void setMonitoringServicesRestartRequired(
@@ -2476,14 +2510,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       hostParams.put(DB_DRIVER_FILENAME, configs.getMySQLJarName());
     }
 
-    List<String> clientsToUpdateConfigsList = componentInfo.getClientsToUpdateConfigs();
-    if (clientsToUpdateConfigsList == null) {
-      clientsToUpdateConfigsList = new ArrayList<>();
-      clientsToUpdateConfigsList.add("*");
-    }
-
-    String clientsToUpdateConfigs = gson.toJson(clientsToUpdateConfigsList);
-    hostParams.put(CLIENTS_TO_UPDATE_CONFIGS, clientsToUpdateConfigs);
+    hostParams.put(CLIENTS_TO_UPDATE_CONFIGS, getClientsToUpdateConfigs(componentInfo));
 
     // If we are starting a component, calculate whether the unlimited key JCE policy is
     // required for the relevant host.  One of the following indicates that the unlimited
@@ -2492,17 +2519,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     //   * The component explicitly requires it whether Kerberos is enabled or not (example, SMARTSENSE/HST_SERVER)
     //   * The component explicitly requires it only when Kerberos is enabled AND Kerberos is enabled (example, most components)
     //
-    UnlimitedKeyJCERequirement unlimitedKeyJCERequirement = componentInfo.getUnlimitedKeyJCERequired();
-    // Ensure that the unlimited key requirement is set. If null, the default value should be used.
-    if(unlimitedKeyJCERequirement == null) {
-      unlimitedKeyJCERequirement = UnlimitedKeyJCERequirement.DEFAULT;
-    }
-
-    boolean unlimitedKeyJCEPolicyRequired = (UnlimitedKeyJCERequirement.ALWAYS == unlimitedKeyJCERequirement) ||
-        ((UnlimitedKeyJCERequirement.KERBEROS_ENABLED == unlimitedKeyJCERequirement) && (cluster.getSecurityType() == SecurityType.KERBEROS));
-
     // Set/update the unlimited_key_jce_required value as needed
-    hostParams.put(UNLIMITED_KEY_JCE_REQUIRED, (unlimitedKeyJCEPolicyRequired) ? "true" : "false");
+    hostParams.put(UNLIMITED_KEY_JCE_REQUIRED, (getUnlimitedKeyJCERequirement(componentInfo, cluster.getSecurityType())) ? "true" : "false");
 
     execCmd.setHostLevelParams(hostParams);
 
@@ -5622,4 +5640,148 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     return QuickLinkVisibilityControllerFactory.get(quickLinkProfileJson);
   }
 
+  /**
+   * Collects metadata info about clusters for agent.
+   * @return metadata info about clusters
+   * @throws AmbariException
+   */
+  public MetadataUpdateEvent getClustersMetadata() throws AmbariException {
+    TreeMap<String, MetadataCluster> metadataClusters = new TreeMap<>();
+
+    for (Cluster cl : clusters.getClusters().values()) {
+      StackId stackId = cl.getDesiredStackVersion();
+
+      SecurityType securityType = cl.getSecurityType();
+
+      TreeMap<String, MetadataServiceInfo> serviceLevelParams = new TreeMap<>();
+      Collection<ServiceInfo> servicesInfo = ambariMetaInfo.getServices(stackId.getStackName(),
+          stackId.getStackVersion()).values();
+      for (ServiceInfo serviceInfo : servicesInfo) {
+        Long statusCommandTimeout = null;
+        if (serviceInfo.getCommandScript() != null) {
+          statusCommandTimeout = new Long (ambariCustomCommandExecutionHelper.getStatusCommandTimeout(serviceInfo));
+        }
+
+        String servicePackageFolder = serviceInfo.getServicePackageFolder();
+
+        serviceLevelParams.put(serviceInfo.getName(),
+            new MetadataServiceInfo(serviceInfo.getVersion(),
+                serviceInfo.isCredentialStoreEnabled(),
+                statusCommandTimeout,
+                servicePackageFolder));
+      }
+
+      MetadataCluster metadataCluster = new MetadataCluster(securityType,
+          serviceLevelParams,
+          getMetadataClusterLevelParams(cl, stackId));
+      metadataClusters.put(Long.toString(cl.getClusterId()), metadataCluster);
+    }
+
+    MetadataUpdateEvent metadataUpdateEvent = new MetadataUpdateEvent(metadataClusters);
+    return metadataUpdateEvent;
+  }
+
+  private String getClientsToUpdateConfigs(ComponentInfo componentInfo) {
+    List<String> clientsToUpdateConfigsList = componentInfo.getClientsToUpdateConfigs();
+    if (clientsToUpdateConfigsList == null) {
+      clientsToUpdateConfigsList = new ArrayList<>();
+      clientsToUpdateConfigsList.add("*");
+    }
+    return gson.toJson(clientsToUpdateConfigsList);
+  }
+
+  private Boolean getUnlimitedKeyJCERequirement(ComponentInfo componentInfo, SecurityType clusterSecurityType) {
+    UnlimitedKeyJCERequirement unlimitedKeyJCERequirement = componentInfo.getUnlimitedKeyJCERequired();
+    // Ensure that the unlimited key requirement is set. If null, the default value should be used.
+    if(unlimitedKeyJCERequirement == null) {
+      unlimitedKeyJCERequirement = UnlimitedKeyJCERequirement.DEFAULT;
+    }
+
+    return (UnlimitedKeyJCERequirement.ALWAYS == unlimitedKeyJCERequirement) ||
+        ((UnlimitedKeyJCERequirement.KERBEROS_ENABLED == unlimitedKeyJCERequirement) &&
+            (clusterSecurityType == SecurityType.KERBEROS));
+
+  }
+
+  //TODO will be a need to change to multi-instance usage
+  public TreeMap<String, String> getTopologyComponentLevelParams(StackId stackId, String serviceName, String componentName,
+                                                             SecurityType clusterSecurityType) throws AmbariException {
+    ServiceInfo serviceInfo = ambariMetaInfo.getService(stackId.getStackName(),
+        stackId.getStackVersion(), serviceName);
+    ComponentInfo componentInfo = ambariMetaInfo.getComponent(
+        stackId.getStackName(), stackId.getStackVersion(),
+        serviceName, componentName);
+
+    String scriptName = null;
+    CommandScriptDefinition script = componentInfo.getCommandScript();
+    if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) {
+      if (script != null) {
+        scriptName = script.getScript();
+      } else {
+        String message = String.format("Component %s of service %s has not " +
+            "command script defined", componentName, serviceName);
+        throw new AmbariException(message);
+      }
+    }
+
+    TreeMap<String, String> statusCommandParams = new TreeMap<>();
+    statusCommandParams.put(ExecutionCommand.KeyNames.CLIENTS_TO_UPDATE_CONFIGS,
+        getClientsToUpdateConfigs(componentInfo));
+    statusCommandParams.put(ExecutionCommand.KeyNames.UNLIMITED_KEY_JCE_REQUIRED,
+         Boolean.toString(getUnlimitedKeyJCERequirement(componentInfo, clusterSecurityType)));
+    statusCommandParams.put(KeyNames.SCRIPT, scriptName);
+    return statusCommandParams;
+  }
+
+  public TreeMap<String, String> getMetadataClusterLevelParams(Cluster cluster, StackId stackId) throws AmbariException {
+    TreeMap<String, String> clusterLevelParams = new TreeMap<>();
+    clusterLevelParams.put(JDK_LOCATION, getJdkResourceUrl());
+    clusterLevelParams.put(JAVA_HOME, getJavaHome());
+    clusterLevelParams.put(JAVA_VERSION, String.valueOf(configs.getJavaVersion()));
+    clusterLevelParams.put(JDK_NAME, getJDKName());
+    clusterLevelParams.put(JCE_NAME, getJCEName());
+    clusterLevelParams.put(STACK_NAME, stackId.getStackName());
+    clusterLevelParams.put(STACK_VERSION, stackId.getStackVersion());
+    clusterLevelParams.put(DB_NAME, getServerDB());
+    clusterLevelParams.put(MYSQL_JDBC_URL, getMysqljdbcUrl());
+    clusterLevelParams.put(ORACLE_JDBC_URL, getOjdbcUrl());
+    clusterLevelParams.put(DB_DRIVER_FILENAME, configs.getMySQLJarName());
+    clusterLevelParams.putAll(getRcaParameters());
+    clusterLevelParams.put(HOST_SYS_PREPPED, configs.areHostsSysPrepped());
+    clusterLevelParams.put(AGENT_STACK_RETRY_ON_UNAVAILABILITY, configs.isAgentStackRetryOnInstallEnabled());
+    clusterLevelParams.put(AGENT_STACK_RETRY_COUNT, configs.getAgentStackRetryOnInstallCount());
+
+    StackInfo stackInfo = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion());
+    clusterLevelParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder());
+
+    Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
+    Set<String> notManagedHdfsPathSet = configHelper.getPropertyValuesWithPropertyType(stackId,
+        PropertyType.NOT_MANAGED_HDFS_PATH, cluster, desiredConfigs);
+    String notManagedHdfsPathList = gson.toJson(notManagedHdfsPathSet);
+    clusterLevelParams.put(NOT_MANAGED_HDFS_PATH_LIST, notManagedHdfsPathList);
+
+    Set<String> userSet = configHelper.getPropertyValuesWithPropertyType(stackId, PropertyType.USER, cluster, desiredConfigs);
+    String userList = gson.toJson(userSet);
+    clusterLevelParams.put(USER_LIST, userList);
+
+    //Create a user_group mapping and send it as part of the hostLevelParams
+    Map<String, Set<String>> userGroupsMap = configHelper.createUserGroupsMap(
+        stackId, cluster, desiredConfigs);
+    String userGroups = gson.toJson(userGroupsMap);
+    clusterLevelParams.put(USER_GROUPS, userGroups);
+
+    Set<String> groupSet = configHelper.getPropertyValuesWithPropertyType(stackId, PropertyType.GROUP, cluster, desiredConfigs);
+    String groupList = gson.toJson(groupSet);
+    clusterLevelParams.put(GROUP_LIST, groupList);
+
+    return clusterLevelParams;
+  }
+
+  public TreeMap<String, String> getTopologyHostLevelParams(Cluster cluster, Host host) throws AmbariException {
+    TreeMap<String, String> hostLevelParams = new TreeMap<>();
+    String repoInfo = customCommandExecutionHelper.getRepoInfo(cluster, host);
+
+    hostLevelParams.put(REPO_INFO, repoInfo);
+    return hostLevelParams;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DeleteHostComponentStatusMetaData.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DeleteHostComponentStatusMetaData.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DeleteHostComponentStatusMetaData.java
index 1a4e34a..477add7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DeleteHostComponentStatusMetaData.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DeleteHostComponentStatusMetaData.java
@@ -32,9 +32,10 @@ public class DeleteHostComponentStatusMetaData extends DeleteStatusMetaData {
     removedHostComponents = new HashSet<>();
   }
 
-  public void addDeletedHostComponent(String componentName, String hostName, Long hostId,
+  public void addDeletedHostComponent(String componentName, String serviceName, String hostName, Long hostId,
                                       String clusterId, String version) {
-    removedHostComponents.add(new HostComponent(componentName, hostId, clusterId, version));
+    removedHostComponents.add(new HostComponent(componentName, serviceName, hostId,
+        hostName, clusterId, version));
     addDeletedKey(componentName + "/" + hostName);
   }
 
@@ -52,13 +53,18 @@ public class DeleteHostComponentStatusMetaData extends DeleteStatusMetaData {
 
   public class HostComponent {
     private String componentName;
+    private String serviceName;
     private Long hostId;
+    private String hostName;
     private String clusterId;
     private String version;
 
-    public HostComponent(String componentName, Long hostId, String clusterId, String version) {
+    public HostComponent(String componentName, String serviceName, Long hostId, String hostName,
+                         String clusterId, String version) {
       this.componentName = componentName;
+      this.serviceName = serviceName;
       this.hostId = hostId;
+      this.hostName = hostName;
       this.clusterId = clusterId;
       this.version = version;
     }
@@ -71,14 +77,6 @@ public class DeleteHostComponentStatusMetaData extends DeleteStatusMetaData {
       this.componentName = componentName;
     }
 
-    public Long getHostId() {
-      return hostId;
-    }
-
-    public void setHostName(Long hostId) {
-      this.hostId = hostId;
-    }
-
     public String getClusterId() {
       return clusterId;
     }
@@ -94,5 +92,29 @@ public class DeleteHostComponentStatusMetaData extends DeleteStatusMetaData {
     public void setVersion(String version) {
       this.version = version;
     }
+
+    public String getServiceName() {
+      return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+      this.serviceName = serviceName;
+    }
+
+    public String getHostName() {
+      return hostName;
+    }
+
+    public void setHostName(String hostName) {
+      this.hostName = hostName;
+    }
+
+    public Long getHostId() {
+      return hostId;
+    }
+
+    public void setHostId(Long hostId) {
+      this.hostId = hostId;
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
index 1b16b5e..74508c1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
@@ -28,6 +28,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeMap;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ClusterNotFoundException;
@@ -35,9 +36,11 @@ import org.apache.ambari.server.DuplicateResourceException;
 import org.apache.ambari.server.HostNotFoundException;
 import org.apache.ambari.server.ObjectNotFoundException;
 import org.apache.ambari.server.ParentObjectNotFoundException;
+import org.apache.ambari.server.agent.RecoveryConfigHelper;
 import org.apache.ambari.server.agent.stomp.dto.TopologyCluster;
 import org.apache.ambari.server.agent.stomp.dto.TopologyHost;
 import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.AmbariManagementControllerImpl;
 import org.apache.ambari.server.controller.ConfigurationRequest;
 import org.apache.ambari.server.controller.HostRequest;
 import org.apache.ambari.server.controller.HostResponse;
@@ -174,6 +177,12 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
   @Inject
   private StateUpdateEventPublisher stateUpdateEventPublisher;
 
+  @Inject
+  private RecoveryConfigHelper recoveryConfigHelper;
+
+  @Inject
+  private AmbariManagementControllerImpl ambariManagementController;
+
   // ----- Constructors ----------------------------------------------------
 
   /**
@@ -515,7 +524,7 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
     Map<String, Map<String, String>> hostAttributes = new HashMap<>();
     Set<String> allClusterSet = new HashSet<>();
 
-    Map<String, TopologyCluster> addedTopologies = new HashMap<>();
+    TreeMap<String, TopologyCluster> addedTopologies = new TreeMap<>();
     for (HostRequest hostRequest : hostRequests) {
       if (hostRequest.getHostname() != null &&
           !hostRequest.getHostname().isEmpty() &&
@@ -529,7 +538,8 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
         if (hostRequest.getHostAttributes() != null) {
           hostAttributes.put(hostRequest.getHostname(), hostRequest.getHostAttributes());
         }
-        String clusterId = Long.toString(clusters.getCluster(hostRequest.getClusterName()).getClusterId());
+        Cluster cl = clusters.getCluster(hostRequest.getClusterName());
+        String clusterId = Long.toString(cl.getClusterId());
         if (!addedTopologies.containsKey(clusterId)) {
           addedTopologies.put(clusterId, new TopologyCluster());
         }
@@ -537,7 +547,10 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
         addedTopologies.get(clusterId).addTopologyHost(new TopologyHost(addedHost.getHostId(),
             addedHost.getHostName(),
             addedHost.getRackInfo(),
-            addedHost.getIPv4()));
+            addedHost.getIPv4(),
+            recoveryConfigHelper.getRecoveryConfig(clusters.getCluster(hostRequest.getClusterName()).getClusterName(),
+                addedHost.getHostName()),
+            ambariManagementController.getTopologyHostLevelParams(cl, addedHost)));
       }
     }
     clusters.updateHostWithClusterAndAttributes(hostClustersMap, hostAttributes);
@@ -545,7 +558,8 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
     for (String clusterName : allClusterSet) {
       clusters.getCluster(clusterName).recalculateAllClusterVersionStates();
     }
-    TopologyUpdateEvent topologyUpdateEvent = new TopologyUpdateEvent(addedTopologies, TopologyUpdateEvent.EventType.ADD);
+    TopologyUpdateEvent topologyUpdateEvent =
+        new TopologyUpdateEvent(addedTopologies, TopologyUpdateEvent.EventType.UPDATE);
     stateUpdateEventPublisher.publish(topologyUpdateEvent);
   }
 
@@ -723,7 +737,7 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
       }
     }
 
-    Map<String, TopologyCluster> topologyUpdates = new HashMap<>();
+    TreeMap<String, TopologyCluster> topologyUpdates = new TreeMap<>();
     for (HostRequest request : requests) {
       if (LOG.isDebugEnabled()) {
         LOG.debug("Received an updateHost request"
@@ -905,7 +919,7 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
     Set<String> hostsClusters = new HashSet<>();
     Set<String> hostNames = new HashSet<>();
     Set<Cluster> allClustersWithHosts = new HashSet<>();
-    Map<String, TopologyCluster> topologyUpdates = new HashMap<>();
+    TreeMap<String, TopologyCluster> topologyUpdates = new TreeMap<>();
     for (HostRequest hostRequest : requests) {
       // Assume the user also wants to delete it entirely, including all clusters.
       String hostname = hostRequest.getHostname();
@@ -944,24 +958,6 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
         for (String key : componentDeleteStatus.getDeletedKeys()) {
           deleteStatusMetaData.addDeletedKey(key);
         }
-        /*for (DeleteHostComponentStatusMetaData.HostComponent hostComponent : componentDeleteStatus.getRemovedHostComponents()) {
-          String clusterId = hostComponent.getClusterId();
-          if (!topologyUpdates.containsKey(clusterId)) {
-            topologyUpdates.put(clusterId, new TopologyCluster());
-          }
-          TopologyComponent deletedComponent = new TopologyComponent(hostComponent.getComponentName(),
-              null,
-              hostComponent.getVersion(),
-              new HashSet<>(Arrays.asList(hostId)),
-              null);
-          if (!topologyUpdates.get(clusterId).getTopologyComponents().contains(deletedComponent)) {
-            topologyUpdates.get(clusterId).addTopologyComponent(deletedComponent);
-          } else {
-            topologyUpdates.get(clusterId).getTopologyComponents()
-                .stream().filter(t -> t.equals(deletedComponent))
-                .forEach(t -> t.addHostId(hostId));
-          }
-        }*/
         for (String key : componentDeleteStatus.getExceptionForKeys().keySet()) {
           deleteStatusMetaData.addException(key, componentDeleteStatus.getExceptionForKeys().get(key));
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/events/AgentConfigsUpdateEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/AgentConfigsUpdateEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/AgentConfigsUpdateEvent.java
new file mode 100644
index 0000000..23f3559
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/AgentConfigsUpdateEvent.java
@@ -0,0 +1,62 @@
+/**
+ * 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.events;
+
+import java.util.TreeMap;
+
+import org.apache.ambari.server.agent.stomp.dto.ClusterConfigs;
+import org.apache.ambari.server.agent.stomp.dto.Hashable;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class AgentConfigsUpdateEvent extends AmbariUpdateEvent implements Hashable {
+
+  private String hash;
+
+  @JsonProperty("clusters")
+  private TreeMap<String, ClusterConfigs> clustersConfigs = new TreeMap<>();
+
+  public AgentConfigsUpdateEvent(TreeMap<String, ClusterConfigs> clustersConfigs) {
+    super(Type.AGENT_CONFIGS);
+    this.clustersConfigs = clustersConfigs;
+  }
+
+  public TreeMap<String, ClusterConfigs> getClustersConfigs() {
+    return clustersConfigs;
+  }
+
+  public void setClustersConfigs(TreeMap<String, ClusterConfigs> clustersConfigs) {
+    this.clustersConfigs = clustersConfigs;
+  }
+
+  @Override
+  public String getHash() {
+    return hash;
+  }
+
+  public void setHash(String hash) {
+    this.hash = hash;
+  }
+
+  public static AgentConfigsUpdateEvent emptyUpdate() {
+    return new AgentConfigsUpdateEvent(null);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/events/AlertUpdateEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/AlertUpdateEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/AlertUpdateEvent.java
index 73862d5..52e2180 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/AlertUpdateEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/AlertUpdateEvent.java
@@ -18,24 +18,24 @@
 
 package org.apache.ambari.server.events;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 
-import org.apache.ambari.server.state.Alert;
+import org.apache.ambari.server.api.query.render.AlertSummaryGroupedRenderer;
 
 public class AlertUpdateEvent extends AmbariUpdateEvent {
-  private List<Alert> alerts = new ArrayList<>();
+  private Map<String, AlertSummaryGroupedRenderer.AlertDefinitionSummary> summaries = new HashMap<>();
 
-  public AlertUpdateEvent(List<Alert> alerts) {
+  public AlertUpdateEvent(Map<String, AlertSummaryGroupedRenderer.AlertDefinitionSummary> summaries) {
     super(Type.ALERT);
-    this.alerts = alerts;
+    this.summaries = summaries;
   }
 
-  public List<Alert> getAlerts() {
-    return alerts;
+  public Map<String, AlertSummaryGroupedRenderer.AlertDefinitionSummary> getSummaries() {
+    return summaries;
   }
 
-  public void setAlerts(List<Alert> alerts) {
-    this.alerts = alerts;
+  public void setSummaries(Map<String, AlertSummaryGroupedRenderer.AlertDefinitionSummary> summaries) {
+    this.summaries = summaries;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariUpdateEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariUpdateEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariUpdateEvent.java
index 2b7efa6..b075179 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariUpdateEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariUpdateEvent.java
@@ -44,13 +44,12 @@ public abstract class AmbariUpdateEvent {
   public enum Type {
     ALERT("/events/alerts", "events.alerts"),
     METADATA("/events/metadata", "events.metadata"),
-    TOPOLOGY("/events/topology", "events.topology_update"),
+    TOPOLOGY("/events/topologies", "events.topology_update"),
     AGENT_CONFIGS("/events/configs", "events.agent.configs"),
     CONFIGS("/events/configs", "events.configs"),
     HOSTCOMPONENT("/events/hostcomponents", "events.hostcomponents"),
     NAMEDHOSTCOMPONENT("/events/tasks/", "events.hostrolecommands.named"),
     REQUEST("/events/requests", "events.requests"),
-    NAMEDREQUEST("/events/requests", "events.requests.named"),
     COMMAND("/user/commands", "events.commands");
 
     private String destination;

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/events/ConfigsUpdateEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/ConfigsUpdateEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/ConfigsUpdateEvent.java
index b6eec10..26f6622 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/ConfigsUpdateEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/ConfigsUpdateEvent.java
@@ -19,7 +19,9 @@
 package org.apache.ambari.server.events;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.ambari.server.orm.entities.ClusterConfigEntity;
 import org.apache.ambari.server.orm.entities.ServiceConfigEntity;
@@ -34,13 +36,14 @@ public class ConfigsUpdateEvent extends AmbariUpdateEvent {
   private String user;
   private String note;
   private List<String> hostNames;
-  private Long createtime;
+  private Long createTime;
   private String groupName;
-  //TODO configs
 
   private List<ClusterConfig> configs = new ArrayList<>();
+  private Set<String> changedConfigTypes = new HashSet<>();
 
-  public ConfigsUpdateEvent(ServiceConfigEntity configs, String configGroupName, List<String> hostNames) {
+  public ConfigsUpdateEvent(ServiceConfigEntity configs, String configGroupName, List<String> hostNames,
+                            Set<String> changedConfigTypes) {
     super(Type.CONFIGS);
     this.serviceConfigId = configs.getServiceConfigId();
     this.clusterId = configs.getClusterEntity().getClusterId();
@@ -56,8 +59,9 @@ public class ConfigsUpdateEvent extends AmbariUpdateEvent {
         clusterConfigEntity.getTag(),
         clusterConfigEntity.getVersion()));
     }
-    this.createtime = configs.getCreateTimestamp();
+    this.createTime = configs.getCreateTimestamp();
     this.groupName = configGroupName;
+    this.changedConfigTypes = changedConfigTypes;
   }
 
   public Long getServiceConfigId() {
@@ -132,12 +136,12 @@ public class ConfigsUpdateEvent extends AmbariUpdateEvent {
     this.configs = configs;
   }
 
-  public Long getCreatetime() {
-    return createtime;
+  public Long getCreateTime() {
+    return createTime;
   }
 
-  public void setCreatetime(Long createtime) {
-    this.createtime = createtime;
+  public void setCreateTime(Long createTime) {
+    this.createTime = createTime;
   }
 
   public String getGroupName() {
@@ -148,6 +152,14 @@ public class ConfigsUpdateEvent extends AmbariUpdateEvent {
     this.groupName = groupName;
   }
 
+  public Set<String> getChangedConfigTypes() {
+    return changedConfigTypes;
+  }
+
+  public void setChangedConfigTypes(Set<String> changedConfigTypes) {
+    this.changedConfigTypes = changedConfigTypes;
+  }
+
   public class ClusterConfig {
     private Long clusterId;
     private String type;

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/events/MetadataUpdateEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/MetadataUpdateEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/MetadataUpdateEvent.java
index fc660a6..6e7ee90 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/MetadataUpdateEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/MetadataUpdateEvent.java
@@ -17,9 +17,46 @@
  */
 package org.apache.ambari.server.events;
 
-public class MetadataUpdateEvent extends AmbariUpdateEvent {
+import java.util.Map;
+import java.util.TreeMap;
 
-  public MetadataUpdateEvent() {
+import org.apache.ambari.server.agent.stomp.dto.Hashable;
+import org.apache.ambari.server.agent.stomp.dto.MetadataCluster;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class MetadataUpdateEvent extends AmbariUpdateEvent implements Hashable {
+
+  private String hash;
+
+  @JsonProperty("clusters")
+  private TreeMap<String, MetadataCluster> metadataClusters = new TreeMap<>();
+
+  public MetadataUpdateEvent(TreeMap<String, MetadataCluster> metadataClusters) {
     super(Type.METADATA);
+    this.metadataClusters = metadataClusters;
+  }
+
+  public Map<String, MetadataCluster> getMetadataClusters() {
+    return metadataClusters;
+  }
+
+  public void setMetadataClusters(TreeMap<String, MetadataCluster> metadataClusters) {
+    this.metadataClusters = metadataClusters;
+  }
+
+  @Override
+  public String getHash() {
+    return hash;
+  }
+
+  public void setHash(String hash) {
+    this.hash = hash;
+  }
+
+  public static MetadataUpdateEvent emptyUpdate() {
+    return new MetadataUpdateEvent(null);
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/421ac277/ambari-server/src/main/java/org/apache/ambari/server/events/NamedHostRoleCommandUpdateEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/NamedHostRoleCommandUpdateEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/NamedHostRoleCommandUpdateEvent.java
new file mode 100644
index 0000000..3096347
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/NamedHostRoleCommandUpdateEvent.java
@@ -0,0 +1,127 @@
+/**
+ * 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.events;
+
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NamedHostRoleCommandUpdateEvent extends AmbariUpdateEvent {
+
+  private Long id;
+  private Long requestId;
+  private String hostName;
+  private Long endTime;
+  private HostRoleStatus status;
+  private String errorLog;
+  private String outLog;
+  private String stderr;
+  private String stdout;
+
+  public NamedHostRoleCommandUpdateEvent(Long id, Long requestId, String hostName, Long endTime, HostRoleStatus status, String errorLog, String outLog, String stderr, String stdout) {
+    super(Type.NAMEDHOSTCOMPONENT);
+    this.id = id;
+    this.requestId = requestId;
+    this.hostName = hostName;
+    this.endTime = endTime;
+    this.status = status;
+    this.errorLog = errorLog;
+    this.outLog = outLog;
+    this.stderr = stderr;
+    this.stdout = stdout;
+  }
+
+  public Long getId() {
+    return id;
+  }
+
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public Long getRequestId() {
+    return requestId;
+  }
+
+  public void setRequestId(Long requestId) {
+    this.requestId = requestId;
+  }
+
+  public String getHostName() {
+    return hostName;
+  }
+
+  public void setHostName(String hostName) {
+    this.hostName = hostName;
+  }
+
+  public Long getEndTime() {
+    return endTime;
+  }
+
+  public void setEndTime(Long endTime) {
+    this.endTime = endTime;
+  }
+
+  public HostRoleStatus getStatus() {
+    return status;
+  }
+
+  public void setStatus(HostRoleStatus status) {
+    this.status = status;
+  }
+
+  public String getErrorLog() {
+    return errorLog;
+  }
+
+  public void setErrorLog(String errorLog) {
+    this.errorLog = errorLog;
+  }
+
+  public String getOutLog() {
+    return outLog;
+  }
+
+  public void setOutLog(String outLog) {
+    this.outLog = outLog;
+  }
+
+  public String getStderr() {
+    return stderr;
+  }
+
+  public void setStderr(String stderr) {
+    this.stderr = stderr;
+  }
+
+  public String getStdout() {
+    return stdout;
+  }
+
+  public void setStdout(String stdout) {
+    this.stdout = stdout;
+  }
+
+  @Override
+  public String getDestination() {
+    return super.getDestination() + getId();
+  }
+}


Mime
View raw message