chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r787513 - in /hadoop/chukwa/trunk: ./ bin/ ivy/ src/java/org/apache/hadoop/chukwa/hicc/ src/test/org/apache/hadoop/chukwa/database/ src/web/hicc/ src/web/hicc/WEB-INF/ src/web/hicc/jsp/ src/web/hicc/jsp/workspace/
Date Tue, 23 Jun 2009 01:50:33 GMT
Author: eyang
Date: Tue Jun 23 01:50:33 2009
New Revision: 787513

URL: http://svn.apache.org/viewvc?rev=787513&view=rev
Log:
CHUKWA-308. Added capability to start hicc without tomcat. (Eric Yang)

Added:
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/HiccWebServer.java
    hadoop/chukwa/trunk/src/web/hicc/WEB-INF/jetty.xml
    hadoop/chukwa/trunk/src/web/hicc/iphone.jsp
Modified:
    hadoop/chukwa/trunk/CHANGES.txt
    hadoop/chukwa/trunk/bin/chukwa-config.sh
    hadoop/chukwa/trunk/bin/hicc.sh
    hadoop/chukwa/trunk/build.xml
    hadoop/chukwa/trunk/ivy.xml
    hadoop/chukwa/trunk/ivy/libraries.properties
    hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/database/TestDatabaseWebJson.java
    hadoop/chukwa/trunk/src/web/hicc/index.jsp
    hadoop/chukwa/trunk/src/web/hicc/jsp/debug.jsp
    hadoop/chukwa/trunk/src/web/hicc/jsp/get_db_data.jsp
    hadoop/chukwa/trunk/src/web/hicc/jsp/workspace/manage_view.jsp

Modified: hadoop/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/CHANGES.txt?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/CHANGES.txt (original)
+++ hadoop/chukwa/trunk/CHANGES.txt Tue Jun 23 01:50:33 2009
@@ -34,6 +34,8 @@
 
   IMPROVEMENTS
 
+    CHUKWA-308. Added capability to start hicc without tomcat. (Eric Yang)
+
     CHUKWA-326. If the chukwa records produce errors in post process, move to InErrorDirectory.
(Jerome Boulon via Eric Yang)
 
     CHUKWA-318. Added check for disk capacity for collector to write. (Jerome Boulon via
Eric Yang)

Modified: hadoop/chukwa/trunk/bin/chukwa-config.sh
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/bin/chukwa-config.sh?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/bin/chukwa-config.sh (original)
+++ hadoop/chukwa/trunk/bin/chukwa-config.sh Tue Jun 23 01:50:33 2009
@@ -100,6 +100,7 @@
 export COMMON=`echo ${COMMON} | sed 'y/ /:/'`
 export CHUKWA_CORE=${CHUKWA_HOME}/chukwa-core-${CHUKWA_VERSION}.jar
 export CHUKWA_AGENT=${CHUKWA_HOME}/chukwa-agent-${CHUKWA_VERSION}.jar
+export HICC_JAR=${CHUKWA_HOME}/hicc.war
 
 export CURRENT_DATE=`date +%Y%m%d%H%M`
 

Modified: hadoop/chukwa/trunk/bin/hicc.sh
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/bin/hicc.sh?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/bin/hicc.sh (original)
+++ hadoop/chukwa/trunk/bin/hicc.sh Tue Jun 23 01:50:33 2009
@@ -21,15 +21,26 @@
 
 . "$bin"/chukwa-config.sh
 
-trap '${CHUKWA_HOME}/opt/apache-tomcat-6.0.18/bin/shutdown.sh;rm -f ${CHUKWA_HOME}/var/run/hicc.pid;
exit 0' 1 2 15
-
-if [ "X$1" = "Xstop" ]; then
-  echo -n "Shutting down Hadoop Infrasture Care Center..."
-  ${CHUKWA_HOME}/opt/apache-tomcat-6.0.18/bin/shutdown.sh
+function stop {
+  echo -n "Shutting down HICC..."
+  ${JPS} | grep HiccWebServer | grep -v grep | grep -o '[^ ].*'| cut -f 1 -d" " | xargs kill
-TERM >&/dev/null
   echo "done"
   exit 0
+}
+
+trap stop SIGHUP SIGINT SIGTERM
+
+if [ "X$1" = "Xstop" ]; then
+  stop
 fi
 
-echo "${pid}" > "${CHUKWA_HOME}/var/run/hicc.pid"
+WEB_SERVICE_COMMON=`ls ${CHUKWA_HOME}/lib/*.jar ${CHUKWA_HOME}/webapps/hicc.war`
+WEB_SERVICE_COMMON=`echo ${WEB_SERVICE_COMMON}| sed 'y/ /:/'`
 
-${CHUKWA_HOME}/opt/apache-tomcat-6.0.18/bin/startup.sh
+exec ${JAVA_HOME}/bin/java -DAPP=hicc \
+                           -Dlog4j.configuration=chukwa-log4j.properties \
+                           -DCHUKWA_HOME=${CHUKWA_HOME} \
+                           -DCHUKWA_CONF_DIR=${CHUKWA_CONF_DIR} \
+                           -DCHUKWA_LOG_DIR=${CHUKWA_LOG_DIR} \
+                           -DCHUKWA_DATA_DIR=${CHUKWA_DATA_DIR} \
+                           -classpath ${CHUKWA_CONF_DIR}:${HADOOP_CONF_DIR}:${CLASSPATH}:${CHUKWA_CORE}:${WEB_SERVICE_COMMON}:${HADOOP_JAR}:${HICC_JAR}
org.apache.hadoop.chukwa.hicc.HiccWebServer

Modified: hadoop/chukwa/trunk/build.xml
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/build.xml?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/build.xml (original)
+++ hadoop/chukwa/trunk/build.xml Tue Jun 23 01:50:33 2009
@@ -92,6 +92,7 @@
 		<path id="testClasspath">
 			<pathelement location="${build.classes}" />
 			<pathelement location="${test.build.classes}" />
+			<pathelement location="${build.dir}/hicc.war" />
 			<pathelement location="${test.build.dir}/conf" />
 			<fileset dir="${lib.dir}">
 				<include name="**/*.jar" />
@@ -337,8 +338,10 @@
 		<property name="test.include" value="Test*" />
 		<property name="test.classpath.id" value="test.classpath" />
 		<property name="test.output" value="no" />
+		<property name="test.printsummary" value="on" />
+		<!-- property name="test.printsummary" value="withOutAndError" / -->
 		<property name="test.timeout" value="900000" />
-		<property name="test.junit.output.format" value="plain" />
+		<property name="test.junit.output.format" value="brief" />
 		<property name="test.junit.fork.mode" value="perTest" />
 		<property name="test.junit.printsummary" value="yes" />
 		<property name="test.junit.haltonfailure" value="yes" />
@@ -450,6 +453,7 @@
 		<copy todir="${test.build.dir}/var" failonerror="false">
 			<fileset dir="${basedir}/test/samples" />
 		</copy>
+                <copy file="${build.dir}/hicc.war" tofile="${test.build.dir}hicc.war"
/>
 	</target>
 
 	  <target name="compile-contrib" depends="compile-common,compile-datacollection,compile-extraction">
@@ -459,31 +463,30 @@
 	     </subant>  	
 	  </target>
 	
-	
-	<!--printsummary="${test.junit.printsummary}" -->
-
-	<target name="test-chukwa" depends="compile,compile-test" description="Run Chukwa unit
tests">
-		<mkdir dir="${basedir}/var" />
+	<target name="test-chukwa" depends="compile,compile-test,compress" description="Run Chukwa
unit tests">
 		<mkdir dir="${test.build.dir}/var" />
 		<mkdir dir="${test.build.dir}/var/log" />
+		<mkdir dir="${test.build.classes}/webapps" />
+		<mkdir dir="${test.build.classes}/logs" />
                 <copy todir="${test.build.dir}/var/log">
                         <fileset dir="${basedir}/test/samples/">
                                 <include name="*.log" />
                         </fileset>
                 </copy>
-                <copy todir="${test.build.dir}">
+                <copy todir="${test.build.classes}">
                         <fileset dir="${build.dir}">
                                 <include name="chukwa-core*.jar" />
                         </fileset>
                 </copy>
                 <copy file="${basedir}/conf/chukwa-demux-conf.xml.template" tofile="${test.build.dir}/conf/chukwa-demux-conf.xml"></copy>
                 <copy file="${basedir}/conf/log4j.properties" tofile="${test.build.dir}/conf/log4j.properties"></copy>
-		<junit showoutput="${test.output}" fork="yes" printsummary="withOutAndErr" forkmode="${test.junit.fork.mode}"
maxmemory="${test.junit.maxmemory}" dir="${test.build.dir}/classes/" timeout="${test.timeout}"
errorProperty="tests.failed" failureProperty="tests.failed">
+                <copy file="${build.dir}/hicc.war" tofile="${test.build.classes}/webapps/hicc.war"></copy>
+		<junit showoutput="${test.output}" fork="yes" printsummary="${test.printsummary}" forkmode="${test.junit.fork.mode}"
maxmemory="${test.junit.maxmemory}" dir="${test.build.dir}/classes/" timeout="${test.timeout}"
errorProperty="tests.failed" failureProperty="tests.failed">
 			<classpath refid="testClasspath" />
 			<env key="CHUKWA_CONF_DIR" value="${test.build.dir}/conf" />
 			<env key="CHUKWA_DATA_DIR" value="${test.build.dir}/var" />
 			<env key="CHUKWA_LOG_DIR" value="${test.build.dir}/var/log" />
-			<env key="CHUKWA_HOME" value="${test.build.dir}" />
+			<env key="CHUKWA_HOME" value="${test.build.classes}" />
 			<sysproperty key="test.src.dir" value="${test.src.dir}" />
 			<sysproperty key="test.build.classes" value="${test.build.classes}" />
 			<sysproperty key="log4j.configuration" value="log4j.properties" />
@@ -698,8 +701,13 @@
 			<fileset dir="${common.ivy.lib.dir}">
 				<include name="*.jar" />
 				<exclude name="jetty-*.jar" />
+				<!-- exclude name="junit-*.jar" / -->
+				<exclude name="standard*.jar" />
+<!-- start -->
 				<exclude name="jsp-api*.jar" />
-				<exclude name="junit-*.jar" />
+				<exclude name="servlet*.jar" />
+<!-- end -->
+				<exclude name="jstl*.jar" />
 			</fileset>
 			<fileset dir="${build.dir}">
 				<include name="${name}-core-${chukwaVersion}.jar" />
@@ -1105,19 +1113,27 @@
 		<mkdir dir="${build.dir}/${final.name}" />
 		<mkdir dir="${build.dir}/${final.name}/lib" />
 		<mkdir dir="${build.dir}/${final.name}/bin" />
-    <mkdir dir="${build.dir}/${final.name}/script" />
-    <mkdir dir="${build.dir}/${final.name}/script/pig" />
+                <mkdir dir="${build.dir}/${final.name}/script" />
+                <mkdir dir="${build.dir}/${final.name}/script/pig" />
 		<mkdir dir="${build.dir}/${final.name}/docs" />
 		<mkdir dir="${build.dir}/${final.name}/opt" />
 		<mkdir dir="${build.dir}/${final.name}/tools" />
 		<mkdir dir="${build.dir}/${final.name}/var" />
 		<mkdir dir="${build.dir}/${final.name}/var/run" />
 		<mkdir dir="${build.dir}/${final.name}/logs" />
+		<mkdir dir="${build.dir}/${final.name}/webapps" />
 
 		<copy todir="${build.dir}/${final.name}" includeEmptyDirs="false">
 			<fileset dir="${build.dir}">
 				<include name="*.jar" />
-				<include name="*.war" />
+				<include name="collector*.war" />
+			</fileset>
+		</copy>
+
+		<copy todir="${build.dir}/${final.name}/webapps" includeEmptyDirs="false">
+			<fileset dir="${build.dir}">
+				<include name="hicc*.war" />
+				<include name="chukwa*.war" />
 			</fileset>
 		</copy>
 
@@ -1170,6 +1186,12 @@
 			</fileset>
 		</chmod>
 
+		<chmod perm="ugo+x" type="file" parallel="false">
+			<fileset dir="${build.dir}/${final.name}/bin">
+				<include name="**" />
+			</fileset>
+		</chmod>
+
 		<copy todir="${build.dir}/${final.name}">
 			<fileset dir=".">
 				<include name="*.txt" />

Modified: hadoop/chukwa/trunk/ivy.xml
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/ivy.xml?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/ivy.xml (original)
+++ hadoop/chukwa/trunk/ivy.xml Tue Jun 23 01:50:33 2009
@@ -1,8 +1,8 @@
 <?xml version="1.0" ?>
 <ivy-module version="1.0">
-  <info organisation="org.apache.hadoop" module="${ant.project.name}">
+  <info organisation="org.apache.hadoop.chukwa" module="${ant.project.name}">
     <license name="Apache 2.0"/>
-    <ivyauthor name="Apache Hadoop Team" url="http://hadoop.apache.org"/>
+    <ivyauthor name="Apache Hadoop Chukwa Team" url="http://hadoop.apache.org/chukwa"/>
     <description>
         Apache Hadoop Chukwa
     </description>
@@ -72,28 +72,10 @@
       name="commons-net"
       rev="${commons-net.version}"
       conf="common->master"/> 
-    <dependency org="tomcat"
-      name="servlet-api"
-      rev="${servlet-api.version}"
-      conf="common->default"/>   
     <dependency org="org.mortbay.jetty"
       name="jetty"
       rev="${jetty.version}"
       conf="common->default"/>   
-<!-- Not able to figureout the version - resolving loaclly  -->
-<!--
-    <dependency org="org.json"
-      name="json"
-      rev="${json.version}"
-      conf="common->default"/>  
-    <dependency org="org.apache.tomcat"
-      name="jsp-api"
-      rev="${jsp-api.version}"
-      conf="common->default"/>
-    <dependency org="taglibs"
-      name="application"
-      rev="${taglibs.version}"
-      conf="common->default"/> -->
     <dependency org="org.mortbay.jetty"
       name="jetty-util"
       rev="${jetty-util.version}"
@@ -102,26 +84,10 @@
       name="junit"
       rev="${junit.version}"
       conf="common->default"/> 
-    <dependency org="tomcat"
-      name="servlet"
-      rev="${servlet.version}"
-      conf="common->default"/>   
     <dependency org="log4j"
       name="log4j"
       rev="${log4j.version}"
       conf="common->master"/>
-    <dependency org="taglibs"
-      name="standard"
-      rev="${taglibs.version}"
-      conf="common->default"/>
-    <dependency org="jspapi"
-      name="jsp-api"
-      rev="${jsp-api.version}"
-      conf="common->default"/>
-    <dependency org="jstl"
-      name="jstl"
-      rev="${jstl.version}"
-      conf="common->default"/>
     <dependency org="mysql"
       name="mysql-connector-java"
       rev="${mysql-connector.version}"
@@ -150,5 +116,29 @@
       name="commons-beanutils"
       rev="${commons-beanutils.version}"
       conf="common->default"/>
+    <dependency org="org.mortbay.jetty"
+      name="jsp-api-2.1"
+      rev="${jetty.version}"
+      conf="jetty->master"/>
+    <dependency org="org.mortbay.jetty"
+      name="jsp-2.1"
+      rev="${jetty.version}"
+      conf="jetty->master"/>
+    <dependency org="org.mortbay.jetty"
+      name="servlet-api-2.5"
+      rev="${jetty.version}"
+      conf="jetty->master"/>
+    <dependency org="org.apache.ant"
+      name="ant"
+      rev="${jetty.ant.version}"
+      conf="common->default"/>
+    <dependency org="org.eclipse.jdt"
+      name="core"
+      rev="${jetty.eclipse.jdt.core.version}"
+      conf="jetty->master"/>
+<!--    <dependency org="org.apache.tomcat"
+      name="jasper"
+      rev="${jasper.version}"
+      conf="jetty->master"/> -->
   </dependencies>
 </ivy-module>

Modified: hadoop/chukwa/trunk/ivy/libraries.properties
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/ivy/libraries.properties?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/ivy/libraries.properties (original)
+++ hadoop/chukwa/trunk/ivy/libraries.properties Tue Jun 23 01:50:33 2009
@@ -1,11 +1,7 @@
 #This properties file lists the versions of the various artifacts used by chukwa.
-
-
-
 hadoop.version=0.20.0-dev
 
-
-#These are the versions of our dependencies (in alphabetical order)
+#These are the versions of our dependencies
 commons-fileupload.version=1.2
 commons-httpclient.version=3.0.1
 commons-lang.version=2.4
@@ -16,27 +12,19 @@
 commons-net.version=1.4.1
 commons-logging-api.version=1.0.4
 commons-beanutils.version=1.8.0
+jasper.version=6.0.20
 
-#couldnt makeout the version of jsp-api
-#jsp-api.version=
 ivy.version=2.1.0-rc1
-# chukwa uses a diff. verion of jetty than the Hadoop
 jetty.version=6.1.11
 jetty-util.version=6.1.11
+jetty.eclipse.jdt.core.version=3.1.1
+jetty.ant.version=1.7.1
 
 junit.version=3.8.1
-
 log4j.version=1.2.13
-
-servlet.version=4.0.6
-servlet-api.version=5.5.12
 json-lib.version=2.2.3
 ezmorph.version=1.0.6
 
-# Not able to figureout the taglibs version 
-taglibs.version=1.1.2
-jsp-api.version=2.0
-jstl.version=1.1.2
 mysql-connector.version=5.1.6
 
 rats-lib.version=0.5.1

Added: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/HiccWebServer.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/HiccWebServer.java?rev=787513&view=auto
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/HiccWebServer.java (added)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/HiccWebServer.java Tue Jun
23 01:50:33 2009
@@ -0,0 +1,52 @@
+package org.apache.hadoop.chukwa.hicc;
+
+import java.io.File;
+import java.net.URL;
+
+import org.apache.hadoop.chukwa.util.DaemonWatcher;
+import org.apache.hadoop.chukwa.util.ExceptionUtil;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.ContextHandler;
+import org.mortbay.xml.XmlConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class HiccWebServer {
+  private static Log log = LogFactory.getLog(HiccWebServer.class);
+  private static URL serverConf = null;
+  private Server server = null;
+
+  public HiccWebServer() {
+    DaemonWatcher.createInstance("hicc");
+    serverConf = HiccWebServer.class.getResource("/WEB-INF/jetty.xml");
+    if(serverConf==null) {
+      log.error("Unable to locate jetty-web.xml.");
+      DaemonWatcher.bailout(-1);
+    }
+  }
+  
+  public void run() {
+    server = new Server();
+    XmlConfiguration configuration;
+    try {
+      configuration = new XmlConfiguration(serverConf);
+      configuration.configure(server);
+      server.start();
+    } catch (Exception e) {
+      log.error(ExceptionUtil.getStackTrace(e));
+    }     
+  }
+  
+  public void shutdown() {
+    try {
+      server.stop();
+      DaemonWatcher.bailout(0);
+    } catch (Exception e) {
+      log.error(ExceptionUtil.getStackTrace(e));
+    }
+  }
+  public static void main(String[] args) {
+    HiccWebServer hicc = new HiccWebServer();
+    hicc.run();
+  }
+}

Modified: hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/database/TestDatabaseWebJson.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/database/TestDatabaseWebJson.java?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/database/TestDatabaseWebJson.java
(original)
+++ hadoop/chukwa/trunk/src/test/org/apache/hadoop/chukwa/database/TestDatabaseWebJson.java
Tue Jun 23 01:50:33 2009
@@ -21,11 +21,16 @@
 import java.util.*;
 import java.text.*;
 import java.io.*;
+import java.net.URL;
 import java.sql.*;
 import org.apache.commons.httpclient.*;
 import org.apache.commons.httpclient.methods.*;
 import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.json.*;
+import org.mortbay.jetty.Server;
+import org.mortbay.xml.XmlConfiguration;
 import org.apache.hadoop.chukwa.util.*;
 
 /*
@@ -35,42 +40,64 @@
 public class TestDatabaseWebJson extends TestCase {
     protected HashMap testTables;
     protected String data_url="http://localhost:8080/hicc/jsp/get_db_data.jsp";
+    private Server server = null;
+    private Log log = LogFactory.getLog(TestDatabaseWebJson.class);
 
     /* 
      * setup list of tables to do testing. 
      * Add the table name and the table's primary keys.
      */
     protected void setUp() {
-	testTables = new HashMap();
+      testTables = new HashMap();
 
-	ArrayList<String> keys=new ArrayList<String>();
-	keys.add("timestamp");
-	keys.add("mount");
-	testTables.put("cluster_disk", keys);
-
-	keys=new ArrayList<String>();
-	keys.add("timestamp");
-	testTables.put("cluster_system_metrics", keys);
-
-	keys=new ArrayList<String>();
-	keys.add("timestamp");
-	keys.add("host");
-	keys.add("mount");
-	testTables.put("disk", keys);
-
-	keys=new ArrayList<String>();
-	keys.add("job_id");
-	testTables.put("mr_job", keys);
-
-	keys=new ArrayList<String>();
-	keys.add("task_id");
-	testTables.put("mr_task", keys);
-
-	keys=new ArrayList<String>();
-	keys.add("timestamp");
-	testTables.put("system_metrics", keys);
+      ArrayList<String> keys = new ArrayList<String>();
+      keys.add("timestamp");
+      keys.add("mount");
+      testTables.put("cluster_disk", keys);
+
+      keys = new ArrayList<String>();
+      keys.add("timestamp");
+      testTables.put("cluster_system_metrics", keys);
+
+      keys = new ArrayList<String>();
+      keys.add("timestamp");
+      keys.add("host");
+      keys.add("mount");
+      testTables.put("disk", keys);
+
+      keys = new ArrayList<String>();
+      keys.add("job_id");
+      testTables.put("mr_job", keys);
+
+      keys = new ArrayList<String>();
+      keys.add("task_id");
+      testTables.put("mr_task", keys);
+
+      keys = new ArrayList<String>();
+      keys.add("timestamp");
+      testTables.put("system_metrics", keys);
+      URL serverConf = TestDatabaseWebJson.class
+        .getResource("/WEB-INF/jetty.xml");
+      server = new Server();
+      XmlConfiguration configuration;
+      try {
+        configuration = new XmlConfiguration(serverConf);
+        configuration.configure(server);
+        server.start();
+        server.setStopAtShutdown(true);
+      } catch (Exception e) {
+        log.error(ExceptionUtil.getStackTrace(e));
+      }
     }
 
+    protected void tearDown() {
+      try {
+        server.stop();
+        Thread.sleep(2000);
+      } catch (Exception e) {
+        log.error(ExceptionUtil.getStackTrace(e));
+      }
+    }
 
     /*
      * similar to PHP join function to join a string array to one single string.
@@ -172,7 +199,7 @@
 	     * with the database
 	     */
 
-	    String cluster = "deploymenttest";
+	    String cluster = "demo";
 	    DatabaseWriter db = new DatabaseWriter(cluster);
 
 	    JSONArray json_array=new JSONArray(json_str);
@@ -208,9 +235,11 @@
 	    System.out.println("Exception: "+e.toString()+":"+e.getMessage());
 	    System.out.println("Exception: "+e.toString()+":"+e.getSQLState());
 	    System.out.println("Exception: "+e.toString()+":"+e.getErrorCode());
+            fail("SQL Error:"+ExceptionUtil.getStackTrace(e));
 	} catch (Exception eOther) {
 	    System.out.println("Other Exception: "+eOther.toString());
 	    eOther.printStackTrace();
+            fail("Error:"+ExceptionUtil.getStackTrace(eOther));
 	} finally {
 	}
     }

Added: hadoop/chukwa/trunk/src/web/hicc/WEB-INF/jetty.xml
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/WEB-INF/jetty.xml?rev=787513&view=auto
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/WEB-INF/jetty.xml (added)
+++ hadoop/chukwa/trunk/src/web/hicc/WEB-INF/jetty.xml Tue Jun 23 01:50:33 2009
@@ -0,0 +1,180 @@
+<?xml version="1.0"?>
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
+
+<!-- =============================================================== -->
+<!-- Configure the Jetty Server                                      -->
+<!--                                                                 -->
+<!-- Documentation of this file format can be found at:              -->
+<!-- http://docs.codehaus.org/display/JETTY/jetty.xml                -->
+<!--                                                                 -->
+<!-- =============================================================== -->
+
+
+<Configure id="Server" class="org.mortbay.jetty.Server">
+
+    <!-- =========================================================== -->
+    <!-- Server Thread Pool                                          -->
+    <!-- =========================================================== -->
+    <Set name="ThreadPool">
+
+      <New class="org.mortbay.thread.QueuedThreadPool">
+        <Set name="minThreads">10</Set>
+        <Set name="maxThreads">200</Set>
+        <Set name="lowThreads">20</Set>
+        <Set name="SpawnOrShrinkAt">2</Set>
+      </New>
+
+      <!-- Optional Java 5 bounded threadpool with job queue 
+      <New class="org.mortbay.thread.concurrent.ThreadPool">
+        <Set name="corePoolSize">50</Set>
+        <Set name="maximumPoolSize">50</Set>
+      </New>
+      -->
+    </Set>
+
+
+
+    <!-- =========================================================== -->
+    <!-- Set connectors                                              -->
+    <!-- =========================================================== -->
+    <!-- One of each type!                                           -->
+    <!-- =========================================================== -->
+
+    <!-- Use this connector for many frequently idle connections
+         and for threadless continuations.
+    -->    
+    <Call name="addConnector">
+      <Arg>
+          <New class="org.mortbay.jetty.nio.SelectChannelConnector">
+            <Set name="host"><SystemProperty name="jetty.host" /></Set>
+            <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
+            <Set name="maxIdleTime">30000</Set>
+            <Set name="Acceptors">2</Set>
+            <Set name="statsOn">false</Set>
+            <Set name="confidentialPort">8443</Set>
+	    <Set name="lowResourcesConnections">5000</Set>
+	    <Set name="lowResourcesMaxIdleTime">5000</Set>
+          </New>
+      </Arg>
+    </Call>
+
+    <!-- Use this connector if NIO is not available. 
+    <Call name="addConnector">
+      <Arg>
+          <New class="org.mortbay.jetty.bio.SocketConnector">
+            <Set name="port">8081</Set>
+            <Set name="maxIdleTime">50000</Set>
+            <Set name="lowResourceMaxIdleTime">1500</Set>
+          </New>
+      </Arg>
+    </Call>
+    -->
+
+    <!-- =========================================================== -->
+    <!-- Set up global session ID manager                            -->
+    <!-- =========================================================== -->
+    <!--
+    <Set name="sessionIdManager">
+      <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
+        <Set name="workerName">node1</Set>
+      </New>
+    </Set>
+    -->
+
+    <!-- =========================================================== -->
+    <!-- Set handler Collection Structure                            --> 
+    <!-- =========================================================== -->
+    <Set name="handler">
+      <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
+        <Set name="handlers">
+         <Array type="org.mortbay.jetty.Handler">
+           <Item>
+             <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
+           </Item>
+           <Item>
+             <New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
+           </Item>
+           <Item>
+             <New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
+           </Item>
+         </Array>
+        </Set>
+      </New>
+    </Set>
+    
+    <!-- =========================================================== -->
+    <!-- Configure the context deployer                              -->
+    <!-- A context deployer will deploy contexts described in        -->
+    <!-- configuration files discovered in a directory.              -->
+    <!-- The configuration directory can be scanned for hot          -->
+    <!-- deployments at the configured scanInterval.                 -->
+    <!--                                                             -->
+    <!-- This deployer is configured to deploy contexts configured   -->
+    <!-- in the $JETTY_HOME/contexts directory                       -->
+    <!--                                                             -->
+    <!-- =========================================================== -->
+    <Call name="addLifeCycle">
+      <Arg>
+        <New class="org.mortbay.jetty.deployer.ContextDeployer">
+          <Set name="contexts"><Ref id="Contexts"/></Set>
+          <Set name="configurationDir"><SystemProperty name="CHUKWA_HOME" default="."/>/contexts</Set>
+          <Set name="scanInterval">1</Set>
+        </New>
+      </Arg>
+    </Call>
+
+    <!-- =========================================================== -->
+    <!-- Configure the webapp deployer.                              -->
+    <!-- A webapp  deployer will deploy standard webapps discovered  -->
+    <!-- in a directory at startup, without the need for additional  -->
+    <!-- configuration files.    It does not support hot deploy or   -->
+    <!-- non standard contexts (see ContextDeployer above).          -->
+    <!--                                                             -->
+    <!-- This deployer is configured to deploy webapps from the      -->
+    <!-- $JETTY_HOME/webapps directory                               -->
+    <!--                                                             -->
+    <!-- Normally only one type of deployer need be used.            -->
+    <!--                                                             -->
+    <!-- =========================================================== -->
+    <Call name="addLifeCycle">
+      <Arg>
+        <New class="org.mortbay.jetty.deployer.WebAppDeployer">
+          <Set name="contexts"><Ref id="Contexts"/></Set>
+          <Set name="webAppDir"><SystemProperty name="CHUKWA_HOME" default="."/>/webapps</Set>
+	  <Set name="parentLoaderPriority">false</Set>
+	  <Set name="extract">true</Set>
+	  <Set name="allowDuplicates">false</Set>
+        </New>
+      </Arg>
+    </Call>
+
+    <!-- =========================================================== -->
+    <!-- Configure Request Log                                       -->
+    <!-- Request logs  may be configured for the entire server here, -->
+    <!-- or they can be configured for a specific web app in a       -->
+    <!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
+    <!-- for an example).                                            -->
+    <!-- =========================================================== -->
+    <Ref id="RequestLog">
+      <Set name="requestLog">
+        <New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
+          <Set name="filename"><SystemProperty name="CHUKWA_LOG_DIR" default="./logs"/>/yyyy_mm_dd.request.log</Set>
+          <Set name="filenameDateFormat">yyyy_MM_dd</Set>
+          <Set name="retainDays">90</Set>
+          <Set name="append">true</Set>
+          <Set name="extended">true</Set>
+          <Set name="logCookies">false</Set>
+          <Set name="LogTimeZone">GMT</Set>
+        </New>
+      </Set>
+    </Ref>
+
+    <!-- =========================================================== -->
+    <!-- extra options                                               -->
+    <!-- =========================================================== -->
+    <Set name="stopAtShutdown">true</Set>
+    <Set name="sendServerVersion">true</Set>
+    <Set name="sendDateHeader">true</Set>
+    <Set name="gracefulShutdown">1000</Set>
+
+</Configure>

Modified: hadoop/chukwa/trunk/src/web/hicc/index.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/index.jsp?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/index.jsp (original)
+++ hadoop/chukwa/trunk/src/web/hicc/index.jsp Tue Jun 23 01:50:33 2009
@@ -17,7 +17,7 @@
  * limitations under the License.
  */
 %>
-<%@ page import = "javax.servlet.http.*, java.sql.*,java.io.*, java.util.Calendar, java.util.Date,
java.text.SimpleDateFormat, java.util.regex.Pattern, java.util.regex.Matcher, java.util.*,
org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.XssFilter"
 %>
+<%@ page import = "java.sql.*,java.io.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat,
java.util.regex.Pattern, java.util.regex.Matcher, java.util.*, org.apache.hadoop.chukwa.hicc.ClusterConfig,
org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.XssFilter"  %>
 <%
     XssFilter xf = new XssFilter(request);
     for (Enumeration e = request.getParameterNames() ; e.hasMoreElements() ;) {

Added: hadoop/chukwa/trunk/src/web/hicc/iphone.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/iphone.jsp?rev=787513&view=auto
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/iphone.jsp (added)
+++ hadoop/chukwa/trunk/src/web/hicc/iphone.jsp Tue Jun 23 01:50:33 2009
@@ -0,0 +1,158 @@
+<%@ page import = "org.json.*, java.net.*, java.io.*, java.util.*, org.apache.hadoop.chukwa.hicc.ClusterConfig,
org.apache.hadoop.chukwa.hicc.TimeHandler"  %>
+<% 
+    session.setAttribute("time_zone","UTC");
+    session.setAttribute("start","1209400695191");
+    session.setAttribute("end","1209404295191");
+    if(session.getAttribute("cluster")==null) {
+        ClusterConfig cc = new ClusterConfig();
+        Iterator ci = cc.getClusters();
+        String cluster = (String) ci.next();
+        session.setAttribute("cluster", cluster);
+    }
+    if(session.getAttribute("period")==null) {
+        session.setAttribute("period","last1hr");
+    }
+    String machine="";
+    if(session.getAttribute("hosts")==null) {
+        session.setAttribute("hosts",machine);
+    }
+    if(session.getAttribute("time_type")==null) {
+        session.setAttribute("time_type","last");
+    }
+    String view_name = "default";
+    if(request.getParameter("view")!=null) {
+        view_name=request.getParameter("view");
+    }
+    TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone"));
+        StringBuffer contents = new StringBuffer();
+        try {
+          //use buffering, reading one line at a time
+          //FileReader always assumes default encoding is OK!
+          FileInputStream url = new FileInputStream(System.getProperty("CHUKWA_DATA_DIR")+"/views/"+view_name+".view");
+          DataInputStream in = new DataInputStream(url);
+          String inputLine;
+          while ((inputLine = in.readLine()) != null) {
+                contents.append(inputLine);
+                contents.append(System.getProperty("line.separator"));
+          }
+          in.close();
+        } catch (IOException ex){
+          ex.printStackTrace();
+        }
+        JSONObject view = new JSONObject(contents.toString());
+
+        StringBuffer contents2 = new StringBuffer();
+        try {
+          //use buffering, reading one line at a time
+          //FileReader always assumes default encoding is OK!
+          FileInputStream url2 = new FileInputStream(System.getProperty("CHUKWA_DATA_DIR")+"/views/workspace_view_list.cache");
+          DataInputStream in2 = new DataInputStream(url2);
+          String inputLine2;
+          while ((inputLine2 = in2.readLine()) != null) {
+                contents2.append(inputLine2);
+                contents2.append(System.getProperty("line.separator"));
+          }
+          in2.close();
+        } catch (IOException ex){
+          ex.printStackTrace();
+        }
+        JSONArray views = new JSONArray(contents2.toString());
+%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Hadoop Infrastructure Care Center</title>
+<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+<style type="text/css" media="screen">@import "css/iui.css";</style>
+<script type="text/javascript" src="/hicc/js/workspace/prototype.js"></script>
+<script type="text/javascript" src="/hicc/js/calendar.js"></script>
+<script type="text/javascript" src="/hicc/js/timeframe.js"></script>
+<script type="text/javascript" src="/hicc/js/lang/calendar-en.js"></script>
+<script type="text/javascript" src="/hicc/js/calendar-setup.js"></script>
+<script type="text/javascript" src="/hicc/js/workspace/scriptaculous.js"></script>
+<script type="text/javascript" src="/hicc/js/workspace/effects.js"></script>
+<script type="text/javascript" src="/hicc/js/workspace/dragdrop.js"></script>
+<script type="text/javascript" src="/hicc/js/time.js"></script>
+<script type="application/x-javascript" src="js/iui.js"></script>
+<script type="application/x-javascript" src="js/workspace/workspace.js"></script>
+<script type="text/javascript" src="/hicc/js/slider.js"></script>
+<script type="text/javascript" src="/hicc/js/swfobject.js"></script>
+
+<script type="application/x-javascript">
+function render_widget(url) {
+    myAjax=new Ajax.Request(
+        url,
+        {
+            method: 'get',
+            asynchronous: true,
+            onSuccess: function(transport) {
+                loadContentComplete(transport);
+            },
+            onFailure: function(error) {
+                alert(error);
+            },
+        });
+}
+</script>
+</head>
+
+<body onclick="console.log('Hello', event.target);">
+    <div class="toolbar">
+        <h1 id="pageTitle"></h1>
+        <a id="backButton" class="button" href="#"></a>
+        <a class="button" href="#viewForm">Views</a>
+    </div>
+    <ul id="home" title="HICC" selected="true">
+        <% for(int i=0;i<((JSONArray)view.get("pages")).length();i++) {
+               String title = (String)((JSONObject)((JSONArray)view.get("pages")).get(i)).get("title");
%>
+        <li><a href="#<%=i%>"><%= title %></a></li>
+        <% } %>
+    </ul>
+    <% for(int i=0;i<((JSONArray)view.get("pages")).length();i++) {
+           String title = (String)((JSONObject)((JSONArray)view.get("pages")).get(i)).get("title");
%>
+    <ul id="<%= i %>" title="<%= title %>">
+<%         JSONArray column = (JSONArray)((JSONObject)((JSONArray)view.get("pages")).get(i)).get("layout");
+           for(int c=0;c<column.length();c++) {
+               JSONArray widgets = (JSONArray)column.get(c);
+               for(int j=0;j<widgets.length();j++) { 
+                   String widget_title = (String)((JSONObject)widgets.get(j)).get("title");

+                   String widget_url = (String)((JSONObject)widgets.get(j)).get("module");
+                   JSONArray widget_param = (JSONArray)((JSONObject)widgets.get(j)).get("parameters");
+                   String widget_parms = "";
+                   for(int p=0;p<widget_param.length();p++) {
+                       JSONObject parm = (JSONObject)widget_param.get(p);
+                       if(parm.get("name").getClass()!=parm.get("value").getClass()) {
+                           JSONArray values = (JSONArray)parm.get("value");
+                           for(int v=0;v<values.length();v++) {
+                               widget_parms+="&";
+                               widget_parms+=(String)parm.get("name")+"=";
+                               widget_parms+=URLEncoder.encode((String)values.get(v));
+                           }
+                       } else {
+                           widget_parms+="&";
+                           widget_parms+=(String)parm.get("name")+"=";
+                           widget_parms+=URLEncoder.encode((String)parm.get("value"));
+                       }
+                   }
+                   widget_parms+="&boxId=999_999";
+%>
+        <li><a href="#999_999" onclick="render_widget('<%=widget_url%>?<%=widget_parms%>');"><%=
widget_title %></a></li>
+           <%  }
+           } %>
+    </ul>
+    <% } %>
+
+                <ul id="viewForm" title="Views">
+<% for(int v=0;v<views.length();v++) { %>
+                    <li><a href="iphone.jsp?view=<%= ((JSONObject)views.get(v)).get("key")
%>" target="_self"><%= ((JSONObject)views.get(v)).get("description") %></a></li>
+<% } %>
+                </ul>
+<div id="999_999" title="Widget" class="panel">
+<div id="dragableBoxContent999_999"></div>
+<div id="dragableBoxHeader999_999"></div>
+<div id="dragableBoxStatusBar999_999"></div>
+</div>
+</body>
+</html>

Modified: hadoop/chukwa/trunk/src/web/hicc/jsp/debug.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/jsp/debug.jsp?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/jsp/debug.jsp (original)
+++ hadoop/chukwa/trunk/src/web/hicc/jsp/debug.jsp Tue Jun 23 01:50:33 2009
@@ -17,7 +17,7 @@
  * limitations under the License.
  */
 %>
-<%@ page import = "javax.servlet.http.*, java.sql.*,java.io.*, java.util.Calendar, java.util.Date,
java.text.SimpleDateFormat, java.util.*, org.apache.tomcat.util.http.Parameters" %>
+<%@ page import = "javax.servlet.http.*, java.sql.*,java.io.*, java.util.Calendar, java.util.Date,
java.text.SimpleDateFormat, java.util.*" %>
 <%
        for (Enumeration e = session.getAttributeNames() ; e.hasMoreElements() ;) {
            String name = (String) e.nextElement();

Modified: hadoop/chukwa/trunk/src/web/hicc/jsp/get_db_data.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/jsp/get_db_data.jsp?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/jsp/get_db_data.jsp (original)
+++ hadoop/chukwa/trunk/src/web/hicc/jsp/get_db_data.jsp Tue Jun 23 01:50:33 2009
@@ -17,7 +17,22 @@
  * limitations under the License.
  */
 %>
-<%@ page import = "java.text.DecimalFormat,java.text.NumberFormat,java.sql.*,java.io.*,
org.json.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, org.apache.hadoop.chukwa.hicc.ClusterConfig,
org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.DatabaseWriter, org.apache.hadoop.chukwa.database.Macro,
org.apache.hadoop.chukwa.util.XssFilter, org.apache.hadoop.chukwa.database.DatabaseConfig,
org.apache.hadoop.chukwa.hicc.DatasetMapper"  %> 
+<%@ page import = "java.text.DecimalFormat" %>
+<%@ page import = "java.text.NumberFormat" %>
+<%@ page import = "java.sql.*" %>
+<%@ page import = "java.io.*" %>
+<%@ page import = "org.json.*" %>
+<%@ page import = "java.util.Calendar" %>
+<%@ page import = "java.util.Date" %>
+<%@ page import = "java.text.SimpleDateFormat" %>
+<%@ page import = "java.util.*" %>
+<%@ page import = "org.apache.hadoop.chukwa.hicc.ClusterConfig" %>
+<%@ page import = "org.apache.hadoop.chukwa.hicc.TimeHandler" %>
+<%@ page import = "org.apache.hadoop.chukwa.util.DatabaseWriter" %>
+<%@ page import = "org.apache.hadoop.chukwa.database.Macro" %>
+<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %>
+<%@ page import = "org.apache.hadoop.chukwa.database.DatabaseConfig" %>
+<%@ page import = "org.apache.hadoop.chukwa.hicc.DatasetMapper"  %> 
 <%
     /* get the passed in parameters */
     String table=request.getParameter("table");
@@ -25,7 +40,7 @@
     String endDate=request.getParameter("end");		// in long format
 
 
-
+    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     Date startDateObj=new Date(Long.parseLong(startDate));
     String startDateString = sdf.format(startDateObj);
 
@@ -46,10 +61,10 @@
 	
     Macro m=new Macro(Long.parseLong(startDate),Long.parseLong(endDate),query);
 
-    String cluster="deploymenttest";
+    String cluster="demo";
     DatabaseWriter db = new DatabaseWriter(cluster);
 
-    String jsonString="{}";
+    String jsonString="[]";
 
     try {
 	// first get the table

Modified: hadoop/chukwa/trunk/src/web/hicc/jsp/workspace/manage_view.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/web/hicc/jsp/workspace/manage_view.jsp?rev=787513&r1=787512&r2=787513&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/web/hicc/jsp/workspace/manage_view.jsp (original)
+++ hadoop/chukwa/trunk/src/web/hicc/jsp/workspace/manage_view.jsp Tue Jun 23 01:50:33 2009
@@ -77,9 +77,9 @@
     </c:forEach>
     </select>
   </td><td align="middle">
-    <input type='checkbox' class='formCheckbox' id='read_permission' name='read_permission'
${permission.[permissionKey].read ? "checked":""}>
+    <input type='checkbox' class='formCheckbox' id='read_permission' name='read_permission'>
   </td><td align="middle">
-    <input type='checkbox' class='formCheckbox' id='modify_permission' name='modify_permission'
${permission.[permissionKey].modify ? "checked":""}>
+    <input type='checkbox' class='formCheckbox' id='modify_permission' name='modify_permission'>
   </td><td>
     <img src='/sim/images/close16.gif' onClick="deleteCurrentRow('${key}',this);"/>
   </td></tr>



Mime
View raw message