You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hcatalog-commits@incubator.apache.org by ga...@apache.org on 2013/01/02 18:05:48 UTC

svn commit: r1427885 - in /incubator/hcatalog/trunk: ./ build-support/ant/ build-support/checkstyle/ conf/ webhcat/svr/ webhcat/svr/src/main/bin/ webhcat/svr/src/main/config/ webhcat/svr/src/main/java/org/apache/hcatalog/templeton/

Author: gates
Date: Wed Jan  2 18:05:47 2013
New Revision: 1427885

URL: http://svn.apache.org/viewvc?rev=1427885&view=rev
Log:
HCATALOG-549 rename webhcat config and shell scripts to use webhcat in the names

Added:
    incubator/hcatalog/trunk/webhcat/svr/src/main/bin/webhcat_config.sh
    incubator/hcatalog/trunk/webhcat/svr/src/main/bin/webhcat_server.sh
    incubator/hcatalog/trunk/webhcat/svr/src/main/config/
    incubator/hcatalog/trunk/webhcat/svr/src/main/config/webhcat-default.xml
    incubator/hcatalog/trunk/webhcat/svr/src/main/config/webhcat-log4j.properties
Removed:
    incubator/hcatalog/trunk/conf/templeton-default.xml
    incubator/hcatalog/trunk/conf/templeton-log4j.properties
    incubator/hcatalog/trunk/webhcat/svr/src/main/bin/templeton_config.sh
    incubator/hcatalog/trunk/webhcat/svr/src/main/bin/templeton_server.sh
Modified:
    incubator/hcatalog/trunk/CHANGES.txt
    incubator/hcatalog/trunk/build-support/ant/build-common.xml
    incubator/hcatalog/trunk/build-support/ant/deploy.xml
    incubator/hcatalog/trunk/build-support/checkstyle/apache_header.txt
    incubator/hcatalog/trunk/build.xml
    incubator/hcatalog/trunk/pom.xml
    incubator/hcatalog/trunk/webhcat/svr/build.xml
    incubator/hcatalog/trunk/webhcat/svr/pom.xml
    incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java

Modified: incubator/hcatalog/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/CHANGES.txt?rev=1427885&r1=1427884&r2=1427885&view=diff
==============================================================================
--- incubator/hcatalog/trunk/CHANGES.txt (original)
+++ incubator/hcatalog/trunk/CHANGES.txt Wed Jan  2 18:05:47 2013
@@ -55,6 +55,8 @@ Release 0.5.0 - Unreleased
   HCAT-427 Document storage-based authorization (lefty via gates)
 
   IMPROVEMENTS
+  HCAT-549 rename webhcat config and shell scripts to use webhcat in the names (thejas via gates)
+
   HCAT-446 Enforce apache headers for all HCatalog code (traviscrawford via gates)
 
   HCAT-564 test.sh should let users specify the ant version (traviscrawford)

Modified: incubator/hcatalog/trunk/build-support/ant/build-common.xml
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/build-support/ant/build-common.xml?rev=1427885&r1=1427884&r2=1427885&view=diff
==============================================================================
--- incubator/hcatalog/trunk/build-support/ant/build-common.xml (original)
+++ incubator/hcatalog/trunk/build-support/ant/build-common.xml Wed Jan  2 18:05:47 2013
@@ -61,6 +61,17 @@
     <delete dir="${build.dir}"/>
   </target>
 
+  <!--
+       Empty target, override in subproject to do any additional
+       specific resource compilation in subprojects.
+       Webhcat server overrides it.
+  -->
+  <target name="compile-resource">
+    <echo message="${ant.project.name}"/>
+    <echo message="Empty default compile-resource target"/>
+  </target>
+
+
   <target name="compile">
     <echo message="${ant.project.name}"/>
     <_javac srcDir="${basedir}/src/main/java"
@@ -80,7 +91,7 @@
     <_junit srcDir="${basedir}/src/test/java"/>
   </target>
 
-  <target name="jar" depends="mvn-dependencies,compile,mvn-init">
+  <target name="jar" depends="mvn-dependencies,compile,compile-resource">
     <echo message="${ant.project.name}"/>
     <jar jarfile="${build.dir}/${jar.name}" basedir="${build.classes}">
       <metainf dir="${path.to.basedir}" includes="**/LICENSE.txt,**/NOTICE.txt"/>

Modified: incubator/hcatalog/trunk/build-support/ant/deploy.xml
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/build-support/ant/deploy.xml?rev=1427885&r1=1427884&r2=1427885&view=diff
==============================================================================
--- incubator/hcatalog/trunk/build-support/ant/deploy.xml (original)
+++ incubator/hcatalog/trunk/build-support/ant/deploy.xml Wed Jan  2 18:05:47 2013
@@ -72,6 +72,15 @@
             <path refid="mvn.compile.classpath"/>
         </copy>
 
+        <artifact:dependencies pathId="mvn.provided.classpath"
+          scopes="provided" pomRefId="mvn.pom">
+            <localRepository path="${mvn.local.repo}"/>
+        </artifact:dependencies>
+        <mkdir dir="${build.dir}/lib/provided"/>
+        <copy todir="${build.dir}/lib/provided">
+            <path refid="mvn.provided.classpath"/>
+        </copy>
+
         <artifact:dependencies pathId="mvn.test.classpath"
           scopes="compile, test" pomRefId="mvn.pom">
             <localRepository path="${mvn.local.repo}"/>

Modified: incubator/hcatalog/trunk/build-support/checkstyle/apache_header.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/build-support/checkstyle/apache_header.txt?rev=1427885&r1=1427884&r2=1427885&view=diff
==============================================================================
--- incubator/hcatalog/trunk/build-support/checkstyle/apache_header.txt (original)
+++ incubator/hcatalog/trunk/build-support/checkstyle/apache_header.txt Wed Jan  2 18:05:47 2013
@@ -16,4 +16,4 @@
 ^\W*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY$
 ^\W*KIND, either express or implied.  See the License for the$
 ^\W*specific language governing permissions and limitations$
-^\W*under the License.$
\ No newline at end of file
+^\W*under the License.$

Modified: incubator/hcatalog/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/build.xml?rev=1427885&r1=1427884&r2=1427885&view=diff
==============================================================================
--- incubator/hcatalog/trunk/build.xml (original)
+++ incubator/hcatalog/trunk/build.xml Wed Jan  2 18:05:47 2013
@@ -95,7 +95,6 @@
         <ant target="test" dir="webhcat/svr" inheritAll="false"/>
         <ant target="test" dir="webhcat/java-client" inheritAll="false"/>
         <ant target="test" dir="storage-handlers/hbase" inheritAll="false"/>
-
         <!-- One checkstyle run for the whole repo. Runs after junit tests
         to piggyback on resolved jars. -->
         <path id="checkstyle.class.path">
@@ -198,9 +197,13 @@
             <classpath>
                 <fileset dir="core/build/lib/compile"/>
                 <fileset dir="hcatalog-pig-adapter/build/lib/compile"/>
+                <fileset dir="hcatalog-pig-adapter/build/lib/provided"/>
                 <fileset dir="server-extensions/build/lib/compile"/>
+                <fileset dir="server-extensions/build/lib/provided"/>
                 <fileset dir="storage-handlers/hbase/build/lib/compile"/>
+                <fileset dir="storage-handlers/hbase/build/lib/provided"/>
                 <fileset dir="webhcat/svr/build/lib/compile"/>
+                <fileset dir="webhcat/svr/build/lib/provided"/>
             </classpath>
             <group title="hcatalog" packages="org.apache.hcatalog.*"/>
         </javadoc>
@@ -292,9 +295,18 @@
             <fileset dir="server-extensions/build">
                 <include name="hcatalog-*.jar"/>
             </fileset>
+        </copy>
+        <copy todir="${dist.dir}/share/webhcat/svr/" includeEmptyDirs="false">
             <fileset dir="webhcat/svr/build">
                 <include name="webhcat-*.jar"/>
             </fileset>
+        </copy>
+        <copy todir="${dist.dir}/share/webhcat/svr/lib/" includeEmptyDirs="false">
+            <fileset dir="webhcat/svr/build/lib/compile/">
+                <include name="*.jar"/>
+            </fileset>
+        </copy>
+        <copy todir="${dist.dir}/share/webhcat/java-client/" includeEmptyDirs="false">
             <fileset dir="webhcat/java-client/build">
                 <include name="webhcat-java-client*.jar"/>
             </fileset>
@@ -322,6 +334,10 @@
             <fileset dir="conf"/>
         </copy>
 
+        <copy todir="${dist.dir}/etc/webhcat">
+            <fileset dir="webhcat/svr/src/main/config/" />
+        </copy>
+
         <copy todir="${dist.dir}/share/${ant.project.name}/scripts">
             <fileset dir="scripts">
                 <include name="*.sh"/>

Modified: incubator/hcatalog/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/pom.xml?rev=1427885&r1=1427884&r2=1427885&view=diff
==============================================================================
--- incubator/hcatalog/trunk/pom.xml (original)
+++ incubator/hcatalog/trunk/pom.xml Wed Jan  2 18:05:47 2013
@@ -31,12 +31,13 @@
       <hbase.version>0.92.0</hbase.version>
       <hcatalog.version>${project.version}</hcatalog.version>
       <hive.version>0.10.0-SNAPSHOT</hive.version>
-      <jackson.version>1.8.8</jackson.version>
-      <jersey.version>1.14</jersey.version>
+      <jackson.version>1.8.3</jackson.version>
+      <jersey.version>1.9.1</jersey.version>
       <jetty.webhcat.version>7.6.0.v20120127</jetty.webhcat.version>
       <jms.version>1.1</jms.version>
       <pig.version>0.8.0</pig.version>
       <slf4j.version>1.6.1</slf4j.version>
+      <wadl-resourcedoc-doclet.version>1.4</wadl-resourcedoc-doclet.version>
       <zookeeper.version>3.4.3</zookeeper.version>
   </properties>
 

Modified: incubator/hcatalog/trunk/webhcat/svr/build.xml
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/build.xml?rev=1427885&r1=1427884&r2=1427885&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/build.xml (original)
+++ incubator/hcatalog/trunk/webhcat/svr/build.xml Wed Jan  2 18:05:47 2013
@@ -26,10 +26,12 @@
 
   <path id="compile.class.path">
     <fileset dir="${build.dir}/lib/compile"/>
+    <fileset dir="${build.dir}/lib/provided"/>
   </path>
 
   <path id="test.class.path">
     <fileset dir="${build.dir}/lib/test"/>
+    <fileset dir="${build.dir}/lib/provided"/>
     <dirset dir="${path.to.basedir}/core/build/test/classes"/>
     <dirset dir="${basedir}/build/classes"/>
     <dirset dir="${basedir}/build/test/classes"/>
@@ -39,4 +41,20 @@
     <fileset dir="${build.dir}/lib/compile"/>
   </path>
 
+  <target name="compile-resource">
+    <echo message="${ant.project.name}"/>
+    <property name="resources.dir"  location="${path.to.basedir}/conf"/>
+    <copy todir="${build.classes}/">
+      <fileset dir="${basedir}/src/main/config/"/>
+    </copy>
+    <echo message="Generating wadl xml file"/>
+    <javadoc access="public" classpathref="compile.class.path">
+      <fileset dir="${basedir}/src/main/java" defaultexcludes="yes"/>
+      <doclet name="com.sun.jersey.wadl.resourcedoc.ResourceDoclet"
+              pathref="compile.class.path">
+        <param name="-output" value="${build.classes}/resourcedoc.xml" />
+      </doclet>
+    </javadoc>
+  </target>
+
 </project>

Modified: incubator/hcatalog/trunk/webhcat/svr/pom.xml
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/pom.xml?rev=1427885&r1=1427884&r2=1427885&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/pom.xml (original)
+++ incubator/hcatalog/trunk/webhcat/svr/pom.xml Wed Jan  2 18:05:47 2013
@@ -37,9 +37,40 @@
     <url>http://maven.apache.org</url>
 
     <dependencies>
+
+        <!-- provided scope - made available as separate package
+          not packaged or added as dependency
+        -->
+
+        <dependency>
+            <groupId>org.apache.hcatalog</groupId>
+            <artifactId>hcatalog-core</artifactId>
+            <version>${hcatalog.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-core</artifactId>
+            <version>${hadoop20.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- compile scope - this is packaged -->
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-core</artifactId>
+            <version>${jersey.version}</version>
+            <scope>compile</scope>
+        </dependency>
         <dependency>
             <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-servlet</artifactId>
+            <artifactId>jersey-json</artifactId>
+            <version>${jersey.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-server</artifactId>
             <version>${jersey.version}</version>
             <scope>compile</scope>
         </dependency>
@@ -50,9 +81,15 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.hcatalog</groupId>
-            <artifactId>hcatalog-core</artifactId>
-            <version>${hcatalog.version}</version>
+            <groupId>org.apache.zookeeper</groupId>
+            <artifactId>zookeeper</artifactId>
+            <version>${zookeeper.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-json</artifactId>
+            <version>${jersey.version}</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
@@ -68,6 +105,12 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
+            <groupId>com.sun.jersey.contribs</groupId>
+            <artifactId>wadl-resourcedoc-doclet</artifactId>
+            <version>${wadl-resourcedoc-doclet.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>jul-to-slf4j</artifactId>
             <version>${slf4j.version}</version>

Added: incubator/hcatalog/trunk/webhcat/svr/src/main/bin/webhcat_config.sh
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/bin/webhcat_config.sh?rev=1427885&view=auto
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/bin/webhcat_config.sh (added)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/bin/webhcat_config.sh Wed Jan  2 18:05:47 2013
@@ -0,0 +1,94 @@
+#!/usr/bin/env bash
+
+# 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.
+
+
+#====================================
+#Default config param values
+#====================================
+
+# The directory,file containing the running pid
+PID_DIR=${WEBHCAT_PID_DIR:-.}
+PID_FILE=${PID_DIR}/webhcat.pid
+
+PID_FILE=./webhcat.pid
+
+#default log directory
+WEBHCAT_LOG_DIR=${WEBHCAT_LOG_DIR:-.}
+
+# The console error log
+ERROR_LOG=${WEBHCAT_LOG_DIR}/webhcat-console-error.log
+
+# The console log
+CONSOLE_LOG=${WEBHCAT_LOG_DIR}/webhcat-console.log
+
+# The name of the webhcat jar file
+WEBHCAT_JAR=webhcat-0.5.0-SNAPSHOT.jar
+
+# How long to wait before testing that the process started correctly
+SLEEP_TIME_AFTER_START=10
+
+#================================================
+#See if the default configs have been overwritten
+#================================================
+
+#These parameters can be overriden by webhcat-env.sh
+# the root of the WEBHCAT installation
+export WEBHCAT_PREFIX=`dirname "$this"`/..
+
+#check to see if the conf dir is given as an optional argument
+if [ $# -gt 1 ]
+then
+    if [ "--config" = "$1" ]
+          then
+              shift
+              confdir=$1
+              shift
+              WEBHCAT_CONF_DIR=$confdir
+    fi
+fi
+
+# Allow alternate conf dir location.
+if [ -e "${WEBHCAT_PREFIX}/etc/webhcat/webhcat-env.sh" ]; then
+  DEFAULT_CONF_DIR=${WEBHCAT_PREFIX}/"etc/webhcat"
+else
+  DEFAULT_CONF_DIR="/etc/webhcat"
+fi
+WEBHCAT_CONF_DIR="${WEBHCAT_CONF_DIR:-$DEFAULT_CONF_DIR}"
+
+#users can add various env vars to webhcat-env.sh in the conf
+#rather than having to export them before running the command
+if [ -f "${WEBHCAT_CONF_DIR}/webhcat-env.sh" ]; then
+  source "${WEBHCAT_CONF_DIR}/webhcat-env.sh"
+fi
+
+#====================================
+#determine where hadoop is
+#====================================
+
+#check HADOOP_HOME and then check HADOOP_PREFIX
+if [ -f ${HADOOP_HOME}/bin/hadoop ]; then
+  HADOOP_PREFIX=$HADOOP_HOME
+#if this is an rpm install check for /usr/bin/hadoop
+elif [ -f ${WEBHCAT_PREFIX}/bin/hadoop ]; then
+  HADOOP_PREFIX=$WEBHCAT_PREFIX
+#otherwise see if HADOOP_PREFIX is defined
+elif [ ! -f ${HADOOP_PREFIX}/bin/hadoop ]; then
+  echo "Hadoop not found."
+  exit 1
+fi

Added: incubator/hcatalog/trunk/webhcat/svr/src/main/bin/webhcat_server.sh
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/bin/webhcat_server.sh?rev=1427885&view=auto
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/bin/webhcat_server.sh (added)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/bin/webhcat_server.sh Wed Jan  2 18:05:47 2013
@@ -0,0 +1,237 @@
+#!/usr/bin/env bash
+
+# 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.
+
+#
+# Support functions
+#
+
+# Follow symlinks on Linux and Darwin
+function real_script_name() {
+        local base=$1
+        local real
+        if readlink -f $base >/dev/null 2>&1; then
+                # Darwin/Mac OS X
+                real=`readlink -f $base`
+        fi
+        if [[ "$?" != "0" || -z "$real" ]]; then
+                # Linux
+                local bin=$(cd -P -- "$(dirname -- "$base")">/dev/null && pwd -P)
+                local script="$(basename -- "$base")"
+                real="$bin/$script"
+        fi
+        echo "$real"
+}
+
+function usage() {
+        echo "usage: $0 [start|stop|foreground]"
+        echo "  start           Start the Webhcat Server"
+        echo "  stop            Stop the Webhcat Server"
+        echo "  foreground      Run the Webhcat Server in the foreground"
+        exit 1
+}
+
+# Print an error message and exit
+function die() {
+        echo "webhcat: $@" 1>&2
+        exit 1
+}
+
+# Print an message
+function log() {
+        echo "webhcat: $@"
+}
+
+# Find the webhcat jar
+function find_jar_path() {
+        for dir in "." "build" "share/webhcat/svr/"; do
+                local jar="$base_dir/$dir/$WEBHCAT_JAR"
+                if [[ -f $jar ]]; then
+                        echo $jar
+                        break
+                fi
+        done
+}
+
+# Find the webhcat classpath
+function find_classpath() {
+        local classpath=""
+        for dir in  "share/webhcat/svr/" "share/webhcat/svr/lib/"  "conf" ; do
+                local path="$base_dir/$dir"
+
+                if [[ -d $path ]]; then
+                        for jar_or_conf in $path/*; do
+                                if [[ -z "$classpath" ]]; then
+                                        classpath="$jar_or_conf"
+                                else
+                                        classpath="$classpath:$jar_or_conf"
+                                fi
+                        done
+                fi
+        done
+
+        if [[ -n "$WEBHCAT_CONF_DIR" ]]; then
+                if [[ -z "$classpath" ]]; then
+                        classpath="$WEBHCAT_CONF_DIR"
+                else
+                        classpath="$classpath:$WEBHCAT_CONF_DIR"
+                fi
+        fi
+
+        # Append hcat classpath
+        local hcat_classpath
+        hcat_classpath=`hcat -classpath`
+        if [[ "$?" != "0" ]]; then
+                die "Unable to get the hcatalog classpath"
+        fi
+        echo "$classpath:$hcat_classpath"
+}
+
+# Check if the pid is running
+function check_pid() {
+        local pid=$1
+        if ps -p $pid > /dev/null; then
+                return 0
+        else
+                return 1
+        fi
+}
+
+# Start the webhcat server in the foreground
+function foreground_webhcat() {
+        $start_cmd
+}
+
+# Start the webhcat server in the background.  Record the PID for
+# later use.
+function start_webhcat() {
+        if [[ -f $PID_FILE ]]; then
+                # Check if there is a server running
+                local pid=`cat $PID_FILE`
+                if check_pid $pid; then
+                        die "already running on process $pid"
+                fi
+        fi
+
+        log "starting ..."
+        log "$start_cmd"
+        nohup $start_cmd >>$CONSOLE_LOG 2>>$ERROR_LOG &
+        local pid=$!
+
+        if [[ -z "${pid}" ]] ; then # we failed right off
+                die "failed to start. Check logs in " `dirname $ERROR_LOG`
+        fi
+
+        sleep $SLEEP_TIME_AFTER_START
+
+        if check_pid $pid; then
+                echo $pid > $PID_FILE
+                log "starting ... started."
+        else
+                die "failed to start. Check logs in " `dirname $ERROR_LOG`
+        fi
+}
+
+# Stop a running server
+function stop_webhcat() {
+        local pid
+        if [[ -f $PID_FILE ]]; then
+                # Check if there is a server running
+                local check=`cat $PID_FILE`
+                if check_pid $check; then
+                        pid=$check
+                fi
+        fi
+
+        if [[ -z "$pid" ]]; then
+                log "no running server found"
+        else
+                log "stopping ..."
+                kill $pid
+                sleep $SLEEP_TIME_AFTER_START
+                if check_pid $pid; then
+                        die "failed to stop"
+                else
+                        log "stopping ... stopped"
+                fi
+        fi
+}
+
+#
+# Build command line and run
+#
+
+this=`real_script_name "${BASH_SOURCE-$0}"`
+this_bin=`dirname $this`
+base_dir="$this_bin/.."
+
+if [[ -f "$base_dir/libexec/webhcat_config.sh" ]]; then
+        . "$base_dir/libexec/webhcat_config.sh"
+else
+        . "$this_bin/webhcat_config.sh"
+fi
+
+JAR=`find_jar_path`
+if [[ -z "$JAR" ]]; then
+        die "No webhcat jar found"
+fi
+
+CLASSPATH=`find_classpath`
+if [[ -z "$CLASSPATH" ]]; then
+        die "No classpath or jars found"
+fi
+CLASSPATH="$JAR:$CLASSPATH"
+
+if [[ -z "$HADOOP_CLASSPATH" ]]; then
+        export HADOOP_CLASSPATH="$CLASSPATH"
+else
+        export HADOOP_CLASSPATH="$CLASSPATH:$HADOOP_CLASSPATH"
+fi
+
+if [[ -z "$WEBHCAT_LOG4J" ]]; then
+        if [[ -f "$base_dir/conf/webhcat-log4j.properties" ]]; then
+                WEBHCAT_LOG4J="$base_dir/conf/webhcat-log4j.properties";
+        elif [[ -f "$base_dir/conf/webhcat-log4j.properties" ]]; then
+                WEBHCAT_LOG4J="$base_dir/conf/webhcat-log4j.properties";
+        else
+                WEBHCAT_LOG4J="webhcat-log4j.properties";
+        fi
+fi
+
+export HADOOP_USER_CLASSPATH_FIRST=true
+export HADOOP_OPTS="-Dwebhcat.log.dir=$WEBHCAT_LOG_DIR -Dlog4j.configuration=$WEBHCAT_LOG4J"
+
+start_cmd="$HADOOP_PREFIX/bin/hadoop jar $JAR org.apache.hcatalog.templeton.Main  "
+
+
+cmd=$1
+case $cmd in
+        start)
+                start_webhcat
+                ;;
+        stop)
+                stop_webhcat
+                ;;
+        foreground)
+                foreground_webhcat
+                ;;
+        *)
+                usage
+                ;;
+esac
+
+log "done"

Added: incubator/hcatalog/trunk/webhcat/svr/src/main/config/webhcat-default.xml
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/config/webhcat-default.xml?rev=1427885&view=auto
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/config/webhcat-default.xml (added)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/config/webhcat-default.xml Wed Jan  2 18:05:47 2013
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    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.
+-->
+
+<!-- The default settings for Templeton. -->
+<!-- Edit templeton-site.xml to change settings for your local -->
+<!-- install. -->
+
+<configuration>
+
+  <property>
+    <name>templeton.port</name>
+    <value>50111</value>
+    <description>The HTTP port for the main server.</description>
+  </property>
+
+  <property>
+    <name>templeton.hadoop.conf.dir</name>
+    <value>${env.HADOOP_CONF_DIR}</value>
+    <description>The path to the Hadoop configuration.</description>
+  </property>
+
+  <property>
+    <name>templeton.jar</name>
+    <value>${env.TEMPLETON_HOME}/templeton-0.1.0-dev.jar</value>
+    <description>The path to the Templeton jar file.</description>
+  </property>
+
+  <property>
+    <name>templeton.libjars</name>
+    <value>${env.TEMPLETON_HOME}/lib/zookeeper-3.3.4.jar</value>
+    <description>Jars to add to the classpath.</description>
+  </property>
+
+  <property>
+    <name>templeton.override.jars</name>
+    <value>hdfs:///user/templeton/ugi.jar</value>
+    <description>
+        Jars to add the the HADOOP_CLASSPATH for all Map Reduce jobs.
+        This is a list of jars that must exist on hdfs that are added
+        to the Distributed Cache.
+    </description>
+  </property>
+
+  <property>
+    <name>templeton.override.enabled</name>
+    <value>true</value>
+    <description>
+      Enable the override path in templeton.override.jars
+    </description>
+  </property>
+
+  <property>
+    <name>templeton.streaming.jar</name>
+    <value>hdfs:///user/templeton/hadoop-streaming.jar</value>
+    <description>The hdfs path to the Hadoop streaming jar file.</description>
+  </property>
+
+  <property>
+    <name>templeton.hadoop</name>
+    <value>${env.HADOOP_PREFIX}/bin/hadoop</value>
+    <description>The path to the Hadoop executable.</description>
+  </property>
+
+  <property>
+    <name>templeton.pig.archive</name>
+    <value>hdfs:///user/templeton/pig-0.10.0.tar.gz</value>
+    <description>The path to the Pig archive.</description>
+  </property>
+
+  <property>
+    <name>templeton.pig.path</name>
+    <value>pig-0.10.0.tar.gz/pig-0.10.0/bin/pig</value>
+    <description>The path to the Pig executable.</description>
+  </property>
+
+  <property>
+    <name>templeton.hcat</name>
+    <value>${env.HCAT_PREFIX}/bin/hcat</value>
+    <description>The path to the hcatalog executable.</description>
+  </property>
+
+  <property>
+    <name>templeton.hive.archive</name>
+    <value>hdfs:///user/templeton/hive-0.10.0.tar.gz</value>
+    <description>The path to the Hive archive.</description>
+  </property>
+
+  <property>
+    <name>templeton.hive.path</name>
+    <value>hive-0.10.0.tar.gz/hive-0.10.0/bin/hive</value>
+    <description>The path to the Hive executable.</description>
+  </property>
+
+  <property>
+    <name>templeton.hive.properties</name>
+    <value>hive.metastore.local=false,hive.metastore.uris=thrift://localhost:9933,hive.metastore.sasl.enabled=false</value>
+    <description>Properties to set when running hive.</description>
+  </property>
+
+  <property>
+    <name>templeton.exec.encoding</name>
+    <value>UTF-8</value>
+    <description>The encoding of the stdout and stderr data.</description>
+  </property>
+
+  <property>
+    <name>templeton.exec.timeout</name>
+    <value>10000</value>
+    <description>
+      How long in milliseconds a program is allowed to run on the
+      Templeton box.
+    </description>
+  </property>
+
+  <property>
+    <name>templeton.exec.max-procs</name>
+    <value>16</value>
+    <description>The maximum number of processes allowed to run at once.</description>
+  </property>
+
+  <property>
+    <name>templeton.exec.max-output-bytes</name>
+    <value>1048576</value>
+    <description>
+      The maximum number of bytes from stdout or stderr stored in ram.
+    </description>
+  </property>
+
+  <property>
+    <name>templeton.exec.envs</name>
+    <value>HADOOP_PREFIX,HADOOP_HOME,JAVA_HOME</value>
+    <description>The environment variables passed through to exec.</description>
+  </property>
+
+  <property>
+    <name>templeton.zookeeper.hosts</name>
+    <value>127.0.0.1:2181</value>
+    <description>ZooKeeper servers, as comma separated host:port pairs</description>
+  </property>
+
+  <property>
+    <name>templeton.zookeeper.session-timeout</name>
+    <value>30000</value>
+    <description>ZooKeeper session timeout in milliseconds</description>
+  </property>
+
+  <property>
+    <name>templeton.callback.retry.interval</name>
+    <value>10000</value>
+    <description>How long to wait between callback retry attempts in milliseconds</description>
+  </property>
+
+  <property>
+    <name>templeton.callback.retry.attempts</name>
+    <value>5</value>
+    <description>How many times to retry the callback</description>
+  </property>
+
+  <property>
+    <name>templeton.storage.class</name>
+    <value>org.apache.hcatalog.templeton.tool.HDFSStorage</value>
+    <description>The class to use as storage</description>
+  </property>
+
+  <property>
+    <name>templeton.storage.root</name>
+    <value>/templeton-hadoop</value>
+    <description>The path to the directory to use for storage</description>
+  </property>
+
+  <property>
+    <name>templeton.hdfs.cleanup.interval</name>
+    <value>43200000</value>
+    <description>The maximum delay between a thread's cleanup checks</description>
+  </property>
+
+  <property>
+    <name>templeton.hdfs.cleanup.maxage</name>
+    <value>604800000</value>
+    <description>The maximum age of a templeton job</description>
+  </property>
+
+  <property>
+    <name>templeton.zookeeper.cleanup.interval</name>
+    <value>43200000</value>
+    <description>The maximum delay between a thread's cleanup checks</description>
+  </property>
+
+  <property>
+    <name>templeton.zookeeper.cleanup.maxage</name>
+    <value>604800000</value>
+    <description>The maximum age of a templeton job</description>
+  </property>
+
+</configuration>

Added: incubator/hcatalog/trunk/webhcat/svr/src/main/config/webhcat-log4j.properties
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/config/webhcat-log4j.properties?rev=1427885&view=auto
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/config/webhcat-log4j.properties (added)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/config/webhcat-log4j.properties Wed Jan  2 18:05:47 2013
@@ -0,0 +1,48 @@
+# 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.
+
+#
+# templeton-log4j - configure the Templeton logging system
+
+# Define some default values that can be overridden by system properties
+templeton.root.logger = DEBUG, standard
+templeton.log.dir = .
+templeton.log.file = templeton.log
+
+log4j.rootLogger = ${templeton.root.logger}
+
+# Logging Threshold
+log4j.threshhold = DEBUG
+
+log4j.appender.standard  =  org.apache.log4j.DailyRollingFileAppender
+log4j.appender.standard.File = ${templeton.log.dir}/${templeton.log.file}
+
+# Rollver at midnight
+log4j.appender.DRFA.DatePattern = .yyyy-MM-dd
+
+log4j.appender.DRFA.layout = org.apache.log4j.PatternLayout
+
+log4j.appender.standard.layout = org.apache.log4j.PatternLayout
+log4j.appender.standard.layout.conversionPattern = %-5p | %d{DATE} | %c | %m%n
+
+# Class logging settings
+log4j.logger.com.sun.jersey = DEBUG
+log4j.logger.com.sun.jersey.spi.container.servlet.WebComponent = ERROR
+log4j.logger.org.apache.hadoop = INFO
+log4j.logger.org.apache.hadoop.conf = WARN
+log4j.logger.org.apache.zookeeper = WARN
+log4j.logger.org.eclipse.jetty = INFO

Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java?rev=1427885&r1=1427884&r2=1427885&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java Wed Jan  2 18:05:47 2013
@@ -39,11 +39,11 @@ import org.apache.hcatalog.templeton.too
  *
  * The Templeton specific configuration is split into two layers
  *
- * 1. templeton-default.xml - All the configuration variables that
+ * 1. webhcat-default.xml - All the configuration variables that
  *    Templeton needs.  These are the defaults that ship with the app
  *    and should only be changed be the app developers.
  *
- * 2. templeton-site.xml - The (possibly empty) configuration that the
+ * 2. webhcat-site.xml - The (possibly empty) configuration that the
  *    system administrator can set variables for their Hadoop cluster.
  *
  * The configuration files are loaded in this order with later files
@@ -72,8 +72,8 @@ public class AppConfig extends Configura
     public static final String TEMPLETON_HOME_VAR = "TEMPLETON_HOME";
 
     public static final String[] TEMPLETON_CONF_FILENAMES = {
-        "templeton-default.xml",
-        "templeton-site.xml"
+        "webhcat-default.xml",
+        "webhcat-site.xml"
     };
 
     public static final String PORT                = "templeton.port";