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/10/03 22:44:20 UTC
svn commit: r1393753 [1/2] - in /incubator/ambari/branches/AMBARI-666: ./
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/
ambari-server/src/main/java/org/apache/ambari/server/agent/
ambari-server/src/main/java/org/apache/ambari/serv...
Author: hitesh
Date: Wed Oct 3 20:44:18 2012
New Revision: 1393753
URL: http://svn.apache.org/viewvc?rev=1393753&view=rev
Log:
AMBARI-797. Prototype for management spi interface continued. (Contributed by hitesh)
Added:
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/AgentVersion.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/DeployState.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/State.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/DeployStateTest.java (with props)
Removed:
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/AgentVersion.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostLiveState.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostState.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/svccomphost/TestServiceComponentHostState.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/actionmanager/ActionScheduler.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/HostResponse.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
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/ClusterImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClustersImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/Host.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/HostRegistrationRequestEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/job/JobEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHost.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostEvent.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/svccomphost/ServiceComponentHostImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/resources/TestResources.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/TestClusterImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/host/TestHostImpl.java
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/state/live/svccomphost/TestServiceComponentHostImpl.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=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Wed Oct 3 20:44:18 2012
@@ -12,6 +12,8 @@ AMBARI-666 branch (unreleased changes)
NEW FEATURES
+ AMBARI-797. Prototype for management spi interface continued. (hitesh)
+
AMBARI-795. Fix failing tests for AgentResource and BootStrap. (mahadev)
AMBARI-793. Make MapReduce, Nagios, and Ganglia optional during cluster
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java Wed Oct 3 20:44:18 2012
@@ -26,8 +26,7 @@ import org.apache.ambari.server.Role;
import org.apache.ambari.server.agent.ActionQueue;
import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
import org.apache.ambari.server.state.live.Clusters;
-import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostEvent;
-import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostEventType;
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostOpFailedEvent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -133,9 +132,9 @@ class ActionScheduler implements Runnabl
if (stage.getAttemptCount(host) >= maxAttempts) {
LOG.warn("Host:"+host+", role:"+hrc.getRole()+", actionId:"+stage.getActionId()+" expired");
// final expired
- ServiceComponentHostEvent timeoutEvent = new ServiceComponentHostEvent(
- ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED, hrc
- .getRole().toString(), host, now);
+ ServiceComponentHostOpFailedEvent timeoutEvent =
+ new ServiceComponentHostOpFailedEvent(hrc.getRole().toString(),
+ host, now);
try {
fsmObject.getCluster(stage.getClusterName())
.handleServiceComponentHostEvent("", hrc.getRole().toString(),
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java Wed Oct 3 20:44:18 2012
@@ -22,8 +22,10 @@ import java.util.List;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.actionmanager.ActionManager;
+import org.apache.ambari.server.state.AgentVersion;
+import org.apache.ambari.server.state.DeployState;
+import org.apache.ambari.server.state.State;
import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
-import org.apache.ambari.server.state.live.AgentVersion;
import org.apache.ambari.server.state.live.Cluster;
import org.apache.ambari.server.state.live.Clusters;
import org.apache.ambari.server.state.live.host.Host;
@@ -33,8 +35,6 @@ import org.apache.ambari.server.state.li
import org.apache.ambari.server.state.live.host.HostStatusUpdatesReceivedEvent;
import org.apache.ambari.server.state.live.host.HostUnhealthyHeartbeatEvent;
import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHost;
-import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostLiveState;
-import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostState;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -98,11 +98,11 @@ public class HeartBeatHandler {
if (status.getClusterName() == cl.getClusterName()) {
ServiceComponentHost scHost = cl.getServiceComponentHost(
status.getServiceName(), status.getComponentName(), hostname);
- ServiceComponentHostState currentState = scHost.getState();
- ServiceComponentHostLiveState liveState = ServiceComponentHostLiveState
- .valueOf(ServiceComponentHostLiveState.class, status.getStatus());
+ State currentState = scHost.getState();
+ DeployState liveState = DeployState
+ .valueOf(DeployState.class, status.getStatus());
// Hack
- scHost.setState(new ServiceComponentHostState(currentState
+ scHost.setState(new State(currentState
.getConfigVersion(), currentState.getStackVersion(), liveState));
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java Wed Oct 3 20:44:18 2012
@@ -24,8 +24,6 @@ import org.apache.ambari.server.actionma
import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
import org.apache.ambari.server.state.live.Clusters;
import org.apache.ambari.server.state.live.host.Host;
-import org.apache.ambari.server.state.live.host.HostEvent;
-import org.apache.ambari.server.state.live.host.HostEventType;
import org.apache.ambari.server.state.live.host.HostHeartbeatLostEvent;
import org.apache.ambari.server.state.live.host.HostState;
import org.apache.commons.logging.Log;
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java Wed Oct 3 20:44:18 2012
@@ -21,6 +21,7 @@ package org.apache.ambari.server.control
import java.util.Set;
import org.apache.ambari.api.controller.spi.Predicate;
+import org.apache.ambari.server.AmbariException;
/**
* Management controller interface.
@@ -30,21 +31,22 @@ public interface AmbariManagementControl
// ----- Create -----------------------------------------------------------
- public ClusterResponse createCluster(ClusterRequest request);
+ public void createCluster(ClusterRequest request) throws AmbariException;
- public ServiceResponse createServices(ServiceRequest request);
+ public void createServices(ServiceRequest request) throws AmbariException;
- public ServiceComponentResponse createComponents(ServiceComponentRequest request);
+ public void createComponents(ServiceComponentRequest request)
+ throws AmbariException;
- public HostResponse createHosts(HostRequest request);
+ public void createHosts(HostRequest request) throws AmbariException;
- public ServiceComponentHostResponse createHostComponents(ServiceComponentHostRequest request);
+ public void createHostComponents(ServiceComponentHostRequest request)
+ throws AmbariException;
// ----- Read -------------------------------------------------------------
- public ClusterResponse getCluster(ClusterRequest request);
- public Set<ClusterResponse> getAllClusters();
+ public Set<ClusterResponse> getCluster(ClusterRequest request, Predicate predicate);
public ServiceResponse getServices(ServiceRequest request, Predicate predicate);
@@ -57,15 +59,15 @@ public interface AmbariManagementControl
// ----- Update -----------------------------------------------------------
- public ClusterResponse updateCluster(ClusterRequest request);
+ public void updateCluster(ClusterRequest request);
- public ServiceResponse updateServices(ServiceRequest request, Predicate predicate);
+ public void updateServices(ServiceRequest request, Predicate predicate);
- public ServiceComponentResponse updateComponents(ServiceComponentRequest request, Predicate predicate);
+ public void updateComponents(ServiceComponentRequest request, Predicate predicate);
- public HostResponse updateHosts(HostRequest request, Predicate predicate);
+ public void updateHosts(HostRequest request, Predicate predicate);
- public ServiceComponentHostResponse updateHostComponents(ServiceComponentHostRequest request, Predicate predicate);
+ public void updateHostComponents(ServiceComponentHostRequest request, Predicate predicate);
// ----- Delete -----------------------------------------------------------
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java?rev=1393753&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java Wed Oct 3 20:44:18 2012
@@ -0,0 +1,160 @@
+package org.apache.ambari.server.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ambari.api.controller.spi.Predicate;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.ServiceRequest.PerServiceRequest;
+import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.DeployState;
+import org.apache.ambari.server.state.ServiceImpl;
+import org.apache.ambari.server.state.live.Cluster;
+import org.apache.ambari.server.state.live.Clusters;
+import org.apache.ambari.server.state.live.ClustersImpl;
+
+public class AmbariManagementControllerImpl implements
+ AmbariManagementController {
+
+ private final Clusters clusters;
+
+ public AmbariManagementControllerImpl() {
+ this.clusters = new ClustersImpl();
+ }
+
+ @Override
+ public void createCluster(ClusterRequest request) throws AmbariException {
+ if (request.getClusterName() == null
+ || request.getClusterName().isEmpty()) {
+ // TODO throw error
+ }
+ clusters.addCluster(request.getClusterName());
+ }
+
+ @Override
+ public void createServices(ServiceRequest request) throws AmbariException {
+ if (request.getClusterName() == null
+ || request.getClusterName().isEmpty()) {
+ // TODO throw error
+ }
+ Cluster cluster = clusters.getCluster(request.getClusterName());
+ for (PerServiceRequest service : request.getServices()) {
+ Map<String, Config> configs = new HashMap<String, Config>();
+ // TODO initialize configs based off service.configVersions
+ // TODO error check if service is already added and/or enabled/deployed
+ cluster.addService(new ServiceImpl(cluster, service.getServiceName(),
+ DeployState.valueOf(service.getDesiredState()), configs));
+
+ // TODO take action based on desired state
+ }
+ }
+
+ @Override
+ public void createComponents(
+ ServiceComponentRequest request) throws AmbariException {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void createHosts(HostRequest request) throws AmbariException {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void createHostComponents(
+ ServiceComponentHostRequest request) throws AmbariException {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public Set<ClusterResponse> getCluster(ClusterRequest request,
+ Predicate predicate) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServiceResponse getServices(ServiceRequest request, Predicate predicate) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServiceComponentResponse getComponents(
+ ServiceComponentRequest request, Predicate predicate) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public HostResponse getHosts(HostRequest request, Predicate predicate) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServiceComponentHostResponse getHostComponents(
+ ServiceComponentHostRequest request, Predicate predicate) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void updateCluster(ClusterRequest request) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void updateServices(ServiceRequest request,
+ Predicate predicate) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void updateComponents(
+ ServiceComponentRequest request, Predicate predicate) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void updateHosts(HostRequest request, Predicate predicate) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void updateHostComponents(
+ ServiceComponentHostRequest request, Predicate predicate) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void deleteCluster(ClusterRequest request) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void deleteServices(ServiceRequest request) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteComponents(ServiceComponentRequest request) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteHosts(HostRequest request) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteHostComponents(ServiceComponentHostRequest request) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java Wed Oct 3 20:44:18 2012
@@ -23,9 +23,60 @@ package org.apache.ambari.server.control
*/
public class ClusterRequest {
- Long clusterId; // for GET
+ private Long clusterId; // for GET
+
+ private String clusterName; // for GET/CREATE/UPDATE
+
+ private String stackVersion; // for CREATE/UPDATE
+
+ public ClusterRequest(Long clusterId, String clusterName, String stackVersion) {
+ super();
+ this.clusterId = clusterId;
+ this.clusterName = clusterName;
+ this.stackVersion = stackVersion;
+ }
+
+ /**
+ * @return the clusterId
+ */
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ /**
+ * @return the clusterName
+ */
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ /**
+ * @return the stackVersion
+ */
+ public String getStackVersion() {
+ return stackVersion;
+ }
+
+ /**
+ * @param clusterId the clusterId to set
+ */
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ /**
+ * @param clusterName the clusterName to set
+ */
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ /**
+ * @param stackVersion the stackVersion to set
+ */
+ public void setStackVersion(String stackVersion) {
+ this.stackVersion = stackVersion;
+ }
- String clusterName; // for GET/CREATE/UPDATE
- String stackVersion; // for CREATE/UPDATE
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java Wed Oct 3 20:44:18 2012
@@ -18,18 +18,30 @@
package org.apache.ambari.server.controller;
-import java.util.Map;
-
-/**
- * Used for create Cluster
- */
public class ClusterResponse {
- Long clusterId; // for GET
-
- String clusterName; // for GET/CREATE/UPDATE
+ private final Long clusterId;
- Map<String, ServiceResponse> services; // for GET
+ private final String clusterName;
+
+ public ClusterResponse(Long clusterId, String clusterName) {
+ super();
+ this.clusterId = clusterId;
+ this.clusterName = clusterName;
+ }
+
+ /**
+ * @return the clusterId
+ */
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ /**
+ * @return the clusterName
+ */
+ public String getClusterName() {
+ return clusterName;
+ }
- Map<String, HostResponse> hosts; // for GET
}
\ No newline at end of file
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java Wed Oct 3 20:44:18 2012
@@ -27,17 +27,109 @@ import java.util.Map;
*/
public class ConfigurationRequest {
- String clusterName;
+ private String clusterName;
- List<PerConfigurationRequest> configs;
+ private List<PerConfigurationRequest> configs;
+ public ConfigurationRequest(String clusterName,
+ List<PerConfigurationRequest> configs) {
+ super();
+ this.clusterName = clusterName;
+ this.configs = configs;
+ }
+
public static class PerConfigurationRequest {
- String type;
+ private String type;
+
+ private String versionTag;
- String versionTag;
+ private Map<String, String> configs;
+
+ public PerConfigurationRequest(String type, String versionTag,
+ Map<String, String> configs) {
+ super();
+ this.type = type;
+ this.versionTag = versionTag;
+ this.configs = configs;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the versionTag
+ */
+ public String getVersionTag() {
+ return versionTag;
+ }
+
+ /**
+ * @param versionTag the versionTag to set
+ */
+ public void setVersionTag(String versionTag) {
+ this.versionTag = versionTag;
+ }
+
+ /**
+ * @return the configs
+ */
+ public Map<String, String> getConfigs() {
+ return configs;
+ }
+
+ /**
+ * @param configs the configs to set
+ */
+ public void setConfigs(Map<String, String> configs) {
+ this.configs = configs;
+ }
- Map<String, String> configs;
+ }
+
+ /**
+ * @return the clusterName
+ */
+ public String getClusterName() {
+ return clusterName;
+ }
+
+
+
+ /**
+ * @param clusterName the clusterName to set
+ */
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+
+
+ /**
+ * @return the configs
+ */
+ public List<PerConfigurationRequest> getConfigs() {
+ return configs;
+ }
+
+
+
+ /**
+ * @param configs the configs to set
+ */
+ public void setConfigs(List<PerConfigurationRequest> configs) {
+ this.configs = configs;
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java Wed Oct 3 20:44:18 2012
@@ -27,17 +27,82 @@ import java.util.Map;
*/
public class ConfigurationResponse {
- String clusterName;
+ private final String clusterName;
- List<PerConfigurationResponse> configs;
+ private final List<PerConfigurationResponse> configs;
+ public ConfigurationResponse(String clusterName,
+ List<PerConfigurationResponse> configs) {
+ super();
+ this.clusterName = clusterName;
+ this.configs = configs;
+ }
+
public static class PerConfigurationResponse {
- String type;
+ private final String type;
- String versionTag;
+ private String versionTag;
- Map<String, String> configs;
+ private Map<String, String> configs;
+
+ public PerConfigurationResponse(String type, String versionTag,
+ Map<String, String> configs) {
+ super();
+ this.type = type;
+ this.versionTag = versionTag;
+ this.configs = configs;
+ }
+
+ /**
+ * @return the versionTag
+ */
+ public String getVersionTag() {
+ return versionTag;
+ }
+
+ /**
+ * @param versionTag the versionTag to set
+ */
+ public void setVersionTag(String versionTag) {
+ this.versionTag = versionTag;
+ }
+
+ /**
+ * @return the configs
+ */
+ public Map<String, String> getConfigs() {
+ return configs;
+ }
+
+ /**
+ * @param configs the configs to set
+ */
+ public void setConfigs(Map<String, String> configs) {
+ this.configs = configs;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ }
+
+ /**
+ * @return the clusterName
+ */
+ public String getClusterName() {
+ return clusterName;
}
+ /**
+ * @return the configs
+ */
+ public List<PerConfigurationResponse> getConfigs() {
+ return configs;
+ }
+
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java Wed Oct 3 20:44:18 2012
@@ -15,7 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.ambari.server.controller;
+
import org.apache.ambari.server.actionmanager.ActionDBAccessor;
import org.apache.ambari.server.actionmanager.ActionDBInMemoryImpl;
import org.apache.ambari.server.agent.rest.AgentResource;
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/HostResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/HostResponse.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/HostResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/HostResponse.java Wed Oct 3 20:44:18 2012
@@ -21,17 +21,385 @@ package org.apache.ambari.server.control
import java.util.List;
import java.util.Map;
+import org.apache.ambari.server.agent.DiskInfo;
+import org.apache.ambari.server.state.AgentVersion;
+import org.apache.ambari.server.state.live.host.HostHealthStatus;
+
public class HostResponse {
- List<PerHostResponse> hosts;
+ private List<PerHostResponse> hosts;
+ public HostResponse(List<PerHostResponse> hosts) {
+ super();
+ this.hosts = hosts;
+ }
+
public static class PerHostResponse {
- String hostname;
-
- List<String> clusterNames;
+
+ private String hostname;
- Map<String, String> hostAttributes;
+ private List<String> clusterNames;
+
+ public PerHostResponse(String hostname, List<String> clusterNames,
+ String ipv4, String ipv6, int cpuCount, String osArch, String osType,
+ String osInfo, long availableMemBytes, long totalMemBytes,
+ List<DiskInfo> disksInfo, long lastHeartbeatTime,
+ long lastRegistrationTime, String rackInfo,
+ Map<String, String> hostAttributes, AgentVersion agentVersion,
+ HostHealthStatus healthStatus) {
+ super();
+ this.hostname = hostname;
+ this.clusterNames = clusterNames;
+ this.ipv4 = ipv4;
+ this.ipv6 = ipv6;
+ this.cpuCount = cpuCount;
+ this.osArch = osArch;
+ this.osType = osType;
+ this.osInfo = osInfo;
+ this.availableMemBytes = availableMemBytes;
+ this.totalMemBytes = totalMemBytes;
+ this.disksInfo = disksInfo;
+ this.lastHeartbeatTime = lastHeartbeatTime;
+ this.lastRegistrationTime = lastRegistrationTime;
+ this.rackInfo = rackInfo;
+ this.hostAttributes = hostAttributes;
+ this.agentVersion = agentVersion;
+ this.healthStatus = healthStatus;
+ }
+
+ public PerHostResponse(String hostname) {
+ super();
+ this.hostname = hostname;
+ }
+
+ /**
+ * Host IP if ipv4 interface available
+ */
+ private String ipv4;
+
+ /**
+ * Host IP if ipv6 interface available
+ */
+ private String ipv6;
+
+ /**
+ * Count of cores on Host
+ */
+ private int cpuCount;
+
+ /**
+ * Os Architecture
+ */
+ private String osArch;
+
+ /**
+ * OS Type
+ */
+ private String osType;
+
+ /**
+ * OS Information
+ */
+ private String osInfo;
+
+ /**
+ * Amount of available memory for the Host
+ */
+ private long availableMemBytes;
+
+ /**
+ * Amount of physical memory for the Host
+ */
+ private long totalMemBytes;
+
+ /**
+ * Disks mounted on the Host
+ */
+ private List<DiskInfo> disksInfo;
+
+ /**
+ * Last heartbeat timestamp from the Host
+ */
+ private long lastHeartbeatTime;
+
+ /**
+ * Last registration timestamp for the Host
+ */
+ private long lastRegistrationTime;
+
+ /**
+ * Rack to which the Host belongs to
+ */
+ private String rackInfo;
+
+ /**
+ * Additional Host attributes
+ */
+ private Map<String, String> hostAttributes;
+
+ /**
+ * Version of agent running on the Host
+ */
+ private AgentVersion agentVersion;
+
+ /**
+ * Host Health Status
+ */
+ private HostHealthStatus healthStatus;
+
+ /**
+ * @return the hostname
+ */
+ public String getHostname() {
+ return hostname;
+ }
+
+ /**
+ * @param hostname the hostname to set
+ */
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
+ }
+
+ /**
+ * @return the clusterNames
+ */
+ public List<String> getClusterNames() {
+ return clusterNames;
+ }
+
+ /**
+ * @param clusterNames the clusterNames to set
+ */
+ public void setClusterNames(List<String> clusterNames) {
+ this.clusterNames = clusterNames;
+ }
+
+ /**
+ * @return the ipv4
+ */
+ public String getIpv4() {
+ return ipv4;
+ }
+
+ /**
+ * @param ipv4 the ipv4 to set
+ */
+ public void setIpv4(String ipv4) {
+ this.ipv4 = ipv4;
+ }
+
+ /**
+ * @return the ipv6
+ */
+ public String getIpv6() {
+ return ipv6;
+ }
+
+ /**
+ * @param ipv6 the ipv6 to set
+ */
+ public void setIpv6(String ipv6) {
+ this.ipv6 = ipv6;
+ }
+
+ /**
+ * @return the cpuCount
+ */
+ public int getCpuCount() {
+ return cpuCount;
+ }
+
+ /**
+ * @param cpuCount the cpuCount to set
+ */
+ public void setCpuCount(int cpuCount) {
+ this.cpuCount = cpuCount;
+ }
+
+ /**
+ * @return the osArch
+ */
+ public String getOsArch() {
+ return osArch;
+ }
+
+ /**
+ * @param osArch the osArch to set
+ */
+ public void setOsArch(String osArch) {
+ this.osArch = osArch;
+ }
+
+ /**
+ * @return the osType
+ */
+ public String getOsType() {
+ return osType;
+ }
+
+ /**
+ * @param osType the osType to set
+ */
+ public void setOsType(String osType) {
+ this.osType = osType;
+ }
+
+ /**
+ * @return the osInfo
+ */
+ public String getOsInfo() {
+ return osInfo;
+ }
+
+ /**
+ * @param osInfo the osInfo to set
+ */
+ public void setOsInfo(String osInfo) {
+ this.osInfo = osInfo;
+ }
+
+ /**
+ * @return the availableMemBytes
+ */
+ public long getAvailableMemBytes() {
+ return availableMemBytes;
+ }
+
+ /**
+ * @param availableMemBytes the availableMemBytes to set
+ */
+ public void setAvailableMemBytes(long availableMemBytes) {
+ this.availableMemBytes = availableMemBytes;
+ }
+
+ /**
+ * @return the totalMemBytes
+ */
+ public long getTotalMemBytes() {
+ return totalMemBytes;
+ }
+
+ /**
+ * @param totalMemBytes the totalMemBytes to set
+ */
+ public void setTotalMemBytes(long totalMemBytes) {
+ this.totalMemBytes = totalMemBytes;
+ }
+
+ /**
+ * @return the disksInfo
+ */
+ public List<DiskInfo> getDisksInfo() {
+ return disksInfo;
+ }
+
+ /**
+ * @param disksInfo the disksInfo to set
+ */
+ public void setDisksInfo(List<DiskInfo> disksInfo) {
+ this.disksInfo = disksInfo;
+ }
+
+ /**
+ * @return the lastHeartbeatTime
+ */
+ public long getLastHeartbeatTime() {
+ return lastHeartbeatTime;
+ }
+
+ /**
+ * @param lastHeartbeatTime the lastHeartbeatTime to set
+ */
+ public void setLastHeartbeatTime(long lastHeartbeatTime) {
+ this.lastHeartbeatTime = lastHeartbeatTime;
+ }
+
+ /**
+ * @return the lastRegistrationTime
+ */
+ public long getLastRegistrationTime() {
+ return lastRegistrationTime;
+ }
+
+ /**
+ * @param lastRegistrationTime the lastRegistrationTime to set
+ */
+ public void setLastRegistrationTime(long lastRegistrationTime) {
+ this.lastRegistrationTime = lastRegistrationTime;
+ }
+
+ /**
+ * @return the rackInfo
+ */
+ public String getRackInfo() {
+ return rackInfo;
+ }
+
+ /**
+ * @param rackInfo the rackInfo to set
+ */
+ public void setRackInfo(String rackInfo) {
+ this.rackInfo = rackInfo;
+ }
+
+ /**
+ * @return the hostAttributes
+ */
+ public Map<String, String> getHostAttributes() {
+ return hostAttributes;
+ }
+
+ /**
+ * @param hostAttributes the hostAttributes to set
+ */
+ public void setHostAttributes(Map<String, String> hostAttributes) {
+ this.hostAttributes = hostAttributes;
+ }
+
+ /**
+ * @return the agentVersion
+ */
+ public AgentVersion getAgentVersion() {
+ return agentVersion;
+ }
+
+ /**
+ * @param agentVersion the agentVersion to set
+ */
+ public void setAgentVersion(AgentVersion agentVersion) {
+ this.agentVersion = agentVersion;
+ }
+
+ /**
+ * @return the healthStatus
+ */
+ public HostHealthStatus getHealthStatus() {
+ return healthStatus;
+ }
+
+ /**
+ * @param healthStatus the healthStatus to set
+ */
+ public void setHealthStatus(HostHealthStatus healthStatus) {
+ this.healthStatus = healthStatus;
+ }
- List<ServiceComponentHostResponse> hostComponents;
+ }
+
+ /**
+ * @return the hosts
+ */
+ public List<PerHostResponse> getHosts() {
+ return hosts;
+ }
+
+
+
+ /**
+ * @param hosts the hosts to set
+ */
+ public void setHosts(List<PerHostResponse> hosts) {
+ this.hosts = hosts;
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java Wed Oct 3 20:44:18 2012
@@ -23,23 +23,140 @@ import java.util.Map;
public class ServiceComponentHostRequest {
- String clusterName; // REF
-
- List<PerServiceComponentHostRequest> hostComponents;
+ private String clusterName; // REF
+ private List<PerServiceComponentHostRequest> hostComponents;
+
+ public ServiceComponentHostRequest(String clusterName,
+ List<PerServiceComponentHostRequest> hostComponents) {
+ super();
+ this.clusterName = clusterName;
+ this.hostComponents = hostComponents;
+ }
+
public static class PerServiceComponentHostRequest {
- String serviceName;
+ private String serviceName;
- String componentName;
+ private String componentName;
- String hostname;
+ private String hostname;
// Config type -> version mapping
- Map<String, String> configVersions; // CREATE/UPDATE
+ private Map<String, String> configVersions; // CREATE/UPDATE
- String desiredState; // CREATE/UPDATE
+ private String desiredState; // CREATE/UPDATE
+
+ public PerServiceComponentHostRequest(String serviceName,
+ String componentName, String hostname,
+ Map<String, String> configVersions, String desiredState) {
+ super();
+ this.serviceName = serviceName;
+ this.componentName = componentName;
+ this.hostname = hostname;
+ this.configVersions = configVersions;
+ this.desiredState = desiredState;
+ }
+
+ /**
+ * @return the serviceName
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /**
+ * @param serviceName the serviceName to set
+ */
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * @return the componentName
+ */
+ public String getComponentName() {
+ return componentName;
+ }
+
+ /**
+ * @param componentName the componentName to set
+ */
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ /**
+ * @return the hostname
+ */
+ public String getHostname() {
+ return hostname;
+ }
+
+ /**
+ * @param hostname the hostname to set
+ */
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
+ }
+
+ /**
+ * @return the configVersions
+ */
+ public Map<String, String> getConfigVersions() {
+ return configVersions;
+ }
+
+ /**
+ * @param configVersions the configVersions to set
+ */
+ public void setConfigVersions(Map<String, String> configVersions) {
+ this.configVersions = configVersions;
+ }
+
+ /**
+ * @return the desiredState
+ */
+ public String getDesiredState() {
+ return desiredState;
+ }
+
+ /**
+ * @param desiredState the desiredState to set
+ */
+ public void setDesiredState(String desiredState) {
+ this.desiredState = desiredState;
+ }
+
+ }
+
+ /**
+ * @return the clusterName
+ */
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ /**
+ * @param clusterName the clusterName to set
+ */
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ /**
+ * @return the hostComponents
+ */
+ public List<PerServiceComponentHostRequest> getHostComponents() {
+ return hostComponents;
+ }
+ /**
+ * @param hostComponents the hostComponents to set
+ */
+ public void setHostComponents(
+ List<PerServiceComponentHostRequest> hostComponents) {
+ this.hostComponents = hostComponents;
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java Wed Oct 3 20:44:18 2012
@@ -23,25 +23,179 @@ import java.util.Map;
public class ServiceComponentHostResponse {
- String clusterName; // REF
+ private String clusterName; // REF
- List<PerServiceComponentHostResponse> hostComponents;
+ private List<PerServiceComponentHostResponse> hostComponents;
+ public ServiceComponentHostResponse(String clusterName,
+ List<PerServiceComponentHostResponse> hostComponents) {
+ super();
+ this.clusterName = clusterName;
+ this.hostComponents = hostComponents;
+ }
+
public static class PerServiceComponentHostResponse {
- String serviceName;
+ private String serviceName;
- String componentName;
+ private String componentName;
- String hostname;
+ private String hostname;
// Config type -> version mapping
- Map<String, String> configVersions;
+ private Map<String, String> configVersions;
+
+ private String liveState;
+
+ private String stackVersion;
+
+ private String desiredState;
+
+ public PerServiceComponentHostResponse(String serviceName,
+ String componentName, String hostname,
+ Map<String, String> configVersions, String liveState,
+ String stackVersion, String desiredState) {
+ super();
+ this.serviceName = serviceName;
+ this.componentName = componentName;
+ this.hostname = hostname;
+ this.configVersions = configVersions;
+ this.liveState = liveState;
+ this.stackVersion = stackVersion;
+ this.desiredState = desiredState;
+ }
+
+ /**
+ * @return the serviceName
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /**
+ * @param serviceName the serviceName to set
+ */
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * @return the componentName
+ */
+ public String getComponentName() {
+ return componentName;
+ }
+
+ /**
+ * @param componentName the componentName to set
+ */
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ /**
+ * @return the hostname
+ */
+ public String getHostname() {
+ return hostname;
+ }
+
+ /**
+ * @param hostname the hostname to set
+ */
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
+ }
+
+ /**
+ * @return the configVersions
+ */
+ public Map<String, String> getConfigVersions() {
+ return configVersions;
+ }
+
+ /**
+ * @param configVersions the configVersions to set
+ */
+ public void setConfigVersions(Map<String, String> configVersions) {
+ this.configVersions = configVersions;
+ }
+
+ /**
+ * @return the liveState
+ */
+ public String getLiveState() {
+ return liveState;
+ }
+
+ /**
+ * @param liveState the liveState to set
+ */
+ public void setLiveState(String liveState) {
+ this.liveState = liveState;
+ }
+
+ /**
+ * @return the stackVersion
+ */
+ public String getStackVersion() {
+ return stackVersion;
+ }
+
+ /**
+ * @param stackVersion the stackVersion to set
+ */
+ public void setStackVersion(String stackVersion) {
+ this.stackVersion = stackVersion;
+ }
+
+ /**
+ * @return the desiredState
+ */
+ public String getDesiredState() {
+ return desiredState;
+ }
+
+ /**
+ * @param desiredState the desiredState to set
+ */
+ public void setDesiredState(String desiredState) {
+ this.desiredState = desiredState;
+ }
+
+ }
+
+ /**
+ * @return the clusterName
+ */
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ /**
+ * @param clusterName the clusterName to set
+ */
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+
+
+ /**
+ * @return the hostComponents
+ */
+ public List<PerServiceComponentHostResponse> getHostComponents() {
+ return hostComponents;
+ }
- String liveState;
- String stackVersion;
+ /**
+ * @param hostComponents the hostComponents to set
+ */
+ public void setHostComponents(
+ List<PerServiceComponentHostResponse> hostComponents) {
+ this.hostComponents = hostComponents;
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java Wed Oct 3 20:44:18 2012
@@ -23,21 +23,121 @@ import java.util.Map;
public class ServiceComponentRequest {
- String clusterName; // REF
+ private String clusterName; // REF
- List<PerServiceComponentRequest> components;
+ private List<PerServiceComponentRequest> components;
+
+ public ServiceComponentRequest(String clusterName,
+ List<PerServiceComponentRequest> components) {
+ super();
+ this.clusterName = clusterName;
+ this.components = components;
+ }
public static class PerServiceComponentRequest {
- String serviceName; // GET/CREATE/UPDATE/DELETE
+ private String serviceName; // GET/CREATE/UPDATE/DELETE
- String componentName; // GET/CREATE/UPDATE/DELETE
+ private String componentName; // GET/CREATE/UPDATE/DELETE
// Config type -> version mapping
- Map<String, String> configVersions; // CREATE/UPDATE
+ private Map<String, String> configVersions; // CREATE/UPDATE
- String desiredState; // CREATE/UPDATE
+ private String desiredState; // CREATE/UPDATE
+
+ public PerServiceComponentRequest(String serviceName, String componentName,
+ Map<String, String> configVersions, String desiredState) {
+ super();
+ this.serviceName = serviceName;
+ this.componentName = componentName;
+ this.configVersions = configVersions;
+ this.desiredState = desiredState;
+ }
+
+ /**
+ * @return the serviceName
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /**
+ * @param serviceName the serviceName to set
+ */
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * @return the componentName
+ */
+ public String getComponentName() {
+ return componentName;
+ }
+
+ /**
+ * @param componentName the componentName to set
+ */
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ /**
+ * @return the configVersions
+ */
+ public Map<String, String> getConfigVersions() {
+ return configVersions;
+ }
+
+ /**
+ * @param configVersions the configVersions to set
+ */
+ public void setConfigVersions(Map<String, String> configVersions) {
+ this.configVersions = configVersions;
+ }
+
+ /**
+ * @return the desiredState
+ */
+ public String getDesiredState() {
+ return desiredState;
+ }
+
+ /**
+ * @param desiredState the desiredState to set
+ */
+ public void setDesiredState(String desiredState) {
+ this.desiredState = desiredState;
+ }
}
+ /**
+ * @return the clusterName
+ */
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ /**
+ * @param clusterName the clusterName to set
+ */
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ /**
+ * @return the components
+ */
+ public List<PerServiceComponentRequest> getComponents() {
+ return components;
+ }
+
+ /**
+ * @param components the components to set
+ */
+ public void setComponents(List<PerServiceComponentRequest> components) {
+ this.components = components;
+ }
+
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java Wed Oct 3 20:44:18 2012
@@ -23,24 +23,121 @@ import java.util.Map;
public class ServiceComponentResponse {
- Long clusterId; // REF
+ private Long clusterId; // REF
- String clusterName; // REF
+ private String clusterName; // REF
- List<PerServiceComponentResponse> components;
+ private List<PerServiceComponentResponse> components;
+
+ public ServiceComponentResponse(Long clusterId, String clusterName,
+ List<PerServiceComponentResponse> components) {
+ super();
+ this.clusterId = clusterId;
+ this.clusterName = clusterName;
+ this.components = components;
+ }
public static class PerServiceComponentResponse {
- String serviceName; // GET/CREATE/UPDATE/DELETE
+ private String serviceName; // GET/CREATE/UPDATE/DELETE
- String componentName; // GET/CREATE/UPDATE/DELETE
+ private String componentName; // GET/CREATE/UPDATE/DELETE
// Config type -> version mapping
- Map<String, String> configVersions; // CREATE/UPDATE
-
- // hostname -> ServiceComponentHost mapping
- Map<String, ServiceComponentHostResponse> serviceComponentHosts;
+ private Map<String, String> configVersions; // CREATE/UPDATE
+
+ public PerServiceComponentResponse(String serviceName,
+ String componentName, Map<String, String> configVersions) {
+ super();
+ this.serviceName = serviceName;
+ this.componentName = componentName;
+ this.configVersions = configVersions;
+ }
+
+ /**
+ * @return the serviceName
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /**
+ * @param serviceName the serviceName to set
+ */
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * @return the componentName
+ */
+ public String getComponentName() {
+ return componentName;
+ }
+
+ /**
+ * @param componentName the componentName to set
+ */
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ /**
+ * @return the configVersions
+ */
+ public Map<String, String> getConfigVersions() {
+ return configVersions;
+ }
+
+ /**
+ * @param configVersions the configVersions to set
+ */
+ public void setConfigVersions(Map<String, String> configVersions) {
+ this.configVersions = configVersions;
+ }
}
+ /**
+ * @return the clusterId
+ */
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ /**
+ * @param clusterId the clusterId to set
+ */
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ /**
+ * @return the clusterName
+ */
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ /**
+ * @param clusterName the clusterName to set
+ */
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ /**
+ * @return the components
+ */
+ public List<PerServiceComponentResponse> getComponents() {
+ return components;
+ }
+
+ /**
+ * @param components the components to set
+ */
+ public void setComponents(List<PerServiceComponentResponse> components) {
+ this.components = components;
+ }
+
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java Wed Oct 3 20:44:18 2012
@@ -22,19 +22,103 @@ import java.util.Map;
public class ServiceRequest {
- String clusterName; // REF
+ private String clusterName; // REF
- List<PerServiceRequest> services;
+ private List<PerServiceRequest> services;
+
+ public ServiceRequest(String clusterName, List<PerServiceRequest> services) {
+ super();
+ this.clusterName = clusterName;
+ this.services = services;
+ }
public static class PerServiceRequest {
- String serviceName; // GET/CREATE/UPDATE/DELETE
+ private String serviceName; // GET/CREATE/UPDATE/DELETE
// Config type -> version mapping
- Map<String, String> configVersions; // CREATE/UPDATE
+ private Map<String, String> configVersions; // CREATE/UPDATE
- String desiredState; // CREATE/UPDATE
+ private String desiredState; // CREATE/UPDATE
+
+ public PerServiceRequest(String serviceName,
+ Map<String, String> configVersions, String desiredState) {
+ super();
+ this.serviceName = serviceName;
+ this.configVersions = configVersions;
+ this.desiredState = desiredState;
+ }
+
+ /**
+ * @return the serviceName
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /**
+ * @param serviceName the serviceName to set
+ */
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * @return the configVersions
+ */
+ public Map<String, String> getConfigVersions() {
+ return configVersions;
+ }
+
+ /**
+ * @param configVersions the configVersions to set
+ */
+ public void setConfigVersions(Map<String, String> configVersions) {
+ this.configVersions = configVersions;
+ }
+
+ /**
+ * @return the desiredState
+ */
+ public String getDesiredState() {
+ return desiredState;
+ }
+
+ /**
+ * @param desiredState the desiredState to set
+ */
+ public void setDesiredState(String desiredState) {
+ this.desiredState = desiredState;
+ }
}
+
+ /**
+ * @return the clusterName
+ */
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ /**
+ * @param clusterName the clusterName to set
+ */
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ /**
+ * @return the services
+ */
+ public List<PerServiceRequest> getServices() {
+ return services;
+ }
+
+ /**
+ * @param services the services to set
+ */
+ public void setServices(List<PerServiceRequest> services) {
+ this.services = services;
+ }
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java Wed Oct 3 20:44:18 2012
@@ -23,19 +23,120 @@ import java.util.Map;
public class ServiceResponse {
- Long clusterId; // REF
+ private Long clusterId; // REF
- String clusterName; // REF
+ private String clusterName; // REF
- List<PerServiceResponse> services;
+ private List<PerServiceResponse> services;
+ public ServiceResponse(Long clusterId, String clusterName,
+ List<PerServiceResponse> services) {
+ super();
+ this.clusterId = clusterId;
+ this.clusterName = clusterName;
+ this.services = services;
+ }
+
public static class PerServiceResponse {
- String serviceName;
+ private String serviceName;
- String currentStackVersion;
+ private String currentStackVersion;
- Map<String, ServiceComponentResponse> components;
+ // Config type -> version mapping
+ private Map<String, String> configVersions; // CREATE/UPDATE
+
+ public PerServiceResponse(String serviceName, String currentStackVersion,
+ Map<String, String> configVersions) {
+ super();
+ this.serviceName = serviceName;
+ this.currentStackVersion = currentStackVersion;
+ this.configVersions = configVersions;
+ }
+
+ /**
+ * @return the serviceName
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /**
+ * @param serviceName the serviceName to set
+ */
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * @return the currentStackVersion
+ */
+ public String getCurrentStackVersion() {
+ return currentStackVersion;
+ }
+
+ /**
+ * @param currentStackVersion the currentStackVersion to set
+ */
+ public void setCurrentStackVersion(String currentStackVersion) {
+ this.currentStackVersion = currentStackVersion;
+ }
+
+ /**
+ * @return the configVersions
+ */
+ public Map<String, String> getConfigVersions() {
+ return configVersions;
+ }
+
+ /**
+ * @param configVersions the configVersions to set
+ */
+ public void setConfigVersions(Map<String, String> configVersions) {
+ this.configVersions = configVersions;
+ }
}
+
+ /**
+ * @return the clusterId
+ */
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ /**
+ * @param clusterId the clusterId to set
+ */
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ /**
+ * @return the clusterName
+ */
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ /**
+ * @param clusterName the clusterName to set
+ */
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ /**
+ * @return the services
+ */
+ public List<PerServiceResponse> getServices() {
+ return services;
+ }
+
+ /**
+ * @param services the services to set
+ */
+ public void setServices(List<PerServiceResponse> services) {
+ this.services = services;
+ }
}
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/AgentVersion.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/AgentVersion.java?rev=1393753&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/AgentVersion.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/AgentVersion.java Wed Oct 3 20:44:18 2012
@@ -0,0 +1,56 @@
+/**
+ * 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;
+
+/**
+ * Agent Version representation
+ */
+public class AgentVersion {
+
+ private final String version;
+
+ public AgentVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof AgentVersion)) {
+ return false;
+ }
+ if (this == object) {
+ return true;
+ }
+ AgentVersion a = (AgentVersion) object;
+ return a.equals(this.version);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = version != null ? version.hashCode() : 0;
+ return result;
+ }
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/AgentVersion.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java?rev=1393753&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java Wed Oct 3 20:44:18 2012
@@ -0,0 +1,5 @@
+package org.apache.ambari.server.state;
+
+public interface Config {
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Config.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/DeployState.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/DeployState.java?rev=1393753&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/DeployState.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/DeployState.java Wed Oct 3 20:44:18 2012
@@ -0,0 +1,110 @@
+/**
+ * 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;
+
+public enum DeployState {
+ /**
+ * Initial/Clean state
+ */
+ INIT(0),
+ /**
+ * In the process of installing.
+ */
+ INSTALLING(1),
+ /**
+ * Install failed
+ */
+ INSTALL_FAILED(2),
+ /**
+ * State when install completed successfully
+ */
+ INSTALLED(3),
+ /**
+ * In the process of starting.
+ */
+ STARTING(4),
+ /**
+ * Start failed.
+ */
+ START_FAILED(5),
+ /**
+ * State when start completed successfully.
+ */
+ STARTED(6),
+ /**
+ * In the process of stopping.
+ */
+ STOPPING(7),
+ /**
+ * Stop failed
+ */
+ STOP_FAILED(8),
+ /**
+ * In the process of uninstalling.
+ */
+ UNINSTALLING(9),
+ /**
+ * Uninstall failed.
+ */
+ UNINSTALL_FAILED(10),
+ /**
+ * State when uninstall completed successfully.
+ */
+ UNINSTALLED(11),
+ /**
+ * In the process of wiping out the install
+ */
+ WIPING_OUT(12),
+ /**
+ * State when wipeout fails
+ */
+ WIPEOUT_FAILED(13);
+
+ private final int state;
+
+ private DeployState(int state) {
+ this.state = state;
+ }
+
+ public boolean isValidDesiredState() {
+ switch (DeployState.values()[this.state]) {
+ case INIT:
+ case INSTALLED:
+ case STARTED:
+ case UNINSTALLED:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public boolean isInProgressState() {
+ switch (DeployState.values()[this.state]) {
+ case INSTALLING:
+ case STARTING:
+ case STOPPING:
+ case UNINSTALLING:
+ case WIPING_OUT:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/DeployState.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java?rev=1393753&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java Wed Oct 3 20:44:18 2012
@@ -0,0 +1,28 @@
+package org.apache.ambari.server.state;
+
+import java.util.Map;
+
+
+public interface Service {
+
+ public String getName();
+
+ public long getClusterId();
+
+ public long getCurrentHostComponentMappingVersion();
+
+ public Map<String, ServiceComponent> getServiceComponents();
+
+ public State getState();
+
+ public void setState(State state);
+
+ public Config getConfig();
+
+ public void setConfig(Config config);
+
+ public StackVersion getStackVersion();
+
+ public void setStackVersion(StackVersion stackVersion);
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java?rev=1393753&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java Wed Oct 3 20:44:18 2012
@@ -0,0 +1,29 @@
+package org.apache.ambari.server.state;
+
+import java.util.Map;
+
+import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHost;
+
+public interface ServiceComponent {
+
+ public String getName();
+
+ public String getServiceName();
+
+ public long getClusterId();
+
+ public State getState();
+
+ public void setState(State state);
+
+ public Config getConfig();
+
+ public void setConfig(Config config);
+
+ public StackVersion getStackVersion();
+
+ public void setStackVersion(StackVersion stackVersion);
+
+ public Map<String, ServiceComponentHost> getServiceComponentHosts();
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java?rev=1393753&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java Wed Oct 3 20:44:18 2012
@@ -0,0 +1,102 @@
+package org.apache.ambari.server.state;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ambari.server.state.live.Cluster;
+
+public class ServiceImpl implements Service {
+
+ private final Cluster cluster;
+ private final String serviceName;
+ private DeployState state;
+ private Map<String, Config> configs;
+ private Map<String, ServiceComponent> components;
+
+ private void init() {
+ // TODO
+ // initialize from DB
+ }
+
+ public ServiceImpl(Cluster cluster, String serviceName,
+ DeployState state, Map<String, Config> configs) {
+ this.cluster = cluster;
+ this.serviceName = serviceName;
+ this.state = state;
+ if (configs != null) {
+ this.configs = configs;
+ } else {
+ this.configs = new HashMap<String, Config>();
+ }
+ this.components = new HashMap<String, ServiceComponent>();
+ init();
+ }
+
+ public ServiceImpl(Cluster cluster, String serviceName,
+ Map<String, Config> configs) {
+ this(cluster, serviceName, DeployState.INIT, configs);
+ }
+
+ public ServiceImpl(Cluster cluster, String serviceName) {
+ this(cluster, serviceName, DeployState.INIT, null);
+ }
+
+ @Override
+ public String getName() {
+ return serviceName;
+ }
+
+ @Override
+ public long getClusterId() {
+ return cluster.getClusterId();
+ }
+
+ @Override
+ public long getCurrentHostComponentMappingVersion() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Map<String, ServiceComponent> getServiceComponents() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public State getState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setState(State state) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Config getConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setConfig(Config config) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public StackVersion getStackVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setStackVersion(StackVersion stackVersion) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/State.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/State.java?rev=1393753&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/State.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/State.java Wed Oct 3 20:44:18 2012
@@ -0,0 +1,132 @@
+/**
+ * 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;
+
+
+public class State {
+
+ private final int hashCodePrime = 131;
+
+ private ConfigVersion configVersion;
+ private StackVersion stackVersion;
+ private DeployState deployState;
+
+ public State(ConfigVersion configVersion,
+ StackVersion stackVersion, DeployState state) {
+ super();
+ this.configVersion = configVersion;
+ this.stackVersion = stackVersion;
+ this.deployState = state;
+ }
+
+ public State() {
+ super();
+ this.configVersion = null;
+ this.stackVersion = null;
+ this.deployState = DeployState.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 DeployState getLiveState() {
+ return deployState;
+ }
+ /**
+ * @param state the state to set
+ */
+ public void setState(DeployState state) {
+ this.deployState = 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=" + deployState;
+ return out;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof State)) {
+ return false;
+ }
+ if (this == object) {
+ return true;
+ }
+ State s = (State) object;
+
+ if (configVersion != null ?
+ !configVersion.equals(s.configVersion) : s.configVersion != null) {
+ return false;
+ }
+ if (stackVersion != null ?
+ !stackVersion.equals(s.stackVersion) : s.stackVersion != null) {
+ return false;
+ }
+ return deployState.equals(s.deployState);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = configVersion != null ? configVersion.hashCode() : 0;
+ result += hashCodePrime * result +
+ ( stackVersion != null ? stackVersion.hashCode() : 0 );
+ result += deployState.hashCode();
+ return result;
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/State.java
------------------------------------------------------------------------------
svn:eol-style = native
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=1393753&r1=1393752&r2=1393753&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 Wed Oct 3 20:44:18 2012
@@ -21,10 +21,11 @@ package org.apache.ambari.server.state.l
import java.util.List;
import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.State;
import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHost;
import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostEvent;
-import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostState;
public interface Cluster {
@@ -60,7 +61,7 @@ public interface Cluster {
* @param hostname Host name
* @return ServiceComponentHostState
*/
- public ServiceComponentHostState getServiceComponentHostState(String service,
+ public State getServiceComponentHostState(String service,
String serviceComponent, String hostname) throws AmbariException;
/**
@@ -72,7 +73,7 @@ public interface Cluster {
*/
public void setServiceComponentHostState(String service,
String serviceComponent, String hostname,
- ServiceComponentHostState state) throws AmbariException;
+ State state) throws AmbariException;
/**
* Send an Event to a given ServiceComponentHost
@@ -99,4 +100,6 @@ public interface Cluster {
public List<ServiceComponentHost> getServiceComponentHosts(String hostname);
+ public void addService(Service service);
+
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterImpl.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterImpl.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClusterImpl.java Wed Oct 3 20:44:18 2012
@@ -24,11 +24,12 @@ import java.util.Map;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.ServiceComponentHostNotFoundException;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.State;
import org.apache.ambari.server.state.fsm.InvalidStateTransitonException;
import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHost;
import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostEvent;
import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostImpl;
-import org.apache.ambari.server.state.live.svccomphost.ServiceComponentHostState;
public class ClusterImpl implements Cluster {
@@ -140,7 +141,7 @@ public class ClusterImpl implements Clus
}
@Override
- public synchronized ServiceComponentHostState getServiceComponentHostState(String service,
+ public synchronized State getServiceComponentHostState(String service,
String serviceComponent, String hostname) throws AmbariException {
return
getServiceComponentHost(service, serviceComponent, hostname).getState();
@@ -149,7 +150,7 @@ public class ClusterImpl implements Clus
@Override
public synchronized void setServiceComponentHostState(String service,
String serviceComponent, String hostname,
- ServiceComponentHostState state) throws AmbariException {
+ State state) throws AmbariException {
getServiceComponentHost(service, serviceComponent, hostname)
.setState(state);
}
@@ -175,4 +176,10 @@ public class ClusterImpl implements Clus
return null;
}
+ @Override
+ public void addService(Service service) {
+ // TODO Auto-generated method stub
+
+ }
+
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClustersImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClustersImpl.java?rev=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClustersImpl.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/ClustersImpl.java Wed Oct 3 20:44:18 2012
@@ -19,7 +19,6 @@
package org.apache.ambari.server.state.live;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Modified: 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=1393753&r1=1393752&r2=1393753&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/Host.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/state/live/host/Host.java Wed Oct 3 20:44:18 2012
@@ -22,8 +22,8 @@ import java.util.List;
import java.util.Map;
import org.apache.ambari.server.agent.DiskInfo;
+import org.apache.ambari.server.state.AgentVersion;
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 {