incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hit...@apache.org
Subject svn commit: r1402922 - in /incubator/ambari/branches/AMBARI-666: ./ ambari-server/src/main/java/org/apache/ambari/server/controller/ ambari-server/src/test/java/org/apache/ambari/server/controller/
Date Sun, 28 Oct 2012 01:30:48 GMT
Author: hitesh
Date: Sun Oct 28 01:30:48 2012
New Revision: 1402922

URL: http://svn.apache.org/viewvc?rev=1402922&view=rev
Log:
AMBARI-938. Hardcode service name and client component mapping while
awaiting meta data integration. (Contributed by hitesh)

Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java

Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1402922&r1=1402921&r2=1402922&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Sun Oct 28 01:30:48 2012
@@ -12,6 +12,9 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-938. Hardcode service name and client component mapping while
+  awaiting meta data integration. (hitesh)
+
   AMBARI-927. Provide metrics graphs on the MapReduce services page. 
   (Srimanth Gunturi via yusaku)
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java?rev=1402922&r1=1402921&r2=1402922&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
(original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
Sun Oct 28 01:30:48 2012
@@ -514,6 +514,82 @@ public class AmbariManagementControllerI
     }
   }
 
+  private boolean hackisClientComponent(String componentName)
+      throws AmbariException {
+    if (componentName == null
+        || componentName.isEmpty()) {
+      throw new AmbariException("Found invalid component name when looking up"
+          + " whether component is a client"
+          + ", componentName=" + componentName);
+    }
+    boolean isClient = false;
+    if (componentName.equals("ZOOKEEPER_CLIENT")
+        || componentName.equals("HDFS_CLIENT")
+        || componentName.equals("HBASE_CLIENT")
+        || componentName.equals("MAPREDUCE_CLIENT")
+        || componentName.equals("KERBEROS_CLIENT")
+        || componentName.equals("KERBEROS_ADMIN_CLIENT")
+        || componentName.equals("HIVE_CLIENT")
+        || componentName.equals("HCAT")
+        || componentName.equals("OOZIE_CLIENT")
+        || componentName.equals("PIG")
+        || componentName.equals("SQOOP")
+        || componentName.equals("TEMPLETON_CLIENT")) {
+      isClient = true;
+    }
+    if (componentName.indexOf("_CLIENT") > 0) {
+      isClient = true;
+    }
+    LOG.debug("Looking up is client component"
+        + ", componentName=" + componentName
+        + ", isClient=" + isClient);
+    return isClient;
+  }
+
+  private String hackGetServiceName(String componentName)
+      throws AmbariException {
+    if (componentName == null
+        || componentName.isEmpty()) {
+      throw new AmbariException("Found invalid component name when looking up"
+          + " service"
+          + ", componentName=" + componentName);
+    }
+    if (componentName.equals("ZOOKEEPER_SERVER")) return "ZOOKEEPER";
+    if (componentName.equals("ZOOKEEPER_CLIENT")) return "ZOOKEEPER";
+    if (componentName.equals("NAMENODE")) return "HDFS";
+    if (componentName.equals("DATANODE")) return "HDFS";
+    if (componentName.equals("SECONDARY_NAMENODE")) return "HDFS";
+    if (componentName.equals("HDFS_CLIENT")) return "HDFS";
+    if (componentName.equals("HBASE_MASTER")) return "HBASE";
+    if (componentName.equals("HBASE_REGIONSERVER")) return "HBASE";
+    if (componentName.equals("HBASE_CLIENT")) return "HBASE";
+    if (componentName.equals("JOBTRACKER")) return "MAPREDUCE";
+    if (componentName.equals("TASKTRACKER")) return "MAPREDUCE";
+    if (componentName.equals("MAPREDUCE_CLIENT")) return "MAPREDUCE";
+    if (componentName.equals("JAVA_JCE")) return "";
+    if (componentName.equals("KERBEROS_SERVER")) return "KERBEROS";
+    if (componentName.equals("KERBEROS_CLIENT")) return "KERBEROS";
+    if (componentName.equals("KERBEROS_ADMIN_CLIENT")) return "KERBEROS";
+    if (componentName.equals("MYSQL_SERVER")) return "HIVE";
+    if (componentName.equals("HIVE_SERVER")) return "HIVE";
+    if (componentName.equals("HIVE_CLIENT")) return "HIVE";
+    if (componentName.equals("HCAT")) return "HCAT";
+    if (componentName.equals("OOZIE_CLIENT")) return "OOZIE";
+    if (componentName.equals("OOZIE_SERVER")) return "OOZIE";
+    if (componentName.equals("PIG")) return "PIG";
+    if (componentName.equals("SQOOP")) return "SQOOP";
+    if (componentName.equals("TEMPLETON_CLIENT")) return "TEMPLETON";
+    if (componentName.equals("TEMPLETON_SERVER")) return "TEMPLETON";
+    if (componentName.equals("DASHBOARD")) return "DASHBOARD";
+    if (componentName.equals("NAGIOS_SERVER")) return "NAGIOS";
+    if (componentName.equals("GANGLIA_SERVER")) return "GANGLIA";
+    if (componentName.equals("GANGLIA_MONITOR")) return "GANGLIA";
+    if (componentName.equals("MONTOR_WEBSERVER")) return "GANGLIA";
+    throw new AmbariException("Found invalid component name when looking up"
+        + " service"
+        + ", componentName=" + componentName);
+  }
+
   @Override
   public synchronized void createHostComponents(Set<ServiceComponentHostRequest> requests)
       throws AmbariException {
@@ -542,9 +618,12 @@ public class AmbariManagementControllerI
       if (request.getServiceName() == null
           || request.getServiceName().isEmpty()
         ) {
-        // FIXME get service name from meta data lib?
-        // Major boo-boo if component names are not unique
-        request.setServiceName("HDFS");
+        String serviceName =
+            hackGetServiceName(request.getComponentName());
+        LOG.debug("Looking up service name for component"
+            + ", componentName=" + request.getComponentName()
+            + ", serviceName=" + serviceName);
+        request.setServiceName(serviceName);
       }
 
       if (LOG.isDebugEnabled()) {
@@ -679,12 +758,7 @@ public class AmbariManagementControllerI
 
       // FIXME meta-data integration needed here
       // for now lets hack it up
-      boolean isClient = true;
-      if (sc.getName().equals("NAMENODE")
-          || sc.getName().equals("DATANODE")
-          || sc.getName().equals("SECONDARY_NAMENODE")) {
-        isClient = false;
-      }
+      boolean isClient = hackisClientComponent(sc.getName());
 
       ServiceComponentHost sch =
           serviceComponentHostFactory.createNew(sc, request.getHostname(),

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java?rev=1402922&r1=1402921&r2=1402922&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
(original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
Sun Oct 28 01:30:48 2012
@@ -667,7 +667,8 @@ public class AmbariManagementControllerT
       // Expected
     }
 
-    createServiceComponentHost(clusterName, serviceName, componentName1,
+    // null service should work
+    createServiceComponentHost(clusterName, null, componentName1,
         host1, null);
     createServiceComponentHost(clusterName, serviceName, componentName2,
         host1, null);



Mime
View raw message