You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by hi...@apache.org on 2012/09/15 02:28:44 UTC
svn commit: r1384984 [1/2] - in /incubator/ambari/branches/AMBARI-666: ./
ambari-server/src/main/java/org/apache/ambari/server/state/live/
ambari-server/src/main/java/org/apache/ambari/server/state/live/host/
ambari-server/src/main/java/org/apache/amba...
Author: hitesh
Date: Sat Sep 15 00:28:42 2012
New Revision: 1384984
URL: http://svn.apache.org/viewvc?rev=1384984&view=rev
Log:
AMBARI-738. s/Node/Host/g. (Contributed by hitesh)
Added:
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHost.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEventType.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostImpl.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostInstallEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostLiveState.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpFailedEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpInProgressEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpRestartedEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpSucceededEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStartEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostState.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStopEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostUninstallEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostWipeoutEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/Host.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEventType.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthStatus.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthyHeartbeatEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHeartbeatTimedOutEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostImpl.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostRegistrationRequestEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostState.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostUnhealthyHeartbeatEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostVerifiedEvent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/TestServiceComponentHostImpl.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/host/
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/host/TestHostImpl.java (with props)
Removed:
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNode.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeEventType.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeInstallEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeLiveState.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpFailedEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpInProgressEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpRestartedEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeOpSucceededEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeStartEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeState.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeStopEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeUninstallEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentNodeWipeoutEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/Node.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/NodeEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/NodeEventType.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/NodeHealthStatus.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/NodeHealthyHeartbeatEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/NodeHeartbeatTimedOutEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/NodeImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/NodeRegistrationRequestEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/NodeState.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/NodeUnhealthyHeartbeatEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/node/NodeVerifiedEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/TestServiceComponentNodeImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/node/TestNodeImpl.java
Modified:
incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/job/Job.java
Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1384984&r1=1384983&r2=1384984&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Sat Sep 15 00:28:42 2012
@@ -12,6 +12,8 @@ AMBARI-666 branch (unreleased changes)
NEW FEATURES
+ AMBARI-738. s/Node/Host/g. (hitesh)
+
AMBARI-737. ServiceComponentNode FSM implementation. (hitesh)
AMBARI-734. Initial work for adding DataNode/TaskTracker/RegionServer
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java?rev=1384984&r1=1384983&r2=1384984&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/Cluster.java Sat Sep 15 00:28:42 2012
@@ -19,63 +19,63 @@
package org.apache.ambari.server.state.live;
import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
-import org.apache.ambari.server.state.live.node.NodeEvent;
-import org.apache.ambari.server.state.live.node.NodeState;
+import org.apache.ambari.server.state.live.host.HostEvent;
+import org.apache.ambari.server.state.live.host.HostState;
public interface Cluster {
/**
- * Get the State for a given Node
- * @param nodeName Node hostname for which to retrieve state
+ * Get the State for a given Host
+ * @param hostName Host hostname for which to retrieve state
* @return
*/
- public NodeState getNodeState(String nodeName);
+ public HostState getHostState(String hostName);
/**
- * Set the State for a given Node
- * @param nodeName Node's hostname for which state is to be set
- * @param state NodeState to set
+ * Set the State for a given Host
+ * @param hostName Host's hostname for which state is to be set
+ * @param state HostState to set
*/
- public void setNodeState(String nodeName, NodeState state);
+ public void setHostState(String hostName, HostState state);
/**
- * Send event to the given Node
- * @param nodeName Node's hostname
+ * Send event to the given Host
+ * @param hostName Host's hostname
* @param event Event to be handled
*/
- public void handleNodeEvent(String nodeName, NodeEvent event)
+ public void handleHostEvent(String hostName, HostEvent event)
throws InvalidStateTransitonException;
/**
- * Get the State for a given ServiceComponentNode
+ * Get the State for a given ServiceComponentHost
* @param service Service name
* @param serviceComponent ServiceComponent name
- * @param nodeName Node name
- * @return ServiceComponentNodeState
+ * @param hostName Host name
+ * @return ServiceComponentHostState
*/
- public ServiceComponentNodeState getServiceComponentNodeState(String service,
- String serviceComponent, String nodeName);
+ public ServiceComponentHostState getServiceComponentHostState(String service,
+ String serviceComponent, String hostName);
/**
- * Set the State for a given ServiceComponentNode
+ * Set the State for a given ServiceComponentHost
* @param service Service name
* @param serviceComponent ServiceComponent name
- * @param nodeName Node name
+ * @param hostName Host name
* @param state State to set
*/
- public void setServiceComponentNodeState(String service,
- String serviceComponent, String nodeName,
- ServiceComponentNodeState state);
+ public void setServiceComponentHostState(String service,
+ String serviceComponent, String hostName,
+ ServiceComponentHostState state);
/**
- * Send an Event to a given ServiceComponentNode
+ * Send an Event to a given ServiceComponentHost
* @param service Service name
* @param serviceComponent ServiceComponent name
- * @param nodeName Node name
+ * @param hostName Host name
* @param event Event to be handled
*/
- public void handleServiceComponentNodeEvent(String service,
- String serviceComponent, String nodeName,
- ServiceComponentNodeEvent event) throws InvalidStateTransitonException;
+ public void handleServiceComponentHostEvent(String service,
+ String serviceComponent, String hostName,
+ ServiceComponentHostEvent event) throws InvalidStateTransitonException;
}
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHost.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHost.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHost.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHost.java Sat Sep 15 00:28:42 2012
@@ -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.state.live;
+
+import java.util.List;
+
+import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
+import org.apache.ambari.server.state.live.job.Job;
+
+
+public interface ServiceComponentHost {
+
+ /**
+ * Get the ServiceComponent this object maps to
+ * @return Name of the ServiceComponent
+ */
+ public String getServiceComponentName();
+
+ /**
+ * Get the Host this object maps to
+ * @return Host's hostname
+ */
+ public String getHostName();
+
+ /**
+ * Get the list of Jobs that are currently being tracked at the
+ * ServiceComponentHost level
+ * @return List of Jobs
+ */
+ public List<Job> getJobs();
+
+
+ /**
+ * Get ServiceComponent-Host State
+ * @return ServiceComponentHostState
+ */
+ public ServiceComponentHostState getState();
+
+ /**
+ * Set the State for this ServiceComponent-Host
+ * @param state ServiceComponentHostState to set to
+ */
+ public void setState(ServiceComponentHostState state);
+
+ /**
+ * Send a ServiceComponentHostState event to the StateMachine
+ * @param event Event to handle
+ * @throws InvalidStateTransitonException
+ */
+ public void handleEvent(ServiceComponentHostEvent event)
+ throws InvalidStateTransitonException;
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHost.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEvent.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,73 @@
+/**
+ * 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.apache.ambari.server.state.fsm.event.AbstractEvent;
+
+/**
+ * Base class for all events that affect the ServiceComponentHost FSM
+ */
+public class ServiceComponentHostEvent
+ extends AbstractEvent<ServiceComponentHostEventType> {
+
+ /**
+ * ServiceComponent that this event relates to
+ */
+ private final String serviceComponentName;
+
+ /**
+ * Hostname of the Host that this event relates to
+ */
+ private final String hostName;
+
+ /**
+ * Time when the event was triggered
+ */
+ private final long opTimestamp;
+
+ public ServiceComponentHostEvent(ServiceComponentHostEventType type,
+ String serviceComponentName, String hostName, long opTimestamp) {
+ super(type);
+ this.serviceComponentName = serviceComponentName;
+ this.hostName = hostName;
+ this.opTimestamp = opTimestamp;
+ }
+
+ /**
+ * @return the serviceComponentName
+ */
+ public String getServiceComponentName() {
+ return serviceComponentName;
+ }
+
+ /**
+ * @return the hostName
+ */
+ public String getHostName() {
+ return hostName;
+ }
+
+ /**
+ * @return the opTimestamp
+ */
+ public long getOpTimestamp() {
+ return opTimestamp;
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEventType.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEventType.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEventType.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEventType.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,58 @@
+/**
+ * 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 enum ServiceComponentHostEventType {
+ /**
+ * Operation in progress
+ */
+ HOST_SVCCOMP_OP_IN_PROGRESS,
+ /**
+ * Operation succeeded
+ */
+ HOST_SVCCOMP_OP_SUCCEEDED,
+ /**
+ * Operation failed.
+ */
+ HOST_SVCCOMP_OP_FAILED,
+ /**
+ * Re-starting a failed operation.
+ */
+ HOST_SVCCOMP_OP_RESTART,
+ /**
+ * Triggering an install.
+ */
+ HOST_SVCCOMP_INSTALL,
+ /**
+ * Triggering a start.
+ */
+ HOST_SVCCOMP_START,
+ /**
+ * Triggering a stop.
+ */
+ HOST_SVCCOMP_STOP,
+ /**
+ * Triggering an uninstall.
+ */
+ HOST_SVCCOMP_UNINSTALL,
+ /**
+ * Triggering a wipe-out ( restore to clean state ).
+ */
+ HOST_SVCCOMP_WIPEOUT
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostEventType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostImpl.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostImpl.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostImpl.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,536 @@
+/**
+ * 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 java.util.List;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+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.StateMachineFactory;
+import org.apache.ambari.server.state.live.job.Job;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class ServiceComponentHostImpl implements ServiceComponentHost {
+
+ private static final Log LOG =
+ LogFactory.getLog(ServiceComponentHostImpl.class);
+
+ private final Lock readLock;
+ private final Lock writeLock;
+
+ private ServiceComponentHostState state;
+
+ private final String serviceComponentName;
+ private final String hostName;
+
+ private long lastOpStartTime;
+ private long lastOpEndTime;
+ private long lastOpLastUpdateTime;
+
+ private static final StateMachineFactory
+ <ServiceComponentHostImpl, ServiceComponentHostLiveState,
+ ServiceComponentHostEventType, ServiceComponentHostEvent>
+ daemonStateMachineFactory
+ = new StateMachineFactory<ServiceComponentHostImpl,
+ ServiceComponentHostLiveState, ServiceComponentHostEventType,
+ ServiceComponentHostEvent>
+ (ServiceComponentHostLiveState.INIT)
+
+ // define the state machine of a HostServiceComponent for runnable
+ // components
+
+ .addTransition(ServiceComponentHostLiveState.INIT,
+ ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+ new ServiceComponentHostOpStartedTransition())
+ .addTransition(ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostLiveState.INSTALLED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+ new ServiceComponentHostOpCompletedTransition())
+ .addTransition(ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+ new ServiceComponentHostOpInProgressTransition())
+ .addTransition(ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostLiveState.INSTALL_FAILED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+ new ServiceComponentHostOpCompletedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.INSTALL_FAILED,
+ ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.INSTALLED,
+ ServiceComponentHostLiveState.STARTING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_START,
+ new ServiceComponentHostOpStartedTransition())
+ .addTransition(ServiceComponentHostLiveState.INSTALLED,
+ ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
+ new ServiceComponentHostOpStartedTransition())
+ .addTransition(ServiceComponentHostLiveState.INSTALLED,
+ ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.STARTING,
+ ServiceComponentHostLiveState.STARTING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+ new ServiceComponentHostOpInProgressTransition())
+ .addTransition(ServiceComponentHostLiveState.STARTING,
+ ServiceComponentHostLiveState.STARTED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+ new ServiceComponentHostOpCompletedTransition())
+ .addTransition(ServiceComponentHostLiveState.STARTING,
+ ServiceComponentHostLiveState.START_FAILED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+ new ServiceComponentHostOpCompletedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.START_FAILED,
+ ServiceComponentHostLiveState.STARTING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.STARTED,
+ ServiceComponentHostLiveState.STOPPING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_STOP,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.STOPPING,
+ ServiceComponentHostLiveState.STOPPING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+ new ServiceComponentHostOpInProgressTransition())
+ .addTransition(ServiceComponentHostLiveState.STOPPING,
+ ServiceComponentHostLiveState.INSTALLED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+ new ServiceComponentHostOpCompletedTransition())
+ .addTransition(ServiceComponentHostLiveState.STOPPING,
+ ServiceComponentHostLiveState.STOP_FAILED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+ new ServiceComponentHostOpCompletedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.STOP_FAILED,
+ ServiceComponentHostLiveState.STOPPING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+ new ServiceComponentHostOpInProgressTransition())
+ .addTransition(ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostLiveState.UNINSTALLED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+ new ServiceComponentHostOpCompletedTransition())
+ .addTransition(ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostLiveState.UNINSTALL_FAILED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+ new ServiceComponentHostOpCompletedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.UNINSTALL_FAILED,
+ ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.UNINSTALLED,
+ ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.UNINSTALLED,
+ ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+ new ServiceComponentHostOpInProgressTransition())
+ .addTransition(ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostLiveState.INIT,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+ new ServiceComponentHostOpCompletedTransition())
+ .addTransition(ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostLiveState.WIPEOUT_FAILED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+ new ServiceComponentHostOpCompletedTransition())
+ .addTransition(ServiceComponentHostLiveState.WIPEOUT_FAILED,
+ ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+ new ServiceComponentHostOpStartedTransition())
+
+ .installTopology();
+
+ private static final StateMachineFactory
+ <ServiceComponentHostImpl, ServiceComponentHostLiveState,
+ ServiceComponentHostEventType, ServiceComponentHostEvent>
+ clientStateMachineFactory
+ = new StateMachineFactory<ServiceComponentHostImpl,
+ ServiceComponentHostLiveState, ServiceComponentHostEventType,
+ ServiceComponentHostEvent>
+ (ServiceComponentHostLiveState.INIT)
+
+ // define the state machine of a HostServiceComponent for client only
+ // components
+
+ .addTransition(ServiceComponentHostLiveState.INIT,
+ ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostLiveState.INSTALLED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+ new ServiceComponentHostOpCompletedTransition())
+ .addTransition(ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+ new ServiceComponentHostOpInProgressTransition())
+ .addTransition(ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostLiveState.INSTALL_FAILED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+ new ServiceComponentHostOpCompletedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.INSTALL_FAILED,
+ ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.INSTALLED,
+ ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
+ new ServiceComponentHostOpStartedTransition())
+ .addTransition(ServiceComponentHostLiveState.INSTALLED,
+ ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+ new ServiceComponentHostOpInProgressTransition())
+ .addTransition(ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostLiveState.UNINSTALLED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+ new ServiceComponentHostOpCompletedTransition())
+ .addTransition(ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostLiveState.UNINSTALL_FAILED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+ new ServiceComponentHostOpCompletedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.UNINSTALL_FAILED,
+ ServiceComponentHostLiveState.UNINSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.UNINSTALLED,
+ ServiceComponentHostLiveState.INSTALLING,
+ ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.UNINSTALLED,
+ ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
+ new ServiceComponentHostOpStartedTransition())
+
+ .addTransition(ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+ new ServiceComponentHostOpInProgressTransition())
+ .addTransition(ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostLiveState.INIT,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+ new ServiceComponentHostOpCompletedTransition())
+ .addTransition(ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostLiveState.WIPEOUT_FAILED,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+ new ServiceComponentHostOpCompletedTransition())
+ .addTransition(ServiceComponentHostLiveState.WIPEOUT_FAILED,
+ ServiceComponentHostLiveState.WIPING_OUT,
+ ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+ new ServiceComponentHostOpStartedTransition())
+
+ .installTopology();
+
+
+ private final StateMachine<ServiceComponentHostLiveState,
+ ServiceComponentHostEventType, ServiceComponentHostEvent> stateMachine;
+
+ static class ServiceComponentHostOpCompletedTransition
+ implements SingleArcTransition<ServiceComponentHostImpl,
+ ServiceComponentHostEvent> {
+
+ @Override
+ public void transition(ServiceComponentHostImpl impl,
+ ServiceComponentHostEvent event) {
+ // TODO Audit logs
+ impl.updateLastOpInfo(event.getType(), event.getOpTimestamp());
+ }
+
+ }
+
+ static class ServiceComponentHostOpStartedTransition
+ implements SingleArcTransition<ServiceComponentHostImpl,
+ ServiceComponentHostEvent> {
+
+ @Override
+ public void transition(ServiceComponentHostImpl impl,
+ ServiceComponentHostEvent event) {
+ // TODO Audit logs
+ impl.updateLastOpInfo(event.getType(), event.getOpTimestamp());
+ }
+ }
+
+ static class ServiceComponentHostOpInProgressTransition
+ implements SingleArcTransition<ServiceComponentHostImpl,
+ ServiceComponentHostEvent> {
+
+ @Override
+ public void transition(ServiceComponentHostImpl impl,
+ ServiceComponentHostEvent 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(ServiceComponentHostEventType eventType,
+ long time) {
+ try {
+ writeLock.lock();
+ switch (eventType) {
+ case HOST_SVCCOMP_INSTALL:
+ case HOST_SVCCOMP_START:
+ case HOST_SVCCOMP_STOP:
+ case HOST_SVCCOMP_UNINSTALL:
+ case HOST_SVCCOMP_WIPEOUT:
+ case HOST_SVCCOMP_OP_RESTART:
+ resetLastOpInfo();
+ setLastOpStartTime(time);
+ break;
+ case HOST_SVCCOMP_OP_FAILED:
+ case HOST_SVCCOMP_OP_SUCCEEDED:
+ setLastOpLastUpdateTime(time);
+ setLastOpEndTime(time);
+ break;
+ case HOST_SVCCOMP_OP_IN_PROGRESS:
+ setLastOpLastUpdateTime(time);
+ break;
+ }
+ }
+ finally {
+ writeLock.unlock();
+ }
+ }
+
+ public ServiceComponentHostImpl(String serviceComponentName,
+ String hostName, boolean isClient) {
+ super();
+ if (isClient) {
+ this.stateMachine = clientStateMachineFactory.make(this);
+ } else {
+ this.stateMachine = daemonStateMachineFactory.make(this);
+ }
+ ReadWriteLock rwLock = new ReentrantReadWriteLock();
+ this.readLock = rwLock.readLock();
+ this.writeLock = rwLock.writeLock();
+ this.serviceComponentName = serviceComponentName;
+ this.hostName = hostName;
+ this.state = new ServiceComponentHostState();
+ this.resetLastOpInfo();
+ }
+
+ @Override
+ public ServiceComponentHostState getState() {
+ try {
+ readLock.lock();
+ return state;
+ }
+ finally {
+ readLock.unlock();
+ }
+ }
+
+ @Override
+ public void setState(ServiceComponentHostState state) {
+ try {
+ writeLock.lock();
+ this.state = state;
+ stateMachine.setCurrentState(state.getLiveState());
+ }
+ finally {
+ writeLock.unlock();
+ }
+ }
+
+ @Override
+ public void handleEvent(ServiceComponentHostEvent event)
+ throws InvalidStateTransitonException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Handling ServiceComponentHostEvent event,"
+ + " eventType=" + event.getType().name()
+ + ", event=" + event.toString());
+ }
+ ServiceComponentHostState oldState = getState();
+ try {
+ writeLock.lock();
+ try {
+ stateMachine.doTransition(event.getType(), event);
+ state.setState(stateMachine.getCurrentState());
+ // TODO Audit logs
+ } catch (InvalidStateTransitonException e) {
+ LOG.error("Can't handle ServiceComponentHostEvent event at"
+ + " current state"
+ + ", serviceComponentName=" + this.getServiceComponentName()
+ + ", hostName=" + this.getHostName()
+ + ", currentState=" + oldState
+ + ", eventType=" + event.getType()
+ + ", event=" + event);
+ throw e;
+ }
+ }
+ finally {
+ writeLock.unlock();
+ }
+ if (oldState.getLiveState() != getState().getLiveState()) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("ServiceComponentHost transitioned to a new state"
+ + ", serviceComponentName=" + this.getServiceComponentName()
+ + ", hostName=" + this.getHostName()
+ + ", oldState=" + oldState
+ + ", currentState=" + getState()
+ + ", eventType=" + event.getType().name()
+ + ", event=" + event);
+ }
+ }
+ }
+
+ @Override
+ public List<Job> getJobs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getServiceComponentName() {
+ return serviceComponentName;
+ }
+
+ @Override
+ public String getHostName() {
+ 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();
+ }
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostInstallEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostInstallEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostInstallEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostInstallEvent.java Sat Sep 15 00:28:42 2012
@@ -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 ServiceComponentHostInstallEvent extends
+ ServiceComponentHostEvent {
+
+
+ public ServiceComponentHostInstallEvent(String serviceComponentName,
+ String hostName, long opTimestamp) {
+ super(ServiceComponentHostEventType.HOST_SVCCOMP_INSTALL,
+ serviceComponentName, hostName, opTimestamp);
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostInstallEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostLiveState.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostLiveState.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostLiveState.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostLiveState.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,78 @@
+/**
+ * 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 enum ServiceComponentHostLiveState {
+ /**
+ * Initial/Clean state
+ */
+ INIT,
+ /**
+ * In the process of installing.
+ */
+ INSTALLING,
+ /**
+ * Install failed
+ */
+ INSTALL_FAILED,
+ /**
+ * State when install completed successfully
+ */
+ INSTALLED,
+ /**
+ * In the process of starting.
+ */
+ STARTING,
+ /**
+ * Start failed.
+ */
+ START_FAILED,
+ /**
+ * State when start completed successfully.
+ */
+ STARTED,
+ /**
+ * In the process of stopping.
+ */
+ STOPPING,
+ /**
+ * Stop failed
+ */
+ STOP_FAILED,
+ /**
+ * In the process of uninstalling.
+ */
+ UNINSTALLING,
+ /**
+ * Uninstall failed.
+ */
+ UNINSTALL_FAILED,
+ /**
+ * State when uninstall completed successfully.
+ */
+ UNINSTALLED,
+ /**
+ * In the process of wiping out the install
+ */
+ WIPING_OUT,
+ /**
+ * State when wipeout fails
+ */
+ WIPEOUT_FAILED
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostLiveState.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpFailedEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpFailedEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpFailedEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpFailedEvent.java Sat Sep 15 00:28:42 2012
@@ -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 ServiceComponentHostOpFailedEvent extends
+ ServiceComponentHostEvent {
+
+ public ServiceComponentHostOpFailedEvent(String serviceComponentName,
+ String hostName, long opTimestamp) {
+ super(ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
+ serviceComponentName, hostName, opTimestamp);
+ // TODO Auto-generated constructor stub
+ }
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpFailedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpInProgressEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpInProgressEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpInProgressEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpInProgressEvent.java Sat Sep 15 00:28:42 2012
@@ -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 ServiceComponentHostOpInProgressEvent extends
+ ServiceComponentHostEvent {
+
+ public ServiceComponentHostOpInProgressEvent(String serviceComponentName,
+ String hostName, long opTimestamp) {
+ super(ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+ serviceComponentName, hostName, opTimestamp);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpInProgressEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpRestartedEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpRestartedEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpRestartedEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpRestartedEvent.java Sat Sep 15 00:28:42 2012
@@ -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 ServiceComponentHostOpRestartedEvent extends
+ ServiceComponentHostEvent {
+
+ public ServiceComponentHostOpRestartedEvent(String serviceComponentName,
+ String hostName, long opTimestamp) {
+ super(ServiceComponentHostEventType.HOST_SVCCOMP_OP_RESTART,
+ serviceComponentName, hostName, opTimestamp);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpRestartedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpSucceededEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpSucceededEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpSucceededEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpSucceededEvent.java Sat Sep 15 00:28:42 2012
@@ -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 ServiceComponentHostOpSucceededEvent extends
+ ServiceComponentHostEvent {
+
+ public ServiceComponentHostOpSucceededEvent(String serviceComponentName,
+ String hostName, long opTimestamp) {
+ super(ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,
+ serviceComponentName, hostName, opTimestamp);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostOpSucceededEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStartEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStartEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStartEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStartEvent.java Sat Sep 15 00:28:42 2012
@@ -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 ServiceComponentHostStartEvent extends
+ ServiceComponentHostEvent {
+
+ public ServiceComponentHostStartEvent(String serviceComponentName,
+ String hostName, long opTimestamp) {
+ super(ServiceComponentHostEventType.HOST_SVCCOMP_START,
+ serviceComponentName, hostName, opTimestamp);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStartEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostState.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostState.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostState.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostState.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,101 @@
+/**
+ * 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.apache.ambari.server.state.ConfigVersion;
+import org.apache.ambari.server.state.StackVersion;
+
+public class ServiceComponentHostState {
+
+ private ConfigVersion configVersion;
+ private StackVersion stackVersion;
+ private ServiceComponentHostLiveState state;
+
+ public ServiceComponentHostState(ConfigVersion configVersion,
+ StackVersion stackVersion, ServiceComponentHostLiveState state) {
+ super();
+ this.configVersion = configVersion;
+ this.stackVersion = stackVersion;
+ this.state = state;
+ }
+
+ public ServiceComponentHostState() {
+ super();
+ this.configVersion = null;
+ this.stackVersion = null;
+ this.state = ServiceComponentHostLiveState.INIT;
+ }
+
+
+ /**
+ * @return the configVersion
+ */
+ public ConfigVersion getConfigVersion() {
+ return configVersion;
+ }
+ /**
+ * @param configVersion the configVersion to set
+ */
+ public void setConfigVersion(ConfigVersion configVersion) {
+ this.configVersion = configVersion;
+ }
+ /**
+ * @return the stackVersion
+ */
+ public StackVersion getStackVersion() {
+ return stackVersion;
+ }
+ /**
+ * @param stackVersion the stackVersion to set
+ */
+ public void setStackVersion(StackVersion stackVersion) {
+ this.stackVersion = stackVersion;
+ }
+ /**
+ * @return the state
+ */
+ public ServiceComponentHostLiveState getLiveState() {
+ return state;
+ }
+ /**
+ * @param state the state to set
+ */
+ public void setState(ServiceComponentHostLiveState 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;
+ }
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostState.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStopEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStopEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStopEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStopEvent.java Sat Sep 15 00:28:42 2012
@@ -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 ServiceComponentHostStopEvent extends
+ ServiceComponentHostEvent {
+
+ public ServiceComponentHostStopEvent(String serviceComponentName,
+ String hostName, long opTimestamp) {
+ super(ServiceComponentHostEventType.HOST_SVCCOMP_STOP,
+ serviceComponentName, hostName, opTimestamp);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostStopEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostUninstallEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostUninstallEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostUninstallEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostUninstallEvent.java Sat Sep 15 00:28:42 2012
@@ -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 ServiceComponentHostUninstallEvent extends
+ ServiceComponentHostEvent {
+
+ public ServiceComponentHostUninstallEvent(String serviceComponentName,
+ String hostName, long opTimestamp) {
+ super(ServiceComponentHostEventType.HOST_SVCCOMP_UNINSTALL,
+ serviceComponentName, hostName, opTimestamp);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostUninstallEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostWipeoutEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostWipeoutEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostWipeoutEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostWipeoutEvent.java Sat Sep 15 00:28:42 2012
@@ -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 ServiceComponentHostWipeoutEvent extends
+ ServiceComponentHostEvent {
+
+ public ServiceComponentHostWipeoutEvent(String serviceComponentName,
+ String hostName, long opTimestamp) {
+ super(ServiceComponentHostEventType.HOST_SVCCOMP_WIPEOUT,
+ serviceComponentName, hostName, opTimestamp);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ServiceComponentHostWipeoutEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/Host.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/Host.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/Host.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/Host.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,239 @@
+/**
+ * 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.host;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.server.agent.DiskInfo;
+import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
+import org.apache.ambari.server.state.live.AgentVersion;
+import org.apache.ambari.server.state.live.job.Job;
+
+public interface Host {
+
+ /**
+ * @return the hostName
+ */
+ public String getHostName();
+
+ /**
+ * @param hostName the hostName to set
+ */
+ public void setHostName(String hostName);
+
+ /**
+ * IPv4 assigned to the Host
+ * @return the ip or null if no IPv4 interface
+ */
+ public String getIPv4();
+
+ /**
+ * @param ip the ip to set
+ */
+ public void setIPv4(String ip);
+
+ /**
+ * IPv6 assigned to the Host
+ * @return the ip or null if no IPv6 interface
+ */
+ public String getIPv6();
+
+ /**
+ * @param ip the ip to set
+ */
+ public void setIPv6(String ip);
+
+ /**
+ * @return the cpuCount
+ */
+ public int getCpuCount();
+
+ /**
+ * @param cpuCount the cpuCount to set
+ */
+ public void setCpuCount(int cpuCount);
+
+ /**
+ * Get the Amount of physical memory for the Host.
+ * @return the totalMemBytes
+ */
+ public long getTotalMemBytes();
+
+ /**
+ * Set the Amount of physical memory for the Host.
+ * @param totalMemBytes the totalMemBytes to set
+ */
+ public void setTotalMemBytes(long totalMemBytes);
+
+ /**
+ * Get the Amount of available memory for the Host.
+ * In most cases, available should be same as total unless
+ * the agent on the host is configured to not use all
+ * available memory
+ * @return the availableMemBytes
+ */
+ public long getAvailableMemBytes();
+
+ /**
+ * Set the Amount of available memory for the Host.
+ * @param availableMemBytes the availableMemBytes to set
+ */
+ public void setAvailableMemBytes(long availableMemBytes);
+
+ /**
+ * Get the OS Architecture.
+ * i386, x86_64, etc.
+ * @return the osArch
+ */
+ public String getOsArch();
+
+ /**
+ * @param osArch the osArch to set
+ */
+ public void setOsArch(String osArch);
+
+ /**
+ * Get the General OS information.
+ * uname -a, /etc/*-release dump
+ * @return the osInfo
+ */
+ public String getOsInfo();
+
+ /**
+ * @param osInfo the osInfo to set
+ */
+ public void setOsInfo(String osInfo);
+
+ /**
+ * Get the OS Type: RHEL5/RHEL6/CentOS5/...
+ * Defined and match-able OS type
+ * @return the osType
+ */
+ public String getOsType();
+
+ /**
+ * @param osType the osType to set
+ */
+ public void setOsType(String osType);
+
+ /**
+ * Get information on disks available on the host.
+ * @return the disksInfo
+ */
+ public List<DiskInfo> getDisksInfo();
+
+ /**
+ * @param disksInfo the disksInfo to set
+ */
+ public void setDisksInfo(List<DiskInfo> disksInfo);
+
+ /**
+ * @return the healthStatus
+ */
+ public HostHealthStatus getHealthStatus();
+
+ /**
+ * @param healthStatus the healthStatus to set
+ */
+ public void setHealthStatus(HostHealthStatus healthStatus);
+
+ /**
+ * Get additional host attributes
+ * For example, public/hostname/IP for AWS
+ * @return the hostAttributes
+ */
+ public Map<String, String> getHostAttributes();
+
+ /**
+ * @param hostAttributes the hostAttributes to set
+ */
+ public void setHostAttributes(Map<String, String> hostAttributes);
+ /**
+ * @return the rackInfo
+ */
+ public String getRackInfo();
+
+ /**
+ * @param rackInfo the rackInfo to set
+ */
+ public void setRackInfo(String rackInfo);
+
+ /**
+ * Last time the host registered with the Ambari Server
+ * ( Unix timestamp )
+ * @return the lastRegistrationTime
+ */
+ public long getLastRegistrationTime();
+
+ /**
+ * @param lastRegistrationTime the lastRegistrationTime to set
+ */
+ public void setLastRegistrationTime(long lastRegistrationTime);
+
+ /**
+ * Last time the Ambari Server received a heartbeat from the Host
+ * ( Unix timestamp )
+ * @return the lastHeartbeatTime
+ */
+ public long getLastHeartbeatTime();
+
+ /**
+ * @param lastHeartbeatTime the lastHeartbeatTime to set
+ */
+ public void setLastHeartbeatTime(long lastHeartbeatTime);
+
+ /**
+ * Version of the Ambari Agent running on the host
+ * @return the agentVersion
+ */
+ public AgentVersion getAgentVersion();
+
+ /**
+ * @param agentVersion the agentVersion to set
+ */
+ public void setAgentVersion(AgentVersion agentVersion);
+
+ /**
+ * Get the list of Jobs that are currently being tracked at the
+ * Host level
+ * @return List of Jobs
+ */
+ public List<Job> getJobs();
+
+ /**
+ * Get Current Host State
+ * @return HostState
+ */
+ public HostState getState();
+
+ /**
+ * Set the State of the Host
+ * @param state Host State
+ */
+ public void setState(HostState state);
+
+ /**
+ * Send an event to the Host's StateMachine
+ * @param event HostEvent
+ * @throws InvalidStateTransitonException
+ */
+ public void handleEvent(HostEvent event)
+ throws InvalidStateTransitonException;
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/Host.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEvent.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,38 @@
+/**
+ * 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.host;
+
+import org.apache.ambari.server.state.fsm.event.AbstractEvent;
+
+/**
+ * Base class for all events that affect the Host FSM
+ */
+public class HostEvent extends AbstractEvent<HostEventType> {
+
+ /**
+ * Hostname of the Host
+ */
+ final String hostName;
+
+ public HostEvent(String hostName, HostEventType type) {
+ super(type);
+ this.hostName = hostName;
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEventType.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEventType.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEventType.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEventType.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,42 @@
+/**
+* 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.host;
+
+public enum HostEventType {
+ /**
+ * Event to denote when a registration request is received from a Host
+ */
+ HOST_REGISTRATION_REQUEST,
+ /**
+ * Host authenticated/verified.
+ */
+ HOST_VERIFIED,
+ /**
+ * A healthy heartbeat event received from the Host.
+ */
+ HOST_HEARTBEAT_HEALTHY,
+ /**
+ * No heartbeat received from the Host within the defined expiry interval.
+ */
+ HOST_HEARTBEAT_TIMED_OUT,
+ /**
+ * A non-healthy heartbeat event received from the Host.
+ */
+ HOST_HEARTBEAT_UNHEALTHY
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostEventType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthStatus.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthStatus.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthStatus.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthStatus.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,55 @@
+/**
+ * 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.host;
+
+public class HostHealthStatus {
+
+ private HealthStatus healthStatus;
+
+ private String healthReport;
+
+ public HostHealthStatus(HealthStatus healthStatus, String healthReport) {
+ super();
+ this.healthStatus = healthStatus;
+ this.healthReport = healthReport;
+ }
+
+ public synchronized HealthStatus getHealthStatus() {
+ return healthStatus;
+ }
+
+ public synchronized void setHealthStatus(HealthStatus healthStatus) {
+ this.healthStatus = healthStatus;
+ }
+
+ public synchronized void setHealthReport(String healthReport) {
+ this.healthReport = healthReport;
+ }
+
+ public synchronized String getHealthReport() {
+ return healthReport;
+ }
+
+ public static enum HealthStatus {
+ UNKNOWN,
+ HEALTHY,
+ UNHEALTHY
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthStatus.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthyHeartbeatEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthyHeartbeatEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthyHeartbeatEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthyHeartbeatEvent.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,38 @@
+/**
+ * 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.host;
+
+public class HostHealthyHeartbeatEvent extends HostEvent {
+
+ private final long heartbeatTime;
+
+ public HostHealthyHeartbeatEvent(String hostName, long heartbeatTime) {
+ super(hostName, HostEventType.HOST_HEARTBEAT_HEALTHY);
+ this.heartbeatTime = heartbeatTime;
+ }
+
+ /**
+ * @return the heartbeatTime
+ */
+ public long getHeartbeatTime() {
+ return heartbeatTime;
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHealthyHeartbeatEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHeartbeatTimedOutEvent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHeartbeatTimedOutEvent.java?rev=1384984&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHeartbeatTimedOutEvent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHeartbeatTimedOutEvent.java Sat Sep 15 00:28:42 2012
@@ -0,0 +1,28 @@
+/**
+ * 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.host;
+
+public class HostHeartbeatTimedOutEvent extends HostEvent {
+
+ public HostHeartbeatTimedOutEvent(String hostName) {
+ super(hostName, HostEventType.HOST_HEARTBEAT_TIMED_OUT);
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostHeartbeatTimedOutEvent.java
------------------------------------------------------------------------------
svn:eol-style = native