Bläddra i källkod

AMBARI-737. ServiceComponentNode FSM implementation. (Contributed by hitesh)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1384976 13f79535-47bb-0310-9956-ffa450edef68
Hitesh Shah 12 år sedan
förälder
incheckning
d4552f3dea
19 ändrade filer med 871 tillägg och 46 borttagningar
  1. 2 0
      AMBARI-666-CHANGES.txt
  2. 21 1
      ambari-server/src/main/java/org/apache/ambari/server/state/ConfigVersion.java
  3. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/state/StackVersion.java
  4. 2 2
      ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java
  5. 30 3
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeEvent.java
  6. 270 37
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeImpl.java
  7. 31 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeInstallEvent.java
  8. 9 1
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeLiveState.java
  9. 30 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpFailedEvent.java
  10. 31 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpInProgressEvent.java
  11. 31 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpRestartedEvent.java
  12. 31 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpSucceededEvent.java
  13. 31 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeStartEvent.java
  14. 28 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeState.java
  15. 31 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeStopEvent.java
  16. 31 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeUninstallEvent.java
  17. 31 0
      ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeWipeoutEvent.java
  18. 229 0
      ambari-server/src/test/java/org/apache/ambari/server/state/live/TestServiceComponentNodeImpl.java
  19. 1 1
      ambari-server/src/test/resources/log4j.properties

+ 2 - 0
AMBARI-666-CHANGES.txt

@@ -12,6 +12,8 @@ AMBARI-666 branch (unreleased changes)
 
 
   NEW FEATURES
   NEW FEATURES
 
 
+  AMBARI-737. ServiceComponentNode FSM implementation. (hitesh)
+
   AMBARI-734. Initial work for adding DataNode/TaskTracker/RegionServer
   AMBARI-734. Initial work for adding DataNode/TaskTracker/RegionServer
   configuration overrides on groups of hosts in Installer Customize Services
   configuration overrides on groups of hosts in Installer Customize Services
   page. (yusaku)
   page. (yusaku)

+ 21 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/ConfigVersion.java

@@ -18,6 +18,26 @@
 
 
 package org.apache.ambari.server.state;
 package org.apache.ambari.server.state;
 
 
-public interface ConfigVersion {
+public class ConfigVersion {
+  private String configVersion;
+
+  public ConfigVersion(String configVersion) {
+    super();
+    this.configVersion = configVersion;
+  }
+
+  /**
+   * @return the configVersion
+   */
+  public String getConfigVersion() {
+    return configVersion;
+  }
+
+  /**
+   * @param configVersion the configVersion to set
+   */
+  public void setConfigVersion(String configVersion) {
+    this.configVersion = configVersion;
+  }
 
 
 }
 }

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/StackVersion.java → ambari-server/src/main/java/org/apache/ambari/server/state/StackVersion.java

@@ -16,7 +16,7 @@
  * limitations under the License.
  * limitations under the License.
  */
  */
 
 
-package org.apache.ambari.server.state.live;
+package org.apache.ambari.server.state;
 
 
 public class StackVersion {
 public class StackVersion {
   private String stackVersion;
   private String stackVersion;

+ 2 - 2
ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java

@@ -53,7 +53,7 @@ public interface Cluster {
    * @param nodeName Node name
    * @param nodeName Node name
    * @return ServiceComponentNodeState
    * @return ServiceComponentNodeState
    */
    */
-  public ServiceComponentNodeLiveState getServiceComponentNodeState(String service,
+  public ServiceComponentNodeState getServiceComponentNodeState(String service,
       String serviceComponent, String nodeName);
       String serviceComponent, String nodeName);
 
 
   /**
   /**
@@ -65,7 +65,7 @@ public interface Cluster {
    */
    */
   public void setServiceComponentNodeState(String service,
   public void setServiceComponentNodeState(String service,
       String serviceComponent, String nodeName,
       String serviceComponent, String nodeName,
-      ServiceComponentNodeLiveState state);
+      ServiceComponentNodeState state);
 
 
   /**
   /**
    * Send an Event to a given ServiceComponentNode
    * Send an Event to a given ServiceComponentNode

+ 30 - 3
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeEvent.java

@@ -29,18 +29,45 @@ public class ServiceComponentNodeEvent
   /**
   /**
    * ServiceComponent that this event relates to
    * ServiceComponent that this event relates to
    */
    */
-  final String serviceComponentName;
+  private final String serviceComponentName;
 
 
   /**
   /**
    * Hostname of the Node that this event relates to
    * Hostname of the Node that this event relates to
    */
    */
-  final String nodeName;
+  private final String nodeName;
+
+  /**
+   * Time when the event was triggered
+   */
+  private final long opTimestamp;
 
 
   public ServiceComponentNodeEvent(ServiceComponentNodeEventType type,
   public ServiceComponentNodeEvent(ServiceComponentNodeEventType type,
-      String serviceComponentName, String nodeName) {
+      String serviceComponentName, String nodeName, long opTimestamp) {
     super(type);
     super(type);
     this.serviceComponentName = serviceComponentName;
     this.serviceComponentName = serviceComponentName;
     this.nodeName = nodeName;
     this.nodeName = nodeName;
+    this.opTimestamp = opTimestamp;
+  }
+
+  /**
+   * @return the serviceComponentName
+   */
+  public String getServiceComponentName() {
+    return serviceComponentName;
+  }
+
+  /**
+   * @return the nodeName
+   */
+  public String getNodeName() {
+    return nodeName;
+  }
+
+  /**
+   * @return the opTimestamp
+   */
+  public long getOpTimestamp() {
+    return opTimestamp;
   }
   }
 
 
 }
 }

+ 270 - 37
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeImpl.java

@@ -24,6 +24,7 @@ import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 
 import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
 import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
+import org.apache.ambari.server.state.fsm.SingleArcTransition;
 import org.apache.ambari.server.state.fsm.StateMachine;
 import org.apache.ambari.server.state.fsm.StateMachine;
 import org.apache.ambari.server.state.fsm.StateMachineFactory;
 import org.apache.ambari.server.state.fsm.StateMachineFactory;
 import org.apache.ambari.server.state.live.job.Job;
 import org.apache.ambari.server.state.live.job.Job;
@@ -43,6 +44,10 @@ public class ServiceComponentNodeImpl implements ServiceComponentNode {
   private final String serviceComponentName;
   private final String serviceComponentName;
   private final String hostName;
   private final String hostName;
 
 
+  private long lastOpStartTime;
+  private long lastOpEndTime;
+  private long lastOpLastUpdateTime;
+
   private static final StateMachineFactory
   private static final StateMachineFactory
   <ServiceComponentNodeImpl, ServiceComponentNodeLiveState,
   <ServiceComponentNodeImpl, ServiceComponentNodeLiveState,
   ServiceComponentNodeEventType, ServiceComponentNodeEvent>
   ServiceComponentNodeEventType, ServiceComponentNodeEvent>
@@ -57,85 +62,124 @@ public class ServiceComponentNodeImpl implements ServiceComponentNode {
 
 
      .addTransition(ServiceComponentNodeLiveState.INIT,
      .addTransition(ServiceComponentNodeLiveState.INIT,
          ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL)
-
+         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL,
+         new ServiceComponentNodeOpStartedTransition())
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLED,
          ServiceComponentNodeLiveState.INSTALLED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED,
+         new ServiceComponentNodeOpCompletedTransition())
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS,
+         new ServiceComponentNodeOpInProgressTransition())
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALL_FAILED,
          ServiceComponentNodeLiveState.INSTALL_FAILED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED,
+         new ServiceComponentNodeOpCompletedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.INSTALL_FAILED,
      .addTransition(ServiceComponentNodeLiveState.INSTALL_FAILED,
          ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.INSTALLED,
      .addTransition(ServiceComponentNodeLiveState.INSTALLED,
          ServiceComponentNodeLiveState.STARTING,
          ServiceComponentNodeLiveState.STARTING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_START)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_START,
+         new ServiceComponentNodeOpStartedTransition())
      .addTransition(ServiceComponentNodeLiveState.INSTALLED,
      .addTransition(ServiceComponentNodeLiveState.INSTALLED,
          ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_UNINSTALL)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_UNINSTALL,
+         new ServiceComponentNodeOpStartedTransition())
      .addTransition(ServiceComponentNodeLiveState.INSTALLED,
      .addTransition(ServiceComponentNodeLiveState.INSTALLED,
          ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.STARTING,
      .addTransition(ServiceComponentNodeLiveState.STARTING,
          ServiceComponentNodeLiveState.STARTING,
          ServiceComponentNodeLiveState.STARTING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS,
+         new ServiceComponentNodeOpInProgressTransition())
      .addTransition(ServiceComponentNodeLiveState.STARTING,
      .addTransition(ServiceComponentNodeLiveState.STARTING,
          ServiceComponentNodeLiveState.STARTED,
          ServiceComponentNodeLiveState.STARTED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED,
+         new ServiceComponentNodeOpCompletedTransition())
      .addTransition(ServiceComponentNodeLiveState.STARTING,
      .addTransition(ServiceComponentNodeLiveState.STARTING,
          ServiceComponentNodeLiveState.START_FAILED,
          ServiceComponentNodeLiveState.START_FAILED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED,
+         new ServiceComponentNodeOpCompletedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.START_FAILED,
      .addTransition(ServiceComponentNodeLiveState.START_FAILED,
          ServiceComponentNodeLiveState.STARTING,
          ServiceComponentNodeLiveState.STARTING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.STARTED,
      .addTransition(ServiceComponentNodeLiveState.STARTED,
          ServiceComponentNodeLiveState.STOPPING,
          ServiceComponentNodeLiveState.STOPPING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_STOP)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_STOP,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.STOPPING,
      .addTransition(ServiceComponentNodeLiveState.STOPPING,
          ServiceComponentNodeLiveState.STOPPING,
          ServiceComponentNodeLiveState.STOPPING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS,
+         new ServiceComponentNodeOpInProgressTransition())
      .addTransition(ServiceComponentNodeLiveState.STOPPING,
      .addTransition(ServiceComponentNodeLiveState.STOPPING,
          ServiceComponentNodeLiveState.INSTALLED,
          ServiceComponentNodeLiveState.INSTALLED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED,
+         new ServiceComponentNodeOpCompletedTransition())
      .addTransition(ServiceComponentNodeLiveState.STOPPING,
      .addTransition(ServiceComponentNodeLiveState.STOPPING,
          ServiceComponentNodeLiveState.STOP_FAILED,
          ServiceComponentNodeLiveState.STOP_FAILED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED,
+         new ServiceComponentNodeOpCompletedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.STOP_FAILED,
      .addTransition(ServiceComponentNodeLiveState.STOP_FAILED,
          ServiceComponentNodeLiveState.STOPPING,
          ServiceComponentNodeLiveState.STOPPING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS,
+         new ServiceComponentNodeOpInProgressTransition())
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALLED,
          ServiceComponentNodeLiveState.UNINSTALLED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED,
+         new ServiceComponentNodeOpCompletedTransition())
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALL_FAILED,
          ServiceComponentNodeLiveState.UNINSTALL_FAILED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED,
+         new ServiceComponentNodeOpCompletedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.UNINSTALL_FAILED,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALL_FAILED,
          ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLED,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLED,
          ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLED,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLED,
+         ServiceComponentNodeLiveState.WIPING_OUT,
+         ServiceComponentNodeEventType.NODE_SVCCOMP_WIPEOUT,
+         new ServiceComponentNodeOpStartedTransition())
+
+     .addTransition(ServiceComponentNodeLiveState.WIPING_OUT,
+         ServiceComponentNodeLiveState.WIPING_OUT,
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS,
+         new ServiceComponentNodeOpInProgressTransition())
+     .addTransition(ServiceComponentNodeLiveState.WIPING_OUT,
          ServiceComponentNodeLiveState.INIT,
          ServiceComponentNodeLiveState.INIT,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_WIPEOUT)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED,
+         new ServiceComponentNodeOpCompletedTransition())
+     .addTransition(ServiceComponentNodeLiveState.WIPING_OUT,
+         ServiceComponentNodeLiveState.WIPEOUT_FAILED,
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED,
+         new ServiceComponentNodeOpCompletedTransition())
+     .addTransition(ServiceComponentNodeLiveState.WIPEOUT_FAILED,
+         ServiceComponentNodeLiveState.WIPING_OUT,
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .installTopology();
      .installTopology();
 
 
@@ -153,50 +197,80 @@ public class ServiceComponentNodeImpl implements ServiceComponentNode {
 
 
      .addTransition(ServiceComponentNodeLiveState.INIT,
      .addTransition(ServiceComponentNodeLiveState.INIT,
          ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLED,
          ServiceComponentNodeLiveState.INSTALLED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED,
+         new ServiceComponentNodeOpCompletedTransition())
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS,
+         new ServiceComponentNodeOpInProgressTransition())
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
      .addTransition(ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALL_FAILED,
          ServiceComponentNodeLiveState.INSTALL_FAILED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED,
+         new ServiceComponentNodeOpCompletedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.INSTALL_FAILED,
      .addTransition(ServiceComponentNodeLiveState.INSTALL_FAILED,
          ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.INSTALLED,
      .addTransition(ServiceComponentNodeLiveState.INSTALLED,
          ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_UNINSTALL)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_UNINSTALL,
+         new ServiceComponentNodeOpStartedTransition())
      .addTransition(ServiceComponentNodeLiveState.INSTALLED,
      .addTransition(ServiceComponentNodeLiveState.INSTALLED,
          ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS,
+         new ServiceComponentNodeOpInProgressTransition())
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALLED,
          ServiceComponentNodeLiveState.UNINSTALLED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED,
+         new ServiceComponentNodeOpCompletedTransition())
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALL_FAILED,
          ServiceComponentNodeLiveState.UNINSTALL_FAILED,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED,
+         new ServiceComponentNodeOpCompletedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.UNINSTALL_FAILED,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALL_FAILED,
          ServiceComponentNodeLiveState.UNINSTALLING,
          ServiceComponentNodeLiveState.UNINSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLED,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLED,
          ServiceComponentNodeLiveState.INSTALLING,
          ServiceComponentNodeLiveState.INSTALLING,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLED,
      .addTransition(ServiceComponentNodeLiveState.UNINSTALLED,
+         ServiceComponentNodeLiveState.WIPING_OUT,
+         ServiceComponentNodeEventType.NODE_SVCCOMP_WIPEOUT,
+         new ServiceComponentNodeOpStartedTransition())
+
+     .addTransition(ServiceComponentNodeLiveState.WIPING_OUT,
+         ServiceComponentNodeLiveState.WIPING_OUT,
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS,
+         new ServiceComponentNodeOpInProgressTransition())
+     .addTransition(ServiceComponentNodeLiveState.WIPING_OUT,
          ServiceComponentNodeLiveState.INIT,
          ServiceComponentNodeLiveState.INIT,
-         ServiceComponentNodeEventType.NODE_SVCCOMP_WIPEOUT)
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED,
+         new ServiceComponentNodeOpCompletedTransition())
+     .addTransition(ServiceComponentNodeLiveState.WIPING_OUT,
+         ServiceComponentNodeLiveState.WIPEOUT_FAILED,
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED,
+         new ServiceComponentNodeOpCompletedTransition())
+     .addTransition(ServiceComponentNodeLiveState.WIPEOUT_FAILED,
+         ServiceComponentNodeLiveState.WIPING_OUT,
+         ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART,
+         new ServiceComponentNodeOpStartedTransition())
 
 
      .installTopology();
      .installTopology();
 
 
@@ -204,6 +278,85 @@ public class ServiceComponentNodeImpl implements ServiceComponentNode {
   private final StateMachine<ServiceComponentNodeLiveState,
   private final StateMachine<ServiceComponentNodeLiveState,
       ServiceComponentNodeEventType, ServiceComponentNodeEvent> stateMachine;
       ServiceComponentNodeEventType, ServiceComponentNodeEvent> stateMachine;
 
 
+  static class ServiceComponentNodeOpCompletedTransition
+     implements SingleArcTransition<ServiceComponentNodeImpl,
+         ServiceComponentNodeEvent> {
+
+    @Override
+    public void transition(ServiceComponentNodeImpl impl,
+        ServiceComponentNodeEvent event) {
+      // TODO Audit logs
+      impl.updateLastOpInfo(event.getType(), event.getOpTimestamp());
+    }
+
+  }
+
+  static class ServiceComponentNodeOpStartedTransition
+    implements SingleArcTransition<ServiceComponentNodeImpl,
+        ServiceComponentNodeEvent> {
+
+    @Override
+    public void transition(ServiceComponentNodeImpl impl,
+        ServiceComponentNodeEvent event) {
+      // TODO Audit logs
+      impl.updateLastOpInfo(event.getType(), event.getOpTimestamp());
+    }
+  }
+
+  static class ServiceComponentNodeOpInProgressTransition
+    implements SingleArcTransition<ServiceComponentNodeImpl,
+        ServiceComponentNodeEvent> {
+
+    @Override
+    public void transition(ServiceComponentNodeImpl impl,
+        ServiceComponentNodeEvent event) {
+      // TODO Audit logs
+      impl.updateLastOpInfo(event.getType(), event.getOpTimestamp());
+    }
+  }
+
+
+  private void resetLastOpInfo() {
+    try {
+      writeLock.lock();
+      setLastOpStartTime(-1);
+      setLastOpLastUpdateTime(-1);
+      setLastOpEndTime(-1);
+    }
+    finally {
+      writeLock.unlock();
+    }
+  }
+
+  private void updateLastOpInfo(ServiceComponentNodeEventType eventType,
+      long time) {
+    try {
+      writeLock.lock();
+      switch (eventType) {
+        case NODE_SVCCOMP_INSTALL:
+        case NODE_SVCCOMP_START:
+        case NODE_SVCCOMP_STOP:
+        case NODE_SVCCOMP_UNINSTALL:
+        case NODE_SVCCOMP_WIPEOUT:
+        case NODE_SVCCOMP_OP_RESTART:
+          resetLastOpInfo();
+          setLastOpStartTime(time);
+          break;
+        case NODE_SVCCOMP_OP_FAILED:
+        case NODE_SVCCOMP_OP_SUCCEEDED:
+          setLastOpLastUpdateTime(time);
+          setLastOpEndTime(time);
+          break;
+        case NODE_SVCCOMP_OP_IN_PROGRESS:
+          setLastOpLastUpdateTime(time);
+          break;
+      }
+    }
+    finally {
+      writeLock.unlock();
+    }
+  }
+
   public ServiceComponentNodeImpl(String serviceComponentName,
   public ServiceComponentNodeImpl(String serviceComponentName,
       String hostName, boolean isClient) {
       String hostName, boolean isClient) {
     super();
     super();
@@ -217,6 +370,8 @@ public class ServiceComponentNodeImpl implements ServiceComponentNode {
     this.writeLock = rwLock.writeLock();
     this.writeLock = rwLock.writeLock();
     this.serviceComponentName = serviceComponentName;
     this.serviceComponentName = serviceComponentName;
     this.hostName = hostName;
     this.hostName = hostName;
+    this.state = new ServiceComponentNodeState();
+    this.resetLastOpInfo();
   }
   }
 
 
   @Override
   @Override
@@ -256,6 +411,7 @@ public class ServiceComponentNodeImpl implements ServiceComponentNode {
       try {
       try {
         stateMachine.doTransition(event.getType(), event);
         stateMachine.doTransition(event.getType(), event);
         state.setState(stateMachine.getCurrentState());
         state.setState(stateMachine.getCurrentState());
+        // TODO Audit logs
       } catch (InvalidStateTransitonException e) {
       } catch (InvalidStateTransitonException e) {
         LOG.error("Can't handle ServiceComponentNodeEvent event at"
         LOG.error("Can't handle ServiceComponentNodeEvent event at"
             + " current state"
             + " current state"
@@ -299,5 +455,82 @@ public class ServiceComponentNodeImpl implements ServiceComponentNode {
     return hostName;
     return hostName;
   }
   }
 
 
+  /**
+   * @return the lastOpStartTime
+   */
+  public long getLastOpStartTime() {
+    try {
+      readLock.lock();
+      return lastOpStartTime;
+    }
+    finally {
+      readLock.unlock();
+    }
+  }
+
+  /**
+   * @param lastOpStartTime the lastOpStartTime to set
+   */
+  public void setLastOpStartTime(long lastOpStartTime) {
+    try {
+      writeLock.lock();
+      this.lastOpStartTime = lastOpStartTime;
+    }
+    finally {
+      writeLock.unlock();
+    }
+  }
+
+  /**
+   * @return the lastOpEndTime
+   */
+  public long getLastOpEndTime() {
+    try {
+      readLock.lock();
+      return lastOpEndTime;
+    }
+    finally {
+      readLock.unlock();
+    }
+  }
+
+  /**
+   * @param lastOpEndTime the lastOpEndTime to set
+   */
+  public void setLastOpEndTime(long lastOpEndTime) {
+    try {
+      writeLock.lock();
+      this.lastOpEndTime = lastOpEndTime;
+    }
+    finally {
+      writeLock.unlock();
+    }
+  }
+
+  /**
+   * @return the lastOpLastUpdateTime
+   */
+  public long getLastOpLastUpdateTime() {
+    try {
+      readLock.lock();
+      return lastOpLastUpdateTime;
+    }
+    finally {
+      readLock.unlock();
+    }
+  }
+
+  /**
+   * @param lastOpLastUpdateTime the lastOpLastUpdateTime to set
+   */
+  public void setLastOpLastUpdateTime(long lastOpLastUpdateTime) {
+    try {
+      writeLock.lock();
+      this.lastOpLastUpdateTime = lastOpLastUpdateTime;
+    }
+    finally {
+      writeLock.unlock();
+    }
+  }
 
 
 }
 }

+ 31 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeInstallEvent.java

@@ -0,0 +1,31 @@
+/**
+ * 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.state.live;
+
+public class ServiceComponentNodeInstallEvent extends
+    ServiceComponentNodeEvent {
+
+
+  public ServiceComponentNodeInstallEvent(String serviceComponentName,
+      String nodeName, long opTimestamp) {
+    super(ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL,
+        serviceComponentName, nodeName, opTimestamp);
+  }
+
+}

+ 9 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeLiveState.java

@@ -66,5 +66,13 @@ public enum ServiceComponentNodeLiveState {
   /**
   /**
    * State when uninstall completed successfully.
    * State when uninstall completed successfully.
    */
    */
-  UNINSTALLED
+  UNINSTALLED,
+  /**
+   * In the process of wiping out the install
+   */
+  WIPING_OUT,
+  /**
+   * State when wipeout fails
+   */
+  WIPEOUT_FAILED
 }
 }

+ 30 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpFailedEvent.java

@@ -0,0 +1,30 @@
+/**
+ * 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.state.live;
+
+public class ServiceComponentNodeOpFailedEvent extends
+    ServiceComponentNodeEvent {
+
+  public ServiceComponentNodeOpFailedEvent(String serviceComponentName,
+      String nodeName, long opTimestamp) {
+    super(ServiceComponentNodeEventType.NODE_SVCCOMP_OP_FAILED,
+        serviceComponentName, nodeName, opTimestamp);
+    // TODO Auto-generated constructor stub
+  }
+}

+ 31 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpInProgressEvent.java

@@ -0,0 +1,31 @@
+/**
+ * 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.state.live;
+
+public class ServiceComponentNodeOpInProgressEvent extends
+    ServiceComponentNodeEvent {
+
+  public ServiceComponentNodeOpInProgressEvent(String serviceComponentName,
+      String nodeName, long opTimestamp) {
+    super(ServiceComponentNodeEventType.NODE_SVCCOMP_OP_IN_PROGRESS,
+        serviceComponentName, nodeName, opTimestamp);
+    // TODO Auto-generated constructor stub
+  }
+
+}

+ 31 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpRestartedEvent.java

@@ -0,0 +1,31 @@
+/**
+ * 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.state.live;
+
+public class ServiceComponentNodeOpRestartedEvent extends
+    ServiceComponentNodeEvent {
+
+  public ServiceComponentNodeOpRestartedEvent(String serviceComponentName,
+      String nodeName, long opTimestamp) {
+    super(ServiceComponentNodeEventType.NODE_SVCCOMP_OP_RESTART,
+        serviceComponentName, nodeName, opTimestamp);
+    // TODO Auto-generated constructor stub
+  }
+
+}

+ 31 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpSucceededEvent.java

@@ -0,0 +1,31 @@
+/**
+ * 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.state.live;
+
+public class ServiceComponentNodeOpSucceededEvent extends
+    ServiceComponentNodeEvent {
+
+  public ServiceComponentNodeOpSucceededEvent(String serviceComponentName,
+      String nodeName, long opTimestamp) {
+    super(ServiceComponentNodeEventType.NODE_SVCCOMP_OP_SUCCEEDED,
+        serviceComponentName, nodeName, opTimestamp);
+    // TODO Auto-generated constructor stub
+  }
+
+}

+ 31 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeStartEvent.java

@@ -0,0 +1,31 @@
+/**
+ * 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.state.live;
+
+public class ServiceComponentNodeStartEvent extends
+    ServiceComponentNodeEvent {
+
+  public ServiceComponentNodeStartEvent(String serviceComponentName,
+      String nodeName, long opTimestamp) {
+    super(ServiceComponentNodeEventType.NODE_SVCCOMP_START,
+        serviceComponentName, nodeName, opTimestamp);
+    // TODO Auto-generated constructor stub
+  }
+
+}

+ 28 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeState.java

@@ -19,6 +19,7 @@
 package org.apache.ambari.server.state.live;
 package org.apache.ambari.server.state.live;
 
 
 import org.apache.ambari.server.state.ConfigVersion;
 import org.apache.ambari.server.state.ConfigVersion;
+import org.apache.ambari.server.state.StackVersion;
 
 
 public class ServiceComponentNodeState {
 public class ServiceComponentNodeState {
 
 
@@ -34,6 +35,14 @@ public class ServiceComponentNodeState {
     this.state = state;
     this.state = state;
   }
   }
 
 
+  public ServiceComponentNodeState() {
+    super();
+    this.configVersion = null;
+    this.stackVersion = null;
+    this.state = ServiceComponentNodeLiveState.INIT;
+  }
+
+
   /**
   /**
    * @return the configVersion
    * @return the configVersion
    */
    */
@@ -70,4 +79,23 @@ public class ServiceComponentNodeState {
   public void setState(ServiceComponentNodeLiveState state) {
   public void setState(ServiceComponentNodeLiveState state) {
     this.state = state;
     this.state = state;
   }
   }
+
+
+  public String toString() {
+    String out = "[";
+    out += " StackVersion=";
+    if (stackVersion != null) {
+      out += stackVersion;
+    } else {
+      out += "null";
+    }
+    out += ", ConfigVersion=";
+    if (configVersion != null) {
+      out += configVersion;
+    } else {
+      out += "null";
+    }
+    out += ", state=" + state;
+    return out;
+  }
 }
 }

+ 31 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeStopEvent.java

@@ -0,0 +1,31 @@
+/**
+ * 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.state.live;
+
+public class ServiceComponentNodeStopEvent extends
+    ServiceComponentNodeEvent {
+
+  public ServiceComponentNodeStopEvent(String serviceComponentName,
+      String nodeName, long opTimestamp) {
+    super(ServiceComponentNodeEventType.NODE_SVCCOMP_STOP,
+        serviceComponentName, nodeName, opTimestamp);
+    // TODO Auto-generated constructor stub
+  }
+
+}

+ 31 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeUninstallEvent.java

@@ -0,0 +1,31 @@
+/**
+ * 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.state.live;
+
+public class ServiceComponentNodeUninstallEvent extends
+    ServiceComponentNodeEvent {
+
+  public ServiceComponentNodeUninstallEvent(String serviceComponentName,
+      String nodeName, long opTimestamp) {
+    super(ServiceComponentNodeEventType.NODE_SVCCOMP_UNINSTALL,
+        serviceComponentName, nodeName, opTimestamp);
+    // TODO Auto-generated constructor stub
+  }
+
+}

+ 31 - 0
ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeWipeoutEvent.java

@@ -0,0 +1,31 @@
+/**
+ * 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.state.live;
+
+public class ServiceComponentNodeWipeoutEvent extends
+    ServiceComponentNodeEvent {
+
+  public ServiceComponentNodeWipeoutEvent(String serviceComponentName,
+      String nodeName, long opTimestamp) {
+    super(ServiceComponentNodeEventType.NODE_SVCCOMP_WIPEOUT,
+        serviceComponentName, nodeName, opTimestamp);
+    // TODO Auto-generated constructor stub
+  }
+
+}

+ 229 - 0
ambari-server/src/test/java/org/apache/ambari/server/state/live/TestServiceComponentNodeImpl.java

@@ -0,0 +1,229 @@
+/**
+ * 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.state.live;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestServiceComponentNodeImpl {
+
+  private ServiceComponentNodeImpl createNewServiceComponentNode(String svcComponent,
+      String hostName, boolean isClient) {
+    ServiceComponentNodeImpl impl = new ServiceComponentNodeImpl(svcComponent,
+        hostName, isClient);
+    Assert.assertEquals(ServiceComponentNodeLiveState.INIT,
+        impl.getState().getLiveState());
+    return impl;
+  }
+
+  @Test
+  public void testNewServiceComponentNodeImpl() {
+    createNewServiceComponentNode("svcComp", "h1", false);
+    createNewServiceComponentNode("svcComp", "h1", true);
+  }
+
+  private ServiceComponentNodeEvent createEvent(ServiceComponentNodeImpl impl,
+      long timestamp, ServiceComponentNodeEventType eventType) {
+    ServiceComponentNodeEvent event = new ServiceComponentNodeEvent(eventType,
+          impl.getServiceComponentName(), impl.getNodeName(), timestamp);
+    return event;
+  }
+
+
+
+  private void runStateChanges(ServiceComponentNodeImpl impl,
+      ServiceComponentNodeEventType startEvent,
+      ServiceComponentNodeLiveState startState,
+      ServiceComponentNodeLiveState inProgressState,
+      ServiceComponentNodeLiveState failedState,
+      ServiceComponentNodeLiveState completedState)
+    throws Exception {
+    long timestamp = 0;
+
+    Assert.assertEquals(startState,
+        impl.getState().getLiveState());
+    ServiceComponentNodeEvent installEvent = createEvent(impl, ++timestamp,
+        startEvent);
+
+    long startTime = timestamp;
+    impl.handleEvent(installEvent);
+    Assert.assertEquals(startTime, impl.getLastOpStartTime());
+    Assert.assertEquals(-1, impl.getLastOpLastUpdateTime());
+    Assert.assertEquals(-1, impl.getLastOpEndTime());
+    Assert.assertEquals(inProgressState,
+        impl.getState().getLiveState());
+
+    ServiceComponentNodeEvent installEvent2 = createEvent(impl, ++timestamp,
+        startEvent);
+    boolean exceptionThrown = false;
+    try {
+      impl.handleEvent(installEvent2);
+    } catch (Exception e) {
+      exceptionThrown = true;
+    }
+    Assert.assertTrue("Exception not thrown on invalid event", exceptionThrown);
+    Assert.assertEquals(startTime, impl.getLastOpStartTime());
+    Assert.assertEquals(-1, impl.getLastOpLastUpdateTime());
+    Assert.assertEquals(-1, impl.getLastOpEndTime());
+    Assert.assertEquals(inProgressState,
+        impl.getState().getLiveState());
+
+    ServiceComponentNodeOpInProgressEvent inProgressEvent1 = new
+        ServiceComponentNodeOpInProgressEvent(impl.getServiceComponentName(),
+            impl.getNodeName(), ++timestamp);
+    impl.handleEvent(inProgressEvent1);
+    Assert.assertEquals(startTime, impl.getLastOpStartTime());
+    Assert.assertEquals(timestamp, impl.getLastOpLastUpdateTime());
+    Assert.assertEquals(-1, impl.getLastOpEndTime());
+    Assert.assertEquals(inProgressState,
+        impl.getState().getLiveState());
+
+    ServiceComponentNodeOpInProgressEvent inProgressEvent2 = new
+        ServiceComponentNodeOpInProgressEvent(impl.getServiceComponentName(),
+            impl.getNodeName(), ++timestamp);
+    impl.handleEvent(inProgressEvent2);
+    Assert.assertEquals(startTime, impl.getLastOpStartTime());
+    Assert.assertEquals(timestamp, impl.getLastOpLastUpdateTime());
+    Assert.assertEquals(-1, impl.getLastOpEndTime());
+    Assert.assertEquals(inProgressState,
+        impl.getState().getLiveState());
+
+
+    ServiceComponentNodeOpFailedEvent failEvent = new
+        ServiceComponentNodeOpFailedEvent(impl.getServiceComponentName(),
+            impl.getNodeName(), ++timestamp);
+    long endTime = timestamp;
+    impl.handleEvent(failEvent);
+    Assert.assertEquals(startTime, impl.getLastOpStartTime());
+    Assert.assertEquals(timestamp, impl.getLastOpLastUpdateTime());
+    Assert.assertEquals(endTime, impl.getLastOpEndTime());
+    Assert.assertEquals(failedState,
+        impl.getState().getLiveState());
+
+    ServiceComponentNodeOpRestartedEvent restartEvent = new
+        ServiceComponentNodeOpRestartedEvent(impl.getServiceComponentName(),
+            impl.getNodeName(), ++timestamp);
+    startTime = timestamp;
+    impl.handleEvent(restartEvent);
+    Assert.assertEquals(startTime, impl.getLastOpStartTime());
+    Assert.assertEquals(-1, impl.getLastOpLastUpdateTime());
+    Assert.assertEquals(-1, impl.getLastOpEndTime());
+    Assert.assertEquals(inProgressState,
+        impl.getState().getLiveState());
+
+    ServiceComponentNodeOpInProgressEvent inProgressEvent3 = new
+        ServiceComponentNodeOpInProgressEvent(impl.getServiceComponentName(),
+            impl.getNodeName(), ++timestamp);
+    impl.handleEvent(inProgressEvent3);
+    Assert.assertEquals(startTime, impl.getLastOpStartTime());
+    Assert.assertEquals(timestamp, impl.getLastOpLastUpdateTime());
+    Assert.assertEquals(-1, impl.getLastOpEndTime());
+    Assert.assertEquals(inProgressState,
+        impl.getState().getLiveState());
+
+    ServiceComponentNodeOpSucceededEvent succeededEvent = new
+        ServiceComponentNodeOpSucceededEvent(impl.getServiceComponentName(),
+            impl.getNodeName(), ++timestamp);
+    endTime = timestamp;
+    impl.handleEvent(succeededEvent);
+    Assert.assertEquals(startTime, impl.getLastOpStartTime());
+    Assert.assertEquals(timestamp, impl.getLastOpLastUpdateTime());
+    Assert.assertEquals(endTime, impl.getLastOpEndTime());
+    Assert.assertEquals(completedState,
+        impl.getState().getLiveState());
+
+  }
+
+  @Test
+  public void testClientStateFlow() throws Exception {
+    ServiceComponentNodeImpl impl = createNewServiceComponentNode("svcComp",
+        "h1", true);
+
+    runStateChanges(impl, ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL,
+        ServiceComponentNodeLiveState.INIT,
+        ServiceComponentNodeLiveState.INSTALLING,
+        ServiceComponentNodeLiveState.INSTALL_FAILED,
+        ServiceComponentNodeLiveState.INSTALLED);
+
+    boolean exceptionThrown = false;
+    try {
+      runStateChanges(impl, ServiceComponentNodeEventType.NODE_SVCCOMP_START,
+        ServiceComponentNodeLiveState.INSTALLED,
+        ServiceComponentNodeLiveState.STARTING,
+        ServiceComponentNodeLiveState.START_FAILED,
+        ServiceComponentNodeLiveState.STARTED);
+    }
+    catch (Exception e) {
+      exceptionThrown = true;
+    }
+    Assert.assertTrue("Exception not thrown on invalid event", exceptionThrown);
+
+    runStateChanges(impl, ServiceComponentNodeEventType.NODE_SVCCOMP_UNINSTALL,
+        ServiceComponentNodeLiveState.INSTALLED,
+        ServiceComponentNodeLiveState.UNINSTALLING,
+        ServiceComponentNodeLiveState.UNINSTALL_FAILED,
+        ServiceComponentNodeLiveState.UNINSTALLED);
+
+    runStateChanges(impl, ServiceComponentNodeEventType.NODE_SVCCOMP_WIPEOUT,
+        ServiceComponentNodeLiveState.UNINSTALLED,
+        ServiceComponentNodeLiveState.WIPING_OUT,
+        ServiceComponentNodeLiveState.WIPEOUT_FAILED,
+        ServiceComponentNodeLiveState.INIT);
+
+  }
+
+  @Test
+  public void testDaemonStateFlow() throws Exception {
+    ServiceComponentNodeImpl impl = createNewServiceComponentNode("svcComp",
+        "h1", false);
+
+    runStateChanges(impl, ServiceComponentNodeEventType.NODE_SVCCOMP_INSTALL,
+        ServiceComponentNodeLiveState.INIT,
+        ServiceComponentNodeLiveState.INSTALLING,
+        ServiceComponentNodeLiveState.INSTALL_FAILED,
+        ServiceComponentNodeLiveState.INSTALLED);
+
+    runStateChanges(impl, ServiceComponentNodeEventType.NODE_SVCCOMP_START,
+      ServiceComponentNodeLiveState.INSTALLED,
+      ServiceComponentNodeLiveState.STARTING,
+      ServiceComponentNodeLiveState.START_FAILED,
+      ServiceComponentNodeLiveState.STARTED);
+
+    runStateChanges(impl, ServiceComponentNodeEventType.NODE_SVCCOMP_STOP,
+      ServiceComponentNodeLiveState.STARTED,
+      ServiceComponentNodeLiveState.STOPPING,
+      ServiceComponentNodeLiveState.STOP_FAILED,
+      ServiceComponentNodeLiveState.INSTALLED);
+
+    runStateChanges(impl, ServiceComponentNodeEventType.NODE_SVCCOMP_UNINSTALL,
+        ServiceComponentNodeLiveState.INSTALLED,
+        ServiceComponentNodeLiveState.UNINSTALLING,
+        ServiceComponentNodeLiveState.UNINSTALL_FAILED,
+        ServiceComponentNodeLiveState.UNINSTALLED);
+
+    runStateChanges(impl, ServiceComponentNodeEventType.NODE_SVCCOMP_WIPEOUT,
+        ServiceComponentNodeLiveState.UNINSTALLED,
+        ServiceComponentNodeLiveState.WIPING_OUT,
+        ServiceComponentNodeLiveState.WIPEOUT_FAILED,
+        ServiceComponentNodeLiveState.INIT);
+
+  }
+
+
+}

+ 1 - 1
ambari-server/src/test/resources/log4j.properties

@@ -12,7 +12,7 @@
 
 
 # log4j configuration used during build and unit tests
 # log4j configuration used during build and unit tests
 
 
-log4j.rootLogger=info,stdout
+log4j.rootLogger=DEBUG,stdout
 log4j.threshhold=ALL
 log4j.threshhold=ALL
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout