incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r1181334 - in /incubator/ambari/trunk: ./ client/src/main/java/org/apache/ambari/common/rest/entities/agent/ controller/src/main/java/org/apache/ambari/controller/rest/agent/
Date Tue, 11 Oct 2011 01:49:26 GMT
Author: eyang
Date: Tue Oct 11 01:49:25 2011
New Revision: 1181334

URL: http://svn.apache.org/viewvc?rev=1181334&view=rev
Log:
AMBARI-56. Surface the write config file command to write config file action. (Eric Yang)

Added:
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/agent/ConfigFile.java
Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/agent/Action.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerResource.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1181334&r1=1181333&r2=1181334&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue Oct 11 01:49:25 2011
@@ -2,6 +2,8 @@ Ambari Change log
 
 Release 0.1.0 - unreleased
 
+  AMBARI-56. Surface the write config file command to write config file action. (Eric Yang)
+
   AMBARI-55. release cluster nodes function (vgogate)
 
   AMBARI-53. Refactor the HeartBeat to have Agents' states separated by 

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/agent/Action.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/agent/Action.java?rev=1181334&r1=1181333&r2=1181334&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/agent/Action.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/agent/Action.java
Tue Oct 11 01:49:25 2011
@@ -51,6 +51,8 @@ public class Action {
   public String bluePrintName;
   @XmlElement
   public String bluePrintRevision;
+  @XmlElement
+  public ConfigFile file;
   
   public Kind getKind() {
     return kind;
@@ -140,9 +142,17 @@ public class Action {
     this.bluePrintRevision = bluePrintRevision;
   }
   
+  public ConfigFile getFile() {
+    return this.file;
+  }
+  
+  public void setFile(ConfigFile file) {
+    this.file = file;
+  }
+  
   public static enum Kind {
     RUN_ACTION, START_ACTION, STOP_ACTION, STATUS_ACTION, 
-    CREATE_STRUCTURE_ACTION, DELETE_STRUCTURE_ACTION;
+    CREATE_STRUCTURE_ACTION, DELETE_STRUCTURE_ACTION, WRITE_FILE_ACTION;
     public static class KindAdaptor extends XmlAdapter<String, Kind> {
       @Override
       public String marshal(Kind obj) throws Exception {

Added: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/agent/ConfigFile.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/agent/ConfigFile.java?rev=1181334&view=auto
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/agent/ConfigFile.java
(added)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/agent/ConfigFile.java
Tue Oct 11 01:49:25 2011
@@ -0,0 +1,103 @@
+/*
+ * 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.common.rest.entities.agent;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+public class ConfigFile {
+  
+  public ConfigFile() {  
+  }
+  
+  public ConfigFile(String owner, String group, String permission, 
+      String path, String umask, String data) {
+    this.owner = owner;
+    this.group = group;
+    this.permission = permission;
+    this.path = path;
+    this.umask = umask;
+    this.data = data;
+  }
+  
+  @XmlElement
+  private String data;
+  @XmlElement
+  private String umask;
+  @XmlElement
+  private String path;
+  @XmlElement
+  private String owner;
+  @XmlElement
+  private String group;
+  @XmlElement
+  private String permission;
+  
+  public String getData() {
+    return data;
+  }
+  
+  public String getUmask() {
+    return umask;
+  }
+  
+  public String getPath() {
+    return path;
+  }
+  
+  public String getOwner() {
+    return owner;
+  }
+  
+  public String getGroup() {
+    return group;
+  }
+  
+  public String getPermission() {
+    return permission;
+  }
+  
+  public void setData(String data) {
+    this.data = data;
+  }
+  
+  public void setUmask(String umask) {
+    this.umask = umask;
+  }
+  
+  public void setPath(String path) {
+    this.path = path;
+  }
+  
+  public void setOwner(String owner) {
+    this.owner = owner;
+  }
+  
+  public void setGroup(String group) {
+    this.group = group;
+  }
+  
+  public void setPermission(String permission) {
+    this.permission = permission;
+  }
+}

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerResource.java?rev=1181334&r1=1181333&r2=1181334&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerResource.java
(original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/agent/ControllerResource.java
Tue Oct 11 01:49:25 2011
@@ -41,6 +41,7 @@ import org.apache.ambari.common.rest.ent
 import org.apache.ambari.common.rest.entities.agent.Command;
 import org.apache.ambari.common.rest.entities.agent.CommandResult;
 import org.apache.ambari.common.rest.entities.agent.ControllerResponse;
+import org.apache.ambari.common.rest.entities.agent.ConfigFile;
 import org.apache.ambari.common.rest.entities.agent.HardwareProfile;
 import org.apache.ambari.common.rest.entities.agent.HeartBeat;
 
@@ -250,9 +251,22 @@ public class ControllerResource {
     action3.setCleanUpCommand(cleanUp);
     
     Action action4 = new Action();
-    action4.setKind(Kind.DELETE_STRUCTURE_ACTION);
-    action4.setComponent("hdfs");
-    action4.setRole("datanode");
+    action4.setBluePrintName("blueprint");
+    action4.setBluePrintRevision("0.1");
+    action4.setUser("hdfs");
+    action4.setKind(Kind.WRITE_FILE_ACTION);
+    String owner ="hdfs";
+    String group = "hadoop";
+    String permission = "0700";
+    String path = "$prefix/config";
+    String umask = "022";
+    String data = "Content of the file";
+    action4.setFile(new ConfigFile(owner, group, permission, path, umask, data));
+    
+    Action action5 = new Action();
+    action5.setKind(Kind.DELETE_STRUCTURE_ACTION);
+    action5.setComponent("hdfs");
+    action5.setRole("datanode");
     
     List<Action> actions = new ArrayList<Action>();
     actions.add(action);



Mime
View raw message