diff --git ant/deploy.xml ant/deploy.xml
index e0f5ea3..b934dab 100644
--- ant/deploy.xml
+++ ant/deploy.xml
@@ -67,6 +67,15 @@
+
+
+
+
+
+
+
+
+
diff --git build-common.xml build-common.xml
index 0e0af1c..7f662b2 100644
--- build-common.xml
+++ build-common.xml
@@ -52,11 +52,20 @@
+
+
+
+
+
+
+
+
<_javac srcDir="${basedir}/src/main/java"
destDir="${build.classes}"
classPathRef="compile.class.path"/>
+
@@ -72,7 +81,7 @@
<_junit srcDir="${basedir}/src/test/java"/>
-
+
diff --git build.xml build.xml
index 61ff391..8c2b756 100644
--- build.xml
+++ build.xml
@@ -176,9 +176,13 @@
+
+
+
+
@@ -270,6 +274,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -293,6 +312,10 @@
+
+
+
+
diff --git conf/templeton-default.xml conf/templeton-default.xml
deleted file mode 100644
index bdd86d0..0000000
--- conf/templeton-default.xml
+++ /dev/null
@@ -1,211 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- templeton.port
- 50111
- The HTTP port for the main server.
-
-
-
- templeton.hadoop.conf.dir
- ${env.HADOOP_CONF_DIR}
- The path to the Hadoop configuration.
-
-
-
- templeton.jar
- ${env.TEMPLETON_HOME}/templeton-0.1.0-dev.jar
- The path to the Templeton jar file.
-
-
-
- templeton.libjars
- ${env.TEMPLETON_HOME}/lib/zookeeper-3.3.4.jar
- Jars to add to the classpath.
-
-
-
- templeton.override.jars
- hdfs:///user/templeton/ugi.jar
-
- 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.
-
-
-
-
- templeton.override.enabled
- true
-
- Enable the override path in templeton.override.jars
-
-
-
-
- templeton.streaming.jar
- hdfs:///user/templeton/hadoop-streaming.jar
- The hdfs path to the Hadoop streaming jar file.
-
-
-
- templeton.hadoop
- ${env.HADOOP_PREFIX}/bin/hadoop
- The path to the Hadoop executable.
-
-
-
- templeton.pig.archive
- hdfs:///user/templeton/pig-0.9.2.tar.gz
- The path to the Pig archive.
-
-
-
- templeton.pig.path
- pig-0.9.2.tar.gz/pig-0.9.2/bin/pig
- The path to the Pig executable.
-
-
-
- templeton.hcat
- ${env.HCAT_PREFIX}/bin/hcat
- The path to the hcatalog executable.
-
-
-
- templeton.hive.archive
- hdfs:///user/templeton/hcatalog-0.3.0.tar.gz
- The path to the Hive archive.
-
-
-
- templeton.hive.path
- hcatalog-0.3.0.tar.gz/hcatalog-0.3.0/bin/hive
- The path to the Hive executable.
-
-
-
- templeton.hive.properties
- hive.metastore.local=false,hive.metastore.uris=thrift://localhost:9933,hive.metastore.sasl.enabled=false
- Properties to set when running hive.
-
-
-
- templeton.exec.encoding
- UTF-8
- The encoding of the stdout and stderr data.
-
-
-
- templeton.exec.timeout
- 10000
-
- How long in milliseconds a program is allowed to run on the
- Templeton box.
-
-
-
-
- templeton.exec.max-procs
- 16
- The maximum number of processes allowed to run at once.
-
-
-
- templeton.exec.max-output-bytes
- 1048576
-
- The maximum number of bytes from stdout or stderr stored in ram.
-
-
-
-
- templeton.exec.envs
- HADOOP_PREFIX,HADOOP_HOME,JAVA_HOME
- The environment variables passed through to exec.
-
-
-
- templeton.zookeeper.hosts
- 127.0.0.1:2181
- ZooKeeper servers, as comma separated host:port pairs
-
-
-
- templeton.zookeeper.session-timeout
- 30000
- ZooKeeper session timeout in milliseconds
-
-
-
- templeton.callback.retry.interval
- 10000
- How long to wait between callback retry attempts in milliseconds
-
-
-
- templeton.callback.retry.attempts
- 5
- How many times to retry the callback
-
-
-
- templeton.storage.class
- org.apache.hcatalog.templeton.tool.HDFSStorage
- The class to use as storage
-
-
-
- templeton.storage.root
- /templeton-hadoop
- The path to the directory to use for storage
-
-
-
- templeton.hdfs.cleanup.interval
- 43200000
- The maximum delay between a thread's cleanup checks
-
-
-
- templeton.hdfs.cleanup.maxage
- 604800000
- The maximum age of a templeton job
-
-
-
- templeton.zookeeper.cleanup.interval
- 43200000
- The maximum delay between a thread's cleanup checks
-
-
-
- templeton.zookeeper.cleanup.maxage
- 604800000
- The maximum age of a templeton job
-
-
-
diff --git conf/templeton-log4j.properties conf/templeton-log4j.properties
deleted file mode 100644
index aa10199..0000000
--- conf/templeton-log4j.properties
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# 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
diff --git pom.xml pom.xml
index 6ade4a6..991b0db 100644
--- pom.xml
+++ pom.xml
@@ -10,12 +10,15 @@
0.92.0
0.5.0-SNAPSHOT
0.10.0-SNAPSHOT
+ 1.8.3
1.14
7.6.0.v20120127
1.1
0.8.0
1.6.1
+ 1.4
3.4.3
+
diff --git webhcat/svr/build.xml webhcat/svr/build.xml
index 070d9be..89723c8 100644
--- webhcat/svr/build.xml
+++ webhcat/svr/build.xml
@@ -20,14 +20,18 @@
+
+
+
+
@@ -37,4 +41,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git webhcat/svr/pom.xml webhcat/svr/pom.xml
index 3ae03e7..980858c 100644
--- webhcat/svr/pom.xml
+++ webhcat/svr/pom.xml
@@ -35,6 +35,25 @@
http://maven.apache.org
+
+
+
+
+ org.apache.hcatalog
+ hcatalog-core
+ ${hcatalog.version}
+ provided
+
+
+ org.apache.hadoop
+ hadoop-core
+ ${hadoop20.version}
+ provided
+
+
+
com.sun.jersey
jersey-servlet
@@ -48,9 +67,28 @@
compile
- org.apache.hcatalog
- hcatalog-core
- ${hcatalog.version}
+ org.apache.zookeeper
+ zookeeper
+ ${zookeeper.version}
+ compile
+
+
+
+ com.sun.jersey
+ jersey-core
+ ${jersey.version}
+ compile
+
+
+ com.sun.jersey
+ jersey-server
+ ${jersey.version}
+ compile
+
+
+ com.sun.jersey
+ jersey-json
+ ${jersey.version}
compile
@@ -60,10 +98,45 @@
compile
+ com.sun.jersey.contribs
+ wadl-resourcedoc-doclet
+ ${wadl-resourcedoc-doclet.version}
+ compile
+
+
+ org.codehaus.jackson
+ jackson-jaxrs
+ ${jackson.version}
+ compile
+
+
+ org.codehaus.jackson
+ jackson-core-asl
+ ${jackson.version}
+ compile
+
+
+ org.codehaus.jackson
+ jackson-mapper-asl
+ ${jackson.version}
+ compile
+
+
+ org.codehaus.jackson
+ jackson-xc
+ ${jackson.version}
+ compile
+
+
+
org.slf4j
jul-to-slf4j
${slf4j.version}
compile
+
+
+
+
diff --git webhcat/svr/src/main/bin/templeton_config.sh webhcat/svr/src/main/bin/templeton_config.sh
deleted file mode 100644
index fff987e..0000000
--- webhcat/svr/src/main/bin/templeton_config.sh
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/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 file containing the running pid
-PID_FILE=./templeton.pid
-
-#default log directory
-TEMPLETON_LOG_DIR=${TEMPLETON_LOG_DIR:-.}
-
-# The console error log
-ERROR_LOG=${TEMPLETON_LOG_DIR}/templeton-console-error.log
-
-# The console log
-CONSOLE_LOG=${TEMPLETON_LOG_DIR}/templeton-console.log
-
-# The name of the templeton jar file
-TEMPLETON_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 templeton-env.sh
-# the root of the TEMPLETON installation
-export TEMPLETON_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
- TEMPLETON_CONF_DIR=$confdir
- fi
-fi
-
-# Allow alternate conf dir location.
-if [ -e "${TEMPLETON_PREFIX}/conf/templeton-env.sh" ]; then
- DEFAULT_CONF_DIR=${TEMPLETON_PREFIX}/"conf"
-else
- DEFAULT_CONF_DIR="/etc/hcatalog"
-fi
-TEMPLETON_CONF_DIR="${TEMPLETON_CONF_DIR:-$DEFAULT_CONF_DIR}"
-
-#users can add various env vars to templeton-env.sh in the conf
-#rather than having to export them before running the command
-if [ -f "${TEMPLETON_CONF_DIR}/templeton-env.sh" ]; then
- . "${TEMPLETON_CONF_DIR}/templeton-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 ${TEMPLETON_PREFIX}/bin/hadoop ]; then
- HADOOP_PREFIX=$TEMPLETON_PREFIX
-#otherwise see if HADOOP_PREFIX is defined
-elif [ ! -f ${HADOOP_PREFIX}/bin/hadoop ]; then
- echo "Hadoop not found."
- exit 1
-fi
-
-
-
-
-
diff --git webhcat/svr/src/main/bin/templeton_server.sh webhcat/svr/src/main/bin/templeton_server.sh
deleted file mode 100755
index c50c59c..0000000
--- webhcat/svr/src/main/bin/templeton_server.sh
+++ /dev/null
@@ -1,237 +0,0 @@
-#!/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 Templeton Server"
- echo " stop Stop the Templeton Server"
- echo " foreground Run the Templeton Server in the foreground"
- exit 1
-}
-
-# Print an error message and exit
-function die() {
- echo "templeton: $@" 1>&2
- exit 1
-}
-
-# Print an message
-function log() {
- echo "templeton: $@"
-}
-
-# Find the templeton jar
-function find_jar_path() {
- for dir in "." "build" "share/hcatalog/"; do
- local jar="$base_dir/$dir/$TEMPLETON_JAR"
- if [[ -f $jar ]]; then
- echo $jar
- break
- fi
- done
-}
-
-# Find the templeton classpath
-function find_classpath() {
- local classpath=""
- for dir in "share/hcatalog" "build/ivy/lib/templeton" "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 "$TEMPLETON_CONF_DIR" ]]; then
- if [[ -z "$classpath" ]]; then
- classpath="$TEMPLETON_CONF_DIR"
- else
- classpath="$classpath:$TEMPLETON_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 templeton server in the foreground
-function foreground_templeton() {
- $start_cmd
-}
-
-# Start the templeton server in the background. Record the PID for
-# later use.
-function start_templeton() {
- 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_templeton() {
- 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/templeton_config.sh" ]]; then
- . "$base_dir/libexec/templeton_config.sh"
-else
- . "$this_bin/templeton_config.sh"
-fi
-
-JAR=`find_jar_path`
-if [[ -z "$JAR" ]]; then
- die "No templeton 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 "$TEMPLETON_LOG4J" ]]; then
- if [[ -f "$base_dir/conf/templeton-log4j.properties" ]]; then
- TEMPLETON_LOG4J="$base_dir/conf/templeton-log4j.properties";
- elif [[ -f "$base_dir/conf/templeton-log4j.properties" ]]; then
- TEMPLETON_LOG4J="$base_dir/conf/templeton-log4j.properties";
- else
- TEMPLETON_LOG4J="templeton-log4j.properties";
- fi
-fi
-
-export HADOOP_USER_CLASSPATH_FIRST=true
-export HADOOP_OPTS="-Dtempleton.log.dir=$TEMPLETON_LOG_DIR -Dlog4j.configuration=$TEMPLETON_LOG4J"
-
-start_cmd="$HADOOP_PREFIX/bin/hadoop jar $JAR org.apache.hcatalog.templeton.Main "
-
-
-cmd=$1
-case $cmd in
- start)
- start_templeton
- ;;
- stop)
- stop_templeton
- ;;
- foreground)
- foreground_templeton
- ;;
- *)
- usage
- ;;
-esac
-
-log "done"
diff --git webhcat/svr/src/main/bin/webhcat_config.sh webhcat/svr/src/main/bin/webhcat_config.sh
new file mode 100755
index 0000000..90f4f79
--- /dev/null
+++ webhcat/svr/src/main/bin/webhcat_config.sh
@@ -0,0 +1,88 @@
+#!/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 file containing the running 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
+ . "${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
diff --git webhcat/svr/src/main/bin/webhcat_server.sh webhcat/svr/src/main/bin/webhcat_server.sh
new file mode 100755
index 0000000..b27f4e7
--- /dev/null
+++ webhcat/svr/src/main/bin/webhcat_server.sh
@@ -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/hcatalog/"; 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"
diff --git webhcat/svr/src/main/config/webhcat-default.xml webhcat/svr/src/main/config/webhcat-default.xml
new file mode 100644
index 0000000..bdd86d0
--- /dev/null
+++ webhcat/svr/src/main/config/webhcat-default.xml
@@ -0,0 +1,211 @@
+
+
+
+
+
+
+
+
+
+
+ templeton.port
+ 50111
+ The HTTP port for the main server.
+
+
+
+ templeton.hadoop.conf.dir
+ ${env.HADOOP_CONF_DIR}
+ The path to the Hadoop configuration.
+
+
+
+ templeton.jar
+ ${env.TEMPLETON_HOME}/templeton-0.1.0-dev.jar
+ The path to the Templeton jar file.
+
+
+
+ templeton.libjars
+ ${env.TEMPLETON_HOME}/lib/zookeeper-3.3.4.jar
+ Jars to add to the classpath.
+
+
+
+ templeton.override.jars
+ hdfs:///user/templeton/ugi.jar
+
+ 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.
+
+
+
+
+ templeton.override.enabled
+ true
+
+ Enable the override path in templeton.override.jars
+
+
+
+
+ templeton.streaming.jar
+ hdfs:///user/templeton/hadoop-streaming.jar
+ The hdfs path to the Hadoop streaming jar file.
+
+
+
+ templeton.hadoop
+ ${env.HADOOP_PREFIX}/bin/hadoop
+ The path to the Hadoop executable.
+
+
+
+ templeton.pig.archive
+ hdfs:///user/templeton/pig-0.9.2.tar.gz
+ The path to the Pig archive.
+
+
+
+ templeton.pig.path
+ pig-0.9.2.tar.gz/pig-0.9.2/bin/pig
+ The path to the Pig executable.
+
+
+
+ templeton.hcat
+ ${env.HCAT_PREFIX}/bin/hcat
+ The path to the hcatalog executable.
+
+
+
+ templeton.hive.archive
+ hdfs:///user/templeton/hcatalog-0.3.0.tar.gz
+ The path to the Hive archive.
+
+
+
+ templeton.hive.path
+ hcatalog-0.3.0.tar.gz/hcatalog-0.3.0/bin/hive
+ The path to the Hive executable.
+
+
+
+ templeton.hive.properties
+ hive.metastore.local=false,hive.metastore.uris=thrift://localhost:9933,hive.metastore.sasl.enabled=false
+ Properties to set when running hive.
+
+
+
+ templeton.exec.encoding
+ UTF-8
+ The encoding of the stdout and stderr data.
+
+
+
+ templeton.exec.timeout
+ 10000
+
+ How long in milliseconds a program is allowed to run on the
+ Templeton box.
+
+
+
+
+ templeton.exec.max-procs
+ 16
+ The maximum number of processes allowed to run at once.
+
+
+
+ templeton.exec.max-output-bytes
+ 1048576
+
+ The maximum number of bytes from stdout or stderr stored in ram.
+
+
+
+
+ templeton.exec.envs
+ HADOOP_PREFIX,HADOOP_HOME,JAVA_HOME
+ The environment variables passed through to exec.
+
+
+
+ templeton.zookeeper.hosts
+ 127.0.0.1:2181
+ ZooKeeper servers, as comma separated host:port pairs
+
+
+
+ templeton.zookeeper.session-timeout
+ 30000
+ ZooKeeper session timeout in milliseconds
+
+
+
+ templeton.callback.retry.interval
+ 10000
+ How long to wait between callback retry attempts in milliseconds
+
+
+
+ templeton.callback.retry.attempts
+ 5
+ How many times to retry the callback
+
+
+
+ templeton.storage.class
+ org.apache.hcatalog.templeton.tool.HDFSStorage
+ The class to use as storage
+
+
+
+ templeton.storage.root
+ /templeton-hadoop
+ The path to the directory to use for storage
+
+
+
+ templeton.hdfs.cleanup.interval
+ 43200000
+ The maximum delay between a thread's cleanup checks
+
+
+
+ templeton.hdfs.cleanup.maxage
+ 604800000
+ The maximum age of a templeton job
+
+
+
+ templeton.zookeeper.cleanup.interval
+ 43200000
+ The maximum delay between a thread's cleanup checks
+
+
+
+ templeton.zookeeper.cleanup.maxage
+ 604800000
+ The maximum age of a templeton job
+
+
+
diff --git webhcat/svr/src/main/config/webhcat-log4j.properties webhcat/svr/src/main/config/webhcat-log4j.properties
new file mode 100644
index 0000000..aa10199
--- /dev/null
+++ webhcat/svr/src/main/config/webhcat-log4j.properties
@@ -0,0 +1,31 @@
+#
+# 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
diff --git webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java
index 28e96e3..d8c124a 100644
--- webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java
+++ webhcat/svr/src/main/java/org/apache/hcatalog/templeton/AppConfig.java
@@ -38,11 +38,11 @@ import org.apache.hcatalog.templeton.tool.ZooKeeperStorage;
*
* 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
@@ -71,8 +71,8 @@ public class AppConfig extends Configuration {
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";