incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1178439 - in /incubator/ambari/trunk: ./ client/src/main/java/org/apache/ambari/common/rest/entities/ client/src/main/java/org/apache/ambari/common/util/ controller/src/main/java/org/apache/ambari/controller/
Date Mon, 03 Oct 2011 16:12:22 GMT
Author: omalley
Date: Mon Oct  3 16:12:22 2011
New Revision: 1178439

URL: http://svn.apache.org/viewvc?rev=1178439&view=rev
Log:
AMBARI-25. Clean up the configuration entity to collapse some levels. 
(omalley)

Added:
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigurationCategory.java
Removed:
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigPropertiesCategory.java
Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Configuration.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ObjectFactory.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Property.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/util/JAXBUtil.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Stacks.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1178439&r1=1178438&r2=1178439&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Mon Oct  3 16:12:22 2011
@@ -2,6 +2,9 @@ Ambari Change log
 
 Release 0.1.0 - unreleased
 
+  AMBARI-25. Clean up the configuration entity to collapse some levels. 
+  (omalley)
+
   AMBARI-31. Fix JAXB annotations for Ambari resourcesi (vgogate)
 
   AMBARI-30. Fix the build so that the client and controller tarballs are 

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Configuration.java?rev=1178439&r1=1178438&r2=1178439&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Configuration.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Configuration.java
Mon Oct  3 16:12:22 2011
@@ -22,6 +22,7 @@ import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 
@@ -37,8 +38,8 @@ import javax.xml.bind.annotation.XmlType
 @XmlRootElement(name = "Configuration")
 public class Configuration {
 
-    @XmlElement(name = "ConfigPropertyCategories", required = true)
-    protected List<ConfigPropertiesCategory> category;
+    @XmlElements({@XmlElement(name = "ConfigurationCategory")})
+    protected List<ConfigurationCategory> category;
 
     /**
      * Gets the value of the category property.
@@ -58,13 +59,13 @@ public class Configuration {
      * 
      * <p>
      * Objects of the following type(s) are allowed in the list
-     * {@link ConfigPropertiesCategory }
+     * {@link ConfigurationCategory }
      * 
      * 
      */
-    public List<ConfigPropertiesCategory> getCategory() {
+    public List<ConfigurationCategory> getCategory() {
         if (category == null) {
-            category = new ArrayList<ConfigPropertiesCategory>();
+            category = new ArrayList<ConfigurationCategory>();
         }
         return this.category;
     }

Added: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigurationCategory.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigurationCategory.java?rev=1178439&view=auto
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigurationCategory.java
(added)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigurationCategory.java
Mon Oct  3 16:12:22 2011
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.common.rest.entities;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+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.XmlType;
+
+
+/**
+ * <p>Java class for CategoryType complex type.
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ConfigurationCategory", propOrder = {
+    "name",
+    "property"
+})
+@XmlRootElement(name = "ConfigurationCategory")
+public class ConfigurationCategory {
+
+    @XmlAttribute(name = "Name", required = true)
+    protected String name;
+    @XmlElements({@XmlElement(name = "Property")})
+    protected List<Property> property;
+
+    /**
+     * 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 property property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the property property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getProperty().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Property }
+     * 
+     * 
+     */
+    public List<Property> getProperty() {
+        if (property == null) {
+            property = new ArrayList<Property>();
+        }
+        return this.property;
+    }
+
+}

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ObjectFactory.java?rev=1178439&r1=1178438&r2=1178439&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ObjectFactory.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ObjectFactory.java
Mon Oct  3 16:12:22 2011
@@ -92,11 +92,11 @@ public class ObjectFactory {
     }
 
     /**
-     * Create an instance of {@link ConfigPropertiesCategory }
+     * Create an instance of {@link ConfigurationCategory }
      * 
      */
-    public ConfigPropertiesCategory createCategoryType() {
-        return new ConfigPropertiesCategory();
+    public ConfigurationCategory createCategoryType() {
+        return new ConfigurationCategory();
     }
 
     /**

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Property.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Property.java?rev=1178439&r1=1178438&r2=1178439&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Property.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Property.java
Mon Oct  3 16:12:22 2011
@@ -19,7 +19,7 @@ package org.apache.ambari.common.rest.en
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 
@@ -27,15 +27,18 @@ import javax.xml.bind.annotation.XmlType
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "Property", propOrder = {
     "name",
-    "value"
+    "value",
+    "force"
 })
 @XmlRootElement(name = "Property")
 public class Property {
 
-    @XmlElement(required = true)
+    @XmlAttribute(required = true)
     protected String name;
-    @XmlElement(required = true)
+    @XmlAttribute(required = true)
     protected String value;
+    @XmlAttribute(required = false)
+    protected boolean force = false;
 
     /**
      * Gets the value of the name property.
@@ -84,4 +87,20 @@ public class Property {
     public void setValue(String value) {
         this.value = value;
     }
+    
+    /**
+     * Get whether this property is forced.
+     * @return true if it is forced
+     */
+    public boolean getForce() {
+      return force;
+    }
+    
+    /**
+     * Set whether this property is forced
+     * @param force mark it as forced
+     */
+    public void setForce(boolean force) {
+      this.force = force;
+    }
 }

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/util/JAXBUtil.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/util/JAXBUtil.java?rev=1178439&r1=1178438&r2=1178439&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/util/JAXBUtil.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/util/JAXBUtil.java
Mon Oct  3 16:12:22 2011
@@ -30,7 +30,8 @@ import org.codehaus.jackson.xc.JaxbAnnot
 public class JAXBUtil {
 
   private static ObjectMapper mapper = new ObjectMapper();
-  private static AnnotationIntrospector introspector = new JaxbAnnotationIntrospector();
+  private static AnnotationIntrospector introspector = 
+      new JaxbAnnotationIntrospector();
   
   public JAXBUtil() {
     mapper.getDeserializationConfig().setAnnotationIntrospector(introspector);
@@ -46,7 +47,7 @@ public class JAXBUtil {
     }
   }
   
-  public static <T> T read(byte[] buffer, java.lang.Class<T> c) throws IOException
{
+  public static <T> T read(byte[] buffer, Class<T> c) throws IOException {
     return (T) mapper.readValue(buffer, 0, buffer.length, c);
   }
 

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java?rev=1178439&r1=1178438&r2=1178439&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
(original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
Mon Oct  3 16:12:22 2011
@@ -41,8 +41,8 @@ import javax.xml.bind.annotation.XmlType
 import org.apache.ambari.common.rest.entities.Blueprint;
 import org.apache.ambari.common.rest.entities.Cluster;
 import org.apache.ambari.common.rest.entities.Component;
-import org.apache.ambari.common.rest.entities.ConfigPropertiesCategory;
 import org.apache.ambari.common.rest.entities.Configuration;
+import org.apache.ambari.common.rest.entities.ConfigurationCategory;
 import org.apache.ambari.common.rest.entities.PackageRepository;
 import org.apache.ambari.common.rest.entities.Property;
 import org.apache.ambari.common.rest.entities.Role;
@@ -84,9 +84,9 @@ public class Blueprints {
         bp.setPackageRepositories(prList);
         
         Configuration bpDefaultCfg = new Configuration();
-        ConfigPropertiesCategory hdfs_site = new ConfigPropertiesCategory();
+        ConfigurationCategory hdfs_site = new ConfigurationCategory();
         hdfs_site.setName("hdfs-site");
-        ConfigPropertiesCategory mapred_site = new ConfigPropertiesCategory();
+        ConfigurationCategory mapred_site = new ConfigurationCategory();
         mapred_site.setName("mapred-site");  
         hdfs_site.getProperty().add(getProperty ("dfs.name.dir", "/tmp/namenode"));
         hdfs_site.getProperty().add(getProperty ("dfs.data.dir", "/tmp/datanode"));

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Stacks.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Stacks.java?rev=1178439&r1=1178438&r2=1178439&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Stacks.java
(original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Stacks.java
Mon Oct  3 16:12:22 2011
@@ -40,7 +40,7 @@ import javax.xml.bind.annotation.XmlType
 
 import org.apache.ambari.common.rest.entities.Blueprint;
 import org.apache.ambari.common.rest.entities.Component;
-import org.apache.ambari.common.rest.entities.ConfigPropertiesCategory;
+import org.apache.ambari.common.rest.entities.ConfigurationCategory;
 import org.apache.ambari.common.rest.entities.Configuration;
 import org.apache.ambari.common.rest.entities.PackageRepository;
 import org.apache.ambari.common.rest.entities.Role;
@@ -107,9 +107,9 @@ public class Stacks {
         bp.setPackageRepositories(prList);
         
         Configuration bpDefaultCfg = new Configuration();
-        ConfigPropertiesCategory hdfs_site = new ConfigPropertiesCategory();
+        ConfigurationCategory hdfs_site = new ConfigurationCategory();
         hdfs_site.setName("hdfs-site");
-        ConfigPropertiesCategory mapred_site = new ConfigPropertiesCategory();
+        ConfigurationCategory mapred_site = new ConfigurationCategory();
         mapred_site.setName("mapred-site");  
         hdfs_site.getProperty().add(Blueprints.getInstance().getProperty ("dfs.name.dir",
"/tmp/namenode"));
         hdfs_site.getProperty().add(Blueprints.getInstance().getProperty ("dfs.data.dir",
"/tmp/datanode"));



Mime
View raw message