You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vg...@apache.org on 2011/12/23 03:35:55 UTC
svn commit: r1222531 - in /incubator/ambari/trunk: ./
client/src/main/java/org/apache/ambari/common/rest/entities/
controller/src/main/java/org/apache/ambari/controller/
controller/src/main/java/org/apache/ambari/datastore/
controller/src/main/resource...
Author: vgogate
Date: Fri Dec 23 02:35:54 2011
New Revision: 1222531
URL: http://svn.apache.org/viewvc?rev=1222531&view=rev
Log:
AMBARI-172 Remove the ambari category from the configuration element, put it as globals elemement in the stack
Added:
incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/KeyValuePair.java
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Stack.java
incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/datastore/StaticDataStore.java
incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/clusters/cluster123.xml
incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/stacks/horton-0.json
incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/stacks/puppet1-0.json
incubator/ambari/trunk/controller/src/test/java/org/apache/ambari/datastore/TestStaticDataStore.java
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1222531&r1=1222530&r2=1222531&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Dec 23 02:35:54 2011
@@ -2,6 +2,8 @@ Ambari Change log
Release 0.1.0 - unreleased
+ AMBARI-172. Remove the "ambari" category from the configuration element, put it as "globals" elemement in the stack. (vgogate)
+
AMBARI-171. Agents retry failed actions for a configurable number of times
after a configurable delay (ddas)
Added: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/KeyValuePair.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/KeyValuePair.java?rev=1222531&view=auto
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/KeyValuePair.java (added)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/KeyValuePair.java Fri Dec 23 02:35:54 2011
@@ -0,0 +1,98 @@
+/*
+ * 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;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * A single key/value pair inside a Configuration.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "KeyValuePair", propOrder = {
+ "name",
+ "value"
+})
+@XmlRootElement(name = "KeyValuePair")
+public class KeyValuePair {
+
+ @XmlAttribute(required = true)
+ protected String name;
+ @XmlAttribute(required = true)
+ protected String value;
+
+ public KeyValuePair() {
+ // PASS
+ }
+
+ public KeyValuePair(String key, String value) {
+ this.name = key;
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Stack.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Stack.java?rev=1222531&r1=1222530&r2=1222531&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Stack.java (original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Stack.java Fri Dec 23 02:35:54 2011
@@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlAcce
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
@@ -49,6 +50,12 @@ import javax.xml.datatype.XMLGregorianCa
* attribute name { text }
* element urls { text }*
* }*
+ * element globals {
+ * element property {
+ * attribute name { text }
+ * attribute value { text }
+ * }*
+ * }
* element configuration { Configuration }?
* element components {
* attribute name { text }
@@ -90,6 +97,7 @@ import javax.xml.datatype.XMLGregorianCa
"parentRevision",
"creationTime",
"repositories",
+ "globals",
"configuration",
"components"
})
@@ -137,6 +145,26 @@ public class Stack {
protected List<RepositoryKind> repositories;
/**
+ * Stack Golbal variables
+ */
+ @XmlElements({@XmlElement})
+ protected List<KeyValuePair> globals;
+
+ /**
+ * @return the globals
+ */
+ public List<KeyValuePair> getGlobals() {
+ return globals;
+ }
+
+ /**
+ * @param globals the globals to set
+ */
+ public void setGlobals(List<KeyValuePair> globals) {
+ this.globals = globals;
+ }
+
+ /**
* The client configuration.
*/
@XmlElement
@@ -167,6 +195,7 @@ public class Stack {
this.parentName = orig.parentName;
this.parentRevision = orig.parentRevision;
this.repositories = orig.repositories;
+ this.globals = orig.globals;
this.revision = orig.revision;
}
Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java?rev=1222531&r1=1222530&r2=1222531&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java Fri Dec 23 02:35:54 2011
@@ -37,6 +37,7 @@ import org.apache.ambari.common.rest.ent
import org.apache.ambari.common.rest.entities.ClusterState;
import org.apache.ambari.common.rest.entities.Component;
import org.apache.ambari.common.rest.entities.ConfigurationCategory;
+import org.apache.ambari.common.rest.entities.KeyValuePair;
import org.apache.ambari.common.rest.entities.Node;
import org.apache.ambari.common.rest.entities.Property;
import org.apache.ambari.common.rest.entities.Role;
@@ -911,14 +912,11 @@ public class Clusters {
}
config = config + "\"\n";
}
- for (ConfigurationCategory cat : stack.getConfiguration().getCategory()) {
- if(cat.getName().equals("ambari")) {
- for (Property p : cat.getProperty()) {
- config = config + "$"+p.getName() + " = " + "\"" + p.getValue() + "\"\n";
- }
- config = config + "\n";
- }
+
+ for (KeyValuePair p : stack.getGlobals()) {
+ config = config + "$"+p.getName() + " = " + "\"" + p.getValue() + "\"\n";
}
+ config = config + "\n";
return config;
}
Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/datastore/StaticDataStore.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/datastore/StaticDataStore.java?rev=1222531&r1=1222530&r2=1222531&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/datastore/StaticDataStore.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/datastore/StaticDataStore.java Fri Dec 23 02:35:54 2011
@@ -65,10 +65,12 @@ class StaticDataStore implements DataSto
}
StaticDataStore() throws IOException {
+ /*
addStackFile("org/apache/ambari/stacks/hadoop-security-0.xml",
"hadoop-security");
addStackFile("org/apache/ambari/stacks/cluster123-0.xml", "cluster123");
addStackFile("org/apache/ambari/stacks/cluster124-0.xml", "cluster124");
+ */
addStackJsonFile("org/apache/ambari/stacks/puppet1-0.json", "puppet1");
addStackJsonFile("org/apache/ambari/stacks/horton-0.json", "horton");
addClusterFile("org/apache/ambari/clusters/cluster123.xml", "cluster123");
Modified: incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/clusters/cluster123.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/clusters/cluster123.xml?rev=1222531&r1=1222530&r2=1222531&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/clusters/cluster123.xml (original)
+++ incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/clusters/cluster123.xml Fri Dec 23 02:35:54 2011
@@ -1,5 +1,5 @@
<cluster description="Owen's cluster"
- stackName="cluster123" stackRevision="0"
+ stackName="puppet1" stackRevision="0"
goalState="active" nodes="node00,node01,node02,node03">
<activeServices>HDFS</activeServices>
<activeServices>MapReduce</activeServices>
Modified: incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/stacks/horton-0.json
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/stacks/horton-0.json?rev=1222531&r1=1222530&r2=1222531&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/stacks/horton-0.json (original)
+++ incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/stacks/horton-0.json Fri Dec 23 02:35:54 2011
@@ -2,15 +2,14 @@
"@name": "horton",
"@parentName": "puppet1",
"@parentRevision": "0",
+ "globals":[
+ {
+ "@name":"ambari_user_realm",
+ "@value":"HORTON.YGRIDCORE.NET"
+ }
+ ],
"configuration": {
- "category": [
- {"@name":"ambari",
- "property":[
- {"@name": "ambari_user_realm",
- "@value": "HORTON.YGRIDCORE.NET"}
- ]
- }
- ]
+ "category": []
},
"components": [
{"@name": "hdfs",
@@ -26,4 +25,4 @@
}
}
]
-}
\ No newline at end of file
+}
Modified: incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/stacks/puppet1-0.json
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/stacks/puppet1-0.json?rev=1222531&r1=1222530&r2=1222531&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/stacks/puppet1-0.json (original)
+++ incubator/ambari/trunk/controller/src/main/resources/org/apache/ambari/stacks/puppet1-0.json Fri Dec 23 02:35:54 2011
@@ -4,11 +4,7 @@
"@kind":"TAR",
"urls":"http://www.apache.org/dist/hadoop/common/"
},
- "configuration":{
- "category":[
- {
- "@name":"ambari",
- "property":[
+ "globals":[
{
"@name":"ambari_namenode_principal",
"@value":"nn"
@@ -73,8 +69,9 @@
"@name":"ambari_auth_to_local",
"@value":"RULE:[1:$1@$0](.*@<%= ambari_user_realm %>)s/@.*//\nRULE:[2:$1@$0](<%= ambari_jobtracker_principal %>@<%= ambari_service_realm %>)s/.*/<%= ambari_mapreduce_user %>/\nRULE:[2:$1@$0](<%= ambari_tasktracker_principal %>@<%= ambari_service_realm %>)s/.*/<%= ambari_mapreduce_user %>/\nRULE:[2:$1@$0](<%= ambari_namenode_principal %>@<%= ambari_service_realm %>)s/.*/<%= ambari_hdfs_user %>/\nRULE:[2:$1@$0](<%= ambari_datanode_principal %>@<%= ambari_service_realm %>)s/.*/<%= ambari_hdfs_user %>/\nRULE:[2:$1@$0](<%= ambari_hbasemaster_principal %>@<%= ambari_service_realm %>)s/.*/<%= ambari_hbase_user %>/\nRULE:[2:$1@$0](<%= ambari_regionserver_principal %>@<%= ambari_service_realm %>)s/.*/<%= ambari_hbase_user %>/\nRULE:[2:$1@$0](<%= ambari_hcat_principal %>@<%= ambari_service_realm %>)s/.*/<%= ambari_hcat_user %>/"
}
- ]
- },
+ ],
+ "configuration":{
+ "category":[
{
"@name":"core-site.xml",
"property":[
Modified: incubator/ambari/trunk/controller/src/test/java/org/apache/ambari/datastore/TestStaticDataStore.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/test/java/org/apache/ambari/datastore/TestStaticDataStore.java?rev=1222531&r1=1222530&r2=1222531&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/test/java/org/apache/ambari/datastore/TestStaticDataStore.java (original)
+++ incubator/ambari/trunk/controller/src/test/java/org/apache/ambari/datastore/TestStaticDataStore.java Fri Dec 23 02:35:54 2011
@@ -28,7 +28,7 @@ public class TestStaticDataStore {
@Test
public void testGetStack() throws Exception {
DataStore ds = new StaticDataStore();
- Stack stack = ds.retrieveStack("hadoop-security", -1);
+ Stack stack = ds.retrieveStack("puppet1", -1);
assertEquals("can fetch revision -1", "0", stack.getRevision());
}
}