Browse Source

AMBARI-694. Class to encapsulate stage.

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1380897 13f79535-47bb-0310-9956-ffa450edef68
Jitendra Nath Pandey 12 years ago
parent
commit
c104d29e15

+ 2 - 0
AMBARI-666-CHANGES.txt

@@ -12,6 +12,8 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-694. Class to encapsulate stage. (jitendra)
+
   AMBARI-691. More basic classes for new design. (hitesh)
 
   AMBARI-693. Classes for request objects. (jitendra)

+ 24 - 0
ambari-server/src/main/java/org/apache/ambari/server/Role.java

@@ -0,0 +1,24 @@
+/**
+ * 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;
+
+//This enumerates all the roles that the server can handle.
+//Each component or a job maps to a particular role. 
+public enum Role {
+  
+}

+ 42 - 0
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRole.java

@@ -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.actionmanager;
+
+import java.util.Map;
+
+import org.apache.ambari.server.Role;
+
+/** 
+ * This class encapsulates all the information for an action
+ * on a host for a particular role. This class will be used to schedule, persist and track
+ * an action.
+ */
+public class HostRole {
+  private final String host;
+  private final Role role;
+  private Map<String, String> params = null;
+  private final float successFactor;
+  private HostRoleStatus status = HostRoleStatus.PENDING;
+  private String manifest = null;
+  
+  public  HostRole(String host, Role role, float successFactor) {
+    this.host = host;
+    this.role = role;
+    this.successFactor = successFactor;
+  }
+}

+ 27 - 0
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleStatus.java

@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.actionmanager;
+
+public enum HostRoleStatus {
+  PENDING,
+  QUEUED,
+  COMPLETED,
+  FAILED,
+  TIMEDOUT,
+  ABORTED
+}

+ 29 - 0
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java

@@ -0,0 +1,29 @@
+/**
+ * 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.actionmanager;
+
+import java.util.List;
+
+//This class encapsulates the stage. The stage encapsulates all the information 
+//required to persist an action.
+public class Stage {
+  private long requestId;
+  private long stageId = -1;
+  private List<HostRole> hostRoles;
+  private String logDir;
+}

+ 0 - 7
ambari-server/src/main/java/org/apache/ambari/server/fsm/Role.java

@@ -1,7 +0,0 @@
-package org.apache.ambari.server.fsm;
-
-public interface Role {
-
-  public String getRoleName();
-  
-}