You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by ar...@apache.org on 2015/12/01 01:18:52 UTC

[3/5] incubator-trafodion git commit: Add trafci.sh-tmpl

Add trafci.sh-tmpl


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

Branch: refs/heads/master
Commit: 08e309225cbc17cf6617509149a939729d97e1ef
Parents: 63beca6
Author: Kevin Xu <ka...@esgyn.cn>
Authored: Fri Nov 27 09:15:47 2015 +0800
Committer: Kevin Xu <ka...@esgyn.cn>
Committed: Fri Nov 27 09:15:47 2015 +0800

----------------------------------------------------------------------
 core/conn/trafci/build.xml            |   5 +
 core/conn/trafci/utils/trafci.sh      | 187 -----------------------------
 core/conn/trafci/utils/trafci.sh-tmpl | 187 +++++++++++++++++++++++++++++
 3 files changed, 192 insertions(+), 187 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/08e30922/core/conn/trafci/build.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/build.xml b/core/conn/trafci/build.xml
index 72c568c..22603d8 100644
--- a/core/conn/trafci/build.xml
+++ b/core/conn/trafci/build.xml
@@ -145,6 +145,11 @@
            tofile="${utils.dir}/trafci.cmd"
            overwrite="true">
        </copy>
+       <copy file="${utils.dir}/trafci.sh-tmpl"
+           tofile="${utils.dir}/trafci.sh"
+           overwrite="true">
+       </copy>
+    	
 
        <replace file="${utils.dir}/trafci.cmd" token="@prodver@" value="${my_env.TRAFODION_VER_PROD}"/>
        <replace file="${utils.dir}/trafci.cmd" token="@copyrighthdr@" value="${my_env.PRODUCT_COPYRIGHT_HEADER}"/>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/08e30922/core/conn/trafci/utils/trafci.sh
----------------------------------------------------------------------
diff --git a/core/conn/trafci/utils/trafci.sh b/core/conn/trafci/utils/trafci.sh
deleted file mode 100644
index 53ee1f2..0000000
--- a/core/conn/trafci/utils/trafci.sh
+++ /dev/null
@@ -1,187 +0,0 @@
-#!/bin/sh
-# @@@ START COPYRIGHT @@@
-#
-# 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.
-#
-# @@@ END COPYRIGHT @@@
-
-
-#
-#  Classpath required for execution. Specifies the jar files containing
-#  the HP JDBC T4 classes and the Trafodion Command Interface classes.
-#
-
-TRAFCI_CLASSPATH="##TRAFCI_CLASSPATH##"
-export TRAFODION_VER_PROD="##prodver##"
-export PRODUCT_COPYRIGHT_HEADER="##copyrighthdr##"
-
-#  Internally used variables.
-#  Name of the main Trafodion Command Interface class.
-#
-UIMAINCLASS_NAME="org.trafodion.ci.UserInterface"
-
-
-#
-#  Name of this script and the number of arguments passed to this script.
-#
-SCRIPT_NAME=$0
-ARGS_CNT=$# 
-#echo "***DEBUG*** Script = $0 , Arguments passed = $@"
-
-
-#
-#  Query option and value specified by the user.
-#
-QUERY_OPTION=""
-QUERY_ARG=""
-
-
-#
-#  Command line parameter values to pass onto the entry-point/main UI class.
-#
-UIMAINCLASS_PARAMS=""
-
-
-#
-#  Check if java is in the PATH (can be invoked).
-#
-#
-
-JAVAHOME=`echo $JAVA_HOME`
-if [ ! -x  "$JAVAHOME" ]; then
-   OSNAME=`uname -s`
-   if [ "$OSNAME" = "HP-UX" ]; then
-      JAVA_CMD=`whence java`
-   else
-      JAVA_CMD=`which java`
-   fi
-
-  if [ ! -x  "$JAVA_CMD" ]; then
-     echo "***Warning***: Missing JAVA_HOME in the environment. "
-     echo "               Please set JAVA_HOME "
-   fi
-else
-   PATH=$JAVAHOME/bin:$PATH
-   export PATH  
-fi
-
-#
-#  Loop thru' all the options passed to this script and check for -q and -sql
-#  and set QUERY_OPTION and QUERY_ARG values appropriately.
-#
-while [ $# -gt 0 ]; do  # {{
-   #  Convert to lower-case for -q|-sql checks.
-   OPT_VALUE=`echo $1 | tr 'A-Z' 'a-z'`
-
-   #  Check if its a -q or -sql option.
-   if [ "ci$OPT_VALUE" = "ci-q"  -o "ci$OPT_VALUE" = "ci-sql" ]; then # {{{
-
-      #
-      #  If -q or -sql was specified earlier -- we ignore it!!
-      #  Use the first -q or -sql option value. Same as old bash code.
-      #
-      #  *****TODO: Maybe we just use the last -q|-sql option value.
-      #
-      if [ -z "$QUERY_OPTION" ]; then  # {{{/{
-         #
-         #  Set QUERY_OPTION with the specified -q|-sql option and
-         #  move onto the next argument value
-         #
-         QUERY_OPTION=$1
-         shift;
-
-         #
-         #  Check if we have any more arguments and if so set QUERY_ARG.
-         #
-         if [ $# -gt 0 ]; then
-            QUERY_ARG=$1
-         fi
-      else
-
-         #
-         #  -q|-sql was already specified -- just add it to the UI MainClass
-         #  arguments for now.
-         #
-         #
-         UIMAINCLASS_PARAMS="$UIMAINCLASS_PARAMS $1"
-
-      fi  #  }}}} End of  IF  QUERY_OPTION was not already set.
-
-   else  
-
-      #
-      #  Its *not*  a -q|-sql option, so just add it to the UI MainClass
-      #  arguments.
-      #
-      if [ "ci$OPT_VALUE" = "ci-u"  -o "ci$OPT_VALUE" = "ci-user" ]; then # {{{{{{
-         USER_ARG=$1
-         shift;
-         USER_OPTION="$1"
-      else
-         if [ "ci$OPT_VALUE" = "ci-p"  -o "ci$OPT_VALUE" = "ci-password" ]; then # {{{{{{{
-           PASSWORD_ARG=$1
-           shift;
-           PASSWORD_OPTION="$1"
-         else
-           if [ "ci$OPT_VALUE" = "ci-r"  -o "ci$OPT_VALUE" = "ci-role" ]; then # {{{{{{{{
-             ROLE_ARG=$1
-             shift;
-             ROLE_VALUE=$1
-             UIMAINCLASS_PARAMS="$UIMAINCLASS_PARAMS $ROLE_ARG \"$ROLE_VALUE\""
-           else
-             UIMAINCLASS_PARAMS="$UIMAINCLASS_PARAMS $1"
-            
-           fi # End of check for Role }}}}}}}}          
-         
-         fi # End of check for password }}}}}}}
-         
-      fi # End of check for user }}}}}}
-
-   fi  #  }}} End of  IF the option is -q or -sql.
-   shift
-done  #  }} End of WHILE there are more arguments.
-
-# Add default role argument -r ""
-if [ "ci$ROLE_ARG" = "ci" ]; then
-  UIMAINCLASS_PARAMS="$UIMAINCLASS_PARAMS -r \"\""
-fi
-
-#
-#  Set the jcmd_opts and invoke the java program.
-#  
-jcmd_opts="-classpath $TRAFCI_CLASSPATH $UIMAINCLASS_NAME $UIMAINCLASS_PARAMS "
-#echo "***DEBUG*** jcmd_opts = java $jcmd_opts $QUERY_OPTION \"$QUERY_ARG\" "
-
-jusercred_opts=""
-if [ ! -z "$USER_OPTION" ]; then
-   jusercred_opts="$USER_ARG \"$USER_OPTION\""
-fi
-
-if [ ! -z "$PASSWORD_ARG" ]; then
-   jusercred_opts="$jusercred_opts $PASSWORD_ARG \"$PASSWORD_OPTION\""
-fi
-
-#echo "***DEBUG*** jusercred_opts = $jusercred_opts"
-#echo ""
-#echo "***DEBUG*** running command = java $jcmd_opts $jusercred_opts $QUERY_OPTION \"$QUERY_ARG\"  "
-
-if [ ! -z "$QUERY_OPTION"  ]; then
-        eval java $jcmd_opts $jusercred_opts $QUERY_OPTION \'"$QUERY_ARG"\'
-else
-        eval java $jcmd_opts $jusercred_opts
-fi

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/08e30922/core/conn/trafci/utils/trafci.sh-tmpl
----------------------------------------------------------------------
diff --git a/core/conn/trafci/utils/trafci.sh-tmpl b/core/conn/trafci/utils/trafci.sh-tmpl
new file mode 100644
index 0000000..53ee1f2
--- /dev/null
+++ b/core/conn/trafci/utils/trafci.sh-tmpl
@@ -0,0 +1,187 @@
+#!/bin/sh
+# @@@ START COPYRIGHT @@@
+#
+# 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.
+#
+# @@@ END COPYRIGHT @@@
+
+
+#
+#  Classpath required for execution. Specifies the jar files containing
+#  the HP JDBC T4 classes and the Trafodion Command Interface classes.
+#
+
+TRAFCI_CLASSPATH="##TRAFCI_CLASSPATH##"
+export TRAFODION_VER_PROD="##prodver##"
+export PRODUCT_COPYRIGHT_HEADER="##copyrighthdr##"
+
+#  Internally used variables.
+#  Name of the main Trafodion Command Interface class.
+#
+UIMAINCLASS_NAME="org.trafodion.ci.UserInterface"
+
+
+#
+#  Name of this script and the number of arguments passed to this script.
+#
+SCRIPT_NAME=$0
+ARGS_CNT=$# 
+#echo "***DEBUG*** Script = $0 , Arguments passed = $@"
+
+
+#
+#  Query option and value specified by the user.
+#
+QUERY_OPTION=""
+QUERY_ARG=""
+
+
+#
+#  Command line parameter values to pass onto the entry-point/main UI class.
+#
+UIMAINCLASS_PARAMS=""
+
+
+#
+#  Check if java is in the PATH (can be invoked).
+#
+#
+
+JAVAHOME=`echo $JAVA_HOME`
+if [ ! -x  "$JAVAHOME" ]; then
+   OSNAME=`uname -s`
+   if [ "$OSNAME" = "HP-UX" ]; then
+      JAVA_CMD=`whence java`
+   else
+      JAVA_CMD=`which java`
+   fi
+
+  if [ ! -x  "$JAVA_CMD" ]; then
+     echo "***Warning***: Missing JAVA_HOME in the environment. "
+     echo "               Please set JAVA_HOME "
+   fi
+else
+   PATH=$JAVAHOME/bin:$PATH
+   export PATH  
+fi
+
+#
+#  Loop thru' all the options passed to this script and check for -q and -sql
+#  and set QUERY_OPTION and QUERY_ARG values appropriately.
+#
+while [ $# -gt 0 ]; do  # {{
+   #  Convert to lower-case for -q|-sql checks.
+   OPT_VALUE=`echo $1 | tr 'A-Z' 'a-z'`
+
+   #  Check if its a -q or -sql option.
+   if [ "ci$OPT_VALUE" = "ci-q"  -o "ci$OPT_VALUE" = "ci-sql" ]; then # {{{
+
+      #
+      #  If -q or -sql was specified earlier -- we ignore it!!
+      #  Use the first -q or -sql option value. Same as old bash code.
+      #
+      #  *****TODO: Maybe we just use the last -q|-sql option value.
+      #
+      if [ -z "$QUERY_OPTION" ]; then  # {{{/{
+         #
+         #  Set QUERY_OPTION with the specified -q|-sql option and
+         #  move onto the next argument value
+         #
+         QUERY_OPTION=$1
+         shift;
+
+         #
+         #  Check if we have any more arguments and if so set QUERY_ARG.
+         #
+         if [ $# -gt 0 ]; then
+            QUERY_ARG=$1
+         fi
+      else
+
+         #
+         #  -q|-sql was already specified -- just add it to the UI MainClass
+         #  arguments for now.
+         #
+         #
+         UIMAINCLASS_PARAMS="$UIMAINCLASS_PARAMS $1"
+
+      fi  #  }}}} End of  IF  QUERY_OPTION was not already set.
+
+   else  
+
+      #
+      #  Its *not*  a -q|-sql option, so just add it to the UI MainClass
+      #  arguments.
+      #
+      if [ "ci$OPT_VALUE" = "ci-u"  -o "ci$OPT_VALUE" = "ci-user" ]; then # {{{{{{
+         USER_ARG=$1
+         shift;
+         USER_OPTION="$1"
+      else
+         if [ "ci$OPT_VALUE" = "ci-p"  -o "ci$OPT_VALUE" = "ci-password" ]; then # {{{{{{{
+           PASSWORD_ARG=$1
+           shift;
+           PASSWORD_OPTION="$1"
+         else
+           if [ "ci$OPT_VALUE" = "ci-r"  -o "ci$OPT_VALUE" = "ci-role" ]; then # {{{{{{{{
+             ROLE_ARG=$1
+             shift;
+             ROLE_VALUE=$1
+             UIMAINCLASS_PARAMS="$UIMAINCLASS_PARAMS $ROLE_ARG \"$ROLE_VALUE\""
+           else
+             UIMAINCLASS_PARAMS="$UIMAINCLASS_PARAMS $1"
+            
+           fi # End of check for Role }}}}}}}}          
+         
+         fi # End of check for password }}}}}}}
+         
+      fi # End of check for user }}}}}}
+
+   fi  #  }}} End of  IF the option is -q or -sql.
+   shift
+done  #  }} End of WHILE there are more arguments.
+
+# Add default role argument -r ""
+if [ "ci$ROLE_ARG" = "ci" ]; then
+  UIMAINCLASS_PARAMS="$UIMAINCLASS_PARAMS -r \"\""
+fi
+
+#
+#  Set the jcmd_opts and invoke the java program.
+#  
+jcmd_opts="-classpath $TRAFCI_CLASSPATH $UIMAINCLASS_NAME $UIMAINCLASS_PARAMS "
+#echo "***DEBUG*** jcmd_opts = java $jcmd_opts $QUERY_OPTION \"$QUERY_ARG\" "
+
+jusercred_opts=""
+if [ ! -z "$USER_OPTION" ]; then
+   jusercred_opts="$USER_ARG \"$USER_OPTION\""
+fi
+
+if [ ! -z "$PASSWORD_ARG" ]; then
+   jusercred_opts="$jusercred_opts $PASSWORD_ARG \"$PASSWORD_OPTION\""
+fi
+
+#echo "***DEBUG*** jusercred_opts = $jusercred_opts"
+#echo ""
+#echo "***DEBUG*** running command = java $jcmd_opts $jusercred_opts $QUERY_OPTION \"$QUERY_ARG\"  "
+
+if [ ! -z "$QUERY_OPTION"  ]; then
+        eval java $jcmd_opts $jusercred_opts $QUERY_OPTION \'"$QUERY_ARG"\'
+else
+        eval java $jcmd_opts $jusercred_opts
+fi