ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgog...@apache.org
Subject svn commit: r1185339 - in /incubator/ambari/trunk: ./ client/src/main/java/org/apache/ambari/client/ client/src/main/java/org/apache/ambari/common/rest/entities/ controller/src/main/java/org/apache/ambari/controller/ controller/src/main/java/org/apache...
Date Mon, 17 Oct 2011 19:24:55 GMT
Author: vgogate
Date: Mon Oct 17 19:24:55 2011
New Revision: 1185339

URL: http://svn.apache.org/viewvc?rev=1185339&view=rev
Log:
AMBARI-79

Added:
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/BlueprintInformation.java
Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/BlueprintList.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.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/Nodes.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1185339&r1=1185338&r2=1185339&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Mon Oct 17 19:24:55 2011
@@ -2,6 +2,8 @@ Ambari Change log
 
 Release 0.1.0 - unreleased
 
+  AMBARI-79. create default blueprint instance
+
   AMBARI-78. Change the datatype of responseId in the heartbeat messages to short (ddas)
 
   AMBARI-77. create default blueprint containing HDFS component (vgogate)

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/BlueprintList.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/BlueprintList.java?rev=1185339&r1=1185338&r2=1185339&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/BlueprintList.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/BlueprintList.java
Mon Oct 17 19:24:55 2011
@@ -17,6 +17,156 @@
  */
 package org.apache.ambari.client;
 
-public class BlueprintList {
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
 
-}
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.ambari.common.rest.entities.Blueprint;
+import org.apache.ambari.common.rest.entities.BlueprintInformation;
+import org.apache.ambari.common.rest.entities.ClusterDefinition;
+import org.apache.ambari.common.rest.entities.ClusterInformation;
+import org.apache.ambari.common.rest.entities.ClusterState;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONObject;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.GenericType;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+
+public class BlueprintList extends Command {
+
+    String[] args = null;
+    Options options = null;
+   
+    CommandLine line;
+    
+    
+    public BlueprintList (String [] args) throws Exception {  
+        /*
+         * Build options for blueprint add
+         */
+        this.args = args;
+        addOptions();
+    }
+    
+    public void printUsage () {
+        HelpFormatter formatter = new HelpFormatter();
+        formatter.printHelp( "ambari blueprint list", this.options);
+    }
+    
+    public void addOptions () {
+             
+        Option help = new Option( "help", "Help" );
+        Option tree = new Option( "tree", "Help" );
+        
+        OptionBuilder.withArgName("name");
+        OptionBuilder.hasArg();
+        OptionBuilder.withDescription( "Name of the blueprint");
+        Option name = OptionBuilder.create( "name" );
+        
+        this.options = new Options();
+        options.addOption(name);
+        options.addOption(tree);
+        options.addOption(help);
+    }
+    
+    public void parseCommandLine() {
+     
+        // create the parser
+        CommandLineParser parser = new GnuParser();
+        try {
+            // parse the command line arguments
+            line = parser.parse(this.options, this.args );
+            
+            if (line.hasOption("help")) {
+                printUsage();
+                System.exit(0);
+            }
+        }
+        catch( ParseException exp ) {
+            // oops, something went wrong
+            System.err.println( "Command parsing failed. Reason: <" + exp.getMessage()+">\n"
);
+            printUsage();
+            System.exit(-1);
+        } 
+    }
+    
+    private static URI getBaseURI() {
+        return UriBuilder.fromUri(
+                "http://localhost:4080/rest/").build();
+    }
+    
+    
+    public void run() throws Exception {
+        /* 
+         * Parse the command line to get the command line arguments
+         */
+        parseCommandLine();
+        
+        ClientConfig config = new DefaultClientConfig();
+        Client client = Client.create(config);
+        WebResource service = client.resource(getBaseURI());
+        String name = line.getOptionValue("name");
+        boolean tree = line.hasOption("tree");
+        
+        /*
+         * Import blueprint 
+         */
+        if (name != null) {
+            ClientResponse response = service.path("blueprints/"+name)
+                    .accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+            /* 
+             * Retrieve the blueprint from the response
+             */
+            Blueprint blueprint = response.getEntity(Blueprint.class);
+            printBlueprintInformation (blueprint, tree);
+           
+        } else {
+            ClientResponse response = service.path("blueprints")
+                    .accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+            /* 
+             * Retrieve the blueprint Information list from the response
+             */
+            List<BlueprintInformation> bpInfos = response.getEntity(new GenericType<List<BlueprintInformation>>(){});
+            for (BlueprintInformation bpInfo : bpInfos) {
+                printBlueprintInformation (bpInfo, tree);
+            }
+        }
+        
+    }
+    
+    public void printBlueprintInformation (BlueprintInformation bpInfo, boolean tree) {
+        
+    }
+    
+    public void printBlueprintInformation (Blueprint bp, boolean tree) {
+        System.out.println("Name:["+bp.getName()+"], Revision:["+bp.getRevision()+"]");
+        System.out.println("     ParentName:["+bp.getParentName()+"], ParentRevision:["+bp.getParentRevision()+"]");
+        if (tree) {
+            
+        }
+    }
+}
\ No newline at end of file

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java?rev=1185339&r1=1185338&r2=1185339&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java
Mon Oct 17 19:24:55 2011
@@ -24,7 +24,9 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
 import javax.xml.bind.annotation.XmlType;
+import javax.xml.datatype.XMLGregorianCalendar;
 
 
 /**
@@ -33,6 +35,10 @@ import javax.xml.bind.annotation.XmlType
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "Blueprint", propOrder = {
+    "name",
+    "revision",
+    "parentName",
+    "parentRevision",
     "repositories",
     "configuration",
     "components"
@@ -48,6 +54,16 @@ public class Blueprint {
     protected String parentName;
     @XmlAttribute
     protected String parentRevision;
+    
+    /*
+    @XmlAttribute
+    @XmlSchemaType(name = "dateTime")
+    protected XMLGregorianCalendar creationTime;
+    
+    @XmlAttribute
+    @XmlSchemaType(name = "dateTime")
+    protected XMLGregorianCalendar lastUpdateTime;
+    */
 
     @XmlElement
     protected List<RepositoryKind> repositories;
@@ -59,6 +75,18 @@ public class Blueprint {
     protected List<Component> components;
     
     /**
+     * @return the repositories
+     */
+    public List<RepositoryKind> getRepositories() {
+        return repositories;
+    }
+    /**
+     * @param repositories the repositories to set
+     */
+    public void setRepositories(List<RepositoryKind> repositories) {
+        this.repositories = repositories;
+    }
+    /**
      * @return the name
      */
     public String getName() {

Added: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/BlueprintInformation.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/BlueprintInformation.java?rev=1185339&view=auto
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/BlueprintInformation.java
(added)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/BlueprintInformation.java
Mon Oct 17 19:24:55 2011
@@ -0,0 +1,145 @@
+/*
+ * 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.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.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "BlueprintInformation", propOrder = {
+    "name",
+    "revision",
+    "parentName",
+    "parentRevision",
+    "creationTime",
+    "lastUpdateTime",
+    "component"
+})
+@XmlRootElement
+public class BlueprintInformation {
+
+    @XmlAttribute
+    protected String name;
+    @XmlAttribute
+    protected String revision;
+    @XmlAttribute
+    protected String parentName;
+    @XmlAttribute
+    protected String parentRevision;
+    @XmlElement
+    protected List<String> component;
+    @XmlAttribute
+    @XmlSchemaType(name = "dateTime")
+    protected XMLGregorianCalendar creationTime;
+    @XmlAttribute
+    @XmlSchemaType(name = "dateTime")
+    protected XMLGregorianCalendar lastUpdateTime;
+    /**
+     * @return the component
+     */
+    public List<String> getComponent() {
+        return component;
+    }
+    /**
+     * @param component the component to set
+     */
+    public void setComponent(List<String> component) {
+        this.component = component;
+    }
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+    /**
+     * @return the revision
+     */
+    public String getRevision() {
+        return revision;
+    }
+    /**
+     * @param revision the revision to set
+     */
+    public void setRevision(String revision) {
+        this.revision = revision;
+    }
+    /**
+     * @return the parentName
+     */
+    public String getParentName() {
+        return parentName;
+    }
+    /**
+     * @param parentName the parentName to set
+     */
+    public void setParentName(String parentName) {
+        this.parentName = parentName;
+    }
+    /**
+     * @return the parentRevision
+     */
+    public String getParentRevision() {
+        return parentRevision;
+    }
+    /**
+     * @param parentRevision the parentRevision to set
+     */
+    public void setParentRevision(String parentRevision) {
+        this.parentRevision = parentRevision;
+    }
+    
+    /**
+     * @return the creationTime
+     */
+    public XMLGregorianCalendar getCreationTime() {
+        return creationTime;
+    }
+    /**
+     * @param creationTime the creationTime to set
+     */
+    public void setCreationTime(XMLGregorianCalendar creationTime) {
+        this.creationTime = creationTime;
+    }
+    /**
+     * @return the lastUpdateTime
+     */
+    public XMLGregorianCalendar getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+    /**
+     * @param lastUpdateTime the lastUpdateTime to set
+     */
+    public void setLastUpdateTime(XMLGregorianCalendar lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+    }
+}

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=1185339&r1=1185338&r2=1185339&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 17 19:24:55 2011
@@ -36,6 +36,7 @@ import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Unmarshaller;
 
 import org.apache.ambari.common.rest.entities.Blueprint;
+import org.apache.ambari.common.rest.entities.BlueprintInformation;
 import org.apache.ambari.common.rest.entities.Component;
 import org.apache.ambari.common.rest.entities.ComponentDefinition;
 import org.apache.ambari.common.rest.entities.Configuration;
@@ -84,20 +85,87 @@ public class Blueprints {
         
         ConfigurationCategory ambari = new ConfigurationCategory();
         ambari.setName("ambari");
-        ambari.getProperty().add(getProperty ("ambari.install.dir", "/var/ambari"));
-        ambari.getProperty().add(getProperty ("ambari.data.dir.pattern", "/grid/*"));
+        ambari.getProperty().add(getProperty ("AMBARI_INSTALL_DIR", "/var/ambari"));
+        ambari.getProperty().add(getProperty ("AMBARI_HADOOP_JAVA_HOME", "/home/hms/apps/jdk1.6.0_27"));
+        ambari.getProperty().add(getProperty ("AMBARI_HADOOP_NN_DIR","/grid/2/hadoop/var/hdfs/name"));

+        ambari.getProperty().add(getProperty ("AMBARI_DATA_DIRS", "/grid/*"));
+        ambari.getProperty().add(getProperty ("AMBARI_HADOOP_SECURITY", "false"));
+        
+        ambari.getProperty().add(getProperty ("AMBARI_HADOOP_DN_ADDR", "DEFAULT"));
+        ambari.getProperty().add(getProperty ("AMBARI_HADOOP_DN_HTTP_ADDR", "DEFAULT"));
+        ambari.getProperty().add(getProperty ("AMBARI_HADOOP_NN_HOST", "DEFAULT"));
+        
+        
+
         
         ConfigurationCategory core_site = new ConfigurationCategory();
         core_site.setName("core-site");
-        core_site.getProperty().add(getProperty ("dfs.name.dir", "/tmp/namenode"));
+        core_site.getProperty().add(getProperty ("local.realm","${KERBEROS_REALM}"));
+        core_site.getProperty().add(getProperty ("fs.default.name","hdfs://${HADOOP_NN_HOST}:8020"));
+        core_site.getProperty().add(getProperty ("fs.trash.interval","360"));
+        core_site.getProperty().add(getProperty ("hadoop.security.auth_to_local","RULE:[2:$1@$0]([jt]t@.*${KERBEROS_REALM})s/.*/${HADOOP_MR_USER}/
RULE:[2:$1@$0](hm@.*${KERBEROS_REALM})s/.*/${HADOOP_HDFS_USER}/ RULE:[2:$1@$0](rs@.*${KERBEROS_REALM})s/.*/${HADOOP_HDFS_USER}/
RULE:[2:$1@$0]([nd]n@.*${KERBEROS_REALM})s/.*/${HADOOP_HDFS_USER}/ RULE:[2:$1@$0](mapred@.*${KERBEROS_REALM})s/.*/${HADOOP_MR_USER}/
RULE:[2:$1@$0](hdfs@.*${KERBEROS_REALM})s/.*/${HADOOP_HDFS_USER}/ RULE:[2:$1@$0](mapredqa@.*${KERBEROS_REALM})s/.*/${HADOOP_MR_USER}/
RULE:[2:$1@$0](hdfsqa@.*${KERBEROS_REALM})s/.*/${HADOOP_HDFS_USER}/ DEFAULT"));
+        core_site.getProperty().add(getProperty ("hadoop.security.authentication","${SECURITY_TYPE}"));
+        core_site.getProperty().add(getProperty ("hadoop.security.authorization","${SECURITY}"));
+        core_site.getProperty().add(getProperty ("hadoop.security.groups.cache.secs","14400"));
+        core_site.getProperty().add(getProperty ("hadoop.kerberos.kinit.command","${KINIT}"));
+        core_site.getProperty().add(getProperty ("hadoop.http.filter.initializers","org.apache.hadoop.http.lib.StaticUserWebFilter"));
         
         ConfigurationCategory hdfs_site = new ConfigurationCategory();
         hdfs_site.setName("hdfs-site");
-        hdfs_site.getProperty().add(getProperty ("dfs.name.dir", "/tmp/namenode"));
-        hdfs_site.getProperty().add(getProperty ("dfs.data.dir", "/tmp/datanode"));
+        hdfs_site.getProperty().add(getProperty ("dfs.name.dir","${HADOOP_NN_DIR}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.data.dir","${HADOOP_DN_DIR}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.safemode.threshold.pct","1.0f"));
+        hdfs_site.getProperty().add(getProperty ("dfs.datanode.address","${HADOOP_DN_ADDR}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.datanode.http.address","${HADOOP_DN_HTTP_ADDR}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.http.address","${HADOOP_NN_HOST}:50070"));
+        hdfs_site.getProperty().add(getProperty ("dfs.umaskmode","077"));
+        hdfs_site.getProperty().add(getProperty ("dfs.block.access.token.enable","${SECURITY}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.namenode.kerberos.principal","nn/_HOST@${local.realm}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.secondary.namenode.kerberos.principal","nn/_HOST@${local.realm}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.namenode.kerberos.https.principal","host/_HOST@${local.realm}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.secondary.namenode.kerberos.https.principal","host/_HOST@${local.realm}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.secondary.https.port","50490"));
+        hdfs_site.getProperty().add(getProperty ("dfs.datanode.kerberos.principal","dn/_HOST@${local.realm}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.namenode.keytab.file","/etc/security/keytabs/nn.service.keytab"));
+        hdfs_site.getProperty().add(getProperty ("dfs.secondary.namenode.keytab.file","/etc/security/keytabs/nn.service.keytab"));
+        hdfs_site.getProperty().add(getProperty ("dfs.datanode.keytab.file","/etc/security/keytabs/dn.service.keytab"));
+        hdfs_site.getProperty().add(getProperty ("dfs.https.port","50470"));
+        hdfs_site.getProperty().add(getProperty ("dfs.https.address","${HADOOP_NN_HOST}:50470"));
+        hdfs_site.getProperty().add(getProperty ("dfs.datanode.data.dir.perm","700"));
+        hdfs_site.getProperty().add(getProperty ("dfs.cluster.administrators","${HADOOP_HDFS_USER}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.permissions.superusergroup","${HADOOP_GROUP}"));
+        hdfs_site.getProperty().add(getProperty ("dfs.namenode.http-address","${HADOOP_NN_HOST}:50070"));
+        hdfs_site.getProperty().add(getProperty ("dfs.namenode.https-address","${HADOOP_NN_HOST}:50470"));
+        hdfs_site.getProperty().add(getProperty ("dfs.secondary.http.address","${HADOOP_SNN_HOST}:50090"));
+        hdfs_site.getProperty().add(getProperty ("dfs.hosts","${HADOOP_CONF_DIR}/dfs.include"));
+        hdfs_site.getProperty().add(getProperty ("dfs.hosts.exclude","${HADOOP_CONF_DIR}/dfs.exclude"));
+        
+        ConfigurationCategory hadoop_env = new ConfigurationCategory();
+        hadoop_env.setName("hadoop-env");
+        hadoop_env.getProperty().add(getProperty ("JAVA_HOME","${JAVA_HOME}"));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_CONF_DIR","${HADOOP_CONF_DIR:-\"/etc/hadoop\"}"));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_OPTS","\"-Djava.net.preferIPv4Stack=true
$HADOOP_OPTS\""));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_NAMENODE_OPTS","\"-Dsecurity.audit.logger=INFO,DRFAS
-Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_NAMENODE_OPTS}\""));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_JOBTRACKER_OPTS","\"-Dsecurity.audit.logger=INFO,DRFAS
-Dmapred.audit.logger=INFO,MRAUDIT -Dmapred.jobsummary.logger=INFO,JSA ${HADOOP_JOBTRACKER_OPTS}\""));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_TASKTRACKER_OPTS","\"-Dsecurity.audit.logger=ERROR,console
-Dmapred.audit.logger=ERROR,console ${HADOOP_TASKTRACKER_OPTS}\""));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_DATANODE_OPTS","\"-Dsecurity.audit.logger=ERROR,DRFAS
${HADOOP_DATANODE_OPTS}\""));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_SECONDARYNAMENODE_OPTS","\"-Dsecurity.audit.logger=INFO,DRFAS
-Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_SECONDARYNAMENODE_OPTS}\""));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_CLIENT_OPTS","\"-Xmx128m ${HADOOP_CLIENT_OPTS}\""));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_SECURE_DN_USER","${HADOOP_SECURE_DN_USER}"));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_LOG_DIR","${HADOOP_LOG_DIR}/$USER"));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_SECURE_DN_LOG_DIR","${HADOOP_LOG_DIR}/${HADOOP_HDFS_USER}"));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_PID_DIR","${HADOOP_PID_DIR}"));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_SECURE_DN_PID_DIR","${HADOOP_PID_DIR}"));
+        hadoop_env.getProperty().add(getProperty ("HADOOP_IDENT_STRING","$USER"));
+
+        ConfigurationCategory hadoop_metrics2 = new ConfigurationCategory();
+        hadoop_metrics2.setName("hadoop_metrics2.properties");
+        hadoop_metrics2.getProperty().add(getProperty ("*.period","60"));
         
         bpDefaultCfg.getCategory().add(core_site);
         bpDefaultCfg.getCategory().add(hdfs_site);
+        bpDefaultCfg.getCategory().add(hadoop_env);
+        bpDefaultCfg.getCategory().add(hadoop_metrics2);
         bpDefaultCfg.getCategory().add(ambari);
         
         bp.setConfiguration(bpDefaultCfg);
@@ -139,11 +207,11 @@ public class Blueprints {
         List<Role> hdfsRoleList = new ArrayList<Role>();
         Role hdfs_nn_role = new Role();
         hdfs_nn_role.setName("namenode");
-        hdfs_nn_role.setConfiguration(bpDefaultCfg);
+        //hdfs_nn_role.setConfiguration(bpDefaultCfg);
         
         Role hdfs_dn_role = new Role();
         hdfs_dn_role.setName("datanode");
-        hdfs_dn_role.setConfiguration(bpDefaultCfg);
+        //hdfs_dn_role.setConfiguration(bpDefaultCfg);
         
         hdfsRoleList.add(hdfs_nn_role);
         hdfsRoleList.add(hdfs_dn_role);
@@ -266,10 +334,28 @@ public class Blueprints {
     /*
      * Return list of blueprint names
      */
-    public JSONArray getBlueprintList() throws Exception {
-        List<String> list = new ArrayList<String>();
-        list.addAll(this.blueprints.keySet());
-        return new JSONArray(list);
+    public List<BlueprintInformation> getBlueprintList() throws Exception {
+        List<BlueprintInformation> list = new ArrayList<BlueprintInformation>();
+        for (String bpName : this.blueprints.keySet()) {
+            // Get the latest blueprint
+            Blueprint bp = this.getBlueprint(bpName, -1);
+            BlueprintInformation bpInfo = new BlueprintInformation();
+            // TODO: get the creation and update times from blueprint
+            bpInfo.setLastUpdateTime(null);
+            bpInfo.setCreationTime(null);
+            bpInfo.setName(bp.getName());
+            bpInfo.setRevision(bp.getRevision());
+            bpInfo.setParentName(bp.getParentName());
+            bpInfo.setParentRevision(bp.getParentRevision());
+            List<String> componentNameVersions = new ArrayList<String>();
+            for (Component com : bp.getComponents()) {
+                String comNameVersion = ""+com.getName()+"-"+com.getVersion();
+                componentNameVersions.add(comNameVersion);
+            }
+            bpInfo.setComponent(componentNameVersions);
+            list.add(bpInfo);
+        }
+        return list;
     }
     
     /*

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Nodes.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Nodes.java?rev=1185339&r1=1185338&r2=1185339&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Nodes.java
(original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Nodes.java
Mon Oct 17 19:24:55 2011
@@ -161,7 +161,7 @@ public class Nodes {
      * Get the node
      */
     public Node getNode (String name) throws Exception {
-        if (this.nodes.get(name) == null) {
+        if (!this.nodes.containsKey(name)) {
             String msg = "Node ["+name+"] does not exists";
             throw new WebApplicationException((new ExceptionResponse(msg, Response.Status.NOT_FOUND)).get());
         }

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java?rev=1185339&r1=1185338&r2=1185339&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java
(original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java
Mon Oct 17 19:24:55 2011
@@ -33,6 +33,7 @@ import javax.ws.rs.WebApplicationExcepti
 import javax.ws.rs.core.Response;
 
 import org.apache.ambari.common.rest.entities.Blueprint;
+import org.apache.ambari.common.rest.entities.BlueprintInformation;
 import org.apache.ambari.controller.Blueprints;
 import org.apache.ambari.controller.ExceptionResponse;
 import org.codehaus.jettison.json.JSONArray;
@@ -78,11 +79,11 @@ public class BlueprintsResource {
      */
     @GET
     @Produces({"application/json", "application/xml"})
-    public JSONArray listBlueprints() throws Exception {
-        JSONArray list;
+    public List<BlueprintInformation> listBlueprints() throws Exception {
+        List<BlueprintInformation> list;
         try {
             list = Blueprints.getInstance().getBlueprintList();
-            if (list.length() == 0) {
+            if (list.isEmpty()) {
                 throw new WebApplicationException(Response.Status.NO_CONTENT);
             } 
             return list;



Mime
View raw message