Repository: incubator-hawq
Updated Branches:
  refs/heads/master aba713218 -> d2d3eaf50


HAWQ-1540. PXF should not accept parameters for init command


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/d2d3eaf5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/d2d3eaf5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/d2d3eaf5

Branch: refs/heads/master
Commit: d2d3eaf508ef0aabcca28b73faa910f343b392fc
Parents: aba7132
Author: Alexander Denissov <[email protected]>
Authored: Wed Oct 18 13:57:03 2017 -0700
Committer: Alexander Denissov <[email protected]>
Committed: Thu Oct 26 11:54:22 2017 -0700

----------------------------------------------------------------------
 pxf/build.gradle                                |   4 +-
 pxf/gradle/profiles/gpdb.properties             |   2 +-
 .../pxf-private-cdh.classpath.template          |  82 +++++++++++
 .../pxf-private-hdp.classpath.template          |  82 +++++++++++
 .../pxf-private-tar.classpath.template          |  82 +++++++++++
 .../templates/pxf-private.classpath.template    |  81 ----------
 .../service/utilities/CustomWebappLoader.java   |   2 +-
 pxf/pxf-service/src/scripts/pxf-env.sh          |  13 +-
 pxf/pxf-service/src/scripts/pxf-service         | 147 +++++++++++--------
 9 files changed, 346 insertions(+), 149 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d2d3eaf5/pxf/build.gradle
----------------------------------------------------------------------
diff --git a/pxf/build.gradle b/pxf/build.gradle
index 2a99231..996e693 100644
--- a/pxf/build.gradle
+++ b/pxf/build.gradle
@@ -270,8 +270,8 @@ project('pxf-service') {
             fileMode 0755
             fileType NOREPLACE
             filter(ReplaceTokens,
-                    tokens: ['pxfLogDir'     : databaseProperties.pxfLogDir,
-                             'pxfRunDir'     : databaseProperties.pxfRunDir,
+                    tokens: ['pxfLogDir'     :  databaseProperties.pxfLogDir,
+                             'pxfRunDir'     :  databaseProperties.pxfRunDir,
                              'pxfDefaultUser': 
(databaseProperties.pxfDefaultUser == null ? "" : 
databaseProperties.pxfDefaultUser)])
             into "/etc/pxf-${project.version}/conf"
         }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d2d3eaf5/pxf/gradle/profiles/gpdb.properties
----------------------------------------------------------------------
diff --git a/pxf/gradle/profiles/gpdb.properties 
b/pxf/gradle/profiles/gpdb.properties
index 90a8a60..df16372 100644
--- a/pxf/gradle/profiles/gpdb.properties
+++ b/pxf/gradle/profiles/gpdb.properties
@@ -16,4 +16,4 @@
 # under the License.
 
 pxfLogDir=${PXF_HOME}/logs
-pxfRunDir=${PXF_HOME}/run
\ No newline at end of file
+pxfRunDir=${PXF_HOME}/run

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d2d3eaf5/pxf/pxf-service/src/configs/templates/pxf-private-cdh.classpath.template
----------------------------------------------------------------------
diff --git 
a/pxf/pxf-service/src/configs/templates/pxf-private-cdh.classpath.template 
b/pxf/pxf-service/src/configs/templates/pxf-private-cdh.classpath.template
new file mode 100644
index 0000000..437ffaf
--- /dev/null
+++ b/pxf/pxf-service/src/configs/templates/pxf-private-cdh.classpath.template
@@ -0,0 +1,82 @@
+# 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.
+
+##################################################################
+# This file contains the internal classpaths required to run PXF
+# with RPM-based installation of hadoop clients from CDH distribution.
+# WARNING: DO NOT EDIT!
+# Any change in this file can result in PXF failing to run.
+# Adding resources should be done using pxf-public.classpath file. 
+##################################################################
+
+# PXF Configuration
+PXF_HOME/conf
+
+# PXF Libraries
+PXF_HOME/lib/pxf-hbase.jar
+PXF_HOME/lib/pxf-hdfs.jar
+PXF_HOME/lib/pxf-hive.jar
+PXF_HOME/lib/pxf-json.jar
+PXF_HOME/lib/pxf-jdbc.jar
+
+# Hadoop/Hive/HBase configurations
+/etc/hadoop/conf
+/etc/hive/conf
+/etc/hbase/conf
+
+# Hadoop Libraries
+/usr/lib/hadoop/client/hadoop-hdfs.jar
+/usr/lib/hadoop/client/hadoop-mapreduce-client-core.jar
+/usr/lib/hadoop/client/hadoop-mapreduce-client-common.jar
+/usr/lib/hadoop/client/hadoop-auth.jar
+/usr/lib/hadoop/client/hadoop-common.jar
+/usr/lib/hadoop/client/avro.jar
+/usr/lib/hadoop/client/commons-cli.jar
+/usr/lib/hadoop/client/commons-codec.jar
+/usr/lib/hadoop/client/commons-collections.jar
+/usr/lib/hadoop/client/commons-configuration.jar
+/usr/lib/hadoop/client/commons-io.jar
+/usr/lib/hadoop/client/commons-lang.jar
+/usr/lib/hadoop/client/commons-logging.jar
+/usr/lib/hadoop/client/guava.jar
+/usr/lib/hadoop/client/htrace-core4.jar
+/usr/lib/hadoop/client/jackson-core.jar
+/usr/lib/hadoop/client/jackson-mapper-asl.jar
+/usr/lib/hadoop/client/jetty-*.jar
+/usr/lib/hadoop/client/jersey-core.jar
+/usr/lib/hadoop/client/log4j.jar
+/usr/lib/hadoop/client/protobuf-java-*[0-9].jar
+/usr/lib/hadoop/client/slf4j-api.jar
+/usr/lib/hadoop/client/snappy-java.jar
+/usr/lib/hadoop/lib/asm-*[0-9].jar
+/usr/lib/hadoop/lib/jersey-server-*[0-9].jar
+
+# Hive Libraries
+/usr/lib/hive/lib/antlr-runtime-*[0-9].jar
+/usr/lib/hive/lib/datanucleus-api-jdo-*[0-9].jar
+/usr/lib/hive/lib/datanucleus-core-*[0-9].jar
+/usr/lib/hive/lib/hive-exec.jar
+/usr/lib/hive/lib/hive-metastore.jar
+/usr/lib/hive/lib/jdo-api-*[0-9].jar
+/usr/lib/hive/lib/libfb303-*[0-9].jar
+
+# HBase Libraries
+/usr/lib/hbase/hbase-client.jar
+/usr/lib/hbase/hbase-common.jar
+/usr/lib/hbase/hbase-protocol.jar
+/usr/lib/hbase/lib/htrace-core.jar
+/usr/lib/hbase/lib/netty-*[0-9].Final.jar
+/usr/lib/hbase/lib/metrics-core*.jar
+/usr/lib/zookeeper/zookeeper.jar

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d2d3eaf5/pxf/pxf-service/src/configs/templates/pxf-private-hdp.classpath.template
----------------------------------------------------------------------
diff --git 
a/pxf/pxf-service/src/configs/templates/pxf-private-hdp.classpath.template 
b/pxf/pxf-service/src/configs/templates/pxf-private-hdp.classpath.template
new file mode 100644
index 0000000..da834a6
--- /dev/null
+++ b/pxf/pxf-service/src/configs/templates/pxf-private-hdp.classpath.template
@@ -0,0 +1,82 @@
+# 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.
+
+##################################################################
+# This file contains the internal classpaths required to run PXF
+# with RPM-based installation of hadoop clients from HDP distribution.
+# WARNING: DO NOT EDIT!
+# Any change in this file can result in PXF failing to run.
+# Adding resources should be done using pxf-public.classpath file. 
+##################################################################
+
+# PXF Configuration
+PXF_HOME/conf
+
+# PXF Libraries
+PXF_HOME/lib/pxf-hbase.jar
+PXF_HOME/lib/pxf-hdfs.jar
+PXF_HOME/lib/pxf-hive.jar
+PXF_HOME/lib/pxf-json.jar
+PXF_HOME/lib/pxf-jdbc.jar
+
+# Hadoop/Hive/HBase configurations
+/etc/hadoop/conf
+/etc/hive/conf
+/etc/hbase/conf
+
+# Hadoop Libraries
+/usr/hdp/current/hadoop-client/client/hadoop-hdfs.jar
+/usr/hdp/current/hadoop-client/client/hadoop-mapreduce-client-core.jar
+/usr/hdp/current/hadoop-client/client/hadoop-mapreduce-client-common.jar
+/usr/hdp/current/hadoop-client/client/hadoop-auth.jar
+/usr/hdp/current/hadoop-client/client/hadoop-common.jar
+/usr/hdp/current/hadoop-client/client/avro.jar
+/usr/hdp/current/hadoop-client/client/commons-cli.jar
+/usr/hdp/current/hadoop-client/client/commons-codec.jar
+/usr/hdp/current/hadoop-client/client/commons-collections.jar
+/usr/hdp/current/hadoop-client/client/commons-configuration.jar
+/usr/hdp/current/hadoop-client/client/commons-io.jar
+/usr/hdp/current/hadoop-client/client/commons-lang.jar
+/usr/hdp/current/hadoop-client/client/commons-logging.jar
+/usr/hdp/current/hadoop-client/client/guava.jar
+/usr/hdp/current/hadoop-client/client/htrace-core.jar
+/usr/hdp/current/hadoop-client/client/jackson-core-asl.jar
+/usr/hdp/current/hadoop-client/client/jackson-mapper-asl.jar
+/usr/hdp/current/hadoop-client/client/jetty-*.jar
+/usr/hdp/current/hadoop-client/client/jersey-core.jar
+/usr/hdp/current/hadoop-client/client/log4j.jar
+/usr/hdp/current/hadoop-client/client/protobuf-java-*[0-9].jar
+/usr/hdp/current/hadoop-client/client/slf4j-api.jar
+/usr/hdp/current/hadoop-client/client/snappy-java.jar
+/usr/hdp/current/hadoop-client/lib/asm-*[0-9].jar
+/usr/hdp/current/hadoop-client/lib/jersey-server-*[0-9].jar
+
+# Hive Libraries
+/usr/hdp/current/hive-client/lib/antlr-runtime-*[0-9].jar
+/usr/hdp/current/hive-client/lib/datanucleus-api-jdo-*[0-9].jar
+/usr/hdp/current/hive-client/lib/datanucleus-core-*[0-9].jar
+/usr/hdp/current/hive-client/lib/hive-exec.jar
+/usr/hdp/current/hive-client/lib/hive-metastore.jar
+/usr/hdp/current/hive-client/lib/jdo-api-*[0-9].jar
+/usr/hdp/current/hive-client/lib/libfb303-*[0-9].jar
+
+# HBase Libraries
+/usr/hdp/current/hbase-client/lib/hbase-client.jar
+/usr/hdp/current/hbase-client/lib/hbase-common.jar
+/usr/hdp/current/hbase-client/lib/hbase-protocol.jar
+/usr/hdp/current/hbase-client/lib/htrace-core.jar
+/usr/hdp/current/hbase-client/lib/netty-*[0-9].Final.jar
+/usr/hdp/current/hbase-client/lib/metrics-core*.jar
+/usr/hdp/current/zookeeper-client/zookeeper.jar

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d2d3eaf5/pxf/pxf-service/src/configs/templates/pxf-private-tar.classpath.template
----------------------------------------------------------------------
diff --git 
a/pxf/pxf-service/src/configs/templates/pxf-private-tar.classpath.template 
b/pxf/pxf-service/src/configs/templates/pxf-private-tar.classpath.template
new file mode 100644
index 0000000..b1c5df0
--- /dev/null
+++ b/pxf/pxf-service/src/configs/templates/pxf-private-tar.classpath.template
@@ -0,0 +1,82 @@
+# 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.
+
+##################################################################
+# This file contains the internal classpaths required to run PXF
+# with tarball based installation of hadoop clients.
+# Edit to set the base paths according to your specific package layout
+# Adding new resources should be done using pxf-public.classpath file.
+##################################################################
+
+# PXF Configuration
+PXF_HOME/conf
+
+# PXF Libraries
+PXF_HOME/lib/pxf-hbase.jar
+PXF_HOME/lib/pxf-hdfs.jar
+PXF_HOME/lib/pxf-hive.jar
+PXF_HOME/lib/pxf-json.jar
+PXF_HOME/lib/pxf-jdbc.jar
+
+# Hadoop/Hive/HBase configurations
+HADOOP_ROOT/hadoop/etc/hadoop
+HADOOP_ROOT/hive/conf
+HADOOP_ROOT/hbase/conf
+
+# Hadoop Libraries
+HADOOP_ROOT/hadoop/share/hadoop/common/hadoop-common-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/hadoop-auth-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/asm-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/avro-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/commons-cli-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/commons-codec-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/commons-collections-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/commons-configuration-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/commons-io-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/commons-lang-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/commons-logging-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/guava-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/htrace-core*.jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/jetty-*.jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/jersey-core-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/jersey-server-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/log4j-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/protobuf-java-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/slf4j-api-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/common/lib/snappy-java-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/hdfs/hadoop-hdfs-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/hdfs/lib/jackson-core-asl-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/hdfs/lib/jackson-mapper-asl-*[0-9].jar
+HADOOP_ROOT/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-core-*[0-9].jar
+# CDH only Library
+HADOOP_ROOT/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-common-*[0-9].jar
+
+# Hive Libraries
+HADOOP_ROOT/hive/lib/antlr-runtime*.jar
+HADOOP_ROOT/hive/lib/datanucleus-api-jdo*.jar
+HADOOP_ROOT/hive/lib/datanucleus-core*.jar
+HADOOP_ROOT/hive/lib/hive-exec*.jar
+HADOOP_ROOT/hive/lib/hive-metastore*.jar
+HADOOP_ROOT/hive/lib/jdo-api*.jar
+HADOOP_ROOT/hive/lib/libfb303*.jar
+
+# HBase Libraries
+HADOOP_ROOT/hbase/lib/hbase-client*.jar
+HADOOP_ROOT/hbase/lib/hbase-common*.jar
+HADOOP_ROOT/hbase/lib/hbase-protocol*.jar
+HADOOP_ROOT/hbase/lib/htrace-core*.jar
+HADOOP_ROOT/hbase/lib/netty*.jar
+HADOOP_ROOT/hbase/lib/zookeeper*.jar
+HADOOP_ROOT/hbase/lib/metrics-core*.jar

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d2d3eaf5/pxf/pxf-service/src/configs/templates/pxf-private.classpath.template
----------------------------------------------------------------------
diff --git 
a/pxf/pxf-service/src/configs/templates/pxf-private.classpath.template 
b/pxf/pxf-service/src/configs/templates/pxf-private.classpath.template
deleted file mode 100644
index e3b3006..0000000
--- a/pxf/pxf-service/src/configs/templates/pxf-private.classpath.template
+++ /dev/null
@@ -1,81 +0,0 @@
-# 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.
-
-##################################################################
-# This file contains the internal classpaths required to run PXF.
-# Edit to set the base paths according to your specific package layout
-# Adding new resources should be done using pxf-public.classpath file.
-##################################################################
-
-# PXF Configuration
-PXF_HOME/conf
-
-# PXF Libraries
-PXF_HOME/lib/pxf-hbase.jar
-PXF_HOME/lib/pxf-hdfs.jar
-PXF_HOME/lib/pxf-hive.jar
-PXF_HOME/lib/pxf-json.jar
-PXF_HOME/lib/pxf-jdbc.jar
-
-# Hadoop/Hive/HBase configurations
-HADOOP_HOME/etc/hadoop
-HIVE_HOME/conf
-HBASE_HOME/conf
-
-# Hadoop Libraries
-HADOOP_HOME/share/hadoop/common/hadoop-common-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/hadoop-auth-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/asm-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/avro-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/commons-cli-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/commons-codec-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/commons-collections-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/commons-configuration-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/commons-io-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/commons-lang-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/commons-logging-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/guava-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/htrace-core*.jar
-HADOOP_HOME/share/hadoop/common/lib/jetty-*.jar
-HADOOP_HOME/share/hadoop/common/lib/jersey-core-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/jersey-server-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/log4j-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/protobuf-java-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/slf4j-api-*[0-9].jar
-HADOOP_HOME/share/hadoop/common/lib/snappy-java-*[0-9].jar
-HADOOP_HOME/share/hadoop/hdfs/hadoop-hdfs-*[0-9].jar
-HADOOP_HOME/share/hadoop/hdfs/lib/jackson-core-asl-*[0-9].jar
-HADOOP_HOME/share/hadoop/hdfs/lib/jackson-mapper-asl-*[0-9].jar
-HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-client-core-*[0-9].jar
-# CDH only Library
-HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-client-common-*[0-9].jar
-
-# Hive Libraries
-HIVE_HOME/lib/antlr-runtime*.jar
-HIVE_HOME/lib/datanucleus-api-jdo*.jar
-HIVE_HOME/lib/datanucleus-core*.jar
-HIVE_HOME/lib/hive-exec*.jar
-HIVE_HOME/lib/hive-metastore*.jar
-HIVE_HOME/lib/jdo-api*.jar
-HIVE_HOME/lib/libfb303*.jar
-
-# HBase Libraries
-HBASE_HOME/lib/hbase-client*.jar
-HBASE_HOME/lib/hbase-common*.jar
-HBASE_HOME/lib/hbase-protocol*.jar
-HBASE_HOME/lib/htrace-core*.jar
-HBASE_HOME/lib/netty*.jar
-HBASE_HOME/lib/zookeeper*.jar
-HBASE_HOME/lib/metrics-core*.jar

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d2d3eaf5/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/utilities/CustomWebappLoader.java
----------------------------------------------------------------------
diff --git 
a/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/utilities/CustomWebappLoader.java
 
b/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/utilities/CustomWebappLoader.java
index 7f45bf7..31ab696 100644
--- 
a/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/utilities/CustomWebappLoader.java
+++ 
b/pxf/pxf-service/src/main/java/org/apache/hawq/pxf/service/utilities/CustomWebappLoader.java
@@ -217,7 +217,7 @@ public class CustomWebappLoader extends WebappLoader {
                                throw new FileNotFoundException(pathUriStr + " 
cannot be read");
                        }
                        addRepository(pathUriStr);
-                       LOG.debug("Repository " + pathUriStr + " added from 
entry " + entry);
+                       LOG.info("Repository " + pathUriStr + " added from 
entry " + entry);
                        return true;
                } catch (Exception e) {
                        LOG.warn("Failed to load path " + path + " to 
repository: " + e);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d2d3eaf5/pxf/pxf-service/src/scripts/pxf-env.sh
----------------------------------------------------------------------
diff --git a/pxf/pxf-service/src/scripts/pxf-env.sh 
b/pxf/pxf-service/src/scripts/pxf-env.sh
index f33e61a..215a6b5 100644
--- a/pxf/pxf-service/src/scripts/pxf-env.sh
+++ b/pxf/pxf-service/src/scripts/pxf-env.sh
@@ -39,4 +39,15 @@ if [ ! -z '@pxfDefaultUser@' ]; then
 fi
 
 # Port
-export PXF_PORT=${PXF_PORT:-51200}
\ No newline at end of file
+export PXF_PORT=${PXF_PORT:-51200}
+
+# Hadoop Distribution Type (optional), supported values:
+# <empty> - for auto discovery of HDP, CDH or tarball based client installation
+# HDP     - for HDP Hadoop client installation
+# CDH     - for CDH Hadoop client installation
+# CUSTOM  - for custom Hadoop client installation
+export HADOOP_DISTRO=${HADOOP_DISTRO}
+
+# Parent directory of Hadoop client installation (optional)
+# used in case of tarball-based installation when all clients are under a 
common parent directory
+export HADOOP_ROOT=${HADOOP_ROOT}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d2d3eaf5/pxf/pxf-service/src/scripts/pxf-service
----------------------------------------------------------------------
diff --git a/pxf/pxf-service/src/scripts/pxf-service 
b/pxf/pxf-service/src/scripts/pxf-service
index ca1b34c..60d46c3 100644
--- a/pxf/pxf-service/src/scripts/pxf-service
+++ b/pxf/pxf-service/src/scripts/pxf-service
@@ -57,6 +57,13 @@ fi
 
 curl=`which curl`
 
+# print error message and return with error code
+function fail()
+{
+    echo "ERROR: $1"
+    exit 1
+}
+
 #
 # createInstance creates a tomcat instance 
 # configuration files 
@@ -206,24 +213,13 @@ function doInit()
                echo WARNING: instance already exists in $instance_root, 
nothing to do...
                return 0
        fi
-       # Generate private classpath file only if user specified hadoop_home 
option
-       # Otherwise use default file
-    if [ ! -z $hadoop_home ]; then
-        generatePrivateClasspath || return 1
-    else
-        if [ ! -z $hbase_home ]; then
-            echo WARNING: hbase_home option will be ignored, please specify 
hadoop_home
-        fi
-        if [ ! -z $hive_home ]; then
-            echo WARNING: hive_home option will be ignored, please specify 
hadoop_home
-        fi
-    fi
+       determineHadoopDistro
+       generatePrivateClasspath || return 1
        createInstance || return 1
        configureInstance || return 1
        deployWebapp || return 1
        createLogsDir || return 1
        createRunDir  || return 1
-
 }
 
 #
@@ -292,38 +288,90 @@ function createRunDir()
     return 0
 }
 
+function check_hadoop_install()
+{
+    local distro_type=${1}
+    case "${distro_type}" in
+        hdp|HDP)
+            if [ -d "/usr/hdp/current/hadoop-client/client" ]; then
+                DISTRO="hdp"
+                return 0;
+            fi
+            ;;
+        cdh|CDH)
+            if [ -d "/usr/lib/hadoop/client" ]; then
+                DISTRO="cdh"
+                return 0;
+            fi
+            ;;
+        tar|TAR)
+            if [ -n "${HADOOP_ROOT}" ] && [ -d 
"${HADOOP_ROOT}/hadoop/share/hadoop/common/lib" ]; then
+                DISTRO="tar"
+                return 0;
+            fi
+            ;;
+        custom|CUSTOM)
+            # use tarball template for custom distro, do not require 
HADOOP_ROOT to be set
+            DISTRO="tar"
+            return 0;
+            ;;
+        *)
+            fail "Unknown hadoop distribution type: 
HADOOP_DISTRO=${distro_type}"
+            ;;
+    esac
+    # the distro type was not found installed, return failure code
+    return 1
+}
+
+function determineHadoopDistro()
+{
+    DISTRO=""
+    # check if the distro is explicitly specified
+    if [ -z "${HADOOP_DISTRO}" ]; then
+        # if distro is not specified, try checking for HDP and then CDH
+        check_hadoop_install "hdp" || check_hadoop_install "cdh"
+    else
+        # check distro specified in the config file
+        check_hadoop_install "${HADOOP_DISTRO}"
+    fi
+
+    # if still not determined, check tarball-based install
+    if [ -z "${DISTRO}" ]; then
+        check_hadoop_install "tar"
+        # if still unknown, then error out
+        if [ -z "${DISTRO}" ]; then
+            fail "Can not determine Hadoop distribution, please install Hadoop 
clients."
+        fi
+    fi
+}
+
 function generatePrivateClasspath()
 {
-    echo "Generating private classpath file..."
-    #Create intial version of the file
-    sed -e "s|PXF_HOME|$PXF_HOME|g" 
$PXF_HOME/conf-templates/pxf-private.classpath.template > 
$PXF_HOME/conf/pxf-private.classpath
-    #Make sure $hadoop_home is defined
-    if [ -z $hadoop_home ]; then
-        echo ERROR: cant generate private classpath without hadoop_home value
-        return 1
+    # distro must have been determined by now, but double check
+    if [ -z "${DISTRO}" ]; then
+        fail "Hadoop distribution was not determined"
     fi
-    #Substitute HADOOP_HOME value
-    sed -i -e "s|HADOOP_HOME|$hadoop_home|g" 
$PXF_HOME/conf/pxf-private.classpath
-    if [ ! -z $hbase_home ]; then
-        #Substitute HBASE_HOME if hbase_home was set
-        sed -i -e "s|HBASE_HOME|$hbase_home|g" 
$PXF_HOME/conf/pxf-private.classpath
-    else
-        #Delete lines with HBASE_HOME if hbase_home wasn't set
-        sed -i -e "/HBASE_HOME/d" $PXF_HOME/conf/pxf-private.classpath
+
+    # verify that a template file for the distribution exists
+    local 
template_file="${PXF_HOME}/conf-templates/pxf-private-${DISTRO}.classpath.template"
+    if [ ! -f "${template_file}" ]; then
+        fail "Template file ${template_file} not found"
     fi
-    if [ ! -z $hive_home ]; then
-        #Substitute HIVE_HOME if hive_home was set
-        sed -i -e "s|HIVE_HOME|$hive_home|g" 
$PXF_HOME/conf/pxf-private.classpath
-    else
-        #Delete lines with HIVE_HOME if hive_home wasn't set
-        sed -i -e "/HIVE_HOME/d" $PXF_HOME/conf/pxf-private.classpath
+
+    echo "Generating ${PXF_HOME}/conf/pxf-private.classpath file from 
${template_file} ..."
+
+    # create initial version of the file by replacing PXF_HOME token 
(applicable to all templates)
+    sed -e "s|PXF_HOME|${PXF_HOME}|g" ${template_file} > 
${PXF_HOME}/conf/pxf-private.classpath
+
+    # substitute HADOOP_ROOT value if defined
+    if [ -n "${HADOOP_ROOT}" ]; then
+        sed -i -e "s|HADOOP_ROOT|${HADOOP_ROOT}|g" 
${PXF_HOME}/conf/pxf-private.classpath
     fi
 }
 
 function printUsage()
 {
-    echo $"Usage: $0 {start|stop|restart|init --hadoop-home HADOOP_LOCATION 
[--hive-home HIVE_LOCATION --hbase-home HBASE_LOCATION]|status}"
-
+    echo $"Usage: $0 {start|stop|restart|init|status}"
 }
 
 function validateParameters()
@@ -361,8 +409,6 @@ function validateParameters()
         exit 1
     fi
 
-
-
     # validate JAVA_HOME
     if [ ! -x $JAVA_HOME/bin/java ]; then
         echo ERROR: \$JAVA_HOME is invalid
@@ -415,31 +461,6 @@ command=$1
 
 case "$command" in
        "init" )
-               shift
-               while [[ $# -gt 1 ]]
-               do
-                       name="$1"
-                       value="$2"
-                       case $name in
-                               --hadoop-home)
-                               hadoop_home="$2"
-                               shift
-                               ;;
-                               --hive-home)
-                                hive_home="$2"
-                                shift
-                                ;;
-                               --hbase-home)
-                                hbase_home="$2"
-                                shift
-                                ;;
-                               *)
-                                echo "$name is an unknown option"
-                                printUsage
-                                exit 1
-                       esac
-                       shift
-               done
                validateParameters
                doInit
                ;;

Reply via email to