You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by li...@apache.org on 2016/12/08 00:45:28 UTC

[01/38] incubator-trafodion git commit: convert trafci project into maven project

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 672b6d114 -> 515ff4c54


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/help/sql_common.help
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/help/sql_common.help b/core/conn/trafci/src/org/trafodion/ci/help/sql_common.help
deleted file mode 100644
index be2e14c..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/help/sql_common.help
+++ /dev/null
@@ -1,376 +0,0 @@
-// @@@ 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 @@@
-
- @@@@@HELP
-
-   The command interface supports these commands:
-
-    @           LOG                     SET TIMING
-    ALIAS       OBEY                    SHOW ALIAS
-    CLEAR       QUIT                    SHOW ALIASES
-    CONNECT     RECONNECT               SHOW COLSEP
-    DELAY       REPEAT                  SHOW ERRORCODE
-    DISCONNECT  RESET LASTERROR         SHOW HISTOPT
-    ENV         SAVEHIST                SHOW IDLETIMEOUT
-    EXIT        SESSION (SHOW SESSION)  SHOW LASTERROR
-                SET COLSEP              SHOW MARKUP
-    FC          SET CONNECTOPT ROLE     SHOW ROLE
-    GOTO        SET HISTOPT             SHOW SESSION
-    HELP        SET IDLETIMEOUT         SHOW TIME
-    HISTORY     SET MARKUP              SHOW TIMING
-    IF...THEN   SET PROMPT              SPOOL
-    LABEL       SET TIME                VERSION
-    LOCALHOST  
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET
-
-   The command interface supports these SET commands:
-
-    SET COLSEP           SET IDLETIMEOUT  SET TIME    
-    SET CONNECTOPT ROLE  SET MARKUP       SET TIMING  
-    SET HISTOPT          SET PROMPT                   
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW
-
-   The command interface supports these SHOW commands:
-
-    SHOW ALIAS      SHOW IDLETIMEOUT  SHOW SESSION   
-    SHOW ALIASES    SHOW LASTERROR    SHOW TIME      
-    SHOW COLSEP     SHOW MARKUP       SHOW TIMING    
-    SHOW ERRORCODE  SHOW ROLE           
-    SHOW HISTOPT                            
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@HELP
-
-   These interface commands can be run only in SQL mode, which
-   is the default mode in TRAFCI:
-
-    /               SET PARAM           SHOW PROCEDURES             
-    GET STATISTICS  SET SQLPROMPT       SHOW RECCOUNT              
-    PRUN            SET SQLTERMINATOR   SHOW SCHEMA        
-    RESET PARAM     SET STATISTICS      SHOW SCHEMAS           
-    RUN             SHOW ACTIVITYCOUNT  SHOW SQLPROMPT        
-    SET FETCHSIZE   SHOW FETCHSIZE      SHOW SQLTERMINATOR  
-    SET LIST_COUNT  SHOW LIST_COUNT     SHOW SYNONYMS                         
-                    SHOW MVGROUPS       SHOW TABLE  
-                    SHOW MVS            SHOW TABLES               
-                    SHOW PARAM          SHOW VIEWS                
-                    SHOW PREPARED       
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
-   SQL mode also supports SQL statements. For descriptions of 
-   the SQL statements, see the SQL Reference Manual.
-
- @@@@@SET
-
-   SQL mode supports these SET commands:
-
-    SET FETCHSIZE   SET PARAM      SET SQLTERMINATOR  
-    SET LIST_COUNT  SET SQLPROMPT  SET STATISTICS     
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW
-
-   SQL mode supports these SHOW commands:
-
-    SHOW ACTIVITYCOUNT  SHOW PARAM       SHOW SQLTERMINATOR  
-    SHOW FETCHSIZE      SHOW PREPARED    SHOW STATISTICS     
-    SHOW INDEXES        SHOW PROCEDURES  SHOW SYNONYMS       
-    SHOW LIST_COUNT     SHOW RECCOUNT    SHOW TABLE          
-    SHOW MVGROUPS       SHOW SCHEMA      SHOW TABLES         
-    SHOW MVS            SHOW SCHEMAS     SHOW VIEWS        
-                        SHOW SQLPROMPT            
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@/
-
-   The / command executes the previously executed SQL statement. This command
-   does not repeat an interface command.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
-
- @@@@@GET STATISTICS
-
-   The GET STATISTICS command returns formatted statistics for the last
-   executed SQL statement.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@PRUN
-
-   The PRUN command runs script files in parallel.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@RESET PARAM
-
-   The RESET PARAM command clears all parameter values or a specified
-   parameter value in the current session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@RUN
-
-   The RUN command executes the previously executed SQL statement. This
-   command does not repeat an interface command.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET FETCHSIZE
-
-   The SET FETCHSIZE command allows you to change the default fetchsize used
-   by JDBC. Setting the value to 0 sets the fetchsize to the default value
-   used in JDBC.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET LIST_COUNT
-
-   The SET LIST_COUNT command sets the maximum number of rows to be returned
-   by SELECT statements that are executed after this command. The default is
-   zero, which means that all rows are returned.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET PARAM
-
-   The SET PARAM command associates a parameter name with a parameter value
-   in the current session. 
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET SQLPROMPT
-
-   The SET SQLPROMPT command sets the SQL prompt of the current session to a
-   specified string. The default is SQL>.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET SQLTERMINATOR
-
-   The SET SQLTERMINATOR command sets the SQL statement terminator of the
-   current session. The default is a semicolon (;).
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET STATISTICS
-
-   The SET STATISTICS command automatically retrieves the statistics
-   information for a query being executed. The results returned are the same
-   as would have been returned if the GET STATISTICS command was executed.
-   The default is OFF which means the statistics information is not
-   automatically printed for any queries.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
-
- @@@@@SHOW ACTIVITYCOUNT
-
-   The SHOW ACTIVITYCOUNT command provides an alias for SHOW RECCOUNT.
-   ACTIVITYCOUNT is an alias for RECCOUNT.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW FETCHSIZE
-
-   The SHOW FETCHSIZE command displays the fetch size value for the current
-   Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW INDEXES
-
-   The SHOW INDEXES command displays all indexes on all tables and 
-   materialized views in the current schema of the Command Interface
-   session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW LIST_COUNT
-
-   The SHOW LIST_COUNT command displays the maximum number of rows to be
-   returned by SELECT statements in the current Command Interface session.
-   The default is zero, which means that all rows are returned.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW MVGROUPS
-
-   The SHOW MVGROUPS command displays all or a set of the materialized view
-   groups in the current schema of the Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW MVS
-
-   The SHOW MVS command displays all or a set of the materialized views in
-   the current schema of the Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW PARAM
-
-   The SHOW PARAM command displays the parameters that are set in the current
-   Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW PREPARED
-
-   The SHOW PREPARED command displays the prepared statements in the current
-   Command Interface session. If a pattern is specified, all prepared
-   statements matching the prepared statement name pattern are displayed. By
-   default, all prepared statements in the current session are displayed.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW PROCEDURES
-
-   The SHOW PROCEDURES command displays the procedures (Stored Procedures in
-   Java) in the current schema of the Command Interface session. If a
-   pattern is specified, all procedures matching the pattern are displayed.
-   By default, all procedures in the current schema of the Command Interface
-   session are displayed.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW RECCOUNT
-
-   The SHOW RECCOUNT command displays the record count of the previously
-   executed SQL statement. If the previously executed command was an
-   interface command, the Command Interface returns zero. Otherwise, the
-   Command Interface returns the count of the previously executed SQL
-   statement. For commands that invoke the catalog APIs-SHOW TABLES, VIEWS,
-   SYNONYMS, MVS, and so on-SHOW RECCOUNT returns the count of the database
-   objects.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW SCHEMA
-
-   The SHOW SCHEMA command displays the current schema of the Command
-   Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW SCHEMAS
-
-   The SHOW SCHEMAS command displays all or a set of the schemas that exist
-   in the default catalog of the current Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW SQLPROMPT
-
-   The SHOW SQLPROMPT command displays the value of the SQL prompt for the
-   current Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW SQLTERMINATOR
-
-   The SHOW SQLTERMINATOR command displays the SQL statement terminator of
-   the current Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW STATISTICS
-
-   The SHOW STATISTICS command displays if statistics has been enabled or
-   disabled for the current session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW SYNONYMS
-
-   The SHOW SYNONYMS command displays all or a set of the synonyms in the
-   current schema of the Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW TABLE
-
-   The SHOW TABLE command displays information about the indexes,
-   materialized views, synonyms, or triggers associated with a 
-   specified table or materialized view.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW TABLES
-
-   The SHOW TABLES command displays all or a set of the tables that exist in
-   the current schema of the Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW VIEWS
-
-   The SHOW VIEWS command displays all or a set of the views that exist in
-   the current schema of the Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/ArgMap.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/ArgMap.java b/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/ArgMap.java
deleted file mode 100644
index 3112771..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/ArgMap.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**********************************************************************
-// @@@ 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 @@@
-**********************************************************************/
-package org.trafodion.ci.pwdencrypt;
-
-import java.util.HashMap;
-/**
- * The map of valid arguments.
- *
- */
-public class ArgMap {
-
-	/**
-	 * Map of valid arguments.
-	 */
-	public static final HashMap<Character, ArgsDef> ARGMAP = argMapBuilder();
-	
-	/**
-	 * Constructor.
-	 * @return ArgMap
-	 */
-	private static HashMap<Character, ArgsDef> argMapBuilder() {
-		HashMap<Character, ArgsDef> constructmap = 
-			new HashMap<Character, ArgsDef>();
-		constructmap.put('o', new ArgsDef(
-				"option", true, 'o', 
-				"either \"install\", \"add\", or \"del\""));
-		constructmap.put('u', new ArgsDef(
-				"username", true, 'u', 
-				"username valid only for \"add\" and \"del\""));
-		constructmap.put('p', new ArgsDef(
-				"password", true, 'p', 
-				"password valid only for \"add\""));
-		constructmap.put('l', new ArgsDef(
-				"logdir",  true, 'l', "Specify log file directory"));
-		constructmap.put('f', new ArgsDef(
-				"logfile", true, 'f', "Specify log file name"));
-		constructmap.put('h', new ArgsDef(
-				"help", false, 'h', "Display this message"));
-		return constructmap;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/ArgsDef.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/ArgsDef.java b/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/ArgsDef.java
deleted file mode 100644
index 0ef9581..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/ArgsDef.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**********************************************************************
-// @@@ 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 @@@
-**********************************************************************/
-package org.trafodion.ci.pwdencrypt;
-
-public class ArgsDef {
-
-
-	private String name;
-	private boolean argrequired;
-	private char ident;
-	private String error;
-	
-	/**
-	 * Constructor.
-	 * @param name name of option rule
-	 * @param argrequired is option required
-	 * @param ident char that coralates command to arg
-	 */
-	public ArgsDef(String name, boolean argrequired, char ident, String error) {
-		this.name = name;
-		this.argrequired = argrequired;
-		this.ident = ident;
-		this.error = error;
-	}
-
-	/**
-	 * Returns ident char.
-	 * @return the ident
-	 */
-	public final char getIdent() {
-		return ident;
-	}
-
-	/**
-	 * @return the name
-	 */
-	public final String getName() {
-		return name;
-	}
-
-	/**
-	 * @return the required
-	 */
-	public final boolean isArgRequired() {
-		return argrequired;
-	}
-
-	/**
-	 * @return the error
-	 */
-	public final String getError() {
-		return error;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/EncryptUtil.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/EncryptUtil.java b/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/EncryptUtil.java
deleted file mode 100644
index 6df66e4..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/EncryptUtil.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/**********************************************************************
-// @@@ 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 @@@
-**********************************************************************/
-/**
- *
- */
-package org.trafodion.ci.pwdencrypt;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-
-public class EncryptUtil {
-
-	/**
-	 * Java Cryptor.
-	 */
-	private static JCE j = new JCE();
-	static boolean doTrace = Boolean.getBoolean("trafci.enableTrace");
-
-
-	/**
-	 * Main method.
-	 * @param args arguments from command line
-	 */
-	public static void main(final String[] args) {
-		PasswordOpts settings = new PasswordOpts();
-		settings.parseCommandLine(args);
-		try {
-			if (settings.getWktype().equalsIgnoreCase(WorkTypes.ADD)) {
-				add(settings.getRef(), settings.getText());
-			//	System.out.println("Decrypting the password::");
-				//j.initSiteEncryptionService();
-				//	read encrypt file
-				ArrayList<String> refs = readLines();
-				if (!refs.isEmpty()) {
-					for (int i=0; i < refs.size(); i++) {
-					//	System.out.println("refs["+i+"]" + refs.get(i));
-						RefLookup.resolve(refs.get(i));
-						/*System.out.println("ref stri = " + ss.substring(3, ss.length()-1));
-                        System.out.println("Pw::" + ss);*/
-					}
-				}
-				
-				//System.out.println((j.decrypt("{DES}44SnpMxWui2uqvrrVzJwZA==")).toString());
-			} else if (settings.getWktype().equalsIgnoreCase(WorkTypes.DEL)) {
-				del(settings.getRef());
-			} else if (settings.getWktype()
-					.equalsIgnoreCase(WorkTypes.INSTALL)) {
-				j.setupSiteEncryptionService();
-			}
-		} catch (Exception e) {
-			StringBuffer msg = new StringBuffer();
-			msg.append("\n\tError Message: ").append(e.getMessage());
-			if (doTrace) { 
-				e.printStackTrace();
-			}
-			System.exit(1);
-		}
-	}
-
-	/**
-	 * Adds a encryption map to the secfile.
-	 * @param ref reference test
-	 * @param tw text word
-	 * @throws DBTransporterException on error
-	 */
-	private static void add(final String ref, final String tw)
-	throws Exception {
-		//init encryptor
-		j.initSiteEncryptionService();
-		final String en =
-			j.encrypt(j.sitePair.encryptor, tw);
-
-		//read encrypt file
-		ArrayList<String> refs = readLines();
-
-		//remove existing entry
-		for (int i=0; i< refs.size(); i++) {
-			if (ref != null){
-				if (0 == refs.get(i).indexOf(ref + " = {DES}")) {
-					refs.remove(refs.get(i));
-					break;
-					//System.exit(0);
-				}
-			}
-		}
-		//add the new entry
-		refs.add(ref + " = {DES}" + en);
-		writelines(refs);
-	}
-
-	/**
-	 * Deletes encryption reference.
-	 * @param ref reference name
-	 */
-	private static void del(final String ref) {
-		//read in encrypt file
-		ArrayList<String> refs = readLines();
-		//locate by ref and delete
-		//For on-platform, clear the encrypted file when option is del
-		for (int i=0; i< refs.size(); i++) {
-			if (ref != null){
-				if (0 == refs.get(i).indexOf(ref + " = {DES}")) {
-					refs.remove(refs.get(i));
-					break;
-					//System.exit(0);
-				}
-			}
-		}
-		if (refs != null){
-			//refs.clear();
-			writelines(refs);
-		}
-		//if(doTrace) 
-				//System.out.println("Failed in del:: " + ref);
-
-	}
-	
-	/**
-	 * Reads encctlprops file.
-	 * @return ArrayList of the reference maps.
-	 */
-	public static ArrayList<String> readLines() {
-		ArrayList<String> refs = new ArrayList<String>();
-		
-		try {
-			//get file in stream
-
-
-
-
-
-
-			StringBuilder buff = new StringBuilder();
-			StringBuilder ref = new StringBuilder();
-			
-			File secfile = new File(j.getSecDir() + JCE.encfilename);
-			FileInputStream fis = new FileInputStream(secfile);
-			InputStreamReader converter = new InputStreamReader(fis);
-			BufferedReader in = new BufferedReader(converter);
-			String tmpStr="";
-			String prevStr=null, nextStr=null;
-			
-			//This loop will read the complete reference string even if it
-			//spans to multiple lines. This way the partial delete or addition 	
-			//to the reference is avoided.
-			prevStr = in.readLine();
-			while(prevStr != null ){
-				nextStr = in.readLine();
-				
-				if (prevStr.contains(" = {DES}")){
-					if( nextStr == null || (nextStr!= null && nextStr.contains(" = {DES}"))){
-						buff.append(prevStr);
-						buff.append('\n');						
-					}
-					else {
-						tmpStr = prevStr;
-					}
-				}
-				else{
-					tmpStr = tmpStr + prevStr; 
-					if (nextStr == null || nextStr.contains(" = {DES}")){
-						buff.append(tmpStr);
-						buff.append('\n');						
-					}
-				}
-				prevStr = nextStr;
-				
-			}
-		
-			// read and assign to refs list
-			char c;
-			for(int i =0; i< buff.length(); i++){
-				if((c = buff.charAt(i)) != '\n' ){
-					ref.append(c);
-				}
-				else{
-					refs.add(ref.toString());
-					ref =  new StringBuilder();
-				}	
-			}
-			
-			//close stream
-			fis.close();
-			
-		} catch (IOException e) {
-			StringBuffer msg = new StringBuffer();
-			msg.append("\n\tError Message: ").append(e.getMessage());
-			if (doTrace) { // log stack trace
-				
-				e.printStackTrace();
-			}
-			
-		}
-		return refs;
-	}
-	
-	/**
-	 * Writes encctlprops using list provided by add or del.
-	 * @param refs list provided by add or del
-	 */
-	private static void writelines(final ArrayList<String> refs) {
-		StringBuilder buff = new StringBuilder();
-		
-		for (String ref : refs) {
-			buff.append(ref + '\n');
-		}
-		
-		try {
-			String pathName = j.getSecDir() + JCE.encfilename;
-			File secfile = new File(pathName);
-			FileOutputStream fos = new FileOutputStream(secfile);
-			fos.write(buff.toString().getBytes());
-			fos.flush();
-			fos.close();
-			Runtime.getRuntime().exec("chmod 600 " + pathName);
-		} catch (IOException e) {
-			StringBuffer msg = new StringBuffer();
-			msg.append("\n\tError Message: ").append(e.getMessage());
-			if (doTrace) { // log stack trace
-			e.printStackTrace();
-			}
-			
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/JCE.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/JCE.java b/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/JCE.java
deleted file mode 100644
index fb03403..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/JCE.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/**********************************************************************
-// @@@ 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 @@@
-**********************************************************************/
-package org.trafodion.ci.pwdencrypt;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.spec.AlgorithmParameterSpec;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.KeySpec;
-import java.util.Arrays;
-import java.util.Properties;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.Cipher;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.KeyGenerator;
-import javax.crypto.NoSuchPaddingException;
-import javax.crypto.SecretKey;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.DESKeySpec;
-import javax.crypto.spec.PBEKeySpec;
-import javax.crypto.spec.PBEParameterSpec;
-
-
-public class JCE {
-	public static final String SECRETKEY_ALGORITHM = "PBEWithMD5AndDES";
-	public static final String SYMMETRICKEY_ALGORITHM = "DES";
-	public static final String DIGEST_ALGORITHM = "MD5";
-
-    private static final byte[] salt = { (byte)0xFF, (byte)0x20, (byte)0xDF,
-    	(byte)0xA6, (byte)0x5D, (byte)0x0D, (byte)0x34, (byte)0xD2 };
-
-    private static final char[] pass = { '\u00FF','\u0010','\u00EF', '\u00F6',
-    	 '\u004B', '\u0004', '\u0056', '\u0088' };
-
-    protected static final String encfilename = "/encprops.txt";
-	private static final int count = 20;
-
-	private String ciHome;
-
-	private String secDir;
-
-	private String secFile;
-
-	private static final String securityDir = ".ciconf";
-
-	private static final String securityFile = "security.props";
-
-	CipherPair basePair;
-
-	CipherPair sitePair;
-
-	MessageDigest md5;
-
-
-	/**
-	 *
-	 */
-	public JCE() {
-		this.ciHome = System.getenv("USERHOME"); //System.getProperty("user.dir");
-		if (ciHome ==null){
-			System.out.println("USERHOME set failed, Please check trafci/bin/ciencr.sh");
-		}
-		this.secDir = this.ciHome + '/' + securityDir; // "/sql/scripts/" + securityDir;
-		this.secFile = this.secDir + '/' + securityFile;
-		
-		try {
-			md5 = initDigest();
-			basePair = initCiphers(pass, salt, count);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-
-	public void setupSiteEncryptionService() throws Exception {
-		try {
-			makeSecurityDir();
-
-			KeyGenerator keyGen = KeyGenerator.getInstance("DES");
-
-			SecretKey sKey = keyGen.generateKey();
-			byte[] encKey = sKey.getEncoded();
-			// We write two files, a digest of the key and the
-			// encrypted key itself
-			md5.reset();
-			byte[] digest = md5.digest(encKey);
-			sun.misc.BASE64Encoder ben = new sun.misc.BASE64Encoder();
-			String d = ben.encode(digest);
-			// Now encrypt the generated key with DBT cipher
-			byte[] enc = basePair.getEncryptor().doFinal(encKey);
-			String k = ben.encode(enc);
-			Properties props = new Properties();
-			props.put("d", d);
-			props.put("k", k);
-			File theSecFile = new File(secFile);
-			FileOutputStream fos = new FileOutputStream(theSecFile);
-			props.store(fos, "TRAFCI Security Initialization File");
-			fos.flush();
-			fos.close();
-			Runtime.getRuntime().exec("chmod 600 " + secFile);
-		} catch (IllegalBlockSizeException ibse) {
-			throw (Exception) new Exception("Invalid cipher block size")
-					.initCause(ibse);
-		} catch (BadPaddingException bpe) {
-			throw (Exception) new Exception("Incorrect cipher padding")
-					.initCause(bpe);
-		} catch (FileNotFoundException fnfe) {
-			throw (Exception) new Exception("Encryption utility not installed under current NVTHOME")
-					.initCause(fnfe);
-
-		} catch (NoSuchAlgorithmException nsae) {
-			throw (Exception) new Exception("Invalid cipher algorithm")
-					.initCause(nsae);
-		} catch (IOException ioe) {
-			throw (Exception) new Exception("IO Exception")
-					.initCause(ioe);
-		}
-	}
-
-	public void initSiteEncryptionService() throws Exception {
-		try {
-			FileInputStream fis = new FileInputStream(secFile);
-			Properties props = new Properties();
-			props.load(fis);
-			String k = props.getProperty("k");
-			String d = props.getProperty("d");
-			sun.misc.BASE64Decoder bde = new sun.misc.BASE64Decoder();
-			// Decrypt the key
-			byte[] key = decrypt(basePair.getDecryptor(), k);
-			byte[] digest = bde.decodeBuffer(d);
-			md5.reset();
-			byte[] d2 = md5.digest(key);
-			if (!Arrays.equals(digest, d2)) {
-				throw (Exception) new Exception("FATAL -- Tampered key");
-			}
-			sitePair = initCiphers(key);
-
-			// Get rid of the base pair
-
-			basePair.setEncryptor(null);
-			basePair.setDecryptor(null);
-			basePair = null;
-		} catch (FileNotFoundException fnfe) {
-			throw (Exception) new Exception("Encryption utility not installed under current TRAFCIHOME")
-					.initCause(fnfe);
-
-		} catch (IOException ioe) {
-			throw (Exception) new Exception("IO Exception")
-					.initCause(ioe);
-		}
-	}
-
-	private void makeSecurityDir() throws Exception {
-		final File dir = new File(secDir);
-
-		if (!dir.exists()) {
-			dir.mkdirs();
-		}
-		final File encfile = new File(
-				secDir + '/' + "encprops.txt");
-		
-		try{
-			if (!encfile.exists()) {
-				encfile.createNewFile();
-				Runtime.getRuntime().exec("chmod 600 " + secDir + '/' + "encprops.txt");
-			}
-			
-		} catch (IOException e) {
-			throw (Exception) new Exception("IO Exception")
-			.initCause(e);
-		}
-			
-		
-		
-
-	}
-
-	public MessageDigest initDigest() throws Exception {
-		try {
-			MessageDigest md5 = MessageDigest.getInstance(DIGEST_ALGORITHM);
-			return md5;
-		} catch (NoSuchAlgorithmException nsae) {
-			throw (Exception) new Exception("Unknown digest")
-					.initCause(nsae);
-		}
-	}
-
-	public CipherPair initCiphers(byte[] keyData) throws Exception {
-		try {
-
-			DESKeySpec dspec = new DESKeySpec(keyData);
-
-			SecretKeyFactory skf = SecretKeyFactory.getInstance(SYMMETRICKEY_ALGORITHM);
-			SecretKey sKey = skf.generateSecret(dspec);
-
-			Cipher encryptor = Cipher.getInstance(SYMMETRICKEY_ALGORITHM);
-			Cipher decryptor = Cipher.getInstance(SYMMETRICKEY_ALGORITHM);
-			encryptor.init(Cipher.ENCRYPT_MODE, sKey);
-			decryptor.init(Cipher.DECRYPT_MODE, sKey);
-			return new CipherPair(encryptor, decryptor);
-
-		} catch (InvalidKeySpecException ikse) {
-			throw (Exception) new Exception("Invalid Key specification")
-					.initCause(ikse);
-		} catch (InvalidKeyException ikse) {
-			throw (Exception) new Exception("Invalid Key")
-					.initCause(ikse);
-		} catch (NoSuchAlgorithmException nsae) {
-			throw (Exception) new Exception("No such algorithm")
-					.initCause(nsae);
-		} catch (NoSuchPaddingException nsae) {
-			throw (Exception) new Exception("No such padding")
-					.initCause(nsae);
-		}
-	}
-
-	public CipherPair initCiphers(SecretKey key, byte[] salt, int count)
-			throws Exception {
-		try {
-			Cipher encryptor = Cipher.getInstance(SECRETKEY_ALGORITHM);
-
-			Cipher decryptor = Cipher.getInstance(SECRETKEY_ALGORITHM);
-
-			AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, count);
-
-			encryptor.init(Cipher.ENCRYPT_MODE, key, paramSpec);
-
-			decryptor.init(Cipher.DECRYPT_MODE, key, paramSpec);
-
-			return new CipherPair(encryptor, decryptor);
-		} catch (NoSuchAlgorithmException nsae) {
-			throw (Exception) new Exception("Invalid cipher algorithm")
-					.initCause(nsae);
-		} catch (InvalidAlgorithmParameterException iape) {
-			throw (Exception) new Exception("Invalid algorithm parameter")
-					.initCause(iape);
-		} catch (InvalidKeyException ike) {
-			throw (Exception) new Exception("Invalid Key").initCause(ike);
-		} catch (NoSuchPaddingException nspe) {
-			throw (Exception) new Exception("Unknown padding")
-					.initCause(nspe);
-		}
-
-	}
-
-
-	private char[] getPass(char ePass[]) {
-		int len = ePass.length;
-		byte p[] = new byte[len];
-		char ret[] = new char[len];
-
-		Arrays.fill(p, (byte)0);
-		for (int row = 0; row < len; ++row) {
-			for (int col = 0; col < len; ++col) {
-				int bit = (int)((ePass[row] >>> ( len - 1 - col)) & 0x1);
-				p[col] |= (int)(bit << (len - 1 - row));
-			}
-		}
-
-		for (int i = 0; i <  len; ++i) {
-			ret[i] = (char) (~p[i] & 0xFF);
-		}
-		return ret;
-	}
-
-	public CipherPair initCiphers(char[] pass, byte[] salt, int count)
-			throws Exception {
-		try {
-
-			KeySpec keySpec = new PBEKeySpec(getPass(pass), salt, count);
-
-			SecretKey key = SecretKeyFactory.getInstance(SECRETKEY_ALGORITHM)
-					.generateSecret(keySpec);
-
-			return initCiphers(key, salt, count);
-
-		} catch (NoSuchAlgorithmException nsae) {
-			throw (Exception) new Exception("Invalid cipher algorithm")
-					.initCause(nsae);
-		} catch (InvalidKeySpecException ike) {
-			throw (Exception) new Exception("Invalid Key specification")
-					.initCause(ike);
-		}
-	}
-
-	public String encrypt(Cipher encryptor, String msg) throws Exception {
-
-		byte[] bytes;
-
-		bytes = msg.getBytes();
-		byte[] enc = null;
-		try {
-			enc = encryptor.doFinal(bytes);
-		} catch (IllegalBlockSizeException ibse) {
-			throw (Exception) new Exception("Invalid cipher block size")
-					.initCause(ibse);
-		} catch (BadPaddingException bpe) {
-			throw (Exception) new Exception("Incorrect cipher padding")
-					.initCause(bpe);
-		}
-		String encrypted = new sun.misc.BASE64Encoder().encode(enc);
-		
-		if (encrypted.contains("\n")){
-			encrypted.replaceAll("\r\n", "");
-		}
-		return  encrypted;
-	}
-
-	/**
-	 * This calls the other version of encrypt which requires access to this
-	 * class' package protected sitePair.  Allows callers outside of this
-	 * package to encrypt strings.
-	 * @param msg the string to be encrypted
-	 * @return the encrypted string
-	 * @throws DBTransporterException when encryption fails
-	 */
-	public String encrypt(String msg) throws Exception {
-		return encrypt(sitePair.encryptor, msg);
-	}
-
-	public byte[] decrypt(Cipher decryptor, String enc) throws Exception {
-		byte[] bytes = null;
-		try {
-			byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(enc);
-			bytes = decryptor.doFinal(dec);
-		} catch (java.io.IOException ioe) {
-			throw (Exception) new Exception("Decoding exception")
-					.initCause(ioe);
-		} catch (IllegalBlockSizeException ibse) {
-			throw (Exception) new Exception("Invalid cipher block size")
-					.initCause(ibse);
-		} catch (BadPaddingException bpe) {
-			throw (Exception) new Exception("Incorrect cipher padding")
-					.initCause(bpe);
-		}
-		return bytes;
-	}
-
-	/**
-	 * This calls the other version of decrypt which requires access to this
-	 * class' package protected sitePair.  Allows callers outside of this
-	 * package to decrypt strings.
-	 * @param msg the string to be decrypted
-	 * @return the decrypted string
-	 * @throws DBTransporterException when decryption fails
-	 */
-	public byte[] decrypt(String msg) throws Exception {
-		return decrypt(sitePair.decryptor, msg);
-	}
-
-	public class CipherPair {
-		Cipher encryptor;
-
-		Cipher decryptor;
-
-		private CipherPair() {
-		}
-
-		private CipherPair(Cipher encryptor, Cipher decryptor) {
-			this.encryptor = encryptor;
-			this.decryptor = decryptor;
-		}
-
-		private Cipher getDecryptor() {
-			return decryptor;
-		}
-
-		private void setDecryptor(Cipher decryptor) {
-			this.decryptor = decryptor;
-		}
-
-		private Cipher getEncryptor() {
-			return encryptor;
-		}
-
-		private void setEncryptor(Cipher encryptor) {
-			this.encryptor = encryptor;
-		}
-	}
-
-	/**
-	 * @return the secDir
-	 */
-	public String getSecDir() {
-		return secDir;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/PasswordOpts.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/PasswordOpts.java b/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/PasswordOpts.java
deleted file mode 100644
index 16eac9a..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/PasswordOpts.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/**********************************************************************
-// @@@ 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 @@@
-**********************************************************************/
-/**
- *
- */
-package org.trafodion.ci.pwdencrypt;
-import java.util.Arrays;
-import java.util.Vector;
-
-public class PasswordOpts {
-
-	/**
-	 * Max length of encryptable text.
-	 */
-	private final int maxtextlen = 128;
-
-	/**
-	 * referencename.
-	 */
-	private String ref;
-	/**
-	 * text to be add/deleted.
-	 */
-	private String text;
-	/**
-	 * directory of the log file.
-	 */
-	private String dir;
-	/**
-	 * file name of the log file.
-	 */
-	private String file;
-	/**
-	 * work type to be done.
-	 */
-	private String wktype;
-      
-	static boolean doTrace = Boolean.getBoolean("trafci.enableTrace");
-	
-    
-
-	public static final Vector<String> OPTIONTYPES = new Vector<String>(
-			Arrays.asList("option", "username", "password", "logdir","logfile","help"));
-
-	/**
-	 * @param optsMap
-	 */
-	public PasswordOpts() {
-		ref = null;
-		text = null;
-		dir = null;
-		file = null;
-		wktype = null;
-
-	}
-
-	/**
-	 * Display help.
-	 *
-	 */
-	private void displayHelp() {
-		System.out.println("Usage: \n" +
-						  "	ciencr.sh -o [options] [args...] \n"+
-				          "where options include:\n"+
-				          "	add			add username and password\n"+
-				          "	del			del username and password\n"+
-				          "where args include:\n"+
-				          "	-u			specify username\n"+
-				          "	-p			specify password\n\n" +
-						  "Example to ecnrypt a user's password \n\n"+
-						  " ciencr.sh -o add -u <user name> -p <password>\n\n"+
-						  "Example to remove a user's password \n\n"+
-						  " ciencr.sh -o del -u <user name>\n\n");
-		/*System.out.println("-o/--option         "
-				+ "either add or del");
-		System.out.println("-u/--username       "
-				+ "username valid only for add and del");
-		System.out.println("-p/--password       "
-				+ "password valid only for add");
-		System.out.println("-l/--logdir         "
-				+ "Specify log file directory");
-		System.out.println("-f/--logfile        "
-				+ "Specify log file name");
-		System.out.println("-h/--help           "
-				+ "Display this message");*/
-
-	}
-
-	/**
-	 * Parse Commandline Args.
-	 * @param args The command to parsed
-	 */
-	public final void parseCommandLine(final String[] args) {
-
-			
-		if (args.length < 2 ) {			
-			displayHelp();
-			if(!(args.length > 0 && 
-				(args[0].contains("h") || 
-				args[0].equalsIgnoreCase("help")))){
-				System.exit(6);
-			}
-			System.exit(0);
-		}
-		
-		char flag;
-//		Matcher matcher = null;
-
-		boolean hasO = false;
-		for (int i = 0; i < args.length; i++) {
-			flag = '?';
-			try {
-				flag = args[i].charAt(1)=='-'? args[i].charAt(2): args[i].charAt(1);
-				if(args[i].length()> 2 && !(OPTIONTYPES.contains(args[i].substring(1).toLowerCase()))){
-						if (doTrace) 
-							System.out.println("Invalid option");
-						displayHelp();
-						System.exit(5);
-				}
-			} catch (Exception e) {
-				StringBuffer msg = new StringBuffer("\n\tError message: ");
-				msg.append(e.getMessage());
-				if (doTrace) { 
-					e.printStackTrace();
-				}
-				System.exit(5);
-			}
-			switch (flag) {
-			case 'o':
-				if (ArgMap.ARGMAP.get('o').isArgRequired()) {
-					i++;
-					if (WorkTypes.WORKTYPES.contains(args[i].toLowerCase())) {
-						wktype = args[i];
-					}else{
-						if (doTrace)
-							System.out.println("Option '"+args[i]+"' is not valid.");
-						displayHelp();
-						System.exit(5);
-					}
-				}
-				if(wktype == null){
-					if (doTrace)
-						System.out.println("Option is required.");
-					displayHelp();
-					System.exit(5);
-				}
-				hasO = true;
-				break;
-
-			case 'u':
-				if (ArgMap.ARGMAP.get('u').isArgRequired()) {
-					i++;
-					ref = args[i];
-					if(ref.charAt(0)=='-' || ref == null){	 if (doTrace)
-						System.out.println("Arg is u");
-						displayHelp();
-						System.exit(5);
-					}
-				}
-				break;
-
-			case 'p':
-				if (ArgMap.ARGMAP.get('p').isArgRequired()) {
-					i++;
-					if (i>=args.length){
-						displayHelp();
-						System.exit(5);
-					}						
-					text = args[i];
-					if (text == null || text.length() > maxtextlen) {
-						if (doTrace)
-							System.out.println("Arg is p");
-						displayHelp();
-						System.exit(5);
-					}
-				}
-				break;
-
-			case 'l':
-				if (ArgMap.ARGMAP.get('l').isArgRequired()) {
-					i++;
-					dir = args[i];
-				}
-				break;
-			case 'f':
-				if (ArgMap.ARGMAP.get('f').isArgRequired()) {
-					i++;
-					file = args[i];
-				}
-				break;
-			case 'h':
-				displayHelp();
-				System.exit(0);
-				break;
-			default:
-				if (doTrace) {
-					System.out.println("Default arg");
-					displayHelp();
-				}
-
-			break;
-			}
-
-		}
-		if (!hasO) {
-			if (doTrace)
-				System.out
-						.println("Error: '-o' is required");
-			displayHelp();
-			System.exit(0);
-		}
-		checkArgs();
-	}
-
-	/**
-	 * Checks the required args for add and del worktypes.
-	 *
-	 */
-	private void checkArgs() {
-
-			if (wktype.equalsIgnoreCase(WorkTypes.ADD)) {
-				if (ref == null || text == null) {
-					if (doTrace)
-						System.out.println("Errors in ADD WrkType ");
-					displayHelp();
-					System.exit(5);
-				}
-			}
-			else if (wktype.equalsIgnoreCase(WorkTypes.DEL)) {
-				/*if (ref == null) {
-					if (doTrace)
-						System.out.println("Errors in del WrkType ");
-				System.exit(5);
-				}*/
-			}
-	}
-
-	/**
-	 * @return the dir
-	 */
-	public final String getDir() {
-		return dir;
-	}
-
-	/**
-	 * @return the file
-	 */
-	public final String getFile() {
-		return file;
-	}
-
-	/**
-	 * @return the ref
-	 */
-	public final String getRef() {
-		return ref;
-	}
-
-	/**
-	 * @return the text
-	 */
-	public final String getText() {
-		return text;
-	}
-
-	/**
-	 * @return the wktype
-	 */
-	public final String getWktype() {
-		return wktype;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/RefLookup.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/RefLookup.java b/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/RefLookup.java
deleted file mode 100644
index a2a9a75..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/RefLookup.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**********************************************************************
-// @@@ 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 @@@
-**********************************************************************/
-package org.trafodion.ci.pwdencrypt;
-
-import java.io.FileInputStream;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-
-import java.io.IOException;
-import java.io.File;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class RefLookup {
-	/** This pattern describes something like 
-	 * 'password = {DES}B/+8B2OcDkKWCFaCfwSwgQ==$'.
-	 * Or more specifically, the word "password" (case insensitive),
-	 * followed by any number of spaces, followed by an equal sign and any
-	 * number of spaces.  Then with or without quotes is any word or non-word 
-	 * characters .  The reference String is identified as group 1 and encrypted 
-	 * strinf * is identified as group 4 in the pattern "refPattern"
-	 */
-	private static Pattern refPattern = Pattern.compile(
-			"([^\\-]([^=](\\w*))*)((\\s*=\\s*\"*)([\\W*\\w*])*(\"*))", 
-			Pattern.CASE_INSENSITIVE);
-
-	public static String resolve(final String ref) {
-		if (ref == null || ref.length() == 0) {
-			return ref;
-		}
-		try {
-			//if (ref.charAt(0) == '$') {
-				JCE j = new JCE();
-
-			//	if (ref.charAt(1) == 'E') {
-					try{
-						if(! new File(j.getSecDir()).exists()){
-							System.out.println("File exists !!!");
-						}
-					//	System.out.println("File being read from ...encprops" + j.getSecDir());
-						FileInputStream fis = new FileInputStream(j.getSecDir() + "/encprops.txt");
-						j.initSiteEncryptionService();
-						String userName = ref.substring(0, ref.indexOf("=")-1);
-					//	System.out.println("ref stri = " + userName);
-						return new String(j.decrypt(j.sitePair.decryptor, findRef(fis, userName))); //ref.substring(0, ref.length()))));
-					}catch (IOException e) {
-
-						e.printStackTrace();
-					}
-
-			/*	}else {
-					try{
-					FileInputStream fis = new FileInputStream(j.getSecDir() + "/ctlprops.txt");
-					return findRef(fis, ref.substring(2,ref.length()-1));
-			      } catch (IOException e) {
-						e.printStackTrace();
-					}
-
-				} 
-			} */
-
-		} catch (Exception e) {
-			StringBuffer msg = new StringBuffer();
-			msg.append("\n\tError Message: ").append(e.getMessage());
-			e.printStackTrace();
-
-
-		}
-		return ref;
-	}
-
-	private static String findRef(FileInputStream fis, String ref) throws IOException{
-
-	  String strLine;
-//		String str[] = null;
-	    boolean match = false;
-	    String enc = null;
-	    String refStr=null;
-	    //Fixed the password reference matching logic , so now the partial reference inputs
-	    //will not be accepted and reports error in that case
-
-	    BufferedReader br = new BufferedReader(new InputStreamReader(fis));
-	    
-	    while ((strLine = br.readLine()) != null)   {
-	    	Matcher matcher = refPattern.matcher(strLine);
-	    	if(matcher.find()) {
-	    		refStr = matcher.group(1).trim(); //group(1) gives the reference String
-		    	//	System.out.println("strLine1=" + refStr);
-				if( refStr.equals(ref)){
-				       // The password to be encrypted
-					enc = matcher.group(4).trim(); //group(4) gives the encrypted value
-					match = true;
-				//	System.out.println("strLine2=" + enc);
-				}
-				if(match)
-					break;
-	    	}
-	    }
-	    if(!match){
-	    	System.out.println("Match failed!!");
-	    	System.exit(0);
-	    }
-	    	
-	    //Trims lead " = {DES}" if present. Would be present when Encrypted.
-		return enc.replaceFirst("=", "").trim().replace("{DES}", "");
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/WorkTypes.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/WorkTypes.java b/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/WorkTypes.java
deleted file mode 100644
index 9bd34e1..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/pwdencrypt/WorkTypes.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**********************************************************************
-// @@@ 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 @@@
-**********************************************************************/
-package org.trafodion.ci.pwdencrypt;
-import java.util.Arrays;
-import java.util.Vector;
-
-/**
- * Defines the valid options for the -o arg.
- *
- */
-public class WorkTypes {
-
-	/**
-	 * Install type.
-	 */
-	public static final String INSTALL = "install";
-	/**
-	 * Add text work type.
-	 */
-	public static final String ADD = "add";
-	/**
-	 * Delete text work type.
-	 */
-	public static final String DEL = "del";
-	/**
-	 * Unknown work type.
-	 */
-	public static final String UNKNOWN = "unknown";
-	
-	/**
-	 * Valid set of worktypes. 
-	 */
-	public static final Vector<String> WORKTYPES = new Vector<String>(
-			Arrays.asList(INSTALL, ADD, DEL, UNKNOWN));
-}


[25/38] incubator-trafodion git commit: add Installer.java and Vpoc.java ignore

Posted by li...@apache.org.
add Installer.java and Vpoc.java ignore


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

Branch: refs/heads/master
Commit: 39b0169864de2bffed1a2fcd7f211d8b4c651f3b
Parents: de7e7d4
Author: AlexPeng19 <al...@hotmail.com>
Authored: Tue Nov 22 10:42:17 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Tue Nov 22 10:42:17 2016 +0800

----------------------------------------------------------------------
 core/conn/trafci/.gitignore | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/39b01698/core/conn/trafci/.gitignore
----------------------------------------------------------------------
diff --git a/core/conn/trafci/.gitignore b/core/conn/trafci/.gitignore
index 6ca6f71..4d6e252 100644
--- a/core/conn/trafci/.gitignore
+++ b/core/conn/trafci/.gitignore
@@ -6,3 +6,4 @@ utils/trafci.sh
 /target/
 install/Installer.java
 src/main/java/org/trafodion/ci/Vproc.java
+/target/


[17/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQueryException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQueryException.java b/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQueryException.java
new file mode 100644
index 0000000..a4115a4
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQueryException.java
@@ -0,0 +1,35 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class InterfaceQueryException extends Exception
+{
+
+   /**
+   * 
+   */
+   private static final long serialVersionUID = 1L;
+
+   InterfaceQueryException()
+   {
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceSyntaxError.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceSyntaxError.java b/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceSyntaxError.java
new file mode 100644
index 0000000..f81373a
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceSyntaxError.java
@@ -0,0 +1,83 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class InterfaceSyntaxError
+{
+
+
+   private StringBuffer errMesg=null;
+   private String errPrefix = SessionError.SYNTAX_ERROR_PREFIX; //"ERROR: A syntax error occurred at or before:";
+
+   InterfaceSyntaxError()
+   {
+
+   }
+
+   public void setSyntaxError(String qryString ,String remainderStr)
+   {
+      if (errMesg == null)
+      {
+         errMesg=new StringBuffer();
+      }
+      this.errMesg.delete(0,errMesg.length());
+      //this.errMesg.append(SessionDefaults.lineSeperator);
+      this.errMesg.append(errPrefix);
+      this.errMesg.append(SessionDefaults.lineSeperator);
+      this.errMesg.append(qryString);
+      this.errMesg.append(SessionDefaults.lineSeperator);
+
+      this.errMesg.append(qryString.replaceAll("\\S"," "));
+
+      /*for(int i=0; i < (qryString.length()-remainderStr.length());i++)
+      this.errMesg.append(" ");*/
+      for (int i=0; i < remainderStr.length();i++)
+         this.errMesg.delete(errMesg.length()-1,errMesg.length());
+
+      this.errMesg.append("^");
+
+      this.errMesg.replace(0,this.errMesg.length(),this.errMesg.toString().replaceAll("(?m)^\\s+$",""));
+      //this.errMesg.append("^");
+   }
+
+   public ErrorObject getSyntaxError(String qryString,String remainderStr )
+   {
+
+      if (qryString != null)
+      {
+         qryString=qryString.replaceAll("\\s+$","");
+      }
+
+      if (remainderStr == null)
+      {
+         remainderStr="";
+      }
+      else
+      {
+         remainderStr=remainderStr.trim();
+      }
+
+      setSyntaxError(qryString,remainderStr);
+      return new ErrorObject(SessionError.GENERIC_SYNTAX_ERROR_CODE, errMesg.toString());
+   }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/InvalidNumberOfArguments.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/InvalidNumberOfArguments.java b/core/conn/trafci/src/main/java/org/trafodion/ci/InvalidNumberOfArguments.java
new file mode 100644
index 0000000..e01b988
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/InvalidNumberOfArguments.java
@@ -0,0 +1,35 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class InvalidNumberOfArguments extends Exception
+{
+
+   /**
+   * 
+   */
+   private static final long serialVersionUID = 1L;
+   InvalidNumberOfArguments()
+   {
+      super(SessionError.CMD_LINE_ARGS_ERR.RAWOutputError());
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/JDBCVproc.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/JDBCVproc.java b/core/conn/trafci/src/main/java/org/trafodion/ci/JDBCVproc.java
new file mode 100644
index 0000000..d81c896
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/JDBCVproc.java
@@ -0,0 +1,38 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+public class JDBCVproc
+{
+   public static String getVproc() 
+   {
+      try {
+         return (org.trafodion.jdbc.t4.Vproc.getVproc());
+      } catch (java.lang.IllegalAccessError iae)
+      {
+         return iae.getMessage();
+   
+      }
+      
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/LFProperties.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/LFProperties.java b/core/conn/trafci/src/main/java/org/trafodion/ci/LFProperties.java
new file mode 100644
index 0000000..0b80f90
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/LFProperties.java
@@ -0,0 +1,130 @@
+// @@@ 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 @@@
+
+/**
+ * 
+ * Class to load and display the look and feel properties file.
+ * 
+ */
+
+package org.trafodion.ci;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class LFProperties
+{
+
+   private Properties lfProps=null;
+   private Session sessObj=null;
+
+   LFProperties(){}
+
+   public String getStatus(Query qryObj) {
+	  String qryString = Utils.trimSQLTerminator(deleteCStyleComments(qryObj.getQueryText().trim()),sessObj.getSessionSQLTerminator());
+      String queryString=sessObj.getStrMode()+"_"+qryString.trim().toUpperCase().replaceAll("\\s+"," ");
+      Enumeration<Object> enumKeys=lfProps.keys();
+      int keySize=0;
+      String matchedElement=null;
+      String matchedValue=null;
+
+      while (enumKeys.hasMoreElements())
+      {
+         String nextElement=enumKeys.nextElement().toString();
+
+         if (queryString.matches(nextElement))
+         {
+            if (nextElement.length() > keySize)
+            {
+               keySize=nextElement.length();
+               matchedElement=nextElement;
+            }
+         }
+
+      }
+
+      if (keySize > 0)
+      {
+         String stmtType=qryObj.getStmtType();
+
+         if (((matchedElement.startsWith("SQL_EXECUTE")) && !qryObj.isTrimOut() &&
+            ( (stmtType.equalsIgnoreCase("SELECT"))  ||
+            (stmtType.equalsIgnoreCase("INSERT"))  ||
+            (stmtType.equalsIgnoreCase("UPDATE"))  ||
+            (stmtType.equalsIgnoreCase("DELETE"))  ) ) || ( stmtType != null && stmtType.equals("SELECT_LIST_COUNT")))
+         {
+            matchedElement=sessObj.getStrMode()+"_"+stmtType+" .*";
+         }
+
+         if ((matchedElement.startsWith("SQL_EXECUTE")) && !qryObj.isTrimOut() &&
+                 (stmtType.equalsIgnoreCase("CREATE_TABLE_AS")))
+         {
+        	 matchedElement = "SQL_CREATE TABLE .* AS SELECT .*";
+         }
+
+         
+         matchedValue = lfProps.getProperty(matchedElement);
+         if (matchedValue.indexOf("@rownum@") != -1)
+         {
+               return (matchedValue.replaceFirst("@rownum@",qryObj.getRowCount()));
+         }
+         return (matchedValue);
+      }
+      return (lfProps.getProperty(sessObj.getStrMode()+"_UNKNOWN_CMD"));
+   }
+
+   /*
+    * Delete C-style comments in a String
+    */
+   private String deleteCStyleComments(String originalString)
+   {
+	   Pattern p = Pattern.compile( "/[*]{1,2}.*?[*]/",Pattern.DOTALL); 
+	   Matcher m = p.matcher(originalString); 
+	   return m.replaceAll("");
+   }
+
+   //  load the look and feel properties 
+   public void loadLookAndFeelProps(Session sessObj, boolean specialModeEnabled) 
+   		throws FileNotFoundException, IOException {
+	  String laFileName=null;
+      String laOption=System.getProperty(SessionDefaults.PROP_TRAFCILF);
+      this.sessObj = sessObj;
+      
+      laFileName= SessionDefaults.PROP_DEFAULT_NAME;
+      sessObj.setSessView(SessionDefaults.CIDEFAULT_VIEW);
+
+      loadProperties(laFileName);
+   }
+
+   public void loadProperties(String fileName) throws FileNotFoundException, IOException
+   {
+
+      lfProps=new Properties();
+      lfProps.load(this.getClass().getResourceAsStream(fileName));
+
+   }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/MaskingThread.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/MaskingThread.java b/core/conn/trafci/src/main/java/org/trafodion/ci/MaskingThread.java
new file mode 100644
index 0000000..5df4d86
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/MaskingThread.java
@@ -0,0 +1,73 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class MaskingThread extends Thread
+{
+   private boolean stop = false;
+   private String prompt = null;
+
+   /**
+   * @param thePrompt The prompt displayed to the user
+   */
+   public MaskingThread(String thePrompt)
+   {
+      prompt = thePrompt;
+   }
+
+   /**
+   * Begin masking until asked to stop.
+   */
+   public void run()
+   {
+      int priority = Thread.currentThread().getPriority();
+      Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
+
+      while (!stop)
+      {
+         if (!stop)
+            System.out.print( "                                 \r" + prompt  );
+         //System.out.flush();
+         try
+         {
+            // attempt masking at this rate (refresh every 1 ms.)
+            sleep(1);
+         }
+         catch (InterruptedException iex)
+         {
+            iex.printStackTrace();
+         }
+         finally
+         { // restore the original priority
+            Thread.currentThread().setPriority(priority);
+         }
+
+      }
+   }
+
+   /**
+   * Instruct the thread to stop masking.
+   */
+   public void stopMasking()
+   {
+      stop = true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/MultiByteUtils.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/MultiByteUtils.java b/core/conn/trafci/src/main/java/org/trafodion/ci/MultiByteUtils.java
new file mode 100644
index 0000000..220243c
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/MultiByteUtils.java
@@ -0,0 +1,56 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+
+import java.awt.FontMetrics;
+import java.awt.Font;
+import java.awt.Panel;
+
+public class MultiByteUtils {
+   
+   private static MultiByteUtils mbUtils = new MultiByteUtils();
+   private FontMetrics fm = null;
+   
+   MultiByteUtils()
+   {
+      try {
+         System.setProperty("java.awt.headless", "true");
+      }catch(Throwable t)
+      {
+      }
+      try {
+         Panel pan = new Panel();
+         fm = pan.getFontMetrics(new Font("Monospaced",Font.PLAIN, 12));
+      } catch (Throwable t)
+      {
+            System.out.println(SessionError.MULTIBYTE_DISP_WARN.errorMessage());
+      }
+  }
+  
+      
+   public static FontMetrics getFontMetrics()
+   {
+     return mbUtils.fm;
+   }
+ 
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/NullKeyWordException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/NullKeyWordException.java b/core/conn/trafci/src/main/java/org/trafodion/ci/NullKeyWordException.java
new file mode 100644
index 0000000..a7854d5
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/NullKeyWordException.java
@@ -0,0 +1,35 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class NullKeyWordException extends InterfaceQueryException
+{
+
+   /**
+   * 
+   */
+   private static final long serialVersionUID = 1L;
+
+   NullKeyWordException()
+   {
+      super();
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/OutputColumnAttribute.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/OutputColumnAttribute.java b/core/conn/trafci/src/main/java/org/trafodion/ci/OutputColumnAttribute.java
new file mode 100644
index 0000000..d84dce4
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/OutputColumnAttribute.java
@@ -0,0 +1,47 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+public class OutputColumnAttribute {
+	public String name;
+	public int width = SessionDefaults.MIN_COL_DISPLAY_SIZE;
+	public int align=OutputContents.LiftAlign;
+	
+	public String getDisplayFormatName()
+	{
+		if(width>name.length())
+		{
+			StringBuilder sbName = new StringBuilder(width);
+			sbName.append(name);
+			for(int i=0;i<width-name.length();i++)
+			{
+				sbName.append(" ");
+			}
+			return sbName.toString();
+		}
+		else
+		{
+			return name;
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/OutputContents.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/OutputContents.java b/core/conn/trafci/src/main/java/org/trafodion/ci/OutputContents.java
new file mode 100644
index 0000000..41c2c41
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/OutputContents.java
@@ -0,0 +1,144 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.util.ArrayList;
+
+public class OutputContents {
+
+	public static int LiftAlign = 0;
+	public static int RightAlign = 1;
+	public static int CenterAlign = 2;
+	
+	private String title="";
+	private String itemName="";
+	private String headerSeparator = "-";
+	private String columnSeparator = " ";
+	private ArrayList<OutputColumnAttribute> alColumns;
+	private ArrayList<ArrayList<String>> alRows;
+	
+	public OutputContents()
+	{
+		alColumns = new ArrayList<OutputColumnAttribute>();
+		alRows = new ArrayList<ArrayList<String>>();
+	}
+
+	public OutputContents(int columnCount)
+	{
+		alColumns = new ArrayList<OutputColumnAttribute>(columnCount);
+		alRows = new ArrayList<ArrayList<String>>();
+	}
+	
+	public ArrayList<String> newRow()
+	{
+		ArrayList<String> row = new ArrayList<String>(alColumns.size());
+		alRows.add(row);
+		return row;
+	}
+	
+	public ArrayList<ArrayList<String>> getRows()
+	{
+		return this.alRows;
+	}
+	
+	public OutputColumnAttribute newColumn()
+	{
+		OutputColumnAttribute column = new OutputColumnAttribute();
+		alColumns.add(column);
+		
+		return column;
+	}
+	
+	public void setColumnWidth(String columnName, int width)
+	{
+		for(int i=0; i<alColumns.size();i++)
+		{
+			OutputColumnAttribute column = (OutputColumnAttribute)alColumns.get(i);
+			if(column!=null && column.name.equals(columnName))
+			{
+				if(column.width<width)
+					column.width=width;
+				break;
+			}
+		}
+	}
+
+	public void setColumnAlign(String columnName, int align)
+	{
+		for(int i=0; i<alColumns.size();i++)
+		{
+			OutputColumnAttribute column = (OutputColumnAttribute)alColumns.get(i);
+			if(column!=null && column.name.equals(columnName))
+			{
+				column.align=align;
+				break;
+			}
+		}
+	}
+	
+	public String getHeaderSeparator()
+	{
+		return this.headerSeparator;
+	}
+
+	public void setHeaderSeparator(String hdSeparator)
+	{
+		this.headerSeparator = hdSeparator;
+	}
+
+	public String getColumnSeparator()
+	{
+		return this.columnSeparator;
+	}
+
+	public void setColumnSeparator(String clSeparator)
+	{
+		this.columnSeparator = clSeparator;
+	}
+	
+	public String getTitle()
+	{
+		return this.title;
+	}
+	
+	public void setTitle(String t)
+	{
+		this.title=t;
+	}
+	
+	public String getItemName()
+	{
+		return itemName;
+	}
+
+	public void setItemName(String name)
+	{
+		itemName = name;
+	}
+	public ArrayList<OutputColumnAttribute> getColumns()
+	{
+		return alColumns;
+	}
+	
+	
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ParallelRun.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ParallelRun.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ParallelRun.java
new file mode 100644
index 0000000..2e91975
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ParallelRun.java
@@ -0,0 +1,1320 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+import java.sql.ResultSet;
+import java.util.Vector;
+import sun.misc.Signal;
+import sun.misc.SignalHandler;
+
+public class ParallelRun extends Thread
+{
+
+   String scriptsDir=null;
+   String scriptsExt=null;
+   String logsDir=null;
+   boolean overwriteLogs=false;
+   int connectionCnt=2;
+   ConsoleReader crObj=null;
+   ConsoleWriter cwObj=null;
+   String summaryFile=null;
+   PrunUserInterruption pui=null;
+   Properties lfProps=null;
+   final String SCRIPT_EXT="sql";
+   int MAX_THREADS=64;
+   int MIN_THREADS=2;
+   List<String> scriptsList=null;
+   Session sessObj=null;
+   FileWriter summaryWriter=null;
+   int threadNumber=0;
+   int totalScriptFiles=0;
+   int totalScriptFilesProcessed=0;
+   int totalSQLsProcessed=0;
+   int totalSQLErrors=0;
+   int totalSQLWarnings=0;
+   int totalConnections=0;
+   int seqNo=0;
+   Utils utils=null;
+   SignalHandler CTRLCHandler=null;
+   Signal INTSignal=null;
+   boolean isUserInterrupt=false;
+   ThreadGroup prunGroup=null;
+   List<Session> activeSessionLists=null;
+   StatusThread status=null;
+   int noOfArgs=0;
+   String[] args=null;
+   HTMLObject htmlObj = null;
+   XMLObject xmlObj = null;
+   boolean errorMsg = false;
+   Writer writeObj = null;
+   PrunSummary summaryObj = new PrunSummary();
+   Query qryObj=null;
+
+   final String TIMER_DEFAULT="60";
+   int timerValue = 60;
+   long endTime = 0;
+   long nowTime = 0;
+   boolean timerMode = false;
+   List<String> scriptsListBak=null;
+   int connDelta = 0;
+   
+   //Added for debugging prun
+   boolean prunDebug=false; 
+
+
+   ParallelRun()
+   {
+
+   }
+
+   ParallelRun(ConsoleReader crObj, ConsoleWriter cwObj,Properties lfProps,Session sessObj) throws IOException
+   {
+      threadNumber=0;
+      this.lfProps=lfProps;
+      this.sessObj=sessObj;
+      this.htmlObj = sessObj.getHtmlObj();
+      this.xmlObj = sessObj.getXmlObj();
+      this.crObj=crObj;
+      this.cwObj=cwObj;
+      this.summaryWriter=new FileWriter();
+      pui=new PrunUserInterruption();
+      utils=new Utils();
+      writeObj = sessObj.getWriter();
+      qryObj = sessObj.getQuery();
+      CTRLCHandler =new SignalHandler ()
+      {
+         public void handle(Signal sig)
+         {
+            isUserInterrupt=true;
+            if (prunGroup  != null)
+            {
+               status.beforeStatus="Cancelling";
+               status.afterStatus="Cancelled";
+            }
+            while (activeSessionLists !=null && activeSessionLists.size() > 0)
+            {
+
+               ((Session)(activeSessionLists.get(0))).setQueryInterrupted(true);
+               ((Session)(activeSessionLists.get(0))).setDBConnExists(false);
+               if (((Session)(activeSessionLists.get(0))).getCurrentStmtObj() != null)
+               {
+                  try
+                  {
+                     ((Statement)((Session)(activeSessionLists.get(0))).getCurrentStmtObj()).cancel();
+                  } catch (Exception e)
+                  {
+
+                  }
+               }
+               activeSessionLists.remove(0);
+            }
+         }
+      };
+      try {
+      INTSignal=new Signal("INT");
+      } catch (Exception e) {}
+
+      // get the maxservers allowed for the current datasource
+      // undocumented arg to disable calling getMaxServers(), -Dtrafci.prun.maxconn=n
+      int maxThreads=0;
+      String maxConn=System.getProperty("trafci.prun.maxconn");
+
+      try
+      {
+         if ((maxConn!=null) && ((maxThreads = Integer.parseInt(maxConn.trim() )) > MAX_THREADS ))
+            MAX_THREADS=maxThreads;
+         else
+            MAX_THREADS=getMaxServers();
+      } catch (NumberFormatException nfe)
+      {
+       	this.writePrunErrors(SessionError.INVALID_MAXCONN);
+         throw nfe;
+      }
+      MIN_THREADS = MAX_THREADS == 1 ? MAX_THREADS:MIN_THREADS;
+
+      String strTimerMode = System.getProperty("trafci.prun.timermode");
+      if ((strTimerMode!=null) &&  strTimerMode.equalsIgnoreCase("y"))
+      {
+         timerMode=true;
+         String strConnDelta = System.getProperty("trafci.prun.connection.delta");
+         if (strConnDelta != null)
+            connDelta = Integer.parseInt(strConnDelta);
+      }
+
+   }
+
+   public void execute() throws IOException, PrunUserInterruption, InvalidNumberOfArguments, UserInterruption
+   {
+      //Signal.handle(INTSignal, CTRLCHandler);
+      String queryStr = sessObj.getQuery().getQueryText();
+      queryStr = queryStr.replaceAll("\\s+"," ").trim();
+      boolean okay = validateArgs(queryStr);
+      if (!okay)
+      {
+         throw new PrunUserInterruption();
+      }
+
+      if (noOfArgs == 1)
+         getInputs();
+      try {
+      Signal.handle(INTSignal, CTRLCHandler);
+      }catch (Exception e) {}
+      
+      scriptsList=null;
+
+      scriptsList=new ArrayList<String>();
+
+      activeSessionLists=new ArrayList<Session>();
+
+      FilenameFilter filter = new FilenameFilter()
+      {
+         public boolean accept(File dir, String name)
+         {
+            if (System.getProperty("os.name").toUpperCase()
+                  .startsWith("WINDOW"))
+            {
+               return name.matches("(?i).*\\." + scriptsExt +"$" );
+            }
+            else
+            {
+               return name.endsWith("."+scriptsExt);
+            }
+         }
+         
+         
+       };
+
+      File dir=new File(scriptsDir);
+      File[] fl=dir.listFiles(filter);
+      //String separator=File.separator;
+      for (int i=0;i< fl.length; i++)
+      {
+         scriptsList.add(fl[i].getName().toString());
+      }
+
+      prunDebug = Boolean.getBoolean("trafci.prun.debug");
+      if (scriptsList.size() == 0)
+      {
+         if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+         {
+            htmlObj.init();
+            cwObj.println(htmlObj._beginTableTag);
+            cwObj.println(htmlObj._startCommentTag);
+            cwObj.println("No files present with this extension.");
+            cwObj.println(htmlObj._endCommentTag);
+            cwObj.println(htmlObj._endTableTag);
+         }
+         else if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+         {
+            xmlObj.init();
+            xmlObj.handleStartTags();
+            cwObj.println(xmlObj._beginStatusTag);
+            cwObj.println(xmlObj._beginCdataTag + "No files present with this extension." + xmlObj._endCdataTag);
+            cwObj.println(xmlObj._endStatusTag);
+            xmlObj.handleEndTags();
+         }
+         else
+         {
+            cwObj.println();
+            cwObj.println("No files present with this extension.");
+         }
+         return;
+      }
+
+      scriptsListBak=new ArrayList<String>(scriptsList);
+
+      totalScriptFiles=this.scriptsList.size();
+
+      try
+      {
+         String summaryDir=logsDir+File.separator+ "error" ;
+         if (!isValid(summaryDir,"dir","write"))
+         {
+            if (new File(summaryDir).mkdir())
+            {
+               if (!isValid(summaryDir,"dir","write"))
+               {
+                  summaryDir=logsDir;
+               }
+            }
+            else
+            {
+               summaryDir=logsDir;
+            }
+         }
+         summaryFile=summaryDir+File.separator+"prun.err.log";
+         String summaryTitle = "PRUN started at "+DateFormat.getDateTimeInstance().format(new Date());
+         if (!this.overwriteLogs)
+            summaryWriter.setAppend(true);
+         summaryWriter.initialize(summaryFile);
+         if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+         {
+            summaryWriter.writeln(htmlObj._beginTableTag);
+            summaryWriter.writeln(htmlObj._startCommentTag + summaryTitle + htmlObj._endCommentTag);
+            summaryWriter.writeln(htmlObj._beginRowTag);
+            summaryWriter.writeln(htmlObj._beginTblHeadTag +"Scripts directory " + htmlObj._endTblHeadTag);
+            summaryWriter.writeln(htmlObj._beginTblDataTag + this.scriptsDir + htmlObj._endTblDataTag);
+            summaryWriter.writeln(htmlObj._endRowTag);
+            summaryWriter.writeln(htmlObj._beginRowTag);
+            summaryWriter.writeln(htmlObj._beginTblHeadTag +"Logs directory " + htmlObj._endTblHeadTag);
+            summaryWriter.writeln(htmlObj._beginTblDataTag + this.logsDir + htmlObj._endTblDataTag);
+            summaryWriter.writeln(htmlObj._endRowTag);
+            summaryWriter.writeln(htmlObj._beginRowTag);
+            summaryWriter.writeln(htmlObj._beginTblHeadTag +"Logs overwritten " + htmlObj._endTblHeadTag);
+            summaryWriter.writeln(htmlObj._beginTblDataTag + (this.overwriteLogs ? "y":"n") + htmlObj._endTblDataTag);
+            summaryWriter.writeln(htmlObj._endRowTag);
+            summaryWriter.writeln(htmlObj._beginRowTag);
+            summaryWriter.writeln(htmlObj._beginTblHeadTag +"Number of connections " + htmlObj._endTblHeadTag);
+            summaryWriter.writeln(htmlObj._beginTblDataTag + this.connectionCnt + htmlObj._endTblDataTag);
+            summaryWriter.writeln(htmlObj._endRowTag);
+            if (timerMode)
+            {
+               summaryWriter.writeln(htmlObj._beginRowTag);
+               summaryWriter.writeln(htmlObj._beginTblHeadTag +"Time to run (mins) " + htmlObj._endTblHeadTag);
+               summaryWriter.writeln(htmlObj._beginTblDataTag + this.timerValue + htmlObj._endTblDataTag);
+               summaryWriter.writeln(htmlObj._endRowTag);
+            }
+         }
+         else if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+         {
+            summaryWriter.writeln(xmlObj._xmlNameSpaceTag);
+            summaryWriter.writeln(xmlObj._beginRootTag);
+            summaryWriter.writeln(xmlObj._beginCdataTag + summaryTitle + xmlObj._endCdataTag);
+            summaryWriter.writeln(xmlObj._beginScriptsDirTag + this.scriptsDir + xmlObj._endStriptsDirTag);
+            summaryWriter.writeln(xmlObj._beginLogsDirTag + this.logsDir + xmlObj._endLogsDirTag);
+            summaryWriter.writeln(xmlObj._beginLogsO + (this.overwriteLogs ? "y":"n") + xmlObj._endLogsO);
+            summaryWriter.writeln(xmlObj._beginConnTag + this.connectionCnt + xmlObj._endConnTag);
+            if (timerMode)
+               summaryWriter.writeln(xmlObj._beginMinTag + this.timerValue + xmlObj._endMinTag);
+
+         }
+         else
+         {
+            summaryWriter.write((utils.formatString("=",80,'=')));
+            summaryWriter.writeln();
+            summaryWriter.write(summaryTitle);
+            summaryWriter.writeln();
+            summaryWriter.write((utils.formatString("=",80,'=')));
+            summaryWriter.writeln();
+            summaryWriter.writeln();
+            summaryWriter.writeln("Scripts directory: "+this.scriptsDir);
+            summaryWriter.writeln("Logs directory: "+this.logsDir);
+            summaryWriter.writeln("Logs overwritten: "+ (this.overwriteLogs ? "y":"n") );
+            summaryWriter.writeln("Number of connections: "+this.connectionCnt);
+            if (timerMode)
+            {
+               summaryWriter.writeln("Time to run (mins): "+this.timerValue);
+               summaryWriter.writeln("Connection delay (secs): "+this.connDelta);
+            }
+            if (prunDebug)
+            {
+               summaryWriter.writeln();
+            }
+
+         }
+      }
+      catch (IOException ioe)
+      {
+         cwObj.println("Could not create the summary file.");
+         return;
+      }
+
+
+      prunGroup=new ThreadGroup("prgroup");
+      Thread prunThread=null;
+
+      status = new StatusThread(cwObj, sessObj);
+
+      // start the status thread
+      if (cwObj.getConsoleOut())
+         status.start();
+
+      if (this.connectionCnt > totalScriptFiles)
+      {
+         this.connectionCnt=totalScriptFiles;
+      }
+
+      sessObj.setQryStartTime();
+      for (int i=1; i <= this.connectionCnt ; i++)
+      {
+         if (this.scriptsList.size()== 0 || this.isUserInterrupt)
+            break;
+         prunThread =new Thread(prunGroup,this);
+         prunThread.setName("Thread"+i);
+         prunThread.start();
+
+         try
+         {
+            Thread.sleep(connDelta * 1000);
+
+         } catch (InterruptedException ie)
+         {
+         }
+
+      }
+      //this.start();
+
+      //Lets wait for all child threads to complete before proceeding further
+      Thread[] activeLists= new Thread[prunGroup.activeCount()];
+      int activeCounts=prunGroup.enumerate(activeLists);
+      for (int t=0;t < activeCounts; t++)
+      {
+         try
+         {
+            activeLists[t].join();
+         } catch (InterruptedException e)
+         {
+
+         }
+      }
+
+      // this loop is not required but need
+      while (prunGroup.activeCount() > 0)
+      {
+         status.stop=false;
+      }
+
+
+      status.stop=true;
+
+      if (cwObj.getConsoleOut())
+      {
+         try
+         {
+            status.join();
+         } catch (InterruptedException e)
+         {
+            // TODO Auto-generated catch block
+            //e.printStackTrace();
+         }
+         while (status.isAlive())
+         {
+
+         }
+      }
+
+      summaryObj.setTotalScriptFiles(this.totalScriptFiles);
+      summaryObj.setTotalScriptFilesProcessed(this.totalScriptFilesProcessed);
+      summaryObj.setTotalSQLsProcessed(this.totalSQLsProcessed);
+      summaryObj.setTotalSQLErrors(this.totalSQLErrors);
+      summaryObj.setTotalSQLWarnings(this.totalSQLWarnings);
+      summaryObj.setTotalConnections(this.totalConnections);
+      summaryObj.setTotalSQLSuccess(this.totalSQLsProcessed - this.totalSQLErrors);
+      summaryObj.setTotalConnectionFailures(this.connectionCnt - this.totalConnections);
+
+      sessObj.setQryEndTime();
+      String elapsedTime = writeObj.getElapsedTime(sessObj,qryObj,utils);
+      if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+      {
+         sessObj.getXmlObj().handlePrunSummary(cwObj,summaryObj, elapsedTime);
+      }
+      else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+      {
+         sessObj.getHtmlObj().handlePrunSummary(cwObj,summaryObj, elapsedTime);
+      }
+      else
+      {
+         cwObj.println();
+         cwObj.println("\t"+utils.formatString("_",45,'_'));
+         cwObj.println("\t"+utils.formatString("          PARALLELRUN(PRUN) SUMMARY",45,' '));
+         cwObj.println("\t"+utils.formatString("_",45,'_'));
+         cwObj.println("\t"+utils.formatString("Total files present ",45,'.',""+this.totalScriptFiles));
+         cwObj.println("\t"+utils.formatString("Total files processed ",45,'.',""+(this.totalScriptFilesProcessed)));
+         cwObj.println("\t"+utils.formatString("Total queries processed ",45,'.',""+this.totalSQLsProcessed));
+         cwObj.println("\t"+utils.formatString("Total errors ",45,'.',""+this.totalSQLErrors));
+         cwObj.println("\t"+utils.formatString("Total warnings ",45,'.',""+this.totalSQLWarnings));
+         cwObj.println("\t"+utils.formatString("Total successes ",45,'.',""+(this.totalSQLsProcessed-this.totalSQLErrors)));
+         cwObj.println("\t"+utils.formatString("Total connections ",45,'.',""+ (this.totalConnections) ));
+         cwObj.println("\t"+utils.formatString("Total connection failures ",45,'.',""+ (connectionCnt-this.totalConnections) ));
+         cwObj.println(SessionDefaults.lineSeperator + writeObj.getElapsedTime(sessObj,qryObj,utils));
+         cwObj.println();
+      }
+      if (this.totalSQLErrors > 0)
+      {
+         String errorLogInfo = "Please verify the error log file " + summaryFile + " for error summary.";
+         cwObj.println(formatSummaryStr(errorLogInfo));
+      } 
+      endPrunConsoleTags();
+      
+      if ((this.totalScriptFiles - this.scriptsList.size()) == 0)
+      {
+         String errorMsgStr = "";
+         if (errorMsg) 
+            errorMsgStr = "No script files have been processed. See preceeding error message(s).";
+         else
+            errorMsgStr = "No script files have been processed successfully.";
+
+         summaryWriter.writeln(formatSummaryStr(errorMsgStr));
+      }
+      else if ((this.totalScriptFiles - this.scriptsList.size()) < this.totalScriptFiles)
+      {
+         String scriptFileMsg ="";
+         if (errorMsg) 
+            scriptFileMsg = "Not all script files have been processed successfully. See preceeding error message(s).";
+         else
+            scriptFileMsg = "Not all script files have been processed successfully.";
+         
+         summaryWriter.writeln(formatSummaryStr(scriptFileMsg));
+      }
+      else
+      {
+         String finalMsg = "";
+         if (errorMsg)
+         {
+            finalMsg = "All the script files have been processed successfully. See preceeding error message(s).";
+         }
+         else if (this.totalSQLErrors == 0)
+         {
+            finalMsg = "All the script files have been processed successfully.";
+         }
+
+         summaryWriter.writeln(formatSummaryStr( finalMsg));
+      }
+
+      String summaryEnd = "PRUN completed at " + DateFormat.getDateTimeInstance().format(new Date());
+
+
+      if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+      {
+         sessObj.getXmlObj().handlePrunSummary(summaryWriter, summaryObj, summaryEnd, elapsedTime);
+      }
+      else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+      {
+         sessObj.getHtmlObj().handlePrunSummary(summaryWriter,summaryObj, summaryEnd, elapsedTime);
+      }
+      else
+      {
+         summaryWriter.writeln();
+         summaryWriter.writeln("\t"+utils.formatString("_",45,'_'));
+         summaryWriter.writeln("\t"+utils.formatString("          PARALLELRUN(PRUN) SUMMARY",45,' '));
+         summaryWriter.writeln("\t"+utils.formatString("_",45,'_'));
+         summaryWriter.writeln("\t"+utils.formatString("Total files present ",45,'.',""+this.totalScriptFiles));
+         summaryWriter.writeln("\t"+utils.formatString("Total files processed ",45,'.',""+(this.totalScriptFilesProcessed)));
+         summaryWriter.writeln("\t"+utils.formatString("Total queries processed ",45,'.',""+this.totalSQLsProcessed));
+         summaryWriter.writeln("\t"+utils.formatString("Total errors ",45,'.',""+this.totalSQLErrors));
+         summaryWriter.writeln("\t"+utils.formatString("Total warnings ",45,'.',""+this.totalSQLWarnings));
+         summaryWriter.writeln("\t"+utils.formatString("Total successes ",45,'.',""+(this.totalSQLsProcessed-this.totalSQLErrors)));
+         summaryWriter.writeln("\t"+utils.formatString("Total connections ",45,'.',""+ (this.totalConnections) ));
+         summaryWriter.writeln("\t"+utils.formatString("Total connection failures ",45,'.',""+ (connectionCnt-this.totalConnections) ));
+         summaryWriter.writeln();
+         summaryWriter.write((utils.formatString("=",80,'=')));
+         summaryWriter.writeln();
+         summaryWriter.write(summaryEnd);
+         summaryWriter.write(" " + elapsedTime);
+         summaryWriter.writeln();
+         summaryWriter.write((utils.formatString("=",80,'=')));
+         summaryWriter.writeln();
+      }
+
+      this.summaryWriter.close();
+      errorMsg = false;
+   }
+
+   private void getInputs() throws IOException, PrunUserInterruption, UserInterruption
+   {
+      cwObj.print(utils.formatString("Enter * as input to stop the current prun session",50,' '));
+      cwObj.println();
+      cwObj.println(utils.formatString("-",50,'-'));
+      cwObj.println();
+
+      while (true)
+      {
+         this.scriptsDir=getInput("Enter the scripts directory               :",null);
+
+         if (isValid(scriptsDir,"dir","read"))
+         {
+            scriptsDir = this.getCanonicalPath(scriptsDir);
+            break;
+         }
+         cwObj.println(SessionError.DIR_NOT_FOUND.errorMessage());
+         cwObj.println();
+
+      }
+
+      this.scriptsExt=getInput("Enter the script file extension["+SCRIPT_EXT+"]      :",SCRIPT_EXT);
+
+      while (true)
+      {
+         this.logsDir=getInput("Enter the logs directory[scripts dir]     :",this.scriptsDir);
+
+         if (isValid(logsDir,"dir","write"))
+         {
+            logsDir = this.getCanonicalPath(logsDir);
+            break;
+         }
+         cwObj.println(SessionError.DIR_NOT_FOUND.errorMessage());
+         cwObj.println();
+
+      }
+
+      while (true)
+      {
+         String overWriteVal=getInput("Overwrite the log files (y/n)[n]?         :","n");
+         if (overWriteVal.equalsIgnoreCase("y"))
+         {
+            this.overwriteLogs=true;
+            break;
+         }
+         else if (overWriteVal.equalsIgnoreCase("n"))
+         {
+            this.overwriteLogs=false;
+            break;
+         }
+         else
+         {
+            cwObj.println(SessionError.INCORRECT_OVERWRITE_OPTION.errorMessage());
+            cwObj.println();
+         }
+
+      }
+
+      while (true)
+      {
+         String connValue=getInput("Enter the number of connections("+ MIN_THREADS + "-" + utils.formatString(MAX_THREADS+")["+MIN_THREADS+"]",8,' ')+":",""+MIN_THREADS);
+         try
+         {
+            this.connectionCnt=Integer.parseInt(connValue);
+            if (this.connectionCnt >= MIN_THREADS && this.connectionCnt <= MAX_THREADS)
+            {
+               break;
+            }
+            cwObj.println(SessionError.PRUN_CONN_CNT_ERR.errorMessage());
+            cwObj.println();
+
+         }catch (NumberFormatException nfe)
+         {
+            cwObj.println("Invalid value specified for connections."+SessionDefaults.lineSeperator);
+         }
+
+      }
+
+      if (timerMode)
+      {
+         while (true)
+         {
+            String strTimerValue=getInput("Enter the time to run in minutes (0=single interation) ["+TIMER_DEFAULT+"]:",TIMER_DEFAULT);   //0=run to completion
+            try
+            {
+
+               timerValue= Integer.parseInt(strTimerValue);
+
+               if (timerValue >= 0)
+               {
+                  if (timerValue > 0)
+                  {
+                     this.endTime = (timerValue*1000*60) + System.currentTimeMillis();
+                     timerMode=true;
+                  }
+                  else
+                     timerMode=false;
+
+                  break;
+               }
+
+               cwObj.println("Invalid timer value");
+               cwObj.println();
+
+            }
+            catch (NumberFormatException nfe)
+            {
+
+            }
+
+         } //end while
+      }
+
+
+   }
+
+   private boolean isValid(String input,String type, String permissions)
+   {
+      if (input != null)
+      {
+         File file=new File(input);
+
+         if (!file.exists())
+         {
+            return false;
+         }
+         if ("dir".equals(type) && !file.isDirectory())
+         {
+            return false;
+         }
+         else if ("file".equals(type) && file.isDirectory())
+         {
+            return false;
+         }
+
+         if (("read".equals(permissions)) && !file.canRead())
+         {
+            return false;
+         }
+         if (("write".equals(permissions)) && !file.canWrite())
+         {
+            return false;
+         }
+         return true;
+
+      }
+      return false;
+   }
+
+   private String getInput(String requestString,String defaultVal) throws IOException, PrunUserInterruption, UserInterruption
+   {
+
+      cwObj.print((utils.formatString(requestString,46,' ')));
+      String input=crObj.getLine();
+      if ((input == null || input.trim().equals("")) && defaultVal != null)
+      {
+         input=defaultVal;
+      }
+      else if (input != null)
+      {
+         input=input.trim();
+      }
+      if ((input != null && input.equals("*")) || isUserInterrupt)
+      {
+         throw pui;
+      }
+
+      return input;
+   }
+
+   /*
+   *  Gets the number of connection available for parallelload
+   *  the maxthread value is set by the return value of this method
+   */
+   int getMaxServers()
+   {
+      boolean moreResults=false;
+      int defaultservercnt=MAX_THREADS;
+      Statement statement=null;
+      try
+      {
+         if ((statement=sessObj.getStmtObj()) != null)
+         {
+            moreResults=statement.execute("cfgcmd:INFO DS "+sessObj.getSessionDsn());
+         }
+
+         if (moreResults)
+         {
+            ResultSet resultSet=statement.getResultSet();
+            if (resultSet.next())
+               defaultservercnt=resultSet.getInt("MAX_SRVR_CNT");
+
+         }
+      }
+      catch (SQLException sqle)
+      {
+         //printAllExceptions(sqle);
+      }
+      return defaultservercnt;
+
+   }
+
+
+   public void run()
+   {
+
+      SessionInterface shareObj=new SessionInterface();
+      Session sessObjt=null;
+      ErrorObject errObj=null;
+      StringBuffer errBuf = new StringBuffer();
+      String threadName=currentThread().getName();
+      String logFile=null;
+      ArrayList<Vector<String>> errArr = new ArrayList<Vector<String>>();
+      Vector<String> errVec=null;
+
+
+      try
+      {
+         sessObjt=new Session(   this.sessObj.getSessionUser(),
+            this.sessObj.getSessionPass(),
+            this.sessObj.getSessionRole(),
+            this.sessObj.getSessionServer(),
+            this.sessObj.getSessionPort(),
+            this.sessObj.getSessionDsn(),
+            crObj,
+            cwObj);
+         // copy the required values from the main session
+         sessObjt.setSessionCtlg(this.sessObj.getSessionCtlg());
+         sessObjt.setSessionSchema(this.sessObj.getSessionSchema());
+         sessObjt.setSessionSQLTerminator(this.sessObj.getSessionSQLTerminator());
+         sessObjt.setSessionPrompt(this.sessObj.getPrompt());
+         sessObjt.setSessionTiming(this.sessObj.isSessionTimingOn());
+         sessObjt.setSessionTime(this.sessObj.isSessionTimeOn());
+         sessObjt.setSessionColSep(this.sessObj.getSessionColSep());
+         sessObjt.setListCount(this.sessObj.getListCount());
+         sessObjt.setStrDisplayFormat(this.sessObj.getStrDisplayFormat());
+         sessObjt.setMxosrvrVersion(this.sessObj.getMxosrvrVersion());
+         sessObjt.setSutVersion(this.sessObj.getSutVersion());
+         sessObjt.setT4verNum(sessObj.getT4verNum());
+         sessObjt.setSessionAutoPrepare(sessObj.isSessionAutoPrepare());
+         sessObjt.setSessionStatsEnabled(sessObj.isSessionStatsEnabled());
+
+         sessObjt= shareObj.createSession(sessObjt, 1, false);
+
+      } catch (FileNotFoundException e)
+      {
+    	  errObj=SessionError.SCRIPT_FILE_NOT_FOUND;
+         return;
+      } catch (SQLException e)
+      {
+         if (e.getErrorCode() == SessionDefaults.SQL_ERR_CONN_MAX_LIMIT)
+         {
+        	 errObj=SessionError.CONN_MAX_LIMIT_ERR;
+         }else
+         {
+			errObj = new ErrorObject(e.toString(), e.getErrorCode());
+         }
+
+         return;
+      } catch (InstantiationException e)
+      {
+    	  errObj=SessionError.DRIVER_INIT_ERR;
+         return;
+      } catch (IllegalAccessException e)
+      {
+    	  errObj=SessionError.DRIVER_INIT_ILLEGAL_ERR;
+         return;
+      } catch (ClassNotFoundException e)
+      {
+    	  errObj=SessionError.DRIVER_CLASS_ERR;
+         return;
+      } catch (IOException e)
+      {
+    	  errObj=new ErrorObject(SessionError.INTERNAL_ERR, "", " "+e.toString());
+         return;
+      }
+      finally
+      {
+         if (this.isUserInterrupt)
+         {
+            try
+            {
+
+               if (sessObjt.getConnObj() != null)
+               {
+                  sessObjt.getConnObj().close();
+               }
+            } catch (SQLException e)
+            {
+               //
+            }
+            sessObjt.setConnObj(null);
+            shareObj=null;
+            return;
+         }
+         if (errObj != null)
+         {
+            synchronized(this)
+            {
+               //if(this.summaryWriter !=null)
+               //this.summaryWriter.write(" Failed");
+               try
+               {
+                  this.summaryWriter.writeln();
+                  this.summaryWriter.writeln(DateFormat.getDateTimeInstance().format(new Date()) + " An error occurred in "+threadName+" when connecting to the database: "+errObj.errorMessage());
+                  errorMsg = true;
+               } catch (IOException e)
+               {
+
+               }
+            }
+         }
+         synchronized(this)
+         {
+            activeSessionLists.add(sessObjt);
+         }
+
+
+      } //end finally
+
+      this.totalConnections++;
+      //cwObj.println("\nConnection made for "+threadName);
+
+      while (true)
+      {
+
+         if (timerMode && ((nowTime=System.currentTimeMillis()) >= endTime))
+         {
+            //cwObj.println("\n" + threadName + " run time reached, terminating ..."); 
+            break;
+         }
+
+         logFile=null;
+         synchronized(this.scriptsList)
+         {
+            if (this.scriptsList.size() > 0)
+            {
+
+               if (this.isUserInterrupt)
+               {
+                  break;
+               }
+               String fileName=this.scriptsList.get(0).toString();
+               logFile=fileName+".log";
+               shareObj.setLogFile(this.logsDir+File.separator+logFile,this.overwriteLogs);
+               shareObj.setScriptFile(this.scriptsDir+File.separator+fileName);
+               this.scriptsList.remove(0);
+               this.totalScriptFilesProcessed++;
+               //debug information, prints the thread name and the script file it picks up for processing
+               if (prunDebug ){
+                  try
+                  {
+                     String debugMsg = DateFormat.getDateTimeInstance().format(new Date()) + ": Thread " + threadName +  " processing " + shareObj.getScriptFile();
+                     if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+                        this.summaryWriter.writeln(xmlObj._beginCdataTag + debugMsg + xmlObj._endCdataTag);
+                     else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)   
+                        this.summaryWriter.writeln(htmlObj._startCommentTag + debugMsg + htmlObj._endCommentTag);
+                     else
+                        this.summaryWriter.writeln( debugMsg );
+                  } catch (IOException ioEx)
+                  {
+                  }
+               }
+
+            }
+            else
+            { // no more files to process
+
+               if (timerMode)
+               {
+                  this.scriptsList.addAll(this.scriptsListBak);
+                  //cwObj.println("List addAll");
+                  continue;
+               }
+
+               break;
+            }
+         }
+         try
+         {
+            int sqlerrCnt=shareObj.getSqlErrorCount();
+            int sqlQueryCnt=shareObj.getSqlQueryCount();
+            int sqlWarningsCnt=shareObj.getSqlWarningsCount();
+            shareObj.invokeSession(sessObjt);
+            //if there are any error occurred in the current file ..write them in to the errBuf
+            if (shareObj.getSqlErrorCount() > sqlerrCnt || shareObj.getSqlWarningsCount() > sqlWarningsCnt)
+            {
+               errVec = new Vector<String>();
+               String scriptSqls=""+(shareObj.getSqlQueryCount() - sqlQueryCnt);
+               String scriptErrs=""+(shareObj.getSqlErrorCount() - sqlerrCnt);
+               String scriptWarns=""+(shareObj.getSqlWarningsCount() - sqlWarningsCnt);
+               if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT || sessObj.getDisplayFormat() == SessionDefaults.CSV_FORMAT)
+               {
+                  errBuf.append(utils.formatString(logFile,65,' ',"")+"  "+utils.formatString("",10,' ',""+scriptSqls)+"  "+utils.formatString("",7,' ',""+scriptErrs)+"  "+utils.formatString("",10,' ',""+scriptWarns));
+                  errBuf.append("####");
+               }
+               else
+               {
+                  errVec.add(0,logFile);
+                  errVec.add(1,scriptSqls);
+                  errVec.add(2, scriptErrs);
+                  errVec.add(3, scriptWarns);
+                  errArr.add(errVec);
+               }
+
+            }
+         } catch (IOException e)
+         {
+            // where to write this exception
+         }
+      }
+      try
+      {
+         //if(sessObjt.getConnObj() != null)
+         sessObjt.getConnObj().close();
+         sessObjt.setConnObj(null);
+      }catch (SQLException sqle)
+      {
+
+      }finally
+      {
+         sessObjt.setConnObj(null);
+         synchronized(this)
+         {
+            //this.totalScriptFilesProcessed++;
+            int sqlerrors=this.totalSQLErrors;
+            int sqlwarnings=this.totalSQLWarnings;
+            boolean isErrHeadPrinted=true;
+            this.totalSQLErrors+=shareObj.getSqlErrorCount();
+            this.totalSQLWarnings+=shareObj.getSqlWarningsCount();
+            if ((sqlerrors == 0 && this.totalSQLErrors != 0) || 
+                (sqlwarnings == 0 && this.totalSQLWarnings !=0) )
+            {
+               isErrHeadPrinted=false;
+            }
+            this.totalSQLsProcessed+=shareObj.getSqlQueryCount();
+            try
+            {
+               if (!isErrHeadPrinted)
+               {
+                  if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT || sessObj.getDisplayFormat() == SessionDefaults.CSV_FORMAT)
+                  {
+
+                     this.summaryWriter.writeln();
+                     this.summaryWriter.writeln("Check the following log files for the detailed error message.");
+                     this.summaryWriter.writeln(utils.formatString("-",4+65+27+8,'-'));  // 65 - size of the log file name + 27 - size of the remaining fields + 6 - spaces between the heading columns
+                     this.summaryWriter.writeln(utils.formatString("Seq#",4,' ',"")+"  "+utils.formatString("Log File Name",65,' ',"")+"  "+utils.formatString("",10,' ',"Total Qrys")+"  "+utils.formatString("",7,' ',"Errors")+"  "+utils.formatString("",10,' ',""+"Warnings"));
+                     this.summaryWriter.writeln(utils.formatString("-",4+65+27+8,'-',""));
+                  }
+                  else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+                  {
+                     this.summaryWriter.writeln(htmlObj._beginRowTag);
+                     this.summaryWriter.writeln(htmlObj._beginTblHeadTag + "Seq # " + htmlObj._endTblHeadTag);
+                     this.summaryWriter.writeln(htmlObj._beginTblHeadTag + "Logfile " + htmlObj._endTblHeadTag);
+                     this.summaryWriter.writeln(htmlObj._beginTblHeadTag + "Total Qrys" + htmlObj._endTblHeadTag);
+                     this.summaryWriter.writeln(htmlObj._beginTblHeadTag + "Errors" + htmlObj._endTblHeadTag);
+                     this.summaryWriter.writeln(htmlObj._beginTblHeadTag + "Warnings" + htmlObj._endTblHeadTag);
+                     this.summaryWriter.writeln(htmlObj._endRowTag);
+                  }
+                  isErrHeadPrinted=true;
+               }
+
+               if (errBuf.length() > 0)
+               {
+                  int newLineIdx=-1;
+
+                  while ((newLineIdx=errBuf.indexOf("####")) != -1)
+                  {
+                     this.seqNo++;
+                     this.summaryWriter.writeln(utils.formatString("",4,' ',this.seqNo+"")+"  "+errBuf.substring(0,newLineIdx).toString());
+                     errBuf.delete(0,newLineIdx+4);
+                  }
+               }
+               else
+               {
+                  for (int i=0; i< errArr.size();i++)
+                  {
+                     Vector<String> vect = errArr.get(i);
+                     this.seqNo++;
+                     if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+                     {
+                        this.summaryWriter.writeln(xmlObj._beginSeqIdTag + this.seqNo + xmlObj._endAttributeTag);
+                        this.summaryWriter.writeln(xmlObj._beginLogFileNameTag + vect.get(0).trim() + xmlObj._endLogFileNameTag);
+                        this.summaryWriter.writeln(xmlObj._beginTotalSqlsTag + vect.get(1).trim() + xmlObj._endTotalSqlsTag);
+                        this.summaryWriter.writeln(xmlObj._beginTotalErrors + vect.get(2).trim() + xmlObj._endTotalErrors);
+                        this.summaryWriter.writeln(xmlObj._beginTotalWarnings + vect.get(3).trim() +xmlObj._endTotalWarnings);
+                        this.summaryWriter.writeln(xmlObj._endSeqIdTag);
+                     }
+                     else if ((sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT))
+                     {
+                        this.summaryWriter.writeln(htmlObj._beginRowTag);
+                        this.summaryWriter.writeln(htmlObj._beginTblDataAlignTag + this.seqNo + htmlObj._endTblDataTag);
+                        this.summaryWriter.writeln(htmlObj._beginTblDataTag + vect.get(0) + htmlObj._endTblDataTag);
+                        this.summaryWriter.writeln(htmlObj._beginTblDataAlignTag +vect.get(1) + htmlObj._endTblDataTag);
+                        this.summaryWriter.writeln(htmlObj._beginTblDataAlignTag + vect.get(2)+ htmlObj._endTblDataTag);
+                        this.summaryWriter.writeln(htmlObj._beginTblDataAlignTag + vect.get(3) + htmlObj._endTblDataTag);
+                        this.summaryWriter.writeln(htmlObj._endRowTag);
+                     }
+                  }
+               }
+               errBuf=null;
+            } catch (IOException e)
+            {
+
+            }
+         }
+      }
+      sessObjt=null;
+
+
+
+   } //end run
+
+   public boolean validateArgs(String query) throws InvalidNumberOfArguments, IOException
+   {
+      if (query.endsWith(sessObj.getSessionSQLTerminator()))
+      {
+         query = query.substring(0, query.length()-sessObj.getSessionSQLTerminator().length());
+      }
+
+      setArgs(query.split(" "));
+
+      if (noOfArgs == 1)
+         return true;
+
+      if (sessObj.isDebugOn())
+    	  System.out.println("No.of args :: " + noOfArgs);
+      if (noOfArgs > 11)
+      {
+         //writeObj.writeln();
+         throw new InvalidNumberOfArguments();
+      }
+
+      //Set defaults for non-interactive mode
+      scriptsDir=System.getProperty("user.dir");
+      scriptsExt = SCRIPT_EXT;
+      connectionCnt = MIN_THREADS;
+
+      for (int i=1; i < noOfArgs; i++)
+      {
+         String value = null;
+         String option=this.args[i++].trim();
+
+         if (i < noOfArgs)
+         {
+            value=this.args[i].trim();
+         }
+         else
+         {
+            if (!option.equalsIgnoreCase("-d") && !option.equalsIgnoreCase("-defaults"))
+            {
+               //writeObj.writeln();
+               throw new InvalidNumberOfArguments();
+            }
+         }
+
+         if (option.equalsIgnoreCase("-sd")|| option.equalsIgnoreCase("-scriptsdir"))
+         {
+            scriptsDir=this.getCanonicalPath(value);
+         }
+         else if (option.equalsIgnoreCase("-e")|| option.equalsIgnoreCase("-extension"))
+         {
+            scriptsExt=value;
+         }
+         else if (option.equalsIgnoreCase("-ld")|| option.equalsIgnoreCase("-logsdir"))
+         {
+            logsDir=this.getCanonicalPath(value);
+         }
+         else if (option.equalsIgnoreCase("-o")|| option.equalsIgnoreCase("-overwrite"))
+         {
+            if (value.equalsIgnoreCase("y"))
+            {
+               this.overwriteLogs=true;
+            }
+            else if (value.equalsIgnoreCase("n"))
+            {
+               this.overwriteLogs=false;
+            }
+            else
+            {
+               this.writePrunErrors(SessionError.INCORRECT_OVERWRITE_OPTION);
+               return false;
+            }
+         }
+         else if (option.equalsIgnoreCase("-c")|| option.equalsIgnoreCase("-connections"))
+         {
+            try
+            {
+               connectionCnt = Integer.parseInt(value);
+            } catch (NumberFormatException nfe)
+            {
+               this.writePrunErrors(SessionError.INVALID_CONN_VALUE);
+               return false;
+            }
+         }
+         else if (option.equalsIgnoreCase("-m")|| option.equalsIgnoreCase("-minutes"))
+         {
+            if (!timerMode)
+            {
+                   this.writePrunErrors(new ErrorObject(SessionError.UNKOWN_OPTION, "" ,option));
+                   //If not in XML, HTML, or CSV markup mode, display help usage.
+                   if(sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+                        printUsage();
+               return (false);
+            }
+
+            timerValue = Integer.parseInt(value);
+
+         }
+         else if (option.equalsIgnoreCase("-d")|| option.equalsIgnoreCase("-defaults"))
+         {
+            if (noOfArgs > 2)
+            {
+             	this.writePrunErrors(SessionError.DEFAULT_OPTION_ERR);
+                //If not in XML, HTML, or CSV markup mode, display help usage.
+                if(sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+                       printUsage();
+               return (false);
+            }
+         }
+         else
+         {
+         	this.writePrunErrors(new ErrorObject(SessionError.UNKOWN_OPTION.errorCode(),SessionError.UNKOWN_OPTION.errorMessage()+ option));
+             //If not in XML, HTML, or CSV markup mode, display help usage.
+            if(sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+                printUsage();
+            return (false);
+         }
+
+      } //end for
+
+      if (!isValid(scriptsDir,"dir","read"))
+      {
+       	this.writePrunErrors(SessionError.SCRIPTS_DIR_NOT_FOUND);
+         return (false);
+      }
+
+      if (logsDir == null)
+         logsDir = scriptsDir;
+      else if (!isValid(logsDir,"dir","read"))
+      {
+       	this.writePrunErrors(SessionError.LOGS_DIR_NOT_FOUND);
+         return (false);
+      }
+
+      if (connectionCnt < MIN_THREADS || connectionCnt > MAX_THREADS)
+      {
+       	this.writePrunErrors(SessionError.PRUN_CONN_CNT_ERR);
+         return (false);
+      }
+
+      if (timerMode)
+      {
+         if (timerValue > 0)
+         {
+            endTime= (timerValue * 1000*60) + System.currentTimeMillis();
+         }
+         else if (timerValue < 0)
+         {
+            cwObj.println("Invalid timer value");
+            cwObj.println();
+            return (false);
+         }
+         else //timerValue=0
+         {
+            cwObj.println(SessionDefaults.lineSeperator+"Timer mode ignored, -m is 0"+SessionDefaults.lineSeperator);
+            timerMode = false;
+         }
+
+      }
+
+      if (cwObj.getConsoleOut())
+      {
+         cwObj.println(SessionDefaults.lineSeperator+"PRUN options are -scriptsdir  " + scriptsDir +
+            SessionDefaults.lineSeperator+"                 -logsdir     " + logsDir +
+            SessionDefaults.lineSeperator+"                 -extension   " + scriptsExt +
+            SessionDefaults.lineSeperator+"                 -overwrite   " + (this.overwriteLogs ? "y":"n") +
+            SessionDefaults.lineSeperator+"                 -connections " + connectionCnt);
+
+         if (timerMode)
+            cwObj.println(SessionDefaults.lineSeperator+"                 -minutes     " + timerValue );
+      }
+
+      return (true);
+
+
+   } //end validateArgs
+
+   private void setArgs(String[] args)
+   {
+      noOfArgs=args.length;
+      this.args=args;
+   }
+
+   private String getCanonicalPath(String fileName)
+   {
+      File file = new File(fileName);
+
+      try
+      {
+         return (file.getCanonicalPath());
+      }catch (IOException io)
+      {
+
+      }
+      return (fileName);
+   }
+
+   public void printUsage() throws IOException
+   {
+      writeObj.writeln();
+      writeObj.writeln("prun -sd|scriptsdir <directory-name> -e|extension <extension> ");
+      writeObj.writeln("     -ld|logsdir <directory-name>  -o|overwrite {y|n} ");
+      writeObj.writeln("     -c|connections <no-of-connections>" );
+      if (timerMode)
+         writeObj.writeln("     -m|minutes <no-of-minutes>" );
+
+      writeObj.writeln();
+      writeObj.writeln("\t----- OR -----");
+      writeObj.writeln();
+      writeObj.writeln("prun -d|defaults");
+      writeObj.writeln();
+      writeObj.writeln("where:");
+      writeObj.writeln("\t-defaults \tspecifies default values for all the options.");
+      writeObj.writeln("\t-scriptsdir \tspecifies the directory containing the script files.");
+      writeObj.writeln("\t-extension \tspecifies the extension of script files.");
+      writeObj.writeln("\t-logsdir \tspecifies the directory where logs files are created.");
+      writeObj.writeln("\t-overwrite \tspecifies if the log files have to be overwritten.");
+      writeObj.writeln("\t-connections \tspecifies the number of connections.");
+      if (timerMode)
+      {
+         writeObj.writeln("\t-minutes \tspecifies the time to run test.");
+         writeObj.writeln();
+         writeObj.writeln("\t[ optional property -Dtrafci.prun.connection.delta=n ]");
+      }
+   }
+
+   private String formatSummaryStr(String msg) 
+   {
+      String summaryStr = null;
+      if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+      {
+         summaryStr = xmlObj._beginCdataTag + msg + xmlObj._endCdataTag;
+      }
+      else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+      {
+         summaryStr = htmlObj._startCommentTag + msg + htmlObj._endCommentTag;
+      }
+      else
+      {
+         summaryStr = "\t" + msg + SessionDefaults.lineSeperator;
+      }
+      return summaryStr;
+   }
+   
+   private void writePrunErrors(ErrorObject prunError) throws IOException
+   {
+       if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+           writeObj.writeln();
+       
+       writeObj.writeInterfaceErrors(this.sessObj, prunError);
+   }
+
+   private void endPrunConsoleTags() 
+   {
+      if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+      {
+         cwObj.println(xmlObj._endRootTag);
+         xmlObj._beginRootElement = false;
+      }
+      else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+      {
+         cwObj.println(htmlObj._endTableTag);
+         htmlObj._startTags = false;
+      }
+   }
+   
+} //end class

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ParamStringObject.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ParamStringObject.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ParamStringObject.java
new file mode 100644
index 0000000..263b98a
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ParamStringObject.java
@@ -0,0 +1,256 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+
+import java.io.UnsupportedEncodingException;
+
+
+
+/**
+ *  Implementation of a CI or SQL parameter value.
+ *
+ *
+ */
+public class ParamStringObject {
+
+
+   /**
+    *  Member variables containing the charset name, is hexadecimal value and
+    *  actual parameter value string specified.
+    */
+   private  String  _charsetName  = null;
+   private  String  _hexPrefixStr = null;
+   private  String  _inputValue   = null;
+
+
+   /**
+    *  Boolean flag indicating whether or not the input value is in hex.
+    */
+   private  boolean _isHexInput   = false;
+
+
+
+   /**
+    *  Default Parameter value constructor.
+    *
+    *  @param   charsetName  The character set name
+    *  @param   hexInput     Prefix if the parameter value is in hex (x'')
+    *  @param   theValue     The actual parameter value
+    *
+    *  @since   R2.4 SP2
+    *
+    */
+   public ParamStringObject(String charsetName, String hexInputPrefix,
+                           String theValue) {
+      this._charsetName  = charsetName;
+      this._hexPrefixStr = hexInputPrefix;
+      this._inputValue   = theValue;
+
+      if (null != this._hexPrefixStr) {
+         this._hexPrefixStr = this._hexPrefixStr.trim();
+
+         if (this._hexPrefixStr.toLowerCase().equals("x") )
+            this._isHexInput = true;
+
+      }
+
+
+   }  /*  End of  ParamStringValue  Constructor.  */
+
+
+
+   /**
+    *  Returns the character set name specified for this parameter value.
+    *
+    *  @return  the SQL character set name
+    *
+    */
+   public  String  getCharacterSetName() {
+      return  this._charsetName;
+
+   }  /*  End of  getCharacterSetName  method.  */
+
+
+
+   /**
+    *  Returns the evaluated parameter value -- any hex input is converted.
+    *
+    *  @return  the evaluated parameter value.
+    *  @since   R2.4 SP2
+    *
+    */
+   public  String  getParameterValue()  throws Exception {
+      /**
+       *  Trim out the quotes.
+       */
+      String  theInput = this._inputValue.trim();
+      if (theInput.startsWith("'")  &&  theInput.endsWith("'") )
+         theInput = theInput.substring(1, theInput.length() - 1);
+
+
+      /**
+       *  If its plain and simple text -- return it as is.
+       */
+      if (!this._isHexInput)
+         return  theInput;
+
+
+      /**
+       *  For hexadecimal values, trim out the spaces inside the quotes.
+       */
+      theInput = theInput.trim();
+
+
+      /**
+       *  Okay its a hexadecimal stream that we need to convert.
+       */
+      String[] inputBits = theInput.split(" ");
+      String  retValue = ""; 
+      int lengthOfInputByte = 0;
+      for (int i = 0; i < inputBits.length; i++) {
+    	  if (inputBits[i].length() % 2 == 1)
+    		  throw new Exception("'" + theInput + "' is not a valid "
+						+ "character encoding value. ");
+    	  lengthOfInputByte += inputBits[i].length() / 2;
+		}
+      byte[] inputByte = new byte[lengthOfInputByte];
+      int inputPos = 0;
+
+      for (int idx = 0; idx < inputBits.length; idx++) {
+    	  String aChunk = inputBits[idx];
+    	  int length = aChunk.length() & -4;
+		  if (this._charsetName == null
+					|| (!this._charsetName.equalsIgnoreCase("_UCS2") && !this._charsetName
+							.equalsIgnoreCase("_UTF8"))) {
+    		  do {
+    	          	 String bitVal = aChunk;
+    	          	 if (4 < aChunk.length() )  {
+    	          		 bitVal = aChunk.substring(0, 4);
+    	          		 aChunk = aChunk.substring(4, aChunk.length() );
+    	             } else
+    	                aChunk = "";
+    	          	 
+    	             try {
+    	                int val = Integer.parseInt(bitVal, 16);
+    	                
+    	                byte  b1 = (byte) (val & 0xFF);
+    	                byte  b2 = (byte) ((val >> 8) & 0xFF);
+    	                byte  b3 = (byte) ((val >> 16) & 0xFF);
+    	                byte  b4 = (byte) ((val >> 24) & 0xFF);
+
+    	                if ((0 != b4) ||  (0 != b3) )
+    	                   retValue += new String(new byte[] { b4, b3, b2, b1 } );
+    	                else if (0 != b2) 
+    	                   retValue += new String(new byte[] { b2, b1 } );
+    	                else
+    	                   retValue += new String(new byte[] { b1 });
+    	             } catch(Exception e) {
+    	            	 throw new Exception("'" + inputBits[idx]
+    	            	         							+ "' is not a valid " + "hexadecimal value. ");
+    	             }
+    		  } while (0 < aChunk.length() );
+    	  }/**
+    	    * for UTF-8
+		    * modify to fix the defect CRID1331
+		    */
+			else if (this._charsetName.equalsIgnoreCase("_UTF8")) {
+				for (int pos = 0; pos < aChunk.length(); pos += 2) {
+					try {
+						int val = Integer.parseInt(
+								aChunk.substring(pos, pos + 2), 16);
+						inputByte[inputPos++] = (byte) (val & 0xFF);
+					} catch (NumberFormatException NF_Ex) {
+						throw new Exception("'" + aChunk + "' is not a valid "
+								+ "hexadecimal value. ");
+					}
+					//when it comes to the end of the bits, convert it
+					if (idx == inputBits.length - 1
+							&& pos == aChunk.length() - 2)
+						try {
+							retValue = new String(inputByte, "UTF8");
+						} catch (UnsupportedEncodingException e) {
+							throw new Exception(
+									"The input hexadecimal is not a valid UTF-8 hexadecimal value. ");
+						}
+				}
+			}else{ // UCS2
+    		  /**
+        	   * set Param is used to set ucs2 values. CI gives wrong data
+        	   * Internal Analysis: by shifting all low bits to right causes UCS2 hex
+        	   * to get the first byte chopped off & turn into invalid character
+        	   * Fix Description: simply convert hex values to String
+        	   */
+    		  for ( int pos=0; pos < length; pos += 4) {
+        		  int this_char = 0;
+        		  try { 
+                	   this_char = Integer.parseInt( aChunk.substring( pos,pos+4), 16);
+        		  }
+        		  catch ( NumberFormatException NF_Ex) { 
+        			  throw new Exception("'" 
+        			     + aChunk + "' is not a valid " + "hexadecimal value. ");
+        		  }
+        		  retValue += (char) this_char;
+               }
+    	  }
+      }  /*  End of  FOR  loop  for all the parts in the input.  */
+      
+      return  retValue;
+
+   }  /*  End of  getParameterValue  method.  */
+
+
+
+
+   /**
+    *  Returns the Stringified form of this parameter value.
+    *
+    *  @return  the stringified form of this parameter value.
+    *  @since   R2.4 SP2
+    *
+    */
+   public String toString() {
+      String theValue = null;
+
+      if (null != this._charsetName)
+         theValue = this._charsetName.toUpperCase();
+
+      if (null == theValue)
+         theValue = this._hexPrefixStr;
+      else if (null != this._hexPrefixStr)
+         theValue += " " + this._hexPrefixStr;
+
+
+      if (null == theValue)
+         theValue = this._inputValue;
+      else
+         theValue += this._inputValue;
+
+      return  theValue;
+ 
+   }  /*  End of  toString  method.  */
+
+
+
+}  /*  End of  class  ParamStringValue.  */
+
+


[26/38] incubator-trafodion git commit: add the copy right declaration

Posted by li...@apache.org.
add the copy right declaration


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

Branch: refs/heads/master
Commit: 9bac03e316bd8567400712302f4f85350d4dbb9e
Parents: 39b0169
Author: AlexPeng19 <al...@hotmail.com>
Authored: Tue Nov 22 12:34:19 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Tue Nov 22 12:34:19 2016 +0800

----------------------------------------------------------------------
 core/conn/trafci/Makefile                       | 25 ++++++++++++++++++++
 core/conn/trafci/pom.xml                        | 24 +++++++++++++++++--
 .../trafci/src/main/resources/install_jar.xml   | 22 +++++++++++++++++
 .../trafci/src/main/resources/install_tar.xml   | 22 +++++++++++++++++
 4 files changed, 91 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9bac03e3/core/conn/trafci/Makefile
----------------------------------------------------------------------
diff --git a/core/conn/trafci/Makefile b/core/conn/trafci/Makefile
index 3a64c00..067a0e3 100644
--- a/core/conn/trafci/Makefile
+++ b/core/conn/trafci/Makefile
@@ -1,3 +1,28 @@
+# @@@ 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 @@@
+
+# This Makefile is just a thin shell to Maven, which is used to do the real build
+
+include ../../macros.gmk #top level
+
 all:Trafci_deploy
 Trafci_deploy:Trafci_installer
 Trafci_installer:Trafci_jar

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9bac03e3/core/conn/trafci/pom.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/pom.xml b/core/conn/trafci/pom.xml
index 159b2c6..15307de 100644
--- a/core/conn/trafci/pom.xml
+++ b/core/conn/trafci/pom.xml
@@ -1,5 +1,25 @@
-<!-- @@@ START COPYRIGHT @@@ (C) Copyright 2015 Esgyn Corporation @@@ END 
-	COPYRIGHT @@@ -->
+<!-- 
+ @@@ 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 @@@
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9bac03e3/core/conn/trafci/src/main/resources/install_jar.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/resources/install_jar.xml b/core/conn/trafci/src/main/resources/install_jar.xml
index a79fdd5..c44b468 100644
--- a/core/conn/trafci/src/main/resources/install_jar.xml
+++ b/core/conn/trafci/src/main/resources/install_jar.xml
@@ -1,3 +1,25 @@
+<!-- 
+ @@@ 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 @@@
+-->
 <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9bac03e3/core/conn/trafci/src/main/resources/install_tar.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/resources/install_tar.xml b/core/conn/trafci/src/main/resources/install_tar.xml
index 391e74b..9424a1f 100644
--- a/core/conn/trafci/src/main/resources/install_tar.xml
+++ b/core/conn/trafci/src/main/resources/install_tar.xml
@@ -1,3 +1,25 @@
+<!-- 
+ @@@ 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 @@@
+-->
 <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">


[22/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/install/Installer.java-tmpl
----------------------------------------------------------------------
diff --git a/core/conn/trafci/install/Installer.java-tmpl b/core/conn/trafci/install/Installer.java-tmpl
new file mode 100644
index 0000000..8b5caaa
--- /dev/null
+++ b/core/conn/trafci/install/Installer.java-tmpl
@@ -0,0 +1,3389 @@
+//
+// @@@ 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 @@@
+//
+
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FilePermission;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.filechooser.FileFilter;
+
+public class Installer
+{
+   /* change this to true when debugging */
+   private boolean DEBUG = false; 
+   
+   static String MANIFEST = "META-INF/MANIFEST.MF";
+   private static final String vprocStr = "@@@VPROC@@@";
+   private String myClassName;
+
+   final static String productName="trafci";
+   final static String productTitle="Trafodion Command Interface";
+   final static String productScriptName="trafci";
+      
+   private static String cardCurrent = "";
+   private static boolean standardInstall = true;
+   private static boolean silentInstall = false;
+   private static boolean enableOpenSource = false;
+   final static String cardInstallerChoices = "INSTALLER CHOICES";
+   final static String cardInstallerPath = "INSTALLER PATHS";
+   final static String cardOptionalComponents = "OPTIONAL COMPONENTS";
+   final static String cardLegal = "LEGAL DISCLAIMER";
+   final static String cardInstallationComplete = "INSTALLATION COMPLETE";
+   
+   final static String ERROR_INVALID_NCI_DIR = "Invalid " + productTitle + " Installation Directory"; 
+   
+   final String NEW_JDBC = "JDBC Type 4 Driver JAR File";
+   final String NEW_JDBC_PKG = "org/trafodion/jdbc/t4/";
+   
+   String installerFilesStartWith="$";
+   String productJarFileName="trafci.jar";
+   String productJarLoc="lib";
+   String productJarFile=productJarLoc+File.separator+productJarFileName;
+   String classVarToReplace="##TRAFCI_CLASSPATH##";
+   String perlClassVarToReplace="##TRAFCI_PERL_CLASSPATH##";
+   String perlLibPathToReplace = "##TRAFCI_PERL_LIB_CLASSPATH##";
+   String pythonClassVarToReplace="##TRAFCI_PYTHON_CLASSPATH##";
+   String pythonLibPathToReplace = "##TRAFCI_PYTHON_LIB_CLASSPATH##";
+   String jythonJarFile="jython.jar";
+   String perlJarFile="JavaServer.jar";
+   String t4jdbcIdentifier= NEW_JDBC_PKG + "TrafT4PreparedStatement.class";
+   String ciJarIdentifier="org/trafodion/ci/Vproc.class"; 
+   BufferedReader bufReader= new BufferedReader(new InputStreamReader(System.in));
+
+   private static String nixDefaultInstallDir="/usr/local/";
+   private static String wDefaultInstallDir="\\Trafodion\\" + productTitle;
+   private static String defaultInstallDir=wDefaultInstallDir;
+   
+   private static String wDefaultInstallJDBC="";
+   private static String nixDefaultInstallJDBC="/usr/local/trafci/jdbcT4.jar";
+   private static String defaultInstallJDBC=wDefaultInstallJDBC;
+   
+   static String jdbcFileLoc=null;
+   static String targetDirectory=null;
+   static String osName=null;
+   
+   String defaultPerlJavaURL = "http://search.cpan.org/src/METZZO/Java-4.7/";
+   String defaultPerlSAXURL = "http://search.cpan.org/src/KMACLEOD/libxml-perl-0.08/lib/XML/Parser/PerlSAX.pm";
+   String defaultPythonJythonURL = "http://fr.sourceforge.jp/frs/g_redir.php?m=jaist&f=%2Fjython%2Fjython%2F2.2%2Fjython_installer-2.2.jar";
+   
+
+   public class InstallerGUIMode extends JFrame {
+
+	  private static final long serialVersionUID = -8158111325005975799L;
+	  JTextField file_txt =null;
+      JButton fileBrowseButton =null;
+      JButton dirBrowseButton =null;
+      JButton dirBrowseButtonOSS =null;
+      JButton choiceStandardInstall =null;
+      JButton choiceCoreComponents =null;
+      JButton choiceOptionalButton =null;
+      JButton nextButtonInstallerPath =null;
+      JButton nextButtonOptionalComponents =null;
+      JButton autoDetectProxy =null;
+      JButton nextButtonLegal =null;
+      JButton finishedButton =null;
+      JButton perlJavaURL =null;
+      JButton perlSAXURL =null;
+      JButton pythonJythonURL =null;
+      
+      JFileChooser filechooser=null;
+      JTextField jdbcFileText =null;
+      JTextField targetDirText =null;
+      JTextField ossTargetDirText =null;
+      JTextField proxyServerText =null;
+      JTextField proxyPortText =null;
+      ProxyBox proxyCombo =null;
+      
+      JCheckBox checkRequiredComponents =null;
+      JCheckBox checkPerl =null;
+      JCheckBox checkPython =null;
+      JCheckBox checkPerlSAX =null;
+      JCheckBox checkLegal =null;
+      
+      ButtonGroup proxyButtonGroup =null;
+      JRadioButton noProxyRadio =null;
+      JRadioButton useProxyRadio =null;
+      
+      JLabel statusLabel =null;
+      JLabel proxyPortLabel =null;
+      JLabel proxyServerLabel =null;
+      JLabel downloadLabel =null;
+      
+      JPanel panelProxy =null;
+      JPanel panelDownload =null;
+      JPanel panelComponentsProxyContainer =null;
+      JPanel finishedContainer =null;
+      JPanel headPanelFinished =null;
+      JPanel controlPanelFinished =null;
+      JPanel targetSelectPanel =null;
+      JPanel legalPanelContainer =null;
+      JPanel pathHolder =null;
+      JPanel optComponentContainer =null;
+      JPanel panelComponents =null;
+      JProgressBar progressBar =null;
+      JTextArea downloadTextArea =null;
+
+      Container content = getContentPane();
+
+      boolean downloadError = false;
+      
+      int getJDBCLocation()
+      {
+         JFileChooser t4c = new JFileChooser();
+         t4c.setCurrentDirectory(new File("."));
+         t4c.setDialogTitle("Select " + NEW_JDBC);
+         t4c.setMultiSelectionEnabled(false);
+         t4c.setFileSelectionMode(JFileChooser.FILES_ONLY);
+         t4c.setBackground(new Color(230,228,223));
+
+         File jdbcFile =null;
+         boolean jarFound = false;
+
+         t4c.addChoosableFileFilter(new nameFilter());
+         t4c.setAcceptAllFileFilterUsed(false);
+
+         while (true)
+         {
+            if (t4c.showDialog(InstallerGUIMode.this, "Select")
+               != JFileChooser.APPROVE_OPTION)
+            {
+               return JFileChooser.CANCEL_OPTION;  //only when user select valid dir, it can return approve_option
+            }
+            jdbcFile = t4c.getSelectedFile();
+            if (jdbcFile.getName().endsWith(".jar") && jdbcFile.canRead())
+            {
+               try
+               {
+                  ZipFile zf = new ZipFile(jdbcFile);
+                  int size = zf.size();
+                  Enumeration<?> entries = zf.entries();
+                  for (int i=0; i<size; i++)
+                  {
+                     ZipEntry entry = (ZipEntry) entries.nextElement();
+                     if (!entry.isDirectory() && entry.getName().equals(t4jdbcIdentifier))
+                     {
+                        jarFound= true;
+                        break;
+                     }
+                  }
+               } catch (Exception e)
+               {
+               }
+            }
+            if (jarFound)
+            {
+               break;
+            }
+            else
+               JOptionPane.showMessageDialog(null,"Invalid JDBC jar file specified", "Error", JOptionPane.ERROR_MESSAGE);
+         }
+         jdbcFileLoc=jdbcFile.getAbsolutePath();
+         return JFileChooser.APPROVE_OPTION;
+      }
+
+      int getTargetInstallLocation()
+      {
+         JFileChooser installDir = new JFileChooser();
+         installDir.setCurrentDirectory(new File("."));
+         installDir.setDialogTitle("Select "+productTitle+" Installation Directory ");
+         installDir.setMultiSelectionEnabled(false);
+         installDir.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+
+
+         File installDirFile =null;
+
+         installDir.addChoosableFileFilter(new dirFilter());
+         installDir.setAcceptAllFileFilterUsed(false);
+         while (true)
+         {
+            if (installDir.showDialog(InstallerGUIMode.this, "Select")
+               != JFileChooser.APPROVE_OPTION)
+            {
+               return JFileChooser.CANCEL_OPTION;  //only when user select valid dir, it can return approve_option
+            }
+            installDirFile = installDir.getSelectedFile();
+            
+            if (installDirFile.isDirectory() && installDirFile.exists() && installDirFile.canWrite())
+            {
+               if(cardCurrent == cardLegal && !validateNCIPath(installDirFile.getAbsolutePath()))
+                   JOptionPane.showMessageDialog(null,ERROR_INVALID_NCI_DIR, "Error", JOptionPane.ERROR_MESSAGE);
+               else{    
+                   targetDirectory=installDirFile.getAbsolutePath();
+                   if (!targetDirectory.equalsIgnoreCase(wDefaultInstallDir))
+                   {
+                	   if (osName.startsWith("window"))
+                	   {
+                		   if(!targetDirectory.endsWith(("\\")))
+                			   targetDirectory +="\\";              	   
+                	   
+                	   }
+                	   else
+                	   {
+                		   if(!targetDirectory.endsWith(("/")))
+                               targetDirectory +="/";                  	   
+                    	   
+                	   }
+                	   if(cardCurrent == cardInstallerPath)
+                	       targetDirectory += productName;
+                   }
+
+                   break;
+               }
+            }
+            else
+               JOptionPane.showMessageDialog(null,"Could not find the directory specified or invalid permissions ", "Error", JOptionPane.ERROR_MESSAGE);
+         }
+         return JFileChooser.APPROVE_OPTION;
+      }
+
+      class nameFilter extends FileFilter
+      {
+
+         public boolean accept(File file)
+         {
+        	
+            boolean jarFound=false;
+            if (file.isDirectory() && file.canRead()) 
+               return true;
+
+            if (file.getName().endsWith(".jar") && file.canRead())
+            {
+               try
+               {
+                  ZipFile zf = new ZipFile(file);
+                  int size = zf.size();
+                  Enumeration<?> entries = zf.entries();
+                  for (int i=0; i<size; i++)
+                  {
+                     ZipEntry entry = (ZipEntry) entries.nextElement();
+                     if (!entry.isDirectory() && entry.getName().equals(t4jdbcIdentifier))
+                        jarFound=true;
+                  }
+               } catch (Exception e)
+               {
+               }
+            }
+            if (jarFound) return true;
+            else return false;
+         }
+
+         //The description of this filter
+         public String getDescription()
+         {
+            return "JAR File";
+         }
+      }
+
+      class dirFilter extends FileFilter
+      {
+         public boolean accept(File file)
+         {
+            if (file.exists() && file.isDirectory() && file.canWrite())
+               return true;
+            else
+               return false;
+         }
+
+         //The description of this filter
+         public String getDescription()
+         {
+            return "Installation Directory";
+         }
+      }
+
+    @SuppressWarnings("unused")
+	void process(String zipfile)
+      {
+         File currentArchive = new File(zipfile);
+         SimpleDateFormat formatter = new SimpleDateFormat ("MM/dd/yyyy hh:mma",Locale.getDefault());
+         //ProgressMonitor pm = null;
+         boolean overwrite = false;
+         ZipFile zf = null;
+         FileOutputStream out = null;
+         InputStream in = null;
+         File outputDir=new File(targetDirectory);
+         File jdbcFile=new File(jdbcFileLoc);
+
+         if (outputDir != null && !outputDir.exists())
+         {
+            outputDir.mkdirs();
+         }
+
+         try
+         {
+            zf = new ZipFile(currentArchive);
+            int size = zf.size();
+            int extracted = 0;
+
+            Enumeration<?> entries = zf.entries();
+            progressBar.setMaximum(size);
+            installLogOutput("Extracting files to " + targetDirectory);
+            
+            ArrayList<String> installerFiles = new ArrayList<String>();
+            
+            installerFiles.add("Downloader.class");
+            installerFiles.add("DownloaderError.class");
+            installerFiles.add("DownloaderTest.class"); 
+            installerFiles.add("Ebcdic2Ascii.class");
+            installerFiles.add("ControlCSignalHandler.class");
+            installerFiles.add("ControlCSignalHandler$1.class");
+            
+            for (int i=0; i<size; i++)
+            {
+               progressBar.setValue(i+1);
+               
+               ZipEntry entry = (ZipEntry) entries.nextElement();
+               if (entry.isDirectory())
+                  continue;
+
+               String pathname = entry.getName();
+               if (myClassName.equals(pathname) || MANIFEST.equals(pathname.toUpperCase()) || 
+                       pathname.startsWith(installerFilesStartWith) || installerFiles.contains(pathname))
+                  continue;
+
+               extracted ++;
+               //pm.setProgress(i);
+               //pm.setNote(pathname);
+               //if (pm.isCanceled())
+               //   return;
+
+               in = zf.getInputStream(entry);
+               File outFile = new File(outputDir, pathname);
+               Date archiveTime = new Date(entry.getTime());
+               if (overwrite==false)
+               {
+                  if (outFile.exists())
+                  {
+                     Object[] options = {"Yes", "Yes To All", "No"};
+                     String msg = checkFileExists (outFile,entry,formatter,archiveTime);
+                     int result = JOptionPane.showOptionDialog(InstallerGUIMode.this,
+                        msg, "Warning", JOptionPane.DEFAULT_OPTION,
+                        JOptionPane.WARNING_MESSAGE, null, options,options[0]);
+                     if (result == 2)
+                     { // No
+                        extracted --;
+                        continue;
+                     }
+                     else if (result == 1)
+                     { //YesToAll
+                        overwrite = true;
+                     }
+                     
+                     optComponentContainer.repaint();
+                     optComponentContainer.revalidate();
+                  }
+               }
+               handleSamplesDir(archiveTime, in, outFile, out, jdbcFile, outputDir);
+            }
+
+            handlePermission(targetDirectory);
+          
+            zf.close();
+            getToolkit().beep();
+            JOptionPane.showMessageDialog (InstallerGUIMode.this,
+               extractedMessage(extracted, zipfile, outputDir, selectedOptionalComponents()),
+               productTitle+" Installation Status"
+               ,
+               JOptionPane.INFORMATION_MESSAGE);
+            
+            optComponentContainer.repaint();
+            
+            installLogOutput("Extraction Complete: Successfully installed core TRAFCI files");
+            
+         } catch (Exception e)
+         {
+            installLogOutput("INSTALLATION ERROR:\n" + e.toString());
+             
+            System.out.println(e);
+            if (zf!=null)
+            {
+               try
+               {
+                  zf.close();
+               } catch (IOException ioe)
+               {
+                  ;
+               } 
+            }
+            if (out!=null)
+            {
+               try
+               {
+                  out.close();
+               } catch (IOException ioe)
+               {
+                  ;
+               } 
+            }
+            if (in!=null)
+            {
+               try
+               {
+                  in.close();
+               } catch (IOException ioe)
+               {
+                  ;
+               } 
+            }
+         }
+      }
+
+      public void installLogOutput(String logtext){
+          downloadTextArea.setText(downloadTextArea.getText() + "\n" + "* " + logtext);
+          downloadTextArea.setCaretPosition(downloadTextArea.getDocument().getLength());
+          downloadTextArea.paintImmediately(downloadTextArea.getVisibleRect());
+      }
+      
+      class ComboBoxListener  implements ActionListener
+      {
+          public void actionPerformed(ActionEvent event)
+          {
+              if(event.getSource() == proxyCombo)
+              {
+                  if(proxyCombo.getSelectedItem() != null)
+                  {   
+                      String tmp[] = proxyCombo.getSelectedItem().toString().split(":");
+                      if(tmp.length>1)
+                      {
+                          proxyServerText.setText(tmp[0]);
+                          proxyPortText.setText(tmp[1]);
+                      }
+                  }
+              }
+          }
+      }
+      
+      class RadioButtonListener  implements ActionListener
+      {
+          public void actionPerformed(ActionEvent event){
+              if(event.getSource() == useProxyRadio || event.getSource() == noProxyRadio){
+                  toggleProxyComponents();
+              }
+          }
+      }
+      
+      class CheckBoxListener  implements ActionListener
+      {
+          public void actionPerformed(ActionEvent event){
+              if(event.getSource() == checkPerl || event.getSource() == checkPerlSAX || event.getSource() == checkPython){
+                  
+                  perlJavaURL.setEnabled(checkPerl.isSelected());
+                  perlSAXURL.setEnabled(checkPerlSAX.isSelected());
+                  pythonJythonURL.setEnabled(checkPython.isSelected());
+                      
+                  if(!selectedOptionalComponents()){
+                      if(!standardInstall)
+                          nextButtonOptionalComponents.setEnabled(false);
+                      
+                      panelProxy.setVisible(false);
+                  }else{
+                      panelProxy.setVisible(true);
+                      nextButtonOptionalComponents.setEnabled(true);
+                  }
+              }else if(event.getSource() == checkLegal){
+                  
+                  if(checkLegal.isSelected())
+                      nextButtonLegal.setEnabled(true);
+                  else
+                      nextButtonLegal.setEnabled(false);
+                  
+                  if(!standardInstall)
+                  {
+                      if(checkLegal.isSelected()){
+                          legalPanelContainer.remove(targetSelectPanel);
+                          legalPanelContainer.add(targetSelectPanel, BorderLayout.PAGE_END);
+                          BorderLayout BL = (BorderLayout)legalPanelContainer.getLayout();
+                          BL.setHgap(20);
+                          legalPanelContainer.revalidate();
+                      }else{
+                          legalPanelContainer.remove(targetSelectPanel);
+                          legalPanelContainer.revalidate();
+                         
+                      }
+                  }
+                  
+              }
+          }
+      }
+
+      class ButtonListener  implements ActionListener
+      {
+         public void actionPerformed(ActionEvent event)
+         {
+            if (((JButton)event.getSource()).getText().equals("Cancel"))
+            {
+               System.exit(0);
+            }
+            else if (event.getSource() == nextButtonInstallerPath)
+            {  
+                if(enableOpenSource && !nextButtonInstallerPath.getText().equals("Install"))
+                    cardCurrent = cardLegal;
+                else
+                    cardCurrent = cardOptionalComponents; 
+                        
+                checkRequiredComponents.setSelected(true);
+                checkLegal.setSelected(false);
+                nextButtonLegal.setEnabled(false);
+                
+                CardLayout cl = (CardLayout)(content.getLayout());
+                cl.show(content, cardCurrent);
+                
+                if(enableOpenSource)
+                    checkLegal.requestFocusInWindow();
+                else
+                    nextButtonOptionalComponents.requestFocusInWindow();
+                
+                
+                if(nextButtonInstallerPath.getText().equals("Install")){
+                    hideOptionalComponents();
+                    new ButtonListener().actionPerformed(new ActionEvent(nextButtonOptionalComponents,0,"click"));
+                }
+            }
+            else if(event.getSource() == nextButtonOptionalComponents)
+            {
+                if(validateProxy()){
+                    panelComponentsProxyContainer.remove(panelProxy);
+                    panelComponentsProxyContainer.add(panelDownload);
+                    panelComponentsProxyContainer.revalidate();
+                    
+                    downloadTextArea.setText("Installation Log\n----------------------");
+                    downloadTextArea.setCaretPosition(downloadTextArea.getText().length());
+                    
+                    if(standardInstall)
+                    {
+                        // first install then download
+                        downloadLabel.setText("Installing Core TRAFCI Files...");
+                        String jarFileName = getJarFileName();
+                        process(jarFileName);
+                    }
+                    
+                    if(selectedOptionalComponents())
+                        SwingUtilities.invokeLater(new DownloadComponentsWrapper());
+                
+                    SwingUtilities.invokeLater(new installComplete());
+                }
+                
+            }
+            else if (event.getSource() == fileBrowseButton)
+            {
+               if (getJDBCLocation()==JFileChooser.APPROVE_OPTION)
+                  jdbcFileText.setText(jdbcFileLoc);
+               if (jdbcFileLoc != null && targetDirectory != null)
+                  nextButtonInstallerPath.setEnabled(true);
+              
+            }
+            else if (event.getSource() == dirBrowseButton)
+            {
+               if (getTargetInstallLocation()==JFileChooser.APPROVE_OPTION)
+                  targetDirText.setText(targetDirectory);
+               if (jdbcFileLoc != null && targetDirectory != null)
+                  nextButtonInstallerPath.setEnabled(true);
+            }
+            else if (event.getSource() == choiceStandardInstall)
+            {
+                /* reset defaults */
+                Color borderCol=new Color(167,160,143);
+                targetSelectPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol),"                                            "));
+                targetDirText.setText(defaultInstallDir);
+                
+                pathHolder.remove(targetSelectPanel);
+                pathHolder.add(targetSelectPanel, BorderLayout.PAGE_END);
+                pathHolder.revalidate();
+                
+                CardLayout cl = (CardLayout)(content.getLayout());
+                cardCurrent = cardInstallerPath;
+                cl.show(content, cardInstallerPath);
+                standardInstall = true;
+                
+                fileBrowseButton.requestFocusInWindow();
+            }
+            else if (event.getSource() == choiceCoreComponents)
+            {
+                /* reset defaults */
+                Color borderCol=new Color(167,160,143);
+                targetSelectPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol),"                                            "));
+                targetDirText.setText(defaultInstallDir);
+                
+                pathHolder.remove(targetSelectPanel);
+                pathHolder.add(targetSelectPanel, BorderLayout.PAGE_END);
+                pathHolder.revalidate();
+                
+                CardLayout cl = (CardLayout)(content.getLayout());
+                cardCurrent = cardInstallerPath;         
+                cl.show(content, cardInstallerPath);
+                
+                nextButtonInstallerPath.setText("Install");
+                
+                fileBrowseButton.requestFocusInWindow();
+            }
+            else if (event.getSource() == choiceOptionalButton)
+            {
+                Color borderCol=new Color(167,160,143);
+                targetSelectPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol),""));
+                
+                cardCurrent = cardLegal;
+                CardLayout cl = (CardLayout)(content.getLayout());
+                cl.show(content, cardCurrent);
+                standardInstall = false;
+                checkRequiredComponents.setSelected(false);
+                checkLegal.setSelected(false);
+                nextButtonLegal.setEnabled(false);
+                legalPanelContainer.remove(targetSelectPanel);
+                legalPanelContainer.revalidate();
+                
+                checkLegal.requestFocusInWindow();
+                
+            }
+            else if (((JButton)event.getSource()).getText().equals("Back"))
+            {
+                if(cardCurrent.equals(cardInstallerPath)){
+                    nextButtonInstallerPath.setText("Next");
+                    cardCurrent = cardInstallerChoices;
+                }else if(cardCurrent.equals(cardOptionalComponents)){
+                    if(enableOpenSource)
+                        cardCurrent = cardLegal;
+                    else
+                        cardCurrent = cardInstallerPath;
+                }
+                else if(cardCurrent.equals(cardLegal)){
+                    if(standardInstall)
+                        cardCurrent = cardInstallerPath;
+                    else
+                        cardCurrent = cardInstallerChoices;
+                }else if(cardCurrent.equals(cardInstallationComplete)){
+                    cardCurrent = cardOptionalComponents;
+                   
+                    panelComponentsProxyContainer.removeAll();
+                    setupDownloadPanel(false);
+                    panelComponentsProxyContainer.add(panelComponents);
+                    panelComponentsProxyContainer.add(panelProxy);
+                    panelComponentsProxyContainer.revalidate();
+                }
+
+                CardLayout cl = (CardLayout)(content.getLayout());
+                cl.show(content, cardCurrent);
+                
+            }
+            else if(event.getSource() == autoDetectProxy){
+                setCursor(new Cursor(Cursor.WAIT_CURSOR));
+                autoDetectProxy.setEnabled(false);
+                Downloader dl = new Downloader();
+                populateProxyComboBox(dl.findProxy());
+                autoDetectProxy.setEnabled(true);
+                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+            
+            }
+            else if(event.getSource() == nextButtonLegal){
+                
+                if(!standardInstall && !validateNCIPath(targetDirText.getText()))
+                    JOptionPane.showMessageDialog(null, ERROR_INVALID_NCI_DIR, "Error", JOptionPane.ERROR_MESSAGE);
+                else{
+                    // if user went to optional components only screen
+                    // unchecked everything, then came back to here,
+                    // lets re-enable everything
+                    if(!nextButtonOptionalComponents.isEnabled())
+                        resetOptionalComponentsScreen();
+                    
+                    cardCurrent = cardOptionalComponents;
+                    CardLayout cl = (CardLayout)(content.getLayout());
+                    cl.show(content, cardCurrent);
+                    
+                    nextButtonOptionalComponents.requestFocusInWindow();
+                }
+            }
+            else if(event.getSource() == finishedButton){
+                System.exit(0);
+            }
+            else if(event.getSource() == dirBrowseButtonOSS){
+                if (getTargetInstallLocation()==JFileChooser.APPROVE_OPTION)
+                    ossTargetDirText.setText(targetDirectory);
+            }
+            else if(event.getSource() == perlJavaURL){
+                Object result = JOptionPane.showInputDialog(content, "URL of the Folder to Download Perl JavaServer (Java.pm, JavaArray.pm, amd JavaServer.jar):","Type a URL", JOptionPane.QUESTION_MESSAGE, null, null, defaultPerlJavaURL);
+                if(result != null && !result.toString().trim().equals("")){
+                    defaultPerlJavaURL = result.toString();
+                    /* we are looking for a folder here */
+                    if(!defaultPerlJavaURL.endsWith("/"))
+                        defaultPerlJavaURL += "/";
+                } 
+            }
+            else if(event.getSource() == perlSAXURL){
+                Object result = JOptionPane.showInputDialog(content, "URL to Download Perl SAX XML Module:                                                                                ","Type a URL", JOptionPane.QUESTION_MESSAGE, null, null, defaultPerlSAXURL);
+                if(result != null && !result.toString().trim().equals(""))
+                    defaultPerlSAXURL = result.toString();
+            }
+            else if(event.getSource() == pythonJythonURL){
+                Object result = JOptionPane.showInputDialog(content, "URL to Jython:                                                                                                                    ","Type a URL", JOptionPane.QUESTION_MESSAGE, null, null, defaultPythonJythonURL);
+                if(result != null && !result.toString().trim().equals(""))
+                    defaultPythonJythonURL = result.toString();
+            }
+            
+         }// action performed
+      }
+      
+      
+      class ProxyBox extends JComboBox
+      {
+		private static final long serialVersionUID = -1623914485707120601L;
+
+		public ProxyBox(){
+              
+          }
+          
+          public Dimension getPreferredSize(){
+              return getMaximumSize();
+          }
+          
+          public Dimension getMaximumSize(){
+              return new Dimension(260,25);
+          } 
+          
+          public Dimension getMinimumSize(){
+              return getMaximumSize();
+          }
+          
+          public Dimension getSize(){
+              return getMaximumSize();
+          }
+          
+          public Dimension getSize(Dimension arg0){
+              return getMaximumSize();
+          }
+      }
+      
+      void populateProxyComboBox(ArrayList<String> list){
+          if(list != null && proxyCombo != null)
+          {
+              proxyCombo.removeAllItems();
+              String[] tmp;
+              for(int i=0;i<list.size();i++)
+              {
+                  proxyCombo.addItem(list.get(i));
+                  if(i==0)
+                  {
+                      tmp = list.get(0).split(":");
+                      if(tmp.length>1)
+                      {
+                          proxyServerText.setText(tmp[0]);
+                          proxyPortText.setText(tmp[1]);
+                      }
+                  }
+              }
+              
+              if(list.size() > 0)
+                  proxyCombo.setVisible(true);
+              else
+                  proxyCombo.setVisible(false);
+              
+          }
+      }
+
+      void resetOptionalComponentsScreen(){
+          nextButtonOptionalComponents.setEnabled(true);
+          
+          checkPerl.setSelected(true);
+          checkPerlSAX.setSelected(true);
+          checkPython.setSelected(true);
+
+          panelComponentsProxyContainer.remove(panelDownload); 
+          panelComponentsProxyContainer.add(panelProxy);
+          panelComponentsProxyContainer.revalidate();
+          panelProxy.setVisible(true);
+          
+          noProxyRadio.setSelected(true);
+          toggleProxyComponents();
+
+      }
+      
+      void hideOptionalComponents(){
+          checkPerl.setSelected(false);
+          checkPerl.setVisible(false);
+          checkPerlSAX.setSelected(false);
+          checkPerlSAX.setVisible(false);
+          checkPython.setSelected(false);
+          checkPython.setVisible(false);
+          
+          perlJavaURL.setVisible(false);
+          perlSAXURL.setVisible(false);
+          pythonJythonURL.setVisible(false);
+      }
+      
+      void initialize(String productTitle)
+      {
+          int winWidth = 550;
+          int winHeight = 525;//475;
+    
+          content.setBackground(Color.white);
+          content.setLayout(new CardLayout());
+          content.setBackground(new Color(255,255,255));
+          
+          // Set up first window
+          setTitle(productTitle+" Installer Wizard");
+          
+          setupInstallerChoices();
+          setupLegalDisclaimer();
+          setupInstallPathPage();
+          setupOptionalComponents();
+          setupInstallationComplete();
+          
+          CardLayout cl = (CardLayout)(content.getLayout());
+          cl.show(content, cardInstallerChoices);
+          cardCurrent = cardInstallerChoices;
+          
+          //Display the window
+          pack();
+          addWindowListener(new ExitListener());
+          
+          setSize(winWidth,winHeight);
+          Dimension screen = getToolkit().getScreenSize();
+          setBounds( (screen.width-getWidth())/2, (screen.height-getHeight())/2, getWidth(), getHeight() );
+
+          setResizable(false);
+          setVisible(true);
+      }
+      
+      KeyAdapter escapeHandler = new KeyAdapter()
+      {
+         public void keyPressed(KeyEvent ke)
+         {
+            if (ke.getKeyCode() == KeyEvent.VK_ESCAPE)
+            {
+               System.exit(0);
+            }
+         }
+      };
+      
+      KeyAdapter installPathKeyHandler = new KeyAdapter()
+      {
+         public void keyPressed(KeyEvent ke)
+         {
+             if(ke.getKeyCode() == KeyEvent.VK_ENTER)
+             {
+                 if(fileBrowseButton.isFocusOwner() && jdbcFileText.getText().trim().equals(""))
+                     new ButtonListener().actionPerformed(new ActionEvent(fileBrowseButton,0,"click"));
+                 else if(dirBrowseButton.isFocusOwner())
+                     new ButtonListener().actionPerformed(new ActionEvent(dirBrowseButton,0,"click"));
+                 else if(nextButtonInstallerPath.isEnabled())
+                     new ButtonListener().actionPerformed(new ActionEvent(nextButtonInstallerPath,0,"click"));
+             }
+         }
+      };
+      
+      KeyAdapter legalKeyHandler = new KeyAdapter()
+      {
+          public void keyPressed(KeyEvent ke)
+          {
+              switch(ke.getKeyCode()){
+                  case KeyEvent.VK_ESCAPE:     System.exit(0);
+                      break;
+                  case KeyEvent.VK_ENTER:
+                          if(checkLegal.isSelected())
+                              new ButtonListener().actionPerformed(new ActionEvent(nextButtonLegal,0,"click"));
+                          else{
+                              checkLegal.setSelected(!checkLegal.isSelected());
+                              new CheckBoxListener().actionPerformed(new ActionEvent(checkLegal,0,"click"));
+                          }
+                      break;
+              }
+          }
+      };
+
+      class ExitListener extends WindowAdapter
+      {
+         public void windowClosing(WindowEvent we)
+         {
+            System.exit(0);
+         }
+      }
+      
+       void setupInstallerChoices(){
+          
+          Color bgCol=new Color(255,255,255);
+          Color borderCol=new Color(167,160,143);
+          
+          Font labelFont=new Font("SansSerif",Font.PLAIN,13);
+          Font headLabelFont=new Font(null,Font.BOLD,15);
+        
+          JPanel headPanel = new JPanel(new GridBagLayout());
+ 
+          GridBagConstraints c = new GridBagConstraints();
+        
+          
+          JLabel headLabel=new JLabel("Welcome to the "+productTitle+" Installer Wizard");
+          c.fill = GridBagConstraints.PAGE_START;
+          c.gridwidth=10;
+          c.gridheight=1;
+          c.weightx = 0;
+          c.gridx = 0;
+          c.gridy = 0;
+          //c.insets = new Insets(0,30,5,0);
+          c.insets = new Insets(10,0,10,0);
+          headPanel.add(headLabel,c);
+          
+          c.fill = GridBagConstraints.HORIZONTAL;
+          
+          JLabel headLabel1=new JLabel("This wizard helps you install and configure "+productTitle +".");
+          c.gridwidth=10;
+          c.weightx = 0.0;
+          c.gridx = 0;
+          c.gridy = 1;
+          c.insets = new Insets(0,0,20,0);
+          headPanel.add(headLabel1,c);
+          
+          
+          JSeparator hRule=new JSeparator();
+          c.gridwidth=10;
+          c.weightx = 0.0;
+          c.gridx = 0;
+          c.gridy = 2;
+          c.insets = new Insets(0,0,5,0);
+          hRule.setForeground(borderCol);
+          headPanel.add(hRule,c);
+          
+          JLabel noteLabel=new JLabel("Note:");
+          c.weightx = 0.0;
+          c.gridx = 1;
+          c.gridy = 3;
+          c.gridwidth=1;
+          c.ipadx= 10;
+          c.insets = new Insets(0,50,0,20);
+          noteLabel.setFont(new Font(null,Font.BOLD,13));
+          headPanel.add(noteLabel,c);
+          
+          JLabel headLabel2=new JLabel("The wizard requires the " + NEW_JDBC);
+          c.weightx = 0.0;
+          c.gridx = 3;
+          c.gridy = 3;
+          c.ipadx =0;
+          c.gridwidth=11;
+          c.insets = new Insets(0,0,0,0);
+          headPanel.add(headLabel2,c);
+          
+          JLabel headLabel3=new JLabel("to be installed on your workstation."
+             );
+          c.weightx = 0.0;
+          c.gridx = 3;
+          c.gridy = 4;
+          c.ipadx=0;
+          c.gridwidth=4;
+          c.insets = new Insets(0,0,0,0);
+          headPanel.add(headLabel3,c);
+          
+          JSeparator hEndRule=new JSeparator();
+          c.weightx = 0.0;
+          c.gridx = 0;
+          c.gridy = 5;
+          c.gridwidth=10;
+          c.insets = new Insets(10,0,5,0);
+          headPanel.add(hEndRule,c);
+          hEndRule.setForeground(borderCol);
+          
+          
+          Color headTxtColor=new Color(000,000,000);
+          headLabel.setForeground(new Color(000,000,128));
+       
+          headLabel1.setForeground(headTxtColor);
+          headLabel2.setForeground(headTxtColor);
+          headLabel3.setForeground(headTxtColor);
+          headLabel.setFont(headLabelFont);
+          headLabel1.setFont(labelFont);
+          headLabel2.setFont(labelFont);
+          headLabel3.setFont(labelFont);
+
+          headPanel.setBackground(bgCol);
+          
+          /* button code goes here */
+          choiceStandardInstall = new JButton("Standard Installation");
+          c.fill = GridBagConstraints.HORIZONTAL;
+          c.weightx = 0.0;
+          c.gridx = 5;
+          c.gridy = 10;
+          c.gridheight = 2;
+          c.gridwidth = 2;
+          c.ipady = 15;
+          c.insets = new Insets(40,0,0,0);
+
+          headPanel.add(choiceStandardInstall, c);
+          
+          choiceCoreComponents = new JButton("Core Components");
+          c.fill = GridBagConstraints.HORIZONTAL;
+          c.weightx = 0.0;
+          c.gridx = 5;
+          c.gridy = 15;
+          c.gridheight = 2;
+          c.gridwidth = 2;
+          c.ipady = 15;
+          c.insets = new Insets(10,0,0,0);
+
+          headPanel.add(choiceCoreComponents, c);
+          
+          choiceOptionalButton = new JButton("Optional Components");
+          c.weightx = 0.0;
+          c.gridx = 5;
+          c.gridy = 20;
+          c.gridheight = 2;
+          c.gridwidth = 2;
+          c.ipady = 15;
+          c.insets = new Insets(10,0,30,0);
+          
+    
+          if(enableOpenSource)
+              headPanel.add(choiceOptionalButton, c);
+          
+          c.ipady = 0;
+
+          choiceStandardInstall.addKeyListener(
+                  new KeyAdapter()
+                  {
+                     public void keyPressed(KeyEvent ke)
+                     {
+                        if (ke.getKeyCode() == KeyEvent.VK_ESCAPE)
+                           System.exit(0);
+                        else if(ke.getKeyCode() == KeyEvent.VK_ENTER)
+                           new ButtonListener().actionPerformed(new ActionEvent(choiceStandardInstall,0,"click"));
+                     }
+                  }
+          );
+          choiceStandardInstall.addActionListener(new ButtonListener());
+          choiceCoreComponents.addActionListener(new ButtonListener());
+          choiceCoreComponents.addKeyListener(escapeHandler);
+          choiceOptionalButton.addKeyListener(escapeHandler);
+          choiceOptionalButton.addActionListener(new ButtonListener());
+          
+          getContentPane().add(headPanel, cardInstallerChoices);
+      }
+      
+       void setupInstallPathPage(){
+          
+          JPanel pathContainer = new JPanel(new BorderLayout());
+          Color bgCol=new Color(255,255,255);
+          Color borderCol=new Color(167,160,143);
+          pathContainer.setBackground(bgCol);
+          
+          
+          file_txt =new JTextField("",20);
+          fileBrowseButton=new JButton("Browse");
+          dirBrowseButton=new JButton("Browse");
+         
+          nextButtonInstallerPath=new JButton("Next");
+          JButton cancelButton=new JButton("Cancel");
+          JButton backButton=new JButton("Back");
+          statusLabel=new JLabel("Not Started");
+          
+          filechooser=new JFileChooser();
+          jdbcFileText =new JTextField("                       ",10);
+          targetDirText =new JTextField("                       ",10);
+          Font titleFont=new Font(null,Font.BOLD,13);
+          Color textCol=new Color(230,230,230);
+
+          Font labelFont=new Font("SansSerif",Font.PLAIN,13);
+          Font headLabelFont=new Font(null,Font.BOLD,15);
+        
+          JPanel headPanel = new JPanel(new GridBagLayout());
+          
+          GridBagConstraints c = new GridBagConstraints();
+        
+          
+          JLabel headLabel=new JLabel("Welcome to the "+productTitle+" Installer Wizard");
+          c.fill = GridBagConstraints.PAGE_START;
+          c.gridwidth=10;
+          c.gridheight=1;
+          c.weightx = 0;
+          c.gridx = 0;
+          c.gridy = 0;
+          //c.insets = new Insets(0,30,5,0);
+          c.insets = new Insets(10,0,10,0);
+          headPanel.add(headLabel,c);
+          
+          c.fill = GridBagConstraints.HORIZONTAL;
+          
+          JLabel headLabel1=new JLabel("This wizard helps you install and configure "+productTitle +".");
+          c.gridwidth=10;
+          c.weightx = 0.0;
+          c.gridx = 0;
+          c.gridy = 1;
+          c.insets = new Insets(0,0,20,0);
+          headPanel.add(headLabel1,c);
+          
+          
+          JSeparator hRule=new JSeparator();
+          c.gridwidth=10;
+          c.weightx = 0.0;
+          c.gridx = 0;
+          c.gridy = 2;
+          c.insets = new Insets(0,0,5,0);
+          hRule.setForeground(borderCol);
+          headPanel.add(hRule,c);
+          
+          JLabel noteLabel=new JLabel("Note:");
+          c.weightx = 0.0;
+          c.gridx = 1;
+          c.gridy = 3;
+          c.gridwidth=1;
+          c.ipadx= 10;
+          c.insets = new Insets(0,50,0,20);
+          noteLabel.setFont(new Font(null,Font.BOLD,13));
+          headPanel.add(noteLabel,c);
+          
+          JLabel headLabel2=new JLabel("The wizard requires the " + NEW_JDBC + " ");
+          c.weightx = 0.0;
+          c.gridx = 3;
+          c.gridy = 3;
+          c.ipadx =0;
+          c.gridwidth=11;
+          c.insets = new Insets(0,0,0,0);
+          headPanel.add(headLabel2,c);
+          
+          JLabel headLabel3=new JLabel("to be installed on your workstation."
+             );
+          c.weightx = 0.0;
+          c.gridx = 3;
+          c.gridy = 4;
+          c.ipadx=0;
+          c.gridwidth=4;
+          c.insets = new Insets(0,0,0,0);
+          headPanel.add(headLabel3,c);
+          
+          JSeparator hEndRule=new JSeparator();
+          c.weightx = 0.0;
+          c.gridx = 0;
+          c.gridy = 5;
+          c.gridwidth=10;
+          c.insets = new Insets(10,0,5,0);
+          headPanel.add(hEndRule,c);
+          hEndRule.setForeground(borderCol);
+    
+          Color headTxtColor=new Color(000,000,000);
+          headLabel.setForeground(new Color(000,000,128));
+       
+          headLabel1.setForeground(headTxtColor);
+          headLabel2.setForeground(headTxtColor);
+          headLabel3.setForeground(headTxtColor);
+          headLabel.setFont(headLabelFont);
+          headLabel1.setFont(labelFont);
+          headLabel2.setFont(labelFont);
+          headLabel3.setFont(labelFont);
+
+          headPanel.setBackground(bgCol);
+          
+          pathContainer.add(headPanel, BorderLayout.PAGE_START);
+          /****************/
+          JPanel pathInternalContainer = new JPanel(new GridBagLayout());
+          /****************/
+          
+          /************************************************************/
+          GridLayout gl = new GridLayout(2,1);
+          gl.setVgap(-10);
+          
+          pathHolder = new JPanel(gl);
+          pathHolder.setBackground(bgCol);
+          
+          /************************************************************/
+          
+          JPanel jdbcFilePanel = new JPanel(new GridBagLayout());
+
+          c.weightx = 0.0;
+          c.gridx = 0;
+          c.gridy = 0;
+          c.ipadx = 0;
+          c.ipady = 0;
+          c.gridwidth = 3;
+          c.insets = new Insets(10,20,0,0);
+          
+          JLabel jdbcFileLabel=new JLabel(NEW_JDBC + ":");
+          jdbcFileLabel.setFont(titleFont);
+          fileBrowseButton.addActionListener(new ButtonListener());
+          fileBrowseButton.addKeyListener(escapeHandler);
+          fileBrowseButton.addKeyListener(installPathKeyHandler);
+         
+          jdbcFilePanel.setBackground(Color.white);
+          jdbcFilePanel.add(jdbcFileLabel,c);
+          c.weightx = 0.5;
+          c.gridx = 1;
+          c.gridy = 1;
+          c.gridwidth = 1;
+          c.insets = new Insets(0,20,10,0);
+          c.ipadx=375;
+          jdbcFilePanel.add(jdbcFileText,c);
+          
+          jdbcFileText.setCaretPosition(jdbcFileText.getColumns());
+          jdbcFileText.addKeyListener(new KeyAdapter()
+          {
+             public void keyPressed(KeyEvent ke)
+             {
+                if (ke.getKeyCode() == KeyEvent.VK_ESCAPE)
+                   System.exit(0);
+
+                if (ke.getKeyCode() == KeyEvent.VK_RIGHT)
+                {
+                   int currentPos = jdbcFileText.getCaretPosition();
+                   if (currentPos < jdbcFileText.getDocument().getLength()) jdbcFileText.setCaretPosition(currentPos+1);
+                }
+             }
+          });
+
+          jdbcFileText.setBackground(textCol);
+          jdbcFileText.setEditable(false);
+          c.weightx = 0.5;
+          c.gridx = 2;
+          c.gridy = 1;
+          c.gridwidth = 1;
+          c.insets = new Insets(0,10,10,40);
+          c.ipadx=75;
+          jdbcFilePanel.add(fileBrowseButton,c);
+          jdbcFilePanel.setSize(500,80);
+          jdbcFilePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol)," Select these locations, and then click Next."));
+          
+          pathHolder.add(jdbcFilePanel);
+          /************************************************************/
+         
+          targetSelectPanel = new JPanel(new GridBagLayout());
+          c.weightx = 0.0;
+          c.gridx = 0;
+          c.gridy = 0;
+          c.gridwidth = 3;
+          c.insets = new Insets(10,20,0,0);
+          JLabel targetDirLabel=new JLabel(productTitle+" installation directory:");
+          targetDirLabel.setFont(titleFont);
+          jdbcFilePanel.setLocation(25,175);
+          jdbcFilePanel.setBackground(bgCol);
+          targetSelectPanel.setBackground(Color.white);
+          targetSelectPanel.add(targetDirLabel,c);
+          c.weightx = 0.5;
+          c.gridx = 1;
+          c.gridy = 1;
+          c.gridwidth = 1;
+          c.insets = new Insets(0,20,10,0);
+          c.ipadx=375;
+
+          targetSelectPanel.add(targetDirText,c);
+          targetDirectory = defaultInstallDir;
+          targetDirText.setText(defaultInstallDir);
+          targetDirText.setCaretPosition(targetDirText.getColumns());
+          targetDirText.addKeyListener(new KeyAdapter()
+          {
+             public void keyPressed(KeyEvent ke)
+             {
+                if (ke.getKeyCode() == KeyEvent.VK_ESCAPE)
+                   System.exit(0);
+                if (ke.getKeyCode() == KeyEvent.VK_RIGHT)
+                {
+                   int currentPos = targetDirText.getCaretPosition();
+                   if (currentPos < targetDirText.getDocument().getLength()) targetDirText.setCaretPosition(currentPos+1);
+                }
+             }
+          });
+
+          targetDirText.setBackground(textCol);
+          targetDirText.setEditable(false);
+          c.weightx = 0.5;
+          c.gridx = 2;
+          c.gridy = 1;
+          c.gridwidth = 1;
+          c.insets = new Insets(0,10,10,40);
+          c.ipadx=75;
+          targetSelectPanel.add(dirBrowseButton,c);
+          dirBrowseButton.addActionListener(new ButtonListener());
+          dirBrowseButton.addKeyListener(escapeHandler);
+          dirBrowseButton.addKeyListener(installPathKeyHandler);
+          targetSelectPanel.setSize(500,100);
+
+          targetSelectPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol),"                                            "));
+          
+          targetSelectPanel.setBackground(bgCol);
+
+          pathHolder.add(targetSelectPanel);
+          targetSelectPanel.setLocation(25,265);
+
+          /************************************************************/
+          //pathContainer.add(pathHolder, BorderLayout.CENTER);
+
+          c.gridwidth = 450;
+          c.gridheight = 100;
+          c.insets = new Insets(0,25,0,25);
+          c.ipady = 28;
+          pathInternalContainer.setBackground(bgCol);
+          pathInternalContainer.add(pathHolder,c);
+          pathContainer.add(pathInternalContainer, BorderLayout.CENTER);
+          /************************************************************/
+          
+          JPanel controlPanel = new JPanel();
+          controlPanel.add(backButton);
+          backButton.addActionListener(new ButtonListener());
+          backButton.addKeyListener(escapeHandler);
+          controlPanel.add(cancelButton);
+          cancelButton.addActionListener(new ButtonListener());
+          cancelButton.addKeyListener(escapeHandler);
+          controlPanel.add(nextButtonInstallerPath);
+          nextButtonInstallerPath.addActionListener(new ButtonListener());
+          nextButtonInstallerPath.addKeyListener(installPathKeyHandler);
+          nextButtonInstallerPath.addKeyListener(escapeHandler);
+          nextButtonInstallerPath.setEnabled(false);
+          
+          controlPanel.setSize(500,50);
+          controlPanel.setLocation(25,385);
+          controlPanel.setBackground(bgCol);
+          
+          pathContainer.add(controlPanel, BorderLayout.SOUTH);
+          /************************************************************/
+          
+          getContentPane().add(pathContainer, cardInstallerPath);
+
+       }
+     
+       void setupOptionalComponents(){
+
+           optComponentContainer = new JPanel(new BorderLayout());
+           
+           Color bgCol=new Color(255,255,255);
+           Color borderCol=new Color(167,160,143);
+           
+           Font labelFont=new Font("SansSerif",Font.PLAIN,13);
+           Font headLabelFont=new Font(null,Font.BOLD,15);
+         
+           /****************** Header Panel ***********************************/
+           JPanel headPanel = new JPanel(new GridBagLayout());
+  
+           GridBagConstraints c = new GridBagConstraints();
+         
+           
+           JLabel headLabel=new JLabel("Welcome to the "+productTitle+" Installer Wizard");
+           c.fill = GridBagConstraints.PAGE_START;
+           c.gridwidth=10;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 0;
+           c.gridy = 0;
+           
+           c.insets = new Insets(10,0,10,0);
+           headPanel.add(headLabel,c);
+           
+           c.fill = GridBagConstraints.HORIZONTAL;
+           
+           JLabel headLabel1=new JLabel("This wizard helps you install and configure "+productTitle +".");
+           c.gridwidth=10;
+           c.weightx = 0.0;
+           c.gridx = 0;
+           c.gridy = 1;
+           c.insets = new Insets(0,0,20,0);
+           headPanel.add(headLabel1,c);
+           
+           
+           JSeparator hRule=new JSeparator();
+           c.gridwidth=10;
+           c.weightx = 0.0;
+           c.gridx = 0;
+           c.gridy = 2;
+           c.insets = new Insets(0,0,5,0);
+           hRule.setForeground(borderCol);
+           headPanel.add(hRule,c);
+   
+ 
+           Color headTxtColor=new Color(000,000,000);
+           headLabel.setForeground(new Color(000,000,128));
+        
+           headLabel1.setForeground(headTxtColor);
+
+           headLabel.setFont(headLabelFont);
+           headLabel1.setFont(labelFont);
+
+           headPanel.setBackground(bgCol);
+           
+           optComponentContainer.add(headPanel, BorderLayout.PAGE_START); 
+           /***** New Panel w/ Options *********************************/
+           
+           GridLayout gl = new GridLayout(2,1);
+           panelComponentsProxyContainer = new JPanel(gl);
+           gl.setVgap(10);
+
+           panelComponents = new JPanel(new GridBagLayout());
+      
+           c = new GridBagConstraints();    // reset c
+           c.fill = GridBagConstraints.HORIZONTAL;
+           c.anchor = GridBagConstraints.NORTH;
+  
+           JLabel componentsLabel=new JLabel("Please check the components you wish to download and install:");
+           c.gridwidth=13;
+           c.weightx = 0.0;
+           c.gridx = 0;
+           c.gridy = 0;
+           c.insets = new Insets(0,0,5,0);
+           panelComponents.add(componentsLabel,c);
+           
+           checkRequiredComponents = new JCheckBox("Core " + productTitle + " Components");
+           c.gridwidth=10;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 1;
+           c.gridy = 1;
+           
+           c.insets = new Insets(5,0,5,0);
+           panelComponents.add(checkRequiredComponents,c);
+ 
+       
+           
+           checkPerl = new JCheckBox("Perl JavaServer extension");
+           c.gridwidth=5;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 1;
+           c.gridy = 2;
+           
+           c.insets = new Insets(5,0,5,0);
+           
+           if(enableOpenSource)
+               panelComponents.add(checkPerl,c);
+           
+           
+           perlJavaURL = new JButton("Edit URL");
+           c.gridwidth = 1;
+           c.gridheight = 1;
+           c.gridx = 0;
+           c.gridy = 2;
+           c.insets = new Insets(8,0,0,5);
+           c.ipady = -5;
+           if(enableOpenSource)
+               panelComponents.add(perlJavaURL,c);
+                      
+           
+           checkPerlSAX = new JCheckBox("Perl XML SAX Module");
+           c.gridwidth=5;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 1;
+           c.gridy = 3;
+           c.ipady =0;
+           //c.insets = new Insets(0,30,5,0);
+           c.insets = new Insets(5,0,5,0);
+           
+           if(enableOpenSource)
+               panelComponents.add(checkPerlSAX,c);
+           
+           perlSAXURL = new JButton("Edit URL");
+           c.gridwidth = 1;
+           c.gridheight = 1;
+           c.gridx = 0;
+           c.gridy = 3;
+           c.ipady = -5;
+           c.insets = new Insets(8,0,0,5);
+           
+           if(enableOpenSource)
+               panelComponents.add(perlSAXURL,c);
+           
+           
+           checkPython = new JCheckBox("Jython, a Java implementation of Python");
+           c.gridwidth=8;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 1;
+           c.gridy = 4;
+           c.ipady =0;
+           c.insets = new Insets(5,0,5,0);
+               
+           if(enableOpenSource)
+               panelComponents.add(checkPython,c);
+
+
+           pythonJythonURL = new JButton("Edit URL");
+           c.gridwidth = 1;
+           c.gridheight = 1;
+           c.gridx = 0;
+           c.gridy = 4;
+           c.ipady = -5;
+           c.insets = new Insets(8,0,0,5);
+           
+           if(enableOpenSource)
+               panelComponents.add(pythonJythonURL,c);
+           
+           checkRequiredComponents.setSelected(true);
+           
+           if(enableOpenSource){
+               checkPerl.setSelected(true);
+               checkPerlSAX.setSelected(true);
+               checkPython.setSelected(true);
+           }
+           
+           checkPerl.addActionListener(new CheckBoxListener());
+           checkPerl.addKeyListener(escapeHandler);
+           checkPerlSAX.addActionListener(new CheckBoxListener());
+           checkPerlSAX.addKeyListener(escapeHandler);
+           checkPython.addActionListener(new CheckBoxListener());
+           checkPython.addKeyListener(escapeHandler);
+           perlJavaURL.addActionListener(new ButtonListener());
+           perlJavaURL.addKeyListener(escapeHandler);
+           perlSAXURL.addActionListener(new ButtonListener());
+           perlSAXURL.addKeyListener(escapeHandler);
+           pythonJythonURL.addActionListener(new ButtonListener());
+           pythonJythonURL.addKeyListener(escapeHandler);
+           
+           checkRequiredComponents.setEnabled(false);
+           checkRequiredComponents.setBackground(bgCol);
+           checkPerl.setBackground(bgCol);
+           checkPerlSAX.setBackground(bgCol);
+           checkPython.setBackground(bgCol);
+           
+           panelComponents.setBackground(bgCol);
+           panelComponents.setFont(labelFont);
+           componentsLabel.setFont(headLabelFont);
+        
+           
+           /************** proxy panel ***********/
+           panelProxy = new JPanel(new GridBagLayout());
+           
+           c = new GridBagConstraints();    // reset c
+           c.fill = GridBagConstraints.HORIZONTAL;
+           c.anchor = GridBagConstraints.NORTH;
+
+           noProxyRadio = new JRadioButton("Do not use a proxy server.");
+           c.gridwidth=5;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 0;
+           c.gridy = 0;
+           
+           if(enableOpenSource)
+               panelProxy.add(noProxyRadio,c);
+           
+           useProxyRadio = new JRadioButton("Use the following proxy settings:");
+           c.gridwidth=7;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 0;
+           c.gridy = 2;
+           
+           if(enableOpenSource)
+               panelProxy.add(useProxyRadio,c);
+           
+           JLabel blankLabel = new JLabel("              ");
+           c.gridwidth=4;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 0;
+           c.gridy = 3;
+           panelProxy.add(blankLabel,c);
+           
+           proxyServerLabel=new JLabel("Proxy Server: ");
+           c.gridwidth=4;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 0;
+           c.gridy = 4;
+           
+           if(enableOpenSource)
+               panelProxy.add(proxyServerLabel,c);
+                   
+           proxyServerText = new JTextField("",10);
+           c.gridwidth=10;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 5;
+           c.gridy = 4;
+           
+           if(enableOpenSource)
+               panelProxy.add(proxyServerText,c);
+           
+           proxyPortLabel=new JLabel("Proxy Port: ");
+           c.gridwidth=4;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 0;
+           c.gridy = 5;
+           
+           if(enableOpenSource)
+               panelProxy.add(proxyPortLabel,c);
+           
+           proxyPortText = new JTextField("",4);
+           c.gridwidth=5;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 5;
+           c.gridy = 5;
+           
+           if(enableOpenSource)
+               panelProxy.add(proxyPortText,c);
+           
+           autoDetectProxy = new JButton("Detect Proxy Server(s)");
+           c.gridwidth=5;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 0;
+           c.gridy = 6;
+           c.insets = new Insets(0,0,8,0);
+           
+           if(enableOpenSource)
+               panelProxy.add(autoDetectProxy,c);
+             
+           proxyCombo = new ProxyBox();
+           c.gridwidth=4;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 7;
+           c.gridy = 6;
+           c.insets = new Insets(0,0,8,0);
+                      
+           if(enableOpenSource)
+               panelProxy.add(proxyCombo,c);
+           
+           proxyButtonGroup = new ButtonGroup();
+           proxyButtonGroup.add(noProxyRadio);
+           proxyButtonGroup.add(useProxyRadio);
+           noProxyRadio.setSelected(true);
+           
+           toggleProxyComponents();
+           
+           proxyCombo.setBackground(bgCol);
+           noProxyRadio.setBackground(bgCol);
+           useProxyRadio.setBackground(bgCol);
+           
+           autoDetectProxy.addActionListener(new ButtonListener());
+           autoDetectProxy.addKeyListener(escapeHandler);
+           proxyCombo.addActionListener(new ComboBoxListener());
+           proxyCombo.addKeyListener(escapeHandler);
+           noProxyRadio.addActionListener(new RadioButtonListener());
+           noProxyRadio.addKeyListener(escapeHandler);
+           useProxyRadio.addActionListener(new RadioButtonListener());
+           useProxyRadio.addKeyListener(escapeHandler);
+           
+           panelProxy.setSize(500,100);
+           
+           if(enableOpenSource)
+               panelProxy.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol),"Proxy Settings"));
+       
+           panelProxy.setBackground(bgCol);
+           /**************************************/
+           
+           /**************************************/
+           setupDownloadPanel(false);
+           /**************************************/
+           
+           panelComponentsProxyContainer.add(panelComponents);
+           
+           panelComponentsProxyContainer.add(panelProxy);
+           Border margin = new EmptyBorder(0, 10, 0, 10);
+           panelComponentsProxyContainer.setBorder(margin);
+           
+           panelComponentsProxyContainer.setBackground(bgCol);
+           optComponentContainer.add(panelComponentsProxyContainer, BorderLayout.CENTER);
+           /***********************************************************/
+           
+           JPanel panelButtons = new JPanel(new GridBagLayout());
+           c = new GridBagConstraints();    // reset c
+           c.fill = GridBagConstraints.HORIZONTAL;
+           c.anchor = GridBagConstraints.NORTH;
+ 
+           c.gridx = 0;
+           c.gridy = 0;
+           JLabel blankLabelBottom = new JLabel(" ");
+           panelButtons.add(blankLabelBottom, c);
+ 
+           c.gridy = 1;
+           JButton backButton = new JButton("Back");
+           JButton cancelButton = new JButton("Cancel");
+           nextButtonOptionalComponents = new JButton("Install");
+           
+           c.insets = new Insets(0,0,5,5);
+           panelButtons.add(backButton, c);
+           c.gridx = 1;
+           panelButtons.add(cancelButton, c);
+           c.gridx = 2;
+           panelButtons.add(nextButtonOptionalComponents, c);
+           
+           backButton.addActionListener(new ButtonListener());
+           backButton.addKeyListener(escapeHandler);
+           cancelButton.addActionListener(new ButtonListener());
+           cancelButton.addKeyListener(escapeHandler);
+           nextButtonOptionalComponents.addActionListener(new ButtonListener());
+           nextButtonOptionalComponents.addKeyListener(
+                   new KeyAdapter(){
+                       public void keyPressed(KeyEvent ke)
+                       {
+                           switch(ke.getKeyCode()){
+                               case KeyEvent.VK_ESCAPE:     System.exit(0);
+                                   break;
+                               case KeyEvent.VK_ENTER:      new ButtonListener().actionPerformed(new ActionEvent(nextButtonOptionalComponents,0,"click"));
+                                   break;
+                           }
+                       }
+                   }
+           );
+           
+           panelButtons.setBackground(bgCol);
+                     
+           optComponentContainer.add(panelButtons, BorderLayout.PAGE_END);
+           /***********************************************************/
+           
+           getContentPane().add(optComponentContainer, cardOptionalComponents);
+           
+           /***********************************************************/
+       }
+       
+       void setupDownloadPanel(boolean installComplete){
+           GridBagConstraints c = new GridBagConstraints();
+           Color bgCol=new Color(255,255,255);
+           
+           panelDownload = new JPanel(new GridBagLayout());
+           
+           c = new GridBagConstraints();    // reset c
+           c.fill = GridBagConstraints.HORIZONTAL;
+           c.anchor = GridBagConstraints.NORTH;
+           
+           if(!installComplete)
+               downloadLabel = new JLabel("Downloading: ");
+                     
+           c.gridwidth=20;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 1;
+           c.gridy = 0;
+           panelDownload.add(downloadLabel,c);     
+           
+           progressBar = new JProgressBar();
+           c.gridwidth=20;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 1;
+           c.gridy = 3;
+           //c.ipadx = 130;
+           
+           if(installComplete)
+               progressBar.setValue(100);
+           
+           panelDownload.add(progressBar,c);
+           
+           c.ipadx = 475;
+           if(!installComplete){
+               downloadTextArea = new JTextArea("");
+               c.ipady = 100;
+           }else
+               c.ipady = 250;
+           
+           c.gridwidth=20;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 1;
+           c.gridy = 7;
+           
+           JScrollPane scrollPane = new JScrollPane(downloadTextArea);
+           panelDownload.add(scrollPane, c);
+           
+           downloadTextArea.setColumns(15);
+           downloadTextArea.setLineWrap(true);
+           downloadTextArea.setRows(7);
+           downloadTextArea.setWrapStyleWord(true);
+           downloadTextArea.setEditable(false);
+           downloadTextArea.setMargin(new Insets(5,5,5,5));
+           if(!installComplete)
+               progressBar.addChangeListener(new pbChangeListener());
+           
+           downloadLabel.setBounds(new Rectangle(500,100));
+           
+           panelDownload.setBackground(bgCol);
+       }
+       
+       void setupLegalDisclaimer(){
+
+           JPanel legalContainer = new JPanel(new BorderLayout());
+           
+           Color bgCol=new Color(255,255,255);
+           Color borderCol=new Color(167,160,143);
+           
+           Font labelFont=new Font("SansSerif",Font.PLAIN,13);
+           Font headLabelFont=new Font(null,Font.BOLD,15);
+         
+           /****************** Header Panel ***********************************/
+           JPanel headPanel = new JPanel(new GridBagLayout());
+  
+           GridBagConstraints c = new GridBagConstraints();
+         
+           
+           JLabel headLabel=new JLabel("Welcome to the "+productTitle+" Installer Wizard");
+           c.fill = GridBagConstraints.PAGE_START;
+           c.gridwidth=10;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 0;
+           c.gridy = 0;
+           
+           c.insets = new Insets(10,0,10,0);
+           headPanel.add(headLabel,c);
+           
+           c.fill = GridBagConstraints.HORIZONTAL;
+           
+           JLabel headLabel1=new JLabel("This wizard helps you install and configure "+productTitle +".");
+           c.gridwidth=10;
+           c.weightx = 0.0;
+           c.gridx = 0;
+           c.gridy = 1;
+           c.insets = new Insets(0,0,20,0);
+           headPanel.add(headLabel1,c);
+           
+           
+           JSeparator hRule=new JSeparator();
+           c.gridwidth=10;
+           c.weightx = 0.0;
+           c.gridx = 0;
+           c.gridy = 2;
+           c.insets = new Insets(0,0,5,0);
+           hRule.setForeground(borderCol);
+           headPanel.add(hRule,c);
+   
+ 
+           Color headTxtColor=new Color(000,000,000);
+           headLabel.setForeground(new Color(000,000,128));
+        
+           headLabel1.setForeground(headTxtColor);
+
+           headLabel.setFont(headLabelFont);
+           headLabel1.setFont(labelFont);
+
+           headPanel.setBackground(bgCol);
+           
+           legalContainer.add(headPanel, BorderLayout.PAGE_START); 
+        
+           /***** New Panel w/ Options *********************************/
+           Border margin = new EmptyBorder(8, 20, 15, 20);
+           legalPanelContainer = new JPanel(new BorderLayout());
+           legalPanelContainer.setBorder(margin);
+           
+           JPanel legalPanel = new JPanel(new GridBagLayout());
+           
+           c = new GridBagConstraints();    // reset c
+           c.fill = GridBagConstraints.HORIZONTAL;
+           c.anchor = GridBagConstraints.NORTH;
+  
+           JLabel componentsLabel=new JLabel("Open Source Legal Disclaimer:");
+           c.gridwidth=13;
+           c.weightx = 0.0;
+           c.gridx = 0;
+           c.gridy = 0;
+           c.insets = new Insets(0,0,5,0);
+           legalPanel.add(componentsLabel,c);
+           
+           JTextArea disclaimerText = new JTextArea("The ability to download open source extensions is provided for your convenience only. Software provided under any open source licensing model is governed solely by such open source licensing terms.");
+           c.gridheight = 15;
+           c.gridwidth=20;
+           c.ipadx = 150;
+           c.weightx = 0.0;
+           c.gridx = 0;
+           c.gridy = 2;
+           
+           disclaimerText.setMargin(new Insets(5,5,5,5));
+           JScrollPane scrollPane = new JScrollPane(disclaimerText);
+           legalPanel.add(scrollPane, c);
+           
+           checkLegal = new JCheckBox("I agree to the above Terms & Conditions");
+           c.gridwidth=10;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 0;
+           c.gridy = 18;
+           c.insets = new Insets(5,0,12,0);
+           legalPanel.add(checkLegal,c);
+           
+           disclaimerText.setColumns(20);
+           disclaimerText.setLineWrap(true);
+           disclaimerText.setRows(12);
+           disclaimerText.setWrapStyleWord(true);
+           disclaimerText.setEditable(false);
+           
+           legalPanel.setBackground(bgCol);
+           checkLegal.setBackground(bgCol);
+           
+           legalPanelContainer.add(legalPanel, BorderLayout.CENTER);
+           legalPanelContainer.setBackground(bgCol);
+           legalContainer.add(legalPanelContainer, BorderLayout.CENTER); 
+           /***********************************************************/
+           
+           JPanel panelButtons = new JPanel();
+           JButton backButton = new JButton("Back");
+           JButton cancelButton = new JButton("Cancel");
+           nextButtonLegal = new JButton("Next");
+           nextButtonLegal.setEnabled(false);
+           
+           panelButtons.add(backButton);
+           panelButtons.add(cancelButton);
+           panelButtons.add(nextButtonLegal);
+           
+           backButton.addActionListener(new ButtonListener());
+           backButton.addKeyListener(escapeHandler);
+           cancelButton.addActionListener(new ButtonListener());
+           cancelButton.addKeyListener(escapeHandler);
+           nextButtonLegal.addActionListener(new ButtonListener());
+           nextButtonLegal.addKeyListener(legalKeyHandler);
+           checkLegal.addActionListener(new CheckBoxListener());
+           checkLegal.addKeyListener(legalKeyHandler);
+           panelButtons.setBackground(bgCol);
+           legalContainer.add(panelButtons, BorderLayout.PAGE_END);
+           /***********************************************************/
+           
+           getContentPane().add(legalContainer, cardLegal);
+           
+           /***********************************************************/
+       }
+       
+       void setupInstallationComplete(){
+
+           finishedContainer = new JPanel(new BorderLayout());
+           
+           Color bgCol=new Color(255,255,255);
+           Font headLabelFont=new Font(null,Font.BOLD,15);
+         
+           /****************** Header Panel ***********************************/
+           headPanelFinished = new JPanel(new GridBagLayout());
+  
+           GridBagConstraints c = new GridBagConstraints();
+         
+           
+           JLabel headLabel=new JLabel(productTitle+" Installation Wizard Complete");
+           c.fill = GridBagConstraints.PAGE_START;
+           c.gridwidth=10;
+           c.gridheight=1;
+           c.weightx = 0;
+           c.gridx = 0;
+           c.gridy = 0;
+           
+           c.insets = new Insets(10,0,10,0);
+           headPanelFinished.add(headLabel,c);
+           headPanelFinished.setBackground(bgCol);
+           headLabel.setFont(headLabelFont);
+           
+           /************************/
+           controlPanelFinished = new JPanel();
+           finishedButton = new JButton("Exit");
+           controlPanelFinished.add(finishedButton);
+           finishedButton.addActionListener(new ButtonListener());
+           finishedButton.addKeyListener(
+                      new KeyAdapter(){ 
+                          public void keyPressed(KeyEvent ke){
+                              if(ke.getKeyCode() == KeyEvent.VK_ENTER || ke.getKeyCode() == KeyEvent.VK_ESCAPE)
+                                  System.exit(0);
+                          }
+                      }
+           );
+           controlPanelFinished.setBackground(bgCol);
+          
+           /**************************/
+           // middle panel will be panelDownload
+           
+           getContentPane().add(finishedContainer, cardInstallationComplete);
+       }
+       
+       void toggleProxyComponents(){
+           boolean val = useProxyRadio.isSelected();
+           proxyServerText.setVisible(val);
+           proxyPortText.setVisible(val);
+           autoDetectProxy.setVisible(val);
+           proxyServerLabel.setVisible(val);
+           proxyPortLabel.setVisible(val);
+           
+           if(proxyCombo.getItemCount()>0 && val)
+               proxyCombo.setVisible(val);
+           else {
+        	   proxyCombo.setVisible(false);
+        	   /*
+        	    * Fix for bug#3280: reset the proxy server and port fields when no
+        	    * proxy is selected
+        	    */
+        	   proxyServerText.setText("");
+        	   proxyPortText.setText("");
+           }
+       }
+       
+       boolean validateProxy()
+       {
+           if(useProxyRadio.isSelected() && panelProxy.isVisible() && selectedOptionalComponents())
+           {
+               if(!proxyServerText.getText().trim().equals("") && !proxyPortText.getText().trim().equals("")){
+                   try{
+                       Integer.parseInt(proxyPortText.getText());
+                       return true;
+                   }catch (NumberFormatException ex){
+                       JOptionPane.showMessageDialog(this,"Enter a valid proxy server and port to continue.");
+                       return false;
+                   }
+               }else{
+                   JOptionPane.showMessageDialog(this,"Enter a valid proxy server and port to continue.");
+                   return false;
+               }
+           }
+           else
+           {
+               return true;
+           }    
+       }
+
+       boolean selectedOptionalComponents(){
+           return (checkPerl.isSelected() || checkPerlSAX.isSelected() || checkPython.isSelected());
+       }
+       
+       class installComplete implements Runnable{
+           
+           public void run(){
+               /* Installation Complete */
+               downloadLabel.setText("Installation Complete");
+               
+               finishedContainer.removeAll();
+               finishedContainer.add(headPanelFinished, BorderLayout.PAGE_START);
+               
+               setupDownloadPanel(true);
+               panelDownload.revalidate();
+               
+               if(downloadError){
+                   // show back button
+                   controlPanelFinished.removeAll();
+                   JButton backButton=new JButton("Back");
+                   backButton.addActionListener(new ButtonListener());
+                   backButton.addKeyListener(escapeHandler);
+                   controlPanelFinished.add(backButton);
+                   controlPanelFinished.add(finishedButton);
+               }else{
+                   controlPanelFinished.removeAll();
+                   controlPanelFinished.add(finishedButton);
+               }
+                     
+               finishedContainer.add(controlPanelFinished, BorderLayout.PAGE_END);
+               finishedContainer.revalidate();
+               finishedContainer.add(panelDownload, BorderLayout.CENTER);
+               
+               cardCurrent = cardInstallationComplete;
+               CardLayout cl = (CardLayout)(content.getLayout());
+               cl.show(content, cardCurrent);
+               
+               finishedButton.requestFocusInWindow();
+           }
+       }
+       
+       class DownloadComponentsWrapper implements Runnable{
+           
+           public DownloadComponentsWrapper(){
+           }
+           
+           public void run(){
+               downloadOptionalComponents();
+           }
+           
+           void downloadOptionalComponents(){
+               downloadError = false;
+               ArrayList<String[]> fileList = new ArrayList<String[]>();
+
+               if(checkPerl.isSelected()){
+                   fileList.add(new String[]{"Perl","Java.pm", defaultPerlJavaURL + "Java.pm"});
+                   fileList.add(new String[]{"Perl","JavaArray.pm", defaultPerlJavaURL + "JavaArray.pm"});
+                   fileList.add(new String[]{"Perl","JavaServer.jar", defaultPerlJavaURL + "JavaServer.jar"});
+               }
+               
+               File saxDir = new File(targetDirectory + File.separator + "lib" + File.separator + "perl" + File.separator + "XML" + File.separator + "Parser");
+               if(checkPerlSAX.isSelected()){
+                   fileList.add(new String[]{"Perl SAX","PerlSAX.pm", defaultPerlSAXURL});
+                   File installDir = new File(targetDirectory);
+                                 
+                   if(installDir.exists() && !saxDir.exists())
+                       saxDir.mkdirs();
+                   
+               }
+               
+               if(checkPython.isSelected())
+                   fileList.add(new String[]{"Python","jython_installer-2.2.jar", defaultPythonJythonURL});
+               
+               Downloader dl = new Downloader(targetDirectory);
+               
+               progressBar.setMaximum(100);
+               progressBar.setMinimum(0);
+               
+               dl.setProxy(proxyServerText.getText(), proxyPortText.getText());
+               dl.setProgressBar(progressBar);
+               
+               String[] tmp;
+               String libDir = targetDirectory + File.separator + "lib";
+               for(int i=0; i<fileList.size(); i++){
+                   tmp = (String[])fileList.get(i);
+                   
+                   downloadLabel.setText("Downloading: " + tmp[0] + " - " + tmp[1]);
+                   if(i==0)
+                       panelDownload.revalidate();
+                   
+                   panelDownload.paintImmediately(panelDownload.getVisibleRect());
+                  
+                   if(tmp[0].equalsIgnoreCase("Perl"))
+                       dl.setFilename(libDir + File.separator + "perl" + File.separator + tmp[1]);
+                   else if(tmp[0].equalsIgnoreCase("Perl SAX"))
+                       dl.setFilename(saxDir.getAbsolutePath() + File.separator + tmp[1]);         
+                   else if(tmp[0].equalsIgnoreCase("Python"))
+                       dl.setFilename(libDir + File.separator + "python" + File.separator + tmp[1]);
+                   
+                   dl.setURL(tmp[2]);
+                   
+                   progressBar.setValue(0);
+                   
+                   Thread dlTh=new Thread(dl);
+                   dlTh.start(); 
+                   do{
+                       
+                       if(dl.getError()!=""){
+                           installLogOutput("Error Downloading " + tmp[1] + ": " + dl.getError());
+                           downloadError = true;
+                           break;
+                       }
+                       
+                       try{
+                           Thread.sleep(100);
+                       }catch(InterruptedException ie){
+                           ie.printStackTrace();
+                       }
+                       
+                   }while(progressBar.getValue() < 100);
+                   
+                   while (dlTh.isAlive()){
+                	  // Download may be done, but dl thread may still have file open,
+                	  // wait until thread exits 
+                   }
+                   
+                   if(progressBar.getValue()==100){
+                       installLogOutput("Successfully downloaded " + tmp[1]);
+                       if(tmp[0].equals("Python"))
+                       {
+                            
+                           if(installJython(dl.getFilename()))
+                           {
+                               installLogOutput("Successfully installed Jython");
+                           
+                               if(setEnvironmentVariable("Python"))
+                                   installLogOutput("Successfully added settings.py");
+                               else
+                                   installLogOutput("Error: cannot create settings.py, manually add TRAFCI_PYTHON_JSERVER to the environment, please see README in the samples directory.");
+                           
+                           }else
+                               installLogOutput("Error installing Jython, please try manually. See the README in the samples directory for more information.");
+                       }
+                       else
+                       {
+                           if(tmp[0].equals("Perl") && tmp[1].endsWith("jar"))
+                           {
+                               if(setEnvironmentVariable("Perl"))
+                                   installLogOutput("Successfully added settings.pl");
+                               else
+                                   installLogOutput("Error: cannot create settings.pl, manually add TRAFCI_PERL_JSERVER to environment, please see README in the samples directory.");
+                           }
+                       }
+                   }
+               }
+               
+               // done
+               
+           }
+       };
+       
+       class pbChangeListener implements ChangeListener
+       {
+               public void stateChanged(ChangeEvent e) 
+               {
+                   JProgressBar bar = (JProgressBar)e.getSource();
+                   bar.paintImmediately(bar.getVisibleRect());
+               }
+       };
+
+   }
+   
+   void installInCmdMode()
+   {
+		try {
+			Class.forName("ControlCSignalHandler").newInstance();
+		} catch (Throwable e) {
+		}
+      
+
+      String line=null;
+      File targetDir=null;
+      File jdbcFile=null;
+      
+      if(enableOpenSource){
+          
+          if(!silentInstall){
+              System.out.println("\nType Y for a standard installation, or N for optional components only.\n");
+              
+              do{
+                  try
+                  {
+                      System.out.print("Standard Installation [Y]: ");
+                      line=bufReader.readLine();
+                      Thread.sleep(100);
+                  } catch (IOException ioe)
+                  {
+                      System.err.println(ioe);
+                  }catch(Exception ex){}
+              }while( !(line != null && (line.equalsIgnoreCase("Y") || line.equalsIgnoreCase("N") || line.equalsIgnoreCase(""))) );
+              
+              if(line.equalsIgnoreCase("N"))
+                  standardInstall = false; // true by default
+          }
+      }
+      
+      
+      while (standardInstall)
+      {
+          
+          if(!silentInstall){
+             try
+             {
+                System.out.print("\n"+ NEW_JDBC +
+                   "\n-----------------

<TRUNCATED>


[29/38] incubator-trafodion git commit: remove the hard code env version

Posted by li...@apache.org.
remove the hard code env version


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

Branch: refs/heads/master
Commit: 3894730af89eeaf7a947a72756f65f452753b946
Parents: dfe4b56
Author: AlexPeng19 <al...@hotmail.com>
Authored: Tue Nov 22 15:45:54 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Tue Nov 22 15:45:54 2016 +0800

----------------------------------------------------------------------
 core/conn/trafci/installer_pom.xml | 2 +-
 core/conn/trafci/pom.xml           | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/3894730a/core/conn/trafci/installer_pom.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/installer_pom.xml b/core/conn/trafci/installer_pom.xml
index 8c497af..3fee491 100644
--- a/core/conn/trafci/installer_pom.xml
+++ b/core/conn/trafci/installer_pom.xml
@@ -26,7 +26,7 @@
 	<groupId>org.trafodion</groupId>
 	<artifactId>trafciInstaller</artifactId>
 	<packaging>jar</packaging>
-	<version>2.2.0</version>
+	<version>${env.TRAFODION_VER}</version>
 	<name>Trafodion Trafci</name>
 	<properties>
 		<basedir>.</basedir>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/3894730a/core/conn/trafci/pom.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/pom.xml b/core/conn/trafci/pom.xml
index 15307de..2a223c7 100644
--- a/core/conn/trafci/pom.xml
+++ b/core/conn/trafci/pom.xml
@@ -26,11 +26,10 @@
 	<groupId>org.trafodion</groupId>
 	<artifactId>trafci</artifactId>
 	<packaging>jar</packaging>
-	<version>2.2.0</version>
+	<version>${env.TRAFODION_VER}</version>
 	<name>Trafodion Trafci</name>
 	<properties>
 		<jettyVersion>9.2.6.v20141205</jettyVersion>
-		<env.TRAFODION_VER>2.2.0</env.TRAFODION_VER>
 		<traf-jdbc-version>${env.TRAFODION_VER}</traf-jdbc-version>
 		<trafci-version>${env.TRAFODION_VER}</trafci-version>
 	</properties>


[32/38] incubator-trafodion git commit: add the create trafci.zip action

Posted by li...@apache.org.
add the create trafci.zip action


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

Branch: refs/heads/master
Commit: d42fd5162e2321c8808ce363edb04b800553c61d
Parents: 4eadefd
Author: AlexPeng19 <al...@hotmail.com>
Authored: Wed Nov 23 13:58:03 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Wed Nov 23 13:58:03 2016 +0800

----------------------------------------------------------------------
 core/conn/trafci/Makefile | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d42fd516/core/conn/trafci/Makefile
----------------------------------------------------------------------
diff --git a/core/conn/trafci/Makefile b/core/conn/trafci/Makefile
index 067a0e3..6ecc68b 100644
--- a/core/conn/trafci/Makefile
+++ b/core/conn/trafci/Makefile
@@ -33,4 +33,5 @@ Trafci_installer:
 	export buildId=`head -n 1 buildId`$
 	mvn -f installer_pom.xml -DbldId=${buildId} clean package$
 Trafci_deploy:
+	zip -r ../clients/trafci.zip target/trafciInstaller.jar utils/README
 	java -jar target/trafciInstaller.jar -silent -jdbcFile ${MY_SQROOT}/export/lib/jdbcT4.jar -installDir ${MY_SQROOT}


[35/38] incubator-trafodion git commit: add one junit test case for trafci

Posted by li...@apache.org.
add one junit test case for trafci


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

Branch: refs/heads/master
Commit: 95b9f2718df007f1c67f97e34c1e3a187c90e88e
Parents: 6fc8775
Author: AlexPeng19 <al...@hotmail.com>
Authored: Tue Nov 29 18:58:01 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Tue Nov 29 18:58:01 2016 +0800

----------------------------------------------------------------------
 core/conn/trafci/Makefile                       |  4 +-
 core/conn/trafci/pom.xml                        | 54 ++++++++++----------
 .../org/trafodion/ci/UserInterfaceTest.java     | 28 ++++++++++
 3 files changed, 56 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/95b9f271/core/conn/trafci/Makefile
----------------------------------------------------------------------
diff --git a/core/conn/trafci/Makefile b/core/conn/trafci/Makefile
index 30a80cf..c9c2da5 100644
--- a/core/conn/trafci/Makefile
+++ b/core/conn/trafci/Makefile
@@ -27,11 +27,11 @@ all:Trafci_deploy
 Trafci_deploy:Trafci_installer
 Trafci_installer:Trafci_jar
 Trafci_jar:
-	mvn clean install$
+	mvn clean install -DskipTests$
 Trafci_installer:
 	./getBuildInfo$
 	export buildId=`head -n 1 buildId`$
-	mvn -f installer_pom.xml -DbldId=${buildId} clean package$
+	mvn -f installer_pom.xml -DbldId=${buildId} clean package -DskipTests$ 
 Trafci_deploy:
 	zip -r ../clients/trafci.zip -j target/trafciInstaller.jar utils/README
 	java -jar target/trafciInstaller.jar -silent -jdbcFile ${MY_SQROOT}/export/lib/jdbcT4.jar -installDir ${MY_SQROOT}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/95b9f271/core/conn/trafci/pom.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/pom.xml b/core/conn/trafci/pom.xml
index 7f74250..7292289 100644
--- a/core/conn/trafci/pom.xml
+++ b/core/conn/trafci/pom.xml
@@ -1,25 +1,14 @@
-<!-- 
- @@@ 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 @@@
--->
+<!-- @@@ 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 @@@ -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>
@@ -37,8 +26,16 @@
 		<dependency>
 			<groupId>org.trafodion.jdbc.t4</groupId>
 			<artifactId>jdbcT4</artifactId>
-			<version>${traf-jdbc-version}</version>
+			<version>${TRAFODION_VER}</version>
+			<scope>provided</scope>
 		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.11</version>
+			<scope>test</scope>
+		</dependency>
+
 	</dependencies>
 	<build>
 		<finalName>trafci</finalName>
@@ -69,9 +66,10 @@
 						<phase>generate-sources</phase>
 						<configuration>
 							<target>
-							<property name="vproc.version" value="TrafCI_Build_${bldId}"/>
-							<property name="vproc.dir" value="${basedir}/src/main/java/org/trafodion/ci"/>
-							<property name="Install.dir" value="${basedir}/install"/>
+								<property name="vproc.version" value="TrafCI_Build_${bldId}" />
+								<property name="vproc.dir"
+									value="${basedir}/src/main/java/org/trafodion/ci" />
+								<property name="Install.dir" value="${basedir}/install" />
 								<copy file="${vproc.dir}/Vproc.java-tmpl" tofile="${vproc.dir}/Vproc.java"
 									overwrite="true"></copy>
 								<copy file="${Install.dir}/Installer.java-tmpl" tofile="${Install.dir}/Installer.java"
@@ -79,8 +77,8 @@
 								<echo message="BUILD Vproc version ${vproc.version}" />
 								<replace file="${vproc.dir}/Vproc.java" token="@@@"
 									value="${vproc.version}" />
-								<replace file="${Install.dir}/Installer.java"
-									token="@@@VPROC@@@" value="${vproc.version}" />
+								<replace file="${Install.dir}/Installer.java" token="@@@VPROC@@@"
+									value="${vproc.version}" />
 							</target>
 						</configuration>
 						<goals>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/95b9f271/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java b/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
new file mode 100644
index 0000000..cc8f52f
--- /dev/null
+++ b/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
@@ -0,0 +1,28 @@
+package org.trafodion.ci;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class UserInterfaceTest {
+
+	@Test
+	public void test() {
+		MySecurityManager secManager = new MySecurityManager();
+		System.setSecurityManager(secManager);
+		try {
+			String[] params = "-h 10.10.12.99:23400 -u trafodion -p traf123 -q values(1);".split("\\s+");
+			UserInterface.main(params);
+		} catch (SecurityException e) {
+			assertTrue(true);
+		}
+	}
+
+}
+
+class MySecurityManager extends SecurityManager {
+	@Override
+	public void checkExit(int status) {
+		throw new SecurityException();
+	}
+}


[38/38] incubator-trafodion git commit: Merge Fix for [TRAFODION-2364]convert trafci project into maven project

Posted by li...@apache.org.
Merge Fix for [TRAFODION-2364]convert trafci project into maven project


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

Branch: refs/heads/master
Commit: 515ff4c54ab5367c0ec34331faf3fa188bcf11a5
Parents: 672b6d1 9ee378b
Author: Liu Ming <li...@apache.org>
Authored: Thu Dec 8 00:18:25 2016 +0000
Committer: Liu Ming <li...@apache.org>
Committed: Thu Dec 8 00:18:25 2016 +0000

----------------------------------------------------------------------
 core/Makefile                                   |    6 +-
 core/conn/trafci/.gitignore                     |    6 +
 core/conn/trafci/Makefile                       |   37 +
 core/conn/trafci/install/Installer.java         | 3389 --------------
 core/conn/trafci/install/Installer.java-tmpl    | 3389 ++++++++++++++
 core/conn/trafci/installer_pom.xml              |  106 +
 core/conn/trafci/pom.xml                        |  114 +
 .../org/trafodion/ci/AWTExceptionHandler.java   |   36 +
 .../main/java/org/trafodion/ci/CSVDisplay.java  |   90 +
 .../src/main/java/org/trafodion/ci/Column.java  |  131 +
 .../java/org/trafodion/ci/ConditionalQuery.java |  435 ++
 .../trafodion/ci/ConditionalQueryException.java |   43 +
 .../trafodion/ci/ConditionalSyntaxError.java    |  123 +
 .../java/org/trafodion/ci/ConsoleReader.java    |  218 +
 .../java/org/trafodion/ci/ConsoleWriter.java    |  130 +
 .../java/org/trafodion/ci/DatabaseQuery.java    | 1804 ++++++++
 .../src/main/java/org/trafodion/ci/Display.java |   68 +
 .../trafodion/ci/DuplicateParamException.java   |   40 +
 .../main/java/org/trafodion/ci/ErrorObject.java |  103 +
 .../src/main/java/org/trafodion/ci/FCQuery.java |  334 ++
 .../main/java/org/trafodion/ci/FileReader.java  |  176 +
 .../main/java/org/trafodion/ci/FileWriter.java  |   80 +
 .../main/java/org/trafodion/ci/HTMLDisplay.java |   80 +
 .../main/java/org/trafodion/ci/HTMLObject.java  |  628 +++
 .../main/java/org/trafodion/ci/HelpIndexer.java |  134 +
 .../src/main/java/org/trafodion/ci/Helper.java  |  225 +
 .../main/java/org/trafodion/ci/HostQuery.java   |  289 ++
 .../main/java/org/trafodion/ci/IDisplay.java    |   28 +
 .../main/java/org/trafodion/ci/IndexStruct.java |   55 +
 .../java/org/trafodion/ci/InterfaceQuery.java   | 4378 ++++++++++++++++++
 .../trafodion/ci/InterfaceQueryException.java   |   35 +
 .../org/trafodion/ci/InterfaceSyntaxError.java  |   83 +
 .../trafodion/ci/InvalidNumberOfArguments.java  |   35 +
 .../main/java/org/trafodion/ci/JDBCVproc.java   |   38 +
 .../java/org/trafodion/ci/LFProperties.java     |  130 +
 .../java/org/trafodion/ci/MaskingThread.java    |   73 +
 .../java/org/trafodion/ci/MultiByteUtils.java   |   56 +
 .../org/trafodion/ci/NullKeyWordException.java  |   35 +
 .../org/trafodion/ci/OutputColumnAttribute.java |   47 +
 .../java/org/trafodion/ci/OutputContents.java   |  144 +
 .../main/java/org/trafodion/ci/ParallelRun.java | 1320 ++++++
 .../org/trafodion/ci/ParamStringObject.java     |  256 +
 .../java/org/trafodion/ci/ParseArguments.java   |  660 +++
 .../src/main/java/org/trafodion/ci/Parser.java  | 1195 +++++
 .../ci/ParserMissingParamException.java         |   42 +
 .../trafciDefaultLookAndFeel.properties         |   60 +
 .../main/java/org/trafodion/ci/PrunSummary.java |  119 +
 .../org/trafodion/ci/PrunUserInterruption.java  |   34 +
 .../java/org/trafodion/ci/PythonInterface.java  |  180 +
 .../src/main/java/org/trafodion/ci/Query.java   |  188 +
 .../main/java/org/trafodion/ci/QueryUtils.java  |   37 +
 .../java/org/trafodion/ci/QueryWrapper.java     |  700 +++
 .../main/java/org/trafodion/ci/RawDisplay.java  |  189 +
 .../src/main/java/org/trafodion/ci/Reader.java  |  286 ++
 .../java/org/trafodion/ci/RepObjInterface.java  |   27 +
 .../java/org/trafodion/ci/ReplacementObj.java   |   39 +
 .../org/trafodion/ci/ScriptSectionNotFound.java |   34 +
 .../java/org/trafodion/ci/ScriptsInterface.java |  153 +
 .../src/main/java/org/trafodion/ci/Session.java | 1908 ++++++++
 .../java/org/trafodion/ci/SessionDefaults.java  |  342 ++
 .../java/org/trafodion/ci/SessionError.java     |  181 +
 .../java/org/trafodion/ci/SessionInterface.java | 1487 ++++++
 .../org/trafodion/ci/SessionTimeoutTask.java    |   93 +
 .../src/main/java/org/trafodion/ci/SqlEnum.java |   83 +
 .../java/org/trafodion/ci/StatusThread.java     |  100 +
 .../org/trafodion/ci/TerminalProcessBridge.java |  246 +
 .../trafodion/ci/UnKnownInterfaceCommand.java   |   34 +
 .../java/org/trafodion/ci/UserInterface.java    |  421 ++
 .../java/org/trafodion/ci/UserInterruption.java |   36 +
 .../src/main/java/org/trafodion/ci/Utils.java   |  381 ++
 .../java/org/trafodion/ci/ValidateQuery.java    |  412 ++
 .../org/trafodion/ci/ValidationException.java   |   39 +
 .../main/java/org/trafodion/ci/Vproc.java-tmpl  |   36 +
 .../main/java/org/trafodion/ci/WCIUtils.java    |  122 +
 .../src/main/java/org/trafodion/ci/Writer.java  |  418 ++
 .../main/java/org/trafodion/ci/XMLDisplay.java  |   75 +
 .../main/java/org/trafodion/ci/XMLObject.java   |  607 +++
 .../org/trafodion/ci/help/common_common.help    |  457 ++
 .../java/org/trafodion/ci/help/help_file.idx    |   30 +
 .../java/org/trafodion/ci/help/sql_common.help  |  376 ++
 .../org/trafodion/ci/pwdencrypt/ArgMap.java     |   61 +
 .../org/trafodion/ci/pwdencrypt/ArgsDef.java    |   74 +
 .../trafodion/ci/pwdencrypt/EncryptUtil.java    |  249 +
 .../java/org/trafodion/ci/pwdencrypt/JCE.java   |  414 ++
 .../trafodion/ci/pwdencrypt/PasswordOpts.java   |  292 ++
 .../org/trafodion/ci/pwdencrypt/RefLookup.java  |  127 +
 .../org/trafodion/ci/pwdencrypt/WorkTypes.java  |   55 +
 .../trafci/src/main/resources/install_jar.xml   |   71 +
 .../trafci/src/main/resources/install_tar.xml   |   51 +
 .../trafci/src/main/resources/trafci.properties |    5 +
 .../org/trafodion/ci/AWTExceptionHandler.java   |   36 -
 .../trafci/src/org/trafodion/ci/CSVDisplay.java |   90 -
 .../trafci/src/org/trafodion/ci/Column.java     |  131 -
 .../src/org/trafodion/ci/ConditionalQuery.java  |  435 --
 .../trafodion/ci/ConditionalQueryException.java |   43 -
 .../trafodion/ci/ConditionalSyntaxError.java    |  123 -
 .../src/org/trafodion/ci/ConsoleReader.java     |  218 -
 .../src/org/trafodion/ci/ConsoleWriter.java     |  130 -
 .../src/org/trafodion/ci/DatabaseQuery.java     | 1804 --------
 .../trafci/src/org/trafodion/ci/Display.java    |   68 -
 .../trafodion/ci/DuplicateParamException.java   |   40 -
 .../src/org/trafodion/ci/ErrorObject.java       |  103 -
 .../trafci/src/org/trafodion/ci/FCQuery.java    |  334 --
 .../trafci/src/org/trafodion/ci/FileReader.java |  176 -
 .../trafci/src/org/trafodion/ci/FileWriter.java |   80 -
 .../src/org/trafodion/ci/HTMLDisplay.java       |   80 -
 .../trafci/src/org/trafodion/ci/HTMLObject.java |  628 ---
 .../src/org/trafodion/ci/HelpIndexer.java       |  134 -
 .../trafci/src/org/trafodion/ci/Helper.java     |  225 -
 .../trafci/src/org/trafodion/ci/HostQuery.java  |  289 --
 .../trafci/src/org/trafodion/ci/IDisplay.java   |   28 -
 .../src/org/trafodion/ci/IndexStruct.java       |   55 -
 .../src/org/trafodion/ci/InterfaceQuery.java    | 4378 ------------------
 .../trafodion/ci/InterfaceQueryException.java   |   35 -
 .../org/trafodion/ci/InterfaceSyntaxError.java  |   83 -
 .../trafodion/ci/InvalidNumberOfArguments.java  |   35 -
 .../trafci/src/org/trafodion/ci/JDBCVproc.java  |   38 -
 .../src/org/trafodion/ci/LFProperties.java      |  130 -
 .../src/org/trafodion/ci/MaskingThread.java     |   73 -
 .../src/org/trafodion/ci/MultiByteUtils.java    |   56 -
 .../org/trafodion/ci/NullKeyWordException.java  |   35 -
 .../org/trafodion/ci/OutputColumnAttribute.java |   47 -
 .../src/org/trafodion/ci/OutputContents.java    |  144 -
 .../src/org/trafodion/ci/ParallelRun.java       | 1320 ------
 .../src/org/trafodion/ci/ParamStringObject.java |  256 -
 .../src/org/trafodion/ci/ParseArguments.java    |  660 ---
 .../trafci/src/org/trafodion/ci/Parser.java     | 1195 -----
 .../ci/ParserMissingParamException.java         |   42 -
 .../trafciDefaultLookAndFeel.properties         |   60 -
 .../src/org/trafodion/ci/PrunSummary.java       |  119 -
 .../org/trafodion/ci/PrunUserInterruption.java  |   34 -
 .../src/org/trafodion/ci/PythonInterface.java   |  180 -
 .../conn/trafci/src/org/trafodion/ci/Query.java |  188 -
 .../trafci/src/org/trafodion/ci/QueryUtils.java |   37 -
 .../src/org/trafodion/ci/QueryWrapper.java      |  700 ---
 .../trafci/src/org/trafodion/ci/RawDisplay.java |  189 -
 .../trafci/src/org/trafodion/ci/Reader.java     |  286 --
 .../src/org/trafodion/ci/RepObjInterface.java   |   27 -
 .../src/org/trafodion/ci/ReplacementObj.java    |   39 -
 .../org/trafodion/ci/ScriptSectionNotFound.java |   34 -
 .../src/org/trafodion/ci/ScriptsInterface.java  |  153 -
 .../trafci/src/org/trafodion/ci/Session.java    | 1908 --------
 .../src/org/trafodion/ci/SessionDefaults.java   |  342 --
 .../src/org/trafodion/ci/SessionError.java      |  181 -
 .../src/org/trafodion/ci/SessionInterface.java  | 1487 ------
 .../org/trafodion/ci/SessionTimeoutTask.java    |   93 -
 .../trafci/src/org/trafodion/ci/SqlEnum.java    |   83 -
 .../src/org/trafodion/ci/StatusThread.java      |  100 -
 .../org/trafodion/ci/TerminalProcessBridge.java |  246 -
 .../trafodion/ci/UnKnownInterfaceCommand.java   |   34 -
 .../src/org/trafodion/ci/UserInterface.java     |  421 --
 .../src/org/trafodion/ci/UserInterruption.java  |   36 -
 .../conn/trafci/src/org/trafodion/ci/Utils.java |  381 --
 .../src/org/trafodion/ci/ValidateQuery.java     |  412 --
 .../org/trafodion/ci/ValidationException.java   |   39 -
 .../conn/trafci/src/org/trafodion/ci/Vproc.java |   36 -
 .../trafci/src/org/trafodion/ci/WCIUtils.java   |  122 -
 .../trafci/src/org/trafodion/ci/Writer.java     |  418 --
 .../trafci/src/org/trafodion/ci/XMLDisplay.java |   75 -
 .../trafci/src/org/trafodion/ci/XMLObject.java  |  607 ---
 .../org/trafodion/ci/help/common_common.help    |  457 --
 .../src/org/trafodion/ci/help/help_file.idx     |   30 -
 .../src/org/trafodion/ci/help/sql_common.help   |  376 --
 .../src/org/trafodion/ci/pwdencrypt/ArgMap.java |   61 -
 .../org/trafodion/ci/pwdencrypt/ArgsDef.java    |   74 -
 .../trafodion/ci/pwdencrypt/EncryptUtil.java    |  249 -
 .../src/org/trafodion/ci/pwdencrypt/JCE.java    |  414 --
 .../trafodion/ci/pwdencrypt/PasswordOpts.java   |  292 --
 .../org/trafodion/ci/pwdencrypt/RefLookup.java  |  127 -
 .../org/trafodion/ci/pwdencrypt/WorkTypes.java  |   55 -
 .../org/trafodion/ci/UserInterfaceTest.java     |  116 +
 171 files changed, 28877 insertions(+), 28371 deletions(-)
----------------------------------------------------------------------



[23/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/install/Installer.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/install/Installer.java b/core/conn/trafci/install/Installer.java
deleted file mode 100644
index 8b5caaa..0000000
--- a/core/conn/trafci/install/Installer.java
+++ /dev/null
@@ -1,3389 +0,0 @@
-//
-// @@@ 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 @@@
-//
-
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.Color;
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.GridLayout;
-import java.awt.Insets;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FilePermission;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.URL;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import javax.swing.*;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.filechooser.FileFilter;
-
-public class Installer
-{
-   /* change this to true when debugging */
-   private boolean DEBUG = false; 
-   
-   static String MANIFEST = "META-INF/MANIFEST.MF";
-   private static final String vprocStr = "@@@VPROC@@@";
-   private String myClassName;
-
-   final static String productName="trafci";
-   final static String productTitle="Trafodion Command Interface";
-   final static String productScriptName="trafci";
-      
-   private static String cardCurrent = "";
-   private static boolean standardInstall = true;
-   private static boolean silentInstall = false;
-   private static boolean enableOpenSource = false;
-   final static String cardInstallerChoices = "INSTALLER CHOICES";
-   final static String cardInstallerPath = "INSTALLER PATHS";
-   final static String cardOptionalComponents = "OPTIONAL COMPONENTS";
-   final static String cardLegal = "LEGAL DISCLAIMER";
-   final static String cardInstallationComplete = "INSTALLATION COMPLETE";
-   
-   final static String ERROR_INVALID_NCI_DIR = "Invalid " + productTitle + " Installation Directory"; 
-   
-   final String NEW_JDBC = "JDBC Type 4 Driver JAR File";
-   final String NEW_JDBC_PKG = "org/trafodion/jdbc/t4/";
-   
-   String installerFilesStartWith="$";
-   String productJarFileName="trafci.jar";
-   String productJarLoc="lib";
-   String productJarFile=productJarLoc+File.separator+productJarFileName;
-   String classVarToReplace="##TRAFCI_CLASSPATH##";
-   String perlClassVarToReplace="##TRAFCI_PERL_CLASSPATH##";
-   String perlLibPathToReplace = "##TRAFCI_PERL_LIB_CLASSPATH##";
-   String pythonClassVarToReplace="##TRAFCI_PYTHON_CLASSPATH##";
-   String pythonLibPathToReplace = "##TRAFCI_PYTHON_LIB_CLASSPATH##";
-   String jythonJarFile="jython.jar";
-   String perlJarFile="JavaServer.jar";
-   String t4jdbcIdentifier= NEW_JDBC_PKG + "TrafT4PreparedStatement.class";
-   String ciJarIdentifier="org/trafodion/ci/Vproc.class"; 
-   BufferedReader bufReader= new BufferedReader(new InputStreamReader(System.in));
-
-   private static String nixDefaultInstallDir="/usr/local/";
-   private static String wDefaultInstallDir="\\Trafodion\\" + productTitle;
-   private static String defaultInstallDir=wDefaultInstallDir;
-   
-   private static String wDefaultInstallJDBC="";
-   private static String nixDefaultInstallJDBC="/usr/local/trafci/jdbcT4.jar";
-   private static String defaultInstallJDBC=wDefaultInstallJDBC;
-   
-   static String jdbcFileLoc=null;
-   static String targetDirectory=null;
-   static String osName=null;
-   
-   String defaultPerlJavaURL = "http://search.cpan.org/src/METZZO/Java-4.7/";
-   String defaultPerlSAXURL = "http://search.cpan.org/src/KMACLEOD/libxml-perl-0.08/lib/XML/Parser/PerlSAX.pm";
-   String defaultPythonJythonURL = "http://fr.sourceforge.jp/frs/g_redir.php?m=jaist&f=%2Fjython%2Fjython%2F2.2%2Fjython_installer-2.2.jar";
-   
-
-   public class InstallerGUIMode extends JFrame {
-
-	  private static final long serialVersionUID = -8158111325005975799L;
-	  JTextField file_txt =null;
-      JButton fileBrowseButton =null;
-      JButton dirBrowseButton =null;
-      JButton dirBrowseButtonOSS =null;
-      JButton choiceStandardInstall =null;
-      JButton choiceCoreComponents =null;
-      JButton choiceOptionalButton =null;
-      JButton nextButtonInstallerPath =null;
-      JButton nextButtonOptionalComponents =null;
-      JButton autoDetectProxy =null;
-      JButton nextButtonLegal =null;
-      JButton finishedButton =null;
-      JButton perlJavaURL =null;
-      JButton perlSAXURL =null;
-      JButton pythonJythonURL =null;
-      
-      JFileChooser filechooser=null;
-      JTextField jdbcFileText =null;
-      JTextField targetDirText =null;
-      JTextField ossTargetDirText =null;
-      JTextField proxyServerText =null;
-      JTextField proxyPortText =null;
-      ProxyBox proxyCombo =null;
-      
-      JCheckBox checkRequiredComponents =null;
-      JCheckBox checkPerl =null;
-      JCheckBox checkPython =null;
-      JCheckBox checkPerlSAX =null;
-      JCheckBox checkLegal =null;
-      
-      ButtonGroup proxyButtonGroup =null;
-      JRadioButton noProxyRadio =null;
-      JRadioButton useProxyRadio =null;
-      
-      JLabel statusLabel =null;
-      JLabel proxyPortLabel =null;
-      JLabel proxyServerLabel =null;
-      JLabel downloadLabel =null;
-      
-      JPanel panelProxy =null;
-      JPanel panelDownload =null;
-      JPanel panelComponentsProxyContainer =null;
-      JPanel finishedContainer =null;
-      JPanel headPanelFinished =null;
-      JPanel controlPanelFinished =null;
-      JPanel targetSelectPanel =null;
-      JPanel legalPanelContainer =null;
-      JPanel pathHolder =null;
-      JPanel optComponentContainer =null;
-      JPanel panelComponents =null;
-      JProgressBar progressBar =null;
-      JTextArea downloadTextArea =null;
-
-      Container content = getContentPane();
-
-      boolean downloadError = false;
-      
-      int getJDBCLocation()
-      {
-         JFileChooser t4c = new JFileChooser();
-         t4c.setCurrentDirectory(new File("."));
-         t4c.setDialogTitle("Select " + NEW_JDBC);
-         t4c.setMultiSelectionEnabled(false);
-         t4c.setFileSelectionMode(JFileChooser.FILES_ONLY);
-         t4c.setBackground(new Color(230,228,223));
-
-         File jdbcFile =null;
-         boolean jarFound = false;
-
-         t4c.addChoosableFileFilter(new nameFilter());
-         t4c.setAcceptAllFileFilterUsed(false);
-
-         while (true)
-         {
-            if (t4c.showDialog(InstallerGUIMode.this, "Select")
-               != JFileChooser.APPROVE_OPTION)
-            {
-               return JFileChooser.CANCEL_OPTION;  //only when user select valid dir, it can return approve_option
-            }
-            jdbcFile = t4c.getSelectedFile();
-            if (jdbcFile.getName().endsWith(".jar") && jdbcFile.canRead())
-            {
-               try
-               {
-                  ZipFile zf = new ZipFile(jdbcFile);
-                  int size = zf.size();
-                  Enumeration<?> entries = zf.entries();
-                  for (int i=0; i<size; i++)
-                  {
-                     ZipEntry entry = (ZipEntry) entries.nextElement();
-                     if (!entry.isDirectory() && entry.getName().equals(t4jdbcIdentifier))
-                     {
-                        jarFound= true;
-                        break;
-                     }
-                  }
-               } catch (Exception e)
-               {
-               }
-            }
-            if (jarFound)
-            {
-               break;
-            }
-            else
-               JOptionPane.showMessageDialog(null,"Invalid JDBC jar file specified", "Error", JOptionPane.ERROR_MESSAGE);
-         }
-         jdbcFileLoc=jdbcFile.getAbsolutePath();
-         return JFileChooser.APPROVE_OPTION;
-      }
-
-      int getTargetInstallLocation()
-      {
-         JFileChooser installDir = new JFileChooser();
-         installDir.setCurrentDirectory(new File("."));
-         installDir.setDialogTitle("Select "+productTitle+" Installation Directory ");
-         installDir.setMultiSelectionEnabled(false);
-         installDir.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
-
-
-         File installDirFile =null;
-
-         installDir.addChoosableFileFilter(new dirFilter());
-         installDir.setAcceptAllFileFilterUsed(false);
-         while (true)
-         {
-            if (installDir.showDialog(InstallerGUIMode.this, "Select")
-               != JFileChooser.APPROVE_OPTION)
-            {
-               return JFileChooser.CANCEL_OPTION;  //only when user select valid dir, it can return approve_option
-            }
-            installDirFile = installDir.getSelectedFile();
-            
-            if (installDirFile.isDirectory() && installDirFile.exists() && installDirFile.canWrite())
-            {
-               if(cardCurrent == cardLegal && !validateNCIPath(installDirFile.getAbsolutePath()))
-                   JOptionPane.showMessageDialog(null,ERROR_INVALID_NCI_DIR, "Error", JOptionPane.ERROR_MESSAGE);
-               else{    
-                   targetDirectory=installDirFile.getAbsolutePath();
-                   if (!targetDirectory.equalsIgnoreCase(wDefaultInstallDir))
-                   {
-                	   if (osName.startsWith("window"))
-                	   {
-                		   if(!targetDirectory.endsWith(("\\")))
-                			   targetDirectory +="\\";              	   
-                	   
-                	   }
-                	   else
-                	   {
-                		   if(!targetDirectory.endsWith(("/")))
-                               targetDirectory +="/";                  	   
-                    	   
-                	   }
-                	   if(cardCurrent == cardInstallerPath)
-                	       targetDirectory += productName;
-                   }
-
-                   break;
-               }
-            }
-            else
-               JOptionPane.showMessageDialog(null,"Could not find the directory specified or invalid permissions ", "Error", JOptionPane.ERROR_MESSAGE);
-         }
-         return JFileChooser.APPROVE_OPTION;
-      }
-
-      class nameFilter extends FileFilter
-      {
-
-         public boolean accept(File file)
-         {
-        	
-            boolean jarFound=false;
-            if (file.isDirectory() && file.canRead()) 
-               return true;
-
-            if (file.getName().endsWith(".jar") && file.canRead())
-            {
-               try
-               {
-                  ZipFile zf = new ZipFile(file);
-                  int size = zf.size();
-                  Enumeration<?> entries = zf.entries();
-                  for (int i=0; i<size; i++)
-                  {
-                     ZipEntry entry = (ZipEntry) entries.nextElement();
-                     if (!entry.isDirectory() && entry.getName().equals(t4jdbcIdentifier))
-                        jarFound=true;
-                  }
-               } catch (Exception e)
-               {
-               }
-            }
-            if (jarFound) return true;
-            else return false;
-         }
-
-         //The description of this filter
-         public String getDescription()
-         {
-            return "JAR File";
-         }
-      }
-
-      class dirFilter extends FileFilter
-      {
-         public boolean accept(File file)
-         {
-            if (file.exists() && file.isDirectory() && file.canWrite())
-               return true;
-            else
-               return false;
-         }
-
-         //The description of this filter
-         public String getDescription()
-         {
-            return "Installation Directory";
-         }
-      }
-
-    @SuppressWarnings("unused")
-	void process(String zipfile)
-      {
-         File currentArchive = new File(zipfile);
-         SimpleDateFormat formatter = new SimpleDateFormat ("MM/dd/yyyy hh:mma",Locale.getDefault());
-         //ProgressMonitor pm = null;
-         boolean overwrite = false;
-         ZipFile zf = null;
-         FileOutputStream out = null;
-         InputStream in = null;
-         File outputDir=new File(targetDirectory);
-         File jdbcFile=new File(jdbcFileLoc);
-
-         if (outputDir != null && !outputDir.exists())
-         {
-            outputDir.mkdirs();
-         }
-
-         try
-         {
-            zf = new ZipFile(currentArchive);
-            int size = zf.size();
-            int extracted = 0;
-
-            Enumeration<?> entries = zf.entries();
-            progressBar.setMaximum(size);
-            installLogOutput("Extracting files to " + targetDirectory);
-            
-            ArrayList<String> installerFiles = new ArrayList<String>();
-            
-            installerFiles.add("Downloader.class");
-            installerFiles.add("DownloaderError.class");
-            installerFiles.add("DownloaderTest.class"); 
-            installerFiles.add("Ebcdic2Ascii.class");
-            installerFiles.add("ControlCSignalHandler.class");
-            installerFiles.add("ControlCSignalHandler$1.class");
-            
-            for (int i=0; i<size; i++)
-            {
-               progressBar.setValue(i+1);
-               
-               ZipEntry entry = (ZipEntry) entries.nextElement();
-               if (entry.isDirectory())
-                  continue;
-
-               String pathname = entry.getName();
-               if (myClassName.equals(pathname) || MANIFEST.equals(pathname.toUpperCase()) || 
-                       pathname.startsWith(installerFilesStartWith) || installerFiles.contains(pathname))
-                  continue;
-
-               extracted ++;
-               //pm.setProgress(i);
-               //pm.setNote(pathname);
-               //if (pm.isCanceled())
-               //   return;
-
-               in = zf.getInputStream(entry);
-               File outFile = new File(outputDir, pathname);
-               Date archiveTime = new Date(entry.getTime());
-               if (overwrite==false)
-               {
-                  if (outFile.exists())
-                  {
-                     Object[] options = {"Yes", "Yes To All", "No"};
-                     String msg = checkFileExists (outFile,entry,formatter,archiveTime);
-                     int result = JOptionPane.showOptionDialog(InstallerGUIMode.this,
-                        msg, "Warning", JOptionPane.DEFAULT_OPTION,
-                        JOptionPane.WARNING_MESSAGE, null, options,options[0]);
-                     if (result == 2)
-                     { // No
-                        extracted --;
-                        continue;
-                     }
-                     else if (result == 1)
-                     { //YesToAll
-                        overwrite = true;
-                     }
-                     
-                     optComponentContainer.repaint();
-                     optComponentContainer.revalidate();
-                  }
-               }
-               handleSamplesDir(archiveTime, in, outFile, out, jdbcFile, outputDir);
-            }
-
-            handlePermission(targetDirectory);
-          
-            zf.close();
-            getToolkit().beep();
-            JOptionPane.showMessageDialog (InstallerGUIMode.this,
-               extractedMessage(extracted, zipfile, outputDir, selectedOptionalComponents()),
-               productTitle+" Installation Status"
-               ,
-               JOptionPane.INFORMATION_MESSAGE);
-            
-            optComponentContainer.repaint();
-            
-            installLogOutput("Extraction Complete: Successfully installed core TRAFCI files");
-            
-         } catch (Exception e)
-         {
-            installLogOutput("INSTALLATION ERROR:\n" + e.toString());
-             
-            System.out.println(e);
-            if (zf!=null)
-            {
-               try
-               {
-                  zf.close();
-               } catch (IOException ioe)
-               {
-                  ;
-               } 
-            }
-            if (out!=null)
-            {
-               try
-               {
-                  out.close();
-               } catch (IOException ioe)
-               {
-                  ;
-               } 
-            }
-            if (in!=null)
-            {
-               try
-               {
-                  in.close();
-               } catch (IOException ioe)
-               {
-                  ;
-               } 
-            }
-         }
-      }
-
-      public void installLogOutput(String logtext){
-          downloadTextArea.setText(downloadTextArea.getText() + "\n" + "* " + logtext);
-          downloadTextArea.setCaretPosition(downloadTextArea.getDocument().getLength());
-          downloadTextArea.paintImmediately(downloadTextArea.getVisibleRect());
-      }
-      
-      class ComboBoxListener  implements ActionListener
-      {
-          public void actionPerformed(ActionEvent event)
-          {
-              if(event.getSource() == proxyCombo)
-              {
-                  if(proxyCombo.getSelectedItem() != null)
-                  {   
-                      String tmp[] = proxyCombo.getSelectedItem().toString().split(":");
-                      if(tmp.length>1)
-                      {
-                          proxyServerText.setText(tmp[0]);
-                          proxyPortText.setText(tmp[1]);
-                      }
-                  }
-              }
-          }
-      }
-      
-      class RadioButtonListener  implements ActionListener
-      {
-          public void actionPerformed(ActionEvent event){
-              if(event.getSource() == useProxyRadio || event.getSource() == noProxyRadio){
-                  toggleProxyComponents();
-              }
-          }
-      }
-      
-      class CheckBoxListener  implements ActionListener
-      {
-          public void actionPerformed(ActionEvent event){
-              if(event.getSource() == checkPerl || event.getSource() == checkPerlSAX || event.getSource() == checkPython){
-                  
-                  perlJavaURL.setEnabled(checkPerl.isSelected());
-                  perlSAXURL.setEnabled(checkPerlSAX.isSelected());
-                  pythonJythonURL.setEnabled(checkPython.isSelected());
-                      
-                  if(!selectedOptionalComponents()){
-                      if(!standardInstall)
-                          nextButtonOptionalComponents.setEnabled(false);
-                      
-                      panelProxy.setVisible(false);
-                  }else{
-                      panelProxy.setVisible(true);
-                      nextButtonOptionalComponents.setEnabled(true);
-                  }
-              }else if(event.getSource() == checkLegal){
-                  
-                  if(checkLegal.isSelected())
-                      nextButtonLegal.setEnabled(true);
-                  else
-                      nextButtonLegal.setEnabled(false);
-                  
-                  if(!standardInstall)
-                  {
-                      if(checkLegal.isSelected()){
-                          legalPanelContainer.remove(targetSelectPanel);
-                          legalPanelContainer.add(targetSelectPanel, BorderLayout.PAGE_END);
-                          BorderLayout BL = (BorderLayout)legalPanelContainer.getLayout();
-                          BL.setHgap(20);
-                          legalPanelContainer.revalidate();
-                      }else{
-                          legalPanelContainer.remove(targetSelectPanel);
-                          legalPanelContainer.revalidate();
-                         
-                      }
-                  }
-                  
-              }
-          }
-      }
-
-      class ButtonListener  implements ActionListener
-      {
-         public void actionPerformed(ActionEvent event)
-         {
-            if (((JButton)event.getSource()).getText().equals("Cancel"))
-            {
-               System.exit(0);
-            }
-            else if (event.getSource() == nextButtonInstallerPath)
-            {  
-                if(enableOpenSource && !nextButtonInstallerPath.getText().equals("Install"))
-                    cardCurrent = cardLegal;
-                else
-                    cardCurrent = cardOptionalComponents; 
-                        
-                checkRequiredComponents.setSelected(true);
-                checkLegal.setSelected(false);
-                nextButtonLegal.setEnabled(false);
-                
-                CardLayout cl = (CardLayout)(content.getLayout());
-                cl.show(content, cardCurrent);
-                
-                if(enableOpenSource)
-                    checkLegal.requestFocusInWindow();
-                else
-                    nextButtonOptionalComponents.requestFocusInWindow();
-                
-                
-                if(nextButtonInstallerPath.getText().equals("Install")){
-                    hideOptionalComponents();
-                    new ButtonListener().actionPerformed(new ActionEvent(nextButtonOptionalComponents,0,"click"));
-                }
-            }
-            else if(event.getSource() == nextButtonOptionalComponents)
-            {
-                if(validateProxy()){
-                    panelComponentsProxyContainer.remove(panelProxy);
-                    panelComponentsProxyContainer.add(panelDownload);
-                    panelComponentsProxyContainer.revalidate();
-                    
-                    downloadTextArea.setText("Installation Log\n----------------------");
-                    downloadTextArea.setCaretPosition(downloadTextArea.getText().length());
-                    
-                    if(standardInstall)
-                    {
-                        // first install then download
-                        downloadLabel.setText("Installing Core TRAFCI Files...");
-                        String jarFileName = getJarFileName();
-                        process(jarFileName);
-                    }
-                    
-                    if(selectedOptionalComponents())
-                        SwingUtilities.invokeLater(new DownloadComponentsWrapper());
-                
-                    SwingUtilities.invokeLater(new installComplete());
-                }
-                
-            }
-            else if (event.getSource() == fileBrowseButton)
-            {
-               if (getJDBCLocation()==JFileChooser.APPROVE_OPTION)
-                  jdbcFileText.setText(jdbcFileLoc);
-               if (jdbcFileLoc != null && targetDirectory != null)
-                  nextButtonInstallerPath.setEnabled(true);
-              
-            }
-            else if (event.getSource() == dirBrowseButton)
-            {
-               if (getTargetInstallLocation()==JFileChooser.APPROVE_OPTION)
-                  targetDirText.setText(targetDirectory);
-               if (jdbcFileLoc != null && targetDirectory != null)
-                  nextButtonInstallerPath.setEnabled(true);
-            }
-            else if (event.getSource() == choiceStandardInstall)
-            {
-                /* reset defaults */
-                Color borderCol=new Color(167,160,143);
-                targetSelectPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol),"                                            "));
-                targetDirText.setText(defaultInstallDir);
-                
-                pathHolder.remove(targetSelectPanel);
-                pathHolder.add(targetSelectPanel, BorderLayout.PAGE_END);
-                pathHolder.revalidate();
-                
-                CardLayout cl = (CardLayout)(content.getLayout());
-                cardCurrent = cardInstallerPath;
-                cl.show(content, cardInstallerPath);
-                standardInstall = true;
-                
-                fileBrowseButton.requestFocusInWindow();
-            }
-            else if (event.getSource() == choiceCoreComponents)
-            {
-                /* reset defaults */
-                Color borderCol=new Color(167,160,143);
-                targetSelectPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol),"                                            "));
-                targetDirText.setText(defaultInstallDir);
-                
-                pathHolder.remove(targetSelectPanel);
-                pathHolder.add(targetSelectPanel, BorderLayout.PAGE_END);
-                pathHolder.revalidate();
-                
-                CardLayout cl = (CardLayout)(content.getLayout());
-                cardCurrent = cardInstallerPath;         
-                cl.show(content, cardInstallerPath);
-                
-                nextButtonInstallerPath.setText("Install");
-                
-                fileBrowseButton.requestFocusInWindow();
-            }
-            else if (event.getSource() == choiceOptionalButton)
-            {
-                Color borderCol=new Color(167,160,143);
-                targetSelectPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol),""));
-                
-                cardCurrent = cardLegal;
-                CardLayout cl = (CardLayout)(content.getLayout());
-                cl.show(content, cardCurrent);
-                standardInstall = false;
-                checkRequiredComponents.setSelected(false);
-                checkLegal.setSelected(false);
-                nextButtonLegal.setEnabled(false);
-                legalPanelContainer.remove(targetSelectPanel);
-                legalPanelContainer.revalidate();
-                
-                checkLegal.requestFocusInWindow();
-                
-            }
-            else if (((JButton)event.getSource()).getText().equals("Back"))
-            {
-                if(cardCurrent.equals(cardInstallerPath)){
-                    nextButtonInstallerPath.setText("Next");
-                    cardCurrent = cardInstallerChoices;
-                }else if(cardCurrent.equals(cardOptionalComponents)){
-                    if(enableOpenSource)
-                        cardCurrent = cardLegal;
-                    else
-                        cardCurrent = cardInstallerPath;
-                }
-                else if(cardCurrent.equals(cardLegal)){
-                    if(standardInstall)
-                        cardCurrent = cardInstallerPath;
-                    else
-                        cardCurrent = cardInstallerChoices;
-                }else if(cardCurrent.equals(cardInstallationComplete)){
-                    cardCurrent = cardOptionalComponents;
-                   
-                    panelComponentsProxyContainer.removeAll();
-                    setupDownloadPanel(false);
-                    panelComponentsProxyContainer.add(panelComponents);
-                    panelComponentsProxyContainer.add(panelProxy);
-                    panelComponentsProxyContainer.revalidate();
-                }
-
-                CardLayout cl = (CardLayout)(content.getLayout());
-                cl.show(content, cardCurrent);
-                
-            }
-            else if(event.getSource() == autoDetectProxy){
-                setCursor(new Cursor(Cursor.WAIT_CURSOR));
-                autoDetectProxy.setEnabled(false);
-                Downloader dl = new Downloader();
-                populateProxyComboBox(dl.findProxy());
-                autoDetectProxy.setEnabled(true);
-                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
-            
-            }
-            else if(event.getSource() == nextButtonLegal){
-                
-                if(!standardInstall && !validateNCIPath(targetDirText.getText()))
-                    JOptionPane.showMessageDialog(null, ERROR_INVALID_NCI_DIR, "Error", JOptionPane.ERROR_MESSAGE);
-                else{
-                    // if user went to optional components only screen
-                    // unchecked everything, then came back to here,
-                    // lets re-enable everything
-                    if(!nextButtonOptionalComponents.isEnabled())
-                        resetOptionalComponentsScreen();
-                    
-                    cardCurrent = cardOptionalComponents;
-                    CardLayout cl = (CardLayout)(content.getLayout());
-                    cl.show(content, cardCurrent);
-                    
-                    nextButtonOptionalComponents.requestFocusInWindow();
-                }
-            }
-            else if(event.getSource() == finishedButton){
-                System.exit(0);
-            }
-            else if(event.getSource() == dirBrowseButtonOSS){
-                if (getTargetInstallLocation()==JFileChooser.APPROVE_OPTION)
-                    ossTargetDirText.setText(targetDirectory);
-            }
-            else if(event.getSource() == perlJavaURL){
-                Object result = JOptionPane.showInputDialog(content, "URL of the Folder to Download Perl JavaServer (Java.pm, JavaArray.pm, amd JavaServer.jar):","Type a URL", JOptionPane.QUESTION_MESSAGE, null, null, defaultPerlJavaURL);
-                if(result != null && !result.toString().trim().equals("")){
-                    defaultPerlJavaURL = result.toString();
-                    /* we are looking for a folder here */
-                    if(!defaultPerlJavaURL.endsWith("/"))
-                        defaultPerlJavaURL += "/";
-                } 
-            }
-            else if(event.getSource() == perlSAXURL){
-                Object result = JOptionPane.showInputDialog(content, "URL to Download Perl SAX XML Module:                                                                                ","Type a URL", JOptionPane.QUESTION_MESSAGE, null, null, defaultPerlSAXURL);
-                if(result != null && !result.toString().trim().equals(""))
-                    defaultPerlSAXURL = result.toString();
-            }
-            else if(event.getSource() == pythonJythonURL){
-                Object result = JOptionPane.showInputDialog(content, "URL to Jython:                                                                                                                    ","Type a URL", JOptionPane.QUESTION_MESSAGE, null, null, defaultPythonJythonURL);
-                if(result != null && !result.toString().trim().equals(""))
-                    defaultPythonJythonURL = result.toString();
-            }
-            
-         }// action performed
-      }
-      
-      
-      class ProxyBox extends JComboBox
-      {
-		private static final long serialVersionUID = -1623914485707120601L;
-
-		public ProxyBox(){
-              
-          }
-          
-          public Dimension getPreferredSize(){
-              return getMaximumSize();
-          }
-          
-          public Dimension getMaximumSize(){
-              return new Dimension(260,25);
-          } 
-          
-          public Dimension getMinimumSize(){
-              return getMaximumSize();
-          }
-          
-          public Dimension getSize(){
-              return getMaximumSize();
-          }
-          
-          public Dimension getSize(Dimension arg0){
-              return getMaximumSize();
-          }
-      }
-      
-      void populateProxyComboBox(ArrayList<String> list){
-          if(list != null && proxyCombo != null)
-          {
-              proxyCombo.removeAllItems();
-              String[] tmp;
-              for(int i=0;i<list.size();i++)
-              {
-                  proxyCombo.addItem(list.get(i));
-                  if(i==0)
-                  {
-                      tmp = list.get(0).split(":");
-                      if(tmp.length>1)
-                      {
-                          proxyServerText.setText(tmp[0]);
-                          proxyPortText.setText(tmp[1]);
-                      }
-                  }
-              }
-              
-              if(list.size() > 0)
-                  proxyCombo.setVisible(true);
-              else
-                  proxyCombo.setVisible(false);
-              
-          }
-      }
-
-      void resetOptionalComponentsScreen(){
-          nextButtonOptionalComponents.setEnabled(true);
-          
-          checkPerl.setSelected(true);
-          checkPerlSAX.setSelected(true);
-          checkPython.setSelected(true);
-
-          panelComponentsProxyContainer.remove(panelDownload); 
-          panelComponentsProxyContainer.add(panelProxy);
-          panelComponentsProxyContainer.revalidate();
-          panelProxy.setVisible(true);
-          
-          noProxyRadio.setSelected(true);
-          toggleProxyComponents();
-
-      }
-      
-      void hideOptionalComponents(){
-          checkPerl.setSelected(false);
-          checkPerl.setVisible(false);
-          checkPerlSAX.setSelected(false);
-          checkPerlSAX.setVisible(false);
-          checkPython.setSelected(false);
-          checkPython.setVisible(false);
-          
-          perlJavaURL.setVisible(false);
-          perlSAXURL.setVisible(false);
-          pythonJythonURL.setVisible(false);
-      }
-      
-      void initialize(String productTitle)
-      {
-          int winWidth = 550;
-          int winHeight = 525;//475;
-    
-          content.setBackground(Color.white);
-          content.setLayout(new CardLayout());
-          content.setBackground(new Color(255,255,255));
-          
-          // Set up first window
-          setTitle(productTitle+" Installer Wizard");
-          
-          setupInstallerChoices();
-          setupLegalDisclaimer();
-          setupInstallPathPage();
-          setupOptionalComponents();
-          setupInstallationComplete();
-          
-          CardLayout cl = (CardLayout)(content.getLayout());
-          cl.show(content, cardInstallerChoices);
-          cardCurrent = cardInstallerChoices;
-          
-          //Display the window
-          pack();
-          addWindowListener(new ExitListener());
-          
-          setSize(winWidth,winHeight);
-          Dimension screen = getToolkit().getScreenSize();
-          setBounds( (screen.width-getWidth())/2, (screen.height-getHeight())/2, getWidth(), getHeight() );
-
-          setResizable(false);
-          setVisible(true);
-      }
-      
-      KeyAdapter escapeHandler = new KeyAdapter()
-      {
-         public void keyPressed(KeyEvent ke)
-         {
-            if (ke.getKeyCode() == KeyEvent.VK_ESCAPE)
-            {
-               System.exit(0);
-            }
-         }
-      };
-      
-      KeyAdapter installPathKeyHandler = new KeyAdapter()
-      {
-         public void keyPressed(KeyEvent ke)
-         {
-             if(ke.getKeyCode() == KeyEvent.VK_ENTER)
-             {
-                 if(fileBrowseButton.isFocusOwner() && jdbcFileText.getText().trim().equals(""))
-                     new ButtonListener().actionPerformed(new ActionEvent(fileBrowseButton,0,"click"));
-                 else if(dirBrowseButton.isFocusOwner())
-                     new ButtonListener().actionPerformed(new ActionEvent(dirBrowseButton,0,"click"));
-                 else if(nextButtonInstallerPath.isEnabled())
-                     new ButtonListener().actionPerformed(new ActionEvent(nextButtonInstallerPath,0,"click"));
-             }
-         }
-      };
-      
-      KeyAdapter legalKeyHandler = new KeyAdapter()
-      {
-          public void keyPressed(KeyEvent ke)
-          {
-              switch(ke.getKeyCode()){
-                  case KeyEvent.VK_ESCAPE:     System.exit(0);
-                      break;
-                  case KeyEvent.VK_ENTER:
-                          if(checkLegal.isSelected())
-                              new ButtonListener().actionPerformed(new ActionEvent(nextButtonLegal,0,"click"));
-                          else{
-                              checkLegal.setSelected(!checkLegal.isSelected());
-                              new CheckBoxListener().actionPerformed(new ActionEvent(checkLegal,0,"click"));
-                          }
-                      break;
-              }
-          }
-      };
-
-      class ExitListener extends WindowAdapter
-      {
-         public void windowClosing(WindowEvent we)
-         {
-            System.exit(0);
-         }
-      }
-      
-       void setupInstallerChoices(){
-          
-          Color bgCol=new Color(255,255,255);
-          Color borderCol=new Color(167,160,143);
-          
-          Font labelFont=new Font("SansSerif",Font.PLAIN,13);
-          Font headLabelFont=new Font(null,Font.BOLD,15);
-        
-          JPanel headPanel = new JPanel(new GridBagLayout());
- 
-          GridBagConstraints c = new GridBagConstraints();
-        
-          
-          JLabel headLabel=new JLabel("Welcome to the "+productTitle+" Installer Wizard");
-          c.fill = GridBagConstraints.PAGE_START;
-          c.gridwidth=10;
-          c.gridheight=1;
-          c.weightx = 0;
-          c.gridx = 0;
-          c.gridy = 0;
-          //c.insets = new Insets(0,30,5,0);
-          c.insets = new Insets(10,0,10,0);
-          headPanel.add(headLabel,c);
-          
-          c.fill = GridBagConstraints.HORIZONTAL;
-          
-          JLabel headLabel1=new JLabel("This wizard helps you install and configure "+productTitle +".");
-          c.gridwidth=10;
-          c.weightx = 0.0;
-          c.gridx = 0;
-          c.gridy = 1;
-          c.insets = new Insets(0,0,20,0);
-          headPanel.add(headLabel1,c);
-          
-          
-          JSeparator hRule=new JSeparator();
-          c.gridwidth=10;
-          c.weightx = 0.0;
-          c.gridx = 0;
-          c.gridy = 2;
-          c.insets = new Insets(0,0,5,0);
-          hRule.setForeground(borderCol);
-          headPanel.add(hRule,c);
-          
-          JLabel noteLabel=new JLabel("Note:");
-          c.weightx = 0.0;
-          c.gridx = 1;
-          c.gridy = 3;
-          c.gridwidth=1;
-          c.ipadx= 10;
-          c.insets = new Insets(0,50,0,20);
-          noteLabel.setFont(new Font(null,Font.BOLD,13));
-          headPanel.add(noteLabel,c);
-          
-          JLabel headLabel2=new JLabel("The wizard requires the " + NEW_JDBC);
-          c.weightx = 0.0;
-          c.gridx = 3;
-          c.gridy = 3;
-          c.ipadx =0;
-          c.gridwidth=11;
-          c.insets = new Insets(0,0,0,0);
-          headPanel.add(headLabel2,c);
-          
-          JLabel headLabel3=new JLabel("to be installed on your workstation."
-             );
-          c.weightx = 0.0;
-          c.gridx = 3;
-          c.gridy = 4;
-          c.ipadx=0;
-          c.gridwidth=4;
-          c.insets = new Insets(0,0,0,0);
-          headPanel.add(headLabel3,c);
-          
-          JSeparator hEndRule=new JSeparator();
-          c.weightx = 0.0;
-          c.gridx = 0;
-          c.gridy = 5;
-          c.gridwidth=10;
-          c.insets = new Insets(10,0,5,0);
-          headPanel.add(hEndRule,c);
-          hEndRule.setForeground(borderCol);
-          
-          
-          Color headTxtColor=new Color(000,000,000);
-          headLabel.setForeground(new Color(000,000,128));
-       
-          headLabel1.setForeground(headTxtColor);
-          headLabel2.setForeground(headTxtColor);
-          headLabel3.setForeground(headTxtColor);
-          headLabel.setFont(headLabelFont);
-          headLabel1.setFont(labelFont);
-          headLabel2.setFont(labelFont);
-          headLabel3.setFont(labelFont);
-
-          headPanel.setBackground(bgCol);
-          
-          /* button code goes here */
-          choiceStandardInstall = new JButton("Standard Installation");
-          c.fill = GridBagConstraints.HORIZONTAL;
-          c.weightx = 0.0;
-          c.gridx = 5;
-          c.gridy = 10;
-          c.gridheight = 2;
-          c.gridwidth = 2;
-          c.ipady = 15;
-          c.insets = new Insets(40,0,0,0);
-
-          headPanel.add(choiceStandardInstall, c);
-          
-          choiceCoreComponents = new JButton("Core Components");
-          c.fill = GridBagConstraints.HORIZONTAL;
-          c.weightx = 0.0;
-          c.gridx = 5;
-          c.gridy = 15;
-          c.gridheight = 2;
-          c.gridwidth = 2;
-          c.ipady = 15;
-          c.insets = new Insets(10,0,0,0);
-
-          headPanel.add(choiceCoreComponents, c);
-          
-          choiceOptionalButton = new JButton("Optional Components");
-          c.weightx = 0.0;
-          c.gridx = 5;
-          c.gridy = 20;
-          c.gridheight = 2;
-          c.gridwidth = 2;
-          c.ipady = 15;
-          c.insets = new Insets(10,0,30,0);
-          
-    
-          if(enableOpenSource)
-              headPanel.add(choiceOptionalButton, c);
-          
-          c.ipady = 0;
-
-          choiceStandardInstall.addKeyListener(
-                  new KeyAdapter()
-                  {
-                     public void keyPressed(KeyEvent ke)
-                     {
-                        if (ke.getKeyCode() == KeyEvent.VK_ESCAPE)
-                           System.exit(0);
-                        else if(ke.getKeyCode() == KeyEvent.VK_ENTER)
-                           new ButtonListener().actionPerformed(new ActionEvent(choiceStandardInstall,0,"click"));
-                     }
-                  }
-          );
-          choiceStandardInstall.addActionListener(new ButtonListener());
-          choiceCoreComponents.addActionListener(new ButtonListener());
-          choiceCoreComponents.addKeyListener(escapeHandler);
-          choiceOptionalButton.addKeyListener(escapeHandler);
-          choiceOptionalButton.addActionListener(new ButtonListener());
-          
-          getContentPane().add(headPanel, cardInstallerChoices);
-      }
-      
-       void setupInstallPathPage(){
-          
-          JPanel pathContainer = new JPanel(new BorderLayout());
-          Color bgCol=new Color(255,255,255);
-          Color borderCol=new Color(167,160,143);
-          pathContainer.setBackground(bgCol);
-          
-          
-          file_txt =new JTextField("",20);
-          fileBrowseButton=new JButton("Browse");
-          dirBrowseButton=new JButton("Browse");
-         
-          nextButtonInstallerPath=new JButton("Next");
-          JButton cancelButton=new JButton("Cancel");
-          JButton backButton=new JButton("Back");
-          statusLabel=new JLabel("Not Started");
-          
-          filechooser=new JFileChooser();
-          jdbcFileText =new JTextField("                       ",10);
-          targetDirText =new JTextField("                       ",10);
-          Font titleFont=new Font(null,Font.BOLD,13);
-          Color textCol=new Color(230,230,230);
-
-          Font labelFont=new Font("SansSerif",Font.PLAIN,13);
-          Font headLabelFont=new Font(null,Font.BOLD,15);
-        
-          JPanel headPanel = new JPanel(new GridBagLayout());
-          
-          GridBagConstraints c = new GridBagConstraints();
-        
-          
-          JLabel headLabel=new JLabel("Welcome to the "+productTitle+" Installer Wizard");
-          c.fill = GridBagConstraints.PAGE_START;
-          c.gridwidth=10;
-          c.gridheight=1;
-          c.weightx = 0;
-          c.gridx = 0;
-          c.gridy = 0;
-          //c.insets = new Insets(0,30,5,0);
-          c.insets = new Insets(10,0,10,0);
-          headPanel.add(headLabel,c);
-          
-          c.fill = GridBagConstraints.HORIZONTAL;
-          
-          JLabel headLabel1=new JLabel("This wizard helps you install and configure "+productTitle +".");
-          c.gridwidth=10;
-          c.weightx = 0.0;
-          c.gridx = 0;
-          c.gridy = 1;
-          c.insets = new Insets(0,0,20,0);
-          headPanel.add(headLabel1,c);
-          
-          
-          JSeparator hRule=new JSeparator();
-          c.gridwidth=10;
-          c.weightx = 0.0;
-          c.gridx = 0;
-          c.gridy = 2;
-          c.insets = new Insets(0,0,5,0);
-          hRule.setForeground(borderCol);
-          headPanel.add(hRule,c);
-          
-          JLabel noteLabel=new JLabel("Note:");
-          c.weightx = 0.0;
-          c.gridx = 1;
-          c.gridy = 3;
-          c.gridwidth=1;
-          c.ipadx= 10;
-          c.insets = new Insets(0,50,0,20);
-          noteLabel.setFont(new Font(null,Font.BOLD,13));
-          headPanel.add(noteLabel,c);
-          
-          JLabel headLabel2=new JLabel("The wizard requires the " + NEW_JDBC + " ");
-          c.weightx = 0.0;
-          c.gridx = 3;
-          c.gridy = 3;
-          c.ipadx =0;
-          c.gridwidth=11;
-          c.insets = new Insets(0,0,0,0);
-          headPanel.add(headLabel2,c);
-          
-          JLabel headLabel3=new JLabel("to be installed on your workstation."
-             );
-          c.weightx = 0.0;
-          c.gridx = 3;
-          c.gridy = 4;
-          c.ipadx=0;
-          c.gridwidth=4;
-          c.insets = new Insets(0,0,0,0);
-          headPanel.add(headLabel3,c);
-          
-          JSeparator hEndRule=new JSeparator();
-          c.weightx = 0.0;
-          c.gridx = 0;
-          c.gridy = 5;
-          c.gridwidth=10;
-          c.insets = new Insets(10,0,5,0);
-          headPanel.add(hEndRule,c);
-          hEndRule.setForeground(borderCol);
-    
-          Color headTxtColor=new Color(000,000,000);
-          headLabel.setForeground(new Color(000,000,128));
-       
-          headLabel1.setForeground(headTxtColor);
-          headLabel2.setForeground(headTxtColor);
-          headLabel3.setForeground(headTxtColor);
-          headLabel.setFont(headLabelFont);
-          headLabel1.setFont(labelFont);
-          headLabel2.setFont(labelFont);
-          headLabel3.setFont(labelFont);
-
-          headPanel.setBackground(bgCol);
-          
-          pathContainer.add(headPanel, BorderLayout.PAGE_START);
-          /****************/
-          JPanel pathInternalContainer = new JPanel(new GridBagLayout());
-          /****************/
-          
-          /************************************************************/
-          GridLayout gl = new GridLayout(2,1);
-          gl.setVgap(-10);
-          
-          pathHolder = new JPanel(gl);
-          pathHolder.setBackground(bgCol);
-          
-          /************************************************************/
-          
-          JPanel jdbcFilePanel = new JPanel(new GridBagLayout());
-
-          c.weightx = 0.0;
-          c.gridx = 0;
-          c.gridy = 0;
-          c.ipadx = 0;
-          c.ipady = 0;
-          c.gridwidth = 3;
-          c.insets = new Insets(10,20,0,0);
-          
-          JLabel jdbcFileLabel=new JLabel(NEW_JDBC + ":");
-          jdbcFileLabel.setFont(titleFont);
-          fileBrowseButton.addActionListener(new ButtonListener());
-          fileBrowseButton.addKeyListener(escapeHandler);
-          fileBrowseButton.addKeyListener(installPathKeyHandler);
-         
-          jdbcFilePanel.setBackground(Color.white);
-          jdbcFilePanel.add(jdbcFileLabel,c);
-          c.weightx = 0.5;
-          c.gridx = 1;
-          c.gridy = 1;
-          c.gridwidth = 1;
-          c.insets = new Insets(0,20,10,0);
-          c.ipadx=375;
-          jdbcFilePanel.add(jdbcFileText,c);
-          
-          jdbcFileText.setCaretPosition(jdbcFileText.getColumns());
-          jdbcFileText.addKeyListener(new KeyAdapter()
-          {
-             public void keyPressed(KeyEvent ke)
-             {
-                if (ke.getKeyCode() == KeyEvent.VK_ESCAPE)
-                   System.exit(0);
-
-                if (ke.getKeyCode() == KeyEvent.VK_RIGHT)
-                {
-                   int currentPos = jdbcFileText.getCaretPosition();
-                   if (currentPos < jdbcFileText.getDocument().getLength()) jdbcFileText.setCaretPosition(currentPos+1);
-                }
-             }
-          });
-
-          jdbcFileText.setBackground(textCol);
-          jdbcFileText.setEditable(false);
-          c.weightx = 0.5;
-          c.gridx = 2;
-          c.gridy = 1;
-          c.gridwidth = 1;
-          c.insets = new Insets(0,10,10,40);
-          c.ipadx=75;
-          jdbcFilePanel.add(fileBrowseButton,c);
-          jdbcFilePanel.setSize(500,80);
-          jdbcFilePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol)," Select these locations, and then click Next."));
-          
-          pathHolder.add(jdbcFilePanel);
-          /************************************************************/
-         
-          targetSelectPanel = new JPanel(new GridBagLayout());
-          c.weightx = 0.0;
-          c.gridx = 0;
-          c.gridy = 0;
-          c.gridwidth = 3;
-          c.insets = new Insets(10,20,0,0);
-          JLabel targetDirLabel=new JLabel(productTitle+" installation directory:");
-          targetDirLabel.setFont(titleFont);
-          jdbcFilePanel.setLocation(25,175);
-          jdbcFilePanel.setBackground(bgCol);
-          targetSelectPanel.setBackground(Color.white);
-          targetSelectPanel.add(targetDirLabel,c);
-          c.weightx = 0.5;
-          c.gridx = 1;
-          c.gridy = 1;
-          c.gridwidth = 1;
-          c.insets = new Insets(0,20,10,0);
-          c.ipadx=375;
-
-          targetSelectPanel.add(targetDirText,c);
-          targetDirectory = defaultInstallDir;
-          targetDirText.setText(defaultInstallDir);
-          targetDirText.setCaretPosition(targetDirText.getColumns());
-          targetDirText.addKeyListener(new KeyAdapter()
-          {
-             public void keyPressed(KeyEvent ke)
-             {
-                if (ke.getKeyCode() == KeyEvent.VK_ESCAPE)
-                   System.exit(0);
-                if (ke.getKeyCode() == KeyEvent.VK_RIGHT)
-                {
-                   int currentPos = targetDirText.getCaretPosition();
-                   if (currentPos < targetDirText.getDocument().getLength()) targetDirText.setCaretPosition(currentPos+1);
-                }
-             }
-          });
-
-          targetDirText.setBackground(textCol);
-          targetDirText.setEditable(false);
-          c.weightx = 0.5;
-          c.gridx = 2;
-          c.gridy = 1;
-          c.gridwidth = 1;
-          c.insets = new Insets(0,10,10,40);
-          c.ipadx=75;
-          targetSelectPanel.add(dirBrowseButton,c);
-          dirBrowseButton.addActionListener(new ButtonListener());
-          dirBrowseButton.addKeyListener(escapeHandler);
-          dirBrowseButton.addKeyListener(installPathKeyHandler);
-          targetSelectPanel.setSize(500,100);
-
-          targetSelectPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol),"                                            "));
-          
-          targetSelectPanel.setBackground(bgCol);
-
-          pathHolder.add(targetSelectPanel);
-          targetSelectPanel.setLocation(25,265);
-
-          /************************************************************/
-          //pathContainer.add(pathHolder, BorderLayout.CENTER);
-
-          c.gridwidth = 450;
-          c.gridheight = 100;
-          c.insets = new Insets(0,25,0,25);
-          c.ipady = 28;
-          pathInternalContainer.setBackground(bgCol);
-          pathInternalContainer.add(pathHolder,c);
-          pathContainer.add(pathInternalContainer, BorderLayout.CENTER);
-          /************************************************************/
-          
-          JPanel controlPanel = new JPanel();
-          controlPanel.add(backButton);
-          backButton.addActionListener(new ButtonListener());
-          backButton.addKeyListener(escapeHandler);
-          controlPanel.add(cancelButton);
-          cancelButton.addActionListener(new ButtonListener());
-          cancelButton.addKeyListener(escapeHandler);
-          controlPanel.add(nextButtonInstallerPath);
-          nextButtonInstallerPath.addActionListener(new ButtonListener());
-          nextButtonInstallerPath.addKeyListener(installPathKeyHandler);
-          nextButtonInstallerPath.addKeyListener(escapeHandler);
-          nextButtonInstallerPath.setEnabled(false);
-          
-          controlPanel.setSize(500,50);
-          controlPanel.setLocation(25,385);
-          controlPanel.setBackground(bgCol);
-          
-          pathContainer.add(controlPanel, BorderLayout.SOUTH);
-          /************************************************************/
-          
-          getContentPane().add(pathContainer, cardInstallerPath);
-
-       }
-     
-       void setupOptionalComponents(){
-
-           optComponentContainer = new JPanel(new BorderLayout());
-           
-           Color bgCol=new Color(255,255,255);
-           Color borderCol=new Color(167,160,143);
-           
-           Font labelFont=new Font("SansSerif",Font.PLAIN,13);
-           Font headLabelFont=new Font(null,Font.BOLD,15);
-         
-           /****************** Header Panel ***********************************/
-           JPanel headPanel = new JPanel(new GridBagLayout());
-  
-           GridBagConstraints c = new GridBagConstraints();
-         
-           
-           JLabel headLabel=new JLabel("Welcome to the "+productTitle+" Installer Wizard");
-           c.fill = GridBagConstraints.PAGE_START;
-           c.gridwidth=10;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 0;
-           c.gridy = 0;
-           
-           c.insets = new Insets(10,0,10,0);
-           headPanel.add(headLabel,c);
-           
-           c.fill = GridBagConstraints.HORIZONTAL;
-           
-           JLabel headLabel1=new JLabel("This wizard helps you install and configure "+productTitle +".");
-           c.gridwidth=10;
-           c.weightx = 0.0;
-           c.gridx = 0;
-           c.gridy = 1;
-           c.insets = new Insets(0,0,20,0);
-           headPanel.add(headLabel1,c);
-           
-           
-           JSeparator hRule=new JSeparator();
-           c.gridwidth=10;
-           c.weightx = 0.0;
-           c.gridx = 0;
-           c.gridy = 2;
-           c.insets = new Insets(0,0,5,0);
-           hRule.setForeground(borderCol);
-           headPanel.add(hRule,c);
-   
- 
-           Color headTxtColor=new Color(000,000,000);
-           headLabel.setForeground(new Color(000,000,128));
-        
-           headLabel1.setForeground(headTxtColor);
-
-           headLabel.setFont(headLabelFont);
-           headLabel1.setFont(labelFont);
-
-           headPanel.setBackground(bgCol);
-           
-           optComponentContainer.add(headPanel, BorderLayout.PAGE_START); 
-           /***** New Panel w/ Options *********************************/
-           
-           GridLayout gl = new GridLayout(2,1);
-           panelComponentsProxyContainer = new JPanel(gl);
-           gl.setVgap(10);
-
-           panelComponents = new JPanel(new GridBagLayout());
-      
-           c = new GridBagConstraints();    // reset c
-           c.fill = GridBagConstraints.HORIZONTAL;
-           c.anchor = GridBagConstraints.NORTH;
-  
-           JLabel componentsLabel=new JLabel("Please check the components you wish to download and install:");
-           c.gridwidth=13;
-           c.weightx = 0.0;
-           c.gridx = 0;
-           c.gridy = 0;
-           c.insets = new Insets(0,0,5,0);
-           panelComponents.add(componentsLabel,c);
-           
-           checkRequiredComponents = new JCheckBox("Core " + productTitle + " Components");
-           c.gridwidth=10;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 1;
-           c.gridy = 1;
-           
-           c.insets = new Insets(5,0,5,0);
-           panelComponents.add(checkRequiredComponents,c);
- 
-       
-           
-           checkPerl = new JCheckBox("Perl JavaServer extension");
-           c.gridwidth=5;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 1;
-           c.gridy = 2;
-           
-           c.insets = new Insets(5,0,5,0);
-           
-           if(enableOpenSource)
-               panelComponents.add(checkPerl,c);
-           
-           
-           perlJavaURL = new JButton("Edit URL");
-           c.gridwidth = 1;
-           c.gridheight = 1;
-           c.gridx = 0;
-           c.gridy = 2;
-           c.insets = new Insets(8,0,0,5);
-           c.ipady = -5;
-           if(enableOpenSource)
-               panelComponents.add(perlJavaURL,c);
-                      
-           
-           checkPerlSAX = new JCheckBox("Perl XML SAX Module");
-           c.gridwidth=5;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 1;
-           c.gridy = 3;
-           c.ipady =0;
-           //c.insets = new Insets(0,30,5,0);
-           c.insets = new Insets(5,0,5,0);
-           
-           if(enableOpenSource)
-               panelComponents.add(checkPerlSAX,c);
-           
-           perlSAXURL = new JButton("Edit URL");
-           c.gridwidth = 1;
-           c.gridheight = 1;
-           c.gridx = 0;
-           c.gridy = 3;
-           c.ipady = -5;
-           c.insets = new Insets(8,0,0,5);
-           
-           if(enableOpenSource)
-               panelComponents.add(perlSAXURL,c);
-           
-           
-           checkPython = new JCheckBox("Jython, a Java implementation of Python");
-           c.gridwidth=8;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 1;
-           c.gridy = 4;
-           c.ipady =0;
-           c.insets = new Insets(5,0,5,0);
-               
-           if(enableOpenSource)
-               panelComponents.add(checkPython,c);
-
-
-           pythonJythonURL = new JButton("Edit URL");
-           c.gridwidth = 1;
-           c.gridheight = 1;
-           c.gridx = 0;
-           c.gridy = 4;
-           c.ipady = -5;
-           c.insets = new Insets(8,0,0,5);
-           
-           if(enableOpenSource)
-               panelComponents.add(pythonJythonURL,c);
-           
-           checkRequiredComponents.setSelected(true);
-           
-           if(enableOpenSource){
-               checkPerl.setSelected(true);
-               checkPerlSAX.setSelected(true);
-               checkPython.setSelected(true);
-           }
-           
-           checkPerl.addActionListener(new CheckBoxListener());
-           checkPerl.addKeyListener(escapeHandler);
-           checkPerlSAX.addActionListener(new CheckBoxListener());
-           checkPerlSAX.addKeyListener(escapeHandler);
-           checkPython.addActionListener(new CheckBoxListener());
-           checkPython.addKeyListener(escapeHandler);
-           perlJavaURL.addActionListener(new ButtonListener());
-           perlJavaURL.addKeyListener(escapeHandler);
-           perlSAXURL.addActionListener(new ButtonListener());
-           perlSAXURL.addKeyListener(escapeHandler);
-           pythonJythonURL.addActionListener(new ButtonListener());
-           pythonJythonURL.addKeyListener(escapeHandler);
-           
-           checkRequiredComponents.setEnabled(false);
-           checkRequiredComponents.setBackground(bgCol);
-           checkPerl.setBackground(bgCol);
-           checkPerlSAX.setBackground(bgCol);
-           checkPython.setBackground(bgCol);
-           
-           panelComponents.setBackground(bgCol);
-           panelComponents.setFont(labelFont);
-           componentsLabel.setFont(headLabelFont);
-        
-           
-           /************** proxy panel ***********/
-           panelProxy = new JPanel(new GridBagLayout());
-           
-           c = new GridBagConstraints();    // reset c
-           c.fill = GridBagConstraints.HORIZONTAL;
-           c.anchor = GridBagConstraints.NORTH;
-
-           noProxyRadio = new JRadioButton("Do not use a proxy server.");
-           c.gridwidth=5;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 0;
-           c.gridy = 0;
-           
-           if(enableOpenSource)
-               panelProxy.add(noProxyRadio,c);
-           
-           useProxyRadio = new JRadioButton("Use the following proxy settings:");
-           c.gridwidth=7;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 0;
-           c.gridy = 2;
-           
-           if(enableOpenSource)
-               panelProxy.add(useProxyRadio,c);
-           
-           JLabel blankLabel = new JLabel("              ");
-           c.gridwidth=4;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 0;
-           c.gridy = 3;
-           panelProxy.add(blankLabel,c);
-           
-           proxyServerLabel=new JLabel("Proxy Server: ");
-           c.gridwidth=4;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 0;
-           c.gridy = 4;
-           
-           if(enableOpenSource)
-               panelProxy.add(proxyServerLabel,c);
-                   
-           proxyServerText = new JTextField("",10);
-           c.gridwidth=10;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 5;
-           c.gridy = 4;
-           
-           if(enableOpenSource)
-               panelProxy.add(proxyServerText,c);
-           
-           proxyPortLabel=new JLabel("Proxy Port: ");
-           c.gridwidth=4;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 0;
-           c.gridy = 5;
-           
-           if(enableOpenSource)
-               panelProxy.add(proxyPortLabel,c);
-           
-           proxyPortText = new JTextField("",4);
-           c.gridwidth=5;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 5;
-           c.gridy = 5;
-           
-           if(enableOpenSource)
-               panelProxy.add(proxyPortText,c);
-           
-           autoDetectProxy = new JButton("Detect Proxy Server(s)");
-           c.gridwidth=5;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 0;
-           c.gridy = 6;
-           c.insets = new Insets(0,0,8,0);
-           
-           if(enableOpenSource)
-               panelProxy.add(autoDetectProxy,c);
-             
-           proxyCombo = new ProxyBox();
-           c.gridwidth=4;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 7;
-           c.gridy = 6;
-           c.insets = new Insets(0,0,8,0);
-                      
-           if(enableOpenSource)
-               panelProxy.add(proxyCombo,c);
-           
-           proxyButtonGroup = new ButtonGroup();
-           proxyButtonGroup.add(noProxyRadio);
-           proxyButtonGroup.add(useProxyRadio);
-           noProxyRadio.setSelected(true);
-           
-           toggleProxyComponents();
-           
-           proxyCombo.setBackground(bgCol);
-           noProxyRadio.setBackground(bgCol);
-           useProxyRadio.setBackground(bgCol);
-           
-           autoDetectProxy.addActionListener(new ButtonListener());
-           autoDetectProxy.addKeyListener(escapeHandler);
-           proxyCombo.addActionListener(new ComboBoxListener());
-           proxyCombo.addKeyListener(escapeHandler);
-           noProxyRadio.addActionListener(new RadioButtonListener());
-           noProxyRadio.addKeyListener(escapeHandler);
-           useProxyRadio.addActionListener(new RadioButtonListener());
-           useProxyRadio.addKeyListener(escapeHandler);
-           
-           panelProxy.setSize(500,100);
-           
-           if(enableOpenSource)
-               panelProxy.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(borderCol),"Proxy Settings"));
-       
-           panelProxy.setBackground(bgCol);
-           /**************************************/
-           
-           /**************************************/
-           setupDownloadPanel(false);
-           /**************************************/
-           
-           panelComponentsProxyContainer.add(panelComponents);
-           
-           panelComponentsProxyContainer.add(panelProxy);
-           Border margin = new EmptyBorder(0, 10, 0, 10);
-           panelComponentsProxyContainer.setBorder(margin);
-           
-           panelComponentsProxyContainer.setBackground(bgCol);
-           optComponentContainer.add(panelComponentsProxyContainer, BorderLayout.CENTER);
-           /***********************************************************/
-           
-           JPanel panelButtons = new JPanel(new GridBagLayout());
-           c = new GridBagConstraints();    // reset c
-           c.fill = GridBagConstraints.HORIZONTAL;
-           c.anchor = GridBagConstraints.NORTH;
- 
-           c.gridx = 0;
-           c.gridy = 0;
-           JLabel blankLabelBottom = new JLabel(" ");
-           panelButtons.add(blankLabelBottom, c);
- 
-           c.gridy = 1;
-           JButton backButton = new JButton("Back");
-           JButton cancelButton = new JButton("Cancel");
-           nextButtonOptionalComponents = new JButton("Install");
-           
-           c.insets = new Insets(0,0,5,5);
-           panelButtons.add(backButton, c);
-           c.gridx = 1;
-           panelButtons.add(cancelButton, c);
-           c.gridx = 2;
-           panelButtons.add(nextButtonOptionalComponents, c);
-           
-           backButton.addActionListener(new ButtonListener());
-           backButton.addKeyListener(escapeHandler);
-           cancelButton.addActionListener(new ButtonListener());
-           cancelButton.addKeyListener(escapeHandler);
-           nextButtonOptionalComponents.addActionListener(new ButtonListener());
-           nextButtonOptionalComponents.addKeyListener(
-                   new KeyAdapter(){
-                       public void keyPressed(KeyEvent ke)
-                       {
-                           switch(ke.getKeyCode()){
-                               case KeyEvent.VK_ESCAPE:     System.exit(0);
-                                   break;
-                               case KeyEvent.VK_ENTER:      new ButtonListener().actionPerformed(new ActionEvent(nextButtonOptionalComponents,0,"click"));
-                                   break;
-                           }
-                       }
-                   }
-           );
-           
-           panelButtons.setBackground(bgCol);
-                     
-           optComponentContainer.add(panelButtons, BorderLayout.PAGE_END);
-           /***********************************************************/
-           
-           getContentPane().add(optComponentContainer, cardOptionalComponents);
-           
-           /***********************************************************/
-       }
-       
-       void setupDownloadPanel(boolean installComplete){
-           GridBagConstraints c = new GridBagConstraints();
-           Color bgCol=new Color(255,255,255);
-           
-           panelDownload = new JPanel(new GridBagLayout());
-           
-           c = new GridBagConstraints();    // reset c
-           c.fill = GridBagConstraints.HORIZONTAL;
-           c.anchor = GridBagConstraints.NORTH;
-           
-           if(!installComplete)
-               downloadLabel = new JLabel("Downloading: ");
-                     
-           c.gridwidth=20;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 1;
-           c.gridy = 0;
-           panelDownload.add(downloadLabel,c);     
-           
-           progressBar = new JProgressBar();
-           c.gridwidth=20;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 1;
-           c.gridy = 3;
-           //c.ipadx = 130;
-           
-           if(installComplete)
-               progressBar.setValue(100);
-           
-           panelDownload.add(progressBar,c);
-           
-           c.ipadx = 475;
-           if(!installComplete){
-               downloadTextArea = new JTextArea("");
-               c.ipady = 100;
-           }else
-               c.ipady = 250;
-           
-           c.gridwidth=20;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 1;
-           c.gridy = 7;
-           
-           JScrollPane scrollPane = new JScrollPane(downloadTextArea);
-           panelDownload.add(scrollPane, c);
-           
-           downloadTextArea.setColumns(15);
-           downloadTextArea.setLineWrap(true);
-           downloadTextArea.setRows(7);
-           downloadTextArea.setWrapStyleWord(true);
-           downloadTextArea.setEditable(false);
-           downloadTextArea.setMargin(new Insets(5,5,5,5));
-           if(!installComplete)
-               progressBar.addChangeListener(new pbChangeListener());
-           
-           downloadLabel.setBounds(new Rectangle(500,100));
-           
-           panelDownload.setBackground(bgCol);
-       }
-       
-       void setupLegalDisclaimer(){
-
-           JPanel legalContainer = new JPanel(new BorderLayout());
-           
-           Color bgCol=new Color(255,255,255);
-           Color borderCol=new Color(167,160,143);
-           
-           Font labelFont=new Font("SansSerif",Font.PLAIN,13);
-           Font headLabelFont=new Font(null,Font.BOLD,15);
-         
-           /****************** Header Panel ***********************************/
-           JPanel headPanel = new JPanel(new GridBagLayout());
-  
-           GridBagConstraints c = new GridBagConstraints();
-         
-           
-           JLabel headLabel=new JLabel("Welcome to the "+productTitle+" Installer Wizard");
-           c.fill = GridBagConstraints.PAGE_START;
-           c.gridwidth=10;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 0;
-           c.gridy = 0;
-           
-           c.insets = new Insets(10,0,10,0);
-           headPanel.add(headLabel,c);
-           
-           c.fill = GridBagConstraints.HORIZONTAL;
-           
-           JLabel headLabel1=new JLabel("This wizard helps you install and configure "+productTitle +".");
-           c.gridwidth=10;
-           c.weightx = 0.0;
-           c.gridx = 0;
-           c.gridy = 1;
-           c.insets = new Insets(0,0,20,0);
-           headPanel.add(headLabel1,c);
-           
-           
-           JSeparator hRule=new JSeparator();
-           c.gridwidth=10;
-           c.weightx = 0.0;
-           c.gridx = 0;
-           c.gridy = 2;
-           c.insets = new Insets(0,0,5,0);
-           hRule.setForeground(borderCol);
-           headPanel.add(hRule,c);
-   
- 
-           Color headTxtColor=new Color(000,000,000);
-           headLabel.setForeground(new Color(000,000,128));
-        
-           headLabel1.setForeground(headTxtColor);
-
-           headLabel.setFont(headLabelFont);
-           headLabel1.setFont(labelFont);
-
-           headPanel.setBackground(bgCol);
-           
-           legalContainer.add(headPanel, BorderLayout.PAGE_START); 
-        
-           /***** New Panel w/ Options *********************************/
-           Border margin = new EmptyBorder(8, 20, 15, 20);
-           legalPanelContainer = new JPanel(new BorderLayout());
-           legalPanelContainer.setBorder(margin);
-           
-           JPanel legalPanel = new JPanel(new GridBagLayout());
-           
-           c = new GridBagConstraints();    // reset c
-           c.fill = GridBagConstraints.HORIZONTAL;
-           c.anchor = GridBagConstraints.NORTH;
-  
-           JLabel componentsLabel=new JLabel("Open Source Legal Disclaimer:");
-           c.gridwidth=13;
-           c.weightx = 0.0;
-           c.gridx = 0;
-           c.gridy = 0;
-           c.insets = new Insets(0,0,5,0);
-           legalPanel.add(componentsLabel,c);
-           
-           JTextArea disclaimerText = new JTextArea("The ability to download open source extensions is provided for your convenience only. Software provided under any open source licensing model is governed solely by such open source licensing terms.");
-           c.gridheight = 15;
-           c.gridwidth=20;
-           c.ipadx = 150;
-           c.weightx = 0.0;
-           c.gridx = 0;
-           c.gridy = 2;
-           
-           disclaimerText.setMargin(new Insets(5,5,5,5));
-           JScrollPane scrollPane = new JScrollPane(disclaimerText);
-           legalPanel.add(scrollPane, c);
-           
-           checkLegal = new JCheckBox("I agree to the above Terms & Conditions");
-           c.gridwidth=10;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 0;
-           c.gridy = 18;
-           c.insets = new Insets(5,0,12,0);
-           legalPanel.add(checkLegal,c);
-           
-           disclaimerText.setColumns(20);
-           disclaimerText.setLineWrap(true);
-           disclaimerText.setRows(12);
-           disclaimerText.setWrapStyleWord(true);
-           disclaimerText.setEditable(false);
-           
-           legalPanel.setBackground(bgCol);
-           checkLegal.setBackground(bgCol);
-           
-           legalPanelContainer.add(legalPanel, BorderLayout.CENTER);
-           legalPanelContainer.setBackground(bgCol);
-           legalContainer.add(legalPanelContainer, BorderLayout.CENTER); 
-           /***********************************************************/
-           
-           JPanel panelButtons = new JPanel();
-           JButton backButton = new JButton("Back");
-           JButton cancelButton = new JButton("Cancel");
-           nextButtonLegal = new JButton("Next");
-           nextButtonLegal.setEnabled(false);
-           
-           panelButtons.add(backButton);
-           panelButtons.add(cancelButton);
-           panelButtons.add(nextButtonLegal);
-           
-           backButton.addActionListener(new ButtonListener());
-           backButton.addKeyListener(escapeHandler);
-           cancelButton.addActionListener(new ButtonListener());
-           cancelButton.addKeyListener(escapeHandler);
-           nextButtonLegal.addActionListener(new ButtonListener());
-           nextButtonLegal.addKeyListener(legalKeyHandler);
-           checkLegal.addActionListener(new CheckBoxListener());
-           checkLegal.addKeyListener(legalKeyHandler);
-           panelButtons.setBackground(bgCol);
-           legalContainer.add(panelButtons, BorderLayout.PAGE_END);
-           /***********************************************************/
-           
-           getContentPane().add(legalContainer, cardLegal);
-           
-           /***********************************************************/
-       }
-       
-       void setupInstallationComplete(){
-
-           finishedContainer = new JPanel(new BorderLayout());
-           
-           Color bgCol=new Color(255,255,255);
-           Font headLabelFont=new Font(null,Font.BOLD,15);
-         
-           /****************** Header Panel ***********************************/
-           headPanelFinished = new JPanel(new GridBagLayout());
-  
-           GridBagConstraints c = new GridBagConstraints();
-         
-           
-           JLabel headLabel=new JLabel(productTitle+" Installation Wizard Complete");
-           c.fill = GridBagConstraints.PAGE_START;
-           c.gridwidth=10;
-           c.gridheight=1;
-           c.weightx = 0;
-           c.gridx = 0;
-           c.gridy = 0;
-           
-           c.insets = new Insets(10,0,10,0);
-           headPanelFinished.add(headLabel,c);
-           headPanelFinished.setBackground(bgCol);
-           headLabel.setFont(headLabelFont);
-           
-           /************************/
-           controlPanelFinished = new JPanel();
-           finishedButton = new JButton("Exit");
-           controlPanelFinished.add(finishedButton);
-           finishedButton.addActionListener(new ButtonListener());
-           finishedButton.addKeyListener(
-                      new KeyAdapter(){ 
-                          public void keyPressed(KeyEvent ke){
-                              if(ke.getKeyCode() == KeyEvent.VK_ENTER || ke.getKeyCode() == KeyEvent.VK_ESCAPE)
-                                  System.exit(0);
-                          }
-                      }
-           );
-           controlPanelFinished.setBackground(bgCol);
-          
-           /**************************/
-           // middle panel will be panelDownload
-           
-           getContentPane().add(finishedContainer, cardInstallationComplete);
-       }
-       
-       void toggleProxyComponents(){
-           boolean val = useProxyRadio.isSelected();
-           proxyServerText.setVisible(val);
-           proxyPortText.setVisible(val);
-           autoDetectProxy.setVisible(val);
-           proxyServerLabel.setVisible(val);
-           proxyPortLabel.setVisible(val);
-           
-           if(proxyCombo.getItemCount()>0 && val)
-               proxyCombo.setVisible(val);
-           else {
-        	   proxyCombo.setVisible(false);
-        	   /*
-        	    * Fix for bug#3280: reset the proxy server and port fields when no
-        	    * proxy is selected
-        	    */
-        	   proxyServerText.setText("");
-        	   proxyPortText.setText("");
-           }
-       }
-       
-       boolean validateProxy()
-       {
-           if(useProxyRadio.isSelected() && panelProxy.isVisible() && selectedOptionalComponents())
-           {
-               if(!proxyServerText.getText().trim().equals("") && !proxyPortText.getText().trim().equals("")){
-                   try{
-                       Integer.parseInt(proxyPortText.getText());
-                       return true;
-                   }catch (NumberFormatException ex){
-                       JOptionPane.showMessageDialog(this,"Enter a valid proxy server and port to continue.");
-                       return false;
-                   }
-               }else{
-                   JOptionPane.showMessageDialog(this,"Enter a valid proxy server and port to continue.");
-                   return false;
-               }
-           }
-           else
-           {
-               return true;
-           }    
-       }
-
-       boolean selectedOptionalComponents(){
-           return (checkPerl.isSelected() || checkPerlSAX.isSelected() || checkPython.isSelected());
-       }
-       
-       class installComplete implements Runnable{
-           
-           public void run(){
-               /* Installation Complete */
-               downloadLabel.setText("Installation Complete");
-               
-               finishedContainer.removeAll();
-               finishedContainer.add(headPanelFinished, BorderLayout.PAGE_START);
-               
-               setupDownloadPanel(true);
-               panelDownload.revalidate();
-               
-               if(downloadError){
-                   // show back button
-                   controlPanelFinished.removeAll();
-                   JButton backButton=new JButton("Back");
-                   backButton.addActionListener(new ButtonListener());
-                   backButton.addKeyListener(escapeHandler);
-                   controlPanelFinished.add(backButton);
-                   controlPanelFinished.add(finishedButton);
-               }else{
-                   controlPanelFinished.removeAll();
-                   controlPanelFinished.add(finishedButton);
-               }
-                     
-               finishedContainer.add(controlPanelFinished, BorderLayout.PAGE_END);
-               finishedContainer.revalidate();
-               finishedContainer.add(panelDownload, BorderLayout.CENTER);
-               
-               cardCurrent = cardInstallationComplete;
-               CardLayout cl = (CardLayout)(content.getLayout());
-               cl.show(content, cardCurrent);
-               
-               finishedButton.requestFocusInWindow();
-           }
-       }
-       
-       class DownloadComponentsWrapper implements Runnable{
-           
-           public DownloadComponentsWrapper(){
-           }
-           
-           public void run(){
-               downloadOptionalComponents();
-           }
-           
-           void downloadOptionalComponents(){
-               downloadError = false;
-               ArrayList<String[]> fileList = new ArrayList<String[]>();
-
-               if(checkPerl.isSelected()){
-                   fileList.add(new String[]{"Perl","Java.pm", defaultPerlJavaURL + "Java.pm"});
-                   fileList.add(new String[]{"Perl","JavaArray.pm", defaultPerlJavaURL + "JavaArray.pm"});
-                   fileList.add(new String[]{"Perl","JavaServer.jar", defaultPerlJavaURL + "JavaServer.jar"});
-               }
-               
-               File saxDir = new File(targetDirectory + File.separator + "lib" + File.separator + "perl" + File.separator + "XML" + File.separator + "Parser");
-               if(checkPerlSAX.isSelected()){
-                   fileList.add(new String[]{"Perl SAX","PerlSAX.pm", defaultPerlSAXURL});
-                   File installDir = new File(targetDirectory);
-                                 
-                   if(installDir.exists() && !saxDir.exists())
-                       saxDir.mkdirs();
-                   
-               }
-               
-               if(checkPython.isSelected())
-                   fileList.add(new String[]{"Python","jython_installer-2.2.jar", defaultPythonJythonURL});
-               
-               Downloader dl = new Downloader(targetDirectory);
-               
-               progressBar.setMaximum(100);
-               progressBar.setMinimum(0);
-               
-               dl.setProxy(proxyServerText.getText(), proxyPortText.getText());
-               dl.setProgressBar(progressBar);
-               
-               String[] tmp;
-               String libDir = targetDirectory + File.separator + "lib";
-               for(int i=0; i<fileList.size(); i++){
-                   tmp = (String[])fileList.get(i);
-                   
-                   downloadLabel.setText("Downloading: " + tmp[0] + " - " + tmp[1]);
-                   if(i==0)
-                       panelDownload.revalidate();
-                   
-                   panelDownload.paintImmediately(panelDownload.getVisibleRect());
-                  
-                   if(tmp[0].equalsIgnoreCase("Perl"))
-                       dl.setFilename(libDir + File.separator + "perl" + File.separator + tmp[1]);
-                   else if(tmp[0].equalsIgnoreCase("Perl SAX"))
-                       dl.setFilename(saxDir.getAbsolutePath() + File.separator + tmp[1]);         
-                   else if(tmp[0].equalsIgnoreCase("Python"))
-                       dl.setFilename(libDir + File.separator + "python" + File.separator + tmp[1]);
-                   
-                   dl.setURL(tmp[2]);
-                   
-                   progressBar.setValue(0);
-                   
-                   Thread dlTh=new Thread(dl);
-                   dlTh.start(); 
-                   do{
-                       
-                       if(dl.getError()!=""){
-                           installLogOutput("Error Downloading " + tmp[1] + ": " + dl.getError());
-                           downloadError = true;
-                           break;
-                       }
-                       
-                       try{
-                           Thread.sleep(100);
-                       }catch(InterruptedException ie){
-                           ie.printStackTrace();
-                       }
-                       
-                   }while(progressBar.getValue() < 100);
-                   
-                   while (dlTh.isAlive()){
-                	  // Download may be done, but dl thread may still have file open,
-                	  // wait until thread exits 
-                   }
-                   
-                   if(progressBar.getValue()==100){
-                       installLogOutput("Successfully downloaded " + tmp[1]);
-                       if(tmp[0].equals("Python"))
-                       {
-                            
-                           if(installJython(dl.getFilename()))
-                           {
-                               installLogOutput("Successfully installed Jython");
-                           
-                               if(setEnvironmentVariable("Python"))
-                                   installLogOutput("Successfully added settings.py");
-                               else
-                                   installLogOutput("Error: cannot create settings.py, manually add TRAFCI_PYTHON_JSERVER to the environment, please see README in the samples directory.");
-                           
-                           }else
-                               installLogOutput("Error installing Jython, please try manually. See the README in the samples directory for more information.");
-                       }
-                       else
-                       {
-                           if(tmp[0].equals("Perl") && tmp[1].endsWith("jar"))
-                           {
-                               if(setEnvironmentVariable("Perl"))
-                                   installLogOutput("Successfully added settings.pl");
-                               else
-                                   installLogOutput("Error: cannot create settings.pl, manually add TRAFCI_PERL_JSERVER to environment, please see README in the samples directory.");
-                           }
-                       }
-                   }
-               }
-               
-               // done
-               
-           }
-       };
-       
-       class pbChangeListener implements ChangeListener
-       {
-               public void stateChanged(ChangeEvent e) 
-               {
-                   JProgressBar bar = (JProgressBar)e.getSource();
-                   bar.paintImmediately(bar.getVisibleRect());
-               }
-       };
-
-   }
-   
-   void installInCmdMode()
-   {
-		try {
-			Class.forName("ControlCSignalHandler").newInstance();
-		} catch (Throwable e) {
-		}
-      
-
-      String line=null;
-      File targetDir=null;
-      File jdbcFile=null;
-      
-      if(enableOpenSource){
-          
-          if(!silentInstall){
-              System.out.println("\nType Y for a standard installation, or N for optional components only.\n");
-              
-              do{
-                  try
-                  {
-                      System.out.print("Standard Installation [Y]: ");
-                      line=bufReader.readLine();
-                      Thread.sleep(100);
-                  } catch (IOException ioe)
-                  {
-                      System.err.println(ioe);
-                  }catch(Exception ex){}
-              }while( !(line != null && (line.equalsIgnoreCase("Y") || line.equalsIgnoreCase("N") || line.equalsIgnoreCase(""))) );
-              
-              if(line.equalsIgnoreCase("N"))
-                  standardInstall = false; // true by default
-          }
-      }
-      
-      
-      while (standardInstall)
-      {
-          
-          if(!silentInstall){
-             try
-             {
-                System.out.print("\n"+ NEW_JDBC +
-                   "\n---------------------------------

<TRUNCATED>


[04/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Session.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Session.java b/core/conn/trafci/src/org/trafodion/ci/Session.java
deleted file mode 100644
index 5219679..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Session.java
+++ /dev/null
@@ -1,1908 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.Statement;
-import java.sql.ResultSet;
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.text.SimpleDateFormat;
-import java.util.Vector;
-import java.lang.reflect.Method;
-import org.trafodion.jdbc.t4.TrafT4Connection;
-
-public class Session extends RepObjInterface
-{
-
-   private int caller=-1;                             // caller id. -1 nobody 0- USERI 1- PRUNI
-   private int mode=SessionDefaults.SQL_MODE; // 0 for sql 1 for cs 
-   private boolean sessionType=true; // true - interactive false - non interactive
-   private boolean sessionStatus=true; // true - active false- in active
-   private String sessionUser=null; // session user
-   private String sessionRole=null;
-   private String tempSessionRole="";
-   private String sessionPass=null; // session password
-   private String sessionServer=null;
-   private String sessionPort=null;
-   private String sessionDsn=null;
-   private String sessionCtlg="TRAFODION"; // session ctlg
-   private String sessionSchema="TRAFODION"; // session schema
-   private String sessionSQLPrompt=SessionDefaults.DEFAULT_SQL_PROMPT; // session prompt
-   private String sessionCprompt="+>";
-   private String sessionWMSPrompt= SessionDefaults.DEFAULT_WMS_PROMPT;
-   private String sessionCSPrompt= SessionDefaults.DEFAULT_CS_PROMPT;
-   private String sessionSQLTerminator=";"; // session sql terminator
-   private String sessionCSTerminator=";"; // session sql terminator
-   private String sessionColSep=" "; // column separator
-   private int sessionIdletime=30; // session idletimeout period
-   private HashMap<String,String> sessParams=null;
-   private HashMap<String,Object[]> prepStmtMap=null;
-   private boolean sessionTime=false; // false - if time off true - if time on
-   private boolean sessionTiming=false; // false - if timing off true - if timing on
-   private boolean sessionLogging=false; // is logging enabled
-   private String sessNull="NULL";
-   private Query qryObj=null; // current query properties
-   private Connection connObj=null; // current connection obj - one per session
-   private Statement stmtObj=null; // statement object to execute database queries
-   private PreparedStatement pstmtObj=null; // current statement obj - one per session
-   private FileReader frObj=null;
-   private FileWriter fwObj=null;
-   private ConsoleReader crObj=null;
-   private ConsoleWriter cwObj=null;
-   private boolean termOut=true; // print the output in the terminal
-   private boolean isQueryInterrupted=false; // set to true when the user cancels the current operation using ctrl +C
-   private boolean isDBConnExists=false; // flag to check if the database connection exists or not.
-   private FileWriter logWriter=null;
-   private FileReader scriptReader=null;
-   private Reader readObj=null;
-   private Writer writerObj=null;
-   private long lastQryExecTime=0;
-   private List<Vector<String>> qryHistory=null;
-   private String prevSQLQuery=null; // previous SQL query
-   private int prevQryStatusCode=0;
-   private int listCount=0;
-   private long qryStartTime=0;
-   private long qryEndTime=0;
-   private int sessLF=0; // Look and feel property
-   private int sqlWarningsCnt=0;
-   private int qsDisplayColSize = SessionDefaults.DISPLAY_COLSIZE;
-   private String strDisplayFormat=SessionDefaults.DEFAULT_DISPLAY_FORMAT;
-   private Object theEncryptObject=null;
-   private String processName=null;
-   private boolean patternsLoaded=false;
-   private String ndcsVersion = null;
-   private String databaseVersion = null;
-   private String databaseEdition = null;
-   public String serverType=null;
-
-   ValidateQuery     vQryObj    = null;
-   InterfaceQuery    iQryObj    = null;
-   ConditionalQuery  cQryObj    = null;
-   DatabaseQuery     dbQryObj   = null;
-   
-   SessionTimeoutTask sTimeoutTask=null;
-   boolean qsOpen=false;
-   private boolean sessionHistoryAll=false;
-   String serviceName=null;
-   String varSessionSQLPrompt=SessionDefaults.DEFAULT_SQL_PROMPT;
-   boolean ampmFmt = false;
-   boolean sessionStats = false;
-   LFProperties lfProps = null;
-   Process procObj=null;
-   private HTMLObject htmlObj=null;
-   private XMLObject xmlObj=null;
-   private String termEvent="0";
-   private int histCmdNo=0;
-   private HashMap<String,String> termEventMap=null;
-   private String prevTermEvent="0";
-   private boolean sessionAutoPrepare=false;
-   private String autoPrepStmtName="STMT_CI";
-   private int lastErrorCode = 0;
-   private String sutVersion = null;
-   private String mxosrvrVersion = null;
-   private long qryExecEndTime=0;
-   private boolean writeParams = false;
-   private String totalRecordCount = "0";
-   private float t4verNum = 0;
-   private boolean spjRs = false;
-   private int exitCode = 0;
-   private boolean inOutandRS=false;
-   private float dbProdVersion=0;
-   private boolean logCmdText = true;
-   private boolean quietEnabled = false;
-   private boolean logAppend = true;
-   Object currentDbExecObj=null;
-   String spoolFileName=null;
-   private boolean isInteractiveRead=false;
-   private boolean isImplicitGetStatsQry=false;
-   private boolean isCmdEchoEnabled=false;
-   // Changes for charset alignment
-   private int isoMapping=-1;
-   private boolean multiByteAlign=true;
-   private HashMap<String,String> aliasParamsMap=null;
-   private int fetchSize = SessionDefaults.DEFAULT_FETCH_SIZE;
-   private HashMap<String,RepObjInterface> patternHashMap=null;
-   private HashMap<String,String> envMap = null;
-   private HashMap<String,String> regExpMap = null;
-   private int maxPatternDepth = SessionDefaults.MAX_PATTERN_DEPTH;
-   private boolean debugOn = false;
-   private boolean logCmdEcho = true;
-   private boolean sessionStartup = false;
-   
-   private int prevMode = SessionDefaults.SQL_MODE;
-   private boolean dotModeCmd = false; 
-   
-   private boolean histOn = true; 
-   private String dotMode = null;
-
-   /*
-    *  Constants for CI's default connection timeout value and for a 
-    *  no timeout value. 
-    */
-   public static final int  DEFAULT_CONNECTION_TIMEOUT = -999; // Defaults.
-   public static final int  INFINITE_CONNECTION_TIMEOUT = 0;   // No timeout.
-
-
-   /*
-    *  Static variables containing the connection timeout and reset idle timer
-    *  method. The _s_ndcsConnTimeout value indicates whether or not the
-    *  user overrode the server side connection timeout defaults.
-    */
-   private static int _s_ndcsConnTimeout = DEFAULT_CONNECTION_TIMEOUT;
-   private static Method _s_resetIdleTimerMethod = null;
-
-   private int versionInfo = 2000;
-
-   public int getVersionInfo() {
-	return versionInfo;
-   }
-
-   public void setVersionInfo(int versionInfo) {
-	this.versionInfo = versionInfo;
-   }
-
-static {
-      String connTimeoutValue = "";
-
-      try {
-         /*
-          *  Check if there was a trafci.connectionTimeout property
-          *  passed to us and use its value if its valid.
-          */
-         connTimeoutValue = System.getProperty("trafci.connectionTimeout");
-         if (null != connTimeoutValue)
-            _s_ndcsConnTimeout = Integer.parseInt(connTimeoutValue);
-
-	  } catch(NumberFormatException nfe) {
-         /*
-          *  Parsing failed -- log an error and use the default value.
-          */
-         System.err.println("Invalid value specified for " + 
-                            "trafci.connectionTimeout [" + connTimeoutValue + 
-                            "]. Using defaults ... ");
-         _s_ndcsConnTimeout = DEFAULT_CONNECTION_TIMEOUT;
-      }
-
-
-      try {
-         /*
-          *  Get the class for the TrafT4Connection class and find the
-          *  reset connection (server) idle timer.
-          */
-         Class<?>  clz = Class.forName("org.trafodion.jdbc.t4.TrafT4Connection");
-         _s_resetIdleTimerMethod = clz.getMethod("resetServerIdleTimer",
-                                                 new Class[] { } );
- 
-       } catch(Exception e) {
-         _s_resetIdleTimerMethod = null;
-       }
-
-
-   }  /*  End of  static initializer.  */
-
-
-
-   Session()
-   {
-
-   }
-
-   Session(String sessionUser,   String sessionPass, String sessionRole ,String sessionServer, String sessionPort,
-      String sessionDsn,ConsoleReader crObj, ConsoleWriter cwObj)
-   {
-      this.sessionUser=sessionUser;
-      this.sessionPass=sessionPass;
-      this.sessionRole=sessionRole;
-      this.sessionServer=sessionServer;
-      this.sessionPort=sessionPort;
-      this.sessionDsn=sessionDsn;
-      this.crObj=crObj;
-      this.cwObj=cwObj;
-
-
-   }
-
-   /*
-    *  Gets the Connection Timeout setting. This value can be overriden by 
-    *  the user by specifying a property "trafci.connectionTimeout".
-    *
-    *  @returns  the currently used Connection Timeout setting.  
-    */
-   public static int getConnectionTimeout() {
-      return _s_ndcsConnTimeout;
-
-   }  /*  End of  getConnectionTimeout  static method.  */
-
-
-
-   /*
-    *  Resets the connection idle timer on the server. Uses reflection to 
-    *  invoke the method, so that we don't need to compile with a specific
-    *  JDBC/T4 driver version.
-    */
-   public void resetConnectionIdleTimer() {
-        /*
-         *  Don't need to do any work, if we set an infinite timeout at
-         *  connection time.
-         */
-        if (INFINITE_CONNECTION_TIMEOUT == _s_ndcsConnTimeout)
-           return;
-
-
-        /*
-         *  Okay, gotta reset the connection idle timer if we have a valid
-         *  resetIdleTimer method handle.
-         */
-        if (null != _s_resetIdleTimerMethod) {
-		   //  System.out.println("@@@TRC: invoking reset timer.");
-
-           try {
-              _s_resetIdleTimerMethod.invoke(connObj, new Object[] { } );
-
-              //  We did our job, so just return back.
-              return;
-
-           } catch(Exception e) {
-		      //  System.out.println("@@@TRC: failed invoking reset timer. " + 
-              //                     "Details = " + e.getMessage() );
-
-
-              //  Don't want to do this again if it failed.
-              _s_resetIdleTimerMethod = null;
-
-             // if (Boolean.getBoolean("trafci.enableTrace") )
-             //    e.printStackTrace();
-
-           }
-
-        }   /*  End of  IF  resetIdleTimerMethod  is valid.  */
-
-
-
-        /*
-         *  Okay, if we got here -- means we failed to invoke the reset
-         *  connection idle timer method -- run a dummy query to reset 
-         *  the timer on the NDCS end.
-         */
-        try {
-		   //  System.out.println("@@@TRC: running infostats keepalive.");
-           Statement stmt = connObj.createStatement();
-           ResultSet rs = stmt.executeQuery("INFOSTATS _KEEPALIVE_HANDLE_");
-           rs.close();
-           stmt.close();
-
-        } catch(Exception exc) {
-           //  Ignore any errors.
-        }
-
-
-   }  /*  End of  resetConnectionIdleTimer  method.  */
-
-
-
-   public Connection getConnObj()
-   {
-      return connObj;
-   }
-
-   public void setConnObj(Connection connObj)
-   {
-      this.connObj = connObj;
-      this.prepStmtMap=null;
-
-   }
-
-   public int getMode()
-   {
-      return mode;
-   }
-
-   public int getDisplayFormat()
-   {
-      if (this.strDisplayFormat.equalsIgnoreCase("HTML"))
-         return SessionDefaults.HTML_FORMAT;
-      else if (this.strDisplayFormat.equalsIgnoreCase("XML"))
-         return SessionDefaults.XML_FORMAT;
-      else if (this.strDisplayFormat.equalsIgnoreCase("CSV") || this.strDisplayFormat.equalsIgnoreCase("COLSEP"))
-         return SessionDefaults.CSV_FORMAT;
-      else
-         return SessionDefaults.RAW_FORMAT;
-   }
-
-   public String getStrMode()
-   {
-      switch (this.mode)
-      {
-         case SessionDefaults.SQL_MODE:
-            return "SQL";
-         default:
-            return "SQL";
-      }
-   }
-
-   public String getEnv(String var)
-   {
-       var=var.toUpperCase();
-       
-       if(var.equals("RECCOUNT") || var.equals("ACTIVITYCOUNT"))
-       {
-           String tmp = this.getTotalRecordCount();
-           if(tmp == null)
-               return "-1";
-           else
-               return tmp;
-       }
-       
-       if(var.equals("LASTERROR") || var.equals("ERRORCODE"))
-           return this.getLastError() + "";
-       
-       if(var.equals("COLSEP"))
-           return this.getSessionColSep();
-       
-       if(var.equals("DATASOURCE"))
-           return this.getSessionDsn();
-       
-       if(var.equals("HISTOPT"))
-           return this.isSessionHistoryAll()?"ALL":"DEFAULT [No expansion of script files]";
-   
-       
-       if(var.equals("IDLETIMEOUT"))
-           return this.getSessionIdletime()+""; 
-       
-       if(var.equals("LIST_COUNT"))
-           return this.getListCount()+"";
-       
-       if(var.equals("LOG_FILE"))
-       {
-           if(this.isSessionLogging())
-               return this.getSpoolFileName();
-           else
-               return "OFF";  
-       }
-       
-       if(var.equals("LOOK_AND_FEEL"))
-           return this.getStrSessView();
-       
-       if(var.equals("MARKUP"))
-           return this.getStrDisplayFormat();
-       
-       if(var.equals("MODE"))
-           return this.getStrMode();
-       
-       if(var.equals("PROMPT"))
-           return this.getSessionPrompt();
-       
-       if(var.equals("ROLE"))
-    	   return this.getSessionRole();
-       
-       if(var.equals("SCHEMA"))
-           return this.getSessionSchema();
-       
-       if(var.equals("SERVER"))
-           return this.getSessionServer() + this.getSessionPort();
-       
-       if(var.equals("SQLTERMINATOR"))
-           return this.getSessionSQLTerminator();
-       
-       if(var.equals("TIME"))
-           return this.isSessionTimeOn()?"ON":"OFF";
-           
-       if(var.equals("TIMING"))
-           return this.isSessionTimingOn()?"ON":"OFF";
-           
-       if(var.equals("USER"))
-           return this.getSessionUser();
-       
-       return null;
-   }
-   
-   public void setNewPrompt()
-   {
-      // include all possible combinations of env variables here
-      String[][] envNameVal = { {"%USER",this.sessionUser},
-                              {"%SCHEMA",this.sessionSchema},
-                              {"%SERVER",this.sessionServer+this.sessionPort},
-                              {"%MODE",this.getStrMode()},
-                              {"%DATASOURCE", this.sessionDsn},
-                              {"%ROLE", this.sessionRole}
-                        };
-      String prompt=this.varSessionSQLPrompt;
-      switch (this.mode)
-      {
-         case SessionDefaults.SQL_MODE:
-            prompt = this.varSessionSQLPrompt;
-            break;
-         default:
-            break;
-      }
-      int envCount=0;
-      String replaceString;
-      while (this.connObj != null && prompt.indexOf("%") != -1 && envCount < envNameVal.length)
-      {
-    	
-      	// Every $ needs to be replaced with \$. Do not delete the backslashes.
-    	 replaceString = envNameVal[envCount][1];
-    	 replaceString = replaceString.replaceAll("\\$","\\\\\\$");
-         prompt=prompt.replaceAll("(?i)"+envNameVal[envCount][0]+"(?![^_\\W])",replaceString);
-         envCount++;
-      }
-
-      if (!prompt.trim().endsWith(">"))
-    	  prompt += ">";
-      switch (this.mode)
-      {
-         case SessionDefaults.SQL_MODE:
-            this.sessionSQLPrompt = prompt;
-            break;
-         default:
-            break;
-      }
-      
-      crObj.setPrompt(prompt,this.sessionTime, ampmFmt);
-   }
-
-   public void setMode(int mode)
-   {
-      this.mode = mode;
-      this.setNewPrompt();
-   }
-
-   public PreparedStatement getPreparedStmt()
-   {
-      return pstmtObj;
-   }
-
-   public void setPreparedStmt(PreparedStatement pstmtObj)
-   {
-      this.pstmtObj = pstmtObj;
-   }
-
-   public Query getQuery()
-   {
-      return qryObj;
-   }
-
-   public void setQuery(Query qryObj)
-   {
-      this.qryObj = qryObj;
-   }
-
-   public String getSessionCtlg()
-   {
-      return sessionCtlg;
-   }
-
-   public void setSessionCtlg(String sessionCtlg)
-   {
-      this.sessionCtlg = sessionCtlg;
-   }
-
-   public String getSessionPass()
-   {
-      return sessionPass;
-   }
-
-   public void setSessionPass(String sessionPass)
-   {
-      this.sessionPass = sessionPass;
-   }
-
-   public String getSessionPrompt()
-   {
-      String timeStamp = "";
-      SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss ");
-      String prompt="";
-
-      if (this.isSessionTimeOn())
-      {
-         if (this.ampmFmt)
-            timeStamp = DateFormat.getTimeInstance().format(new Date())+ " ";
-         else
-            timeStamp = sdf.format(new Date());
-      }
-      
-      prompt = this.getPrompt();
-      crObj.setPrompt(prompt, sessionTime, ampmFmt);
-      return (timeStamp + prompt);
-   }
-
-   public String getPrompt() {
-      
-      String prompt="";
-     
-      switch (this.mode)
-      {
-         case SessionDefaults.SQL_MODE:
-            prompt =  sessionSQLPrompt;
-            break;
-         default:
-            prompt =  sessionSQLPrompt;
-      }
-      return prompt;
-   }
-   
-   public void setSessionPrompt(String sessionPrompt)
-   {
-      switch (this.mode)
-      {
-         case SessionDefaults.SQL_MODE:
-            this.sessionSQLPrompt = this.varSessionSQLPrompt = sessionPrompt;
-            break;
-         default: break;
-      }
-      this.setNewPrompt();
-   }
-
-   public String getSessionSchema()
-   {
-      return sessionSchema;
-   }
-
-   public void setSessionSchema(String sessionSchema)
-   {
-      this.sessionSchema = sessionSchema;
-      this.setNewPrompt();
-   }
-
-   public boolean isSessionActive()
-   {
-      return sessionStatus;
-   }
-
-   public void setSessionStatus(boolean sessionStatus)
-   {
-      this.sessionStatus = sessionStatus;
-   }
-
-   public boolean isSessionTimeOn()
-   {
-      return sessionTime;
-   }
-
-   public void setSessionTime(boolean sessionTime)
-   {
-      this.sessionTime = sessionTime;
-   }
-
-   public boolean isSessionTimingOn()
-   {
-      return sessionTiming;
-   }
-
-   public void setSessionTiming(boolean sessionTiming)
-   {
-      this.sessionTiming = sessionTiming;
-   }
-
-   public boolean isSessionInteractive()
-   {
-      return sessionType;
-   }
-
-   public void setSessionType(boolean sessionType)
-   {
-      this.sessionType = sessionType;
-   }
-
-   public boolean getSessionType()
-   {
-      return this.sessionType;
-   }
-
-   public String getSessionUser()
-   {
-      return sessionUser;
-   }
-
-   public void setSessionUser(String sessionUser)
-   {
-      this.sessionUser = sessionUser;
-      this.setNewPrompt();
-   }
-
-
-   public ConsoleReader getConsoleReader()
-   {
-      return crObj;
-   }
-
-
-   public void setConsoleReader(ConsoleReader crObj)
-   {
-      this.crObj = crObj;
-   }
-
-
-   public ConsoleWriter getConsoleWriter()
-   {
-      return cwObj;
-   }
-
-
-   public void setConsoleWriter(ConsoleWriter cwObj)
-   {
-      this.cwObj = cwObj;
-   }
-
-
-   public FileReader getFileReader()
-   {
-      return frObj;
-   }
-
-
-   public void setFileReader(FileReader frObj)
-   {
-      if (frObj == null)
-      {
-         frObj=new FileReader();
-      }
-      this.frObj = frObj;
-   }
-
-
-   public FileWriter getFileWriter()
-   {
-      return fwObj;
-   }
-
-
-   public void setFileWriter(FileWriter fwObj)
-   {
-      if (fwObj == null)
-      {
-         fwObj=new FileWriter();
-      }
-      this.fwObj = fwObj;
-   }
-
-   public String getStrDisplayFormat()
-   {
-      return strDisplayFormat;
-   }
-
-   public void setStrDisplayFormat(String strDisplayFormat)
-   {
-      this.strDisplayFormat = strDisplayFormat;
-   }
-
-   public String getSessionDsn()
-   {
-      return sessionDsn;
-   }
-
-   public void setSessionDsn(String sessionDsn)
-   {
-      this.sessionDsn = sessionDsn;
-      this.setNewPrompt();
-   }
-
-   public String getSessionPort()
-   {
-      return sessionPort;
-   }
-
-   public void setSessionPort(String sessionPort)
-   {
-      this.sessionPort = sessionPort;
-   }
-
-   public String getSessionServer()
-   {
-      return sessionServer;
-   }
-
-   public void setSessionSever(String sessionServer)
-   {
-      this.sessionServer = sessionServer;
-      this.setNewPrompt();
-   }
-
-   public String getSessionSQLTerminator()
-   {
-      if (this.mode != SessionDefaults.SQL_MODE)
-      {
-         return sessionCSTerminator;
-      }
-      else
-      {
-         return sessionSQLTerminator;
-      }
-   }
-
-   public void setSessionSQLTerminator(String sessionSQLTerminator)
-   {
-      this.sessionSQLTerminator = sessionSQLTerminator.toUpperCase();
-   }
-
-   public int getSessionIdletime()
-   {
-      return sessionIdletime;
-   }
-
-   public void setSessionIdletime(int sessionIdletime)
-   {
-      this.sessionIdletime = sessionIdletime;
-      if (this.sTimeoutTask != null)
-      {
-         this.sTimeoutTask.idleTime=sessionIdletime;
-      }
-   }
-
-   public HashMap<String,Object[]> getPrepStmtMap()
-   {
-      return prepStmtMap;
-   }
-
-   public PreparedStatement getPrepStmtMap(String stmtName)
-   {
-      if (prepStmtMap !=null)
-      {
-         Object[] pStmtObj=(Object[]) prepStmtMap.get(stmtName);
-         if (pStmtObj != null)
-         {
-            return (PreparedStatement) (pStmtObj[0]);
-         }
-      }
-      return null;
-   }
-
-   public boolean getPrepTrimOut(String stmtName)
-   {
-      if (prepStmtMap !=null)
-      {
-         Object[] pStmtObj=(Object[]) prepStmtMap.get(stmtName);
-
-         return (Boolean.valueOf((String)pStmtObj[1]).booleanValue());
-      }
-      else
-         return false;
-   }
-
-   public void setPrepStmtMap(String stmtName,Object pStmtObj,boolean trimOut)
-   {
-      Object[] objectArr=new Object[2];
-      if (this.prepStmtMap == null)
-      {
-         this.prepStmtMap=new HashMap<String,Object[]>();
-      }
-      objectArr[0]=pStmtObj;
-      if (trimOut)
-      {
-         objectArr[1]="true";
-      }
-      else
-      {
-         objectArr[1]="false";
-      }
-      this.prepStmtMap.put(stmtName,objectArr);
-
-   }
-
-   public void removePrepStmtMap(String stmtName)
-   {
-      if (this.prepStmtMap != null)
-      {
-         this.prepStmtMap.remove(stmtName);
-      }
-   }
-
-   public HashMap<String,String> getSessParams()
-   {
-      return sessParams;
-   }
-
-   public void resetPrepStmtMap(HashMap<String,Object[]> prepStmtMap)
-   {
-      this.prepStmtMap=null;
-   }
-
-   public String getSessParams(String param)
-   {
-      if (sessParams!=null)
-         return (String) sessParams.get(param);
-      else
-         return null;
-
-   }
-
-   public void setSessParams(String param,String value)
-   {
-      if (this.sessParams == null)
-      {
-         this.sessParams=new HashMap<String,String>();
-      }
-      this.sessParams.put(param,value);
-   }
-
-   public void resetSessionParams(HashMap<String,String> sessParams)
-   {
-      this.sessParams=sessParams;
-   }
-
-   public void resetSessionParams(String param)
-   {
-      if (this.sessParams != null)
-      {
-         this.sessParams.remove(param);
-      }
-   }
-
-   public boolean isSessionLogging()
-   {
-      return sessionLogging;
-   }
-
-   public void setSessionLogging(boolean sessionLogging)
-   {
-      this.sessionLogging = sessionLogging;
-   }
-
-   public Statement getStmtObj()
-   {
-      return stmtObj;
-   }
-
-   public void setStmtObj(Statement stmtObj)
-   {
-      this.stmtObj = stmtObj;
-   }
-
-   public String getSessNull()
-   {
-      return sessNull;
-   }
-
-   public void setSessNull(String sessNull)
-   {
-      this.sessNull = sessNull;
-   }
-
-   public String getSessionCprompt()
-   {
-      return sessionCprompt;
-   }
-
-   public void setSessionCprompt(String sessionCprompt)
-   {
-      this.sessionCprompt = sessionCprompt;
-   }
-
-   public boolean isTermOut()
-   {
-      return termOut;
-   }
-
-   public void setTermOut(boolean termOut)
-   {
-      this.termOut = termOut;
-   }
-
-   public FileWriter getLogWriter()
-   {
-      return logWriter;
-   }
-
-   public void setLogWriter(FileWriter logWriter)
-   {
-      this.logWriter = logWriter;
-   }
-
-   public FileReader getScriptReader()
-   {
-      return scriptReader;
-   }
-
-   public void setScriptReader(FileReader scriptReader)
-   {
-      this.scriptReader = scriptReader;
-   }
-
-   public int getCaller()
-   {
-      return caller;
-   }
-
-   public void setCaller(int caller)
-   {
-      this.caller = caller;
-   }
-
-   public DatabaseQuery getDbQryObj()
-   {
-      return dbQryObj;
-   }
-
-   public void setDbQryObj(DatabaseQuery dbQryObj)
-   {
-      this.dbQryObj = dbQryObj;
-   }
-
-   public InterfaceQuery getIQryObj()
-   {
-      return iQryObj;
-   }
-
-   public void setIQryObj(InterfaceQuery qryObj)
-   {
-      iQryObj = qryObj;
-   }
-   
-   public ConditionalQuery getCQryObj(){
-       return cQryObj;
-   }
-   
-   public void setCQryObj(ConditionalQuery qryObj) {
-       cQryObj = qryObj;
-   }
-
-   public ValidateQuery getVQryObj()
-   {
-      return vQryObj;
-   }
-
-   public void setVQryObj(ValidateQuery qryObj)
-   {
-      vQryObj = qryObj;
-   }
-
-   public Reader getReader()
-   {
-      return readObj;
-   }
-
-   public void setReader(Reader readObj)
-   {
-      this.readObj = readObj;
-   }
-
-   public Writer getWriter()
-   {
-      return writerObj;
-   }
-
-   public void setWriter(Writer writerObj)
-   {
-      this.writerObj = writerObj;
-   }
-
-   public long getLastQryExecTime()
-   {
-      return lastQryExecTime;
-   }
-
-   public void setLastQryExecTime(long lastQryExecTime)
-   {
-      this.lastQryExecTime = lastQryExecTime;
-      if (this.sTimeoutTask != null)
-      {
-         this.sTimeoutTask.lastQueryExecTime=lastQryExecTime;
-         this.sTimeoutTask.checkRequired=true;
-      }
-   }
-
-   public SessionTimeoutTask getTimeoutTask()
-   {
-      return sTimeoutTask;
-   }
-
-   public void setTimeoutTask(SessionTimeoutTask timeoutTask)
-   {
-      sTimeoutTask = timeoutTask;
-
-      if (null != sTimeoutTask)
-         sTimeoutTask.setSessionObj(this);
-
-   }
-
-   public void setTimerHold()
-   {
-      if (this.sTimeoutTask != null)
-      {
-         this.sTimeoutTask.checkRequired=false;
-      }
-
-   }
-
-   public List<Vector<String>> getQryHistory()
-   {
-      return qryHistory;
-   }
-
-   public void addQryToHistory(String qryText)
-   {
-	   if (isDotModeCmd()) {
-		   qryText = "."+ this.getDotMode() + " " + qryText;
-		   if (this.debugOn)
-			   System.out.println(this.getClass().getName()+"::"+ qryText);
-	   }
-
-	   if (!histOn)
-	   {
-		   this.setHistOn(true);
-		   return;
-	   }
-		   
-      histCmdNo++;
-      if (this.qryHistory == null)
-      {
-         this.qryHistory =new ArrayList<Vector<String>>();
-      }
-      if (this.termEventMap == null)
-      {
-         this.termEventMap=new HashMap<String, String>();
-         termEventMap.put("0",";");
-      }
-      if (this.qryHistory.size() >= SessionDefaults.QRY_HISTORY_MAX_LMT)
-      {
-         this.qryHistory.remove(0);
-      }
-      Vector<String> histVect = new Vector<String>();
-      //mark
-      //histVect.add(new Integer(histCmdNo));
-      histVect.add(String.valueOf(histCmdNo));
-      histVect.add(qryText);
-      if (Integer.parseInt(termEvent) == histCmdNo)
-      {
-         histVect.add(prevTermEvent);
-      }
-      else
-      {
-         histVect.add(termEvent);
-      }
-      this.qryHistory.add(histVect);
-
-   }
-
-   public String getPrevSQLQuery()
-   {
-      return prevSQLQuery;
-   }
-
-   public void setPrevSQLQuery(String prevSQLQuery)
-   {
-      this.prevSQLQuery = prevSQLQuery;
-   }
-
-   public int getPrevQryStatusCode()
-   {
-      return prevQryStatusCode;
-   }
-
-   public void setPrevQryStatusCode(int prevQryStatusCode)
-   {
-      this.prevQryStatusCode = prevQryStatusCode;
-   }
-
-   public int getListCount()
-   {
-      return listCount;
-   }
-
-   public void setListCount(int listCount)
-   {
-      this.listCount = listCount;
-   }
-
-   public int getDisplayColSize()
-   {
-      return qsDisplayColSize;
-   }
-
-   public void setDisplayColSize(int colSize)
-   {
-      this.qsDisplayColSize = colSize;
-   }
-
-   public String getSessionColSep()
-   {
-      return sessionColSep;
-   }
-
-   public void setSessionColSep(String sessionColSep)
-   {
-      this.sessionColSep = sessionColSep;
-   }
-
-   public void setQryStartTime()
-   {
-      qryStartTime=System.currentTimeMillis();
-   }
-
-   public void setQryEndTime()
-   {
-      qryEndTime=System.currentTimeMillis();
-      if (qryObj != null)
-         qryObj.setElapsedTime(this.qryEndTime-this.qryStartTime);
-   }
-
-
-
-   public void resetQryStartEndTime()
-   {
-      qryStartTime=qryEndTime=0;
-   }
-
-   public int getSessView()
-   {
-      return sessLF;
-   }
-
-   public String getStrSessView()
-   {
-      switch (sessLF)
-      {
-         case SessionDefaults.CIDEFAULT_VIEW:
-            return "TRAFCI";
-
-         case SessionDefaults.MXCI_VIEW:
-            return "MXCI";
-
-         default:
-            return "TRAFCI";
-
-      }
-   }
-
-   public void setSessView(int sessLF)
-   {
-      this.sessLF = sessLF;
-   }
-
-   public int getSqlWarningsCnt()
-   {
-      return sqlWarningsCnt;
-   }
-
-   public void setSqlWarningsCnt(int sqlWarningsCnt)
-   {
-      this.sqlWarningsCnt = sqlWarningsCnt;
-   }
-
-   public boolean isQueryInterrupted()
-   {
-      return isQueryInterrupted;
-   }
-
-   public void setQueryInterrupted(boolean isQueryInterrupted)
-   {
-      this.isQueryInterrupted = isQueryInterrupted;
-   }
-
-   public boolean isDBConnExists()
-   {
-      return isDBConnExists;
-   }
-
-   public void setDBConnExists(boolean isDBConnExists)
-   {
-      this.isDBConnExists = isDBConnExists;
-      if (!isDBConnExists)
-      {
-         setMxosrvrVersion(null);
-      }
-   }
-
-   public void setCurrentStmtObj(Object currentDbExecObj)
-   {
-      this.currentDbExecObj=currentDbExecObj;
-   }
-   public Object getCurrentStmtObj()
-   {
-      return this.currentDbExecObj;
-   }
-
-   public boolean isSessionHistoryAll()
-   {
-      return sessionHistoryAll;
-   }
-
-   public void setSessionHistoryAll(boolean sessionHistoryAll)
-   {
-      this.sessionHistoryAll = sessionHistoryAll;
-   }
-
-
-   public boolean isSessionStatsEnabled()
-   {
-      return sessionStats;
-   }
-
-   public void setSessionStatsEnabled(boolean sessionStats)
-   {
-      this.sessionStats = sessionStats;
-   }
-
-   public LFProperties getLfProps()
-   {
-      return lfProps;
-   }
-
-   public void setLFProps(LFProperties lfProps)
-   {
-      this.lfProps = lfProps;
-   }
-
-   public boolean isAmPmFmt()
-   {
-      return ampmFmt;
-   }
-
-   public void setAmPmFmt(boolean ampmFmt)
-   {
-      this.ampmFmt = ampmFmt;
-   }
-
-   public Process getProcObj()
-   {
-      return procObj;
-   }
-
-   public void setProcObj(Process procObj)
-   {
-      this.procObj = procObj;
-   }
-
-   public HTMLObject getHtmlObj()
-   {
-      return htmlObj;
-   }
-
-   public void setHtmlObj(HTMLObject htmlObj)
-   {
-      this.htmlObj = htmlObj;
-   }
-
-   public XMLObject getXmlObj()
-   {
-      return xmlObj;
-   }
-
-   public void setXmlObj(XMLObject xmlObj)
-   {
-      this.xmlObj = xmlObj;
-   }
-
-   public String getTermEvent()
-   {
-      return termEvent;
-   }
-
-   public void setTermEvent(String termEvent)
-   {
-      prevTermEvent = this.termEvent;
-      this.termEvent = termEvent;
-   }
-
-   public int getHistCmdNo()
-   {
-      return histCmdNo;
-   }
-
-   public void setHistCmdNo(int histCmdNo)
-   {
-      this.histCmdNo = histCmdNo;
-   }
-
-   public HashMap<String, String> getTermEventMap()
-   {
-      return termEventMap;
-   }
-
-   public void setTermEventMap(String eventNum, String sqlTerminator)
-   {
-      if (this.termEventMap == null)
-      {
-         this.termEventMap=new HashMap<String, String>();
-         termEventMap.put("0",";");
-      }
-
-      this.termEventMap.put(eventNum,sqlTerminator);
-
-   }
-
-   public long getQryExecEndTime()
-   {
-      return qryExecEndTime;
-   }
-
-   public void setQryExecEndTime()
-   {
-      this.qryExecEndTime = (System.currentTimeMillis() - this.qryStartTime);
-   }
-
-   public boolean isSessionAutoPrepare()
-   {
-      return sessionAutoPrepare;
-   }
-
-   public void setSessionAutoPrepare(boolean sessionAutoPrepare)
-   {
-      this.sessionAutoPrepare = sessionAutoPrepare;
-   }
-
-   public String getAutoPrepStmtName()
-   {
-      return autoPrepStmtName;
-   }
-
-   public void setAutoPrepStmtName(String autoPrepStmtName)
-   {
-      this.autoPrepStmtName = autoPrepStmtName;
-   }
-
-   public int getLastError()
-   {
-      return lastErrorCode;
-   }
-
-   public void setLastError(int lastErrorCode)
-   {
-      this.lastErrorCode = lastErrorCode;
-   }
-   
-   public String getSutVersion()
-   {
-      return sutVersion;
-   }
-
-   public void setSutVersion(String sutVersion)
-   {
-      this.sutVersion = sutVersion;
-   }
-   
-   public String getMxosrvrVersion()
-   {
-      return mxosrvrVersion;
-   }
-
-   public void setMxosrvrVersion(String mxosrvrVersion)
-   {
-      this.mxosrvrVersion = mxosrvrVersion;
-   }
-
-/* public NSCmd getNscmd()
-   {
-      return nscmd;
-   }
-
-   public void setNscmd(NSCmd nscmd)
-   {
-      this.nscmd = nscmd;
-   }
-*/
-
-   public boolean isWriteParams()
-   {
-      return writeParams;
-   }
-
-   public void setWriteParams(boolean writeParams)
-   {
-      this.writeParams = writeParams;
-   }
-
-   public String getTotalRecordCount()
-   {
-      return totalRecordCount;
-   }
-
-   public void setTotalRecordCount(String totalRecordCount)
-   {
-      this.totalRecordCount = totalRecordCount;
-   }
-
-   public void setT4verNum(float num)
-   {
-      t4verNum = num;
-   }
-   public float getT4verNum()
-   {
-      return t4verNum;
-   }
-
-   public boolean isSPJRS()
-   {
-      return spjRs;
-   }
-
-   public void setSPJRS(boolean spjRs)
-   {
-      this.spjRs = spjRs;
-   }
-   
-   public void setExitCode(int code){
-       this.exitCode = code;
-   }
-   
-   public int getExitCode(){
-       return this.exitCode;
-   }
-
-   public boolean isInOutandRS()
-   {
-      return inOutandRS;
-   }
-
-   public void setInOutandRS(boolean inOutandRS)
-   {
-      this.inOutandRS = inOutandRS;
-   }
-
-   public float getDatabaseProdVersion()
-   {
-      return dbProdVersion;
-   }
-
-   public void setDatabaseProdVersion(float dbProdVersion)
-   {
-      this.dbProdVersion = dbProdVersion;
-   }
-
-   public boolean isLogCmdText()
-   {
-      return logCmdText;
-   }
-
-   public void setLogCmdText(boolean logCmdText)
-   {
-      this.logCmdText = logCmdText;
-   }
-
-   public boolean isQuietEnabled()
-   {
-      return quietEnabled;
-   }
-
-   public void setQuietEnabled(boolean quietEnabled)
-   {
-      this.quietEnabled = quietEnabled;
-   }
-
-   public boolean isLogAppend()
-   {
-      return logAppend;
-   }
-
-   public void setLogAppend(boolean logAppend)
-   {
-      this.logAppend = logAppend;
-   }
-
-   public String getSpoolFileName()
-   {
-      return spoolFileName;
-   }
-
-   public void setSpoolFileName(String spoolFileName)
-   {
-      this.spoolFileName = spoolFileName;
-   }
-   
-   protected void setSessionValues() 
-   {	  
-	   
-      try
-      { 
-    	this.sessionRole = ((TrafT4Connection)this.connObj).getRoleName();
-    	if (this.debugOn)
-    		System.out.println("Session::"  + this.sessionRole);
-    	if (0 == this.sessionRole.trim().length())  // If T4 returns empty string
-    	{
-    		this.sessionRole = this.getUserRoleName();
-        	if (this.debugOn)
-        		System.out.println("Session getUserRoleName::"  + this.sessionRole);
- 		}    			  
-      } 
-      catch (NullPointerException npe) 
-      {    	 
-    	this.sessionRole = this.getUserRoleName();
-       	if (this.debugOn)
-    		System.out.println("Session NPE getUserRoleName::"  + this.sessionRole);
-      } 
-      catch (Exception se)
-      {
-      }
-      finally {
-    	  this.setNewPrompt();
-      }
-   }
-   
-   protected String getUserRoleName()
-   {
-
-      //String userName = null;
-      String userRole = null;
-      try
-      {
-         Statement stmt = this.connObj.createStatement();
-         ResultSet rs = stmt.executeQuery("VALUES(USER, CURRENT_ROLE)");
-         while (rs!=null && rs.next())
-         {
-            //userName = rs.getString(1);
-            userRole = rs.getString(2);
-         }
-         rs.close();
-         stmt.close();
-      } catch (Exception se)
-      {
-        // System.out.println("error:"+se.getMessage());
-      }
-      if (userRole != null)
-      {
-   		 int i = userRole.indexOf(".");
-   		 this.sessionRole = userRole.substring(i+1); // Prints the second half of the role
-      }
-      else
-      {
-    	  sessionRole = "Information not available";
-      }
-      return sessionRole;
-   }
-
-   
-   public boolean isInteractiveRead()
-   {
-      return isInteractiveRead;
-   }
-
-   public void setInteractiveRead(boolean isInteractiveRead)
-   {
-      this.isInteractiveRead = isInteractiveRead;
-   }
-
-   public boolean isImplicitGetStatsQry()
-   {
-      return isImplicitGetStatsQry;
-   }
-
-   public void setImplicitGetStatsQry(boolean isImplicitGetStatsQry)
-   {
-      this.isImplicitGetStatsQry = isImplicitGetStatsQry;
-   }
-
-   public boolean isCmdEchoEnabled()
-   {
-      return isCmdEchoEnabled;
-   }
-
-   public void setCmdEcho(boolean isCmdEchoEnabled)
-   {
-      this.isCmdEchoEnabled = isCmdEchoEnabled;
-   }
-
-   public int getISOMapping()
-   {
-      return isoMapping;
-   }
-
-   public void setISOMapping(int isoMapping)
-   {
-      this.isoMapping = isoMapping;
-   }
-
-   public boolean isMultiByteAlign()
-   {
-      return multiByteAlign;
-   }
-
-   public void setMultiByteAlign(boolean multiByteAlign)
-   {
-      this.multiByteAlign = multiByteAlign;
-   }
-   public String getSessionRole()
-   {
-      return sessionRole;
-   }
-   
-   public void setSessionRole(String sessionRole)
-   {
-	   this.sessionRole = sessionRole;
-	   this.setNewPrompt();
-   }
-  
-   public String getTempSessionRole() {
-	return tempSessionRole;
-   }
-
-  public void setTempSessionRole(String tempSessionRole) {
-	this.tempSessionRole = tempSessionRole;
-  }
-   public HashMap<String, String> getAliasMap()
-   {
-      return aliasParamsMap;
-   }
-   
-   public String getAlias(String param)
-   {
-      if (aliasParamsMap!=null)
-         return (String) aliasParamsMap.get(param);
-      else
-         return null;
-   }
-   
-   public void setAlias(String param,String value)
-   {	   
-	 if (this.aliasParamsMap == null)
-     {
-         this.aliasParamsMap=new HashMap<String, String>();
-     }
-     this.aliasParamsMap.put(param.toUpperCase(),value);
-    }
-
-	public int getFetchSize() {
-		return fetchSize;
-	}
-	
-	public void setFetchSize(int fetchSize) {
-		this.fetchSize = fetchSize;
-	}
-
-	public HashMap<String, RepObjInterface> getPatternHashMap() {
-		return patternHashMap;
-	}
-	
-	public void setPatternHashMap(HashMap<String, RepObjInterface> patternHashMap) {
-		this.patternHashMap = patternHashMap;
-	}
-
-	public void setPattern(String patternKey, String patternVal)
-	{
-		if (patternHashMap == null)
-			patternHashMap = new HashMap<String, RepObjInterface>();
-		patternHashMap.put(patternKey.toUpperCase(), new ReplacementObj(patternKey, patternVal));
-		
-	}
-	
-	
-	public String getValue (String key)
-	{
-		return (String)this.getEnvMap().get(key.toUpperCase());
-		
-	}
-	
-	public String getPatternValue(String key)
-	{
-		if (patternHashMap.containsKey(key.toUpperCase()))
-		{
-			RepObjInterface repObj = (RepObjInterface)(patternHashMap.get(key.toUpperCase()));
-			return (repObj).getValue(key);
-		}
-		return null;
-		
-	
-	}
-
-	public HashMap<String, String> getEnvMap() {
-		if (envMap == null)
-			envMap = new HashMap<String, String>();
-		return envMap;
-	}
-
-	public void setEnvMap(HashMap<String,String> envMap) {
-		this.envMap = envMap;
-	}
-
-	public HashMap<String, String> getRegExpMap() {
-		return regExpMap;
-	}
-
-		
-	public void setRegExpPattern(String patternKey, String patternVal)
-	{
-		if (regExpMap == null)
-			regExpMap = new HashMap<String, String>();
-		regExpMap.put(patternKey, patternVal);
-		
-	}
-
-	public int getMaxPatternDepth() {
-		return maxPatternDepth;
-	}
-
-	public void setMaxPatternDepth(int maxPatternDepth) {
-		this.maxPatternDepth = maxPatternDepth;
-	}
-
-	public boolean isDebugOn() {
-		return debugOn;
-	}
-
-	public void setDebugOn(boolean debugOn) {
-		this.debugOn = debugOn;
-	}
-	
-	public boolean isLogCmdEcho() {
-		return logCmdEcho;
-	}
-
-	public void setLogCmdEcho(boolean logCmdEcho) {
-		this.logCmdEcho = logCmdEcho;
-	}
-
-	public boolean isSessionStartup() {
-		return sessionStartup;
-	}
-
-	public void setSessionStartup(boolean sessionStartup) {
-		this.sessionStartup = sessionStartup;
-		setSessionLogging(sessionStartup);
-		this.logCmdEcho = !sessionStartup;
-	}
-
-	public int getPrevMode() {
-		return prevMode;
-	}
-
-	public void setPrevMode(int prevMode) {
-		this.prevMode = prevMode;
-	}
-
-	public boolean isDotModeCmd() {
-		return dotModeCmd;
-	}
-
-	public void setDotModeCmd(boolean dotModeCmd) {
-		this.dotModeCmd = dotModeCmd;
-	}
-
-	public boolean isHistOn() {
-		return histOn;
-	}
-
-	public void setHistOn(boolean histOn) {
-		this.histOn = histOn;
-	}
-
-	public void setTheEncryptObject(Object theEncryptObject) {
-		this.theEncryptObject = theEncryptObject;
-	}
-
-	public Object getTheEncryptObject() {
-		return theEncryptObject;
-	}
-
-	public String getNeoProcessName() {
-		return processName;
-	}
-
-	public void setNeoProcessName(String processName) {
-		this.processName = processName;
-	}
-
-	public boolean isPatternsLoaded() {
-		return patternsLoaded;
-	}
-
-	public void setPatternsLoaded(boolean patternsLoaded) {
-		this.patternsLoaded = patternsLoaded;
-	}
-
-	/**
-	 * @return
-	 * true : can get Platform version
-	 * false: can't get Platform version
-	 */
-	protected boolean getPlatformObjectVersions()
-	{
-	      try
-	      {
-	         Statement stmt = this.connObj.createStatement();
-	         ResultSet rs = null; 
-	         if (stmt.execute("info system"))
-	        	 rs = stmt.getResultSet();
-	         
-	    	  if (this.isDebugOn() ) {
-	    		  System.out.println("rs for info system = " + rs);
-	    	  }
-	    	  
-  	         if (rs!=null && rs.next()) {
-	             {
-	                ndcsVersion = rs.getString(2);
-	                if (ndcsVersion != null){
-	                     ndcsVersion = ndcsVersion.substring(ndcsVersion.indexOf("Version"));
-	                     sutVersion = ndcsVersion.substring(ndcsVersion.indexOf("Release"),ndcsVersion.indexOf("("));
-	                     String platformVersion = sutVersion.substring(8);
-	                }
-                        databaseVersion = rs.getString(5);
-                        databaseEdition = rs.getString(6);
-
-	             }
-	             if (this.debugOn) {
-	                System.out.println("ndcs version:: " + ndcsVersion);
-	                System.out.println("database version:: " + databaseVersion);
-	                System.out.println("database edition:: " + databaseEdition);
-	             }
-	             rs.close();
-	             stmt.close();
-	         }
-	      } catch (Exception se) {
-	    	  if (this.isDebugOn() ) {
-	    		  System.out.println("error:"+se.getMessage() );
-	    		  se.printStackTrace(System.out);
-	    	  }
-	    	  
-	    	  ndcsVersion = null;
-	    	  return false;
-	      }
-	      this.setNdcsVersion(ndcsVersion);
-	      return true;
-	   }
-
-	public String getNdcsVersion() {
-		return ndcsVersion;
-	}
-
-	public void setNdcsVersion(String ndcsVersion) {
-		this.ndcsVersion = ndcsVersion;
-	}
-
-	public String getDotMode() {
-		return dotMode;
-	}
-
-	public void setDotMode(String dotMode) {
-		this.dotMode = dotMode;
-	}
-
-	public String getServerType() {
-		return serverType;
-	}
-
-	public void setServerType(String serverType) {
-		this.serverType = serverType;
-	}
-
-	public String getDatabaseVersion() {
-		return databaseVersion;
-	}
-
-	public String getDatabaseEdition() {
- 		return databaseEdition;
-	}
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/SessionDefaults.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/SessionDefaults.java b/core/conn/trafci/src/org/trafodion/ci/SessionDefaults.java
deleted file mode 100644
index 3639ce1..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/SessionDefaults.java
+++ /dev/null
@@ -1,342 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-public interface SessionDefaults {
-   final String DATABASE_EDITION = System.getenv("TRAFODION_VER_PROD");
-   final String PROD_NAME = System.getenv("TRAFODION_VER_PROD")+" Command Interface ";
-   final String APP_NAME = "TrafCI";
-   final String DRIVER_NAME = "org.trafodion.jdbc.t4.T4Driver"; 
-   final String PKG_NAME = "/org/trafodion/ci/";
-   final String PROP_DEFAULT_NAME = PKG_NAME + "Properties/trafciDefaultLookAndFeel.properties";
-   final String PROP_TRAFCILF = "trafciLF";
-   final String PROP_TRACE = "trafci.enableTrace";
-   final String PROP_OS = "os.name";
-   final String PROP_PRINT_TIME = "trafci.printConnTime";
-   final String PROP_MAX_DELAY = "trafci.maxDelayLimit";
-   
-   String dsnName="Default_DataSource";
-   String portNumber="18650";
-   String lineSeperator=System.getProperty("line.separator");
-   
-
-	String DEFAULT_SQL_PROMPT = "SQL>";
-	String DEFAULT_WMS_PROMPT = "WMS>";
-	String DEFAULT_CS_PROMPT = "CS>";
-	String SQL = "SQL";
-	String WMS = "WMS";
-	String CS = "CS";
-   
-   String DEFAULT_DISPLAY_FORMAT="RAW";
-   
-   final int trafciMajorVersion=1;
-   final int trafciMinorVersion=0;
-
-   final int QRY_HISTORY_MAX_LMT=100;
-   final String DEFAULT_DATA_SOURCE="Default_DataSource";
-
-   final int abruptExit=-9999;
-   final int DEFAULT_EXIT_CODE = 0;
-   
-   final int SQL_ERR_CONN_MAX_LIMIT=-29154;
-   final int NDCS_ERR_DSN_NOT_AVAILABLE = -29164;
-   final int UNKNOWN_DATA_SOURCE=29182;
-   final int MIN_COL_DISPLAY_SIZE = 4;
-   final int DISPLAY_COLSIZE = 160;
-   final int WMS_PROCESS_DOES_NOT_EXIST=-29162;
-   final int SQL_ERR_INVALID_AUTH=-29153;
-   final int MAX_DELAY_LIMIT=3600; //in seconds
-   final int DEFAULT_FETCH_SIZE=0; 
-   final int MAX_PATTERN_DEPTH=1; 
-   final int PATTERN_DEPTH_LIMIT = 10;
-   final int SQL_ERR_CLI_AUTH=-8837;
-   
-   /* don't ask me why mxci does this, but look at SqlCmd.cpp of
-    * mxci's code line 1534, and you'll see that 72 is their limit,
-    * after that they trim the whole last column header
-    */
-   final int MXCI_TRIM_FIX = 72;
-   
-   final int IQ=0;
-   final int SQLQ=1;
-   final int PRUNQ=2;
-   //final int CSQ=3;
-   final int NSQ=4;
-   final int CQ=5;      // conditional query
-   //final int SECQ=6; 
-   final int SPJQ=7;    // SPJ deployment
-
-   final int USERI=0;
-   final int PRUNI=1;
-   final int PERLI=2;
-   final int PYTHI=3;
-
-   final int SQL_MODE=0;
-   final int CS_MODE=2;
-   final int WMS_MODE=4;  
-
-   final int CONSOLE_INPUT=0;
-   final int FILE_INPUT=1;
-
-   final int CONSOLE_READ_MODE=0;
-   final int SCRIPT_READ_MODE=1;
-   final int OBEY_READ_MODE=2;
-
-   final int CONSOLE_WRITE_MODE=0;
-   final int LOG_WRITE_MODE=1;
-   final int SPOOL_WRITE_MODE=2;
-   final int CONSOLE_SPOOL_WRITE_MODE=3;
-   final int SILENT_SPOOL_WRITE_MODE=4;
-
-   final int CIDEFAULT_VIEW=0;
-   final int MXCI_VIEW=4;
-
-   final int RAW_FORMAT=0;
-   final int HTML_FORMAT=1;
-   final int XML_FORMAT=2;
-   final int CSV_FORMAT=3;
-
-   // include only the interface commands first tokens
-   final int iqKeyWordBase=100;
-   final int EXIT=iqKeyWordBase + 1;
-   //final int QUIT=iqKeyWordBase + 2;
-   final int DISCONNECT=iqKeyWordBase + 3;
-   final int SET=iqKeyWordBase + 4;
-   final int ED=iqKeyWordBase + 5;
-   final int EDIT=iqKeyWordBase + 6;
-   final int SPOOL=iqKeyWordBase + 7;
-   final int SLASH=iqKeyWordBase + 8;
-   final int RUN=iqKeyWordBase + 9;
-   final int SHOW=iqKeyWordBase + 10;
-   final int AT=iqKeyWordBase + 11;
-   final int OBEY=iqKeyWordBase + 12;
-   final int LOG=iqKeyWordBase + 13;
-   final int MODE=iqKeyWordBase+14;
-   final int RESET=iqKeyWordBase+15;
-   final int PRUN=iqKeyWordBase + 16;
-   final int SET_TIME=iqKeyWordBase+17;
-   final int SHOW_TIME=iqKeyWordBase+18;
-   final int SET_TIMING=iqKeyWordBase+19;
-   final int SHOW_TIMING=iqKeyWordBase+20;
-   final int SET_SQLPROMPT=iqKeyWordBase+21;
-   final int SHOW_SQLPROMPT=iqKeyWordBase+22;
-   final int SET_SQLTERMINATOR=iqKeyWordBase+23;
-   final int SHOW_SQLTERMINATOR=iqKeyWordBase+24;
-   final int SET_PARAM=iqKeyWordBase+25;
-   final int SHOW_PARAM=iqKeyWordBase+26;
-   final int SET_IDLETIMEOUT=iqKeyWordBase+27;
-   final int SHOW_IDLETIMEOUT=iqKeyWordBase+28;
-   final int SHOW_SCHEMA=iqKeyWordBase+29;
-   final int SHOW_CATALOG=iqKeyWordBase+30;
-   final int SHOW_CATALOGS=iqKeyWordBase+31;
-   final int SHOW_SCHEMAS=iqKeyWordBase+32;
-   final int SHOW_TABLES=iqKeyWordBase+33;
-   final int SHOW_VIEWS=iqKeyWordBase+34;
-   final int SHOW_TABLE=iqKeyWordBase+35;
-   final int SHOW_SYNONYMS=iqKeyWordBase+36;
-   final int SHOW_MVS=iqKeyWordBase+37;
-   final int SHOW_MVGROUPS=iqKeyWordBase+38;
-   final int HISTORY=iqKeyWordBase+39;
-   final int REPEAT=iqKeyWordBase+40;
-   final int FC=iqKeyWordBase+41;
-   final int CLEAR=iqKeyWordBase+42;
-   final int SET_LISTCOUNT=iqKeyWordBase+43;
-   final int SHOW_LISTCOUNT=iqKeyWordBase+44;
-   final int SECTION=iqKeyWordBase+45;
-   final int HELP=iqKeyWordBase+46;
-   final int SHOW_PROCEDURES=iqKeyWordBase+47;
-   final int ENV=iqKeyWordBase+48;
-   final int SHOW_MODE=iqKeyWordBase+49;
-   final int SESSION=iqKeyWordBase+50;
-   final int SHOW_SESSION=iqKeyWordBase+51;
-   final int SET_PROMPT=iqKeyWordBase+52;
-   final int SAVEHIST=iqKeyWordBase+53;
-   final int VERSION=iqKeyWordBase+54;
-   final int SET_LOOKANDFEEL=iqKeyWordBase+55;
-   final int SHOW_LOOKANDFEEL=iqKeyWordBase+56;
-   final int SET_SERVICE=iqKeyWordBase+57;
-   final int SHOW_SERVICE=iqKeyWordBase+58;
-   final int SET_DISPLAY_COLSIZE=iqKeyWordBase+59;
-   final int SHOW_DISPLAY_COLSIZE=iqKeyWordBase+60;
-   
-   final int SET_COLSEP=iqKeyWordBase+61;
-   final int SHOW_COLSEP=iqKeyWordBase+62;
-   final int CONNECT=iqKeyWordBase+63;
-   final int RECONNECT=iqKeyWordBase+64;
-   final int SHOW_PREPARED=iqKeyWordBase+65;
-   final int SET_HISTOPT=iqKeyWordBase+66;
-   final int SHOW_HISTOPT=iqKeyWordBase+67;
-   final int GET=iqKeyWordBase+68;
-   final int SET_STATISTICS=iqKeyWordBase+69;
-
-   final int LOCALHOST=iqKeyWordBase+70;
-
-   final int SET_MARKUP=iqKeyWordBase+71;
-   final int SHOW_MARKUP=iqKeyWordBase+72;
-   final int SHOW_PARAMS=iqKeyWordBase+73;
-   final int AUDIT=iqKeyWordBase+74;
-   final int SET_AUTOPREPARE=iqKeyWordBase+75;
-   final int SHOW_AUTOPREPARE=iqKeyWordBase+76;
-   final int ERROR=iqKeyWordBase+77;
-   final int SHOW_LASTERROR=iqKeyWordBase+78;
-   final int ONLINEDBDUMP=iqKeyWordBase+79;
-   final int SHOW_INVENTORY=iqKeyWordBase+80;
-   final int SHOW_RECCOUNT=iqKeyWordBase+81;
-   final int SRUN=iqKeyWordBase+82;
-   final int SHOW_STATISTICS=iqKeyWordBase+83;
-   final int ALLOW=iqKeyWordBase+84;
-   final int DENY=iqKeyWordBase+85;
-   final int SCHEDULE=iqKeyWordBase+86;
-   final int SHOW_ACCESS=iqKeyWordBase+87;
-   final int LIST=iqKeyWordBase+88;
-   final int LIST_OPENS=iqKeyWordBase+89;
-   final int LIST_LOCKS=iqKeyWordBase+90;
-   final int DELAY=iqKeyWordBase+91;
-   final int SHOW_ERRORCODE=iqKeyWordBase+92;
-   final int SHOW_ACTIVITYCOUNT=iqKeyWordBase+93;
-   final int SET_CMDECHO=iqKeyWordBase+94;
-
-   final int ALIAS=iqKeyWordBase+95;
-   final int SHOW_ALIAS=iqKeyWordBase+96;
-   final int SHOW_ALIASES=iqKeyWordBase+97;
-
-   final int SET_FETCHSIZE=iqKeyWordBase+98;
-   final int SHOW_FETCHSIZE=iqKeyWordBase+99;
-   
-   final int SET_PATTERN=iqKeyWordBase+100;
-   final int SHOW_PATTERN=iqKeyWordBase+101;
-   final int SHOW_PATTERNS=iqKeyWordBase+102;
-   final int SET_PATTERNDEPTH=iqKeyWordBase+103;
-   final int SHOW_PATTERNDEPTH=iqKeyWordBase+104;
-   final int SET_DEBUG=iqKeyWordBase+105;
-   final int SHOW_DEBUG=iqKeyWordBase+106;
-   
-   final int DOTSQL = iqKeyWordBase+107;
-   final int DOTCS  = iqKeyWordBase+108;
-   final int DOTNS  = iqKeyWordBase+109;
-   final int DOTWMS = iqKeyWordBase+110;
-   final int DOTSEC = iqKeyWordBase+111;
-   
-   final int SET_CMDDISPLAY  =  iqKeyWordBase+112;
-   final int SHOW_CMDDISPLAY =  iqKeyWordBase+113;
-   final int CREATE_SERVER   =  iqKeyWordBase+114;
-   final int ALTER_SERVER    =  iqKeyWordBase+115;
-   final int DROP_SERVER     =  iqKeyWordBase+116;
-   final int INFO_SERVER     =  iqKeyWordBase+117;
-   final int CREATE_USER     =  iqKeyWordBase+118;
-   final int ALTER_USER      =  iqKeyWordBase+119;
-   final int DROP_USER       =  iqKeyWordBase+120;
-   final int CREATE_CSR      =  iqKeyWordBase+121;
-   final int CREATE_CERT     =  iqKeyWordBase+122;
-   final int INFO_CERT_POLICY = iqKeyWordBase+123;
-   final int INSERT_CERT     =  iqKeyWordBase+124;
-   final int ALTER_CERT_POLICY = iqKeyWordBase+125;
-   final int CHANGE_PASS     =  iqKeyWordBase+126;
-   final int SHOW_PROCESSNAME=  iqKeyWordBase+127;
-   final int CREATE_ROLE     =  iqKeyWordBase+128;
-   final int DROP_ROLE       =  iqKeyWordBase+129;   
-   final int GRANT_ROLE      =  iqKeyWordBase+130;
-   final int REVOKE_ROLE     =  iqKeyWordBase+131;
-   final int SET_DEFAULTROLE =  iqKeyWordBase+132;   
-   final int CREATE_PLATFORM_USER     = iqKeyWordBase+133;
-   final int SHOW_USER       =  iqKeyWordBase+136;
-   final int SHOW_SERVER     =  iqKeyWordBase+137;
-   final int ALTER_ROLE      =  iqKeyWordBase+138;
-   final int SHOW_ROLE       =  iqKeyWordBase+139;
-   final int SET_CONNECTOPT  =  iqKeyWordBase+140;
-   final int SHOW_CONNECTOPT =  iqKeyWordBase+141; 
-   final int INFO_POLICY     =  iqKeyWordBase+142; 
-   final int ALTER_POLICY    =  iqKeyWordBase+143;
-   final int INFO_USER       =  iqKeyWordBase+144;
-   final int INFO_POLICY_WITH_OPTION  =  iqKeyWordBase+145;
-   final int ALTER_LOG_POLICY =  iqKeyWordBase+146;
-   final int ALTER_PWD_COMPLEXITY_POLICY =  iqKeyWordBase+147;
-   final int ALTER_RESET_PWD_POLICY =  iqKeyWordBase+148;
-   final int ALTER_RESET_MOSTSECURE =  iqKeyWordBase+149;
-   final int ALTER_RESET_ALLDEFAULT =  iqKeyWordBase+150; 
-   final int ALTER_PWD_QUALITY_POLICY =  iqKeyWordBase+151;
-   final int INFO_ROLE      =  iqKeyWordBase+152;
-
-   final int LIST_JAR	= iqKeyWordBase+153;
-   final int LIST_JARS	= iqKeyWordBase+154;
-   final int UPLOAD_JAR	= iqKeyWordBase+155;
-   final int DROP_JAR	= iqKeyWordBase+156;
-
-   final int ADD_LIB	= iqKeyWordBase+157;
-   final int MODIFY_LIB	= iqKeyWordBase+158;
-   final int REMOVE_LIB	= iqKeyWordBase+160;
-
-   final int SHOW_INDEXES=iqKeyWordBase+159;
-   
-   // these are special query cases for 
-   // only to trim the output
-   final int sqKeyBase=500;
-   final int SHOWDDL=sqKeyBase+ 1;
-   final int REORG=sqKeyBase + 2;
-   final int REORGANIZE=sqKeyBase + 3;
-   final int MAINTAIN=sqKeyBase + 4;
-   final int SHOWLABEL=sqKeyBase + 5;
-   final int SHOWPLAN=sqKeyBase + 6;
-   final int SHOWSHAPE=sqKeyBase + 7;
-   final int SHOWCONTROL=sqKeyBase + 8;
-   final int INVOKE=sqKeyBase + 9;
-   final int REPLICATE=sqKeyBase + 10;
-   final int SHOWTRANSACTION=sqKeyBase + 11;
-
-   // these are only db queries
-   // but not a pass thru
-
-   final int dbqKeyBase=1000;
-   final int PREPARE=dbqKeyBase+1;
-   final int EXECUTE=dbqKeyBase+2;
-   final int EXPLAIN=dbqKeyBase+3;
-   final int INFOSTATS=dbqKeyBase+4;
-   final int SET_SCHEMA=dbqKeyBase+5;
-   final int SET_CATALOG=dbqKeyBase+6;
-   final int CALL=dbqKeyBase+7;
-   final int CONTROL=dbqKeyBase+8;
-
-   // conditional queries
-   final int condKeyBase=1500;
-   final int IF_THEN=condKeyBase+1;
-   final int LABEL=condKeyBase+2;
-   final int GOTO=condKeyBase+3;
-   
-   //version queries
-   final int versionKeyBase = 2000; 
-   final int VERSION_M5 = versionKeyBase;
-   final int VERSION_M6 = versionKeyBase+100;
-   final int VERSION_M7 = versionKeyBase+200;
-   final int VERSION_M8 = versionKeyBase+300;
-   final int VERSION_M9 = versionKeyBase+400;
-   final int VERSION_M10 = versionKeyBase+500;
-   final int VERSION_M11 = versionKeyBase+600;
-   
-   //mode change command string
-	final String CMDOPEN = "CMDOPEN";
-	final String WMSOPEN = "WMSOPEN";
-	final String CMDCLOSE = "CMDCLOSE";
-	final String WMSCLOSE = "WMSCLOSE";
-   
-   
-   
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/SessionError.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/SessionError.java b/core/conn/trafci/src/org/trafodion/ci/SessionError.java
deleted file mode 100644
index 1aa55a9..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/SessionError.java
+++ /dev/null
@@ -1,181 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-public interface SessionError
-{
-
-         //The third arugment represents the ERROR TYPE. I = Informational, W = Warning
-       ErrorObject CONSOLE_READER_ERR = new ErrorObject("29400", "Could not initialize the console reader.");
-       ErrorObject CONSOLE_WRITER_ERR =  new ErrorObject("29401", "Could not initialize the console writer.");
-       ErrorObject CMD_LINE_ARGS_ERR = new ErrorObject("29402", "Invalid Number of arguments passed.");
-       ErrorObject SCRIPT_FILE_NOT_FOUND = new ErrorObject("29403", "Could not find the script file specified.");
-       ErrorObject DRIVER_INIT_ERR = new ErrorObject("29404", "Could not instantiate the driver class.");
-       ErrorObject DRIVER_INIT_ILLEGAL_ERR = new ErrorObject("29405", "Could not instantiate the driver class because of an IllegalAccessException.");
-       ErrorObject DRIVER_CLASS_ERR = new ErrorObject("29406", "Could not find JDBC Type 4 Driver in the classpath.");
-
-       ErrorObject CONN_MAX_LIMIT_ERR = new ErrorObject("29407", "Failed to connect to the database. Connection limit exceeded");
-
-       ErrorObject SET_NO_OPTION = new ErrorObject("29408", "SET command must have an option specified.");
-       ErrorObject SHOW_NO_OPTION = new ErrorObject("29409", "SHOW command must have an option specified.");
-       ErrorObject OBEY_FILE_NOT_FOUND = new ErrorObject("29410", "Could not find the file specified.");
-       ErrorObject SPOOL_FILE_NOT_FOUND = new ErrorObject("29411", "Could not create the spool file.");
-       ErrorObject CMD_NOT_CS_SUPPORTED = new ErrorObject("29412", "This command is not supported in CS mode.");
-       ErrorObject CMD_NOT_SQL_SUPPORTED = new ErrorObject("29414", "This command is not supported in SQL mode.");
-       ErrorObject CMD_NOT_MODE_SUPPORTED = new ErrorObject("29415", "This command is not supported in current mode.");   
-       
-       //Warnings
-       ErrorObject SHOW_TAB_NOT_FOUND = new ErrorObject("29416", "No tables found.", 'I');
-       ErrorObject SHOW_CAT_NOT_FOUND = new ErrorObject("29417", "No catalogs found.", 'I');
-       ErrorObject SHOW_SCH_NOT_FOUND = new ErrorObject("29418", "No schemas found.", 'I');
-       ErrorObject SHOW_VIEW_NOT_FOUND = new ErrorObject("29419", "No views found.", 'I');
-       ErrorObject SHOW_SYNONYM_NOT_FOUND = new ErrorObject("29420", "No synonyms found.", 'I');
-       ErrorObject SHOW_MV_NOT_FOUND = new ErrorObject("29421", "No materialized views found.", 'I');
-       ErrorObject SHOW_MVG_NOT_FOUND = new ErrorObject("29422", "No materialized view groups found.", 'I');
-       ErrorObject SHOW_PROC_NOT_FOUND = new ErrorObject("29423", "No procedures found.", 'I');
-       ErrorObject SHOW_TAB_IDX_NOT_FOUND = new ErrorObject("29424", "No indexes present for object, ", 'I');
-       ErrorObject SHOW_TAB_MVS_NOT_FOUND = new ErrorObject("29425", "No materialized views present for object, ", 'I');
-       ErrorObject SHOW_TAB_SYN_NOT_FOUND = new ErrorObject("29426", "No synonyms present for object, ", 'I');
-       ErrorObject SHOW_PREP_NOT_FOUND = new ErrorObject("29427", "No prepared statements found.", 'I');
-       ErrorObject SHOW_PARAM_NOT_FOUND = new ErrorObject("29428", "No parameters found.", 'I');
-       
-       //More Warnings
-       ErrorObject SPOOL_ON_ON = new ErrorObject("29429", "Spooling is already ON.", 'I');
-       ErrorObject SPOOL_OFF_OFF = new ErrorObject("29430", "Spooling is already OFF.", 'I');
-       ErrorObject STMT_NOT_FOUND = new ErrorObject("29431", "Prepared statement %s was not found.");
-       ErrorObject INVALID_PARAM_NUM = new ErrorObject("29432", "Invalid number of parameters for prepared statement %s.");
-       ErrorObject NUMERIC_VAL_REQ = new ErrorObject("29433", "Non-numeric value cannot be specified for numeric data type.");
-       ErrorObject SET_IDLETIMEOUT_VAL_ERR = new ErrorObject("29434", "Invalid IdleTimeout value. The value must be in the range 0-2147483647.");
-       ErrorObject SET_LISTCOUNT_VAL_ERR = new ErrorObject("29435", "Invalid ListCount value. The value must be in the range 0-2147483647.");
-       ErrorObject REPEAT_ERR = new ErrorObject("29436", "The specified statement does not exist in the history buffer.");
-       ErrorObject HISTORY_ERR = new ErrorObject("29437", "The maximum size of the history buffer is "+SessionDefaults.QRY_HISTORY_MAX_LMT+".");
-       ErrorObject HISTORY_BUF_ERR = new ErrorObject("29438", "The history buffer is empty.");
-       ErrorObject SLASH_ERR = new ErrorObject("29439", "The query buffer is empty.");
-       ErrorObject DIR_NOT_FOUND = new ErrorObject("29440", "Directory not found or"+SessionDefaults.lineSeperator+"does not have READ/WRITE permissions.");   
-       ErrorObject OBEY_SECTION_NOT_FOUND = new ErrorObject("29441", "was not found in file ");
-       ErrorObject SAVE_FILE_CREATE_ERROR = new ErrorObject("29442", "Could not create the specified file.");
-       ErrorObject DB_CONN_NOT_EXIST = new ErrorObject("29443", "Database connection does not exist. Please connect to the database by using the connect or the reconnect command.");
-       ErrorObject DB_DISCONNECT_ON_USER_REQ = new ErrorObject("29444", "The current operation has been cancelled and the connection to the database has been lost."+SessionDefaults.lineSeperator+"Please connect to the database by using the connect or the reconnect command.");
-       ErrorObject OPERATION_CANCELLED = new ErrorObject("29445", "The current operation has been cancelled.");
-       ErrorObject PRUN_CONN_CNT_ERR = new ErrorObject("29446", "Number of connections entered is not within the allowable range.");
-       ErrorObject INCORRECT_OVERWRITE_OPTION = new ErrorObject("29447", "Incorrect value specified for overwrite option.");
-       ErrorObject EXECUTE_PRIVILEGE_ERR = new ErrorObject("29448", "The user does not have EXECUTE privilege.");
-       ErrorObject SERVER_PRODUCT_ERR = new ErrorObject("29449", "Server product may not be installed or an internal error has occurred. Please contact support.");
-       ErrorObject CALL_ERR = new ErrorObject("29450", "This command is not supported by this JDBC Type 4 Driver version.");
-       ErrorObject INTERNAL_ERR = new ErrorObject("29451", "Internal error processing command.");
-       
-       ErrorObject INVALID_MAXCONN = new ErrorObject("29452", "Invalid value specified for property, trafci.prun.maxconn.");
-       ErrorObject NO_FILES_OF_EXTENSION = new ErrorObject("29453", "No files present with this extension.");
-       ErrorObject INVALID_CONN_VALUE = new ErrorObject("29454", "Invalid value specified for -c/connections option.");
-       ErrorObject UNKOWN_OPTION = new ErrorObject("29455", "Unknown option specified: ");
-       ErrorObject DEFAULT_OPTION_ERR = new ErrorObject("29456", "-d|defaults option cannot be specified with any other options.");
-       ErrorObject NWMS_NOT_STARTED = new ErrorObject("29457", "NWMS not started on this server.", 'W');
-       
-       ErrorObject SCRIPTS_DIR_NOT_FOUND = new ErrorObject("29458", "Scripts Directory not found or"+SessionDefaults.lineSeperator+"does not have READ/WRITE permissions.");
-       ErrorObject LOGS_DIR_NOT_FOUND = new ErrorObject("29459", "Logs Directory not found or"+SessionDefaults.lineSeperator+"does not have READ/WRITE permissions.");  
-       
-       
-       String GENERIC_SYNTAX_ERROR_CODE = "29460";
-       String SYNTAX_ERROR_PREFIX = "A syntax error occurred at or before:";
-       String ERROR_CODE_PREFIX = "*** ERROR[";
-       String ERROR_CODE_SUFFIX = "]";
-
-
-       ErrorObject LIST_NO_OPTION = new ErrorObject("29461", "LIST command must have an option specified.");
-       ErrorObject OBEY_PATH_NOT_FOUND = new ErrorObject("29462", "Could not find the file or directory specified.");
-       ErrorObject OBEY_WILDCARD_NOT_FOUND  =new ErrorObject("29463", "Could not find any file(s) with the specified extension.");
-       ErrorObject PARAM_NOT_FOUND = new ErrorObject("29464", "Param "); //Add Parameter name as suffix
-       
-       ErrorObject OBEY_BLANK_SESSION_ERR = new ErrorObject("29465","Obey commands inside of files are executed in non-interactive mode and require a filename or wildcard.");
-       ErrorObject OBEY_DEPTH_MAX = new ErrorObject("29466","The max obey depth has been reached, breaking current obey loop. Recursion detected in ");
-      String CS_SYNTAX_ERROR_CODE = "29467";
-      
-      ErrorObject SESSION_DISCONNECT_ERR = new ErrorObject("29468", "Session Disconnected. Please connect to the database by using connect/reconnect command.", 'I');
-      ErrorObject MULTIBYTE_DISP_WARN = new ErrorObject("29469", "Unable to align display for multibyte characters." +
-                                       " Try relaunching TrafCI with -Djava.awt.headless=true", 'W');
-
-      /* Conditional Errors */
-      ErrorObject VARIABLE_NOT_FOUND = new ErrorObject("29471", "Unable to find TrafCI variable ");
-      // use 29464 for PARAM_NOT_FOUND
-      ErrorObject INT_STR_COMPARISON = new ErrorObject("29472", "Unable to compare an integer with a string.");
-      ErrorObject STR_INT_COMPARISON = new ErrorObject("29473", "Unable to compare a string with an integer.");
-      ErrorObject INVALID_STRING_COMPARE = new ErrorObject("29474", "Unable to compare strings using the operator ");
-
-      ErrorObject MAX_DELAY_LIMIT = new ErrorObject("29475", "Invalid delay time specified. The value must be in the range 0-");
-      
-      // warning for label:
-      ErrorObject LABEL_WARNING = new ErrorObject("29476", "TrafCI encountered a blank label. Use the format LABEL <name>",'W');
-      ErrorObject OUT_OF_BOUNDS = new ErrorObject("29477","ArrayIndexOutOfBounds exception has occurred.");
-      ErrorObject MESSAGE_WARNING = new ErrorObject("29478", "Skipping command until a matching 'LABEL ",'W');
-      ErrorObject GOTO_MESSAGE = new ErrorObject("29479", "GOTO statement executed, ignoring all commands until a 'LABEL ",'W');
-      ErrorObject MATCHING_LABEL = new ErrorObject("29480", "Matching label encountered, no longer ignoring commands.",'I');
-      
-      /* Alias commands */
-      ErrorObject SHOW_ALIAS_NOT_FOUND = new ErrorObject("29481", "No aliases found.", 'I');
-      ErrorObject COMMAND_NAME_NOT_ALLOWED= new ErrorObject("29482", "Command name, ", 'I');
-      String COMMAND_NAME_NOT_ALLOWED_SUFFIX= " not allowed as Alias.";
-      ErrorObject INVALID_COMMAND_FOR_ALIAS = new ErrorObject("29483", "Alias on an alias not supported., ", 'I');
-            
-      ErrorObject SET_FETCHSIZE_VAL_ERR = new ErrorObject("29484", "Invalid fetch size value. The value must be in the range 0-2147483647.");
-            
-      /* Pattern commands */
-      ErrorObject SET_PATTERN_DEPTH_VAL_ERR = new ErrorObject("29485", "Invalid pattern depth value. The value must be in the range 0-" + SessionDefaults.PATTERN_DEPTH_LIMIT+ ".");
-      ErrorObject SHOW_PATTERN_NOT_FOUND = new ErrorObject("29486", "No patterns found.",'I');
-      String PATTERN_COMMAND_NAME_NOT_ALLOWED_SUFFIX= " not allowed as Pattern.";
-      ErrorObject INVALID_REGEXP = new ErrorObject("29487", "Invalid regular expression.",'I');
-      
-      /* Security commands */
-      ErrorObject CMD_NOT_SUPPORTED_SERVER = new ErrorObject("29488", "This command is not supported on this server version.");
-      ErrorObject FILE_NO_READ_PERMISSIONS = new ErrorObject("29489", "Unable to read the specified file.");
-      ErrorObject CMD_NOT_SEC_SUPPORTED = new ErrorObject("29490", "This command is not supported in SEC mode.");
-      ErrorObject CMD_NOT_WMS_SUPPORTED = new ErrorObject("29491", "This command is not supported in WMS mode.");
-      ErrorObject INVALID_NUMBER_FORMAT = new ErrorObject("29492", "Numeric value out of range ");
-      ErrorObject INFO_SEC_NO_ROWS = new ErrorObject("29493", "No server configuration found.",'I');
-      ErrorObject MISSING_PARM = new ErrorObject("29494", "Required Parameter ",'E');
-      ErrorObject INVALID_PWORD = new ErrorObject("29495", "Passwords do not match.",'E');
-      ErrorObject DUPLICATE_PARAM = new ErrorObject("29496", "Duplicate Parameter ",'E');
-      ErrorObject SET_DUMPPRIORITY_VAL_ERR = new ErrorObject("29497", "Invalid dump priority specified. The value must be in the range 1...199");
-      /* Param commands */
-      ErrorObject INVALID_PARAM_STRING_VALUE = new ErrorObject("29498", "Invalid parameter value. ");
-      ErrorObject SET_BACKUPSYNC_DURATION_ERR = new ErrorObject("29499", "Invalid backup sync duration specified. The value must be in the range 1...31");
-      //SPJ deployment error
-      ErrorObject JAR_EXTENSION_MISSING = new ErrorObject("29500", "JAR extension is missing. ");
-      ErrorObject JAR_EMPTY = new ErrorObject("29501", "JAR file is empty. Failed to upload jar file ", 'I');
-      ErrorObject JAR_EMPTY_FOLDER = new ErrorObject("29502", "Specified directory contains no JAR file. SPJ Uploading failed.");
-      
-      //Server Side errors start from 29550 - 29599
-      
-      ErrorObject MISSING_NODE_DUMP = new ErrorObject("29550","Missing Node Dump Pattern.");
-      ErrorObject MISSING_CORE_DUMP = new ErrorObject("29551","Missing Core File Pattern.");
-      ErrorObject MISSING_CORE_NODE_DUMP = new ErrorObject("29552","Missing Node Dump and Core File Pattern.");
-
-      ErrorObject NOT_SUPPORT = new ErrorObject("29553", "This platform does not support ", 'I');     
-      ErrorObject SHOW_TAB_TRIG_NOT_FOUND = new ErrorObject("29554", "No triggers present for object, ", 'I');
-     ErrorObject CMD_NOT_SEAQUEST_SUPPORTED = new ErrorObject("29555", "This command is not supported.");
-     ErrorObject CMD_ONLY_CS_SUPPORTED = new ErrorObject("29556", "This command is only supported in CS mode.");
-     ErrorObject CMD_ONLY_WMS_SUPPORTED = new ErrorObject("29557", "This command is only supported in WMS mode.");
-     ErrorObject CMD_ONLY_SQL_SUPPORTED = new ErrorObject("29558", "This command is only supported in SQL mode.");
-     ErrorObject CMD_SYNTAX_ERROR = new ErrorObject("29559", "A syntax error occurred in the command.");
-     ErrorObject SQL_RESERVED_WORD_ERROR = new ErrorObject("29560", "SQL is a reserved word. Please specify another string.");
-     ErrorObject WMS_RESERVED_WORD_ERROR = new ErrorObject("29561", "WMS is a reserved word. Please specify another string.");
-     ErrorObject CS_RESERVED_WORD_ERROR = new ErrorObject("29562", "CS is a reserved word. Please specify another string.");
-}


[15/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/QueryWrapper.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/QueryWrapper.java b/core/conn/trafci/src/main/java/org/trafodion/ci/QueryWrapper.java
new file mode 100644
index 0000000..75086c5
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/QueryWrapper.java
@@ -0,0 +1,700 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.awt.FontMetrics;
+import java.io.IOException;
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.ParameterMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Types;
+
+import org.trafodion.jdbc.t4.TrafT4Statement;
+
+
+
+import sun.misc.Signal;
+import sun.misc.SignalHandler;
+
+/**
+ * 
+ * 
+ * Abstract class for executing queries and formatting the result sets.
+ *
+ */
+
+public abstract class QueryWrapper
+{
+
+   Session sessObj=null;
+   Writer writer=null;
+   Reader reader=null;
+   Query qryObj=null;
+   String queryStr=null;
+   Parser parser=null;
+   Connection conn=null;
+   Statement stmt=null;
+   Utils utils=null;
+   UnKnownInterfaceCommand uic=null;
+   InterfaceSyntaxError ise=null;
+   ConditionalQueryException cqe=null;
+   ConditionalSyntaxError cse=null;
+   UserInterruption ui=null;
+   boolean isMultiLine=true;
+   boolean blankLiner=true;
+   SignalHandler CTRLCHandler=null;
+   Signal INTSignal=null;
+   int i = 0;
+   HTMLObject htmlObj = null;
+   XMLObject xmlObj = null;
+   String columnName="";
+   int colCount=1;
+   String crTrigTerminator ="/";
+   FontMetrics fontMetrics = null;
+   protected int isoMapping;
+   boolean useGetUpdateCount64 = true;
+   // false-show complete msg, true-no show
+   public boolean showStatusMsg = false;
+   
+   int[] colSize   ={};
+   int[] colAlign  ={};
+   String[] columnNameArray={};   
+   
+   /**
+   * creates an empty constructor.
+   *
+   */
+   QueryWrapper()
+   {
+
+   }
+
+   /**
+   * creates the query wrapper for t
+   */
+   QueryWrapper(Session sessObj)
+   {
+      this.sessObj=sessObj;
+      this.parser=new Parser();
+      this.utils=new Utils();
+      this.uic=new UnKnownInterfaceCommand();
+      this.ise=new InterfaceSyntaxError();
+      this.cqe=new ConditionalQueryException();
+      this.cse=new ConditionalSyntaxError();
+      this.ui=new UserInterruption();
+      if (sessObj.getCaller() != SessionDefaults.PRUNI)
+      {
+         CTRLCHandler =new SignalHandler ()
+         {
+            public void handle(Signal sig)
+            {
+               cancelQuery();
+            }
+         };
+         try {
+         INTSignal=new Signal("INT");
+         } catch (Exception e) {}
+      }
+      
+      fontMetrics = MultiByteUtils.getFontMetrics();
+      isoMapping = sessObj.getISOMapping();
+    
+      
+   }
+
+
+   /**
+   * Initializes the reader and writer objects
+   *
+   */
+   void init()
+   {
+      this.writer=sessObj.getWriter();
+      this.reader=sessObj.getReader();
+      this.qryObj=sessObj.getQuery();
+      this.conn=sessObj.getConnObj();
+      this.stmt=sessObj.getStmtObj();
+      try {
+         if (CTRLCHandler != null)
+         {
+            Signal.handle(INTSignal, CTRLCHandler);
+         }
+      }catch (Exception e) {}
+      sessObj.setCurrentStmtObj(null);
+
+   }
+
+
+
+   /**
+   * Reads the query string from the console or from a file depending on the 
+   * read mode.
+   * @throws IOException
+   * @throws UserInterruption 
+   */
+   void readQuery() throws IOException, UserInterruption
+   {
+      boolean matchTrigStmt=false;
+      String[] qryLineArr = null;
+      //queryStr=qryObj.getQueryText().trim();
+      queryStr=qryObj.getQueryText();
+
+      try {
+         if (CTRLCHandler != null)
+         {
+            Signal.handle(INTSignal, CTRLCHandler);
+         }
+      }catch (Exception e) {}
+
+      matchTrigStmt = isCreateTriggerCmd(qryObj.getQueryText());
+      //This is needed if user does a repeat
+      //on create trigger
+      if ((matchTrigStmt) && (queryStr.indexOf(SessionDefaults.lineSeperator) != -1))
+      {
+         qryLineArr = queryStr.split(SessionDefaults.lineSeperator);
+         if (qryLineArr[qryLineArr.length-1].equals(crTrigTerminator))
+         {
+            isMultiLine = false;
+         }
+      }
+
+      while (isMultiLine)
+      {
+         if ((matchTrigStmt)&& (utils.rtrim(queryStr).equals(crTrigTerminator)))
+            break;
+         else if ((!matchTrigStmt) && (queryStr.trim().toUpperCase().endsWith(sessObj.getSessionSQLTerminator())))
+            break;
+         if (( (writer.getWriterMode() == SessionDefaults.CONSOLE_WRITE_MODE ||
+            writer.getWriterMode() == SessionDefaults.CONSOLE_SPOOL_WRITE_MODE))  )
+         {
+            if((reader.getReadMode() == SessionDefaults.OBEY_READ_MODE  && !sessObj.isQuietEnabled()) || !(reader.getReadMode() == SessionDefaults.OBEY_READ_MODE) )            
+                writer.getConsoleWriter().print(sessObj.getSessionCprompt());
+         }
+         try
+         {
+           
+            queryStr = reader.getNonBlankLine();
+            if (sessObj.isCmdEchoEnabled())
+               writer.getConsoleWriter().println(queryStr);
+         }
+         catch (UserInterruption ui)
+         {
+            sessObj.setQuery(null);
+            sessObj.setQueryInterrupted(false);
+            throw ui;
+         }
+
+         if ((queryStr == null))
+         {
+            if (matchTrigStmt)
+               queryStr = crTrigTerminator;
+            else
+               queryStr=sessObj.getSessionSQLTerminator();
+         }
+
+         if (writer.getWriterMode() == SessionDefaults.LOG_WRITE_MODE)
+            writer.getLogWriter().writeln(queryStr);
+         else if (reader.getReadMode() == SessionDefaults.CONSOLE_READ_MODE && writer.getWriterMode() == SessionDefaults.CONSOLE_SPOOL_WRITE_MODE)
+         {
+            if (sessObj.isLogCmdText())
+               writer.getSpoolWriter().writeln(queryStr);
+         }else if ((reader.getReadMode() == SessionDefaults.OBEY_READ_MODE ) || ( sessObj.getCaller() !=SessionDefaults.PRUNI && reader.getReadMode() == SessionDefaults.SCRIPT_READ_MODE ))
+         {
+            writer.getConsoleWriter().println(queryStr);
+            if (sessObj.isLogCmdText() && writer.getWriterMode() == SessionDefaults.CONSOLE_SPOOL_WRITE_MODE)
+               writer.getSpoolWriter().writeln(queryStr);
+         }
+
+         queryStr=parser.ignoreComments(queryStr);
+         qryObj.setQueryText(SessionDefaults.lineSeperator+queryStr);
+         matchTrigStmt = isCreateTriggerCmd(qryObj.getQueryText());
+
+         //queryStr=queryStr.trim();
+      }
+      sessObj.setTimerHold();
+      if ((blankLiner) && (sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT))
+      {
+          writer.writeln();
+      }
+      if (matchTrigStmt)
+      {
+         this.queryStr = Utils.trimSQLTerminator(sessObj.getQuery().getQueryText().trim(),"/");
+         isMultiLine = true;
+      }
+      else
+         this.queryStr = Utils.trimSQLTerminator(sessObj.getQuery().getQueryText().trim(),sessObj.getSessionSQLTerminator());
+      
+      this.queryStr = utils.rtrim(this.queryStr);
+      if (qryObj.getQueryType()==SessionDefaults.SQLQ)
+         sessObj.setPrevSQLQuery(this.queryStr);
+      parser.setRemainderStr(null);
+      parser.setRemainderStr(this.queryStr);
+
+      this.fixPopIndxUpdStatsCmds();
+   }
+   
+   protected void setQueryRowCount(Statement theStmt) throws SQLException
+   {
+       if(!useGetUpdateCount64){
+           qryObj.setRowCount(String.valueOf(theStmt.getUpdateCount()));
+           return;
+       }
+           
+       try
+       {
+           qryObj.setRowCount(String.valueOf(((TrafT4Statement)theStmt).getUpdateCount64())); 
+       }
+       catch(NoSuchMethodError nsme)
+       {
+           // for backwards compatibility
+           useGetUpdateCount64 = false;
+           qryObj.setRowCount(String.valueOf(theStmt.getUpdateCount()));
+       }
+    }
+
+   boolean isCreateTriggerCmd(String qryText)
+   {
+      if (qryText.toUpperCase().matches("(?s)^\\s*CREATE\\s+TRIGGER\\s+(.*)"))
+      {
+         return true;
+      }
+      return false;
+   }
+
+   void fixPopIndxUpdStatsCmds()
+   {
+      if ((qryObj.getQueryText().toUpperCase().matches("(?s)^\\s*POPULATE\\s+INDEX\\s+(.*)"))  
+         )
+      {
+         queryStr = queryStr.replaceAll(SessionDefaults.lineSeperator," ");
+      }
+   }
+   
+   /**
+   * cancels the current query if ctrl + C is pressed. 
+   * 
+   */
+   void cancelQuery()
+   {
+      sessObj.setQueryInterrupted(true);
+      if (sessObj.getCurrentStmtObj() != null)
+      {
+         try
+         {
+            ((Statement)sessObj.getCurrentStmtObj()).cancel();
+              sessObj.setDBConnExists(false);
+              if (sessObj.isDotModeCmd() ){
+            	sessObj.setLogCmdEcho(true);
+            	sessObj.setMode(sessObj.getPrevMode());
+              }
+         } catch (SQLException e){}
+      }
+      
+   }
+
+
+
+   public abstract void execute() throws IOException, SQLException, UnKnownInterfaceCommand, UserInterruption, ConditionalQueryException ;
+
+   boolean dbExecute(Object st ) throws SQLException, IOException
+   {
+	   boolean status=false;
+
+      try {
+         if (CTRLCHandler != null)
+         {
+            Signal.handle(INTSignal, CTRLCHandler);
+         }
+      }catch (Exception e) {}
+
+      try
+      {
+
+         sessObj.setCurrentStmtObj(st);
+         sessObj.setQueryInterrupted(false);
+
+         if (st instanceof CallableStatement)
+         {
+            status=((CallableStatement)st).execute();
+            sessObj.setSPJRS(status);
+         }else if (st instanceof PreparedStatement)
+         {
+            status=((PreparedStatement)st).execute();
+         }
+         else if (st instanceof Statement)
+         {
+            status=((Statement)st).execute(queryStr);
+         }
+
+      }catch (SQLException sqle)
+      {
+         if (sessObj.isQueryInterrupted() && sqle.getErrorCode() == -29157)
+         {
+            sessObj.setDBConnExists(false);
+
+         }
+         throw sqle;
+      }
+	   sessObj.setQryExecEndTime();
+	   
+      return status;
+   }
+   
+   boolean dbExec(Object st) throws SQLException, IOException
+   {
+	   boolean status = dbExecute(st);
+	   
+	   /*if (sessObj.getMode() == SessionDefaults.SQL_MODE &&
+	         writer != null &&
+	         qryObj.getQueryType() != SessionDefaults.IQ)
+	         writer.writeExecutionTime(sessObj, utils, writer);
+           */	   
+	   return status;
+   }
+
+   void writeSeparator() throws IOException
+   {
+      if (sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
+         write(sessObj.getSessionColSep());
+      write(sessObj.getSessionColSep());
+   }
+
+   void write(String output) throws IOException
+   {
+      switch (sessObj.getDisplayFormat())
+      {
+         //HTML Format
+         case SessionDefaults.HTML_FORMAT:
+            sessObj.getHtmlObj().processHtml(output);
+            writer.writeln();
+            break;
+
+         //XML Format
+         case SessionDefaults.XML_FORMAT:
+            sessObj.getXmlObj().processXml(this.columnName,output);
+            writer.writeln();
+            break;
+
+         //CSV Format
+         case SessionDefaults.CSV_FORMAT:
+            writer.write(output);
+            if (qryObj.getColCount() != null)
+            {
+               if (colCount == Integer.parseInt(qryObj.getColCount()))
+               {
+                  writer.write(SessionDefaults.lineSeperator);
+                  colCount=1;
+                  break;
+               }
+            }
+            colCount++;
+            if (sessObj.getStrDisplayFormat().equalsIgnoreCase("COLSEP"))
+               writer.write(sessObj.getSessionColSep());
+            else
+               writer.write(",");
+            break;
+
+         //Default Raw Format
+         default: writer.write(output);
+            break;
+      }
+   }
+
+
+   void writeln(String output) throws IOException
+   {
+      write(output);
+      write(SessionDefaults.lineSeperator);
+   }
+
+   void writeln() throws IOException
+   {
+      write(SessionDefaults.lineSeperator);
+   }
+
+   void formatOutput(String output,int colWidth,char fillchar,int align) throws IOException
+   {
+
+     int outputStrLen = 0;
+      
+      if (output != null && output.length() > colWidth)
+      {
+         output=output.substring(0,colWidth);
+      } 
+      StringBuffer outBuffer=new StringBuffer(output);
+
+      if (sessObj.isMultiByteAlign() && (isoMapping == 10 || isoMapping == 15)) //SJIS or UTF8
+      {
+         try {
+         outputStrLen = getMultiByteColWidth(outBuffer);
+         }catch (Exception ex)
+         {
+            ex.printStackTrace();
+            throw new IOException(ex.getMessage());
+         }
+      }
+      else
+      {
+         outputStrLen = outBuffer.length();
+      }
+      //If the output is greater than the column width,
+      //truncate the output
+      
+      if (outputStrLen > colWidth)
+      {
+         outBuffer = new StringBuffer(outBuffer.substring(0,Math.min(colWidth, outBuffer.length())));
+         outputStrLen = outBuffer.length();
+      }
+
+      if ( outputStrLen <= colWidth)
+      {
+    	 if (colWidth > 128)
+    		 colWidth = 128;
+         for (int i=outputStrLen;i<colWidth;i++)
+         {
+            if (align == 0)
+            {
+               outBuffer.append(fillchar);
+            }
+            else
+            {
+               outBuffer.insert(0,fillchar);
+            }
+         }
+
+         write( outBuffer.toString());
+
+      }
+      outBuffer=null;
+   }
+
+   void formatHtmlOutput(String output) throws IOException
+   {
+      write(output);
+   }
+
+   void formatXmlOutput(String columnName, String output) throws IOException
+   {
+      this.columnName = columnName;
+      write(output);
+   }
+
+   void formatCsvOutput(String output) throws IOException
+   {
+      write(output);
+   }
+
+   protected int getMultiByteColWidth(StringBuffer output)
+   {
+      if (null == fontMetrics)
+         return output.length();
+      
+      int refWidth = fontMetrics.charWidth('w');
+      int width=0;
+     
+       for (int i=0; i< output.length(); i++)
+      {
+         int tmpLen=fontMetrics.charWidth(output.charAt(i));
+         //incorrect value of char width. Treat it as no-ASCII.
+         if(tmpLen==0 || tmpLen>fontMetrics.getMaxAdvance())
+         {
+        	 if(output.charAt(i)>256)
+        	 {
+        		 tmpLen=refWidth*2-1;
+        	 }
+        	 else
+        	 {
+        		 tmpLen=refWidth;
+        	 }
+         } 
+         
+         width += (tmpLen/refWidth) + (tmpLen%refWidth>0?1:0);
+      }
+      
+      return width;
+   }
+
+   void writeQryOutParams(ResultSetMetaData rsmd,int numColumns,ParameterMetaData paramMetaData,CallableStatement callStmt) throws SQLException, IOException
+   {
+	   //   sessObj.setWriteParams(true);
+	      columnNameArray = new String[numColumns];
+	      colSize=new int[numColumns];
+	      colAlign=new int[numColumns];
+	      //qryObj.setColCount(String.valueOf(numColumns));
+	      for (int i=1;i<=numColumns;i++)
+	      {
+	         if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
+	            paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
+	         {
+	            int colNameSize = rsmd.getColumnName(i).length();
+	            if (colNameSize > rsmd.getColumnDisplaySize(i))
+	               colSize[i-1]=colNameSize;
+	            else
+	               colSize[i-1]=rsmd.getColumnDisplaySize(i);
+
+	            if (colSize[i-1] < SessionDefaults.MIN_COL_DISPLAY_SIZE)
+	            {
+	               colSize[i-1] = SessionDefaults.MIN_COL_DISPLAY_SIZE;
+	            }
+
+	            switch (sessObj.getDisplayFormat())
+	            {
+	               case SessionDefaults.RAW_FORMAT:
+	                  formatOutput(rsmd.getColumnName(i),colSize[i-1],' ',0);
+	                  if (i < numColumns)
+	                  {
+	                     writeSeparator();
+	                  }
+	                  break;
+
+	               case SessionDefaults.XML_FORMAT:
+	                  columnNameArray[i-1] = sessObj.getXmlObj().checkColumnNames(rsmd.getColumnName(i));
+	                  break;
+
+	               case SessionDefaults.HTML_FORMAT:
+	                  formatHtmlOutput(rsmd.getColumnName(i));
+	                  break;
+	               case SessionDefaults.CSV_FORMAT:
+	            	  formatCsvOutput(rsmd.getColumnName(i));
+	                  break;
+
+	               default:
+	                  break;
+	            }
+
+	            switch (rsmd.getColumnType(i))
+	            {
+	               case Types.BIGINT:
+	               case Types.BIT:
+	               case Types.DECIMAL:
+	               case Types.DOUBLE:
+	               case Types.FLOAT:
+	               case Types.INTEGER:
+	               case Types.NUMERIC:
+	               case Types.REAL:
+	               case Types.SMALLINT:
+	               case Types.TINYINT:
+	                  colAlign[i-1]=1;
+	                  break;
+	               default:
+	                  colAlign[i-1]=0;
+	                  break;
+
+	            }
+	         }
+	      }
+	      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+	      {
+	         writeln();
+	         for (int i=1;i<=numColumns ;i++)
+	         {
+	            if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
+	               paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
+	            {
+	               formatOutput("",colSize[i-1],'-',0);
+	               if (i < numColumns)
+	               {
+	                  writeSeparator();
+	               }
+	            }
+	         }
+	         writeln();
+
+	         if (sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
+	            writeln();
+	      }
+	      writeQryData(callStmt,numColumns,paramMetaData);
+	      qryObj.setRowCount("1");		      
+   }
+
+   private void writeQryData(CallableStatement callStmt,int numColumns, ParameterMetaData paramMetaData) throws SQLException, IOException
+   {
+      for (int i=1;i<=numColumns ;i++)
+      {
+         if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
+            paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
+         {
+            String value=callStmt.getString(i);
+            if (value == null)
+            {
+               value=sessObj.getSessNull();
+            }
+
+            switch (sessObj.getDisplayFormat())
+            {
+               case SessionDefaults.RAW_FORMAT :
+                  if (qryObj.isTrimOut())
+                  {
+                     formatOutput(value,value.length(),' ',0);
+                  }
+                  else
+                  {
+                     formatOutput(value,colSize[i-1],' ',colAlign[i-1]);
+                  }
+
+                  if (i < numColumns)
+                  {
+                     writeSeparator();
+                  }
+                  break;
+
+
+               case SessionDefaults.XML_FORMAT :
+                  formatXmlOutput(columnNameArray[i-1],value);
+                  break;
+
+               case SessionDefaults.HTML_FORMAT:
+                  formatHtmlOutput(value);
+                  break;
+
+               case SessionDefaults.CSV_FORMAT:
+                  formatCsvOutput(value.trim());
+                  break;
+            }
+         }
+      }
+
+      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+         writeln();
+   }
+   
+   void formatOutputVertical(String colHeading, String output) throws IOException
+   {
+	   if (colHeading != null)
+		   write( colHeading + ": " + output + SessionDefaults.lineSeperator);
+	   else
+		   write( output + SessionDefaults.lineSeperator);
+   }
+   
+	public boolean getShowStatusMsg() {
+		return this.showStatusMsg;
+	}
+
+	public void setShowStatusMsg(boolean showStatusMsg) {
+		this.showStatusMsg = showStatusMsg;
+	}
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/RawDisplay.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/RawDisplay.java b/core/conn/trafci/src/main/java/org/trafodion/ci/RawDisplay.java
new file mode 100644
index 0000000..84be925
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/RawDisplay.java
@@ -0,0 +1,189 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.awt.FontMetrics;
+import java.io.IOException;
+import java.util.ArrayList;
+
+public class RawDisplay implements IDisplay {
+
+	private Writer writer=null;
+	private Session sessObj=null;
+	private int isoMapping;
+	private FontMetrics fontMetrics = null;
+	
+	public RawDisplay(Session sessObj)
+	{
+		if(sessObj!=null)
+		{
+			this.sessObj = sessObj;
+			this.writer=sessObj.getWriter();
+			isoMapping = sessObj.getISOMapping();
+		}
+		fontMetrics = MultiByteUtils.getFontMetrics();
+	}
+
+	public void output(OutputContents contents) throws IOException {
+		// TODO Auto-generated method stub
+
+		if(contents!=null)
+		{
+			this.writer=sessObj.getWriter();
+			//display header
+			ArrayList<OutputColumnAttribute> columns = contents.getColumns();
+			if(columns!=null && columns.size()>0)
+			{
+				//display columns name
+				for(int i=0;i<columns.size();i++)
+				{
+					OutputColumnAttribute columnAttr = columns.get(i);
+					formatOutput(columnAttr.name,columnAttr.width,' ',columnAttr.align);					
+					writer.write(contents.getColumnSeparator());
+				}
+				writeln();
+				
+				//display column header separator
+				for(int i=0;i<columns.size();i++)
+				{
+					OutputColumnAttribute columnAttr = columns.get(i);
+					formatOutput("",columnAttr.width,'-',columnAttr.align);
+					writer.write(contents.getColumnSeparator());
+				}
+				writeln();
+			}
+			
+			//display contents
+			ArrayList<ArrayList<String>> alRows = contents.getRows();
+			if(alRows!=null && alRows.size()>0)
+			{
+				for(int i=0;i<alRows.size();i++)
+				{
+					ArrayList<String> alRow = alRows.get(i);
+					if(alRow!=null && alRow.size()>0)
+					{
+						for(int j=0;j<alRow.size();j++)
+						{
+							OutputColumnAttribute columnAttr = columns.get(j);
+							formatOutput(alRow.get(j),columnAttr.width,' ',columnAttr.align);
+							
+							writer.write(contents.getColumnSeparator());
+						}
+						writeln();
+					}
+					
+				}
+				writeln();
+			}
+		}
+	}
+
+	   void formatOutput(String output,int colWidth,char fillchar,int align) throws IOException
+	   {
+
+	     int outputStrLen = 0;
+	      
+	      if (output != null && output.length() > colWidth)
+	      {
+	         output=output.substring(0,colWidth);
+	      } 
+	      StringBuffer outBuffer=new StringBuffer(output);
+
+	      if (sessObj.isMultiByteAlign() && (isoMapping == 10 || isoMapping == 15)) //SJIS or UTF8
+	      {
+	         try {
+	         outputStrLen = getMultiByteColWidth(outBuffer);
+	         }catch (Exception ex)
+	         {
+	            ex.printStackTrace();
+	            throw new IOException(ex.getMessage());
+	         }
+	      }
+	      else
+	      {
+	         outputStrLen = outBuffer.length();
+	      }
+	      //If the output is greater than the column width,
+	      //truncate the output
+	      
+	      if (outputStrLen > colWidth)
+	      {
+	         outBuffer = new StringBuffer(outBuffer.substring(0,Math.min(colWidth, outBuffer.length())));
+	         outputStrLen = outBuffer.length();
+	      }
+
+	      if ( outputStrLen <= colWidth)
+	      {
+	         for (int i=outputStrLen;i<colWidth;i++)
+	         {
+	            if (align == 0)
+	            {
+	               outBuffer.append(fillchar);
+	            }
+	            else
+	            {
+	               outBuffer.insert(0,fillchar);
+	            }
+	         }
+
+	         writer.write( outBuffer.toString());
+
+	      }
+	      outBuffer=null;
+	   }
+
+	   protected int getMultiByteColWidth(StringBuffer output)
+	   {
+	      if (null == fontMetrics)
+	         return output.length();
+	      
+	      int refWidth = fontMetrics.charWidth('w');
+	      int width=0;
+	     
+	       for (int i=0; i< output.length(); i++)
+	      {
+	         int tmpLen=fontMetrics.charWidth(output.charAt(i));
+	         //incorrect value of char width. Treat it as no-ASCII.
+	         if(tmpLen==0 || tmpLen>fontMetrics.getMaxAdvance())
+	         {
+	        	 if(output.charAt(i)>256)
+	        	 {
+	        		 tmpLen=refWidth*2-1;
+	        	 }
+	        	 else
+	        	 {
+	        		 tmpLen=refWidth;
+	        	 }
+	         } 
+	         
+	         width += (tmpLen/refWidth) + (tmpLen%refWidth>0?1:0);
+	      }
+	      
+	      return width;
+	   }
+
+	   void writeln() throws IOException
+	   {
+		   writer.write(SessionDefaults.lineSeperator);
+	   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Reader.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Reader.java b/core/conn/trafci/src/main/java/org/trafodion/ci/Reader.java
new file mode 100644
index 0000000..f216f09
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Reader.java
@@ -0,0 +1,286 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class Reader
+{
+   private ConsoleReader cReader=null;
+   private FileReader sReader=null;
+   private FileReader oReader=null;
+   private List<FileReader> nestedObeyReaders=null;
+
+//   private boolean obeyFileList = false;
+   private int readMode=SessionDefaults.CONSOLE_READ_MODE;
+   private int prevReadMode=SessionDefaults.CONSOLE_READ_MODE;
+   private String tmpString=null;
+   private FileReader tmpReader=null;
+   
+   private HashMap<String, String> obeyHashMap = null;
+   private int MAX_OBEY_DEPTH;
+   
+   Reader()
+   {
+       int defaultDepth = 10;
+       
+       MAX_OBEY_DEPTH = defaultDepth;
+       try
+       {
+           if(System.getProperty("trafci.obeydepth") != null)
+               MAX_OBEY_DEPTH = Integer.parseInt(System.getProperty("trafci.obeydepth"));
+           
+           if(MAX_OBEY_DEPTH < 0)
+               MAX_OBEY_DEPTH = defaultDepth;
+       }
+       catch(Exception ex)
+       {
+               MAX_OBEY_DEPTH = defaultDepth;
+       }
+   } 
+   
+   public String getNonBlankLine() throws IOException, UserInterruption
+   {
+      
+      switch (readMode)
+      {
+         case SessionDefaults.CONSOLE_READ_MODE:
+            return cReader.getLine();
+         case SessionDefaults.SCRIPT_READ_MODE:
+            return sReader.getNonBlankLine();
+         case SessionDefaults.OBEY_READ_MODE:
+             
+             if(isObeyDepthMax(oReader.getFileName()))
+             {
+                 obeyHashMap = null;
+                 throw new IOException("\n\nERROR: " + SessionError.OBEY_DEPTH_MAX + oReader.getFileName());
+             }
+
+            tmpString=oReader.getNonBlankLine();
+            if (tmpString == null && ((tmpReader=getLastObeyReader()) != null))
+            {
+               obeyHashMap.remove(oReader.getFileName());
+               decrementHashMap(tmpReader.getFileName());
+               oReader.close();
+               
+               oReader=tmpReader;
+               return getNonBlankLine();
+            }
+            else
+                return tmpString;
+      }
+      return null;
+   }
+
+   public String getLine() throws IOException, UserInterruption
+   {
+
+      switch (readMode)
+      {
+         case SessionDefaults.CONSOLE_READ_MODE:
+            return cReader.getLine();
+         case SessionDefaults.SCRIPT_READ_MODE:
+            return sReader.getLine();
+         case SessionDefaults.OBEY_READ_MODE:
+            tmpString=oReader.getLine();
+            if (tmpString == null && ((tmpReader=getLastObeyReader()) != null))
+            {
+               oReader=tmpReader;
+               getLine();
+            }
+            return tmpString;
+      }
+      return null;
+   }
+
+   public ConsoleReader getConsoleReader()
+   {
+      return cReader;
+   }
+
+   public void setConsoleReader(ConsoleReader reader)
+   {
+      cReader = reader;
+   }
+
+   public FileReader getObeyReader()
+   {
+      return oReader;
+   }
+   
+   public List<FileReader> getObeyReaderList()
+   {
+       return this.nestedObeyReaders;
+   }
+
+   public void setObeyReader(FileReader reader)
+   {
+      // if the current mode is already obey read mode..then push the current object to the nested buffer
+      // and set the current reader
+
+      if (reader != null && readMode == SessionDefaults.OBEY_READ_MODE)
+      {
+         this.addObeyReader(oReader);
+         //this.obeyFileList = true;
+      }
+      else
+      {
+         //this.obeyFileList = false;
+         this.nestedObeyReaders = null;
+      }
+      
+      oReader = reader;
+   }
+
+   public FileReader getScriptReader()
+   {
+      return sReader;
+   }
+
+   public void setScriptReader(FileReader reader)
+   {
+      sReader = reader;
+   }
+
+   public int getReadMode()
+   {
+      return readMode;
+   }
+
+   public int getPrevReadMode()
+   {
+      return this.prevReadMode;
+   }
+
+   public void setReadMode(int readMode)
+   {
+      this.prevReadMode=this.readMode;
+      this.readMode = readMode;
+   }
+
+   private FileReader getLastObeyReader()
+   {
+      if (this.nestedObeyReaders == null)
+      {
+         return null;
+      }
+      FileReader fr=(FileReader)this.nestedObeyReaders.get(this.nestedObeyReaders.size()-1);
+      this.nestedObeyReaders.remove(this.nestedObeyReaders.size()-1);
+      if (this.nestedObeyReaders.size() == 0)
+      {
+         this.nestedObeyReaders=null;
+      }
+      return fr;
+   }
+
+   private void addObeyReader(FileReader obeyReader)
+   {
+      if (this.nestedObeyReaders == null)
+      {
+         this.nestedObeyReaders = new ArrayList<FileReader>();
+      }
+
+      if(this.obeyHashMap == null)
+      {
+          this.obeyHashMap = new HashMap<String, String>();
+      }
+      
+      incrementHashMap(obeyReader);
+   }
+   
+   public boolean obeyMultipleFiles(){
+     /* if (this.nestedObeyReaders == null){
+			     return false; 
+      } 
+     */
+	   
+      if (oReader.getFileName().equals(""))
+	 	   return false;
+	  else
+		   return true;
+   }
+   
+   private boolean isObeyDepthMax(String path)
+   {
+       if(obeyHashMap != null)
+       {
+           String tmpHashObject = obeyHashMap.get(path);
+           
+           if(tmpHashObject != null)
+           {
+               int obeyFileCount = Integer.parseInt(tmpHashObject); 
+               if(obeyFileCount == MAX_OBEY_DEPTH)
+               {
+                   return true;
+               }
+           }
+       }
+       return false;
+   }
+   
+   private void incrementHashMap(FileReader obeyReader){
+       String path = obeyReader.getFileName();
+       int obeyFileCount = 1;
+       
+       if(obeyHashMap.get(path) == null)
+       {
+           obeyHashMap.put(path, obeyFileCount + "");
+       }
+       else
+       {
+           obeyFileCount = Integer.parseInt(obeyHashMap.get(path));
+           obeyFileCount++;
+           obeyHashMap.put(path, obeyFileCount + "");  
+       }
+       
+       if(obeyFileCount <= MAX_OBEY_DEPTH)
+           this.nestedObeyReaders.add(obeyReader);
+   }
+
+   private void decrementHashMap(String path){
+       if(obeyHashMap.get(path) != null){
+           int obeyFileCount = Integer.parseInt(obeyHashMap.get(path));
+           obeyFileCount--;
+           obeyHashMap.put(path, obeyFileCount + "");   
+       }
+   }
+   
+   public boolean isReallyObeyfile()
+   {
+	   // Try an determine if this is really an obey file or
+	   // a stream of multiple commands constructed to run .sec
+	   
+	   // No obey files are being processed right now
+	   if (oReader == null || readMode != SessionDefaults.OBEY_READ_MODE)
+		   return false;
+	   //Only one obey file see if its for .sec
+	   if (this.nestedObeyReaders == null){
+		   if ( oReader.getFileName()== "")
+			     return false; 
+	   }
+   	   // One actual obey file or nested obey files
+	   return true;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/RepObjInterface.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/RepObjInterface.java b/core/conn/trafci/src/main/java/org/trafodion/ci/RepObjInterface.java
new file mode 100644
index 0000000..19b27b2
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/RepObjInterface.java
@@ -0,0 +1,27 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+public abstract class RepObjInterface {
+
+	public abstract String getValue(String key);
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ReplacementObj.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ReplacementObj.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ReplacementObj.java
new file mode 100644
index 0000000..d06fac6
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ReplacementObj.java
@@ -0,0 +1,39 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+public class ReplacementObj extends RepObjInterface {
+
+//	private String patternKey;
+	private String patternValue;
+	
+	ReplacementObj(String patternKey, String patternValue)
+	{
+//		this.patternKey = patternKey;
+		this.patternValue = patternValue;
+	}
+	
+	public String getValue(String patternKey)
+	{
+		return this.patternValue;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ScriptSectionNotFound.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ScriptSectionNotFound.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ScriptSectionNotFound.java
new file mode 100644
index 0000000..5456157
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ScriptSectionNotFound.java
@@ -0,0 +1,34 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class ScriptSectionNotFound extends Exception
+{
+   /**
+   * 
+   */
+   private static final long serialVersionUID = 1L;
+
+   ScriptSectionNotFound()
+   {
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ScriptsInterface.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ScriptsInterface.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ScriptsInterface.java
new file mode 100644
index 0000000..2413a2b
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ScriptsInterface.java
@@ -0,0 +1,153 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.sql.SQLException;
+
+public class ScriptsInterface
+{
+   Session sessObj=null;
+   SessionInterface siObj=null;
+   ConsoleReader crObj=null;
+   ConsoleWriter cwObj=null;
+
+
+   public ScriptsInterface()
+   {
+
+   }
+
+   public void openConnection(String userName,
+		      String password,
+		      String serverName,
+		      String portNumber,
+		      String dsnName) throws IOException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException
+  {
+	   String roleName = ""; //primary role
+	   openConnection( userName, password, roleName, serverName, portNumber, dsnName);
+	   
+  }
+
+   public void openConnection(String userName,
+      String password,
+      String roleName,
+      String serverName,
+      String portNumber,
+      String dsnName) throws IOException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException
+   {
+
+      //System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream("c:\\output.dat"))));
+      cwObj=new ConsoleWriter();
+      cwObj.setConsoleOut(false);
+      cwObj.initialize();
+      crObj=new ConsoleReader();
+      crObj.initialize();
+      siObj=new SessionInterface(crObj,cwObj);
+      if (portNumber == null || portNumber.trim().equals(""))
+      {
+         portNumber=SessionDefaults.portNumber;
+      }
+      portNumber=":"+portNumber;
+
+	  if (portNumber.endsWith("#"))
+
+	  {
+
+		  portNumber = portNumber.substring(0, portNumber.length() - 1);
+
+	  }
+
+
+        try {
+      sessObj=siObj.createSession(userName,
+         roleName,
+         password,
+         serverName,
+         portNumber,
+         dsnName,
+         0);
+  } finally {
+		  cwObj.setConsoleOut(true);
+	  }
+
+   }
+
+   public String executeQuery(String query) throws IOException
+   {
+      cwObj.resetStream();
+      cwObj.setConsoleOut(false);
+      sessObj.setCaller(SessionDefaults.USERI);
+      siObj.setScriptFile(null);
+      siObj.setLogFile(null,false);
+      if (sessObj == null)
+      {
+         System.out.println("session object is null");
+
+      }
+
+      if (sessObj.getConnObj() == null)
+      {
+         System.out.println("connection object is null");
+      }
+
+      if (sessObj.getConsoleWriter() == null)
+      {
+         System.out.println("Console writer is null");
+      }
+      siObj.setConsoleWriter(cwObj);
+      siObj.setConsoleReader(crObj);
+      siObj.setQueryOptions(true, query);
+      String cmdOutput = "";
+      
+      try {
+      siObj.invokeSession(sessObj);
+      cmdOutput = cwObj.getResult();
+      } finally {
+    	  cwObj.setConsoleOut(true);
+      }
+      
+      return cmdOutput;
+   }
+
+   public void executeScript(String scriptFile, String logFile) throws IOException
+   {
+      cwObj.setConsoleOut(true);
+      siObj.setScriptFile(scriptFile);
+      siObj.setLogFile(logFile,true);
+      siObj.setQueryOptions(false,null);
+      sessObj.setCaller(SessionDefaults.PRUNI);
+      siObj.invokeSession(sessObj);
+   }
+
+   public void disconnect() throws SQLException
+   {
+      this.sessObj.getConnObj().close();
+      this.sessObj=null;
+      this.siObj=null;
+   // This will support multiple connections
+   //     System.exit(0); 
+   }
+
+
+}



[02/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/UserInterruption.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/UserInterruption.java b/core/conn/trafci/src/org/trafodion/ci/UserInterruption.java
deleted file mode 100644
index 431d189..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/UserInterruption.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class UserInterruption extends Exception
-{
-
-   /**
-   * 
-   */
-   private static final long serialVersionUID = 1L;
-
-   UserInterruption()
-   {
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Utils.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Utils.java b/core/conn/trafci/src/org/trafodion/ci/Utils.java
deleted file mode 100644
index 54184a6..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Utils.java
+++ /dev/null
@@ -1,381 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.regex.*;
-
-public class Utils
-{
-
-   static HashMap<String, String> xmlHashMap = new HashMap<String, String>();
-
-   Utils()
-   {
-
-   }
-
-
-
-  static String trimSQLTerminator(String qryStr,String sqlTerminator)
-   {
-	  if (qryStr.toUpperCase().endsWith(sqlTerminator))
-      {
-		  qryStr = qryStr.substring(0,qryStr.length()- sqlTerminator.length());
-      }
-	  
-      return qryStr;
-   }
-
-   String formatString(String output,int colWidth,char fillchar,String appendStr)
-   {
-      if (output == null)
-      {
-         return null;
-      }
-
-
-
-      if (appendStr != null)
-      {
-         colWidth=colWidth - appendStr.length();
-      }
-
-      output=formatString(output,colWidth,fillchar);
-
-      if (appendStr != null && output != null)
-      {
-         output+=appendStr;
-      }
-
-
-      return output;
-
-   }
- //dead code. Removed by Kevin Xu
-/*
-   String formatStringWordwrap(String output,int colWidth,char fillchar,String appendStr)
-   {
-      int beginIndex,endIndex;
-      String valueStr;
-
-      if (output == null)
-      {
-         return null;
-      }
-
-      // This is the case where the length of the value exceeds the
-      // column width
-      if ((appendStr !=null) && (appendStr.length()> colWidth-output.length()))
-      {
-         //print atleast five fill characters
-         int labelWidth = output.length() + 5;
-         StringBuffer blankOutput = new StringBuffer();
-         for (int i=0;i<labelWidth;i++)
-            blankOutput.append(' ');
-
-         output=formatString(output,labelWidth,fillchar);
-
-         //break the value into multiple strings to print
-         //on separate lines
-         colWidth = colWidth-labelWidth;
-         for (beginIndex=0,endIndex=colWidth;
-            endIndex<=appendStr.length();
-            beginIndex=endIndex,endIndex+=colWidth)
-         {
-            valueStr = appendStr.substring(beginIndex,endIndex);
-            if (beginIndex==0)
-               output+=valueStr;
-            else
-               output = output + SessionDefaults.lineSeperator + blankOutput + valueStr ;
-
-         }
-         if (endIndex > appendStr.length())
-            output = output + SessionDefaults.lineSeperator + blankOutput + appendStr.substring(beginIndex);
-
-         return output;
-      }
-
-      if (appendStr != null)
-      {
-         colWidth=colWidth - appendStr.length();
-      }
-
-      output=formatString(output,colWidth,fillchar);
-
-      if (appendStr != null && output != null)
-      {
-         output+=appendStr;
-      }
-
-
-      return output;
-
-   }
-*/
-   String formatString(String output,int colWidth,char fillchar)
-   {
-      StringBuffer outBuffer=null;
-
-      if (output == null)
-      {
-         return null;
-      }
-
-      outBuffer=new StringBuffer(output);
-
-
-      if (outBuffer.length() <= colWidth)
-      {
-         for (int i=outBuffer.length();i<colWidth;i++)
-            outBuffer.append(fillchar);
-
-      }
-
-      return outBuffer.toString();
-
-   }
-
-   // Change the string to lowerCase and capitalize the starting character and any character
-   // followed by _ and remove _(under score)
- //dead code. Removed by Kevin Xu
-/*
-   String initCap(String value)
-   {
-      StringBuffer buffer=null;
-
-      if (value == null)
-         return value;
-
-      buffer=new StringBuffer();
-
-      char[] valueArray=value.toLowerCase().toCharArray();
-
-      // capitalize the first character
-
-      buffer.append(Character.toUpperCase(valueArray[0]));
-
-      boolean changeCase=false;
-
-      for (int i=1;i<valueArray.length;i++)
-      {
-         if (valueArray[i] =='_')
-         {
-            changeCase=true;
-            i++;
-         }
-         else
-            changeCase=false;
-
-         if (changeCase)
-            buffer.append(Character.toUpperCase(valueArray[i]));
-         else
-            buffer.append(valueArray[i]);
-      }
-
-      return buffer.toString();
-
-
-   }
-  
-   public String trimSingleQuote(String value)
-   {
-      if (value!=null && value.startsWith("'") && value.endsWith("'"))
-      {
-         value=value.substring(1,value.length()-1);
-         value=value.replaceAll("''","'");
-      }
-      return value;
-   }
- */
-   public String trimDoubleQuote(String value)
-   {
-      if (value!=null && value.startsWith("\"") && value.endsWith("\""))
-      {
-         value=value.substring(1,value.length()-1);
-         //value=value.replaceAll("''","'");
-      }
-      return value;
-   }
- //dead code. Removed by Kevin Xu
-/*
-   public String uppQuoteStr(String strValue)
-   {
-      if (strValue != null && !isQuoted(strValue))
-         return strValue.toUpperCase();
-      else
-         return strValue;
-
-   }
-
-   boolean isQuoted(String source)
-   {
-      if (source != null)
-      {
-         source=source.trim();
-         if (source.startsWith("\"") && source.endsWith("\""))
-            return true;
-         else
-            return false;
-      }
-
-      return false;
-   }
-*/
-   public String getTimeinWords(long time)
-   {
-      int hrs = getHrs(time);
-      int mins = getMinutes(time);
-      int secs = getSeconds(time);
-      int msecs = getMilliseconds(time);
-      StringBuffer sb = new StringBuffer();
-
-      if (hrs > 0)
-      {
-         sb.append(hrs);
-         sb.append(" hours and ");
-      }
-      if (mins > 0)
-      {
-         sb.append(mins);
-         sb.append(" minutes and ");
-      }
-      //if (secs != 0) {
-      if (secs > 0 && secs != 1)
-      {
-         sb.append(secs);
-         sb.append(" seconds.");
-      }
-      if ((secs == 0 || secs == 1) && msecs >= 0)
-         sb.append("1 second.");
-
-      return sb.toString();
-   }
-
-   public String millisecondsToString(long time)
-   {
-      int milliseconds = getMilliseconds(time);
-      int seconds = getSeconds(time);
-      int minutes = getMinutes(time);
-      int hours = getHrs(time);
-      String millisecondsStr = (milliseconds<10 ? "00" : (milliseconds<100 ? "0" : ""))+milliseconds;
-      String secondsStr = (seconds<10 ? "0" : "")+seconds;
-      String minutesStr = (minutes<10 ? "0" : "")+minutes;
-      String hoursStr = (hours<10 ? "0" : "")+hours;
-      return new String(hoursStr+":"+minutesStr+":"+secondsStr+"."+millisecondsStr);
-
-   }
-
-   public int getMilliseconds(long time)
-   {
-      return (int)(time % 1000);
-   }
-   public int getSeconds(long time)
-   {
-      return (int)((time/1000) % 60);
-   }
-   public int getMinutes(long time)
-   {
-      return (int)((time/60000) % 60);
-   }
-   public int getHrs(long time)
-   {
-      return (int)((time/3600000) % 24);
-   }
-
-   public String formatXMLdata(String xmlData)
-   {
-
-      Pattern p = Pattern.compile("(<|&|\'|\"|>)");
-      Matcher m = p.matcher(xmlData);
-      StringBuffer strBuf = new StringBuffer();
-      while (m.find())
-      {
-         m.appendReplacement(strBuf, (String) xmlHashMap.get(m.group() ));
-      }
-      m.appendTail(strBuf);
-      return strBuf.toString();
-   }
-
-   static
-   {
-      xmlHashMap.put("&", "&amp;");
-      xmlHashMap.put("<", "&lt;");
-      xmlHashMap.put(">", "&gt;");
-      xmlHashMap.put("\"", "&quot;");
-      xmlHashMap.put("\'", "&apos;");
-   }
-
-   public String rtrim(String tmpStr)
-   {
-      tmpStr = tmpStr.replaceAll("\\s+$","");
-      return tmpStr;
-   }
-
-   public String removeSpaces(String str)
-   {
-      str = str.replaceAll("\\s+", "");
-      return str;
-   }
-   
-   public static String execLocalhostCmd(String cmd)  throws IOException 
-   {
-
-      Runtime runtime = Runtime.getRuntime();
-      Process proc = runtime.exec(cmd);
-
-      InputStream is = proc.getInputStream();
-      InputStreamReader isr = new InputStreamReader(is);
-      BufferedReader bufReader = new BufferedReader(isr);
-
-      String line="";
-      StringBuffer sbuf =new StringBuffer("");
-      while ((line = bufReader.readLine()) != null) {
-        sbuf.append(line);
-      }
-   
-      try {
-        if (proc.waitFor() != 0) {
-          //System.err.println("Exit Value = " +   proc.exitValue());
-        }
-      }
-      catch (InterruptedException e) {
-        System.err.println(e);
-      }
-      return sbuf.toString();
-   }
-   
-   public static String internalFormat2(String name)
-   {
-       int index = -1;
-       while((index = name.indexOf('"', index+2)) != -1)
-       {
-       	name = name.substring(0,index) + "\\" +name.substring(index);
-       }
-       return name;
-   }
-   
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ValidateQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ValidateQuery.java b/core/conn/trafci/src/org/trafodion/ci/ValidateQuery.java
deleted file mode 100644
index fb40fb2..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ValidateQuery.java
+++ /dev/null
@@ -1,412 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-/* 
- * This class verifies the first key word of any sql string passed and  
- * categorizes the type of sql. The query type is set in the query object
- */
-
-import java.util.HashMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-//import java.util.Iterator;
-//import java.util.Map;
-//import java.util.TreeMap;
-
-
-public class ValidateQuery implements SessionDefaults
-{
-   private Query qryObj=null;
-   private HashMap<String, String> fKeyMap;
-   NullKeyWordException nke;          // if the user enters blank throw this exception
-   InterfaceQueryException iqe;     // if the token is not listed throw this exception
-   Session sessObj=null;
-   
-   
-
-
-   ValidateQuery(Session sessObj)
-   {
-      fKeyMap=new HashMap<String, String>();
-      loadfKeyConstants();
-      nke=new NullKeyWordException();
-      iqe=new InterfaceQueryException();
-      this.sessObj=sessObj;
-   }
-
-   public HashMap<String, String> getfKeyMap(){
-	   return fKeyMap;
-   }
-
-   public Query getQuery()
-   {
-      return qryObj;
-   }
-   public void setQuery(Query qryObj)
-   {
-      this.qryObj = qryObj;
-   }
-
-   public void validate(Query qryObj,String sqlTerminator) throws NullKeyWordException
-   {
-      this.qryObj=qryObj;
-      String qryText= qryObj.getQueryText();
-
-      if (qryText != null)
-      {
-         qryText=Utils.trimSQLTerminator(qryText.trim(),sqlTerminator);
-      }
-
-      // check the query string and return NullKeyWord if its blank 
-      if ((qryText== null)||( qryText !=null && qryText.trim().equals("")))
-      {
-         throw nke;
-      }
-
-      String fKeyWord=getFirstToken(qryText);
-
-      // this case should not happen because we are checking for non space characters
-      if (fKeyWord==null)
-      {
-         throw nke;
-      }
-     
-      /*Check for Alias*/
-      if(sessObj.getAliasMap()!=null && qryText!=null)
-      {    
-        if(!(qryText.trim().equals("")))
-        {
-            if(sessObj.getAliasMap().containsKey(fKeyWord.toUpperCase()))
-    	    {
-            	qryText = qryObj.getQueryText().replaceFirst(replaceRegexCharacter(fKeyWord), sessObj.getAlias(fKeyWord.toUpperCase())); 
-       	   	    qryObj.resetQueryText(qryText);
-       	   	    qryText=Utils.trimSQLTerminator(qryText.trim(),sqlTerminator);
-       	   	    fKeyWord=getFirstToken(qryText);
-    	    }
-        }
-      }
-      
-      // if the first key word starts with @ , replace it with obey
-      if (fKeyWord.startsWith("@"))
-      {
-         fKeyWord="@";
-		 qryText = qryText.replaceFirst("@", "@ ");
-		 qryObj.resetQueryText(qryText);
-      }
-
-      //replace the first key word with its associated constant value
-      // from fKeyMap has table
-		fKeyWord = fKeyMap.get(fKeyWord.toUpperCase());
-
-      // if the constant value is not found, its defintely a sql or some other
-      // unknown tokens. so set the query type to SQL 
-      // set the query id -1 as its unknown at this time
-      if (fKeyWord == null)
-      {
-		if (sessObj.getMode() == SQL_MODE )
-					qryObj.setQueryType(SQLQ);
-
-         qryObj.setMultiLine(true);
-         qryObj.setPassThrough(true);
-         qryObj.setQueryId(-1);
-         return;
-      }
-
-      // convert the string integer to int
-      // we dont need to catch exception here as we made sure
-      // that the constant is int and present in the fKeyMap
-      int fKeyId=Integer.parseInt(fKeyWord);
-
-      switch (fKeyId)
-      {
-         case PRUN:
-
-            qryObj.setQueryType(PRUNQ);
-            qryObj.setMultiLine(false);
-            qryObj.setPassThrough(false);
-            qryObj.setQueryId(fKeyId);
-            break;
-
-
-         case ALIAS:
-        	 qryObj.setQueryType(IQ);
-        	 qryObj.setMultiLine(true);
-        	 qryObj.setPassThrough(false);
-        	 qryObj.setQueryId(fKeyId);
-        	 break;
-
-         case EXIT:
-         case ED:
-         case EDIT:
-         case FC:
-         case CLEAR:
-         case SLASH:
-         case RUN:
-         case SECTION:
-         case LOCALHOST:
-            //case AT:
-            qryObj.setQueryType(IQ);
-            qryObj.setMultiLine(false);
-            qryObj.setPassThrough(false);
-            qryObj.setQueryId(fKeyId);
-            break;
-
-         case SET:
-         case SPOOL:
-         case SHOW:
-         case OBEY:
-         case LOG:
-         case MODE:
-         case RESET:
-         case ENV:
-         case SESSION:
-         case HISTORY:
-         case REPEAT:
-         case HELP:
-         case SAVEHIST:
-         case VERSION:
-         case DISCONNECT:
-         case CONNECT:
-         case RECONNECT:
-         case SRUN:
-         case ERROR:
-         case ONLINEDBDUMP:
-         case AUDIT:
-         case SCHEDULE:
-         case ALLOW:
-         case DENY:
-         case LIST:
-         case DELAY:
-            qryObj.setQueryType(IQ);
-            qryObj.setMultiLine(false);
-            qryObj.setPassThrough(false);
-            qryObj.setQueryId(fKeyId);
-            break;
-
-         case INVOKE:
-         case SHOWDDL:
-         case SHOWSHAPE:
-         case SHOWCONTROL:
-         case SHOWTRANSACTION:
-         case REORG:
-         case REORGANIZE:
-         case MAINTAIN:
-         case REPLICATE:
-         case SHOWLABEL:
-         case SHOWPLAN:
-         case EXPLAIN:
-         case GET:
-
-            //qryObj.setQueryType(SQLQ);
-			if (SQL_MODE == sessObj.getMode() || CS_MODE == sessObj.getMode())
-				qryObj.setQueryType(SQLQ);
-			else if (sessObj.getMode() == WMS_MODE)
-				qryObj.setQueryType(NSQ);
-            qryObj.setMultiLine(true);
-            qryObj.setPassThrough(true);
-            qryObj.setQueryId(fKeyId);
-            qryObj.setTrimOut(true);    // set the trimout to true as we need to trim the result sets for all these cases
-            break;
-
-         case IF_THEN:
-         case LABEL:
-         case GOTO:
-            qryObj.setQueryType(CQ);
-            qryObj.setMultiLine((fKeyId == IF_THEN));
-            qryObj.setPassThrough(false);
-            qryObj.setQueryId(fKeyId);
-            break;
-         
-            
-         case DOTSQL:
-         case DOTCS:
-         case DOTNS:
-         case DOTWMS:
-         case DOTSEC:
-        	 qryObj.setQueryType(IQ);
-        	 qryObj.setMultiLine(false);
-        	 qryObj.setPassThrough(false);
-        	 qryObj.setQueryId(fKeyId);
-        	 break;
-         
-         default:
-//            if (sessObj.getMode()==SQL_MODE)
-			if (SQL_MODE == sessObj.getMode() || CS_MODE == sessObj.getMode())
-				qryObj.setQueryType(SQLQ);
-			else if (sessObj.getMode() == WMS_MODE)
-				qryObj.setQueryType(NSQ);
-            qryObj.setMultiLine(false);
-            qryObj.setPassThrough(false);
-            qryObj.setQueryId(fKeyId);
-            break;
-
-      }
-
-   }
-
-   // the first token will be any non-space characters as a word
-   // prefixed and suffixed with one or more spaces or
-   // line end
-   String getFirstToken(String fLine)
-   {
-      Pattern pat=Pattern.compile("^\\s*(\\S*)(\\s+.*|$)");
-      Matcher mat=pat.matcher(fLine);
-      if (mat.find())
-      {
-         return mat.group(1);
-      }
-      else
-         return null;
-   }
-
-   int getQueryId(String qryStr)
-   {
-	   String fToken= getFirstToken(qryStr);
-		fToken = fKeyMap.get(fToken.toUpperCase());
-	   if (fToken !=null)
-		   return Integer.parseInt(fToken);
-	   else 
-		   return -1;
-	   
-   }
-   
-//   public String trimSQLTerminator(String qryStr,String sqlTerminator)
-//   {
-//      if (qryStr.endsWith(sqlTerminator))
-//      {
-//         return qryStr.substring(0,qryStr.length()- sqlTerminator.length());
-//      }
-//      return qryStr;
-//   }
-
-   // load all first keywords which needs to be processed
-   private void loadfKeyConstants()
-   {
-      fKeyMap.put("PRUN",""+PRUN);
-      fKeyMap.put("EXIT",""+EXIT);
-      fKeyMap.put("QUIT",""+EXIT);
-      fKeyMap.put("DISCONNECT",""+DISCONNECT);
-      fKeyMap.put("SET",""+SET);
-      fKeyMap.put("RESET",""+RESET);
-      fKeyMap.put("ED",""+ED);
-      fKeyMap.put("SPOOL",""+SPOOL);
-      fKeyMap.put("LOG",""+LOG);
-      fKeyMap.put("/",""+SLASH);
-      fKeyMap.put("RUN",""+RUN);
-      fKeyMap.put("SHOW",""+SHOW);
-      fKeyMap.put("@",""+OBEY);
-      fKeyMap.put("MODE",""+MODE);
-      fKeyMap.put("OBEY",""+OBEY);
-      fKeyMap.put("HISTORY",""+HISTORY);
-      fKeyMap.put("REPEAT",""+REPEAT);
-      fKeyMap.put("INVOKE",""+INVOKE);
-      fKeyMap.put("SHOWDDL",""+SHOWDDL);
-      fKeyMap.put("SHOWSHAPE",""+SHOWSHAPE);
-      fKeyMap.put("SHOWCONTROL",""+SHOWCONTROL);
-      fKeyMap.put("REORG",""+REORG);
-      fKeyMap.put("REORGANIZE",""+REORGANIZE);
-      fKeyMap.put("MAINTAIN",""+MAINTAIN);
-      fKeyMap.put("SHOWLABEL",""+SHOWLABEL);
-      fKeyMap.put("SHOWPLAN",""+SHOWPLAN);
-      fKeyMap.put("PREPARE",""+PREPARE);
-      fKeyMap.put("EXECUTE",""+EXECUTE);
-      fKeyMap.put("EXPLAIN",""+EXPLAIN);
-      fKeyMap.put("INFOSTATS",""+INFOSTATS);
-      fKeyMap.put("FC",""+FC);
-      fKeyMap.put("CALL",""+CALL);
-      fKeyMap.put("CLEAR",""+CLEAR);
-      fKeyMap.put("HELP",""+HELP);
-      fKeyMap.put("?SECTION",""+SECTION);
-      fKeyMap.put("SAVEHIST",""+SAVEHIST);
-      fKeyMap.put("VERSION",""+VERSION);
-      fKeyMap.put("ENV",""+ENV);
-      fKeyMap.put("SESSION",""+SESSION);
-      fKeyMap.put("CONNECT",""+CONNECT);
-      fKeyMap.put("RECONNECT",""+RECONNECT);
-      fKeyMap.put("GET",""+GET);
-      fKeyMap.put("LOCALHOST",""+LOCALHOST);
-      fKeyMap.put("LH",""+LOCALHOST);
-      fKeyMap.put("ERROR",""+ERROR);
-      fKeyMap.put("ONLINEDBDUMP",""+ONLINEDBDUMP);
-      fKeyMap.put("SRUN",""+SRUN);
-      fKeyMap.put("ALLOW",""+ALLOW);
-      fKeyMap.put("DENY",""+DENY);
-      fKeyMap.put("SCHEDULE",""+SCHEDULE);
-      fKeyMap.put("LIST",""+LIST);
-      fKeyMap.put("AUDIT",""+AUDIT);
-      fKeyMap.put("DELAY",""+DELAY);
-      fKeyMap.put("IF",""+IF_THEN);
-      fKeyMap.put("LABEL",""+LABEL);
-      fKeyMap.put("GOTO",""+GOTO);
-      fKeyMap.put("ALIAS",""+ALIAS);
-      fKeyMap.put(".SQL",""+DOTSQL);
-      fKeyMap.put(".CS",""+DOTCS);
-      fKeyMap.put(".NS",""+DOTNS);
-      fKeyMap.put(".WMS",""+DOTWMS);
-      fKeyMap.put(".SEC",""+DOTSEC);
-      fKeyMap.put("CONTROL",""+CONTROL);
-      fKeyMap.put("REPLICATE",""+REPLICATE);
-      fKeyMap.put("SHOWTRANSACTION",""+SHOWTRANSACTION);
-
-   }
-   /**
-    * Added  2010-02-26
-    * Replace reserved characters of regex with '\'+characters
-    * @param source
-    * @return
-    */
-   public String replaceRegexCharacter(String source)
-   {
-	   if(source==null || source.length()==0)
-		   return "";
-	   StringBuilder stbReturn = new StringBuilder();
-	   char[] analyStr=source.toCharArray();
-	   if(analyStr.length>0)
-	   {
-		   for(int i=0;i<analyStr.length;i++)
-		   {
-			   switch(analyStr[i])
-			   {
-			   	case '+':
-			   	case '?':
-			   	case '*':
-			   	case '.':
-			   	case '^':
-			   	case '{':
-			   	case '[':
-			   	case '(':
-			   	case ')':
-			   	case '$':
-			   		stbReturn.append('\\');
-			   		break;
-			   		
-			   }
-			   stbReturn.append(analyStr[i]);
-		   }
-	   }
-	   
-	   return stbReturn.toString();
-   }
-   
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ValidationException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ValidationException.java b/core/conn/trafci/src/org/trafodion/ci/ValidationException.java
deleted file mode 100644
index e289751..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ValidationException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class ValidationException extends Exception {
-
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = 8842989562052059377L;
-
-	ValidationException()
-	{
-		
-	}
-	
-	ValidationException(String msg)
-	{
-		super(msg);
-	}	
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Vproc.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Vproc.java b/core/conn/trafci/src/org/trafodion/ci/Vproc.java
deleted file mode 100644
index 170922c..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Vproc.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-
-public class Vproc
-{
-   private static final String vprocStr = "@@@";
-   public static void main(String[] args)
-   {
-      System.out.println(vprocStr);
-   }
-   public static String getVproc()
-   {
-      return vprocStr;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/WCIUtils.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/WCIUtils.java b/core/conn/trafci/src/org/trafodion/ci/WCIUtils.java
deleted file mode 100644
index 63a9057..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/WCIUtils.java
+++ /dev/null
@@ -1,122 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.FileOutputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.io.IOException;
-
-public class WCIUtils
-{
-
-   // constants copied from wincon.h
-
-   /**
-   *  Characters read by the ReadFile or ReadConsole function
-   *  are written to the active screen buffer as they are read.
-   *  This mode can be used only if the ENABLE_LINE_INPUT mode
-   *  is also enabled.
-   */
-   private static final int ENABLE_ECHO_INPUT = 4;
-
-   private static boolean loaded = false;
-
-   String tmpDir=System.getProperty("java.io.tmpdir");
-   String userName=System.getProperty("user.name");
-   String archModel=System.getProperty("sun.arch.data.model");
-
-   public  native void cls();
-   private native int getConsoleMode();
-   private native void setConsoleMode(final int mode);
-
-
-   public WCIUtils() throws IOException
-   {
-      if (!loaded)
-      {
-         copyDllFromURL();
-         if (archModel.equalsIgnoreCase("64"))
-            System.load(tmpDir + "WCIUtils64_" + userName + ".dll");
-         else
-        	System.load(tmpDir + "WCIUtils32_" + userName + ".dll");
-         loaded = true;
-      }
-   }
-
-   public synchronized void enableEcho()
-   {
-      setConsoleMode( getConsoleMode() | ENABLE_ECHO_INPUT );
-   }
-
-   public synchronized void disableEcho()
-   {
-      setConsoleMode( getConsoleMode() & ~( ENABLE_ECHO_INPUT));
-   }
-
-
-   private synchronized void copyDllFromURL() throws IOException
-   {
-	  File dest;
-      if (archModel.equalsIgnoreCase("64"))
-    	  dest = new File( tmpDir, "WCIUtils64_" + userName + ".dll" );
-      else
-    	  dest = new File( tmpDir, "WCIUtils32_" + userName + ".dll" );
-
-
-      // if the dll already exists in the local pc
-      // recopy the file it is not already loaded
-      if (dest.exists())
-      {
-         try
-         {
-            if (!dest.delete())
-               return;
-         }catch (Exception e)
-         {
-            dest=null;
-            return;
-         }
-      }
-
-      FileOutputStream os = new FileOutputStream( dest );
-      InputStream is;
-      if (archModel.equalsIgnoreCase("64"))
-    	  is=this.getClass().getResourceAsStream("WCIUtils64.dll");
-      else
-    	  is=this.getClass().getResourceAsStream("WCIUtils32.dll");
-
-      byte data[] = new byte[ 4096 ];
-      int ct;
-
-      while ((ct=is.read( data )) >= 0)
-         os.write( data, 0, ct );
-
-      is.close();
-      os.close();
-      os=null;
-      is=null;
-      dest=null;
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Writer.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Writer.java b/core/conn/trafci/src/org/trafodion/ci/Writer.java
deleted file mode 100644
index c277342..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Writer.java
+++ /dev/null
@@ -1,418 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-
-public class Writer
-{
-
-   private ConsoleWriter cWriter=null;
-   private FileWriter lWriter=null;
-   private FileWriter sWriter=null;
-   private InterfaceSyntaxError ise=null;
-   private ConditionalSyntaxError cse=null;
-   private Parser parser = new Parser();
-   private int writerMode=SessionDefaults.CONSOLE_WRITE_MODE;
-   private Session sessObj=null;
-
-   Writer()
-   {
-   }
-
-   Writer(Session sessObj)
-   {
-      this.sessObj = sessObj;
-   }
-
-
-
-   public void write(String line) throws IOException
-   {
-      switch (writerMode)
-      {
-         case SessionDefaults.CONSOLE_WRITE_MODE:
-            cWriter.print(line);
-            break;
-         case SessionDefaults.LOG_WRITE_MODE:
-            lWriter.write(line);
-            break;
-         case SessionDefaults.SPOOL_WRITE_MODE:
-            sWriter.write(line);
-            break;
-         case SessionDefaults.CONSOLE_SPOOL_WRITE_MODE:      	 
-        	 if (!sessObj.isQuietEnabled()) 
-             	cWriter.print(line);
-             sWriter.write(line);
-             
-            break;
-      }
-   }
-
-   public void writeln() throws IOException
-   {
-      switch (writerMode)
-      {
-         case SessionDefaults.CONSOLE_WRITE_MODE:
-            cWriter.println();
-            break;
-         case SessionDefaults.LOG_WRITE_MODE:
-            lWriter.writeln();
-            break;
-         case SessionDefaults.SPOOL_WRITE_MODE:
-            sWriter.writeln();
-            break;
-         case SessionDefaults.CONSOLE_SPOOL_WRITE_MODE:
-        	if (!sessObj.isQuietEnabled()) 
-             	cWriter.println();
-             sWriter.writeln();
-
-            break;
-      }
-   }
-
-   public void writeAllSQLExceptions(Session sessObj, SQLException sqle) throws IOException
-   {
-      do
-      {
-         if (!sessObj.isSessionAutoPrepare())
-         {
-			String errorInfo = parser.getErrorCode(
-						formatErrStr(sqle.toString(), sessObj),
-						sqle.getErrorCode());
-            if (errorInfo.equals("8822") && !sessObj.getQuery().getQueryText().trim().toUpperCase().startsWith("PREPARE "))
-            {
-               continue;
-            }
-         }
-		this.writeInterfaceError(sessObj,
-					new ErrorObject(formatErrStr(sqle.toString(), sessObj),
-							sqle.getErrorCode()));
-      } while ((sqle=sqle.getNextException()) != null);
-
-      // Print end tags if MARKUP is XML or HTML
-      this.writeEndTags(sessObj);
-   }
-
-   /*
-    *  Writes all the warnings that are returned as part of the ResultSet
-    *  whilst we are doing a fetch.
-    */
-   public void writeAllFetchWarnings(Session sessObj, SQLWarning sqlw,
-                                     int numCols) throws IOException {
-
-      /*  Get the markup being currently used for the display.  */
-      int outputMarkup = sessObj.getDisplayFormat();
-
-
-      /*
-       *  Print starting tags.
-       */
-      if (SessionDefaults.XML_FORMAT == outputMarkup)
-         sessObj.getXmlObj().startFetchWarningListTag();
-      else if (SessionDefaults.HTML_FORMAT == outputMarkup)
-         sessObj.getHtmlObj().startFetchWarningListTable(numCols);
-
-
-      /*
-       *  Loop thru' all the warnings.
-       */
-      while (null != sqlw) {
-         String errStr = formatErrStr(sqlw.toString(), sessObj);
-
-         switch(outputMarkup) {
-            case SessionDefaults.XML_FORMAT  : 
-            case SessionDefaults.HTML_FORMAT :
-                 ErrorObject eo = new ErrorObject(parser.getErrorCode(errStr,sqlw.getErrorCode()),
-                                                  errStr, 'W');
-                 if (SessionDefaults.XML_FORMAT == outputMarkup)
-                    sessObj.getXmlObj().handleFetchWarnings(eo);
-                 else
-                    sessObj.getHtmlObj().handleFetchWarnings(eo);
-
-                 break;
-
-            default:
-                writeln(errStr);
-                break;
-
-         }  /*  End of  switch on display output markup.  */
-
-
-         /*  Get the next warning in this warning chain.  */
-         sqlw=sqlw.getNextWarning();
-
-
-      }  /*  End of  WHILE  there are more warnings to process.  */
- 
-
-      /*
-       *  Print the ending tags.
-       */
-      if (SessionDefaults.XML_FORMAT == outputMarkup)
-         sessObj.getXmlObj().endFetchWarningListTag();
-      else if (SessionDefaults.HTML_FORMAT == outputMarkup)
-         sessObj.getHtmlObj().endFetchWarningListTable();
-
-   }   /*  End of  writeAllFetchWarnings  method.  */
-
-   public void writeAllSQLWarnings(Session sessObj, SQLWarning sqlw) throws IOException
-   {
-      while ((sqlw!=null))
-      {
-			if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-				sessObj.getXmlObj().handleWarnings(
-						new ErrorObject(parser.getErrorCode(
-								formatErrStr(sqlw.toString(), sessObj),
-								sqlw.getErrorCode()),
-								formatErrStr(sqlw.toString(), sessObj), 'W'));
-			else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-				sessObj.getHtmlObj().handleWarnings(
-						new ErrorObject(parser.getErrorCode(
-								formatErrStr(sqlw.toString(), sessObj),
-								sqlw.getErrorCode()),
-								formatErrStr(sqlw.toString(), sessObj), 'W'));
-			else
-				writeln(formatErrStr(sqlw.toString(), sessObj));
-
-         sqlw=sqlw.getNextWarning();
-      }
-   }
-
-   public void writeSyntaxError(Session sessObj, String qryString, String remainderString) throws IOException
-   {
-      if (ise == null)
-      {
-         ise=new InterfaceSyntaxError();
-      }
-      writeInterfaceErrors(sessObj, ise.getSyntaxError(qryString,remainderString));
-   }
-
-   public void writeConditionalSyntaxError(Session sessObj, String qryString) throws IOException
-   {
-       if(cse == null )
-       {
-           cse=new ConditionalSyntaxError();
-       }
-       writeInterfaceErrors(sessObj, cse.getSyntaxError(qryString));
-   }
-   
-   public void writeln(String line) throws IOException
-   {
-      write(line);
-      writeln();
-   }
-
-   private String formatErrStr(String errStr, Session sessObj)
-   {
-
-	if ((errStr.indexOf("org.trafodion.jdbc.t4") != -1)
-				|| (errStr.indexOf("java.sql") != -1)
-				|| (errStr.indexOf("org.trafodion.jdbc.t4.TrafT4") != -1))
-      {
-         if (errStr.indexOf(":")!=-1)
-         {
-            errStr =errStr.substring(errStr.indexOf(":")+1).trim();
-         }
-         else
-         {
-            return errStr;
-         }
-      }
-     
-      return errStr;
-   }
-
-   public void writeElapsedTime(String time) throws IOException
-   {
-      writeln();
-      writeln("Elapsed: "+ time);
-   }
-
-   public ConsoleWriter getConsoleWriter()
-   {
-      return cWriter;
-   }
-   public void setConsoleWriter(ConsoleWriter writer)
-   {
-      cWriter = writer;
-   }
-   public FileWriter getSpoolWriter()
-   {
-      return sWriter;
-   }
-   public void setSpoolWriter(FileWriter sWriter)
-   {
-      this.sWriter = sWriter;
-   }
-   public FileWriter getLogWriter()
-   {
-      return lWriter;
-   }
-   public void setLogWriter(FileWriter lWriter)
-   {
-      this.lWriter = lWriter;
-   }
-   public int getWriterMode()
-   {
-      return this.writerMode;
-   }
-   public void setWriterMode(int writerMode)
-   {
-      this.writerMode = writerMode;
-   }
-
- public void writeError(Session sessObj, ErrorObject errObj) throws IOException
-     {
-      this.writeInterfaceErrors(sessObj, errObj);
-   }
-      
-   public void writeError(Session sessObj, char errType,ErrorObject errObj, String[] values) throws IOException
-   {
-	     String errStr = errObj.errorMessage();
-	      for (int i=0;i<values.length;i++)
-	    	  errStr = errStr.replaceFirst("%s",values[i].toString());
-	      this.writeError(sessObj, new ErrorObject(errObj.errorCode(), errStr));
-   }
-
-   public void writeExecutionTime(Session sessObj, Utils utilObj, Writer writer) throws IOException
-   {
-      String qryExecTime= "";
-      qryExecTime = " *** Total Query time was " + utilObj.getTimeinWords(sessObj.getQryExecEndTime());
-
-      if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-         sessObj.getHtmlObj().handleQryExecutionTime(qryExecTime);
-      else if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-         sessObj.getXmlObj().handleQryExecutionTime(qryExecTime);
-      else if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-         writer.writeln(qryExecTime+SessionDefaults.lineSeperator);
-   }
-
-   public void writeStatusMsg(Session sessObj, Query qryObj, Utils utilObj, Writer writer) throws IOException
-   {
-       String elapsedTimeMsg = getElapsedTime(sessObj,qryObj, utilObj);
-       String statusMsg = sessObj.getLfProps().getStatus(qryObj) + SessionDefaults.lineSeperator;
-       writeStatusMsg(sessObj, statusMsg, elapsedTimeMsg, writer);
-   }
-
-   public void writeStatusMsg(Session sessObj, String statusMsg, String elapsedTimeMsg, Writer writer) throws IOException
-   {
-      if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-         sessObj.getHtmlObj().processHtml(elapsedTimeMsg);
-      else if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-      {
-         sessObj.getXmlObj().processXml("",elapsedTimeMsg);
-      }
-      else if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-      {
-         if (null != statusMsg)
-            writer.write(statusMsg);
-         if (sessObj.isSessionTimingOn())
-         {
-            if (null != statusMsg)
-               writer.writeln(); 
-            writer.writeln(elapsedTimeMsg);
-            
-            writer.printElapsedQuietMode(elapsedTimeMsg);
-         }
-      }
-
-   }
-
-   public String getElapsedTime(Session sessObj,Query qryObj,Utils utilObj)
-   {
-      String elapsedTimeMsg="";
-      if (sessObj.isSessionTimingOn())
-      {
-            elapsedTimeMsg =  "Elapsed: " + utilObj.millisecondsToString(qryObj.getElapsedTime());
-      }
-      return elapsedTimeMsg;
-   }
-   
-   public void printElapsedQuietMode(String elapsedTimeMsg){
-       if (sessObj.isSessionTimingOn())
-       {
-           if(writerMode == SessionDefaults.CONSOLE_SPOOL_WRITE_MODE && 
-                    sessObj.isQuietEnabled() && sessObj.getCaller() != SessionDefaults.PRUNI)
-           {
-               try{
-            	     sessObj.setQuietEnabled(false);
-                   writeln(); 
-                   this.getConsoleWriter().println(elapsedTimeMsg);
-               }catch(IOException ioex){
-                   ;
-               }
-               sessObj.setQuietEnabled(true);
-           }
-       }
-   }
-
-   // Print end tags if MARKUP is XML or HTML
-   public void writeEndTags (Session sessObj) throws IOException
-   {
-      if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-         sessObj.getXmlObj().handleEndTags();
-      if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-         sessObj.getHtmlObj().handleEndTags();
-   }
-
-   //called when an SQL query returns an error.
-   public void writeInterfaceErrors(Session sessObj, String errorStr) throws IOException
-   {
-	   writeInterfaceErrors(sessObj,new ErrorObject(errorStr));
-   }
-
-   // called when a single interface error occurs.
-   public void writeInterfaceErrors(Session sessObj, ErrorObject errorObj) throws IOException
-   {
-      writeInterfaceError(sessObj, errorObj);
-      //Catalog API calls - print the end tags in InterfaceQuery 
-      int errorNo = Integer.parseInt(errorObj.errorCode());
-      if (!(errorNo >= 29416 && errorNo <= 29423))
-         writeEndTags(sessObj);
-   }
-
-   // called once for each error message in a series of errors.
-   public void writeInterfaceError(Session sessObj, ErrorObject errorObj) throws IOException
-   {
-      switch (sessObj.getDisplayFormat())
-      {
-         case SessionDefaults.HTML_FORMAT:
-         sessObj.getHtmlObj().handleErrors(errorObj);
-         break;
-      case SessionDefaults.XML_FORMAT: 
-         sessObj.getXmlObj().handleErrors(errorObj);
-         break;
-      default:
-         writeln(errorObj.RAWOutputError());
-         break;
-      }
-      
-     if (!errorObj.errorCode().equalsIgnoreCase(Parser.UNKNOWN_ERROR_CODE))
-         sessObj.setLastError(Integer.parseInt(errorObj.errorCode()));
-   }
-}
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/XMLDisplay.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/XMLDisplay.java b/core/conn/trafci/src/org/trafodion/ci/XMLDisplay.java
deleted file mode 100644
index f121300..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/XMLDisplay.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-public class XMLDisplay implements IDisplay {
-	
-	private Query qryObj;
-	private Writer writer=null;
-	private Session sessObj=null;
-	
-	public XMLDisplay(Session sessObj)
-	{
-		if(sessObj!=null)
-		{
-			this.sessObj = sessObj;
-			this.writer=sessObj.getWriter();
-			this.qryObj=sessObj.getQuery();
-		}
-	}
-
-	public void output(OutputContents contents) throws IOException {
-		// TODO Auto-generated method stub
-		if(contents!=null)
-		{
-			this.writer=sessObj.getWriter();
-			this.qryObj=sessObj.getQuery();
-			//display header
-			ArrayList<OutputColumnAttribute> columns = contents.getColumns();
-			qryObj.setColCount(String.valueOf(columns.size()));
-			
-			ArrayList<ArrayList<String>> alRows = contents.getRows();
-			if(alRows!=null && alRows.size()>0)
-			{
-				for(int i=0;i<alRows.size();i++)
-				{
-					ArrayList<String> alRow = alRows.get(i);
-					if(alRow!=null && alRow.size()>0)
-					{
-						for(int j=0;j<alRow.size();j++)
-						{
-							OutputColumnAttribute columnAttr = columns.get(j);
-				            sessObj.getXmlObj().processXml(columnAttr.name,alRow.get(j));
-				            writer.writeln();
-						}
-					}
-					
-				}
-			}
-			
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/XMLObject.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/XMLObject.java b/core/conn/trafci/src/org/trafodion/ci/XMLObject.java
deleted file mode 100644
index 469b1ef..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/XMLObject.java
+++ /dev/null
@@ -1,607 +0,0 @@
-// @@@ 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 @@@
-/**
- * 
- * 
- * Class to display the Errors/Warnings/ResultSets/Status Messages in XML format 
- * 
- */
-
-package org.trafodion.ci;
-
-import java.io.*;
-
-public class XMLObject
-{
-
-   private Utils utilObj = null;
-//   private Parser parser = null;
-   private Session sessObj = null;
-   private Writer writer = null;
-   private Query qryObj = null;
-   private QueryUtils qryUtilObj=null;
-
-   int rowCount = 0;
-   int colCount = 1;
-   int errorCount = 0;
-
-   public String _xmlNameSpaceTag="<?xml version=\"1.0\"?>";
-   private String encodingTag="";
-   public String _beginRootTag = "<Results>";
-   public String _endRootTag = "</Results>";
-
-   String _beginQueryTag = " <Query>";
-   String _endQueryTag = " </Query>";
-
-   boolean _beginRootElement = false;
-   boolean _errors = false;
-   boolean _warnings = false;
-   boolean _initDone = false;
-
-   String _beginRowTag = " <Row id=\"" ;
-   String _endRowTag = " </Row>";
-
-   String _beginCdataTag=" <![CDATA[";
-   String _endCdataTag = " ]]>";
-   String _endCdataTagEscaped = "]]&#62;";
-
-   String _beginStatusTag = "<Status>";
-   String _endStatusTag = "</Status>";
-
-   String _beginErrorListTag = " <ErrorList>";
-   String _endErrorListTag = " </ErrorList>";
-
-   String _beginErrorCountTag = "  <Error id=\"" ;
-   String _endErrorCountTag = "  </Error>";
-
-   String _beginErrorCodeTag = "    <ErrorCode>";
-   String _endErrorCodeTag = "</ErrorCode>";
-   
-   String _beginMessageCodeTag = "    <MessageCode>";
-   String _endMessageCodeTag = "</MessageCode>";
-
-   String _beginErrorMsgTag = "    <ErrorMsg>";
-   String _endErrorMsgTag = "</ErrorMsg>";
-
-   String _beginMessageMsgTag = "    <MessageText>";
-   String _endMessageMsgTag = "</MessageText>";
-   
-   String _beginWarnListTag = " <WarningList>";
-   String _endWarnListTag = " </WarningList>";
-
-   String _beginWarnCountTag = "  <Warning id=\"" ;
-   String _endWarnCountTag = "  </Warning>";
-
-   String _beginWarnCodeTag = "    <WarningCode>";
-   String _endWarnCodeTag = "</WarningCode>";
-
-   String _beginWarnMsgTag = "    <WarningMsg>";
-   String _endWarnMsgTag = "</WarningMsg>";
-
-   public String _beginScriptsDirTag = "<ScriptsDirectory>";
-   public String _endStriptsDirTag = "</ScriptsDirectory>";
-
-   public String _beginLogsDirTag = "<LogsDirectory>";
-   public String _endLogsDirTag = "</LogsDirectory>";
-
-   public String _beginLogsO = "<OverWriteLog>";
-   public String _endLogsO = "</OverWriteLog>";
-
-   public String _beginConnTag = "<TotalConnections>";
-   public String _endConnTag = "</TotalConnections>";
-
-   public String _beginSeqIdTag = "<Seq id = \"";
-   public String _endSeqIdTag = "</Seq>";
-
-   public String _beginLogFileNameTag = "  <LogFileName>";
-   public String _endLogFileNameTag = "  </LogFileName>";
-
-   public String _beginTotalSqlsTag = "  <TotalSqls>";
-   public String _endTotalSqlsTag = "  </TotalSqls>";
-
-   public String _beginTotalErrors = "  <Errors>";
-   public String _endTotalErrors = "  </Errors>";
-
-   public String _beginTotalWarnings = "  <Warnings>" ;
-   public String _endTotalWarnings = "  </Warnings>" ;
-
-   public String _beginMinTag = "<TotalMinutes>";
-   public String _endMinTag = "</TotalMinutes>";
-
-   public String _endAttributeTag = "\">";
-
-   String _beginResultSetIdTag = " <ResultSet id=\"" ;
-   String _beginResultSetTag = " <ResultSet>" ;
-   String _endResultSetTag = " </ResultSet>";
-   
-   String _beginExecutionTimeTag = " <ExecutionTime>";
-   String _endExecutionTimeTag = "</ExecutionTime>";
-   
-   String statusMsg = "";
-   boolean perTableStats = false;
-   
-   
-
-   XMLObject ()
-   {
-   }
-
-   XMLObject (Session sessObj)
-   {
-      this.sessObj = sessObj;
-//      parser = new Parser();
-      utilObj = new Utils();
-      qryUtilObj = new QueryUtils();
-      
-   }
-
-   public void init()
-   {
-      this.writer=sessObj.getWriter();
-      this.qryObj=sessObj.getQuery();
-      _initDone = true;
-    }
-
-   public void processXml(String columnName, String output) throws IOException
-   {
-
-      if (!_initDone)
-      {
-         this.init();
-         this.handleStartTags();
-         //_initDone = true;
-      }
-      if (sessObj.isInOutandRS() && qryObj.getRsCount() >= 0)
-      {
-         //   writer.writeln(" " + _beginResultSetTag);
-         qryObj.resetQueryText("SELECT *");
-         rowCount = 0;
-         colCount = 1;
-
-      }
-      if ((qryObj.getRowCount() != null))
-      {
-
-         if ((_warnings) || ((rowCount==0 && Integer.parseInt(qryObj.getRowCount())==0)  || (rowCount != Integer.parseInt(qryObj.getRowCount()))))
-         {
-            this.handleStartTags();
-         }
-         
-         if ((qryObj.isTrimOut() && !qryUtilObj.isGetStatsCmd(qryObj)) || (perTableStats) )
-         {
-            writer.writeln(" " + _endCdataTag);
-            perTableStats = false;
-         }
-         
-         if (_warnings && !sessObj.isWriteParams())
-            writer.writeln(_endWarnListTag);
-         
-         if ((sessObj.isImplicitGetStatsQry()) && qryUtilObj.isGetStatsCmd(qryObj))
-         {
-            statusMsg = "";
-            sessObj.getDbQryObj().resetQryObj();
-            sessObj.setImplicitGetStatsQry(false);
-         }
-         else
-         {
-            statusMsg = sessObj.getLfProps().getStatus(qryObj);
-         }
-         if (!((output.equals("")) && statusMsg.equals("")))
-            writer.write(_beginStatusTag + _beginCdataTag + statusMsg + output +  _endCdataTag + _endStatusTag +SessionDefaults.lineSeperator);
-         this.handleEndTags();
-         return;
-      }
-
-      if (qryObj.isTrimOut())
-      {
-         if (qryUtilObj.isGetStatsCmd(qryObj) && !perTableStats)
-         {
-            if (!(output.trim().equals("")))
-               printGetStatsOutput(output.trim());
-         }
-         else
-               writer.write(output.trim());
-      }else
-      {
-         if (colCount == 1)
-         {
-            if (_warnings && sessObj.isWriteParams())
-               writer.writeln(_endWarnListTag);
-            if (sessObj.isSPJRS() && rowCount == 0 || (sessObj.isInOutandRS()))
-            {
-               writer.write( _beginResultSetIdTag + (qryObj.getRsCount()+1) + _endAttributeTag + SessionDefaults.lineSeperator);
-               sessObj.setInOutandRS(false);
-            }
-            writer.write(_beginRowTag + (rowCount+1) + _endAttributeTag + SessionDefaults.lineSeperator);
-
-         }
-         writer.write("   <"+columnName+">"+utilObj.formatXMLdata(output.trim())+"</"+columnName+">");
-
-         if (qryObj.getColCount() != null)
-         {
-            colCount++;
-            if (colCount > Integer.parseInt(qryObj.getColCount()))
-            {
-               writer.write(SessionDefaults.lineSeperator+_endRowTag);
-               rowCount++;
-               colCount=1;
-            }
-         }
-      }
-   }
-
-   public void handleStartTags() throws IOException
-   {
-      if (!_beginRootElement)
-      {
-         if (sessObj.getISOMapping() == 10)
-         {
-            encodingTag = "encoding=\"" + "Shift_JIS"+ "\"";
-            _xmlNameSpaceTag = "<?xml version=\"1.0\" " + encodingTag + "?>";
-         }
-         else
-         {
-            _xmlNameSpaceTag = "<?xml version=\"1.0\"?>";
-         }
-
-         writer.writeln(_xmlNameSpaceTag);
-         writer.writeln(_beginRootTag);
-
-         if (qryObj.getQueryText() != null)
-         {
-            writer.writeln(_beginQueryTag);
-
-            if (sessObj.isSPJRS() && qryObj.getRowCount() == "0")
-               qryObj.resetQueryText(sessObj.getDbQryObj().qryText);
-
-            //Escape "]]>" if it appears within QueryText
-            writer.writeln(" " + _beginCdataTag + sessObj.getQuery().getQueryText().replaceAll(_endCdataTag.trim(), _endCdataTagEscaped)+ _endCdataTag);
-            writer.writeln(_endQueryTag);
-
-            if (qryObj.isTrimOut()) 
-               writer.writeln(" " + _beginCdataTag);
-
-            if (sessObj.isSPJRS() && qryObj.getRsCount() > 0)
-            {
-               writer.writeln(" " + _beginResultSetTag);
-               qryObj.resetQueryText("SELECT *");
-            }
-         }
-         
-         _beginRootElement = true;
-      }
-
-   }
-
-   public void handleEndTags() throws IOException
-   {
-	if (_initDone)
-	{
-      if (_errors)
-         writer.writeln(_endErrorListTag);
-
-      if (sessObj.isSPJRS())
-      {
-         writer.write(SessionDefaults.lineSeperator+_endResultSetTag);
-      }
-      else
-      {
-         if (!(sessObj.isImplicitGetStatsQry())) {
-            writer.write(_endRootTag+SessionDefaults.lineSeperator);
-            _beginRootElement = false;
-         }
-      }
-
-      _errors = false;
-      _warnings = false;
-      errorCount = 0;
-      rowCount = 0;
-      colCount = 1;
-      _initDone = false;
-      sessObj.setWriteParams(false);
-	}
-   }
-
-   public void handleErrors(ErrorObject errorObj) throws IOException
-   {
-       if (errorObj != null)
-           {
-	           if (!_initDone)
-	               {
-	               this.init();
-	               }
-	
-	           boolean notBegin=false;
-	           if(notBegin = !_beginRootElement)
-	           {
-	        	   this.handleStartTags();
-	           }
-	           
-	           if (errorObj.errorCode() == Parser.UNKNOWN_ERROR_CODE)
-	           {
-	               writeServerMessage(errorObj);
-	           }
-	           else if(errorObj.errorType == 'I')
-	           {
-	               writeInformational(errorObj);
-	           }
-	           else if(errorObj.errorType == 'W')
-	           {
-	               handleWarnings(errorObj);
-	           }
-	           else 
-	           {
-	               if (notBegin)
-	               {
-	                   writer.writeln(_beginErrorListTag);
-	                   _errors = true;
-	               }
-	               writeErrors(errorObj);
-               }
-         }
-   }
-   public void writeServerMessage(ErrorObject errorObj) throws IOException
-   {
-         String escapedErrorMessage = errorObj.errorMessage().replaceAll(_endCdataTag.trim(), _endCdataTagEscaped);
-         //escape any instance of the substring "]]>" that appears in errorStr. It is escaped by replacing it with the _endCdataTagEscaped string.
-         writer.writeln(_beginCdataTag + escapedErrorMessage + _endCdataTag);
-   }
-   public void writeInformational(ErrorObject errorObj) throws IOException
-   {
-         String escapedErrorMessage = errorObj.errorMessage().replaceAll(_endCdataTag.trim(), _endCdataTagEscaped);
-         //  writer.writeln(_beginMessageCodeTag + errorObj.errorCode() + _endMessageCodeTag);
-         //escape any instance of the substring "]]>" that appears in errorStr. It is escaped by replacing it with the _endCdataTagEscaped string.
-         writer.writeln(_beginMessageMsgTag + _beginCdataTag + escapedErrorMessage + _endCdataTag + _endMessageMsgTag);
-   }
-   
-   public void writeErrors(ErrorObject errorObj) throws IOException
-   {
-         String escapedErrorMessage = errorObj.errorMessage().replaceAll(_endCdataTag.trim(), _endCdataTagEscaped);
-    	 writer.write(_beginErrorCountTag + ++errorCount + _endAttributeTag + SessionDefaults.lineSeperator );
-         writer.writeln(_beginErrorCodeTag + errorObj.errorCode() + _endErrorCodeTag);
-
-         //escape any instance of the substring "]]>" that appears in errorStr. It is escaped by replacing it with the _endCdataTagEscaped string.
-         writer.writeln(_beginErrorMsgTag + _beginCdataTag + escapedErrorMessage + _endCdataTag + _endErrorMsgTag);
-         writer.writeln(_endErrorCountTag);
-   }
- //dead code. Removed by Kevin Xu
-/* 
-   public void writeWarnings(ErrorObject errorObj) throws IOException
-   {
-         String escapedErrorMessage = errorObj.errorMessage().replaceAll(_endCdataTag.trim(), _endCdataTagEscaped);
-    	 writer.write(_beginErrorCountTag + ++errorCount + _endAttributeTag + SessionDefaults.lineSeperator );
-         writer.writeln(_beginErrorCodeTag + errorObj.errorCode() + _endErrorCodeTag);
-
-         //escape any instance of the substring "]]>" that appears in errorStr. It is escaped by replacing it with the _endCdataTagEscaped string.
-         writer.writeln(_beginErrorMsgTag + _beginCdataTag + escapedErrorMessage + _endCdataTag + _endErrorMsgTag);
-         writer.writeln(_endErrorCountTag);
-   }
-*/
-   /**
-    *  Method to print a top level xml tag below the root element of the
-    *  marked up xml document.
-    */
-   private void printTopLevelXMLTag(String theTag)  throws IOException {
-      /*  Check if we need to do the initialization.  */
-      if (!_initDone)
-         this.init();
-
-      /*  Check if we need to setup and create the tags.  */
-      if (!_beginRootElement)
-         this.handleStartTags();
-
-
-      if ((null != theTag)  &&  (0 < theTag.length() ) )
-         writer.writeln(theTag);
-        
-   }  /*  End  of  printTopLevelXMLTag  method.  */
-
-
-
-   /**
-    *  Method to print the warning list start tag for all warnings
-    *  encountered during a fetch operation. 
-    */
-   public void startFetchWarningListTag()  throws IOException {
-      printTopLevelXMLTag(_beginWarnListTag);
-
-   }  /*  End of  startFetchWarningListTag  method.  */
-
-
-
-   /**
-    *  Method to print the warning list end tag for all warnings
-    *  encountered during a fetch operation. 
-    */
-   public void endFetchWarningListTag()  throws IOException {
-      printTopLevelXMLTag(_endWarnListTag);
-
-   }  /*  End of  endFetchWarningListTag  method.  */
-
-
-
-   /**
-    *  Method to print warnings encountered during a fetch operation. These 
-    *  warnings need to printed in a separate warning list within the scope 
-    *  of the fetch.
-    *  Oh, this whole xml/html markup piece is so very messy!! :^(
-    */
-   public void handleFetchWarnings(ErrorObject errorObj) throws IOException {
-      /*  Check if we need to do the initialization.  */
-      if (!_initDone)
-         this.init();
-
-      /*  Check if we need to setup and create the tags.  */
-      if (!_beginRootElement)
-         this.handleStartTags();
-
-
-      if (errorObj != null) {
-         writer.writeln(_beginWarnCountTag + ++errorCount + _endAttributeTag);
-         writer.writeln(_beginWarnCodeTag + errorObj.errorCode() + 
-                       _endWarnCodeTag);
-         writer.writeln(_beginWarnMsgTag + errorObj.errorMessage() + 
-                        _endWarnMsgTag);
-         writer.writeln(_endWarnCountTag);
-      }
-
-   }   /*  End of  handleFetchWarnings  method.  */
-
-   public void handleWarnings(ErrorObject errorObj) throws IOException
-   {
-      if (!_initDone)
-      {
-         this.init();
-         //_initDone = true;
-      }
-
-      if (!_beginRootElement)
-      {
-         this.handleStartTags();
-         writer.writeln(_beginWarnListTag);
-         _warnings = true;
-      }
-
-      if (errorObj != null)
-      {
-         writer.write(_beginWarnCountTag + ++errorCount + _endAttributeTag + SessionDefaults.lineSeperator );
-         writer.writeln(_beginWarnCodeTag + errorObj.errorCode() + _endWarnCodeTag);
-         writer.writeln(_beginWarnMsgTag + errorObj.errorMessage() + _endWarnMsgTag);
-         writer.writeln(_endWarnCountTag);
-      }
-   }
-
-   public void handlePrunSummary(ConsoleWriter cWriter, PrunSummary summaryObj,String elapsedTime) throws IOException
-   {
-      this.init();
-      this.handleStartTags();
-      cWriter.println(_beginCdataTag);
-      cWriter.println(" " + SessionDefaults.lineSeperator+"PARALLELRUN(PRUN) SUMMARY");
-      cWriter.println(_endCdataTag);
-      cWriter.println("<Summary>");
-      cWriter.println("  <TotalFilesPresent>" + summaryObj.getTotalScriptFiles() + "</TotalFilesPresent>");
-      cWriter.println("  <TotalFilesProcessed>" + summaryObj.getTotalScriptFilesProcessed() + "</TotalFilesProcessed>");
-      cWriter.println("  <TotalQueriesProcessed>" + summaryObj.getTotalSQLsProcessed() + "</TotalQueriesProcessed>");
-      cWriter.println("  <TotalErrors>" + summaryObj.getTotalSQLErrors() + "</TotalErrors>");
-      cWriter.println("  <TotalWarnings>" + summaryObj.getTotalSQLWarnings() + "</TotalWarnings>");
-      cWriter.println("  <TotalSuccesses>" + summaryObj.getTotalSQLSuccess() + "</TotalSuccesses>");
-      cWriter.println("  <TotalConnections>" + summaryObj.getTotalConnections() + "</TotalConnections>");
-      cWriter.println("  <TotalConnectionFailures>" + summaryObj.getTotalConnectionFailures() + "</TotalConnectionFailures>");
-      if (sessObj.isSessionTimingOn())
-         cWriter.println("  <ElapsedTime>" + elapsedTime.trim() + "</ElapsedTime>");
-      cWriter.println("</Summary>");
-      
-      //reset _initDone to false since it is automatically set to true in this.init();
-      _initDone = false;
-   }
-
-   public void handlePrunSummary(FileWriter fWriter, PrunSummary summaryObj, String summaryEnd, String elapsedTime) throws IOException
-   {
-
-      fWriter.writeln(_beginCdataTag + "PARALLELRUN(PRUN) SUMMARY" + _endCdataTag);
-      fWriter.writeln("<Summary>");
-      fWriter.writeln("  <TotalFilesPresent>" + summaryObj.getTotalScriptFiles() + "</TotalFilesPresent>");
-      fWriter.writeln("  <TotalFilesProcessed>" + summaryObj.getTotalScriptFilesProcessed() + "</TotalFilesProcessed>");
-      fWriter.writeln("  <TotalQueriesProcessed>" + summaryObj.getTotalSQLsProcessed() + "</TotalQueriesProcessed>");
-      fWriter.writeln("  <TotalErrors>" + summaryObj.getTotalSQLErrors() + "</TotalErrors>");
-      fWriter.writeln("  <TotalWarnings>" + summaryObj.getTotalSQLWarnings() + "</TotalWarnings>");
-      fWriter.writeln("  <TotalSuccesses>" + summaryObj.getTotalSQLSuccess() + "</TotalSuccesses>");
-      fWriter.writeln("  <TotalConnections>" + summaryObj.getTotalConnections() + "</TotalConnections>");
-      fWriter.writeln("  <TotalConnectionFailures>" + summaryObj.getTotalConnectionFailures() + "</TotalConnectionFailures>");
-      fWriter.writeln("</Summary>");
-      fWriter.writeln(_beginCdataTag + summaryEnd + _endCdataTag);
-      if (sessObj.isSessionTimingOn())
-         fWriter.writeln(_beginCdataTag + elapsedTime.trim() + _endCdataTag);
-      fWriter.writeln(_endRootTag);
-      this._initDone = false;
-   }
-
-   public void handleQryExecutionTime(String qryExecTime)  throws IOException
-   {
-
-      if (!_initDone)
-      {
-         this.init();
-         this.handleStartTags();
-         //_initDone = true;
-      }
-      writer.write(_beginExecutionTimeTag + _beginCdataTag + qryExecTime +  _endCdataTag + _endExecutionTimeTag +SessionDefaults.lineSeperator);
-   }
-
-   public String checkColumnNames(String colHeader)
-   {
-      String colName = null;
-      String xmlColHeader = colHeader;
-      if (xmlColHeader.startsWith("(", 0) && xmlColHeader.endsWith(")"))
-         colName = xmlColHeader.substring(1, xmlColHeader.length()-1);
-      else
-         colName = colHeader;
-      return colName;
-   }
-   
-   public void printGetStatsOutput(String line) throws IOException
-   {
-      int i=0;
-      String columnNameTag = "";
-      String columnData = null;
-      
-      if (line.trim().equals(""))
-            return;
-      
-      if (line.startsWith("Table Name") || line.startsWith("Id"))
-      {
-         writer.writeln(" " + _beginCdataTag); 
-         writer.writeln(" " + line); 
-         perTableStats = true;
-         return;
-      }
-      String outputArr[] = line.split(" ");
-      for (i=0;i<outputArr.length; i++)
-      {
-         if (!outputArr[i].matches("^(\\-[0-9]|[0-9]|\\\\|NONE|CLOSE|SQL_|MX|PERTABLE|ACCUMULATED|PROGRESS|DEFAULT|OPERATOR|DEALLOCATED|select).*"))
-            columnNameTag += outputArr[i];
-         else
-            break;
-      }
-
-      for (int j=Math.max(0,(i-1));j<outputArr.length; j++)
-      {
-         if (!outputArr[j].trim().equals(""))
-         {
-            if (columnData == null)
-               columnData = outputArr[j];
-            else
-               columnData+=" " + outputArr[j];
-         }
-      }
-      
-      String xmlColTag = "Missing_tag"; 
-      if (null != columnNameTag && 0 < columnNameTag.length())
-         xmlColTag = checkColumnNames(columnNameTag);
-
-      if (columnData!= null)
-         writer.write("<"+xmlColTag+">"+utilObj.formatXMLdata(columnData.trim())+"</"+xmlColTag+">");
-      
-   }
-   
-   
-   
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/help/common_common.help
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/help/common_common.help b/core/conn/trafci/src/org/trafodion/ci/help/common_common.help
deleted file mode 100644
index 697cc3e..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/help/common_common.help
+++ /dev/null
@@ -1,457 +0,0 @@
-// @@@ 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 @@@
-
- @@@@@HELP
-
-   The command interface supports these commands:
-
-    @           LOG                     SHOW ALIAS
-    ALIAS       OBEY                    SHOW ALIASES
-    CLEAR       QUIT                    SHOW COLSEP
-    CONNECT     RECONNECT               SHOW ERRORCODE
-    DELAY       REPEAT                  SHOW HISTOPT
-    DISCONNECT  RESET LASTERROR         SHOW IDLETIMEOUT
-    ENV         SAVEHIST                SHOW LASTERROR
-    EXIT        SESSION (SHOW SESSION)  SHOW MARKUP
-                SET COLSEP              SHOW REMOTEPROCESS
-    FC          SET CONNECTOPT ROLE     SHOW ROLE                    
-    GOTO        SET HISTOPT             SHOW SESSION
-    HELP        SET IDLETIMEOUT         SHOW TIME    
-    HISTORY     SET MARKUP              SHOW TIMING
-    IF...THEN   SET PROMPT              SPOOL   
-    LABEL       SET TIME                VERSION
-    LOCALHOST   SET TIMING                    
-              
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET
-
-   The command interface supports these SET commands:
-
-    SET COLSEP           SET IDLETIMEOUT  SET TIME    
-    SET CONNECTOPT ROLE  SET MARKUP       SET TIMING  
-    SET HISTOPT          SET PROMPT                   
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW
-
-   The command interface supports these SHOW commands:
-
-    SHOW ALIAS      SHOW IDLETIMEOUT   SHOW SESSION   
-    SHOW ALIASES    SHOW LASTERROR     SHOW TIME      
-    SHOW COLSEP     SHOW MARKUP        SHOW TIMING    
-    SHOW ERRORCODE  SHOW REMOTEPROCESS           
-    SHOW HISTOPT    SHOW ROLE                       
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@@
-
-   The @ command executes the SQL statements and interface commands contained
-   in a specified script file. The @ command is executed the same as the OBEY
-   command.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@ALIAS
-
-   The ALIAS command allows you to map a string to any interface or SQL
-   command. The syntax of the interface or SQL command is checked only on
-   execution of the mapped string. This command replaces only the first token
-   of a command string, which allows the rest of the tokens to be treated as
-   parameters.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@CLEAR
-
-   The CLEAR command clears the interface window so that only the prompt
-   appears at the top of the window. CLEAR does not clear the log file or
-   reset the settings of the session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@CONNECT
-
-   The CONNECT command creates a new connection to the Trafodion platform from
-   the current or existing Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@DELAY
-
-   The DELAY command allows the Command Interface session to be in sleep
-   mode for the specified interval.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@DISCONNECT
-
-   The DISCONNECT command terminates the connection from the Trafodion
-   platform, not from the Command Interface.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@ENV
-
-   ENV displays attributes of the current Command Interface session. You
-   can also use the SESSION and SHOW SESSION commands to perform the same
-   function.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@EXIT
-
-   The EXIT command disconnects from and exits the Command Interface.
-   EXIT can return a status code. If no status code is specified, zero is
-   returned by default. In addition, a conditional statement can be appended
-   to the command.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@FC
-
-   The FC command allows you to edit and reissue a command in the history
-   buffer of a Command Interface session. You can display the commands
-   in the history buffer by using the HISTORY command.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@GOTO
-
-   The GOTO command allows you to jump to a designated point in the command
-   history. The point in the command history is designated by a LABEL
-   command. All commands executed after a GOTO statement are ignored until
-   the specified label is set. To set a label, use the LABEL command.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@HISTORY
-
-   The HISTORY command displays recently executed commands, identifying each
-   command by a number that you can use to reexecute or edit the command.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@IF...THEN
-
-   IF...THEN statements allow for the conditional execution of actions. If
-   the condition is met, the action is executed; otherwise, no action is
-   taken.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@LABEL
-
-   The LABEL command marks a point in the command history that you can jump
-   to by using the GOTO command.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@LOCALHOST
-
-   The LOCALHOST command allows you to execute client machine commands.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@LOG
-
-   The LOG command logs the entered commands and their output from the
-   Command Interface to a log file. If this is an obey script file, then
-   the command text from the obey script file is shown on the console.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@MODE
-
-   This command is no longer supported in TRAFCI.
-
- @@@@@OBEY
-
-   The OBEY command executes the SQL statements and interface commands of a
-   specified script file or an entire directory. This command accepts a
-   single filename or a filename with a wild-card pattern specified.
-   Executing the OBEY command without optional parameters prompts you to
-   enter a filename. If a filename is not specified, then *.sql is used.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@QUIT
-
-   The QUIT command disconnects from and exits the Command Interface.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@RECONNECT
-
-   The RECONNECT command creates a new connection to the Trafodion platform
-   using the login credentials of the last successful connection.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@REPEAT
-
-   The REPEAT command reexecutes a previous command.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@RESET LASTERROR
-
-   The RESET LASTERROR command resets the last error code to 0.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SAVEHIST
-
-   The SAVEHIST command saves the session history in a user-specified file.
-   The session history consists of a list of the commands that were executed
-   in the Command Interface session before the SAVEHIST command.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET COLSEP
-
-   The SET COLSEP command sets the column separator and allows you to control
-   the formatting of the result displayed for SQL queries. The SET COLSEP
-   command specifies a delimiter value to use for separating columns in each
-   row of the results. The default delimiter is " "(white space).
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET CONNECTOPT ROLE
-
-   The SET CONNECTOPT ROLE command changes the role during a Command Interface 
-   session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET HISTOPT
-
-   The SET HISTOPT command sets the history option and controls how commands
-   are added to the history buffer. By default, commands within a script file
-   are not added to history. If the history option is set to "ALL," all the
-   commands in the script file are added to the history buffer. If no options
-   are specified, DEFAULT is used.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET IDLETIMEOUT
-
-   The SET IDLETIMEOUT command sets the idle timeout value for the current
-   session. The idle timeout value of a session determines when the session
-   expires after a period of inactivity. The default is 30 minutes.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET MARKUP
-
-   The SET MARKUP command sets the markup format and controls how results are
-   displayed by the Command Interface.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET PROMPT
-
-   The SET PROMPT command sets the prompt of the current session to a
-   specified string and/or to the session variables, which start with %. The
-   default prompt is SQL> in SQL mode.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET TIME
-
-   The SET TIME command causes the local time of the client workstation to be
-   displayed as part of the interface prompt. By default, the local time is
-   not displayed in the interface prompt.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SET TIMING
-
-   The SET TIMING command causes the elapsed time to be displayed after each
-   SQL statement executes. This command does not cause the elapsed time of
-   interface commands to be displayed. By default, the elapsed time is off.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW ALIAS
-
-   The SHOW ALIAS command displays all or a set of aliases available in the
-   current Command Interface session. If a pattern is specified, all aliases
-   matching the pattern are displayed. By default, all aliases in the current
-   session are displayed.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW ALIASES
-
-   The SHOW ALIASES command displays all the aliases available in the current
-   Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW COLSEP
-
-   The SHOW COLSEP command displays the value of the column separator for the
-   current Command Interface session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW ERRORCODE
-
-   The SHOW ERRORCODE command is an alias for the SHOW LASTERROR command.
-   ERRORCODE is an alias for LASTERROR.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW HISTOPT
-
-   The SHOW HISTOPT command displays the value that has been set for the
-   history option.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW IDLETIMEOUT
-
-   The SHOW IDLETIMEOUT command displays the idle timeout value of the
-   current Command Interface session. The idle timeout value of a session
-   determines when the session expires after a period of inactivity.
-   The default is 30 minutes.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW LASTERROR
-
-   The SHOW LASTERROR command displays the error of the last SQL statement
-   that was executed. If the query was successful, 0 is returned; otherwise
-   an SQL error code is returned.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW MARKUP
-
-   The SHOW MARKUP command displays the value set for the markup option.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW MODE
-
-   This command is no longer supported in TRAFCI.
-
- @@@@@SHOW REMOTEPROCESS
- 
-   The SHOW REMOTEPROCESS command displays the process name of the DCS
-   server that is handling the current connection.
-   
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW ROLE
-
-   The SHOW ROLE command displays the role in which you are currently logged
-   on during an TRAFCI session.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW SESSION & SESSION
-
-   SHOW SESSION or SESSION displays attributes of the current Command
-   Interface session. You can also use the ENV command to perform the
-   same function.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW TIME
-
-   The SHOW TIME command displays whether the setting for the local time in
-   the interface prompt is ON or OFF.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SHOW TIMING
-
-   The SHOW TIMING command displays whether the setting for the elapsed time
-   is ON or OFF.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@SPOOL
-
-   The SPOOL command logs the entered commands and their output from the
-   Command Interface to a log file.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.
-
- @@@@@VERSION
-
-   The VERSION command displays the build versions of the Trafodion platform,
-   Trafodion Connectivity Services, Trafodion JDBC Type 4 Driver, and Command
-   Interface.
-
-   For more information, see the Trafodion Command Interface
-   (TRAFCI) Guide.

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/help/help_file.idx
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/help/help_file.idx b/core/conn/trafci/src/org/trafodion/ci/help/help_file.idx
deleted file mode 100644
index 035ccbd..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/help/help_file.idx
+++ /dev/null
@@ -1,30 +0,0 @@
-# @@@ 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 @@@
-
-###########################################################
-## This is the main index file for all other help files. ##
-###########################################################
-
-#Common Commands
-common:common = common_common_help.idx
-
-#Mode SQL
-sql:common = sql_common_help.idx


[12/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/UserInterruption.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/UserInterruption.java b/core/conn/trafci/src/main/java/org/trafodion/ci/UserInterruption.java
new file mode 100644
index 0000000..431d189
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/UserInterruption.java
@@ -0,0 +1,36 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class UserInterruption extends Exception
+{
+
+   /**
+   * 
+   */
+   private static final long serialVersionUID = 1L;
+
+   UserInterruption()
+   {
+
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Utils.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Utils.java b/core/conn/trafci/src/main/java/org/trafodion/ci/Utils.java
new file mode 100644
index 0000000..54184a6
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Utils.java
@@ -0,0 +1,381 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.regex.*;
+
+public class Utils
+{
+
+   static HashMap<String, String> xmlHashMap = new HashMap<String, String>();
+
+   Utils()
+   {
+
+   }
+
+
+
+  static String trimSQLTerminator(String qryStr,String sqlTerminator)
+   {
+	  if (qryStr.toUpperCase().endsWith(sqlTerminator))
+      {
+		  qryStr = qryStr.substring(0,qryStr.length()- sqlTerminator.length());
+      }
+	  
+      return qryStr;
+   }
+
+   String formatString(String output,int colWidth,char fillchar,String appendStr)
+   {
+      if (output == null)
+      {
+         return null;
+      }
+
+
+
+      if (appendStr != null)
+      {
+         colWidth=colWidth - appendStr.length();
+      }
+
+      output=formatString(output,colWidth,fillchar);
+
+      if (appendStr != null && output != null)
+      {
+         output+=appendStr;
+      }
+
+
+      return output;
+
+   }
+ //dead code. Removed by Kevin Xu
+/*
+   String formatStringWordwrap(String output,int colWidth,char fillchar,String appendStr)
+   {
+      int beginIndex,endIndex;
+      String valueStr;
+
+      if (output == null)
+      {
+         return null;
+      }
+
+      // This is the case where the length of the value exceeds the
+      // column width
+      if ((appendStr !=null) && (appendStr.length()> colWidth-output.length()))
+      {
+         //print atleast five fill characters
+         int labelWidth = output.length() + 5;
+         StringBuffer blankOutput = new StringBuffer();
+         for (int i=0;i<labelWidth;i++)
+            blankOutput.append(' ');
+
+         output=formatString(output,labelWidth,fillchar);
+
+         //break the value into multiple strings to print
+         //on separate lines
+         colWidth = colWidth-labelWidth;
+         for (beginIndex=0,endIndex=colWidth;
+            endIndex<=appendStr.length();
+            beginIndex=endIndex,endIndex+=colWidth)
+         {
+            valueStr = appendStr.substring(beginIndex,endIndex);
+            if (beginIndex==0)
+               output+=valueStr;
+            else
+               output = output + SessionDefaults.lineSeperator + blankOutput + valueStr ;
+
+         }
+         if (endIndex > appendStr.length())
+            output = output + SessionDefaults.lineSeperator + blankOutput + appendStr.substring(beginIndex);
+
+         return output;
+      }
+
+      if (appendStr != null)
+      {
+         colWidth=colWidth - appendStr.length();
+      }
+
+      output=formatString(output,colWidth,fillchar);
+
+      if (appendStr != null && output != null)
+      {
+         output+=appendStr;
+      }
+
+
+      return output;
+
+   }
+*/
+   String formatString(String output,int colWidth,char fillchar)
+   {
+      StringBuffer outBuffer=null;
+
+      if (output == null)
+      {
+         return null;
+      }
+
+      outBuffer=new StringBuffer(output);
+
+
+      if (outBuffer.length() <= colWidth)
+      {
+         for (int i=outBuffer.length();i<colWidth;i++)
+            outBuffer.append(fillchar);
+
+      }
+
+      return outBuffer.toString();
+
+   }
+
+   // Change the string to lowerCase and capitalize the starting character and any character
+   // followed by _ and remove _(under score)
+ //dead code. Removed by Kevin Xu
+/*
+   String initCap(String value)
+   {
+      StringBuffer buffer=null;
+
+      if (value == null)
+         return value;
+
+      buffer=new StringBuffer();
+
+      char[] valueArray=value.toLowerCase().toCharArray();
+
+      // capitalize the first character
+
+      buffer.append(Character.toUpperCase(valueArray[0]));
+
+      boolean changeCase=false;
+
+      for (int i=1;i<valueArray.length;i++)
+      {
+         if (valueArray[i] =='_')
+         {
+            changeCase=true;
+            i++;
+         }
+         else
+            changeCase=false;
+
+         if (changeCase)
+            buffer.append(Character.toUpperCase(valueArray[i]));
+         else
+            buffer.append(valueArray[i]);
+      }
+
+      return buffer.toString();
+
+
+   }
+  
+   public String trimSingleQuote(String value)
+   {
+      if (value!=null && value.startsWith("'") && value.endsWith("'"))
+      {
+         value=value.substring(1,value.length()-1);
+         value=value.replaceAll("''","'");
+      }
+      return value;
+   }
+ */
+   public String trimDoubleQuote(String value)
+   {
+      if (value!=null && value.startsWith("\"") && value.endsWith("\""))
+      {
+         value=value.substring(1,value.length()-1);
+         //value=value.replaceAll("''","'");
+      }
+      return value;
+   }
+ //dead code. Removed by Kevin Xu
+/*
+   public String uppQuoteStr(String strValue)
+   {
+      if (strValue != null && !isQuoted(strValue))
+         return strValue.toUpperCase();
+      else
+         return strValue;
+
+   }
+
+   boolean isQuoted(String source)
+   {
+      if (source != null)
+      {
+         source=source.trim();
+         if (source.startsWith("\"") && source.endsWith("\""))
+            return true;
+         else
+            return false;
+      }
+
+      return false;
+   }
+*/
+   public String getTimeinWords(long time)
+   {
+      int hrs = getHrs(time);
+      int mins = getMinutes(time);
+      int secs = getSeconds(time);
+      int msecs = getMilliseconds(time);
+      StringBuffer sb = new StringBuffer();
+
+      if (hrs > 0)
+      {
+         sb.append(hrs);
+         sb.append(" hours and ");
+      }
+      if (mins > 0)
+      {
+         sb.append(mins);
+         sb.append(" minutes and ");
+      }
+      //if (secs != 0) {
+      if (secs > 0 && secs != 1)
+      {
+         sb.append(secs);
+         sb.append(" seconds.");
+      }
+      if ((secs == 0 || secs == 1) && msecs >= 0)
+         sb.append("1 second.");
+
+      return sb.toString();
+   }
+
+   public String millisecondsToString(long time)
+   {
+      int milliseconds = getMilliseconds(time);
+      int seconds = getSeconds(time);
+      int minutes = getMinutes(time);
+      int hours = getHrs(time);
+      String millisecondsStr = (milliseconds<10 ? "00" : (milliseconds<100 ? "0" : ""))+milliseconds;
+      String secondsStr = (seconds<10 ? "0" : "")+seconds;
+      String minutesStr = (minutes<10 ? "0" : "")+minutes;
+      String hoursStr = (hours<10 ? "0" : "")+hours;
+      return new String(hoursStr+":"+minutesStr+":"+secondsStr+"."+millisecondsStr);
+
+   }
+
+   public int getMilliseconds(long time)
+   {
+      return (int)(time % 1000);
+   }
+   public int getSeconds(long time)
+   {
+      return (int)((time/1000) % 60);
+   }
+   public int getMinutes(long time)
+   {
+      return (int)((time/60000) % 60);
+   }
+   public int getHrs(long time)
+   {
+      return (int)((time/3600000) % 24);
+   }
+
+   public String formatXMLdata(String xmlData)
+   {
+
+      Pattern p = Pattern.compile("(<|&|\'|\"|>)");
+      Matcher m = p.matcher(xmlData);
+      StringBuffer strBuf = new StringBuffer();
+      while (m.find())
+      {
+         m.appendReplacement(strBuf, (String) xmlHashMap.get(m.group() ));
+      }
+      m.appendTail(strBuf);
+      return strBuf.toString();
+   }
+
+   static
+   {
+      xmlHashMap.put("&", "&amp;");
+      xmlHashMap.put("<", "&lt;");
+      xmlHashMap.put(">", "&gt;");
+      xmlHashMap.put("\"", "&quot;");
+      xmlHashMap.put("\'", "&apos;");
+   }
+
+   public String rtrim(String tmpStr)
+   {
+      tmpStr = tmpStr.replaceAll("\\s+$","");
+      return tmpStr;
+   }
+
+   public String removeSpaces(String str)
+   {
+      str = str.replaceAll("\\s+", "");
+      return str;
+   }
+   
+   public static String execLocalhostCmd(String cmd)  throws IOException 
+   {
+
+      Runtime runtime = Runtime.getRuntime();
+      Process proc = runtime.exec(cmd);
+
+      InputStream is = proc.getInputStream();
+      InputStreamReader isr = new InputStreamReader(is);
+      BufferedReader bufReader = new BufferedReader(isr);
+
+      String line="";
+      StringBuffer sbuf =new StringBuffer("");
+      while ((line = bufReader.readLine()) != null) {
+        sbuf.append(line);
+      }
+   
+      try {
+        if (proc.waitFor() != 0) {
+          //System.err.println("Exit Value = " +   proc.exitValue());
+        }
+      }
+      catch (InterruptedException e) {
+        System.err.println(e);
+      }
+      return sbuf.toString();
+   }
+   
+   public static String internalFormat2(String name)
+   {
+       int index = -1;
+       while((index = name.indexOf('"', index+2)) != -1)
+       {
+       	name = name.substring(0,index) + "\\" +name.substring(index);
+       }
+       return name;
+   }
+   
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ValidateQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ValidateQuery.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ValidateQuery.java
new file mode 100644
index 0000000..fb40fb2
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ValidateQuery.java
@@ -0,0 +1,412 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+/* 
+ * This class verifies the first key word of any sql string passed and  
+ * categorizes the type of sql. The query type is set in the query object
+ */
+
+import java.util.HashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+//import java.util.Iterator;
+//import java.util.Map;
+//import java.util.TreeMap;
+
+
+public class ValidateQuery implements SessionDefaults
+{
+   private Query qryObj=null;
+   private HashMap<String, String> fKeyMap;
+   NullKeyWordException nke;          // if the user enters blank throw this exception
+   InterfaceQueryException iqe;     // if the token is not listed throw this exception
+   Session sessObj=null;
+   
+   
+
+
+   ValidateQuery(Session sessObj)
+   {
+      fKeyMap=new HashMap<String, String>();
+      loadfKeyConstants();
+      nke=new NullKeyWordException();
+      iqe=new InterfaceQueryException();
+      this.sessObj=sessObj;
+   }
+
+   public HashMap<String, String> getfKeyMap(){
+	   return fKeyMap;
+   }
+
+   public Query getQuery()
+   {
+      return qryObj;
+   }
+   public void setQuery(Query qryObj)
+   {
+      this.qryObj = qryObj;
+   }
+
+   public void validate(Query qryObj,String sqlTerminator) throws NullKeyWordException
+   {
+      this.qryObj=qryObj;
+      String qryText= qryObj.getQueryText();
+
+      if (qryText != null)
+      {
+         qryText=Utils.trimSQLTerminator(qryText.trim(),sqlTerminator);
+      }
+
+      // check the query string and return NullKeyWord if its blank 
+      if ((qryText== null)||( qryText !=null && qryText.trim().equals("")))
+      {
+         throw nke;
+      }
+
+      String fKeyWord=getFirstToken(qryText);
+
+      // this case should not happen because we are checking for non space characters
+      if (fKeyWord==null)
+      {
+         throw nke;
+      }
+     
+      /*Check for Alias*/
+      if(sessObj.getAliasMap()!=null && qryText!=null)
+      {    
+        if(!(qryText.trim().equals("")))
+        {
+            if(sessObj.getAliasMap().containsKey(fKeyWord.toUpperCase()))
+    	    {
+            	qryText = qryObj.getQueryText().replaceFirst(replaceRegexCharacter(fKeyWord), sessObj.getAlias(fKeyWord.toUpperCase())); 
+       	   	    qryObj.resetQueryText(qryText);
+       	   	    qryText=Utils.trimSQLTerminator(qryText.trim(),sqlTerminator);
+       	   	    fKeyWord=getFirstToken(qryText);
+    	    }
+        }
+      }
+      
+      // if the first key word starts with @ , replace it with obey
+      if (fKeyWord.startsWith("@"))
+      {
+         fKeyWord="@";
+		 qryText = qryText.replaceFirst("@", "@ ");
+		 qryObj.resetQueryText(qryText);
+      }
+
+      //replace the first key word with its associated constant value
+      // from fKeyMap has table
+		fKeyWord = fKeyMap.get(fKeyWord.toUpperCase());
+
+      // if the constant value is not found, its defintely a sql or some other
+      // unknown tokens. so set the query type to SQL 
+      // set the query id -1 as its unknown at this time
+      if (fKeyWord == null)
+      {
+		if (sessObj.getMode() == SQL_MODE )
+					qryObj.setQueryType(SQLQ);
+
+         qryObj.setMultiLine(true);
+         qryObj.setPassThrough(true);
+         qryObj.setQueryId(-1);
+         return;
+      }
+
+      // convert the string integer to int
+      // we dont need to catch exception here as we made sure
+      // that the constant is int and present in the fKeyMap
+      int fKeyId=Integer.parseInt(fKeyWord);
+
+      switch (fKeyId)
+      {
+         case PRUN:
+
+            qryObj.setQueryType(PRUNQ);
+            qryObj.setMultiLine(false);
+            qryObj.setPassThrough(false);
+            qryObj.setQueryId(fKeyId);
+            break;
+
+
+         case ALIAS:
+        	 qryObj.setQueryType(IQ);
+        	 qryObj.setMultiLine(true);
+        	 qryObj.setPassThrough(false);
+        	 qryObj.setQueryId(fKeyId);
+        	 break;
+
+         case EXIT:
+         case ED:
+         case EDIT:
+         case FC:
+         case CLEAR:
+         case SLASH:
+         case RUN:
+         case SECTION:
+         case LOCALHOST:
+            //case AT:
+            qryObj.setQueryType(IQ);
+            qryObj.setMultiLine(false);
+            qryObj.setPassThrough(false);
+            qryObj.setQueryId(fKeyId);
+            break;
+
+         case SET:
+         case SPOOL:
+         case SHOW:
+         case OBEY:
+         case LOG:
+         case MODE:
+         case RESET:
+         case ENV:
+         case SESSION:
+         case HISTORY:
+         case REPEAT:
+         case HELP:
+         case SAVEHIST:
+         case VERSION:
+         case DISCONNECT:
+         case CONNECT:
+         case RECONNECT:
+         case SRUN:
+         case ERROR:
+         case ONLINEDBDUMP:
+         case AUDIT:
+         case SCHEDULE:
+         case ALLOW:
+         case DENY:
+         case LIST:
+         case DELAY:
+            qryObj.setQueryType(IQ);
+            qryObj.setMultiLine(false);
+            qryObj.setPassThrough(false);
+            qryObj.setQueryId(fKeyId);
+            break;
+
+         case INVOKE:
+         case SHOWDDL:
+         case SHOWSHAPE:
+         case SHOWCONTROL:
+         case SHOWTRANSACTION:
+         case REORG:
+         case REORGANIZE:
+         case MAINTAIN:
+         case REPLICATE:
+         case SHOWLABEL:
+         case SHOWPLAN:
+         case EXPLAIN:
+         case GET:
+
+            //qryObj.setQueryType(SQLQ);
+			if (SQL_MODE == sessObj.getMode() || CS_MODE == sessObj.getMode())
+				qryObj.setQueryType(SQLQ);
+			else if (sessObj.getMode() == WMS_MODE)
+				qryObj.setQueryType(NSQ);
+            qryObj.setMultiLine(true);
+            qryObj.setPassThrough(true);
+            qryObj.setQueryId(fKeyId);
+            qryObj.setTrimOut(true);    // set the trimout to true as we need to trim the result sets for all these cases
+            break;
+
+         case IF_THEN:
+         case LABEL:
+         case GOTO:
+            qryObj.setQueryType(CQ);
+            qryObj.setMultiLine((fKeyId == IF_THEN));
+            qryObj.setPassThrough(false);
+            qryObj.setQueryId(fKeyId);
+            break;
+         
+            
+         case DOTSQL:
+         case DOTCS:
+         case DOTNS:
+         case DOTWMS:
+         case DOTSEC:
+        	 qryObj.setQueryType(IQ);
+        	 qryObj.setMultiLine(false);
+        	 qryObj.setPassThrough(false);
+        	 qryObj.setQueryId(fKeyId);
+        	 break;
+         
+         default:
+//            if (sessObj.getMode()==SQL_MODE)
+			if (SQL_MODE == sessObj.getMode() || CS_MODE == sessObj.getMode())
+				qryObj.setQueryType(SQLQ);
+			else if (sessObj.getMode() == WMS_MODE)
+				qryObj.setQueryType(NSQ);
+            qryObj.setMultiLine(false);
+            qryObj.setPassThrough(false);
+            qryObj.setQueryId(fKeyId);
+            break;
+
+      }
+
+   }
+
+   // the first token will be any non-space characters as a word
+   // prefixed and suffixed with one or more spaces or
+   // line end
+   String getFirstToken(String fLine)
+   {
+      Pattern pat=Pattern.compile("^\\s*(\\S*)(\\s+.*|$)");
+      Matcher mat=pat.matcher(fLine);
+      if (mat.find())
+      {
+         return mat.group(1);
+      }
+      else
+         return null;
+   }
+
+   int getQueryId(String qryStr)
+   {
+	   String fToken= getFirstToken(qryStr);
+		fToken = fKeyMap.get(fToken.toUpperCase());
+	   if (fToken !=null)
+		   return Integer.parseInt(fToken);
+	   else 
+		   return -1;
+	   
+   }
+   
+//   public String trimSQLTerminator(String qryStr,String sqlTerminator)
+//   {
+//      if (qryStr.endsWith(sqlTerminator))
+//      {
+//         return qryStr.substring(0,qryStr.length()- sqlTerminator.length());
+//      }
+//      return qryStr;
+//   }
+
+   // load all first keywords which needs to be processed
+   private void loadfKeyConstants()
+   {
+      fKeyMap.put("PRUN",""+PRUN);
+      fKeyMap.put("EXIT",""+EXIT);
+      fKeyMap.put("QUIT",""+EXIT);
+      fKeyMap.put("DISCONNECT",""+DISCONNECT);
+      fKeyMap.put("SET",""+SET);
+      fKeyMap.put("RESET",""+RESET);
+      fKeyMap.put("ED",""+ED);
+      fKeyMap.put("SPOOL",""+SPOOL);
+      fKeyMap.put("LOG",""+LOG);
+      fKeyMap.put("/",""+SLASH);
+      fKeyMap.put("RUN",""+RUN);
+      fKeyMap.put("SHOW",""+SHOW);
+      fKeyMap.put("@",""+OBEY);
+      fKeyMap.put("MODE",""+MODE);
+      fKeyMap.put("OBEY",""+OBEY);
+      fKeyMap.put("HISTORY",""+HISTORY);
+      fKeyMap.put("REPEAT",""+REPEAT);
+      fKeyMap.put("INVOKE",""+INVOKE);
+      fKeyMap.put("SHOWDDL",""+SHOWDDL);
+      fKeyMap.put("SHOWSHAPE",""+SHOWSHAPE);
+      fKeyMap.put("SHOWCONTROL",""+SHOWCONTROL);
+      fKeyMap.put("REORG",""+REORG);
+      fKeyMap.put("REORGANIZE",""+REORGANIZE);
+      fKeyMap.put("MAINTAIN",""+MAINTAIN);
+      fKeyMap.put("SHOWLABEL",""+SHOWLABEL);
+      fKeyMap.put("SHOWPLAN",""+SHOWPLAN);
+      fKeyMap.put("PREPARE",""+PREPARE);
+      fKeyMap.put("EXECUTE",""+EXECUTE);
+      fKeyMap.put("EXPLAIN",""+EXPLAIN);
+      fKeyMap.put("INFOSTATS",""+INFOSTATS);
+      fKeyMap.put("FC",""+FC);
+      fKeyMap.put("CALL",""+CALL);
+      fKeyMap.put("CLEAR",""+CLEAR);
+      fKeyMap.put("HELP",""+HELP);
+      fKeyMap.put("?SECTION",""+SECTION);
+      fKeyMap.put("SAVEHIST",""+SAVEHIST);
+      fKeyMap.put("VERSION",""+VERSION);
+      fKeyMap.put("ENV",""+ENV);
+      fKeyMap.put("SESSION",""+SESSION);
+      fKeyMap.put("CONNECT",""+CONNECT);
+      fKeyMap.put("RECONNECT",""+RECONNECT);
+      fKeyMap.put("GET",""+GET);
+      fKeyMap.put("LOCALHOST",""+LOCALHOST);
+      fKeyMap.put("LH",""+LOCALHOST);
+      fKeyMap.put("ERROR",""+ERROR);
+      fKeyMap.put("ONLINEDBDUMP",""+ONLINEDBDUMP);
+      fKeyMap.put("SRUN",""+SRUN);
+      fKeyMap.put("ALLOW",""+ALLOW);
+      fKeyMap.put("DENY",""+DENY);
+      fKeyMap.put("SCHEDULE",""+SCHEDULE);
+      fKeyMap.put("LIST",""+LIST);
+      fKeyMap.put("AUDIT",""+AUDIT);
+      fKeyMap.put("DELAY",""+DELAY);
+      fKeyMap.put("IF",""+IF_THEN);
+      fKeyMap.put("LABEL",""+LABEL);
+      fKeyMap.put("GOTO",""+GOTO);
+      fKeyMap.put("ALIAS",""+ALIAS);
+      fKeyMap.put(".SQL",""+DOTSQL);
+      fKeyMap.put(".CS",""+DOTCS);
+      fKeyMap.put(".NS",""+DOTNS);
+      fKeyMap.put(".WMS",""+DOTWMS);
+      fKeyMap.put(".SEC",""+DOTSEC);
+      fKeyMap.put("CONTROL",""+CONTROL);
+      fKeyMap.put("REPLICATE",""+REPLICATE);
+      fKeyMap.put("SHOWTRANSACTION",""+SHOWTRANSACTION);
+
+   }
+   /**
+    * Added  2010-02-26
+    * Replace reserved characters of regex with '\'+characters
+    * @param source
+    * @return
+    */
+   public String replaceRegexCharacter(String source)
+   {
+	   if(source==null || source.length()==0)
+		   return "";
+	   StringBuilder stbReturn = new StringBuilder();
+	   char[] analyStr=source.toCharArray();
+	   if(analyStr.length>0)
+	   {
+		   for(int i=0;i<analyStr.length;i++)
+		   {
+			   switch(analyStr[i])
+			   {
+			   	case '+':
+			   	case '?':
+			   	case '*':
+			   	case '.':
+			   	case '^':
+			   	case '{':
+			   	case '[':
+			   	case '(':
+			   	case ')':
+			   	case '$':
+			   		stbReturn.append('\\');
+			   		break;
+			   		
+			   }
+			   stbReturn.append(analyStr[i]);
+		   }
+	   }
+	   
+	   return stbReturn.toString();
+   }
+   
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ValidationException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ValidationException.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ValidationException.java
new file mode 100644
index 0000000..e289751
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ValidationException.java
@@ -0,0 +1,39 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class ValidationException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 8842989562052059377L;
+
+	ValidationException()
+	{
+		
+	}
+	
+	ValidationException(String msg)
+	{
+		super(msg);
+	}	
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Vproc.java-tmpl
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Vproc.java-tmpl b/core/conn/trafci/src/main/java/org/trafodion/ci/Vproc.java-tmpl
new file mode 100644
index 0000000..170922c
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Vproc.java-tmpl
@@ -0,0 +1,36 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+
+public class Vproc
+{
+   private static final String vprocStr = "@@@";
+   public static void main(String[] args)
+   {
+      System.out.println(vprocStr);
+   }
+   public static String getVproc()
+   {
+      return vprocStr;
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/WCIUtils.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/WCIUtils.java b/core/conn/trafci/src/main/java/org/trafodion/ci/WCIUtils.java
new file mode 100644
index 0000000..63a9057
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/WCIUtils.java
@@ -0,0 +1,122 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.FileOutputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
+
+public class WCIUtils
+{
+
+   // constants copied from wincon.h
+
+   /**
+   *  Characters read by the ReadFile or ReadConsole function
+   *  are written to the active screen buffer as they are read.
+   *  This mode can be used only if the ENABLE_LINE_INPUT mode
+   *  is also enabled.
+   */
+   private static final int ENABLE_ECHO_INPUT = 4;
+
+   private static boolean loaded = false;
+
+   String tmpDir=System.getProperty("java.io.tmpdir");
+   String userName=System.getProperty("user.name");
+   String archModel=System.getProperty("sun.arch.data.model");
+
+   public  native void cls();
+   private native int getConsoleMode();
+   private native void setConsoleMode(final int mode);
+
+
+   public WCIUtils() throws IOException
+   {
+      if (!loaded)
+      {
+         copyDllFromURL();
+         if (archModel.equalsIgnoreCase("64"))
+            System.load(tmpDir + "WCIUtils64_" + userName + ".dll");
+         else
+        	System.load(tmpDir + "WCIUtils32_" + userName + ".dll");
+         loaded = true;
+      }
+   }
+
+   public synchronized void enableEcho()
+   {
+      setConsoleMode( getConsoleMode() | ENABLE_ECHO_INPUT );
+   }
+
+   public synchronized void disableEcho()
+   {
+      setConsoleMode( getConsoleMode() & ~( ENABLE_ECHO_INPUT));
+   }
+
+
+   private synchronized void copyDllFromURL() throws IOException
+   {
+	  File dest;
+      if (archModel.equalsIgnoreCase("64"))
+    	  dest = new File( tmpDir, "WCIUtils64_" + userName + ".dll" );
+      else
+    	  dest = new File( tmpDir, "WCIUtils32_" + userName + ".dll" );
+
+
+      // if the dll already exists in the local pc
+      // recopy the file it is not already loaded
+      if (dest.exists())
+      {
+         try
+         {
+            if (!dest.delete())
+               return;
+         }catch (Exception e)
+         {
+            dest=null;
+            return;
+         }
+      }
+
+      FileOutputStream os = new FileOutputStream( dest );
+      InputStream is;
+      if (archModel.equalsIgnoreCase("64"))
+    	  is=this.getClass().getResourceAsStream("WCIUtils64.dll");
+      else
+    	  is=this.getClass().getResourceAsStream("WCIUtils32.dll");
+
+      byte data[] = new byte[ 4096 ];
+      int ct;
+
+      while ((ct=is.read( data )) >= 0)
+         os.write( data, 0, ct );
+
+      is.close();
+      os.close();
+      os=null;
+      is=null;
+      dest=null;
+
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Writer.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Writer.java b/core/conn/trafci/src/main/java/org/trafodion/ci/Writer.java
new file mode 100644
index 0000000..c277342
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Writer.java
@@ -0,0 +1,418 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+
+public class Writer
+{
+
+   private ConsoleWriter cWriter=null;
+   private FileWriter lWriter=null;
+   private FileWriter sWriter=null;
+   private InterfaceSyntaxError ise=null;
+   private ConditionalSyntaxError cse=null;
+   private Parser parser = new Parser();
+   private int writerMode=SessionDefaults.CONSOLE_WRITE_MODE;
+   private Session sessObj=null;
+
+   Writer()
+   {
+   }
+
+   Writer(Session sessObj)
+   {
+      this.sessObj = sessObj;
+   }
+
+
+
+   public void write(String line) throws IOException
+   {
+      switch (writerMode)
+      {
+         case SessionDefaults.CONSOLE_WRITE_MODE:
+            cWriter.print(line);
+            break;
+         case SessionDefaults.LOG_WRITE_MODE:
+            lWriter.write(line);
+            break;
+         case SessionDefaults.SPOOL_WRITE_MODE:
+            sWriter.write(line);
+            break;
+         case SessionDefaults.CONSOLE_SPOOL_WRITE_MODE:      	 
+        	 if (!sessObj.isQuietEnabled()) 
+             	cWriter.print(line);
+             sWriter.write(line);
+             
+            break;
+      }
+   }
+
+   public void writeln() throws IOException
+   {
+      switch (writerMode)
+      {
+         case SessionDefaults.CONSOLE_WRITE_MODE:
+            cWriter.println();
+            break;
+         case SessionDefaults.LOG_WRITE_MODE:
+            lWriter.writeln();
+            break;
+         case SessionDefaults.SPOOL_WRITE_MODE:
+            sWriter.writeln();
+            break;
+         case SessionDefaults.CONSOLE_SPOOL_WRITE_MODE:
+        	if (!sessObj.isQuietEnabled()) 
+             	cWriter.println();
+             sWriter.writeln();
+
+            break;
+      }
+   }
+
+   public void writeAllSQLExceptions(Session sessObj, SQLException sqle) throws IOException
+   {
+      do
+      {
+         if (!sessObj.isSessionAutoPrepare())
+         {
+			String errorInfo = parser.getErrorCode(
+						formatErrStr(sqle.toString(), sessObj),
+						sqle.getErrorCode());
+            if (errorInfo.equals("8822") && !sessObj.getQuery().getQueryText().trim().toUpperCase().startsWith("PREPARE "))
+            {
+               continue;
+            }
+         }
+		this.writeInterfaceError(sessObj,
+					new ErrorObject(formatErrStr(sqle.toString(), sessObj),
+							sqle.getErrorCode()));
+      } while ((sqle=sqle.getNextException()) != null);
+
+      // Print end tags if MARKUP is XML or HTML
+      this.writeEndTags(sessObj);
+   }
+
+   /*
+    *  Writes all the warnings that are returned as part of the ResultSet
+    *  whilst we are doing a fetch.
+    */
+   public void writeAllFetchWarnings(Session sessObj, SQLWarning sqlw,
+                                     int numCols) throws IOException {
+
+      /*  Get the markup being currently used for the display.  */
+      int outputMarkup = sessObj.getDisplayFormat();
+
+
+      /*
+       *  Print starting tags.
+       */
+      if (SessionDefaults.XML_FORMAT == outputMarkup)
+         sessObj.getXmlObj().startFetchWarningListTag();
+      else if (SessionDefaults.HTML_FORMAT == outputMarkup)
+         sessObj.getHtmlObj().startFetchWarningListTable(numCols);
+
+
+      /*
+       *  Loop thru' all the warnings.
+       */
+      while (null != sqlw) {
+         String errStr = formatErrStr(sqlw.toString(), sessObj);
+
+         switch(outputMarkup) {
+            case SessionDefaults.XML_FORMAT  : 
+            case SessionDefaults.HTML_FORMAT :
+                 ErrorObject eo = new ErrorObject(parser.getErrorCode(errStr,sqlw.getErrorCode()),
+                                                  errStr, 'W');
+                 if (SessionDefaults.XML_FORMAT == outputMarkup)
+                    sessObj.getXmlObj().handleFetchWarnings(eo);
+                 else
+                    sessObj.getHtmlObj().handleFetchWarnings(eo);
+
+                 break;
+
+            default:
+                writeln(errStr);
+                break;
+
+         }  /*  End of  switch on display output markup.  */
+
+
+         /*  Get the next warning in this warning chain.  */
+         sqlw=sqlw.getNextWarning();
+
+
+      }  /*  End of  WHILE  there are more warnings to process.  */
+ 
+
+      /*
+       *  Print the ending tags.
+       */
+      if (SessionDefaults.XML_FORMAT == outputMarkup)
+         sessObj.getXmlObj().endFetchWarningListTag();
+      else if (SessionDefaults.HTML_FORMAT == outputMarkup)
+         sessObj.getHtmlObj().endFetchWarningListTable();
+
+   }   /*  End of  writeAllFetchWarnings  method.  */
+
+   public void writeAllSQLWarnings(Session sessObj, SQLWarning sqlw) throws IOException
+   {
+      while ((sqlw!=null))
+      {
+			if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+				sessObj.getXmlObj().handleWarnings(
+						new ErrorObject(parser.getErrorCode(
+								formatErrStr(sqlw.toString(), sessObj),
+								sqlw.getErrorCode()),
+								formatErrStr(sqlw.toString(), sessObj), 'W'));
+			else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+				sessObj.getHtmlObj().handleWarnings(
+						new ErrorObject(parser.getErrorCode(
+								formatErrStr(sqlw.toString(), sessObj),
+								sqlw.getErrorCode()),
+								formatErrStr(sqlw.toString(), sessObj), 'W'));
+			else
+				writeln(formatErrStr(sqlw.toString(), sessObj));
+
+         sqlw=sqlw.getNextWarning();
+      }
+   }
+
+   public void writeSyntaxError(Session sessObj, String qryString, String remainderString) throws IOException
+   {
+      if (ise == null)
+      {
+         ise=new InterfaceSyntaxError();
+      }
+      writeInterfaceErrors(sessObj, ise.getSyntaxError(qryString,remainderString));
+   }
+
+   public void writeConditionalSyntaxError(Session sessObj, String qryString) throws IOException
+   {
+       if(cse == null )
+       {
+           cse=new ConditionalSyntaxError();
+       }
+       writeInterfaceErrors(sessObj, cse.getSyntaxError(qryString));
+   }
+   
+   public void writeln(String line) throws IOException
+   {
+      write(line);
+      writeln();
+   }
+
+   private String formatErrStr(String errStr, Session sessObj)
+   {
+
+	if ((errStr.indexOf("org.trafodion.jdbc.t4") != -1)
+				|| (errStr.indexOf("java.sql") != -1)
+				|| (errStr.indexOf("org.trafodion.jdbc.t4.TrafT4") != -1))
+      {
+         if (errStr.indexOf(":")!=-1)
+         {
+            errStr =errStr.substring(errStr.indexOf(":")+1).trim();
+         }
+         else
+         {
+            return errStr;
+         }
+      }
+     
+      return errStr;
+   }
+
+   public void writeElapsedTime(String time) throws IOException
+   {
+      writeln();
+      writeln("Elapsed: "+ time);
+   }
+
+   public ConsoleWriter getConsoleWriter()
+   {
+      return cWriter;
+   }
+   public void setConsoleWriter(ConsoleWriter writer)
+   {
+      cWriter = writer;
+   }
+   public FileWriter getSpoolWriter()
+   {
+      return sWriter;
+   }
+   public void setSpoolWriter(FileWriter sWriter)
+   {
+      this.sWriter = sWriter;
+   }
+   public FileWriter getLogWriter()
+   {
+      return lWriter;
+   }
+   public void setLogWriter(FileWriter lWriter)
+   {
+      this.lWriter = lWriter;
+   }
+   public int getWriterMode()
+   {
+      return this.writerMode;
+   }
+   public void setWriterMode(int writerMode)
+   {
+      this.writerMode = writerMode;
+   }
+
+ public void writeError(Session sessObj, ErrorObject errObj) throws IOException
+     {
+      this.writeInterfaceErrors(sessObj, errObj);
+   }
+      
+   public void writeError(Session sessObj, char errType,ErrorObject errObj, String[] values) throws IOException
+   {
+	     String errStr = errObj.errorMessage();
+	      for (int i=0;i<values.length;i++)
+	    	  errStr = errStr.replaceFirst("%s",values[i].toString());
+	      this.writeError(sessObj, new ErrorObject(errObj.errorCode(), errStr));
+   }
+
+   public void writeExecutionTime(Session sessObj, Utils utilObj, Writer writer) throws IOException
+   {
+      String qryExecTime= "";
+      qryExecTime = " *** Total Query time was " + utilObj.getTimeinWords(sessObj.getQryExecEndTime());
+
+      if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+         sessObj.getHtmlObj().handleQryExecutionTime(qryExecTime);
+      else if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+         sessObj.getXmlObj().handleQryExecutionTime(qryExecTime);
+      else if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+         writer.writeln(qryExecTime+SessionDefaults.lineSeperator);
+   }
+
+   public void writeStatusMsg(Session sessObj, Query qryObj, Utils utilObj, Writer writer) throws IOException
+   {
+       String elapsedTimeMsg = getElapsedTime(sessObj,qryObj, utilObj);
+       String statusMsg = sessObj.getLfProps().getStatus(qryObj) + SessionDefaults.lineSeperator;
+       writeStatusMsg(sessObj, statusMsg, elapsedTimeMsg, writer);
+   }
+
+   public void writeStatusMsg(Session sessObj, String statusMsg, String elapsedTimeMsg, Writer writer) throws IOException
+   {
+      if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+         sessObj.getHtmlObj().processHtml(elapsedTimeMsg);
+      else if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+      {
+         sessObj.getXmlObj().processXml("",elapsedTimeMsg);
+      }
+      else if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+      {
+         if (null != statusMsg)
+            writer.write(statusMsg);
+         if (sessObj.isSessionTimingOn())
+         {
+            if (null != statusMsg)
+               writer.writeln(); 
+            writer.writeln(elapsedTimeMsg);
+            
+            writer.printElapsedQuietMode(elapsedTimeMsg);
+         }
+      }
+
+   }
+
+   public String getElapsedTime(Session sessObj,Query qryObj,Utils utilObj)
+   {
+      String elapsedTimeMsg="";
+      if (sessObj.isSessionTimingOn())
+      {
+            elapsedTimeMsg =  "Elapsed: " + utilObj.millisecondsToString(qryObj.getElapsedTime());
+      }
+      return elapsedTimeMsg;
+   }
+   
+   public void printElapsedQuietMode(String elapsedTimeMsg){
+       if (sessObj.isSessionTimingOn())
+       {
+           if(writerMode == SessionDefaults.CONSOLE_SPOOL_WRITE_MODE && 
+                    sessObj.isQuietEnabled() && sessObj.getCaller() != SessionDefaults.PRUNI)
+           {
+               try{
+            	     sessObj.setQuietEnabled(false);
+                   writeln(); 
+                   this.getConsoleWriter().println(elapsedTimeMsg);
+               }catch(IOException ioex){
+                   ;
+               }
+               sessObj.setQuietEnabled(true);
+           }
+       }
+   }
+
+   // Print end tags if MARKUP is XML or HTML
+   public void writeEndTags (Session sessObj) throws IOException
+   {
+      if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
+         sessObj.getXmlObj().handleEndTags();
+      if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
+         sessObj.getHtmlObj().handleEndTags();
+   }
+
+   //called when an SQL query returns an error.
+   public void writeInterfaceErrors(Session sessObj, String errorStr) throws IOException
+   {
+	   writeInterfaceErrors(sessObj,new ErrorObject(errorStr));
+   }
+
+   // called when a single interface error occurs.
+   public void writeInterfaceErrors(Session sessObj, ErrorObject errorObj) throws IOException
+   {
+      writeInterfaceError(sessObj, errorObj);
+      //Catalog API calls - print the end tags in InterfaceQuery 
+      int errorNo = Integer.parseInt(errorObj.errorCode());
+      if (!(errorNo >= 29416 && errorNo <= 29423))
+         writeEndTags(sessObj);
+   }
+
+   // called once for each error message in a series of errors.
+   public void writeInterfaceError(Session sessObj, ErrorObject errorObj) throws IOException
+   {
+      switch (sessObj.getDisplayFormat())
+      {
+         case SessionDefaults.HTML_FORMAT:
+         sessObj.getHtmlObj().handleErrors(errorObj);
+         break;
+      case SessionDefaults.XML_FORMAT: 
+         sessObj.getXmlObj().handleErrors(errorObj);
+         break;
+      default:
+         writeln(errorObj.RAWOutputError());
+         break;
+      }
+      
+     if (!errorObj.errorCode().equalsIgnoreCase(Parser.UNKNOWN_ERROR_CODE))
+         sessObj.setLastError(Integer.parseInt(errorObj.errorCode()));
+   }
+}
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/XMLDisplay.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/XMLDisplay.java b/core/conn/trafci/src/main/java/org/trafodion/ci/XMLDisplay.java
new file mode 100644
index 0000000..f121300
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/XMLDisplay.java
@@ -0,0 +1,75 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+public class XMLDisplay implements IDisplay {
+	
+	private Query qryObj;
+	private Writer writer=null;
+	private Session sessObj=null;
+	
+	public XMLDisplay(Session sessObj)
+	{
+		if(sessObj!=null)
+		{
+			this.sessObj = sessObj;
+			this.writer=sessObj.getWriter();
+			this.qryObj=sessObj.getQuery();
+		}
+	}
+
+	public void output(OutputContents contents) throws IOException {
+		// TODO Auto-generated method stub
+		if(contents!=null)
+		{
+			this.writer=sessObj.getWriter();
+			this.qryObj=sessObj.getQuery();
+			//display header
+			ArrayList<OutputColumnAttribute> columns = contents.getColumns();
+			qryObj.setColCount(String.valueOf(columns.size()));
+			
+			ArrayList<ArrayList<String>> alRows = contents.getRows();
+			if(alRows!=null && alRows.size()>0)
+			{
+				for(int i=0;i<alRows.size();i++)
+				{
+					ArrayList<String> alRow = alRows.get(i);
+					if(alRow!=null && alRow.size()>0)
+					{
+						for(int j=0;j<alRow.size();j++)
+						{
+							OutputColumnAttribute columnAttr = columns.get(j);
+				            sessObj.getXmlObj().processXml(columnAttr.name,alRow.get(j));
+				            writer.writeln();
+						}
+					}
+					
+				}
+			}
+			
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/XMLObject.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/XMLObject.java b/core/conn/trafci/src/main/java/org/trafodion/ci/XMLObject.java
new file mode 100644
index 0000000..469b1ef
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/XMLObject.java
@@ -0,0 +1,607 @@
+// @@@ 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 @@@
+/**
+ * 
+ * 
+ * Class to display the Errors/Warnings/ResultSets/Status Messages in XML format 
+ * 
+ */
+
+package org.trafodion.ci;
+
+import java.io.*;
+
+public class XMLObject
+{
+
+   private Utils utilObj = null;
+//   private Parser parser = null;
+   private Session sessObj = null;
+   private Writer writer = null;
+   private Query qryObj = null;
+   private QueryUtils qryUtilObj=null;
+
+   int rowCount = 0;
+   int colCount = 1;
+   int errorCount = 0;
+
+   public String _xmlNameSpaceTag="<?xml version=\"1.0\"?>";
+   private String encodingTag="";
+   public String _beginRootTag = "<Results>";
+   public String _endRootTag = "</Results>";
+
+   String _beginQueryTag = " <Query>";
+   String _endQueryTag = " </Query>";
+
+   boolean _beginRootElement = false;
+   boolean _errors = false;
+   boolean _warnings = false;
+   boolean _initDone = false;
+
+   String _beginRowTag = " <Row id=\"" ;
+   String _endRowTag = " </Row>";
+
+   String _beginCdataTag=" <![CDATA[";
+   String _endCdataTag = " ]]>";
+   String _endCdataTagEscaped = "]]&#62;";
+
+   String _beginStatusTag = "<Status>";
+   String _endStatusTag = "</Status>";
+
+   String _beginErrorListTag = " <ErrorList>";
+   String _endErrorListTag = " </ErrorList>";
+
+   String _beginErrorCountTag = "  <Error id=\"" ;
+   String _endErrorCountTag = "  </Error>";
+
+   String _beginErrorCodeTag = "    <ErrorCode>";
+   String _endErrorCodeTag = "</ErrorCode>";
+   
+   String _beginMessageCodeTag = "    <MessageCode>";
+   String _endMessageCodeTag = "</MessageCode>";
+
+   String _beginErrorMsgTag = "    <ErrorMsg>";
+   String _endErrorMsgTag = "</ErrorMsg>";
+
+   String _beginMessageMsgTag = "    <MessageText>";
+   String _endMessageMsgTag = "</MessageText>";
+   
+   String _beginWarnListTag = " <WarningList>";
+   String _endWarnListTag = " </WarningList>";
+
+   String _beginWarnCountTag = "  <Warning id=\"" ;
+   String _endWarnCountTag = "  </Warning>";
+
+   String _beginWarnCodeTag = "    <WarningCode>";
+   String _endWarnCodeTag = "</WarningCode>";
+
+   String _beginWarnMsgTag = "    <WarningMsg>";
+   String _endWarnMsgTag = "</WarningMsg>";
+
+   public String _beginScriptsDirTag = "<ScriptsDirectory>";
+   public String _endStriptsDirTag = "</ScriptsDirectory>";
+
+   public String _beginLogsDirTag = "<LogsDirectory>";
+   public String _endLogsDirTag = "</LogsDirectory>";
+
+   public String _beginLogsO = "<OverWriteLog>";
+   public String _endLogsO = "</OverWriteLog>";
+
+   public String _beginConnTag = "<TotalConnections>";
+   public String _endConnTag = "</TotalConnections>";
+
+   public String _beginSeqIdTag = "<Seq id = \"";
+   public String _endSeqIdTag = "</Seq>";
+
+   public String _beginLogFileNameTag = "  <LogFileName>";
+   public String _endLogFileNameTag = "  </LogFileName>";
+
+   public String _beginTotalSqlsTag = "  <TotalSqls>";
+   public String _endTotalSqlsTag = "  </TotalSqls>";
+
+   public String _beginTotalErrors = "  <Errors>";
+   public String _endTotalErrors = "  </Errors>";
+
+   public String _beginTotalWarnings = "  <Warnings>" ;
+   public String _endTotalWarnings = "  </Warnings>" ;
+
+   public String _beginMinTag = "<TotalMinutes>";
+   public String _endMinTag = "</TotalMinutes>";
+
+   public String _endAttributeTag = "\">";
+
+   String _beginResultSetIdTag = " <ResultSet id=\"" ;
+   String _beginResultSetTag = " <ResultSet>" ;
+   String _endResultSetTag = " </ResultSet>";
+   
+   String _beginExecutionTimeTag = " <ExecutionTime>";
+   String _endExecutionTimeTag = "</ExecutionTime>";
+   
+   String statusMsg = "";
+   boolean perTableStats = false;
+   
+   
+
+   XMLObject ()
+   {
+   }
+
+   XMLObject (Session sessObj)
+   {
+      this.sessObj = sessObj;
+//      parser = new Parser();
+      utilObj = new Utils();
+      qryUtilObj = new QueryUtils();
+      
+   }
+
+   public void init()
+   {
+      this.writer=sessObj.getWriter();
+      this.qryObj=sessObj.getQuery();
+      _initDone = true;
+    }
+
+   public void processXml(String columnName, String output) throws IOException
+   {
+
+      if (!_initDone)
+      {
+         this.init();
+         this.handleStartTags();
+         //_initDone = true;
+      }
+      if (sessObj.isInOutandRS() && qryObj.getRsCount() >= 0)
+      {
+         //   writer.writeln(" " + _beginResultSetTag);
+         qryObj.resetQueryText("SELECT *");
+         rowCount = 0;
+         colCount = 1;
+
+      }
+      if ((qryObj.getRowCount() != null))
+      {
+
+         if ((_warnings) || ((rowCount==0 && Integer.parseInt(qryObj.getRowCount())==0)  || (rowCount != Integer.parseInt(qryObj.getRowCount()))))
+         {
+            this.handleStartTags();
+         }
+         
+         if ((qryObj.isTrimOut() && !qryUtilObj.isGetStatsCmd(qryObj)) || (perTableStats) )
+         {
+            writer.writeln(" " + _endCdataTag);
+            perTableStats = false;
+         }
+         
+         if (_warnings && !sessObj.isWriteParams())
+            writer.writeln(_endWarnListTag);
+         
+         if ((sessObj.isImplicitGetStatsQry()) && qryUtilObj.isGetStatsCmd(qryObj))
+         {
+            statusMsg = "";
+            sessObj.getDbQryObj().resetQryObj();
+            sessObj.setImplicitGetStatsQry(false);
+         }
+         else
+         {
+            statusMsg = sessObj.getLfProps().getStatus(qryObj);
+         }
+         if (!((output.equals("")) && statusMsg.equals("")))
+            writer.write(_beginStatusTag + _beginCdataTag + statusMsg + output +  _endCdataTag + _endStatusTag +SessionDefaults.lineSeperator);
+         this.handleEndTags();
+         return;
+      }
+
+      if (qryObj.isTrimOut())
+      {
+         if (qryUtilObj.isGetStatsCmd(qryObj) && !perTableStats)
+         {
+            if (!(output.trim().equals("")))
+               printGetStatsOutput(output.trim());
+         }
+         else
+               writer.write(output.trim());
+      }else
+      {
+         if (colCount == 1)
+         {
+            if (_warnings && sessObj.isWriteParams())
+               writer.writeln(_endWarnListTag);
+            if (sessObj.isSPJRS() && rowCount == 0 || (sessObj.isInOutandRS()))
+            {
+               writer.write( _beginResultSetIdTag + (qryObj.getRsCount()+1) + _endAttributeTag + SessionDefaults.lineSeperator);
+               sessObj.setInOutandRS(false);
+            }
+            writer.write(_beginRowTag + (rowCount+1) + _endAttributeTag + SessionDefaults.lineSeperator);
+
+         }
+         writer.write("   <"+columnName+">"+utilObj.formatXMLdata(output.trim())+"</"+columnName+">");
+
+         if (qryObj.getColCount() != null)
+         {
+            colCount++;
+            if (colCount > Integer.parseInt(qryObj.getColCount()))
+            {
+               writer.write(SessionDefaults.lineSeperator+_endRowTag);
+               rowCount++;
+               colCount=1;
+            }
+         }
+      }
+   }
+
+   public void handleStartTags() throws IOException
+   {
+      if (!_beginRootElement)
+      {
+         if (sessObj.getISOMapping() == 10)
+         {
+            encodingTag = "encoding=\"" + "Shift_JIS"+ "\"";
+            _xmlNameSpaceTag = "<?xml version=\"1.0\" " + encodingTag + "?>";
+         }
+         else
+         {
+            _xmlNameSpaceTag = "<?xml version=\"1.0\"?>";
+         }
+
+         writer.writeln(_xmlNameSpaceTag);
+         writer.writeln(_beginRootTag);
+
+         if (qryObj.getQueryText() != null)
+         {
+            writer.writeln(_beginQueryTag);
+
+            if (sessObj.isSPJRS() && qryObj.getRowCount() == "0")
+               qryObj.resetQueryText(sessObj.getDbQryObj().qryText);
+
+            //Escape "]]>" if it appears within QueryText
+            writer.writeln(" " + _beginCdataTag + sessObj.getQuery().getQueryText().replaceAll(_endCdataTag.trim(), _endCdataTagEscaped)+ _endCdataTag);
+            writer.writeln(_endQueryTag);
+
+            if (qryObj.isTrimOut()) 
+               writer.writeln(" " + _beginCdataTag);
+
+            if (sessObj.isSPJRS() && qryObj.getRsCount() > 0)
+            {
+               writer.writeln(" " + _beginResultSetTag);
+               qryObj.resetQueryText("SELECT *");
+            }
+         }
+         
+         _beginRootElement = true;
+      }
+
+   }
+
+   public void handleEndTags() throws IOException
+   {
+	if (_initDone)
+	{
+      if (_errors)
+         writer.writeln(_endErrorListTag);
+
+      if (sessObj.isSPJRS())
+      {
+         writer.write(SessionDefaults.lineSeperator+_endResultSetTag);
+      }
+      else
+      {
+         if (!(sessObj.isImplicitGetStatsQry())) {
+            writer.write(_endRootTag+SessionDefaults.lineSeperator);
+            _beginRootElement = false;
+         }
+      }
+
+      _errors = false;
+      _warnings = false;
+      errorCount = 0;
+      rowCount = 0;
+      colCount = 1;
+      _initDone = false;
+      sessObj.setWriteParams(false);
+	}
+   }
+
+   public void handleErrors(ErrorObject errorObj) throws IOException
+   {
+       if (errorObj != null)
+           {
+	           if (!_initDone)
+	               {
+	               this.init();
+	               }
+	
+	           boolean notBegin=false;
+	           if(notBegin = !_beginRootElement)
+	           {
+	        	   this.handleStartTags();
+	           }
+	           
+	           if (errorObj.errorCode() == Parser.UNKNOWN_ERROR_CODE)
+	           {
+	               writeServerMessage(errorObj);
+	           }
+	           else if(errorObj.errorType == 'I')
+	           {
+	               writeInformational(errorObj);
+	           }
+	           else if(errorObj.errorType == 'W')
+	           {
+	               handleWarnings(errorObj);
+	           }
+	           else 
+	           {
+	               if (notBegin)
+	               {
+	                   writer.writeln(_beginErrorListTag);
+	                   _errors = true;
+	               }
+	               writeErrors(errorObj);
+               }
+         }
+   }
+   public void writeServerMessage(ErrorObject errorObj) throws IOException
+   {
+         String escapedErrorMessage = errorObj.errorMessage().replaceAll(_endCdataTag.trim(), _endCdataTagEscaped);
+         //escape any instance of the substring "]]>" that appears in errorStr. It is escaped by replacing it with the _endCdataTagEscaped string.
+         writer.writeln(_beginCdataTag + escapedErrorMessage + _endCdataTag);
+   }
+   public void writeInformational(ErrorObject errorObj) throws IOException
+   {
+         String escapedErrorMessage = errorObj.errorMessage().replaceAll(_endCdataTag.trim(), _endCdataTagEscaped);
+         //  writer.writeln(_beginMessageCodeTag + errorObj.errorCode() + _endMessageCodeTag);
+         //escape any instance of the substring "]]>" that appears in errorStr. It is escaped by replacing it with the _endCdataTagEscaped string.
+         writer.writeln(_beginMessageMsgTag + _beginCdataTag + escapedErrorMessage + _endCdataTag + _endMessageMsgTag);
+   }
+   
+   public void writeErrors(ErrorObject errorObj) throws IOException
+   {
+         String escapedErrorMessage = errorObj.errorMessage().replaceAll(_endCdataTag.trim(), _endCdataTagEscaped);
+    	 writer.write(_beginErrorCountTag + ++errorCount + _endAttributeTag + SessionDefaults.lineSeperator );
+         writer.writeln(_beginErrorCodeTag + errorObj.errorCode() + _endErrorCodeTag);
+
+         //escape any instance of the substring "]]>" that appears in errorStr. It is escaped by replacing it with the _endCdataTagEscaped string.
+         writer.writeln(_beginErrorMsgTag + _beginCdataTag + escapedErrorMessage + _endCdataTag + _endErrorMsgTag);
+         writer.writeln(_endErrorCountTag);
+   }
+ //dead code. Removed by Kevin Xu
+/* 
+   public void writeWarnings(ErrorObject errorObj) throws IOException
+   {
+         String escapedErrorMessage = errorObj.errorMessage().replaceAll(_endCdataTag.trim(), _endCdataTagEscaped);
+    	 writer.write(_beginErrorCountTag + ++errorCount + _endAttributeTag + SessionDefaults.lineSeperator );
+         writer.writeln(_beginErrorCodeTag + errorObj.errorCode() + _endErrorCodeTag);
+
+         //escape any instance of the substring "]]>" that appears in errorStr. It is escaped by replacing it with the _endCdataTagEscaped string.
+         writer.writeln(_beginErrorMsgTag + _beginCdataTag + escapedErrorMessage + _endCdataTag + _endErrorMsgTag);
+         writer.writeln(_endErrorCountTag);
+   }
+*/
+   /**
+    *  Method to print a top level xml tag below the root element of the
+    *  marked up xml document.
+    */
+   private void printTopLevelXMLTag(String theTag)  throws IOException {
+      /*  Check if we need to do the initialization.  */
+      if (!_initDone)
+         this.init();
+
+      /*  Check if we need to setup and create the tags.  */
+      if (!_beginRootElement)
+         this.handleStartTags();
+
+
+      if ((null != theTag)  &&  (0 < theTag.length() ) )
+         writer.writeln(theTag);
+        
+   }  /*  End  of  printTopLevelXMLTag  method.  */
+
+
+
+   /**
+    *  Method to print the warning list start tag for all warnings
+    *  encountered during a fetch operation. 
+    */
+   public void startFetchWarningListTag()  throws IOException {
+      printTopLevelXMLTag(_beginWarnListTag);
+
+   }  /*  End of  startFetchWarningListTag  method.  */
+
+
+
+   /**
+    *  Method to print the warning list end tag for all warnings
+    *  encountered during a fetch operation. 
+    */
+   public void endFetchWarningListTag()  throws IOException {
+      printTopLevelXMLTag(_endWarnListTag);
+
+   }  /*  End of  endFetchWarningListTag  method.  */
+
+
+
+   /**
+    *  Method to print warnings encountered during a fetch operation. These 
+    *  warnings need to printed in a separate warning list within the scope 
+    *  of the fetch.
+    *  Oh, this whole xml/html markup piece is so very messy!! :^(
+    */
+   public void handleFetchWarnings(ErrorObject errorObj) throws IOException {
+      /*  Check if we need to do the initialization.  */
+      if (!_initDone)
+         this.init();
+
+      /*  Check if we need to setup and create the tags.  */
+      if (!_beginRootElement)
+         this.handleStartTags();
+
+
+      if (errorObj != null) {
+         writer.writeln(_beginWarnCountTag + ++errorCount + _endAttributeTag);
+         writer.writeln(_beginWarnCodeTag + errorObj.errorCode() + 
+                       _endWarnCodeTag);
+         writer.writeln(_beginWarnMsgTag + errorObj.errorMessage() + 
+                        _endWarnMsgTag);
+         writer.writeln(_endWarnCountTag);
+      }
+
+   }   /*  End of  handleFetchWarnings  method.  */
+
+   public void handleWarnings(ErrorObject errorObj) throws IOException
+   {
+      if (!_initDone)
+      {
+         this.init();
+         //_initDone = true;
+      }
+
+      if (!_beginRootElement)
+      {
+         this.handleStartTags();
+         writer.writeln(_beginWarnListTag);
+         _warnings = true;
+      }
+
+      if (errorObj != null)
+      {
+         writer.write(_beginWarnCountTag + ++errorCount + _endAttributeTag + SessionDefaults.lineSeperator );
+         writer.writeln(_beginWarnCodeTag + errorObj.errorCode() + _endWarnCodeTag);
+         writer.writeln(_beginWarnMsgTag + errorObj.errorMessage() + _endWarnMsgTag);
+         writer.writeln(_endWarnCountTag);
+      }
+   }
+
+   public void handlePrunSummary(ConsoleWriter cWriter, PrunSummary summaryObj,String elapsedTime) throws IOException
+   {
+      this.init();
+      this.handleStartTags();
+      cWriter.println(_beginCdataTag);
+      cWriter.println(" " + SessionDefaults.lineSeperator+"PARALLELRUN(PRUN) SUMMARY");
+      cWriter.println(_endCdataTag);
+      cWriter.println("<Summary>");
+      cWriter.println("  <TotalFilesPresent>" + summaryObj.getTotalScriptFiles() + "</TotalFilesPresent>");
+      cWriter.println("  <TotalFilesProcessed>" + summaryObj.getTotalScriptFilesProcessed() + "</TotalFilesProcessed>");
+      cWriter.println("  <TotalQueriesProcessed>" + summaryObj.getTotalSQLsProcessed() + "</TotalQueriesProcessed>");
+      cWriter.println("  <TotalErrors>" + summaryObj.getTotalSQLErrors() + "</TotalErrors>");
+      cWriter.println("  <TotalWarnings>" + summaryObj.getTotalSQLWarnings() + "</TotalWarnings>");
+      cWriter.println("  <TotalSuccesses>" + summaryObj.getTotalSQLSuccess() + "</TotalSuccesses>");
+      cWriter.println("  <TotalConnections>" + summaryObj.getTotalConnections() + "</TotalConnections>");
+      cWriter.println("  <TotalConnectionFailures>" + summaryObj.getTotalConnectionFailures() + "</TotalConnectionFailures>");
+      if (sessObj.isSessionTimingOn())
+         cWriter.println("  <ElapsedTime>" + elapsedTime.trim() + "</ElapsedTime>");
+      cWriter.println("</Summary>");
+      
+      //reset _initDone to false since it is automatically set to true in this.init();
+      _initDone = false;
+   }
+
+   public void handlePrunSummary(FileWriter fWriter, PrunSummary summaryObj, String summaryEnd, String elapsedTime) throws IOException
+   {
+
+      fWriter.writeln(_beginCdataTag + "PARALLELRUN(PRUN) SUMMARY" + _endCdataTag);
+      fWriter.writeln("<Summary>");
+      fWriter.writeln("  <TotalFilesPresent>" + summaryObj.getTotalScriptFiles() + "</TotalFilesPresent>");
+      fWriter.writeln("  <TotalFilesProcessed>" + summaryObj.getTotalScriptFilesProcessed() + "</TotalFilesProcessed>");
+      fWriter.writeln("  <TotalQueriesProcessed>" + summaryObj.getTotalSQLsProcessed() + "</TotalQueriesProcessed>");
+      fWriter.writeln("  <TotalErrors>" + summaryObj.getTotalSQLErrors() + "</TotalErrors>");
+      fWriter.writeln("  <TotalWarnings>" + summaryObj.getTotalSQLWarnings() + "</TotalWarnings>");
+      fWriter.writeln("  <TotalSuccesses>" + summaryObj.getTotalSQLSuccess() + "</TotalSuccesses>");
+      fWriter.writeln("  <TotalConnections>" + summaryObj.getTotalConnections() + "</TotalConnections>");
+      fWriter.writeln("  <TotalConnectionFailures>" + summaryObj.getTotalConnectionFailures() + "</TotalConnectionFailures>");
+      fWriter.writeln("</Summary>");
+      fWriter.writeln(_beginCdataTag + summaryEnd + _endCdataTag);
+      if (sessObj.isSessionTimingOn())
+         fWriter.writeln(_beginCdataTag + elapsedTime.trim() + _endCdataTag);
+      fWriter.writeln(_endRootTag);
+      this._initDone = false;
+   }
+
+   public void handleQryExecutionTime(String qryExecTime)  throws IOException
+   {
+
+      if (!_initDone)
+      {
+         this.init();
+         this.handleStartTags();
+         //_initDone = true;
+      }
+      writer.write(_beginExecutionTimeTag + _beginCdataTag + qryExecTime +  _endCdataTag + _endExecutionTimeTag +SessionDefaults.lineSeperator);
+   }
+
+   public String checkColumnNames(String colHeader)
+   {
+      String colName = null;
+      String xmlColHeader = colHeader;
+      if (xmlColHeader.startsWith("(", 0) && xmlColHeader.endsWith(")"))
+         colName = xmlColHeader.substring(1, xmlColHeader.length()-1);
+      else
+         colName = colHeader;
+      return colName;
+   }
+   
+   public void printGetStatsOutput(String line) throws IOException
+   {
+      int i=0;
+      String columnNameTag = "";
+      String columnData = null;
+      
+      if (line.trim().equals(""))
+            return;
+      
+      if (line.startsWith("Table Name") || line.startsWith("Id"))
+      {
+         writer.writeln(" " + _beginCdataTag); 
+         writer.writeln(" " + line); 
+         perTableStats = true;
+         return;
+      }
+      String outputArr[] = line.split(" ");
+      for (i=0;i<outputArr.length; i++)
+      {
+         if (!outputArr[i].matches("^(\\-[0-9]|[0-9]|\\\\|NONE|CLOSE|SQL_|MX|PERTABLE|ACCUMULATED|PROGRESS|DEFAULT|OPERATOR|DEALLOCATED|select).*"))
+            columnNameTag += outputArr[i];
+         else
+            break;
+      }
+
+      for (int j=Math.max(0,(i-1));j<outputArr.length; j++)
+      {
+         if (!outputArr[j].trim().equals(""))
+         {
+            if (columnData == null)
+               columnData = outputArr[j];
+            else
+               columnData+=" " + outputArr[j];
+         }
+      }
+      
+      String xmlColTag = "Missing_tag"; 
+      if (null != columnNameTag && 0 < columnNameTag.length())
+         xmlColTag = checkColumnNames(columnNameTag);
+
+      if (columnData!= null)
+         writer.write("<"+xmlColTag+">"+utilObj.formatXMLdata(columnData.trim())+"</"+xmlColTag+">");
+      
+   }
+   
+   
+   
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/help/common_common.help
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/help/common_common.help b/core/conn/trafci/src/main/java/org/trafodion/ci/help/common_common.help
new file mode 100644
index 0000000..697cc3e
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/help/common_common.help
@@ -0,0 +1,457 @@
+// @@@ 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 @@@
+
+ @@@@@HELP
+
+   The command interface supports these commands:
+
+    @           LOG                     SHOW ALIAS
+    ALIAS       OBEY                    SHOW ALIASES
+    CLEAR       QUIT                    SHOW COLSEP
+    CONNECT     RECONNECT               SHOW ERRORCODE
+    DELAY       REPEAT                  SHOW HISTOPT
+    DISCONNECT  RESET LASTERROR         SHOW IDLETIMEOUT
+    ENV         SAVEHIST                SHOW LASTERROR
+    EXIT        SESSION (SHOW SESSION)  SHOW MARKUP
+                SET COLSEP              SHOW REMOTEPROCESS
+    FC          SET CONNECTOPT ROLE     SHOW ROLE                    
+    GOTO        SET HISTOPT             SHOW SESSION
+    HELP        SET IDLETIMEOUT         SHOW TIME    
+    HISTORY     SET MARKUP              SHOW TIMING
+    IF...THEN   SET PROMPT              SPOOL   
+    LABEL       SET TIME                VERSION
+    LOCALHOST   SET TIMING                    
+              
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET
+
+   The command interface supports these SET commands:
+
+    SET COLSEP           SET IDLETIMEOUT  SET TIME    
+    SET CONNECTOPT ROLE  SET MARKUP       SET TIMING  
+    SET HISTOPT          SET PROMPT                   
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW
+
+   The command interface supports these SHOW commands:
+
+    SHOW ALIAS      SHOW IDLETIMEOUT   SHOW SESSION   
+    SHOW ALIASES    SHOW LASTERROR     SHOW TIME      
+    SHOW COLSEP     SHOW MARKUP        SHOW TIMING    
+    SHOW ERRORCODE  SHOW REMOTEPROCESS           
+    SHOW HISTOPT    SHOW ROLE                       
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@@
+
+   The @ command executes the SQL statements and interface commands contained
+   in a specified script file. The @ command is executed the same as the OBEY
+   command.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@ALIAS
+
+   The ALIAS command allows you to map a string to any interface or SQL
+   command. The syntax of the interface or SQL command is checked only on
+   execution of the mapped string. This command replaces only the first token
+   of a command string, which allows the rest of the tokens to be treated as
+   parameters.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@CLEAR
+
+   The CLEAR command clears the interface window so that only the prompt
+   appears at the top of the window. CLEAR does not clear the log file or
+   reset the settings of the session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@CONNECT
+
+   The CONNECT command creates a new connection to the Trafodion platform from
+   the current or existing Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@DELAY
+
+   The DELAY command allows the Command Interface session to be in sleep
+   mode for the specified interval.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@DISCONNECT
+
+   The DISCONNECT command terminates the connection from the Trafodion
+   platform, not from the Command Interface.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@ENV
+
+   ENV displays attributes of the current Command Interface session. You
+   can also use the SESSION and SHOW SESSION commands to perform the same
+   function.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@EXIT
+
+   The EXIT command disconnects from and exits the Command Interface.
+   EXIT can return a status code. If no status code is specified, zero is
+   returned by default. In addition, a conditional statement can be appended
+   to the command.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@FC
+
+   The FC command allows you to edit and reissue a command in the history
+   buffer of a Command Interface session. You can display the commands
+   in the history buffer by using the HISTORY command.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@GOTO
+
+   The GOTO command allows you to jump to a designated point in the command
+   history. The point in the command history is designated by a LABEL
+   command. All commands executed after a GOTO statement are ignored until
+   the specified label is set. To set a label, use the LABEL command.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@HISTORY
+
+   The HISTORY command displays recently executed commands, identifying each
+   command by a number that you can use to reexecute or edit the command.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@IF...THEN
+
+   IF...THEN statements allow for the conditional execution of actions. If
+   the condition is met, the action is executed; otherwise, no action is
+   taken.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@LABEL
+
+   The LABEL command marks a point in the command history that you can jump
+   to by using the GOTO command.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@LOCALHOST
+
+   The LOCALHOST command allows you to execute client machine commands.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@LOG
+
+   The LOG command logs the entered commands and their output from the
+   Command Interface to a log file. If this is an obey script file, then
+   the command text from the obey script file is shown on the console.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@MODE
+
+   This command is no longer supported in TRAFCI.
+
+ @@@@@OBEY
+
+   The OBEY command executes the SQL statements and interface commands of a
+   specified script file or an entire directory. This command accepts a
+   single filename or a filename with a wild-card pattern specified.
+   Executing the OBEY command without optional parameters prompts you to
+   enter a filename. If a filename is not specified, then *.sql is used.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@QUIT
+
+   The QUIT command disconnects from and exits the Command Interface.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@RECONNECT
+
+   The RECONNECT command creates a new connection to the Trafodion platform
+   using the login credentials of the last successful connection.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@REPEAT
+
+   The REPEAT command reexecutes a previous command.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@RESET LASTERROR
+
+   The RESET LASTERROR command resets the last error code to 0.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SAVEHIST
+
+   The SAVEHIST command saves the session history in a user-specified file.
+   The session history consists of a list of the commands that were executed
+   in the Command Interface session before the SAVEHIST command.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET COLSEP
+
+   The SET COLSEP command sets the column separator and allows you to control
+   the formatting of the result displayed for SQL queries. The SET COLSEP
+   command specifies a delimiter value to use for separating columns in each
+   row of the results. The default delimiter is " "(white space).
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET CONNECTOPT ROLE
+
+   The SET CONNECTOPT ROLE command changes the role during a Command Interface 
+   session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET HISTOPT
+
+   The SET HISTOPT command sets the history option and controls how commands
+   are added to the history buffer. By default, commands within a script file
+   are not added to history. If the history option is set to "ALL," all the
+   commands in the script file are added to the history buffer. If no options
+   are specified, DEFAULT is used.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET IDLETIMEOUT
+
+   The SET IDLETIMEOUT command sets the idle timeout value for the current
+   session. The idle timeout value of a session determines when the session
+   expires after a period of inactivity. The default is 30 minutes.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET MARKUP
+
+   The SET MARKUP command sets the markup format and controls how results are
+   displayed by the Command Interface.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET PROMPT
+
+   The SET PROMPT command sets the prompt of the current session to a
+   specified string and/or to the session variables, which start with %. The
+   default prompt is SQL> in SQL mode.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET TIME
+
+   The SET TIME command causes the local time of the client workstation to be
+   displayed as part of the interface prompt. By default, the local time is
+   not displayed in the interface prompt.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET TIMING
+
+   The SET TIMING command causes the elapsed time to be displayed after each
+   SQL statement executes. This command does not cause the elapsed time of
+   interface commands to be displayed. By default, the elapsed time is off.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW ALIAS
+
+   The SHOW ALIAS command displays all or a set of aliases available in the
+   current Command Interface session. If a pattern is specified, all aliases
+   matching the pattern are displayed. By default, all aliases in the current
+   session are displayed.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW ALIASES
+
+   The SHOW ALIASES command displays all the aliases available in the current
+   Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW COLSEP
+
+   The SHOW COLSEP command displays the value of the column separator for the
+   current Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW ERRORCODE
+
+   The SHOW ERRORCODE command is an alias for the SHOW LASTERROR command.
+   ERRORCODE is an alias for LASTERROR.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW HISTOPT
+
+   The SHOW HISTOPT command displays the value that has been set for the
+   history option.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW IDLETIMEOUT
+
+   The SHOW IDLETIMEOUT command displays the idle timeout value of the
+   current Command Interface session. The idle timeout value of a session
+   determines when the session expires after a period of inactivity.
+   The default is 30 minutes.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW LASTERROR
+
+   The SHOW LASTERROR command displays the error of the last SQL statement
+   that was executed. If the query was successful, 0 is returned; otherwise
+   an SQL error code is returned.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW MARKUP
+
+   The SHOW MARKUP command displays the value set for the markup option.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW MODE
+
+   This command is no longer supported in TRAFCI.
+
+ @@@@@SHOW REMOTEPROCESS
+ 
+   The SHOW REMOTEPROCESS command displays the process name of the DCS
+   server that is handling the current connection.
+   
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW ROLE
+
+   The SHOW ROLE command displays the role in which you are currently logged
+   on during an TRAFCI session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW SESSION & SESSION
+
+   SHOW SESSION or SESSION displays attributes of the current Command
+   Interface session. You can also use the ENV command to perform the
+   same function.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW TIME
+
+   The SHOW TIME command displays whether the setting for the local time in
+   the interface prompt is ON or OFF.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW TIMING
+
+   The SHOW TIMING command displays whether the setting for the elapsed time
+   is ON or OFF.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SPOOL
+
+   The SPOOL command logs the entered commands and their output from the
+   Command Interface to a log file.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@VERSION
+
+   The VERSION command displays the build versions of the Trafodion platform,
+   Trafodion Connectivity Services, Trafodion JDBC Type 4 Driver, and Command
+   Interface.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/help/help_file.idx
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/help/help_file.idx b/core/conn/trafci/src/main/java/org/trafodion/ci/help/help_file.idx
new file mode 100644
index 0000000..035ccbd
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/help/help_file.idx
@@ -0,0 +1,30 @@
+# @@@ 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 @@@
+
+###########################################################
+## This is the main index file for all other help files. ##
+###########################################################
+
+#Common Commands
+common:common = common_common_help.idx
+
+#Mode SQL
+sql:common = sql_common_help.idx


[09/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/FileReader.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/FileReader.java b/core/conn/trafci/src/org/trafodion/ci/FileReader.java
deleted file mode 100644
index bf4dcde..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/FileReader.java
+++ /dev/null
@@ -1,176 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-
-public class FileReader
-{
-   private BufferedReader br=null;
-   private String fileName=null;
-   private String line=null;
-   private boolean isSectionRead=false;
-//   private String sectionName=null;
-   String sectionLine=null;
-   private boolean isSectionLineRead=false;
-   Pattern sectionPat=null;
-   Matcher sectionMat=null;
-
-   FileReader()
-   {
-
-   }
-
-   public void initialize(String fileName) throws IOException
-   {
-      this.fileName=fileName;
-      java.io.FileReader fr=new java.io.FileReader(this.fileName);
-      this.br = new BufferedReader(fr);
-   }
-   
-   public void initializeStream(InputStream theStream, String clzName) throws IOException
-   {
-      this.fileName=clzName;
-      InputStreamReader ir= new InputStreamReader(theStream);
-      //dead code
-//      if (null == ir)
-//    	  throw new IOException("Unable to load stream from class '" + clzName + "' ");
-      this.br = new BufferedReader(ir);
-   }
-   
-
-   public String getLine() throws IOException
-   {
-      if (next(true))
-      {
-         return this.line;
-      }
-      else
-      {
-         return null;
-      }
-   }
-
-   public String getNonBlankLine() throws IOException
-   {
-      if (next(false))
-      {
-         return this.line;
-      }
-      else
-      {
-         return null;
-      }
-   }
-
-   public boolean next(boolean readBlanks) throws IOException
-   {
-
-      while (true)
-      {
-         // if section option is enabled , return the section line which was read already
-         // before reading the remaining lines from the file
-         if (this.isSectionRead && !this.isSectionLineRead)
-         {
-            line=this.sectionLine;
-            this.sectionLine=null;
-            this.isSectionLineRead=true;
-            return true;
-         }
-         line=this.br.readLine();
-         if (line == null)
-         {
-            return false;
-         }
-         else if (readBlanks)
-         {
-            return true;
-         }
-         else if (!line.trim().equals(""))
-         {
-            if (this.isSectionRead && line.trim().toUpperCase().startsWith("?SECTION"))
-            {
-               return false;
-            }
-            return true;
-         }
-      }
-   }
-
-   public String getFileName()
-   {
-      return this.fileName;
-   }
-
-   public void close() throws IOException
-   {
-      this.br.close();
-      this.br=null;
-   
-   }
-
-   public boolean isSectionRead()
-   {
-      return isSectionRead;
-   }
-
-   public void setSectionRead(boolean isSectionRead,String sectionName) throws IOException, ScriptSectionNotFound
-   {
-      if (isSectionRead && sectionName != null)
-      {
-         sectionPat=Pattern.compile("(?i)^\\s*\\?SECTION\\s+"+sectionName+"\\s*$");
-         seekToSection();
-//         this.sectionName=sectionName;
-         this.isSectionRead = isSectionRead;
-
-      }else
-      {
-//         this.sectionName=null;
-         this.isSectionRead = false;
-      }
-
-   }
-
-   private void seekToSection() throws IOException, ScriptSectionNotFound
-   {
-      String line=null;
-      while ((line=this.getNonBlankLine()) != null)
-      {
-         sectionMat=sectionPat.matcher(line);
-         if (sectionMat.find())
-         {
-            sectionLine=line;
-            //section found..
-            return;
-         }
-      }
-      throw new ScriptSectionNotFound();
-   }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/FileWriter.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/FileWriter.java b/core/conn/trafci/src/org/trafodion/ci/FileWriter.java
deleted file mode 100644
index 10c153f..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/FileWriter.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-
-public class FileWriter
-{
-   private BufferedWriter bw=null;
-   private boolean append=false;
-   private java.io.FileWriter fw=null;
-   FileWriter()
-   {
-
-   }
-
-   public void setAppend(boolean append)
-   {
-      this.append=append;
-   }
-
-   public void initialize(String fileName) throws IOException
-   {
-      fw=new java.io.FileWriter(fileName,append);
-      bw=new BufferedWriter(fw);
-   }
-
-   public void write(String line) throws IOException
-   {
-      if (line != null)
-      {
-         if (SessionDefaults.lineSeperator.equals(line))
-         {
-            writeln();
-         }
-         else
-         {
-            bw.write(line);
-         }
-         bw.flush();
-      }
-   }
-
-   public void writeln() throws IOException
-   {
-      bw.newLine();
-   }
-
-   public void writeln(String line) throws IOException
-   {
-      write(line);
-      writeln();
-   }
-
-   public void close() throws IOException
-   {
-      bw.close();
-      bw=null;
-      fw=null;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/HTMLDisplay.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/HTMLDisplay.java b/core/conn/trafci/src/org/trafodion/ci/HTMLDisplay.java
deleted file mode 100644
index 106d842..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/HTMLDisplay.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-public class HTMLDisplay implements IDisplay {
-
-	private Query qryObj;
-	private Writer writer=null;
-	private Session sessObj=null;
-	
-	public HTMLDisplay(Session sessObj)
-	{
-		if(sessObj!=null)
-		{
-			this.sessObj = sessObj;
-			this.writer=sessObj.getWriter();
-			this.qryObj=sessObj.getQuery();
-		}
-	}
-
-	public void output(OutputContents contents) throws IOException {
-		// TODO Auto-generated method stub
-		if(contents!=null)
-		{
-			this.writer=sessObj.getWriter();
-			this.qryObj=sessObj.getQuery();
-			//display header
-			ArrayList<OutputColumnAttribute> columns = contents.getColumns();
-			qryObj.setColCount(String.valueOf(columns.size()));
-			//display columns name
-			for(int i=0;i<columns.size();i++)
-			{
-				OutputColumnAttribute columnAttr = columns.get(i);
-				sessObj.getHtmlObj().processHtml(columnAttr.getDisplayFormatName());
-	            writer.writeln();
-			}
-			
-			ArrayList<ArrayList<String>> alRows = contents.getRows();
-			if(alRows!=null && alRows.size()>0)
-			{
-				for(int i=0;i<alRows.size();i++)
-				{
-					ArrayList<String> alRow = alRows.get(i);
-					if(alRow!=null && alRow.size()>0)
-					{
-						for(int j=0;j<alRow.size();j++)
-						{
-							sessObj.getHtmlObj().processHtml(alRow.get(j));
-				            writer.writeln();
-						}
-					}
-					
-				}
-			}
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/HTMLObject.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/HTMLObject.java b/core/conn/trafci/src/org/trafodion/ci/HTMLObject.java
deleted file mode 100644
index 79a53a0..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/HTMLObject.java
+++ /dev/null
@@ -1,628 +0,0 @@
-// @@@ 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 @@@
-/**
- *Class to display the Errors/Warnings/ResultSets/Status Messages in HTML format 
- */
-
-package org.trafodion.ci;
-
-import java.io.*;
-
-public class HTMLObject
-{
-
-//   private Parser parser = null;
-   private Query qryObj = null;
-   private Session sessObj = null;
-   private Writer writer = null;
-   private QueryUtils qryUtilObj = null;
-
-   String _beginHtmlTag  = "<HTML>";
-   String _endHtmlTag = "</HTML>";
-   String _beginBodyTag = "<BODY>";
-   String _endBodyTag = "</BODY>";
-   public String _beginTableTag = "<TABLE>";
-   public String _beginWarningsTableTag = "<TABLE border='2'>";
-   public String _endTableTag="</TABLE>";
-   String _beginRowTag="<tr>";
-   String _endRowTag="</tr>";
-   String _beginTblHeadTag="<th>";
-   String _beginTblDataTag="<td>";
-   String _beginTblDataColspanAttrTag="<td colspan=";
-   String _beginTblDataAlignTag="<td align=\"right\">";
-   String _endTblHeadTag="</th>";
-   String _endTblDataTag="</td>";
-   String _startCommentTag="<!-- ";
-   String _endCommentTag=" -->";
-   String _endAttributeTag=">";
-
-   String error_Id = "Error Id";
-   String error_Code = "Error Code";
-   String error_Msg = "Error Message";
-   
-   String message_Code = "Message Code";
-   String message_Msg = "Message Information";
-   
-   String warn_Id = "Warning Id";
-   String warn_Code = "Warning Code";
-   String warn_Msg = "Warning Message";
-   String statusMsg = "";
-
-   int rowCount = 0;
-   int colCount = 1;
-   int errorCount = 0;
-
-   boolean _startTags = false;
-   boolean _columnHeading = true;
-   boolean _initDone = false;
-   boolean perTableStats = false;
-
-   HTMLObject()
-   {
-   }
-
-   HTMLObject(Session sessObj)
-   {
-//      parser = new Parser();
-      this.sessObj = sessObj;
-      qryUtilObj = new QueryUtils();
-   }
-
-   public void init()
-   {
-      this.writer=sessObj.getWriter();
-      this.qryObj=sessObj.getQuery();
-   }
-
-   public void processHtml(String output) throws IOException
-   {
-
-      if (!_initDone)
-      {
-         this.init();
-         this.handleStartTags();
-         _initDone = true;
-      }
-
-      if (qryObj.getRowCount() != null)
-      {
-         if ((rowCount==0 && Integer.parseInt(qryObj.getRowCount())==0)  || ((rowCount-1) != Integer.parseInt(qryObj.getRowCount())))
-         {
-            this.handleStartTags();
-         }
-         if ( (qryObj.isTrimOut() && !qryUtilObj.isGetStatsCmd(qryObj)) || (perTableStats)) {
-            writer.writeln(_endCommentTag);
-            perTableStats = false;
-         }
-         if ((sessObj.isImplicitGetStatsQry()) && qryUtilObj.isGetStatsCmd(qryObj)) 
-         {
-            statusMsg = "";
-            sessObj.getDbQryObj().resetQryObj();
-            sessObj.setImplicitGetStatsQry(false);
-         }
-         else
-         {
-            statusMsg = sessObj.getLfProps().getStatus(qryObj);
-         }
-         if (!((output.equals("")) && statusMsg.equals("")))
-            writer.writeln(_startCommentTag + statusMsg + output+ _endCommentTag);
-
-         if (qryObj.getRsCount() > 0 && sessObj.isSPJRS())
-         {
-            writer.write(_endTableTag+SessionDefaults.lineSeperator);
-            _columnHeading = true;
-            rowCount = 0;
-         }
-         if (!sessObj.isSPJRS())
-            this.handleEndTags();
-         return;
-      }
-      if (sessObj.isInOutandRS() && qryObj.getRsCount() >= 0)
-      {
-         rowCount = 0;
-         colCount = 1;
-         _columnHeading = true;
-         qryObj.resetQueryText("SELECT *");
-         sessObj.setInOutandRS(false);
-      }
-
-      if (qryObj.isTrimOut())
-      {
-         if (qryUtilObj.isGetStatsCmd(qryObj) && !perTableStats)
-         {
-            if (!(output.trim().equals("")))
-               printGetStatsOutput(output.trim());
-         }
-         else
-         {
-            writer.write(output.trim());
-         }
-      }
-      else
-      {
-         if ((_columnHeading))
-         {  // Only for Column headers
-            if (colCount == 1)
-            {
-               if (sessObj.isSPJRS())
-                  writer.write(_beginTableTag+SessionDefaults.lineSeperator);
-               writer.write(_beginRowTag+SessionDefaults.lineSeperator);
-            }
-            writer.write("  "+_beginTblHeadTag+output.trim()+_endTblHeadTag);
-         }
-         else
-         {
-            if ((colCount == 1)) //Only for Column Data and not headers
-               writer.write(_beginRowTag+SessionDefaults.lineSeperator);
-            writer.write("  "+ _beginTblDataTag+output.trim()+_endTblDataTag);
-         }
-
-         if (qryObj.getColCount() != null)
-         {
-            colCount++;
-            if (colCount > Integer.parseInt(qryObj.getColCount()))
-            {
-               writer.write(SessionDefaults.lineSeperator+_endRowTag);
-               _columnHeading = false;
-               rowCount++;
-               colCount=1;
-            }
-         }
-      }
-   }
-   public void handleStartTags() throws IOException
-   {
-
-      if (!_startTags)
-      {
-         writer.write(_beginTableTag+SessionDefaults.lineSeperator);
-         _startTags = true;
-
-         if (sessObj.isSPJRS() && qryObj.getRowCount() == "0")
-            qryObj.resetQueryText(sessObj.getDbQryObj().qryText);
-
-         writer.writeln(_startCommentTag + sessObj.getQuery().getQueryText() + _endCommentTag);
-
-         if (sessObj.isSPJRS() && qryObj.getRsCount() > 0)
-         {
-            writer.write(_beginTableTag+SessionDefaults.lineSeperator);
-            qryObj.resetQueryText("SELECT *");
-         }
-
-         if (qryObj.isTrimOut() && !qryUtilObj.isGetStatsCmd(qryObj)) 
-            writer.writeln(_startCommentTag);
-      }
-   }
-
-   public void handleEndTags() throws IOException
-   {
-
-      if (!(sessObj.isImplicitGetStatsQry())) {
-      writer.write(_endTableTag+SessionDefaults.lineSeperator);
-      _startTags = false;
-      rowCount = 0;
-      _columnHeading = true;
-      errorCount = 0;
-      _initDone = false;
-      }
-   }
-
-   
-   
-   public void handleErrors(ErrorObject errorObj) throws IOException
-   {
-	   if (!_initDone)
-	   {
-	      this.init();
-	      _initDone = true;
-	   }
-	   
-	   if (errorObj.errorCode() == Parser.UNKNOWN_ERROR_CODE)
-	   { 
-		   writeServerMessage(errorObj);
-	   }
-	   else if(errorObj.errorType == 'I')
-		   writeInformational(errorObj);
-	   else if(errorObj.errorType == 'W')
-       {
-           handleWarnings(errorObj);
-       }
-	   else
-		   writeErrors(errorObj);
-   }
-  
-   public void writeServerMessage(ErrorObject errorObj) throws IOException
-   {
-      if (!_startTags)
-      {
-         this.handleStartTags();
-         writer.write(_beginRowTag+SessionDefaults.lineSeperator);
-         writer.write("  "+_beginTblHeadTag + this.message_Msg +_endTblHeadTag+ SessionDefaults.lineSeperator);
-         writer.write(_endRowTag+SessionDefaults.lineSeperator);
-      }
-
-      if (errorObj != null)
-      {
-          writer.write(_beginRowTag+SessionDefaults.lineSeperator);
-          //Escape "<" and ">" in the error message
-          writer.write("  "+ _beginTblDataTag + errorObj.errorMessage().replaceAll("<", "&lt;").replaceAll(">", "&gt;") + _endTblDataTag + SessionDefaults.lineSeperator);
-          writer.write(_endRowTag+SessionDefaults.lineSeperator);
-      }
-   }
-   
-   public void writeInformational(ErrorObject errorObj) throws IOException
-   {
-
-      if (!_startTags)
-      {
-         this.handleStartTags();
-         writer.write(_beginRowTag+SessionDefaults.lineSeperator);
-    //     writer.write("  "+_beginTblHeadTag + this.message_Code +_endTblHeadTag + SessionDefaults.lineSeperator);
-         writer.write("  "+_beginTblHeadTag + this.message_Msg +_endTblHeadTag+ SessionDefaults.lineSeperator);
-         writer.write(_endRowTag+SessionDefaults.lineSeperator);
-      }
-
-      if (errorObj != null)
-      {
-          writer.write(_beginRowTag+SessionDefaults.lineSeperator);
-          // For all informational message we are not displaying the errorCode
-    //      writer.write("  "+ _beginTblDataTag + errorObj.errorCode() + _endTblDataTag + SessionDefaults.lineSeperator);
-         
-          //Escape "<" and ">" in the error message
-          writer.write("  "+ _beginTblDataTag + errorObj.errorMessage().replaceAll("<", "&lt;").replaceAll(">", "&gt;") + _endTblDataTag + SessionDefaults.lineSeperator);
-          writer.write(_endRowTag+SessionDefaults.lineSeperator);
-      }
-   }
-
-   
-   public void writeErrors(ErrorObject errorObj) throws IOException
-   {
-      if (!_startTags)
-      {
-         this.handleStartTags();
-         writer.write(_beginRowTag+SessionDefaults.lineSeperator);
-         writer.write("  "+_beginTblHeadTag + this.error_Id +_endTblHeadTag + SessionDefaults.lineSeperator);
-         writer.write("  "+_beginTblHeadTag + this.error_Code +_endTblHeadTag + SessionDefaults.lineSeperator);
-         writer.write("  "+_beginTblHeadTag + this.error_Msg +_endTblHeadTag+ SessionDefaults.lineSeperator);
-         writer.write(_endRowTag+SessionDefaults.lineSeperator);
-      }
-
-      if (errorObj != null)
-      {
-          writer.write(_beginRowTag+SessionDefaults.lineSeperator);
-          writer.write("  "+ _beginTblDataTag + ++errorCount + _endTblDataTag + SessionDefaults.lineSeperator);
-          writer.write("  "+ _beginTblDataTag + errorObj.errorCode() + _endTblDataTag + SessionDefaults.lineSeperator);
-         
-          //Escape "<" and ">" in the error message
-          writer.write("  "+ _beginTblDataTag + errorObj.errorMessage().replaceAll("<", "&lt;").replaceAll(">", "&gt;") + _endTblDataTag + SessionDefaults.lineSeperator);
-          writer.write(_endRowTag+SessionDefaults.lineSeperator);
-      }
-   }
-
-
-   /**
-    *  Method to print the start of the warning list table for all warnings
-    *  encountered during a fetch operation. 
-    */
-   public void startFetchWarningListTable(int numCols)  throws IOException {
-
-      /*  Check if we need to do the initialization.  */
-      if (!_initDone) {
-         this.init();
-         _initDone = true;
-      }
-
-
-      /*  Check if we need to setup and create a table.  */
-      if (!_startTags)
-         this.handleStartTags();
-
-
-      /*  Get the current line seperator (CRLF).  */
-      String crlf = SessionDefaults.lineSeperator;
-
-
-      /*
-       *  Start a new row with a single cell spanning the entire table.
-       *  <tr><td colspan='n'> ... 
-       */
-      writer.write(_beginRowTag + crlf);
-      writer.write(_beginTblDataColspanAttrTag + "'" + numCols + "'" + 
-                   _endAttributeTag + crlf);
-
-
-      /*
-       *  And now start an inner table with all the warnings information.
-       *  <TABLE border="2">
-       *     <tr>
-       *        <th>Warning Id</th>
-       *        <th>Warning Code</th>
-       *        <th>Warning Message</th>
-       *     </tr>
-       */
-      writer.write("    " + _beginWarningsTableTag  + crlf);
-      writer.write("    " + _beginRowTag + crlf);
-      writer.write("        " + _beginTblHeadTag + this.warn_Id +
-                   _endTblHeadTag + crlf);
-      writer.write("        " + _beginTblHeadTag + this.warn_Code +
-                   _endTblHeadTag + crlf);
-      writer.write("        " + _beginTblHeadTag + this.warn_Msg +
-                   _endTblHeadTag + crlf);
-      writer.write("    " + _endRowTag + crlf);
-
-
-   }  /*  End of  startFetchWarningListTable  method.  */
-
-
-
-   /**
-    *  Method to end printing the warning list table for all warnings
-    *  encountered during a fetch operation. 
-    */
-   public void endFetchWarningListTable()  throws IOException {
-
-      /*  Get the current line seperator (CRLF).  */
-      String crlf = SessionDefaults.lineSeperator;
-
-      /*
-       *  First end the  inner table with all the warnings information.
-       *  <TABLE border="2">
-       *     <tr>
-       *        <th>Warning Id</th>
-       *        <th>Warning Code</th>
-       *        <th>Warning Message</th>
-       *     </tr>
-       *     ...
-       *  </table>
-       */
-      writer.write("    " + _endTableTag + crlf);
-
-
-      /*
-       *  End the cell and row for the warning list table. 
-       *  </td>
-       *  </tr>
-       */
-      writer.write(_endTblDataTag + crlf);
-      writer.write(_endRowTag + crlf);
-
-   }  /*  End of  endFetchWarningListTable  method.  */
-
-
-
-   /**
-    *  Method to print warnings encountered during a fetch operation. These 
-    *  warnings need to printed in a separate table within its own scope.
-    *  Oh, this whole xml/html markup piece is so very messy!! :^(
-    */
-   public void handleFetchWarnings(ErrorObject errorObj) 
-			throws IOException {
-
-      /*  Check if we need to do the initialization.  */
-      if (!_initDone) {
-         this.init();
-         _initDone = true;
-      }
-
-
-      /*  Check if we need to setup and create a table.  */
-      if (!_startTags)
-         this.handleStartTags();
-
-
-      if (null != errorObj) {
-         /*  Get the current line seperator (CRLF).  */
-         String crlf = SessionDefaults.lineSeperator;
-
-         /*  Print the warning information.  */
-         writer.write(_beginRowTag + crlf);
-         ++errorCount;
-         writer.write("  " + _beginTblDataTag + errorCount +
-                      _endTblDataTag + crlf);
-         writer.write("  " + _beginTblDataTag + errorObj.errorCode() +
-                      _endTblDataTag + crlf);
-
-         String msgtxt = errorObj.errorMessage().replaceAll("<", "&lt;").replaceAll(">", "&gt;");
-         writer.write("  " + _beginTblDataTag + msgtxt + _endTblDataTag + crlf);
-         writer.write(_endRowTag + crlf);
-      }
-
-   }   /*  End of  handleFetchWarnings  method.  */
-
-   public void handleWarnings(ErrorObject errorObj) throws IOException
-   {
-
-      if (!_initDone)
-      {
-         this.init();
-         _initDone = true;
-      }
-      if (!_startTags)
-      {
-         this.handleStartTags();
-         writer.write(_beginRowTag+SessionDefaults.lineSeperator);
-         writer.write("  "+_beginTblHeadTag + this.warn_Id +_endTblHeadTag + SessionDefaults.lineSeperator);
-         writer.write("  "+_beginTblHeadTag + this.warn_Code +_endTblHeadTag + SessionDefaults.lineSeperator);
-         writer.write("  "+_beginTblHeadTag + this.warn_Msg +_endTblHeadTag+ SessionDefaults.lineSeperator);
-
-         writer.write(_endRowTag + SessionDefaults.lineSeperator);
-     }
-
-      if (errorObj != null)
-      {
-         writer.write(_beginRowTag+SessionDefaults.lineSeperator);
-         writer.write("  "+ _beginTblDataTag + ++errorCount + _endTblDataTag + SessionDefaults.lineSeperator);
-         writer.write("  "+ _beginTblDataTag + errorObj.errorCode() + _endTblDataTag + SessionDefaults.lineSeperator);
-
-          String msgtxt = errorObj.errorMessage().replaceAll("<", "&lt;").replaceAll(">", "&gt;");
-          writer.write("  "+ _beginTblDataTag + msgtxt + _endTblDataTag + SessionDefaults.lineSeperator);
-         writer.write(_endRowTag + SessionDefaults.lineSeperator);
-
-      }
-   }
-
-   public void handlePrunSummary(ConsoleWriter cWriter, PrunSummary summaryObj, String elapsedTime) throws IOException
-   {
-      this.init();
-      this.handleStartTags();
-      cWriter.println(_startCommentTag);
-      cWriter.println(SessionDefaults.lineSeperator+"PARALLELRUN(PRUN) SUMMARY");
-      cWriter.println(_endCommentTag);
-      cWriter.println(_beginRowTag);
-      cWriter.println("  "+_beginTblHeadTag + "Total Files Present"+_endTblHeadTag);
-      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalScriptFiles() + _endTblDataTag);
-      cWriter.println(_endRowTag);
-      cWriter.println(_beginRowTag);
-      cWriter.println("  "+_beginTblHeadTag + "Total Files Processed"+_endTblHeadTag);
-      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalScriptFilesProcessed() + _endTblDataTag);
-      cWriter.println(_endRowTag);
-      cWriter.println(_beginRowTag);
-      cWriter.println("  "+_beginTblHeadTag + "Total Queries Processed"+_endTblHeadTag);
-      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalSQLsProcessed() + _endTblDataTag);
-      cWriter.println(_endRowTag);
-      cWriter.println(_beginRowTag);
-      cWriter.println("  "+_beginTblHeadTag + "Total Errors"+_endTblHeadTag);
-      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalSQLErrors() + _endTblDataTag);
-      cWriter.println(_endRowTag);
-      cWriter.println(_beginRowTag);
-      cWriter.println("  "+_beginTblHeadTag + "Total Warnings"+_endTblHeadTag);
-      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalSQLWarnings() + _endTblDataTag);
-      cWriter.println(_endRowTag);
-      cWriter.println(_beginRowTag);
-      cWriter.println("  "+_beginTblHeadTag + "Total Successes"+_endTblHeadTag);
-      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalSQLSuccess() + _endTblDataTag);
-      cWriter.println(_endRowTag);
-      cWriter.println(_beginRowTag);
-      cWriter.println("  "+_beginTblHeadTag + "Total Connections"+_endTblHeadTag);
-      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalConnections()  + _endTblDataTag);
-      cWriter.println(_endRowTag);
-      cWriter.println(_beginRowTag);
-      cWriter.println("  "+_beginTblHeadTag + "Total Connection Failures"+_endTblHeadTag);
-      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalConnectionFailures() + _endTblDataTag);
-      cWriter.println(_endRowTag);
-      if (sessObj.isSessionTimingOn())
-         cWriter.println(_startCommentTag + elapsedTime + _endCommentTag);
-   }
-
-   public void handlePrunSummary(FileWriter fWriter, PrunSummary summaryObj, String summaryEnd, String elapsedTime) throws IOException
-   {
-
-      fWriter.writeln(_startCommentTag + "PARALLELRUN(PRUN) SUMMARY" + _endCommentTag);
-      fWriter.writeln(_beginRowTag);
-      fWriter.writeln("  "+_beginTblHeadTag + "Total Files Present"+_endTblHeadTag);
-      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalScriptFiles() + _endTblDataTag);
-      fWriter.writeln(_endRowTag);
-      fWriter.writeln(_beginRowTag);
-      fWriter.writeln("  "+_beginTblHeadTag + "Total Files Processed"+_endTblHeadTag);
-      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalScriptFilesProcessed() + _endTblDataTag);
-      fWriter.writeln(_endRowTag);
-      fWriter.writeln(_beginRowTag);
-      fWriter.writeln("  "+_beginTblHeadTag + "Total Queries Processed"+_endTblHeadTag);
-      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalSQLsProcessed() + _endTblDataTag);
-      fWriter.writeln(_endRowTag);
-      fWriter.writeln(_beginRowTag);
-      fWriter.writeln("  "+_beginTblHeadTag + "Total Errors"+_endTblHeadTag);
-      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalSQLErrors() + _endTblDataTag);
-      fWriter.writeln(_endRowTag);
-      fWriter.writeln(_beginRowTag);
-      fWriter.writeln("  "+_beginTblHeadTag + "Total Warnings"+_endTblHeadTag);
-      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalSQLWarnings() + _endTblDataTag);
-      fWriter.writeln(_endRowTag);
-      fWriter.writeln(_beginRowTag);
-      fWriter.writeln("  "+_beginTblHeadTag + "Total Successes"+_endTblHeadTag);
-      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalSQLSuccess() + _endTblDataTag);
-      fWriter.writeln(_endRowTag);
-      fWriter.writeln(_beginRowTag);
-      fWriter.writeln("  "+_beginTblHeadTag + "Total Connections"+_endTblHeadTag);
-      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalConnections()  + _endTblDataTag);
-      fWriter.writeln(_endRowTag);
-      fWriter.writeln(_beginRowTag);
-      fWriter.writeln("  "+_beginTblHeadTag + "Total Connection Failures"+_endTblHeadTag);
-      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalConnectionFailures() + _endTblDataTag);
-      fWriter.writeln(_endRowTag);
-      fWriter.writeln(_startCommentTag + summaryEnd + _endCommentTag);
-      if (sessObj.isSessionTimingOn())
-         fWriter.writeln(_startCommentTag + elapsedTime + _endCommentTag);
-      fWriter.writeln(_endTableTag);
-      this._initDone = false;
-   }
-
-   public void handleQryExecutionTime(String qryExecTime)  throws IOException
-   {
-
-      if (!_initDone)
-      {
-         this.init();
-         this.handleStartTags();
-         _initDone = true;
-      }
-      writer.write(_startCommentTag + qryExecTime +  _endCommentTag +SessionDefaults.lineSeperator);
-   }
-   
-   public void printGetStatsOutput(String line) throws IOException
-   {
-      int i=0;
-      String columnNameTag = "";
-      String columnData = null;
-      
-      if (line.trim().equals(""))
-            return;
-      
-      if (line.startsWith("Table Name") || line.startsWith("Id"))
-      {
-         writer.writeln(" " + _startCommentTag); 
-         writer.writeln(" " + line); 
-         perTableStats = true;
-         return;
-      }
-      String outputArr[] = line.split(" ");
-      for (i=0;i<outputArr.length; i++)
-      {
-    	 if (sessObj.isDebugOn())
-    	  System.out.println("****outputArr["+i+"]::" + outputArr[i]);
-         if (!outputArr[i].matches("^(\\-[0-9]|[0-9]|\\\\|NONE|CLOSE|SQL_|MX|PERTABLE|ACCUMULATED|PROGRESS|DEFAULT|OPERATOR|DEALLOCATED|select).*"))
-            columnNameTag += outputArr[i];
-         else
-            break;
-      }
-      if (sessObj.isDebugOn()) {
-    	  System.out.println("***i:"+i);
-    	  System.out.println("***outputArr.length:"+outputArr.length);
-      }
-      for (int j=Math.max(0,(i-1));j<outputArr.length; j++)
-      {
-         if (!outputArr[j].trim().equals(""))
-         {
-            if (columnData == null)
-               columnData = outputArr[j].trim();
-            else
-               columnData+=" " + outputArr[j].trim();
-         }
-      }
-      writer.writeln(_beginRowTag);
-      writer.writeln("  "+ _beginTblHeadTag + columnNameTag + _endTblHeadTag);
-      writer.writeln("  "+ _beginTblDataTag + columnData + _endTblDataTag);
-      writer.write(_endRowTag);
-      
-      
-   }
-   
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/HelpIndexer.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/HelpIndexer.java b/core/conn/trafci/src/org/trafodion/ci/HelpIndexer.java
deleted file mode 100644
index 2b0123f..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/HelpIndexer.java
+++ /dev/null
@@ -1,134 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-
-
-// Creates index file for help utility
-// help index file will contain the format of
-// <helpKeyWord>=<helpFileName>:<byteLocation>
-// helpKeyWord - the keyword for example, for obey command the key is obey
-// helpFileName - Actual help file name where the help text for the given command is available
-// byteLocation - the actual byte location where the help for the given command starts
-// this program is called during the build time
-
-public class HelpIndexer
-{
-
-   final static String helpIdxKeyIdentifier=" @@@@@";
-   final static String HELPER_IDX_FILE="_help.idx";
-   
-   /*The following modes and roles used tp create the list of 
-   /*potential '.help' file names.*/
-   final static String[] modes={"SQL","NS","NS-WMS","COMMON"};
-   final static String[] roles={"super","services", "mgr", "dba", "user","common"};
-   
-   HelpIndexer()
-   {
-
-   }
-
-   public static void main(String[] args)
-   {
-      try
-      { 
-         //for each mode create an index file
-         for (int i=0;i<modes.length;i++)
-         {
-             for (int j=0;j<roles.length;j++)
-             {
-                 createIndexFile(modes[i],roles[j],args[0]);
-             }
-         }
-      } catch (IOException e)
-      {
-         // TODO Auto-generated catch block
-         e.printStackTrace();
-      }
-   }
-
-   private static void createIndexFile(String mode,String role,String helpFilesDir) throws IOException
-   {
-      mode=mode.toLowerCase()+"_";
-      role=role.toLowerCase();
-
-      File helpfiles= new File(helpFilesDir);
-      String[] hfiles=helpfiles.list();
-
-      RandomAccessFile fr=null;
-      for (int i=0;i < hfiles.length ; i++)
-      {
-         String filename=hfiles[i];
-
-         //process files with the extension .help
-         // files with common_ prefix defines the commands which are applicable to all modes
-         // so each individual mode help files should have a reference to the mode specified commands and common commands
-         if (!filename.endsWith(".help") || !filename.startsWith(mode))
-         {
-            continue;
-         }
-         if(!filename.startsWith(role, filename.indexOf("_")+1))
-         {
-        	 continue;
-         }
-         //Rename role to match file name. This allows for multiple help files for each mode/role. 
-         role=filename.substring(filename.indexOf("_")+1,filename.indexOf("."));
-         //Create and initialize Index File
-         FileWriter fw=new FileWriter();
-         fw.initialize(helpFilesDir+File.separator+mode+role+HELPER_IDX_FILE);
-         
-         fr=new RandomAccessFile(helpFilesDir+File.separator+filename,"r");
-         String currentLine=null;
-         while ((currentLine=fr.readLine()) != null)
-         {
-            if (currentLine.startsWith(helpIdxKeyIdentifier))
-            {
-               currentLine=currentLine.substring(helpIdxKeyIdentifier.length()).trim();
-               //currentLine=currentLine.replaceAll(" ","\\\\ ");
-               String[] commandsList=currentLine.split("&");
-               for (int cnt=0; cnt < commandsList.length;cnt++)
-               {
-                  commandsList[cnt]=commandsList[cnt].trim().toLowerCase().replaceAll(" ","\\\\ ");
-                  fw.writeln(commandsList[cnt].trim().toLowerCase()+"="+filename+":"+fr.getFilePointer());
-               }
-            }
-            if (currentLine.replaceAll("\\s*$","").length() > 80)
-            {
-               System.out.println("ERROR: help text line exceeded 80 chars. FileName: "+filename+"\tText line: "+currentLine);
-            }
-         }
-
-         fr.close();
-         fr=null;
-
-         if (fw != null)
-         {
-            fw.close();
-            fw=null;
-         }
-      }
-   }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Helper.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Helper.java b/core/conn/trafci/src/org/trafodion/ci/Helper.java
deleted file mode 100644
index e479f3c..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Helper.java
+++ /dev/null
@@ -1,225 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.ListIterator;
-
-// Helper class to display help text for dbScripts commands
-// This class reads the index file for filename and byte position
-// of the given command in the help files and then reads only portion
-// of the text from the help file that needs to be displayed to the user
-
-public class Helper {
-   final String HELP_FILES_BASE_DIR=SessionDefaults.PKG_NAME + "help/";
-   final String HELP_FILE_IDX = "help_file.idx";
-   final String NO_HELP_TEXT="Help not available in ";
-   final String NO_HELP_FOR_CMD="No help available for this command.";
-   final String HELP_KEYWORD_INDICATOR=" @@@@@";
-   final String HELP_COMMENT_INDICATOR="#";
-   final String FILENAME_SEPERATOR = ",";
-   final String COMMON_KEYWORD_INDICATOR="common";
-   final Pattern hfiPattern = Pattern.compile("\\s*(\\w*)\\s*:\\s*(\\w*)\\s*=(.*)");
-
-   String helpFileName=null;
-   long helpLocInBytes=0;
-
-   List<String> helpFileList = new ArrayList<String>();
-   Properties helpIdxProps=null;
-   Helper()
-   {
-   }
-
-   public void printHelpText(Writer writer,String mode,String role, String command,String section) throws IOException
-   {
-      boolean isSectionRead=false;
-      if (section != null)
-      {
-         isSectionRead=true;
-      }
-
-      // Load the help index file as property if the help index property is empty
-      //if (helpFileList.size() != 0)
-      //{
-      try
-         {
-            loadFileIdx(mode, role);
-         }catch (FileNotFoundException fnfe)
-         {
-            writer.writeln();
-            writer.writeln(NO_HELP_TEXT+mode.toUpperCase()+" mode.");
-            return;
-         }
-      //}
-      //If no help files associated with this mode/role
-      if (helpFileList.size()==0)
-      {
-         writer.writeln();
-         writer.writeln(NO_HELP_TEXT+mode.toUpperCase()+" mode.");
-         return;
-      }
-
-      // help keys in index file are stored in lower case
-      // so convert the command to lower case before checking
-      // the property file.
-      command=command.toLowerCase().trim();
-
-      if (command.equals(""))
-      {
-         command="help";
-      }
-
-      String helpKeyValue=null;
-     
-      command=command.replaceAll("\\s+"," ");
-      ListIterator<String> listItr = helpFileList.listIterator();
-      boolean matchFound = false;
-      //Look in each index file for the requested command. First in, first searched.
-      while(listItr.hasNext())
-      {
-         Properties commProp = loadPropertyIdx((String)listItr.next());
-         helpKeyValue = (null != commProp) ? commProp.getProperty(command): null;
-     
-         if (helpKeyValue  != null)    {   // index file is stored in the format of
-            // <helpKey>=<filename>:<location>
-            matchFound = true;
-            helpFileName=helpKeyValue.substring(0,helpKeyValue.indexOf(":"));
-            helpLocInBytes=Long.parseLong(helpKeyValue.substring((helpKeyValue.indexOf(":")+1)));
-      
-            InputStream is=this.getClass().getResourceAsStream(HELP_FILES_BASE_DIR+helpFileName);
-            if(null == is)
-            {
-          	  writer.writeln();
-                writer.writeln(NO_HELP_TEXT+mode.toUpperCase()+" mode.");
-                return;
-            }
-      
-            InputStreamReader isr=new InputStreamReader(is);
-            BufferedReader br= new BufferedReader(isr);
-            String currentLine=null;
-            br.skip(helpLocInBytes);
-      
-            // Read all text available till the end of file
-            // or till the next command in the help file
-      
-            while ((currentLine=br.readLine()) != null)
-            {
-               if (currentLine.startsWith(HELP_KEYWORD_INDICATOR))
-               {
-                  break;
-               }
-               if (isSectionRead)
-               {
-                  if (!currentLine.toUpperCase().startsWith(section.toUpperCase()))
-                  {
-                     continue;
-                  }
-                  isSectionRead=false;
-               }
-               writer.writeln(currentLine.replaceAll("\\s*$",""));
-            }
-            is=null;
-            isr=null;
-            br=null;
-         }  
-      }
-      if (helpKeyValue  == null && !matchFound) { 
-         //If no entry exists for this command
-           writer.writeln();
-           writer.writeln(NO_HELP_FOR_CMD);
-       }
-   }
-
-   private void loadFileIdx(String mode, String role) throws FileNotFoundException,IOException
-   {
-	   String helpFileIndexContents = null;
-	   Matcher mat = null;
-	   InputStream hfIS=this.getClass().getResourceAsStream(HELP_FILES_BASE_DIR+HELP_FILE_IDX);
-	   //Check for valid stream
-	   if(null==hfIS)
-		   throw new FileNotFoundException();
-	   
-	   //Load the help-file index.
-	   BufferedReader input = new BufferedReader(new InputStreamReader(hfIS));
-	   
-	   //For each line in the index file check if the rule matches the current mode and role
-	   while ((helpFileIndexContents = input.readLine()) != null) {
-
-		   //Skip index file comments
-		   if(helpFileIndexContents.startsWith(HELP_COMMENT_INDICATOR))
-		   {continue;}
-
-		   mat = hfiPattern.matcher(helpFileIndexContents);
-		   //if the mode and role match the rule
-		   if (mat.find() && 
-				(mat.group(1).equalsIgnoreCase(mode) ||
-						mat.group(1).equalsIgnoreCase(COMMON_KEYWORD_INDICATOR)) &&
-				(mat.group(2).equalsIgnoreCase(role) || 
-						mat.group(2).equalsIgnoreCase(COMMON_KEYWORD_INDICATOR)))
-   	    	{
-               //add file-names to the help-file list.
-			   String[] fileNames = mat.group(3).split(FILENAME_SEPERATOR);
-			   for(int i = 0; i < fileNames.length; i++ ) {
-				   this.helpFileList.add(fileNames[i].trim());
-			   }              
-   	    	}
-        }
-        input.close();
-        hfIS.close();
-
-   }
-   
-   private Properties loadPropertyIdx(String fileName) throws FileNotFoundException, IOException
-   {
-	   try{
-	 	   InputStream is = null;
-	       //Assume the base directory and stream the indicated file
-	 	   is = this.getClass().getResourceAsStream(HELP_FILES_BASE_DIR+fileName);
-	 	   
-	       Properties helpIdxProp = new Properties();
-
-	       //If the file stream succeeded load the properties
-	       if (is != null)
-	       {
-	          helpIdxProp.load(is);
-	       } else
-	       {
-	    	  //otherwise, set properties to null. 
-	     	  helpIdxProp = null;
-	       }
-	       is=null;
-	       return helpIdxProp;
-	   
-	   } catch(Exception e) {
-		   return null;
-	   }
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/HostQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/HostQuery.java b/core/conn/trafci/src/org/trafodion/ci/HostQuery.java
deleted file mode 100644
index 117818e..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/HostQuery.java
+++ /dev/null
@@ -1,289 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-
-
-public class HostQuery extends Thread
-{
-
-
-   BufferedWriter bw=null;
-   boolean doneflag=false;
-   StringBuffer outputStr=null ;
-   StringBuffer errorStr=null;
-   boolean nextCommand=false;
-   boolean errorFlag=false;
-   boolean startInputThread=true;
-
-
-   HostQuery()
-   {
-      bw=null;
-      doneflag=false;
-      outputStr=new StringBuffer() ;
-      errorStr=new StringBuffer();
-      nextCommand=false;
-      errorFlag=false;
-   }
-
-   public void execute(String command,Reader reader, Writer writer)
-   {
-      Runtime rt=Runtime.getRuntime();
-      if (reader == null)
-      {
-         System.out.println("reader is null");
-      }
-      if (writer == null)
-      {
-         System.out.println("writer is null");
-      }
-      final String newLine=System.getProperty("line.separator");
-
-
-      try
-      {
-         final Process p=rt.exec(command);
-
-         InputStream is=null;
-         OutputStream os=null;
-         InputStream es=null;
-
-         is=p.getInputStream();
-         os=p.getOutputStream();
-         es=p.getErrorStream();
-
-         InputStreamReader isr=null;
-         InputStreamReader iser=null;
-         OutputStreamWriter osw=null;
-
-         isr=new InputStreamReader(is);
-         iser=new InputStreamReader(es);
-         osw=new OutputStreamWriter(os);
-
-         final BufferedReader br=new BufferedReader(isr);
-         final BufferedReader ber=new BufferedReader(iser);
-
-         bw=new BufferedWriter(osw);
-         //String tmpline=null;
-
-         // output thread
-         class OutputThread extends Thread
-         {
-            Writer writer;
-            OutputThread(Writer writer)
-            {
-               this.writer=writer;
-            }
-            public void run()
-            {
-               int i=0;
-               try
-               {
-                  while ((i=br.read()) != -1)
-                  {
-                     if (errorFlag)
-                     {
-                        Thread.yield();
-                        errorFlag=false;
-                        try
-                        {
-                           sleep(100);
-                        }
-                        catch (InterruptedException ie)
-                        {
-                        }
-                     }
-                     if (nextCommand)
-                     {
-                        br.readLine();
-                        nextCommand=false;
-                     }else
-                     {
-                        //System.out.print((char)i);
-                        writer.write(""+(char)i);
-                     }
-                  }
-                  doneflag=true;
-
-               }catch (IOException ote)
-               {
-                  System.out.println("output thread exception "+ote);
-               }
-
-            }
-         };
-
-         OutputThread outputt=new OutputThread(writer);
-         outputt.start();
-
-
-
-         // error thread
-         class ErrorThread extends Thread
-         {
-            Writer writer=null;
-            ErrorThread(Writer writer)
-            {
-               this.writer=writer;
-            }
-            public void run()
-            {
-               int i=0;
-               try
-               {
-                  while ((i=ber.read()) != -1)
-                  {
-                     errorFlag=true;
-                     //System.out.print((char)i);
-                     writer.write(""+(char)i);
-                  }
-               }catch (IOException ete)
-               {
-                  System.out.println("error thread exception "+ete);
-               }
-            }
-         };
-
-         ErrorThread errort=new ErrorThread(writer);
-         errort.start();
-
-         // input thread
-         class InputThread extends Thread
-         {
-            Reader reader=null;
-            InputThread(Reader reader)
-            {
-               this.reader=reader;
-            }
-            public void run()
-            {
-               String input=null;
-
-               try
-               {
-
-                  while (!doneflag)
-                  {
-                     if (doneflag) break;
-                     try
-                     {
-                        sleep(100);
-                     } catch (InterruptedException e)
-                     {
-                        break;
-                     }
-                     input=reader.getNonBlankLine();
-                     if (input != null)
-                     {
-
-                        try
-                        {
-                           //if the subprocess exited already..dont write anything to the pipe.
-                           p.exitValue();
-
-                           break;
-                        }catch (IllegalThreadStateException itse)
-                        {
-                        }
-
-                        nextCommand=true;
-                        bw.write(input+newLine);
-                        bw.flush();
-
-
-                     }
-
-                  }
-               } catch (UserInterruption ui)
-               {
-
-               }catch (IOException ite)
-               {
-                  System.out.println("input thread exception "+ite);
-               }
-            }
-
-         };
-
-         InputThread inpt=new InputThread(reader);
-
-         if (this.startInputThread)
-         {
-            inpt.start();
-         }
-
-         try
-         {
-            p.waitFor();
-            errort.join();
-            outputt.join();
-
-            if (this.startInputThread)
-            {
-               inpt.interrupt();
-               inpt.join();
-            }
-
-
-         } catch (InterruptedException e)
-         {
-            // TODO Auto-generated catch block
-            //.printStackTrace();
-         }
-
-
-
-         isr=null;
-         iser=null;
-         osw=null;
-         bw=null;
-         inpt=null;
-         outputt=null;
-         errort=null;
-         outputStr=null;
-         errorStr=null;
-
-      }
-      catch (IOException ioe)
-      {
-         try
-         {
-            writer.write("Could not create the sub process"+ioe);
-         } catch (IOException e)
-         {
-            // TODO Auto-generated catch block
-            //e.printStackTrace();
-         }
-      }
-
-
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/IDisplay.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/IDisplay.java b/core/conn/trafci/src/org/trafodion/ci/IDisplay.java
deleted file mode 100644
index f24b8bc..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/IDisplay.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.IOException;
-
-public interface IDisplay {
-	public void output(OutputContents contents) throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/IndexStruct.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/IndexStruct.java b/core/conn/trafci/src/org/trafodion/ci/IndexStruct.java
deleted file mode 100644
index 6cd1f63..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/IndexStruct.java
+++ /dev/null
@@ -1,55 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class IndexStruct {
-	private String indexName;
-	private String tableName;
-	private String tableType;
-
-	public IndexStruct(String indexName, String tableName, String tableType) {
-		super();
-		this.indexName = indexName;
-		this.tableName = tableName;
-		this.tableType = tableType;
-	}
-	public final String getTableType() {
-		return tableType;
-	}
-	public final void setTableType(String tableType) {
-		this.tableType = tableType;
-	}
-	public final String getIndexName() {
-		return indexName;
-	}
-
-	public final void setIndexName(String indexName) {
-		this.indexName = indexName;
-	}
-
-	public final String getTableName() {
-		return tableName;
-	}
-
-	public final void setTableName(String tableName) {
-		this.tableName = tableName;
-	}
-}


[19/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/HTMLObject.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/HTMLObject.java b/core/conn/trafci/src/main/java/org/trafodion/ci/HTMLObject.java
new file mode 100644
index 0000000..79a53a0
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/HTMLObject.java
@@ -0,0 +1,628 @@
+// @@@ 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 @@@
+/**
+ *Class to display the Errors/Warnings/ResultSets/Status Messages in HTML format 
+ */
+
+package org.trafodion.ci;
+
+import java.io.*;
+
+public class HTMLObject
+{
+
+//   private Parser parser = null;
+   private Query qryObj = null;
+   private Session sessObj = null;
+   private Writer writer = null;
+   private QueryUtils qryUtilObj = null;
+
+   String _beginHtmlTag  = "<HTML>";
+   String _endHtmlTag = "</HTML>";
+   String _beginBodyTag = "<BODY>";
+   String _endBodyTag = "</BODY>";
+   public String _beginTableTag = "<TABLE>";
+   public String _beginWarningsTableTag = "<TABLE border='2'>";
+   public String _endTableTag="</TABLE>";
+   String _beginRowTag="<tr>";
+   String _endRowTag="</tr>";
+   String _beginTblHeadTag="<th>";
+   String _beginTblDataTag="<td>";
+   String _beginTblDataColspanAttrTag="<td colspan=";
+   String _beginTblDataAlignTag="<td align=\"right\">";
+   String _endTblHeadTag="</th>";
+   String _endTblDataTag="</td>";
+   String _startCommentTag="<!-- ";
+   String _endCommentTag=" -->";
+   String _endAttributeTag=">";
+
+   String error_Id = "Error Id";
+   String error_Code = "Error Code";
+   String error_Msg = "Error Message";
+   
+   String message_Code = "Message Code";
+   String message_Msg = "Message Information";
+   
+   String warn_Id = "Warning Id";
+   String warn_Code = "Warning Code";
+   String warn_Msg = "Warning Message";
+   String statusMsg = "";
+
+   int rowCount = 0;
+   int colCount = 1;
+   int errorCount = 0;
+
+   boolean _startTags = false;
+   boolean _columnHeading = true;
+   boolean _initDone = false;
+   boolean perTableStats = false;
+
+   HTMLObject()
+   {
+   }
+
+   HTMLObject(Session sessObj)
+   {
+//      parser = new Parser();
+      this.sessObj = sessObj;
+      qryUtilObj = new QueryUtils();
+   }
+
+   public void init()
+   {
+      this.writer=sessObj.getWriter();
+      this.qryObj=sessObj.getQuery();
+   }
+
+   public void processHtml(String output) throws IOException
+   {
+
+      if (!_initDone)
+      {
+         this.init();
+         this.handleStartTags();
+         _initDone = true;
+      }
+
+      if (qryObj.getRowCount() != null)
+      {
+         if ((rowCount==0 && Integer.parseInt(qryObj.getRowCount())==0)  || ((rowCount-1) != Integer.parseInt(qryObj.getRowCount())))
+         {
+            this.handleStartTags();
+         }
+         if ( (qryObj.isTrimOut() && !qryUtilObj.isGetStatsCmd(qryObj)) || (perTableStats)) {
+            writer.writeln(_endCommentTag);
+            perTableStats = false;
+         }
+         if ((sessObj.isImplicitGetStatsQry()) && qryUtilObj.isGetStatsCmd(qryObj)) 
+         {
+            statusMsg = "";
+            sessObj.getDbQryObj().resetQryObj();
+            sessObj.setImplicitGetStatsQry(false);
+         }
+         else
+         {
+            statusMsg = sessObj.getLfProps().getStatus(qryObj);
+         }
+         if (!((output.equals("")) && statusMsg.equals("")))
+            writer.writeln(_startCommentTag + statusMsg + output+ _endCommentTag);
+
+         if (qryObj.getRsCount() > 0 && sessObj.isSPJRS())
+         {
+            writer.write(_endTableTag+SessionDefaults.lineSeperator);
+            _columnHeading = true;
+            rowCount = 0;
+         }
+         if (!sessObj.isSPJRS())
+            this.handleEndTags();
+         return;
+      }
+      if (sessObj.isInOutandRS() && qryObj.getRsCount() >= 0)
+      {
+         rowCount = 0;
+         colCount = 1;
+         _columnHeading = true;
+         qryObj.resetQueryText("SELECT *");
+         sessObj.setInOutandRS(false);
+      }
+
+      if (qryObj.isTrimOut())
+      {
+         if (qryUtilObj.isGetStatsCmd(qryObj) && !perTableStats)
+         {
+            if (!(output.trim().equals("")))
+               printGetStatsOutput(output.trim());
+         }
+         else
+         {
+            writer.write(output.trim());
+         }
+      }
+      else
+      {
+         if ((_columnHeading))
+         {  // Only for Column headers
+            if (colCount == 1)
+            {
+               if (sessObj.isSPJRS())
+                  writer.write(_beginTableTag+SessionDefaults.lineSeperator);
+               writer.write(_beginRowTag+SessionDefaults.lineSeperator);
+            }
+            writer.write("  "+_beginTblHeadTag+output.trim()+_endTblHeadTag);
+         }
+         else
+         {
+            if ((colCount == 1)) //Only for Column Data and not headers
+               writer.write(_beginRowTag+SessionDefaults.lineSeperator);
+            writer.write("  "+ _beginTblDataTag+output.trim()+_endTblDataTag);
+         }
+
+         if (qryObj.getColCount() != null)
+         {
+            colCount++;
+            if (colCount > Integer.parseInt(qryObj.getColCount()))
+            {
+               writer.write(SessionDefaults.lineSeperator+_endRowTag);
+               _columnHeading = false;
+               rowCount++;
+               colCount=1;
+            }
+         }
+      }
+   }
+   public void handleStartTags() throws IOException
+   {
+
+      if (!_startTags)
+      {
+         writer.write(_beginTableTag+SessionDefaults.lineSeperator);
+         _startTags = true;
+
+         if (sessObj.isSPJRS() && qryObj.getRowCount() == "0")
+            qryObj.resetQueryText(sessObj.getDbQryObj().qryText);
+
+         writer.writeln(_startCommentTag + sessObj.getQuery().getQueryText() + _endCommentTag);
+
+         if (sessObj.isSPJRS() && qryObj.getRsCount() > 0)
+         {
+            writer.write(_beginTableTag+SessionDefaults.lineSeperator);
+            qryObj.resetQueryText("SELECT *");
+         }
+
+         if (qryObj.isTrimOut() && !qryUtilObj.isGetStatsCmd(qryObj)) 
+            writer.writeln(_startCommentTag);
+      }
+   }
+
+   public void handleEndTags() throws IOException
+   {
+
+      if (!(sessObj.isImplicitGetStatsQry())) {
+      writer.write(_endTableTag+SessionDefaults.lineSeperator);
+      _startTags = false;
+      rowCount = 0;
+      _columnHeading = true;
+      errorCount = 0;
+      _initDone = false;
+      }
+   }
+
+   
+   
+   public void handleErrors(ErrorObject errorObj) throws IOException
+   {
+	   if (!_initDone)
+	   {
+	      this.init();
+	      _initDone = true;
+	   }
+	   
+	   if (errorObj.errorCode() == Parser.UNKNOWN_ERROR_CODE)
+	   { 
+		   writeServerMessage(errorObj);
+	   }
+	   else if(errorObj.errorType == 'I')
+		   writeInformational(errorObj);
+	   else if(errorObj.errorType == 'W')
+       {
+           handleWarnings(errorObj);
+       }
+	   else
+		   writeErrors(errorObj);
+   }
+  
+   public void writeServerMessage(ErrorObject errorObj) throws IOException
+   {
+      if (!_startTags)
+      {
+         this.handleStartTags();
+         writer.write(_beginRowTag+SessionDefaults.lineSeperator);
+         writer.write("  "+_beginTblHeadTag + this.message_Msg +_endTblHeadTag+ SessionDefaults.lineSeperator);
+         writer.write(_endRowTag+SessionDefaults.lineSeperator);
+      }
+
+      if (errorObj != null)
+      {
+          writer.write(_beginRowTag+SessionDefaults.lineSeperator);
+          //Escape "<" and ">" in the error message
+          writer.write("  "+ _beginTblDataTag + errorObj.errorMessage().replaceAll("<", "&lt;").replaceAll(">", "&gt;") + _endTblDataTag + SessionDefaults.lineSeperator);
+          writer.write(_endRowTag+SessionDefaults.lineSeperator);
+      }
+   }
+   
+   public void writeInformational(ErrorObject errorObj) throws IOException
+   {
+
+      if (!_startTags)
+      {
+         this.handleStartTags();
+         writer.write(_beginRowTag+SessionDefaults.lineSeperator);
+    //     writer.write("  "+_beginTblHeadTag + this.message_Code +_endTblHeadTag + SessionDefaults.lineSeperator);
+         writer.write("  "+_beginTblHeadTag + this.message_Msg +_endTblHeadTag+ SessionDefaults.lineSeperator);
+         writer.write(_endRowTag+SessionDefaults.lineSeperator);
+      }
+
+      if (errorObj != null)
+      {
+          writer.write(_beginRowTag+SessionDefaults.lineSeperator);
+          // For all informational message we are not displaying the errorCode
+    //      writer.write("  "+ _beginTblDataTag + errorObj.errorCode() + _endTblDataTag + SessionDefaults.lineSeperator);
+         
+          //Escape "<" and ">" in the error message
+          writer.write("  "+ _beginTblDataTag + errorObj.errorMessage().replaceAll("<", "&lt;").replaceAll(">", "&gt;") + _endTblDataTag + SessionDefaults.lineSeperator);
+          writer.write(_endRowTag+SessionDefaults.lineSeperator);
+      }
+   }
+
+   
+   public void writeErrors(ErrorObject errorObj) throws IOException
+   {
+      if (!_startTags)
+      {
+         this.handleStartTags();
+         writer.write(_beginRowTag+SessionDefaults.lineSeperator);
+         writer.write("  "+_beginTblHeadTag + this.error_Id +_endTblHeadTag + SessionDefaults.lineSeperator);
+         writer.write("  "+_beginTblHeadTag + this.error_Code +_endTblHeadTag + SessionDefaults.lineSeperator);
+         writer.write("  "+_beginTblHeadTag + this.error_Msg +_endTblHeadTag+ SessionDefaults.lineSeperator);
+         writer.write(_endRowTag+SessionDefaults.lineSeperator);
+      }
+
+      if (errorObj != null)
+      {
+          writer.write(_beginRowTag+SessionDefaults.lineSeperator);
+          writer.write("  "+ _beginTblDataTag + ++errorCount + _endTblDataTag + SessionDefaults.lineSeperator);
+          writer.write("  "+ _beginTblDataTag + errorObj.errorCode() + _endTblDataTag + SessionDefaults.lineSeperator);
+         
+          //Escape "<" and ">" in the error message
+          writer.write("  "+ _beginTblDataTag + errorObj.errorMessage().replaceAll("<", "&lt;").replaceAll(">", "&gt;") + _endTblDataTag + SessionDefaults.lineSeperator);
+          writer.write(_endRowTag+SessionDefaults.lineSeperator);
+      }
+   }
+
+
+   /**
+    *  Method to print the start of the warning list table for all warnings
+    *  encountered during a fetch operation. 
+    */
+   public void startFetchWarningListTable(int numCols)  throws IOException {
+
+      /*  Check if we need to do the initialization.  */
+      if (!_initDone) {
+         this.init();
+         _initDone = true;
+      }
+
+
+      /*  Check if we need to setup and create a table.  */
+      if (!_startTags)
+         this.handleStartTags();
+
+
+      /*  Get the current line seperator (CRLF).  */
+      String crlf = SessionDefaults.lineSeperator;
+
+
+      /*
+       *  Start a new row with a single cell spanning the entire table.
+       *  <tr><td colspan='n'> ... 
+       */
+      writer.write(_beginRowTag + crlf);
+      writer.write(_beginTblDataColspanAttrTag + "'" + numCols + "'" + 
+                   _endAttributeTag + crlf);
+
+
+      /*
+       *  And now start an inner table with all the warnings information.
+       *  <TABLE border="2">
+       *     <tr>
+       *        <th>Warning Id</th>
+       *        <th>Warning Code</th>
+       *        <th>Warning Message</th>
+       *     </tr>
+       */
+      writer.write("    " + _beginWarningsTableTag  + crlf);
+      writer.write("    " + _beginRowTag + crlf);
+      writer.write("        " + _beginTblHeadTag + this.warn_Id +
+                   _endTblHeadTag + crlf);
+      writer.write("        " + _beginTblHeadTag + this.warn_Code +
+                   _endTblHeadTag + crlf);
+      writer.write("        " + _beginTblHeadTag + this.warn_Msg +
+                   _endTblHeadTag + crlf);
+      writer.write("    " + _endRowTag + crlf);
+
+
+   }  /*  End of  startFetchWarningListTable  method.  */
+
+
+
+   /**
+    *  Method to end printing the warning list table for all warnings
+    *  encountered during a fetch operation. 
+    */
+   public void endFetchWarningListTable()  throws IOException {
+
+      /*  Get the current line seperator (CRLF).  */
+      String crlf = SessionDefaults.lineSeperator;
+
+      /*
+       *  First end the  inner table with all the warnings information.
+       *  <TABLE border="2">
+       *     <tr>
+       *        <th>Warning Id</th>
+       *        <th>Warning Code</th>
+       *        <th>Warning Message</th>
+       *     </tr>
+       *     ...
+       *  </table>
+       */
+      writer.write("    " + _endTableTag + crlf);
+
+
+      /*
+       *  End the cell and row for the warning list table. 
+       *  </td>
+       *  </tr>
+       */
+      writer.write(_endTblDataTag + crlf);
+      writer.write(_endRowTag + crlf);
+
+   }  /*  End of  endFetchWarningListTable  method.  */
+
+
+
+   /**
+    *  Method to print warnings encountered during a fetch operation. These 
+    *  warnings need to printed in a separate table within its own scope.
+    *  Oh, this whole xml/html markup piece is so very messy!! :^(
+    */
+   public void handleFetchWarnings(ErrorObject errorObj) 
+			throws IOException {
+
+      /*  Check if we need to do the initialization.  */
+      if (!_initDone) {
+         this.init();
+         _initDone = true;
+      }
+
+
+      /*  Check if we need to setup and create a table.  */
+      if (!_startTags)
+         this.handleStartTags();
+
+
+      if (null != errorObj) {
+         /*  Get the current line seperator (CRLF).  */
+         String crlf = SessionDefaults.lineSeperator;
+
+         /*  Print the warning information.  */
+         writer.write(_beginRowTag + crlf);
+         ++errorCount;
+         writer.write("  " + _beginTblDataTag + errorCount +
+                      _endTblDataTag + crlf);
+         writer.write("  " + _beginTblDataTag + errorObj.errorCode() +
+                      _endTblDataTag + crlf);
+
+         String msgtxt = errorObj.errorMessage().replaceAll("<", "&lt;").replaceAll(">", "&gt;");
+         writer.write("  " + _beginTblDataTag + msgtxt + _endTblDataTag + crlf);
+         writer.write(_endRowTag + crlf);
+      }
+
+   }   /*  End of  handleFetchWarnings  method.  */
+
+   public void handleWarnings(ErrorObject errorObj) throws IOException
+   {
+
+      if (!_initDone)
+      {
+         this.init();
+         _initDone = true;
+      }
+      if (!_startTags)
+      {
+         this.handleStartTags();
+         writer.write(_beginRowTag+SessionDefaults.lineSeperator);
+         writer.write("  "+_beginTblHeadTag + this.warn_Id +_endTblHeadTag + SessionDefaults.lineSeperator);
+         writer.write("  "+_beginTblHeadTag + this.warn_Code +_endTblHeadTag + SessionDefaults.lineSeperator);
+         writer.write("  "+_beginTblHeadTag + this.warn_Msg +_endTblHeadTag+ SessionDefaults.lineSeperator);
+
+         writer.write(_endRowTag + SessionDefaults.lineSeperator);
+     }
+
+      if (errorObj != null)
+      {
+         writer.write(_beginRowTag+SessionDefaults.lineSeperator);
+         writer.write("  "+ _beginTblDataTag + ++errorCount + _endTblDataTag + SessionDefaults.lineSeperator);
+         writer.write("  "+ _beginTblDataTag + errorObj.errorCode() + _endTblDataTag + SessionDefaults.lineSeperator);
+
+          String msgtxt = errorObj.errorMessage().replaceAll("<", "&lt;").replaceAll(">", "&gt;");
+          writer.write("  "+ _beginTblDataTag + msgtxt + _endTblDataTag + SessionDefaults.lineSeperator);
+         writer.write(_endRowTag + SessionDefaults.lineSeperator);
+
+      }
+   }
+
+   public void handlePrunSummary(ConsoleWriter cWriter, PrunSummary summaryObj, String elapsedTime) throws IOException
+   {
+      this.init();
+      this.handleStartTags();
+      cWriter.println(_startCommentTag);
+      cWriter.println(SessionDefaults.lineSeperator+"PARALLELRUN(PRUN) SUMMARY");
+      cWriter.println(_endCommentTag);
+      cWriter.println(_beginRowTag);
+      cWriter.println("  "+_beginTblHeadTag + "Total Files Present"+_endTblHeadTag);
+      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalScriptFiles() + _endTblDataTag);
+      cWriter.println(_endRowTag);
+      cWriter.println(_beginRowTag);
+      cWriter.println("  "+_beginTblHeadTag + "Total Files Processed"+_endTblHeadTag);
+      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalScriptFilesProcessed() + _endTblDataTag);
+      cWriter.println(_endRowTag);
+      cWriter.println(_beginRowTag);
+      cWriter.println("  "+_beginTblHeadTag + "Total Queries Processed"+_endTblHeadTag);
+      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalSQLsProcessed() + _endTblDataTag);
+      cWriter.println(_endRowTag);
+      cWriter.println(_beginRowTag);
+      cWriter.println("  "+_beginTblHeadTag + "Total Errors"+_endTblHeadTag);
+      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalSQLErrors() + _endTblDataTag);
+      cWriter.println(_endRowTag);
+      cWriter.println(_beginRowTag);
+      cWriter.println("  "+_beginTblHeadTag + "Total Warnings"+_endTblHeadTag);
+      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalSQLWarnings() + _endTblDataTag);
+      cWriter.println(_endRowTag);
+      cWriter.println(_beginRowTag);
+      cWriter.println("  "+_beginTblHeadTag + "Total Successes"+_endTblHeadTag);
+      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalSQLSuccess() + _endTblDataTag);
+      cWriter.println(_endRowTag);
+      cWriter.println(_beginRowTag);
+      cWriter.println("  "+_beginTblHeadTag + "Total Connections"+_endTblHeadTag);
+      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalConnections()  + _endTblDataTag);
+      cWriter.println(_endRowTag);
+      cWriter.println(_beginRowTag);
+      cWriter.println("  "+_beginTblHeadTag + "Total Connection Failures"+_endTblHeadTag);
+      cWriter.println("  "+ _beginTblDataTag + summaryObj.getTotalConnectionFailures() + _endTblDataTag);
+      cWriter.println(_endRowTag);
+      if (sessObj.isSessionTimingOn())
+         cWriter.println(_startCommentTag + elapsedTime + _endCommentTag);
+   }
+
+   public void handlePrunSummary(FileWriter fWriter, PrunSummary summaryObj, String summaryEnd, String elapsedTime) throws IOException
+   {
+
+      fWriter.writeln(_startCommentTag + "PARALLELRUN(PRUN) SUMMARY" + _endCommentTag);
+      fWriter.writeln(_beginRowTag);
+      fWriter.writeln("  "+_beginTblHeadTag + "Total Files Present"+_endTblHeadTag);
+      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalScriptFiles() + _endTblDataTag);
+      fWriter.writeln(_endRowTag);
+      fWriter.writeln(_beginRowTag);
+      fWriter.writeln("  "+_beginTblHeadTag + "Total Files Processed"+_endTblHeadTag);
+      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalScriptFilesProcessed() + _endTblDataTag);
+      fWriter.writeln(_endRowTag);
+      fWriter.writeln(_beginRowTag);
+      fWriter.writeln("  "+_beginTblHeadTag + "Total Queries Processed"+_endTblHeadTag);
+      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalSQLsProcessed() + _endTblDataTag);
+      fWriter.writeln(_endRowTag);
+      fWriter.writeln(_beginRowTag);
+      fWriter.writeln("  "+_beginTblHeadTag + "Total Errors"+_endTblHeadTag);
+      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalSQLErrors() + _endTblDataTag);
+      fWriter.writeln(_endRowTag);
+      fWriter.writeln(_beginRowTag);
+      fWriter.writeln("  "+_beginTblHeadTag + "Total Warnings"+_endTblHeadTag);
+      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalSQLWarnings() + _endTblDataTag);
+      fWriter.writeln(_endRowTag);
+      fWriter.writeln(_beginRowTag);
+      fWriter.writeln("  "+_beginTblHeadTag + "Total Successes"+_endTblHeadTag);
+      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalSQLSuccess() + _endTblDataTag);
+      fWriter.writeln(_endRowTag);
+      fWriter.writeln(_beginRowTag);
+      fWriter.writeln("  "+_beginTblHeadTag + "Total Connections"+_endTblHeadTag);
+      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalConnections()  + _endTblDataTag);
+      fWriter.writeln(_endRowTag);
+      fWriter.writeln(_beginRowTag);
+      fWriter.writeln("  "+_beginTblHeadTag + "Total Connection Failures"+_endTblHeadTag);
+      fWriter.writeln("  "+ _beginTblDataTag + summaryObj.getTotalConnectionFailures() + _endTblDataTag);
+      fWriter.writeln(_endRowTag);
+      fWriter.writeln(_startCommentTag + summaryEnd + _endCommentTag);
+      if (sessObj.isSessionTimingOn())
+         fWriter.writeln(_startCommentTag + elapsedTime + _endCommentTag);
+      fWriter.writeln(_endTableTag);
+      this._initDone = false;
+   }
+
+   public void handleQryExecutionTime(String qryExecTime)  throws IOException
+   {
+
+      if (!_initDone)
+      {
+         this.init();
+         this.handleStartTags();
+         _initDone = true;
+      }
+      writer.write(_startCommentTag + qryExecTime +  _endCommentTag +SessionDefaults.lineSeperator);
+   }
+   
+   public void printGetStatsOutput(String line) throws IOException
+   {
+      int i=0;
+      String columnNameTag = "";
+      String columnData = null;
+      
+      if (line.trim().equals(""))
+            return;
+      
+      if (line.startsWith("Table Name") || line.startsWith("Id"))
+      {
+         writer.writeln(" " + _startCommentTag); 
+         writer.writeln(" " + line); 
+         perTableStats = true;
+         return;
+      }
+      String outputArr[] = line.split(" ");
+      for (i=0;i<outputArr.length; i++)
+      {
+    	 if (sessObj.isDebugOn())
+    	  System.out.println("****outputArr["+i+"]::" + outputArr[i]);
+         if (!outputArr[i].matches("^(\\-[0-9]|[0-9]|\\\\|NONE|CLOSE|SQL_|MX|PERTABLE|ACCUMULATED|PROGRESS|DEFAULT|OPERATOR|DEALLOCATED|select).*"))
+            columnNameTag += outputArr[i];
+         else
+            break;
+      }
+      if (sessObj.isDebugOn()) {
+    	  System.out.println("***i:"+i);
+    	  System.out.println("***outputArr.length:"+outputArr.length);
+      }
+      for (int j=Math.max(0,(i-1));j<outputArr.length; j++)
+      {
+         if (!outputArr[j].trim().equals(""))
+         {
+            if (columnData == null)
+               columnData = outputArr[j].trim();
+            else
+               columnData+=" " + outputArr[j].trim();
+         }
+      }
+      writer.writeln(_beginRowTag);
+      writer.writeln("  "+ _beginTblHeadTag + columnNameTag + _endTblHeadTag);
+      writer.writeln("  "+ _beginTblDataTag + columnData + _endTblDataTag);
+      writer.write(_endRowTag);
+      
+      
+   }
+   
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/HelpIndexer.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/HelpIndexer.java b/core/conn/trafci/src/main/java/org/trafodion/ci/HelpIndexer.java
new file mode 100644
index 0000000..2b0123f
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/HelpIndexer.java
@@ -0,0 +1,134 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+
+// Creates index file for help utility
+// help index file will contain the format of
+// <helpKeyWord>=<helpFileName>:<byteLocation>
+// helpKeyWord - the keyword for example, for obey command the key is obey
+// helpFileName - Actual help file name where the help text for the given command is available
+// byteLocation - the actual byte location where the help for the given command starts
+// this program is called during the build time
+
+public class HelpIndexer
+{
+
+   final static String helpIdxKeyIdentifier=" @@@@@";
+   final static String HELPER_IDX_FILE="_help.idx";
+   
+   /*The following modes and roles used tp create the list of 
+   /*potential '.help' file names.*/
+   final static String[] modes={"SQL","NS","NS-WMS","COMMON"};
+   final static String[] roles={"super","services", "mgr", "dba", "user","common"};
+   
+   HelpIndexer()
+   {
+
+   }
+
+   public static void main(String[] args)
+   {
+      try
+      { 
+         //for each mode create an index file
+         for (int i=0;i<modes.length;i++)
+         {
+             for (int j=0;j<roles.length;j++)
+             {
+                 createIndexFile(modes[i],roles[j],args[0]);
+             }
+         }
+      } catch (IOException e)
+      {
+         // TODO Auto-generated catch block
+         e.printStackTrace();
+      }
+   }
+
+   private static void createIndexFile(String mode,String role,String helpFilesDir) throws IOException
+   {
+      mode=mode.toLowerCase()+"_";
+      role=role.toLowerCase();
+
+      File helpfiles= new File(helpFilesDir);
+      String[] hfiles=helpfiles.list();
+
+      RandomAccessFile fr=null;
+      for (int i=0;i < hfiles.length ; i++)
+      {
+         String filename=hfiles[i];
+
+         //process files with the extension .help
+         // files with common_ prefix defines the commands which are applicable to all modes
+         // so each individual mode help files should have a reference to the mode specified commands and common commands
+         if (!filename.endsWith(".help") || !filename.startsWith(mode))
+         {
+            continue;
+         }
+         if(!filename.startsWith(role, filename.indexOf("_")+1))
+         {
+        	 continue;
+         }
+         //Rename role to match file name. This allows for multiple help files for each mode/role. 
+         role=filename.substring(filename.indexOf("_")+1,filename.indexOf("."));
+         //Create and initialize Index File
+         FileWriter fw=new FileWriter();
+         fw.initialize(helpFilesDir+File.separator+mode+role+HELPER_IDX_FILE);
+         
+         fr=new RandomAccessFile(helpFilesDir+File.separator+filename,"r");
+         String currentLine=null;
+         while ((currentLine=fr.readLine()) != null)
+         {
+            if (currentLine.startsWith(helpIdxKeyIdentifier))
+            {
+               currentLine=currentLine.substring(helpIdxKeyIdentifier.length()).trim();
+               //currentLine=currentLine.replaceAll(" ","\\\\ ");
+               String[] commandsList=currentLine.split("&");
+               for (int cnt=0; cnt < commandsList.length;cnt++)
+               {
+                  commandsList[cnt]=commandsList[cnt].trim().toLowerCase().replaceAll(" ","\\\\ ");
+                  fw.writeln(commandsList[cnt].trim().toLowerCase()+"="+filename+":"+fr.getFilePointer());
+               }
+            }
+            if (currentLine.replaceAll("\\s*$","").length() > 80)
+            {
+               System.out.println("ERROR: help text line exceeded 80 chars. FileName: "+filename+"\tText line: "+currentLine);
+            }
+         }
+
+         fr.close();
+         fr=null;
+
+         if (fw != null)
+         {
+            fw.close();
+            fw=null;
+         }
+      }
+   }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Helper.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Helper.java b/core/conn/trafci/src/main/java/org/trafodion/ci/Helper.java
new file mode 100644
index 0000000..e479f3c
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Helper.java
@@ -0,0 +1,225 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.ListIterator;
+
+// Helper class to display help text for dbScripts commands
+// This class reads the index file for filename and byte position
+// of the given command in the help files and then reads only portion
+// of the text from the help file that needs to be displayed to the user
+
+public class Helper {
+   final String HELP_FILES_BASE_DIR=SessionDefaults.PKG_NAME + "help/";
+   final String HELP_FILE_IDX = "help_file.idx";
+   final String NO_HELP_TEXT="Help not available in ";
+   final String NO_HELP_FOR_CMD="No help available for this command.";
+   final String HELP_KEYWORD_INDICATOR=" @@@@@";
+   final String HELP_COMMENT_INDICATOR="#";
+   final String FILENAME_SEPERATOR = ",";
+   final String COMMON_KEYWORD_INDICATOR="common";
+   final Pattern hfiPattern = Pattern.compile("\\s*(\\w*)\\s*:\\s*(\\w*)\\s*=(.*)");
+
+   String helpFileName=null;
+   long helpLocInBytes=0;
+
+   List<String> helpFileList = new ArrayList<String>();
+   Properties helpIdxProps=null;
+   Helper()
+   {
+   }
+
+   public void printHelpText(Writer writer,String mode,String role, String command,String section) throws IOException
+   {
+      boolean isSectionRead=false;
+      if (section != null)
+      {
+         isSectionRead=true;
+      }
+
+      // Load the help index file as property if the help index property is empty
+      //if (helpFileList.size() != 0)
+      //{
+      try
+         {
+            loadFileIdx(mode, role);
+         }catch (FileNotFoundException fnfe)
+         {
+            writer.writeln();
+            writer.writeln(NO_HELP_TEXT+mode.toUpperCase()+" mode.");
+            return;
+         }
+      //}
+      //If no help files associated with this mode/role
+      if (helpFileList.size()==0)
+      {
+         writer.writeln();
+         writer.writeln(NO_HELP_TEXT+mode.toUpperCase()+" mode.");
+         return;
+      }
+
+      // help keys in index file are stored in lower case
+      // so convert the command to lower case before checking
+      // the property file.
+      command=command.toLowerCase().trim();
+
+      if (command.equals(""))
+      {
+         command="help";
+      }
+
+      String helpKeyValue=null;
+     
+      command=command.replaceAll("\\s+"," ");
+      ListIterator<String> listItr = helpFileList.listIterator();
+      boolean matchFound = false;
+      //Look in each index file for the requested command. First in, first searched.
+      while(listItr.hasNext())
+      {
+         Properties commProp = loadPropertyIdx((String)listItr.next());
+         helpKeyValue = (null != commProp) ? commProp.getProperty(command): null;
+     
+         if (helpKeyValue  != null)    {   // index file is stored in the format of
+            // <helpKey>=<filename>:<location>
+            matchFound = true;
+            helpFileName=helpKeyValue.substring(0,helpKeyValue.indexOf(":"));
+            helpLocInBytes=Long.parseLong(helpKeyValue.substring((helpKeyValue.indexOf(":")+1)));
+      
+            InputStream is=this.getClass().getResourceAsStream(HELP_FILES_BASE_DIR+helpFileName);
+            if(null == is)
+            {
+          	  writer.writeln();
+                writer.writeln(NO_HELP_TEXT+mode.toUpperCase()+" mode.");
+                return;
+            }
+      
+            InputStreamReader isr=new InputStreamReader(is);
+            BufferedReader br= new BufferedReader(isr);
+            String currentLine=null;
+            br.skip(helpLocInBytes);
+      
+            // Read all text available till the end of file
+            // or till the next command in the help file
+      
+            while ((currentLine=br.readLine()) != null)
+            {
+               if (currentLine.startsWith(HELP_KEYWORD_INDICATOR))
+               {
+                  break;
+               }
+               if (isSectionRead)
+               {
+                  if (!currentLine.toUpperCase().startsWith(section.toUpperCase()))
+                  {
+                     continue;
+                  }
+                  isSectionRead=false;
+               }
+               writer.writeln(currentLine.replaceAll("\\s*$",""));
+            }
+            is=null;
+            isr=null;
+            br=null;
+         }  
+      }
+      if (helpKeyValue  == null && !matchFound) { 
+         //If no entry exists for this command
+           writer.writeln();
+           writer.writeln(NO_HELP_FOR_CMD);
+       }
+   }
+
+   private void loadFileIdx(String mode, String role) throws FileNotFoundException,IOException
+   {
+	   String helpFileIndexContents = null;
+	   Matcher mat = null;
+	   InputStream hfIS=this.getClass().getResourceAsStream(HELP_FILES_BASE_DIR+HELP_FILE_IDX);
+	   //Check for valid stream
+	   if(null==hfIS)
+		   throw new FileNotFoundException();
+	   
+	   //Load the help-file index.
+	   BufferedReader input = new BufferedReader(new InputStreamReader(hfIS));
+	   
+	   //For each line in the index file check if the rule matches the current mode and role
+	   while ((helpFileIndexContents = input.readLine()) != null) {
+
+		   //Skip index file comments
+		   if(helpFileIndexContents.startsWith(HELP_COMMENT_INDICATOR))
+		   {continue;}
+
+		   mat = hfiPattern.matcher(helpFileIndexContents);
+		   //if the mode and role match the rule
+		   if (mat.find() && 
+				(mat.group(1).equalsIgnoreCase(mode) ||
+						mat.group(1).equalsIgnoreCase(COMMON_KEYWORD_INDICATOR)) &&
+				(mat.group(2).equalsIgnoreCase(role) || 
+						mat.group(2).equalsIgnoreCase(COMMON_KEYWORD_INDICATOR)))
+   	    	{
+               //add file-names to the help-file list.
+			   String[] fileNames = mat.group(3).split(FILENAME_SEPERATOR);
+			   for(int i = 0; i < fileNames.length; i++ ) {
+				   this.helpFileList.add(fileNames[i].trim());
+			   }              
+   	    	}
+        }
+        input.close();
+        hfIS.close();
+
+   }
+   
+   private Properties loadPropertyIdx(String fileName) throws FileNotFoundException, IOException
+   {
+	   try{
+	 	   InputStream is = null;
+	       //Assume the base directory and stream the indicated file
+	 	   is = this.getClass().getResourceAsStream(HELP_FILES_BASE_DIR+fileName);
+	 	   
+	       Properties helpIdxProp = new Properties();
+
+	       //If the file stream succeeded load the properties
+	       if (is != null)
+	       {
+	          helpIdxProp.load(is);
+	       } else
+	       {
+	    	  //otherwise, set properties to null. 
+	     	  helpIdxProp = null;
+	       }
+	       is=null;
+	       return helpIdxProp;
+	   
+	   } catch(Exception e) {
+		   return null;
+	   }
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/HostQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/HostQuery.java b/core/conn/trafci/src/main/java/org/trafodion/ci/HostQuery.java
new file mode 100644
index 0000000..117818e
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/HostQuery.java
@@ -0,0 +1,289 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+
+
+public class HostQuery extends Thread
+{
+
+
+   BufferedWriter bw=null;
+   boolean doneflag=false;
+   StringBuffer outputStr=null ;
+   StringBuffer errorStr=null;
+   boolean nextCommand=false;
+   boolean errorFlag=false;
+   boolean startInputThread=true;
+
+
+   HostQuery()
+   {
+      bw=null;
+      doneflag=false;
+      outputStr=new StringBuffer() ;
+      errorStr=new StringBuffer();
+      nextCommand=false;
+      errorFlag=false;
+   }
+
+   public void execute(String command,Reader reader, Writer writer)
+   {
+      Runtime rt=Runtime.getRuntime();
+      if (reader == null)
+      {
+         System.out.println("reader is null");
+      }
+      if (writer == null)
+      {
+         System.out.println("writer is null");
+      }
+      final String newLine=System.getProperty("line.separator");
+
+
+      try
+      {
+         final Process p=rt.exec(command);
+
+         InputStream is=null;
+         OutputStream os=null;
+         InputStream es=null;
+
+         is=p.getInputStream();
+         os=p.getOutputStream();
+         es=p.getErrorStream();
+
+         InputStreamReader isr=null;
+         InputStreamReader iser=null;
+         OutputStreamWriter osw=null;
+
+         isr=new InputStreamReader(is);
+         iser=new InputStreamReader(es);
+         osw=new OutputStreamWriter(os);
+
+         final BufferedReader br=new BufferedReader(isr);
+         final BufferedReader ber=new BufferedReader(iser);
+
+         bw=new BufferedWriter(osw);
+         //String tmpline=null;
+
+         // output thread
+         class OutputThread extends Thread
+         {
+            Writer writer;
+            OutputThread(Writer writer)
+            {
+               this.writer=writer;
+            }
+            public void run()
+            {
+               int i=0;
+               try
+               {
+                  while ((i=br.read()) != -1)
+                  {
+                     if (errorFlag)
+                     {
+                        Thread.yield();
+                        errorFlag=false;
+                        try
+                        {
+                           sleep(100);
+                        }
+                        catch (InterruptedException ie)
+                        {
+                        }
+                     }
+                     if (nextCommand)
+                     {
+                        br.readLine();
+                        nextCommand=false;
+                     }else
+                     {
+                        //System.out.print((char)i);
+                        writer.write(""+(char)i);
+                     }
+                  }
+                  doneflag=true;
+
+               }catch (IOException ote)
+               {
+                  System.out.println("output thread exception "+ote);
+               }
+
+            }
+         };
+
+         OutputThread outputt=new OutputThread(writer);
+         outputt.start();
+
+
+
+         // error thread
+         class ErrorThread extends Thread
+         {
+            Writer writer=null;
+            ErrorThread(Writer writer)
+            {
+               this.writer=writer;
+            }
+            public void run()
+            {
+               int i=0;
+               try
+               {
+                  while ((i=ber.read()) != -1)
+                  {
+                     errorFlag=true;
+                     //System.out.print((char)i);
+                     writer.write(""+(char)i);
+                  }
+               }catch (IOException ete)
+               {
+                  System.out.println("error thread exception "+ete);
+               }
+            }
+         };
+
+         ErrorThread errort=new ErrorThread(writer);
+         errort.start();
+
+         // input thread
+         class InputThread extends Thread
+         {
+            Reader reader=null;
+            InputThread(Reader reader)
+            {
+               this.reader=reader;
+            }
+            public void run()
+            {
+               String input=null;
+
+               try
+               {
+
+                  while (!doneflag)
+                  {
+                     if (doneflag) break;
+                     try
+                     {
+                        sleep(100);
+                     } catch (InterruptedException e)
+                     {
+                        break;
+                     }
+                     input=reader.getNonBlankLine();
+                     if (input != null)
+                     {
+
+                        try
+                        {
+                           //if the subprocess exited already..dont write anything to the pipe.
+                           p.exitValue();
+
+                           break;
+                        }catch (IllegalThreadStateException itse)
+                        {
+                        }
+
+                        nextCommand=true;
+                        bw.write(input+newLine);
+                        bw.flush();
+
+
+                     }
+
+                  }
+               } catch (UserInterruption ui)
+               {
+
+               }catch (IOException ite)
+               {
+                  System.out.println("input thread exception "+ite);
+               }
+            }
+
+         };
+
+         InputThread inpt=new InputThread(reader);
+
+         if (this.startInputThread)
+         {
+            inpt.start();
+         }
+
+         try
+         {
+            p.waitFor();
+            errort.join();
+            outputt.join();
+
+            if (this.startInputThread)
+            {
+               inpt.interrupt();
+               inpt.join();
+            }
+
+
+         } catch (InterruptedException e)
+         {
+            // TODO Auto-generated catch block
+            //.printStackTrace();
+         }
+
+
+
+         isr=null;
+         iser=null;
+         osw=null;
+         bw=null;
+         inpt=null;
+         outputt=null;
+         errort=null;
+         outputStr=null;
+         errorStr=null;
+
+      }
+      catch (IOException ioe)
+      {
+         try
+         {
+            writer.write("Could not create the sub process"+ioe);
+         } catch (IOException e)
+         {
+            // TODO Auto-generated catch block
+            //e.printStackTrace();
+         }
+      }
+
+
+
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/IDisplay.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/IDisplay.java b/core/conn/trafci/src/main/java/org/trafodion/ci/IDisplay.java
new file mode 100644
index 0000000..f24b8bc
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/IDisplay.java
@@ -0,0 +1,28 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.IOException;
+
+public interface IDisplay {
+	public void output(OutputContents contents) throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/IndexStruct.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/IndexStruct.java b/core/conn/trafci/src/main/java/org/trafodion/ci/IndexStruct.java
new file mode 100644
index 0000000..6cd1f63
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/IndexStruct.java
@@ -0,0 +1,55 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class IndexStruct {
+	private String indexName;
+	private String tableName;
+	private String tableType;
+
+	public IndexStruct(String indexName, String tableName, String tableType) {
+		super();
+		this.indexName = indexName;
+		this.tableName = tableName;
+		this.tableType = tableType;
+	}
+	public final String getTableType() {
+		return tableType;
+	}
+	public final void setTableType(String tableType) {
+		this.tableType = tableType;
+	}
+	public final String getIndexName() {
+		return indexName;
+	}
+
+	public final void setIndexName(String indexName) {
+		this.indexName = indexName;
+	}
+
+	public final String getTableName() {
+		return tableName;
+	}
+
+	public final void setTableName(String tableName) {
+		this.tableName = tableName;
+	}
+}


[08/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/InterfaceQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/InterfaceQuery.java b/core/conn/trafci/src/org/trafodion/ci/InterfaceQuery.java
deleted file mode 100644
index 5bd73cb..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/InterfaceQuery.java
+++ /dev/null
@@ -1,4378 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.ByteArrayInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.InputStream;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.text.DateFormat;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Timer;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-import java.sql.PreparedStatement;
-
-import org.trafodion.jdbc.t4.TrafT4Statement;
-
-import java.lang.InterruptedException;
-
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.Vector;
-import java.sql.Connection;
-import sun.misc.Signal;
-import sun.misc.SignalHandler;
-import java.net.UnknownHostException;
-
-public class InterfaceQuery extends QueryWrapper implements SessionDefaults {
-	private HashMap<String, String> iqKeyMap = null;
-	private HashMap<String, String> envMap = null;
-	private FileWriter spoolWriter = null;
-	private FileReader obeyReader = null;
-	private String spoolFileName = null;
-	private Connection newConn = null;
-	private SignalHandler LHCTRLCHandler = null;
-	private SignalHandler DelayCTRLCHandler = null;
-	private Signal INTSignal = null;
-	private int totalCount = 0;
-	private boolean doTrace = Boolean.getBoolean(SessionDefaults.PROP_TRACE);
-	private boolean printConnTime = false;
-	private String strFilter = "";
-
-	private Thread curThread = null;
-	private int maxDelayVal = -1;
-
-	/**
-	 * Final String Initialization.
-	 */
-	private final String infoNotAvailable = "Information not available.";
-	private final String ciServerErrMsg = "An internal server error has occurred. Please contact support.";
-
-	InterfaceQuery() {
-	}
-
-	InterfaceQuery(Session sessObj) {
-		super(sessObj);
-		iqKeyMap = new HashMap<String,String>();
-		envMap = sessObj.getEnvMap();
-		loadIqKeyWordMap();
-		loadEnvVarMap(); // loads the env variables in the pattern hashmap
-		addEnvValuesMap(); // loads env values into the env hash map
-		if (sessObj.getCaller() != SessionDefaults.PRUNI) {
-			LHCTRLCHandler = new SignalHandler() {
-				public void handle(Signal sig) {
-					killProcess();
-				}
-			};
-
-			/* Ctrl+C handler for the delay command */
-			DelayCTRLCHandler = new SignalHandler() {
-				public void handle(Signal sig) {
-					if (curThread != null)
-						curThread.interrupt();
-
-				}
-			};
-
-			try {
-				INTSignal = new Signal("INT");
-				Signal.handle(INTSignal, LHCTRLCHandler);
-			} catch (Exception e) {
-			}
-		}
-
-		String strConnTime = System
-				.getProperty(SessionDefaults.PROP_PRINT_TIME);
-		if ((strConnTime != null) && strConnTime.equalsIgnoreCase("y")) {
-			printConnTime = true;
-		}
-
-		String maxDelayStr = System.getProperty(SessionDefaults.PROP_MAX_DELAY);
-		if (maxDelayStr != null)
-			maxDelayVal = Integer.parseInt(maxDelayStr) * 1000;
-	}
-
-	void killProcess() {
-		Query qryObj = sessObj.getQuery();
-		if (qryObj != null && qryObj.getQueryId() == LOCALHOST) {
-			if (sessObj.getProcObj() != null) {
-				sessObj.getProcObj().destroy();
-				sessObj.setProcObj(null);
-			}
-		}
-	}
-
-	public void execute() throws UnKnownInterfaceCommand, SQLException,
-			IOException, UserInterruption {
-		String cmdStr = null;
-		int cmdNo = 0;
-		init();
-		isMultiLine = false; // flag to check if the input line can be entered
-		// in multline.
-		blankLiner = false;
-
-		readQuery();
-
-		// Move the pointer to the next key word as we already know the
-		// first key word for all interface commands which would have been
-		// set by the validateQuery
-		//
-		String fToken = parser.getNextKeyToken();
-
-		// put the timer on hold
-		// sessObj.setTimerHold();
-
-		// get the QueryId and directly process that command
-		sessObj.setQryStartTime();
-
-		switch (sessObj.getQuery().getQueryId()) {
-
-		case SECTION:
-			sessObj.getQuery().resetQueryText("");
-			break;
-
-		case HELP:
-			handleHelp();
-			break;
-
-		case CLEAR:
-			handleClearCommand();
-			break;
-
-		case MODE:
-			writer.writeln();
-			writer.writeError(sessObj, SessionError.CMD_NOT_SEAQUEST_SUPPORTED);
-			break;
-
-		case SET:
-			execSet();
-			break;
-
-		case SHOW:
-			execShow();
-			break;
-
-		case GET:
-			execGet();
-			break;
-
-		case CONNECT:
-			handleConnect();
-			break;
-
-		case RECONNECT:
-			handleReconnect();
-			break;
-
-		case EXIT:
-		case DISCONNECT:
-			handleDisConnect();
-			break;
-
-		case ED:
-		case EDIT:
-			break;
-
-		case SPOOL:
-		case LOG:
-			execSpool();
-			break;
-
-		case SLASH:
-		case RUN:
-			handleRunCommand();
-			break;
-
-		case AT:
-		case OBEY:
-			execObey();
-			break;
-
-		case RESET:
-			handleResetCommand();
-			break;
-
-		case HISTORY:
-			handleHistory();
-			break;
-
-		case FC:
-		case REPEAT:
-			handleRepeatCommand(cmdStr, cmdNo);
-			break;
-
-		case SESSION:
-		case ENV:
-			execEnv();
-			break;
-
-		case SAVEHIST:
-			handleSaveHistory();
-			break;
-
-		case VERSION:
-			handleVersion();
-			break;
-
-		case ERROR:
-			formatResults(SessionError.NOT_SUPPORT + SqlEnum.ERROR.toString() + " command.");
-			break;
-
-		case LOCALHOST:
-			handleHostCommand();
-			break;
-
-		case DELAY:
-			handleDelay();
-			break;
-
-		case ALIAS:
-			handleAlias();
-			break;
-
-		case DOTSEC:
-		case DOTCS:
-		case DOTSQL:
-		case DOTNS:
-		case DOTWMS:
-
-			if (!sessObj.isDBConnExists()) // Added  2010-03-01
-			{
-				displayNoConnInfo();
-				break;
-			}
-
-			if (!parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			String secondToken = parser.lookAtNextToken().toUpperCase();
-
-			if (secondToken.equalsIgnoreCase(".SEC")
-					|| secondToken.equalsIgnoreCase(".CS")
-					|| secondToken.equalsIgnoreCase(".NS")) {
-				formatResults(SessionError.NOT_SUPPORT
-						+ secondToken.substring(1) + " mode.");
-			}
-
-			if (secondToken.equalsIgnoreCase(".SQL")
-					|| secondToken.equalsIgnoreCase(".WMS")) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			rewriteQryString(sessObj.getStrMode(), fToken.substring(1));
-			sessObj.setDotMode(fToken.substring(1));
-			ByteArrayInputStream bais = new ByteArrayInputStream(qryObj
-					.getQueryText().getBytes());
-			sessObj.setLogCmdEcho(false);
-			sessObj.setDotModeCmd(true);
-			sessObj.setHistOn(false);
-			sessObj.setPrevMode(sessObj.getMode());
-			this.execObeyStream(bais, "");
-			break;
-
-		} // end switch
-		sessObj.setQryEndTime();
-		// sessObj.setLastError(sessObj.getQuery().getStatusCode());
-	} // end execute
-
-	/* parameterized types not available in 1.4, must cast below */
-	class FilenameComparator implements Comparator<File> {
-
-		// sort alphabetically
-		public int compare(File fa, File fb) {
-			return fb.getName().compareToIgnoreCase(
-					fa.getName());
-		}
-	}
-
-	public void execObeyStream(InputStream theStream, String clzName)
-			throws IOException {
-		obeyReader = new FileReader();
-
-		try {
-			obeyReader.initializeStream(theStream, clzName);
-			sessObj.getReader().setObeyReader(obeyReader);
-			if (sessObj.getReader().getReadMode() != SessionDefaults.OBEY_READ_MODE) {
-				sessObj.getReader().setReadMode(OBEY_READ_MODE);
-				sessObj.setSessionType(false);
-			}
-
-		} catch (IOException e) {
-			throw e;
-		}
-
-	}
-
-	public void execObey() throws IOException {
-		FilenameFilter filter;
-		File file = null;
-		Comparator<File> fileAlphabetize = new FilenameComparator();
-
-		String obeyFileName = parser.getNextFileToken();
-		obeyFileName = (obeyFileName == null) ? "" : obeyFileName.trim();
-
-		if (obeyFileName.equals("")) {
-			// if user just hit enter, prompt for a file
-			if (sessObj.isSessionInteractive()) {
-				try {
-
-					String defaultVal = "*.sql";
-					String prompt = "Enter the script filename [" + defaultVal
-							+ "]      :";
-					sessObj.getConsoleWriter()
-							.print(utils.formatString(prompt,
-									prompt.length() + 1, ' '));
-					obeyFileName = sessObj.getReader().getLine();
-					if ((obeyFileName == null || obeyFileName.trim().equals(""))) {
-						obeyFileName = defaultVal;
-					}
-
-					obeyFileName = obeyFileName.trim();
-
-				} catch (UserInterruption ui) {
-					return;
-				}
-			} else {
-				sessionError('E', new ErrorObject(
-						SessionError.OBEY_BLANK_SESSION_ERR.errorCode(),
-						SessionError.OBEY_BLANK_SESSION_ERR.errorMessage()));
-				return;
-			}
-		}
-
-		// obtain filter at the end of the filename
-		file = new File(obeyFileName);
-
-		// test for slash, add on at end
-		boolean addSlash = obeyFileName.endsWith(File.separator) ? true : false;
-		if (file.getParent() != null) {
-			obeyFileName = file.getAbsolutePath(); // java strips last slash
-			if (addSlash)
-				obeyFileName += File.separator;
-		} else if (file.exists() && file.isDirectory() && !addSlash) {
-			obeyFileName += File.separator;
-			file = new File(obeyFileName);
-		}
-
-		if (file.exists()) {
-			if (file.isDirectory())
-				strFilter = "*.sql";
-			else
-				file = new File(obeyFileName);
-		} else if (!obeyFileName.endsWith(File.separator)
-				&& (obeyFileName.indexOf("*") != -1 || obeyFileName
-						.indexOf("?") != -1)) {
-			strFilter = file.getName();
-			obeyFileName = file.getParent();
-			if (obeyFileName == null)
-				obeyFileName = System.getProperty("user.dir");
-
-			file = new File(obeyFileName);
-		} else {
-			sessionError(
-					'E',
-					new ErrorObject(SessionError.OBEY_PATH_NOT_FOUND
-							.errorCode(), SessionError.OBEY_PATH_NOT_FOUND
-							.errorMessage()));
-			return;
-		}
-
-		// windows/dos-style wildcards, * really means .* and ? means . in regex
-		// terms
-		// replace asterisks with regex something like .* but remember to
-		// replace existing dots with \.
-		strFilter = strFilter.replaceAll("\\.", "\\\\.");
-		strFilter = strFilter.replaceAll("\\*", "\\.\\*");
-		strFilter = strFilter.replaceAll("\\?", ".");
-
-		// escape all other regex symbols
-		Pattern p = Pattern.compile("([$+|\\[\\](){}])");
-		Matcher m = p.matcher(strFilter);
-		strFilter = m.replaceAll("\\\\$1");
-
-		filter = new FilenameFilter() {
-			public boolean accept(File dir, String name) {
-				File testFile = new File(dir.getAbsolutePath() + File.separator
-						+ name);
-
-				Pattern pattern;
-				if (System.getProperty("os.name").toUpperCase()
-						.startsWith("WINDOW"))
-					pattern = Pattern.compile(strFilter,
-							Pattern.CASE_INSENSITIVE);
-				else
-					pattern = Pattern.compile(strFilter);
-
-				Matcher matcher = pattern.matcher(name);
-				return matcher.matches() && testFile.isFile();
-			}
-		};
-
-		File[] fl;
-		if (file != null && file.exists() && file.isDirectory()) {
-			fl = file.listFiles(filter);
-			Arrays.sort(fl, fileAlphabetize);
-		} else {
-			fl = new File[1];
-			fl[0] = file;
-		}
-
-		if (obeyFileName == null || obeyFileName.trim().equals("")) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		}
-
-		String sectionName = parser.getNextSectionToken();
-
-		if (parser.hasMoreTokens()) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		}
-
-		if (fl.length == 0) {
-
-			sessionError('E', SessionError.OBEY_WILDCARD_NOT_FOUND);
-			return;
-		}
-
-		if (sessObj.isSessionInteractive()
-				|| sessObj.getReader().getReadMode() == SessionDefaults.OBEY_READ_MODE) {
-
-			File f;
-			for (int i = 0; i < fl.length; i++) {
-				f = fl[i];
-
-				/* ignore the log file if its in the obey list */
-				if (sessObj.isSessionLogging()) {
-					if (f.getAbsolutePath().equals(sessObj.getSpoolFileName()))
-						continue;
-				}
-
-				obeyReader = new FileReader();
-
-				try {
-					obeyReader.initialize(f.getAbsolutePath());
-
-					if (sectionName != null) {
-						try {
-							obeyReader.setSectionRead(true, sectionName);
-						} catch (ScriptSectionNotFound e) {
-							sessionError(
-									'E',
-									new ErrorObject(
-											SessionError.OBEY_SECTION_NOT_FOUND
-													.errorCode(),
-											"Section "
-													+ sectionName
-													+ SessionError.OBEY_SECTION_NOT_FOUND
-															.errorMessage()
-													+ f.getName()));
-							obeyReader.close();
-							obeyReader = null;
-							return;
-						}
-					}
-					sessObj.getReader().setObeyReader(obeyReader);
-					if (sessObj.getReader().getReadMode() != SessionDefaults.OBEY_READ_MODE) {
-						sessObj.getReader().setReadMode(OBEY_READ_MODE);
-						sessObj.setSessionType(false);
-					}
-
-				} catch (FileNotFoundException fnfe) {
-					sessionError('E', new ErrorObject(
-							SessionError.OBEY_FILE_NOT_FOUND.errorCode(),
-							SessionError.OBEY_FILE_NOT_FOUND.errorMessage()));
-					return;
-				} catch (IOException e) {
-					throw e;
-				}
-			}
-		}
-
-	}
-
-	private void resetSpoolOptions(FileWriter sWriter) throws IOException {
-		sessObj.setSessionLogging(false);
-		sessObj.getWriter().setWriterMode(CONSOLE_WRITE_MODE);
-		sessObj.setQuietEnabled(false);
-		sessObj.setLogCmdText(true);
-		sessObj.setLogAppend(true);
-		sessObj.setLogCmdEcho(true);
-		sessObj.setSessionStartup(false);
-		try {
-			if (sWriter != null)
-				sWriter.close();
-			sWriter = null;
-		} catch (IOException e) {
-			throw e;
-		}
-	}
-
-	private void execSpool() throws IOException {
-		spoolFileName = parser.getNextFileToken();
-		if (sessObj.getCaller() == PRUNI) {
-			if (spoolFileName.equalsIgnoreCase("OFF")) {
-				sessObj.setSessionStartup(false);
-				sessObj.setSessionLogging(false);
-			}
-			return;
-		}
-		if (spoolFileName == null || spoolFileName.trim().equals("")) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		}
-		if (spoolFileName.endsWith(","))
-			spoolFileName = spoolFileName.substring(0,
-					spoolFileName.length() - 1);
-
-		if (!spoolFileName.equalsIgnoreCase("OFF")) {
-			if (spoolFileName.equalsIgnoreCase("ON")) {
-				spoolFileName = "sqlspool.lst";
-			}
-			if (sessObj.isSessionLogging()) {
-				resetSpoolOptions(spoolWriter);
-				spoolWriter = null;
-			}
-		} else if (spoolFileName.equalsIgnoreCase("OFF")) {
-
-			if ((spoolWriter == null) && !sessObj.isSessionStartup()) {
-				sessionError('E', SessionError.SPOOL_OFF_OFF);
-				return;
-			} else {
-				resetSpoolOptions(spoolWriter);
-				spoolWriter = null;
-				return;
-			}
-		}
-		sessObj.setSpoolFileName(spoolFileName);
-		String spoolOption = null;
-		String cmdStr, cmdTextValue = null;
-		String[] formatStrArr = parser.getRemainderStr().trim().split(",");
-
-		for (int i = 0; i < formatStrArr.length; i++) {
-			spoolOption = parser.getNextToken().trim();
-			if (spoolOption != null
-					&& !spoolOption.equalsIgnoreCase("")
-					&& !spoolOption
-							.matches("(?i)\\s*((CMDTEXT|CMDECHO)\\s+(ON|OFF))|(QUIET|CLEAR)")) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				resetSpoolOptions(spoolWriter);
-				return;
-			}
-			if (spoolOption.matches("(?i)\\s*(CMDTEXT|CMDECHO)\\s+(ON|OFF)")) {
-				cmdStr = spoolOption.substring(0, 7);
-				cmdTextValue = spoolOption.trim().substring(8);
-				if (cmdStr.equalsIgnoreCase("CMDECHO")) {
-					if (cmdTextValue == null
-							|| cmdTextValue.trim().equalsIgnoreCase("ON"))
-						sessObj.setLogCmdEcho(true);
-					else
-						sessObj.setLogCmdEcho(false);
-
-				} else if (cmdTextValue == null
-						|| cmdTextValue.trim().equalsIgnoreCase("ON"))
-					sessObj.setLogCmdText(true);
-				else
-					sessObj.setLogCmdText(false);
-			} else if (spoolOption.equalsIgnoreCase("QUIET")) {
-				sessObj.setQuietEnabled(true);
-			} else if (spoolOption.equalsIgnoreCase("CLEAR")) {
-				sessObj.setLogAppend(false);
-			}
-		}
-		if (!spoolFileName.equalsIgnoreCase("OFF")) {
-			try {
-				spoolWriter = new FileWriter();
-
-				if (sessObj.isLogAppend())
-					spoolWriter.setAppend(true);
-				spoolWriter.initialize(spoolFileName);
-				sessObj.setSessionLogging(true);
-				sessObj.getWriter().setSpoolWriter(spoolWriter);
-				sessObj.getWriter().setWriterMode(CONSOLE_SPOOL_WRITE_MODE);
-				if (sessObj.isLogCmdText()
-						&& sessObj.getSessView() != SessionDefaults.MXCI_VIEW) {
-					spoolWriter.writeln((utils.formatString("=", 80, '=')));
-					spoolWriter.writeln("Spooling started at "
-							+ DateFormat.getDateTimeInstance().format(
-									new Date()));
-					spoolWriter.writeln((utils.formatString("=", 80, '=')));
-				}
-			} catch (FileNotFoundException fnfe) {
-				sessionError('E',
-						new ErrorObject(SessionError.INTERNAL_ERR.errorCode(),
-								fnfe.getMessage()));
-				spoolWriter = null;
-				return;
-			} catch (IOException e) {
-				spoolWriter = null;
-				throw e;
-			}
-		}
-	}
-
-	private void execEnv() throws IOException, UnKnownInterfaceCommand,
-			UserInterruption {
-		if (parser.hasMoreTokens()) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		}
-
-		// writer.writeln("CATALOG        ",(sessObj.getSessionCtlg()));
-		handleOutput("COLSEP         ", "\"" + sessObj.getSessionColSep()
-				+ "\"");
-		handleOutput("HISTOPT        ", (sessObj.isSessionHistoryAll() ? "ALL"
-				: "DEFAULT [No expansion of script files]"), false);
-		handleOutput("IDLETIMEOUT    ", (sessObj.getSessionIdletime())
-				+ " min(s) "
-				+ (sessObj.getSessionIdletime() == 0 ? "[Never Expires]" : ""),
-				false);
-		if (sessObj.getListCount() == 0)
-			handleOutput("LIST_COUNT     ", (sessObj.getListCount())
-					+ " [All Rows]", false);
-		else
-			handleOutput("LIST_COUNT     ",
-					String.valueOf((sessObj.getListCount())), false);
-		if (sessObj.isSessionLogging()) {
-			handleOutput("LOG FILE       ", sessObj.getSpoolFileName(), false);
-			handleOutput("LOG OPTIONS    ", (sessObj.isLogAppend() ? "APPEND"
-					: "CLEAR")
-					+ (sessObj.isQuietEnabled() ? ",QUIET" : "")
-					+ ",CMDTEXT " + (sessObj.isLogCmdText() ? "ON" : "OFF"),
-					false);
-		} else
-			handleOutput("LOG            ", "OFF", false);
-		handleOutput("MARKUP         ", (sessObj.getStrDisplayFormat()), false);
-		handleOutput("PROMPT         ", (sessObj.getSessionPrompt()), false);
-		if (sessObj.isDBConnExists())
-		{
-			handleOutput("SCHEMA         ", (sessObj.getSessionSchema()), false);
-			handleOutput("SERVER         ", sessObj.getSessionServer()
-					+ sessObj.getSessionPort(), false);
-		} else {
-			handleOutput("SCHEMA         ", (this.infoNotAvailable), false);
-			handleOutput("SERVER         ", (this.infoNotAvailable), false);
-		}
-
-		handleOutput("SQLTERMINATOR  ", (sessObj.getSessionSQLTerminator()),
-				false);
-		handleOutput("STATISTICS     ", (sessObj.isSessionStatsEnabled() ? "ON"
-				: "OFF"), false);
-		handleOutput("TIME           ", (sessObj.isSessionTimeOn() ? "ON"
-				: "OFF"), false);
-		handleOutput("TIMING         ", (sessObj.isSessionTimingOn() ? "ON"
-				: "OFF"), false);
-		if (sessObj.isDBConnExists())// Changed  2010-03-01
-		{
-			handleOutput("USER           ", (sessObj.getSessionUser()), false);
-		} else {
-			handleOutput("USER           ", (this.infoNotAvailable), false);
-		}
-		writer.writeEndTags(sessObj);
-	}
-
-	private void execShow() throws UnKnownInterfaceCommand, SQLException,
-			IOException, UserInterruption {
-		String showOption = parser.getNextKeyToken();
-
-		if (showOption == null) {
-			if (parser.hasMoreTokens()) {
-				throw uic;
-			}
-			sessionError('E', SessionError.SHOW_NO_OPTION);
-			return;
-		}
-
-		showOption = iqKeyMap.get("SHOW_" + showOption.toUpperCase());
-
-		if (showOption == null) {
-			throw uic;
-		}
-
-		int showId = Integer.parseInt(showOption);
-		sessObj.getQuery().setQueryId(showId);
-
-//		String setValue;
-
-		switch (showId) {
-		case SHOW_TIME:
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			handleOutput("TIME", (sessObj.isSessionTimeOn() ? "ON" : "OFF"));
-			break;
-
-		case SHOW_TIMING:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			handleOutput("TIMING", (sessObj.isSessionTimingOn() ? "ON" : "OFF"));
-			break;
-
-		case SHOW_SQLTERMINATOR:
-
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			handleOutput("SQLTERMINATOR", (sessObj.getSessionSQLTerminator()));
-			break;
-
-		case SHOW_SQLPROMPT:
-
-			//change for show schemas can't executed in cs mode
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE && sessObj.getMode() != SessionDefaults.CS_MODE) {
-//			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			handleOutput("SQLPROMPT", (sessObj.getSessionPrompt()));
-			break;
-
-		case SHOW_CATALOG:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (sessObj.isDBConnExists()) // Modified  2010-03-01
-			{
-				handleOutput("CATALOG", (sessObj.getSessionCtlg()));
-			} else {
-				displayNoConnInfo();
-			}
-			break;
-
-		case SHOW_SESSION:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			execEnv();
-			break;
-
-		case SHOW_SCHEMA:
-
-			if (parser.getNextKeyToken() != null
-					|| parser.getNextValueToken() != null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (sessObj.isDBConnExists()) // Modified  2010-03-01
-			{
-				handleOutput("SCHEMA", (sessObj.getSessionSchema()));
-			} else {
-				displayNoConnInfo();
-			}
-
-			break;
-
-		case SHOW_ROLE:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (sessObj.isDBConnExists()) // Modified  2010-03-01
-			{
-				handleOutput("ROLE", (sessObj.getSessionRole()));
-			} else {
-				displayNoConnInfo();
-			}
-
-			break;
-
-		case SHOW_IDLETIMEOUT:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			handleOutput("IDLETIMEOUT", (sessObj.getSessionIdletime())
-					+ " min(s) "
-					+ (sessObj.getSessionIdletime() == 0 ? "[Never Expires]"
-							: ""));
-			break;
-
-		case SHOW_LISTCOUNT:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			handleOutput(
-					"LIST_COUNT",
-					(sessObj.getListCount())
-							+ (sessObj.getListCount() == 0 ? " [All Rows]" : ""));
-			break;
-
-		case SHOW_DISPLAY_COLSIZE:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			handleOutput("DISPLAY COLSIZE",
-					String.valueOf(sessObj.getDisplayColSize()));
-			break;
-
-		case SHOW_PROCESSNAME:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (sessObj.isDBConnExists()) // Modified  2010-03-01
-			{
-				String processName = sessObj.getNeoProcessName();
-				handleOutput("REMOTE PROCESS", processName);
-			} else {
-				displayNoConnInfo();
-			}
-
-			break;
-
-		case SHOW_MODE:
-			writer.writeln();
-			writer.writeError(sessObj, SessionError.CMD_NOT_SEAQUEST_SUPPORTED);
-/*
- * remove show mode command for seaquest
- */
-//			if (parser.hasMoreTokens()) {
-//				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-//				break;
-//			}
-//			handleOutput("MODE", sessObj.getStrMode());
-			break;
-
-		case SHOW_COLSEP:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			handleOutput("COLSEP", ("\"" + sessObj.getSessionColSep() + "\""));
-			break;
-
-		case SHOW_MARKUP:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			handleOutput("MARKUP", sessObj.getStrDisplayFormat());
-			break;
-
-		case SHOW_PARAM:
-		case SHOW_PARAMS:
-
-			totalCount = 0;
-			String paramName = parser.getNextParamToken();
-			if (paramName != null) {
-				if (parser.hasMoreTokens()) {
-					writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				} else if (sessObj.getSessParams() != null) {
-					if (sessObj.getSessParams(paramName) != null) {
-						handleOutput(paramName,
-								sessObj.getSessParams(paramName), false);
-						totalCount++;
-					} else {
-						sessionError('E', SessionError.SHOW_PARAM_NOT_FOUND);
-					}
-
-				}
-				break;
-			}
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				HashMap<String,String> paramHash = sessObj.getSessParams();
-				if ((paramHash != null) && !paramHash.isEmpty()) {
-					Map<String, String> sortedMap = new TreeMap<String, String>(paramHash);
-					Iterator<String> paramNames = sortedMap.keySet().iterator();
-					for (int paramCnt = 0; paramCnt < paramHash.size(); paramCnt++) {
-						if (paramNames.hasNext()) {
-							String pName = (String) paramNames.next();
-							handleOutput(pName,
-									paramHash.get(pName).toString(), false);
-							totalCount++;
-						}
-					}
-					printElapsedTime();
-					writer.writeEndTags(sessObj);
-				} else {
-					sessionError('E', SessionError.SHOW_PARAM_NOT_FOUND);
-				}
-
-			}
-
-			sessObj.setTotalRecordCount(String.valueOf(totalCount));
-			break;
-
-		case SHOW_TABLES:
-		case SHOW_SCHEMAS:
-		case SHOW_CATALOGS:
-		case SHOW_VIEWS:
-		case SHOW_SYNONYMS:
-		case SHOW_MVS:
-		case SHOW_MVGROUPS:
-		case SHOW_PROCEDURES:
-
-			totalCount = 0;
-			String tableNamePattern = null;
-
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE && sessObj.getMode() != SessionDefaults.CS_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-			tableNamePattern = parser.getNextQValueToken();
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (!sessObj.isDBConnExists()) // Modified  2010-03-01
-			{
-				displayNoConnInfo();
-				break;
-			}
-
-			ResultSet rsmd = null;
-			// default is TABLE_NAME
-			String getStr = SqlEnum.TABLE_NAME.toString();
-			;
-
-			DatabaseMetaData dbmd = conn.getMetaData();
-
-			String displayStr = null;
-			ErrorObject errObj = null;
-
-			if (tableNamePattern != null) {
-
-				if ((tableNamePattern.indexOf("*") != -1)
-						|| (tableNamePattern.indexOf("?") != -1))
-
-					tableNamePattern = parser
-							.replaceShowPattern(tableNamePattern);
-
-			}
-			try {
-				switch (showId) {
-				case SHOW_TABLES:
-					String[] ttype = { SqlEnum.TABLE.toString() };
-					rsmd = dbmd
-							.getTables(sessObj.getSessionCtlg(),
-									sessObj.getSessionSchema(),
-									tableNamePattern, ttype);
-					displayStr = "TABLE NAMES";
-					errObj = SessionError.SHOW_TAB_NOT_FOUND;
-					tableNamePattern = null;
-					break;
-
-				case SHOW_VIEWS:
-					String[] vtype = { "VIEW" };
-					rsmd = dbmd
-							.getTables(sessObj.getSessionCtlg(),
-									sessObj.getSessionSchema(),
-									tableNamePattern, vtype);
-					displayStr = "VIEW NAMES";
-					errObj = SessionError.SHOW_VIEW_NOT_FOUND;
-					tableNamePattern = null;
-					break;
-
-				case SHOW_SYNONYMS:
-					String[] stype = { SqlEnum.SYNONYM.toString() };
-					rsmd = dbmd
-							.getTables(sessObj.getSessionCtlg(),
-									sessObj.getSessionSchema(),
-									tableNamePattern, stype);
-					displayStr = "SYNONYM NAMES";
-					errObj = SessionError.SHOW_SYNONYM_NOT_FOUND;
-					tableNamePattern = null;
-					break;
-
-				case SHOW_MVS:
-					String[] mvtype = { "MV" };
-					rsmd = dbmd.getTables(sessObj.getSessionCtlg(),
-							sessObj.getSessionSchema(), tableNamePattern,
-							mvtype);
-					displayStr = "MATERIALIZED VIEW NAMES";
-					errObj = SessionError.SHOW_MV_NOT_FOUND;
-					tableNamePattern = null;
-					break;
-
-				case SHOW_MVGROUPS:
-					String[] mvgtype = { "MVG" };
-					rsmd = dbmd.getTables(sessObj.getSessionCtlg(),
-							sessObj.getSessionSchema(), tableNamePattern,
-							mvgtype);
-					displayStr = "MATERIALIZED VIEW GROUP NAMES";
-					errObj = SessionError.SHOW_MVG_NOT_FOUND;
-					tableNamePattern = null;
-					break;
-
-				case SHOW_CATALOGS:
-					rsmd = dbmd.getCatalogs();
-					getStr = "TABLE_CAT";
-					displayStr = "CATALOG NAMES";
-					errObj = SessionError.SHOW_CAT_NOT_FOUND;
-					break;
-
-				case SHOW_SCHEMAS:
-					rsmd = dbmd.getSchemas();
-					getStr = "TABLE_SCHEM";
-					displayStr = "SCHEMA NAMES";
-					errObj = SessionError.SHOW_SCH_NOT_FOUND;
-					break;
-
-				case SHOW_PROCEDURES:
-					rsmd = dbmd.getProcedures(sessObj.getSessionCtlg(),
-							sessObj.getSessionSchema(), tableNamePattern);
-					getStr = "PROCEDURE_NAME";
-					displayStr = "PROCEDURE NAMES";
-					errObj = SessionError.SHOW_PROC_NOT_FOUND;
-					tableNamePattern = null;
-					break;
-
-				}
-				// Temporary fix till JDBC fixes this issue.
-			} catch (NullPointerException npe) {
-				errObj = SessionError.INTERNAL_ERR;
-			}
-
-			if ((tableNamePattern != null)
-					&& (tableNamePattern.trim().equals(""))) {
-				tableNamePattern = null;
-			}
-			if (tableNamePattern != null) {
-				tableNamePattern = utils.trimDoubleQuote(tableNamePattern);
-				try {
-					tableNamePattern = tableNamePattern.replaceAll("_", ".");
-					tableNamePattern = tableNamePattern.replaceAll("%", ".*");
-				} catch (PatternSyntaxException pse) {
-					tableNamePattern = "";
-				}
-
-			}
-
-			List<String> results = new ArrayList<String>();
-			int maxDisplaySize = 0;
-			int displayCols = 0;
-			if (rsmd == null || !rsmd.next()) {
-				sessionError('E', errObj);
-			} else {
-				int currentColLength = 0;
-
-				do {
-					if ((currentColLength = rsmd.getString(getStr).getBytes().length) > maxDisplaySize) {
-						maxDisplaySize = currentColLength;
-					}
-					if (tableNamePattern == null) {
-						results.add(rsmd.getString(getStr));
-
-					} else {
-						try {
-							if (rsmd.getString(getStr)
-									.matches(tableNamePattern)) {
-								results.add(rsmd.getString(getStr));
-
-							}
-						} catch (PatternSyntaxException pse) {
-							tableNamePattern = "";
-						}
-
-					}
-				} while (rsmd.next());
-
-				if (results.size() == 0) {
-					sessionError('E', errObj);
-				} else {
-
-					switch (sessObj.getDisplayFormat()) {
-					case SessionDefaults.HTML_FORMAT:
-						sessObj.getHtmlObj().init();
-						sessObj.getHtmlObj().handleStartTags();
-						writer.writeln("<tr>");
-						writer.writeln("  <th>" + displayStr + "</th>");
-						writer.writeln("</tr>");
-						break;
-					case SessionDefaults.XML_FORMAT:
-						sessObj.getXmlObj().init();
-						sessObj.getXmlObj().handleStartTags();
-						writer.writeln("   <" + utils.removeSpaces(displayStr)
-								+ ">");
-						break;
-					case SessionDefaults.CSV_FORMAT:
-						writer.writeln();
-						break;
-					default:
-						// print the header label
-						writer.writeln();
-						writer.writeln(displayStr);
-						writer.write(utils.formatString("-", 80, '-'));
-						writer.writeln();
-						break;
-					}
-
-					if (maxDisplaySize == 0 || maxDisplaySize > 60) {
-						displayCols = 1;
-					} else {
-						displayCols = (int) Math
-								.floor(96 / (maxDisplaySize + 2));
-
-					}
-
-					for (int j = 0; j < results.size(); j++) {
-						switch (sessObj.getDisplayFormat()) {
-						case SessionDefaults.XML_FORMAT:
-							writer.writeln("     <Name>"
-									+ utils.formatXMLdata(results.get(j)
-											.toString()) + "</Name>");
-							break;
-						case SessionDefaults.HTML_FORMAT:
-							writer.writeln("<tr>");
-							writer.writeln("  <td>" + results.get(j).toString()
-									+ "</td>");
-							writer.writeln("</tr>");
-							break;
-						case SessionDefaults.CSV_FORMAT:
-							writer.writeln(results.get(j).toString());
-							break;
-						default:
-							formatOutput(results.get(j).toString(),
-									maxDisplaySize + 2, ' ', 0);
-							if ((j + 1) % displayCols == 0) {
-								writer.writeln();
-							}
-							break;
-						}
-						totalCount++;
-					}
-
-					sessObj.setQryEndTime();
-
-				}
-			}
-
-			switch (sessObj.getDisplayFormat()) {
-			case SessionDefaults.HTML_FORMAT:
-				if (sessObj.isSessionTimingOn())
-					writer.writeln(sessObj.getHtmlObj()._startCommentTag
-							+ writer.getElapsedTime(sessObj, qryObj, utils)
-							+ sessObj.getHtmlObj()._endCommentTag);
-				writer.printElapsedQuietMode(writer.getElapsedTime(sessObj,
-						qryObj, utils));
-				sessObj.getHtmlObj().handleEndTags();
-				break;
-			case SessionDefaults.XML_FORMAT:
-				if (results.size() != 0)
-					writer.writeln("   </" + utils.removeSpaces(displayStr)
-							+ ">");
-				if (sessObj.isSessionTimingOn())
-					writer.writeln(sessObj.getXmlObj()._beginCdataTag
-							+ writer.getElapsedTime(sessObj, qryObj, utils)
-							+ sessObj.getXmlObj()._endCdataTag);
-
-				writer.printElapsedQuietMode(writer.getElapsedTime(sessObj,
-						qryObj, utils));
-				sessObj.getXmlObj().handleEndTags();
-				break;
-			case SessionDefaults.CSV_FORMAT:
-				writer.writeln();
-				if (results.size() != 0 && sessObj.isSessionTimingOn()) {
-					writer.writeln(writer
-							.getElapsedTime(sessObj, qryObj, utils));
-					writer.printElapsedQuietMode(writer.getElapsedTime(sessObj,
-							qryObj, utils));
-				}
-				break;
-			default:
-				if (results.size() != 0 && results.size() % displayCols != 0) {
-					writer.writeln();
-				}
-				if (sessObj.isSessionTimingOn()) {
-					writer.writeln();
-					writer.writeln(writer
-							.getElapsedTime(sessObj, qryObj, utils));
-					writer.printElapsedQuietMode(writer.getElapsedTime(sessObj,
-							qryObj, utils));
-				}
-				break;
-			}
-			results = null;
-
-			sessObj.setTotalRecordCount(String.valueOf(totalCount));
-			sessObj.setLastError(0);
-			break;
-		/**
-		 * show indexes [order by table] By default: order by index names
-		 */
-		case SHOW_INDEXES:
-			boolean orderByIndex = true;
-			if (parser.hasMoreTokens()) {
-				String remainderStr = parser.getRemainderStr();
-				if (!remainderStr.equalsIgnoreCase(" order by table")) {
-					writeSyntaxError(this.queryStr, remainderStr);
-					break;
-				} else
-					orderByIndex = false;
-			}
-			if (sessObj.isDBConnExists())
-				this.handleShowIndexes(orderByIndex);
-			else
-				displayNoConnInfo();
-
-			break;
-
-		case SHOW_TABLE:
-
-			String ctlgName = null;
-			String schemaName = null;
-			String tableName = null;
-			String prepTableName = null;
-			String[] validOptions = { SqlEnum.INDEXES.toString(),
-					SqlEnum.SYNONYMS.toString(), SqlEnum.MVS.toString(),
-					SqlEnum.TRIGGERS.toString() };
-			int headingLength = 80;
-
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-
-			if (!parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				return;
-			}
-
-			if (!sessObj.isDBConnExists()) {
-				displayNoConnInfo();
-				break;
-			}
-
-			List<String> cstList = parser.getCSTList(parser.getRemainderStr());
-
-			if (cstList.size() == 0) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (parser.showTableIdxRemainder != null) {
-				prepTableName = parser.getRemainderStr().substring(
-						0,
-						parser.getRemainderStr().length()
-								- parser.showTableIdxRemainder.length());
-				parser.setRemainderStr(parser.getRemainderStr().substring(
-						prepTableName.length(),
-						parser.getRemainderStr().length()));
-			} else {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (!parser.getRemainderStr().trim().startsWith(",")) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				parser.setRemainderStr(parser.getRemainderStr().substring(1,
-						parser.getRemainderStr().length()));
-			}
-
-			switch (cstList.size()) {
-			case 3:
-				ctlgName = cstList.get(0);
-				schemaName = cstList.get(1);
-				tableName = cstList.get(2);
-				break;
-			case 2:
-				ctlgName = sessObj.getSessionCtlg();
-				schemaName = cstList.get(0);
-				tableName = cstList.get(1);
-				break;
-			case 1:
-				ctlgName = sessObj.getSessionCtlg();
-				schemaName = sessObj.getSessionSchema();
-				tableName = cstList.get(0);
-
-				break;
-			}
-
-			String keyWordToken = parser.getNextKeyToken();
-			String[] tmpOptions = null;
-			if (keyWordToken == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (keyWordToken.equalsIgnoreCase("ALL")) {
-				tmpOptions = validOptions;
-			} else {
-				tmpOptions = new String[1];
-				tmpOptions[0] = keyWordToken;
-			}
-
-			int howManyOptions = tmpOptions.length;
-			handleShowTableOptions(howManyOptions, keyWordToken, prepTableName,
-					tmpOptions, ctlgName, schemaName, tableName, headingLength);
-			break;
-
-		case SHOW_PREPARED:
-
-			totalCount = 0;
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-
-			PreparedStatement pStmt = null;
-			String stmtNamePattern = parser.getNextQValueToken();
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (!sessObj.isDBConnExists()) // Modified  2010-03-01
-			{
-				displayNoConnInfo();
-				break;
-			}
-
-			HashMap<String, Object[]> prepStmtMap = sessObj.getPrepStmtMap();
-			if ((prepStmtMap == null) || (prepStmtMap.isEmpty())) {
-				sessionError('E', SessionError.SHOW_PREP_NOT_FOUND);
-				break;
-			}
-			if (stmtNamePattern != null) {
-
-				if ((stmtNamePattern.indexOf("*") != -1)
-						|| (stmtNamePattern.indexOf("?") != -1))
-
-					stmtNamePattern = parser
-							.replaceShowPrepPattern(stmtNamePattern);
-
-				stmtNamePattern = utils.trimDoubleQuote(stmtNamePattern);
-				try {
-					stmtNamePattern = stmtNamePattern.replaceAll("_", ".");
-					stmtNamePattern = stmtNamePattern.replaceAll("%", ".*");
-				} catch (PatternSyntaxException pse) {
-					stmtNamePattern = "";
-				}
-			}
-			Map<String, Object[]> sortedMap = new TreeMap<String, Object[]>(prepStmtMap);
-			Iterator<String> it = sortedMap.keySet().iterator();
-			String key = null;
-			boolean found = false;
-
-			while (it.hasNext()) {
-				key = it.next();
-				try {
-					if ((stmtNamePattern == null || key
-							.matches(stmtNamePattern))
-							&& !key.equals(sessObj.getAutoPrepStmtName())) {
-						pStmt = (PreparedStatement) sessObj.getPrepStmtMap(key);
-						handleOutput(key, ((TrafT4Statement) pStmt).getSQL(),
-								false);
-						found = true;
-						totalCount++;
-					}
-				} catch (PatternSyntaxException pse) {
-					// No action required here
-				}
-			}
-
-			// If no matching statement names were found
-			// display a status message
-			if (!found) {
-				sessionError('E', SessionError.SHOW_PREP_NOT_FOUND);
-			}
-			sessObj.setTotalRecordCount(String.valueOf(totalCount));
-			printElapsedTime();
-			writer.writeEndTags(sessObj);
-			break;
-
-		case SHOW_HISTOPT:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			handleOutput("HISTOPT", (sessObj.isSessionHistoryAll() ? "ALL"
-					: "DEFAULT [No expansion of script files]"));
-			break;
-
-		case SHOW_AUTOPREPARE:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			handleOutput("AUTOPREPARE", (sessObj.isSessionAutoPrepare() ? "ON"
-					: "OFF"));
-			break;
-
-		case SHOW_ERRORCODE:
-		case SHOW_LASTERROR:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (showId == SHOW_LASTERROR)
-				handleOutput("LASTERROR",
-						String.valueOf(sessObj.getLastError()));
-			else
-				handleOutput("ERRORCODE",
-						String.valueOf(sessObj.getLastError()));
-
-			break;
-
-		case SHOW_ACTIVITYCOUNT:
-		case SHOW_RECCOUNT:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (!sessObj.isDBConnExists()) // Modified  2010-03-01
-			{
-				displayNoConnInfo();
-				break;
-			}
-
-			String recCount = sessObj.getTotalRecordCount();
-			if (showId == SHOW_RECCOUNT)
-				handleOutput("RECCOUNT", (recCount != null ? recCount : "0"));
-			else
-				handleOutput("ACTIVITYCOUNT", (recCount != null ? recCount
-						: "0"));
-
-			break;
-
-		case SHOW_STATISTICS:
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			handleOutput("STATISTICS", (sessObj.isSessionStatsEnabled() ? "ON"
-					: "OFF"));
-			break;
-
-		case SHOW_ACCESS:
-			if (!parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			handleDumpFileAccess();
-
-			break;
-
-		case SHOW_LOOKANDFEEL:
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			handleOutput("LOOK AND FEEL", (sessObj.getStrSessView()));
-			break;
-
-		case SHOW_ALIAS:
-			handleShowAlias();
-			break;
-
-		case SHOW_ALIASES:
-			handleShowAliases();
-			break;
-
-		case SHOW_FETCHSIZE:
-
-			if (!checkForMoreTokens())
-				handleOutput(
-						"FETCHSIZE",
-						String.valueOf(sessObj.getFetchSize())
-								+ (sessObj.getFetchSize() == 0 ? " [Default]"
-										: ""));
-			break;
-
-		case SHOW_PATTERNDEPTH:
-
-			if (!checkForMoreTokens())
-				handleOutput("PATTERNDEPTH",
-						String.valueOf(sessObj.getMaxPatternDepth()));
-			break;
-
-		case SHOW_PATTERN:
-			handleShowPattern();
-			break;
-
-		case SHOW_PATTERNS:
-			handleShowPatterns();
-			break;
-
-		case SHOW_DEBUG:
-			checkForMoreTokens();
-			handleOutput("DEBUG", (sessObj.isDebugOn() ? "ON" : "OFF"));
-			break;
-
-		case SHOW_CMDDISPLAY:
-			checkForMoreTokens();
-			handleOutput("CMDDISPLAY", (sessObj.isLogCmdEcho() ? "ON" : "OFF"));
-			break;
-
-		case SHOW_USER:
-			checkForMoreTokens();
-			if (sessObj.isDBConnExists()) {
-				handleOutput(
-						"USER",
-						sessObj.getSessionUser() + " ("
-								+ sessObj.getSessionRole() + ")");
-			} else {
-				displayNoConnInfo();
-			}
-			break;
-
-		case SHOW_SERVER:
-			checkForMoreTokens();
-			if (sessObj.isDBConnExists())
-				handleOutput("SERVER:PORT", sessObj.getSessionServer()
-						+ sessObj.getSessionPort());
-			else
-				displayNoConnInfo();
-			break;
-
-		case SHOW_CONNECTOPT:
-			checkForMoreTokens();
-			handleOutput("CONNECTOPT",
-					(sessObj.getTempSessionRole().length() == 0 ? "DEFAULT"
-							: sessObj.getTempSessionRole()));
-			break;
-		}
-	}
-
-	private void execSet() throws UnKnownInterfaceCommand, IOException,
-			SQLException, UserInterruption {
-
-		String setOption = parser.getNextKeyToken();
-		int setOpt;
-
-		// not a keyword..then its not ours
-
-		if (setOption == null) {
-			if (parser.hasMoreTokens()) {
-				throw uic;
-			}
-			sessionError('E', SessionError.SET_NO_OPTION);
-			return;
-		}
-
-		setOption = iqKeyMap.get("SET_" + setOption.toUpperCase());
-
-		if (setOption == null) {
-			throw uic;
-		}
-
-		int setId = Integer.parseInt(setOption);
-
-		String setValue = "";
-
-		switch (setId) {
-		case SET_CONNECTOPT:
-			setValue = parser.getNextKeyToken();
-			if (setValue == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (!setValue.toUpperCase().equals("ROLE")) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			setValue = parser.getNextValueToken();
-			if (setValue == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				sessObj.setTempSessionRole(setValue);
-			}
-			break;
-
-		case SET_TIME:
-
-			setValue = parser.getNextKeyToken();
-			if (setValue == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			setValue = setValue.toUpperCase();
-			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
-				writeSyntaxError(this.queryStr,
-						setValue + parser.getRemainderStr());
-				break;
-			}
-			if (setValue.equals("OFF") && parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr,
-						setValue + parser.getRemainderStr());
-				break;
-			}
-			String timeFormat = parser.getNextKeyToken();
-
-			if ((timeFormat != null) && !timeFormat.equalsIgnoreCase("12h")) {
-				writeSyntaxError(this.queryStr,
-						setValue + parser.getRemainderStr());
-				break;
-			}
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (setValue.equals("ON")) {
-				sessObj.setSessionTime(true);
-				if ((timeFormat != null)
-						&& (timeFormat.equalsIgnoreCase("12h")))
-					sessObj.setAmPmFmt(true);
-				else
-					sessObj.setAmPmFmt(false);
-
-			} else {
-				sessObj.setSessionTime(false);
-			}
-			envMap.put("TIME", (sessObj.isSessionTimeOn() ? "ON" : "OFF"));
-
-			break;
-
-		case SET_TIMING:
-
-			setOpt = getSetValue();
-			if (setOpt != -1) {
-				sessObj.setSessionTiming(setOpt == 1 ? true : false);
-			}
-			envMap.put("TIMING", (sessObj.isSessionTimingOn() ? "ON" : "OFF"));
-			break;
-
-		case SET_SQLPROMPT:
-
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-
-		case SET_PROMPT:
-
-			setValue = parser.getNextValueToken();
-			String regx1 = "\\s*(?i)";
-			String regx2 = "\\s*[>\\s]*\\s*";
-			if (setValue == null) {
-				if (SessionDefaults.SQL_MODE == sessObj.getMode())
-					sessObj.setSessionPrompt(SessionDefaults.DEFAULT_SQL_PROMPT);
-				else if (SessionDefaults.CS_MODE == sessObj.getMode())
-					sessObj.setSessionPrompt(SessionDefaults.DEFAULT_CS_PROMPT);
-				else if (SessionDefaults.WMS_MODE == sessObj.getMode())
-					sessObj.setSessionPrompt(SessionDefaults.DEFAULT_WMS_PROMPT);
-				envMap.put("PROMPT", sessObj.getSessionPrompt());
-				break;
-			} else if (setValue.matches(regx1 + SessionDefaults.SQL + regx2)) {
-				sessionError('E', SessionError.SQL_RESERVED_WORD_ERROR);
-				break;
-			} else if (setValue.matches(regx1 + SessionDefaults.CS + regx2)) {
-				sessionError('E', SessionError.CS_RESERVED_WORD_ERROR);
-				break;
-			} else if (setValue.matches(regx1 + SessionDefaults.WMS + regx2)) {
-				sessionError('E', SessionError.WMS_RESERVED_WORD_ERROR);
-				break;
-			}
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				// Added  to deal with non-connection situation
-				if (!sessObj.isDBConnExists()
-						&& (setValue.toUpperCase().indexOf("%USER") != -1
-								|| setValue.toUpperCase().indexOf("%SCHEMA") != -1
-								|| setValue.toUpperCase().indexOf("%SERVER") != -1
-								|| setValue.toUpperCase().indexOf("%MODE") != -1
-								|| setValue.toUpperCase()
-										.indexOf("%DATASOURCE") != -1 || setValue
-								.toUpperCase().indexOf("%ROLE") != -1)) {
-					displayNoConnInfo();
-					break;
-				}
-				sessObj.setSessionPrompt(setValue);
-			}
-			envMap.put("PROMPT", sessObj.getSessionPrompt());
-			break;
-
-		case SET_SQLTERMINATOR:
-
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-			setValue = parser.getNextValueToken();
-			if (setValue == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				sessObj.setSessionSQLTerminator(setValue);
-				sessObj.setTermEventMap(
-						Integer.toString(sessObj.getHistCmdNo() + 1), setValue);
-				sessObj.setTermEvent(Integer.toString(sessObj.getHistCmdNo() + 1));
-			}
-			envMap.put("SQLTERMINATOR", sessObj.getSessionSQLTerminator());
-			break;
-
-		case SET_IDLETIMEOUT:
-			int intSetValue = 0;
-			setValue = parser.getNextNumberToken();
-			if (setValue == null || setValue.trim().equals("")) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				try {
-					intSetValue = Integer.parseInt(setValue);
-					if (intSetValue < 0)
-						throw (new NumberFormatException());
-					else
-						sessObj.setSessionIdletime(intSetValue);
-					envMap.put("IDLETIMEOUT",
-							Integer.toString(sessObj.getSessionIdletime()));
-				} catch (NumberFormatException nfe) {
-					sessionError('E', SessionError.SET_IDLETIMEOUT_VAL_ERR);
-				}
-			}
-
-			break;
-
-		case SET_PARAM:
-
-			String paramName = parser.getNextParamToken();
-			if (paramName == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			/**
-			 * Use the new method to get the parameter value and validate that
-			 * the value is syntactically correct.
-			 */
-			ParamStringObject psv = parser.getParamValue(null);
-			if (null != psv) {
-				setValue = psv.toString();
-
-				try {
-					if (sessObj.isDebugOn())
-						System.out.println("@@@Debug: InterfaceQuery:: psv = "
-								+ psv.toString());
-
-					String theActualValue = psv.getParameterValue();
-
-					if (sessObj.isDebugOn())
-						System.out.println("@@@Debug: InterfaceQuery:: psv "
-								+ "getParamValue= " + theActualValue);
-
-				} catch (Exception exc) {
-					setValue = null;
-
-					ErrorObject eo = new ErrorObject(
-							SessionError.INVALID_PARAM_STRING_VALUE, "",
-							exc.getMessage());
-					sessionError('E', eo);
-					break;
-				}
-
-			} else
-				setValue = null;
-
-			if (sessObj.isDebugOn())
-				System.out.println("@@@Debug: InterfaceQuery:: setValue "
-						+ setValue);
-
-			if (setValue == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (sessObj.isDebugOn())
-				System.out.println("@@@Debug: InterfaceQuery:: parser has "
-						+ "more tokens = " + parser.hasMoreTokens());
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			sessObj.setSessParams(paramName, setValue);
-			break;
-
-		case SET_DISPLAY_COLSIZE:
-			if (sessObj.getMode() != SessionDefaults.WMS_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-			setValue = parser.getNextValueToken();
-			if (setValue == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				try {
-					int dispColSize = Integer.parseInt(setValue);
-					if (dispColSize <= 0)
-						throw (new NumberFormatException());
-					else {
-						sessObj.setDisplayColSize(dispColSize);
-					}
-				} catch (NumberFormatException nfe) {
-					// sessionError('E',SessionError.SET_LISTCOUNT_VAL_ERR);
-				}
-			}
-			break;
-
-		case SET_LISTCOUNT:
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-			int intListCntValue = 0;
-			setValue = parser.getNextNumberToken();
-			if (setValue == null || setValue.trim().equals("")) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				try {
-					intListCntValue = Integer.parseInt(setValue);
-					if (intListCntValue < 0)
-						throw (new NumberFormatException());
-					else {
-						sessObj.setListCount(intListCntValue);
-					}
-					envMap.put("LIST_COUNT",
-							Integer.toString(sessObj.getListCount()));
-				} catch (NumberFormatException nfe) {
-					sessionError('E', SessionError.SET_LISTCOUNT_VAL_ERR);
-				}
-			}
-			break;
-
-		case SET_COLSEP:
-
-			setValue = parser.getNextValueToken();
-			if (setValue == null) {
-				sessObj.setSessionColSep(" ");
-				break;
-			}
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				sessObj.setSessionColSep(setValue);
-			}
-			envMap.put("COLSEP", sessObj.getSessionColSep());
-			break;
-
-		case SET_HISTOPT:
-
-			setValue = parser.getNextKeyToken();
-			if (setValue == null) {
-				sessObj.setSessionHistoryAll(false);
-				break;
-			}
-			setValue = setValue.toUpperCase();
-			if (!setValue.equals("ALL") && !setValue.equals("DEFAULT")) {
-				writeSyntaxError(this.queryStr,
-						setValue + parser.getRemainderStr());
-				break;
-			}
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (setValue.equals("ALL")) {
-				sessObj.setSessionHistoryAll(true);
-			} else {
-				sessObj.setSessionHistoryAll(false);
-			}
-			envMap.put("HISTOPT", sessObj.isSessionHistoryAll() ? "ALL"
-					: "DEFAULT [No expansion of script files]");
-			break;
-
-		case SET_STATISTICS:
-
-			setValue = parser.getNextKeyToken();
-			if (setValue == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			setValue = setValue.toUpperCase();
-			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
-				writeSyntaxError(this.queryStr,
-						setValue + parser.getRemainderStr());
-				break;
-			}
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (setValue.equals("ON")) {
-				sessObj.setSessionStatsEnabled(true);
-			} else {
-				sessObj.setSessionStatsEnabled(false);
-			}
-			envMap.put("STATISTICS", sessObj.isSessionStatsEnabled() ? "ON"
-					: "OFF");
-			break;
-
-		case SET_MARKUP:
-
-			setValue = parser.getNextValueToken();
-			if (setValue == null) {
-				sessObj.setStrDisplayFormat("RAW");
-				break;
-			}
-
-			if ((!setValue.toUpperCase().equals("RAW"))
-					&& (!setValue.toUpperCase().equals("XML"))
-					&& (!setValue.toUpperCase().equals("HTML"))
-					&& (!setValue.toUpperCase().equals("CSV"))
-					&& (!setValue.toUpperCase().equals("COLSEP"))) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				sessObj.setStrDisplayFormat(setValue);
-			}
-			envMap.put("MARKUP", sessObj.getStrDisplayFormat());
-			break;
-
-		case SET_AUTOPREPARE:
-
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-			setOpt = getSetValue();
-			if (setOpt != -1) {
-				sessObj.setSessionAutoPrepare(setOpt == 1 ? true : false);
-			}
-			break;
-
-		case SET_LOOKANDFEEL:
-
-			setValue = parser.getNextValueToken();
-			if (setValue == null || setValue == "") {
-				sessObj.setSessView(SessionDefaults.CIDEFAULT_VIEW);
-				sessObj.setSessionPrompt(SessionDefaults.DEFAULT_SQL_PROMPT);
-				break;
-			}
-			if ((!setValue.matches("(?i)\\s*(MXCI|TRAFCI)"))
-					|| parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			} else {
-				if (setValue.equalsIgnoreCase("MXCI")) {
-					sessObj.setSessView(SessionDefaults.MXCI_VIEW);
-					sessObj.setSessionPrompt(">>");
-				} else {
-					if (sessObj.isCmdEchoEnabled()
-							&& sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
-						sessObj.setCmdEcho(false);
-
-					sessObj.setSessView(SessionDefaults.CIDEFAULT_VIEW);
-					sessObj.setSessionPrompt(SessionDefaults.DEFAULT_SQL_PROMPT);
-				}
-			}
-			envMap.put("LOOK_AND_FEEL", sessObj.getStrSessView());
-			break;
-
-		case SET_CMDECHO:
-
-			setValue = parser.getNextKeyToken();
-			if (setValue == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			setValue = setValue.toUpperCase();
-			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
-				writeSyntaxError(this.queryStr,
-						setValue + parser.getRemainderStr());
-				break;
-			}
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (setValue.equals("ON")) {
-				sessObj.setCmdEcho(true);
-			} else {
-				sessObj.setCmdEcho(false);
-			}
-			break;
-
-		case SET_FETCHSIZE:
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-			setValue = parser.getNextNumberToken();
-			if (setValue == null || parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			try {
-				int fetchSize = Integer.parseInt(setValue);
-
-				if (fetchSize < 0)
-					throw (new NumberFormatException());
-				else {
-					sessObj.setFetchSize(fetchSize);
-				}
-			} catch (NumberFormatException nfe) {
-				sessionError('E', SessionError.SET_FETCHSIZE_VAL_ERR);
-			}
-			break;
-
-		case SET_PATTERN:
-			String key = null;
-
-			if ((key = parser.getPatternKeyPattern()) != null) {
-				if (envMap.containsKey(key.toUpperCase())) {
-					sessionError(
-							'E',
-							new ErrorObject(
-									SessionError.COMMAND_NAME_NOT_ALLOWED,
-									"",
-									key.toUpperCase()
-											+ SessionError.PATTERN_COMMAND_NAME_NOT_ALLOWED_SUFFIX));
-					return;
-				}
-				if (sessObj.isDebugOn())
-					System.out.println("SET_PATTERN :: key:" + key);
-
-				setValue = parser.getPatternValueToken();
-
-				if (sessObj.isDebugOn())
-					System.out.println("SET_PATTERN :: value:" + setValue + "");
-
-				if (setValue == null || parser.hasMoreTokens()) {
-					writeSyntaxError(this.queryStr, parser.getRemainderStr());
-					break;
-				}
-				sessObj.setPattern(key, setValue);
-				break;
-			} else if ((key = parser.getRegexpPattern()) != null) {
-				try {
-					Pattern.compile(key);
-				} catch (PatternSyntaxException pse) {
-					sessionError('E', SessionError.INVALID_REGEXP);
-					break;
-				}
-				if (sessObj.isDebugOn())
-					System.out.println("SET_PATTERN :: RegExp:" + key);
-
-				setValue = parser.getRegexpValue();
-
-				if (sessObj.isDebugOn())
-					System.out.println("SET_PATTERN :: value:" + setValue);
-
-				if ((setValue == null) || parser.hasMoreTokens()) {
-					writeSyntaxError(this.queryStr, "");
-					break;
-				}
-				sessObj.setRegExpPattern(key, setValue);
-			} else {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			break;
-
-		case SET_PATTERNDEPTH:
-			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
-				this.invalidCmdforMode(sessObj.getMode());
-				break;
-			}
-			setValue = parser.getNextNumberToken();
-			if (setValue == null || parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			try {
-				int maxPatternDepth = Integer.parseInt(setValue);
-
-				if (maxPatternDepth < 0
-						|| maxPatternDepth > SessionDefaults.PATTERN_DEPTH_LIMIT)
-					throw (new NumberFormatException());
-				else {
-					sessObj.setMaxPatternDepth(maxPatternDepth);
-				}
-			} catch (NumberFormatException nfe) {
-				sessionError('E', SessionError.SET_PATTERN_DEPTH_VAL_ERR);
-			}
-			break;
-
-		case SET_DEBUG:
-			setValue = parser.getNextKeyToken();
-			if (setValue == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			setValue = setValue.toUpperCase();
-			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
-				writeSyntaxError(this.queryStr,
-						setValue + parser.getRemainderStr());
-				break;
-			}
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			if (setValue.equals("ON")) {
-				sessObj.setDebugOn(true);
-			} else {
-				sessObj.setDebugOn(false);
-			}
-			break;
-
-		case SET_CMDDISPLAY:
-
-			setValue = parser.getNextKeyToken();
-			if (setValue == null) {
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-				break;
-			}
-			setValue = setValue.toUpperCase();
-			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
-				writeSyntaxError(this.queryStr,
-						setValue + parser.getRemainderStr());
-				break;
-			}
-			if (parser.hasMoreTokens()) {
-				writeSyntaxError(this.queryStr,
-						setValue + parser.getRemainderStr());
-				break;
-			}
-			if (setValue.equals("ON")) {
-				sessObj.setLogCmdEcho(true);
-				if (sessObj.isDotModeCmd()) {
-					sessObj.setDotModeCmd(false);
-					sessObj.setHistOn(false);
-				}
-			} else {
-				sessObj.setLogCmdEcho(false);
-			}
-			break;
-		}
-	}
-
-	int getSetValue() throws IOException {
-		String setValue = parser.getNextKeyToken();
-		if (setValue == null) {
-			return 0;
-		}
-		if (parser.hasMoreTokens()) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return -1;
-		}
-		if (setValue.equalsIgnoreCase("ON"))
-			return (1);
-		else if (setValue.equalsIgnoreCase("OFF"))
-			return (0);
-		else {
-			writeSyntaxError(this.queryStr, setValue + parser.getRemainderStr());
-			return -1;
-		}
-	}
-
-	private void writeSyntaxError(String queryStr, String remainderStr)
-			throws IOException {
-		sessObj.getQuery().setStatusCode(-1); // update the error code to -1
-
-		if (sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-			writer.writeln();
-
-		writer.writeSyntaxError(sessObj, this.queryStr, remainderStr);
-	}
-
-	private void invalidCmdforMode(int mode) throws IOException {
-		switch (mode) {
-		case SessionDefaults.WMS_MODE:
-			sessionError('E', SessionError.CMD_NOT_WMS_SUPPORTED);
-			break;
-		case SessionDefaults.SQL_MODE:
-			sessionError('E', SessionError.CMD_NOT_SQL_SUPPORTED);
-			break;
-		case SessionDefaults.CS_MODE:
-			sessionError('E', SessionError.CMD_NOT_CS_SUPPORTED);
-			break;
-		}
-	}
-
-	private void sessionError(char errType, ErrorObject errObj)
-			throws IOException {
-		sessObj.getQuery().setStatusCode(-1); // update the error code to -1
-
-		if (sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-			writer.writeln();
-
-		sessObj.setLastError(Integer.parseInt(errObj.errorCode()));
-		writer.writeError(sessObj, errObj);
-	}
-
-	void saveFile(String fileName, boolean append) throws IOException {
-		FileWriter historyWriter = new FileWriter();
-		try {
-			historyWriter.setAppend(append);
-			historyWriter.initialize(fileName);
-
-			List<Vector<String>> historyList = sessObj.getQryHistory();
-			if (historyList != null) {
-				for (int i = 0; i < historyList.size(); i++) {
-					historyWriter.writeln((historyList.get(i)).get(1));
-				}
-			}
-			historyWriter.close();
-		} catch (FileNotFoundException fnfe) {
-			sessionError('E', SessionError.SAVE_FILE_CREATE_ERROR);
-			return;
-		} catch (IOException e) {
-			historyWriter = null;
-			throw e;
-		}
-	}
-
-	private void execGet() throws UnKnownInterfaceCommand, IOException,
-			SQLException {
-
-		// We dont have any interface commands with GET currently
-		// This method has been created for future use
-		throw uic;
-	}
-
-	private void handleVersion() throws IOException, SQLException {
-		if (parser.hasMoreTokens()) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		} else
-			displayVersionInfo(!sessObj.getPlatformObjectVersions());
-	}
-
-	private void displayVersionInfo(boolean srvrErrMsg) throws IOException {
-		String platformVersion = sessObj.getSutVersion();
-		String mxoSrvrVersion  = sessObj.getNdcsVersion();
-                String databaseVersion = sessObj.getDatabaseVersion();
-                String databaseEdition = sessObj.getDatabaseEdition();
-
-		if (databaseVersion != null &&  databaseEdition != null) {
-                    handleOutput("Database Version            : Release ", databaseVersion);
-                    handleOutput("Database Edition            :", databaseEdition,false);
-                } else {
-                    handleOutput("Database Version            :", this.infoNotAvailable, false);
-                    handleOutput("Database Edition            :", this.infoNotAvailable, false);
-                }
-                handleOutput("JDBC Type 4 Driver Build ID :", JDBCVproc.getVproc(), false);
-                handleOutput("Command Interface Build ID  :", Vproc.getVproc(), false);
-               
-		writer.writeEndTags(sessObj);
-	}
-
-	private void handleConnect() throws IOException, UserInterruption {
-		List<String> connectArgsList = new ArrayList<String>();
-
-		String connArgStr = null;
-		String newServer = null;
-		connArgStr = parser.getConnArg("user");
-
-		// if the user name is not specified but other args are specified..then
-		// throw an error
-		if (connArgStr != null) {
-			connectArgsList.add("-u");
-			connectArgsList.add(connArgStr);
-		} else if (connArgStr == null && parser.hasMoreTokens()) {
-			connectArgsList = null;
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		}
-		connArgStr = parser.getConnArg("pass");
-
-		// if the password is not specified but the other args specified..then
-		// throw syntax error
-		if (connArgStr != null) {
-			connectArgsList.add("-p");
-			connectArgsList.add(connArgStr);
-		}
-		connArgStr = newServer = parser.getConnArg("server");
-
-		if (connArgStr != null) {
-			connectArgsList.add("-h");
-			connectArgsList.add(connArgStr);
-		}
-		/*connArgStr = parser.getConnArg("dsn");
-
-		if (connArgStr != null) {
-			connectArgsList.add("-dsn");
-			connectArgsList.add(connArgStr);
-		} */
-
-		if (parser.hasMoreTokens()) {
-			connectArgsList = null;
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		}
-
-		String[] connectArgs = new String[connectArgsList.size()];
-		connectArgsList.toArray(connectArgs);
-
-		// parse the arguments and validate the user credentials
-		ParseArguments paObj = new ParseArguments(sessObj.getConsoleReader(),
-				sessObj.getConsoleWriter());
-		SessionInterface siObj = null;
-		paObj.setDefaults(SessionDefaults.dsnName, SessionDefaults.portNumber);
-
-		paObj.serverName = sessObj.getSessionServer();
-		if (sessObj.isDebugOn()) {
-			System.out.println(this.getClass().getName() + "NewServer:: "
-					+ newServer);
-			System.out.println(this.getClass().getName() + ":: "
-					+ paObj.serverName);
-			System.out.println(this.getClass().getName() + "::SessionPort:: "
-					+ sessObj.getSessionPort());
-			System.out.println(this.getClass().getName() + "::SessionServer:: "
-					+ sessObj.getSessionServer());
-		}
-		if (newServer != null) {
-			String newServer1[] = newServer.split(":");
-			if (newServer1.length > 0
-					&& newServer1[0].equalsIgnoreCase(sessObj
-							.getSessionServer()))
-				paObj.portNumber = sessObj.getSessionPort();
-			else
-				paObj.portNumber = ":" + SessionDefaults.portNumber;
-		} else
-			paObj.portNumber = sessObj.getSessionPort();
-
-		//paObj.dsnName = sessObj.getSessionDsn();
-
-		if (sessObj.isDebugOn()) {
-			System.out.println("Session Role::" + sessObj.getSessionRole());
-			System.out.println("Temp Session Role::"
-					+ sessObj.getTempSessionRole());
-		}
-
-		// String theRole=null;
-		// if (sessObj.getConnObj() != null) {
-		String theRole = sessObj.getTempSessionRole();
-		if ((null == theRole) || (0 >= theRole.length()))
-			theRole = "";
-		// }
-		paObj.roleName = theRole;
-
-		// Set the retry count to 1 if connect command is being invoked
-		// from OBEY or PRUN script files.
-		if ((sessObj.getReader().getReadMode() == SessionDefaults.OBEY_READ_MODE)
-				|| (sessObj.getCaller() == PRUNI)) {
-			paObj.retryCnt = 1;
-		}
-		while (paObj.retryCnt > 0) {
-			sessObj.setLastError(0);
-			try {
-				paObj.setAutoLogin(false);
-				connectArgs = paObj.validateArgs(connectArgs);
-				siObj = new SessionInterface(sessObj);
-				sessObj.setQryStartTime();
-
-				if (sessObj.isDebugOn())
-					System.out.println("CONNECT: " + paObj.userName + "|"
-							+ paObj.roleName + "|" + paObj.serverName + "|"
-							+ paObj.dsnName + "|" + paObj.portNumber);
-				// Get a new connection with the args specified, if success then
-				// close the previous connection
-				newConn = siObj.getConnection(paObj.userName, paObj.password,
-						paObj.roleName, paObj.serverName, paObj.dsnName,
-						paObj.portNumber);
-
-				if (newConn != null) {
-					try {
-						if (sessObj.getConnObj() != null) {
-							sessObj.getConnObj().getWarnings();
-							sessObj.getConnObj().close();
-							sessObj.setDBConnExists(false);
-						} else {
-							startTimerTask(newConn);
-						}
-					} catch (SQLException sqle) {
-					}
-
-					sessObj.setConnObj(newConn);
-					sessObj.setSessionUser(paObj.userName);
-					sessObj.setSessionPass(paObj.password);
-					sessObj.setSessionSever(paObj.serverName);
-					sessObj.setSessionPort(paObj.portNumber);
-					sessObj.setSessionValues();
-					sessObj.setStmtObj(siObj.getStatement(newConn));
-					sessObj.qsOpen = false;
-					sessObj.setDBConnExists(true);
-                                        boolean trafver = sessObj.getPlatformObjectVersions();
-
-					// Uncomment this line if you need to reset role to DEFAULT;
-					// TempSessionRole is set using SET CONNECTIOPT command
-					// sessObj.setTempSessionRole("");
-					//writer.writeln();
-
-			                writer.writeln("Connected to " + sessObj.getDatabaseEdition());
-
-					sessObj.setQryEndTime();
-					if (printConnTime) {
-						printElapsedTime();
-						writer.writeEndTags(sessObj);
-					}
-
-				}
-
-				paObj.retryCnt = 0;
-
-			} // end try
-			catch (Exception e) {
-				paObj.retryCnt--;
-				connectArgs = handleConnException(e, paObj, connectArgs);
-			}
-
-			finally {
-				newConn = null;
-			}
-		} // end while
-
-	}
-
-	private void handleReconnect() throws IOException, UserInterruption {
-		boolean prevConn = false;
-		if (parser.hasMoreTokens()) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		}
-
-		// if a connection exists already, close it before creating new one.
-		if (sessObj.getConnObj() != null) {
-			prevConn = true;
-			try {
-				sessObj.getConnObj().getWarnings();
-				sessObj.getConnObj().close();
-				// sessObj.setConnObj(null);
-			} catch (SQLException sqle) {
-
-			}
-		}
-		sessObj.setDBConnExists(false);
-
-		List<String> reconnectArgsList = new ArrayList<String>();
-
-		if (sessObj.getSessionUser() != null) {
-			reconnectArgsList.add("-u");
-			reconnectArgsList.add(sessObj.getSessionUser());
-		}
-		if (sessObj.getSessionPass() != null) {
-			reconnectArgsList.add("-p");
-			reconnectArgsList.add(sessObj.getSessionPass());
-		}
-		if (sessObj.getSessionServer() != null) {
-			reconnectArgsList.add("-h");
-			reconnectArgsList.add(sessObj.getSessionServer()
-					+ sessObj.getSessionPort());
-		}
-		/*if (sessObj.getSessionDsn() != null) {
-			reconnectArgsList.add("-dsn");
-			reconnectArgsList.add(sessObj.getSessionDsn());
-		}*/
-
-		if (sessObj.getSessionRole() != null) {
-			reconnectArgsList.add("-r");
-			reconnectArgsList.add(sessObj.getSessionRole());
-		}
-
-		String[] reconnectArgs = new String[reconnectArgsList.size()];
-		reconnectArgsList.toArray(reconnectArgs);
-		reconnectArgsList = null;
-
-		// parse the arguments and validate the user credentials
-		ParseArguments rcPaObj = new ParseArguments(sessObj.getConsoleReader(),
-				sessObj.getConsoleWriter());
-		SessionInterface rcSIObj = null;
-
-		rcPaObj.setDefaults(SessionDefaults.dsnName, SessionDefaults.portNumber);
-
-		// Set the retry count to 1 if connect command is being invoked
-		// from OBEY or PRUN script files.
-		if ((sessObj.getReader().getReadMode() == SessionDefaults.OBEY_READ_MODE)
-				|| (sessObj.getCaller() == PRUNI)) {
-			rcPaObj.retryCnt = 1;
-		}
-		while (rcPaObj.retryCnt > 0) {
-			sessObj.setLastError(0);
-			try {
-				rcPaObj.setAutoLogin(false);
-				reconnectArgs = rcPaObj.validateArgs(reconnectArgs);
-				sessObj.setQryStartTime();
-
-				sessObj.setSessionUser(rcPaObj.userName);
-				sessObj.setSessionPass(rcPaObj.password);
-				sessObj.setSessionSever(rcPaObj.serverName);
-				sessObj.setSessionPort(rcPaObj.portNumber);
-				//sessObj.setSessionDsn(rcPaObj.dsnName);
-				// Session role will be null only in noconnect mode
-				if (sessObj.getSessionRole() == null)
-					sessObj.setSessionRole(rcPaObj.roleName);
-
-				rcSIObj = new SessionInterface(sessObj);
-
-				if (sessObj.isDebugOn())
-					System.out.println("RECONNECT: " + rcPaObj.userName + "|"
-							+ rcPaObj.roleName + "|" + rcPaObj.serverName + "|"
-							+ rcPaObj.dsnName + "|" + rcPaObj.portNumber);
-
-				sessObj.setConnObj(rcSIObj.getConnection());
-				sessObj.setSessionValues();
-				if (!sessObj.isDBConnExists())
-					startTimerTask(sessObj.getConnObj());
-				sessObj.setStmtObj(rcSIObj.getStatement(sessObj.getConnObj()));
-				sessObj.qsOpen = false;
-				sessObj.setDBConnExists(true);
-                                boolean trafver = sessObj.getPlatformObjectVersions();
-				writer.writeln();
-				writer.writeln("Connected to " + sessObj.getDatabaseEdition());
-				rcPaObj.retryCnt = 0;
-
-				sessObj.setQryEndTime();
-
-			} catch (Exception ex) {
-				rcPaObj.retryCnt--;
-				reconnectArgs = handleConnException(ex, rcPaObj, reconnectArgs);
-			}
-
-		} // end while
-		if (printConnTime) {
-			printElapsedTime();
-			writer.writeEndTags(sessObj);
-		}
-
-	}
-
-	private String[] handleConnException(Exception e, ParseArguments pa,
-			String[] args) throws IOException, UserInterruption {
-		sessObj.getQuery().setStatusCode(-1); // update the error code to -1
-		sessObj.setLastError(-1);
-		if (e instanceof InvalidNumberOfArguments) {
-			writer.writeln(e.toString());
-		} else if (e instanceof IOException) {
-			if (!(e instanceof UnknownHostException))
-				writer.writeln(e.toString());
-
-		} else if (e instanceof InstantiationException) {
-			writer.writeln(e.toString());
-		} else if (e instanceof IllegalAccessException) {
-			writer.writeln(e.toString());
-		} else if (e instanceof ClassNotFoundException) {
-			writer.writeln(e.toString());
-		} else if (e instanceof UserInterruption) {
-			throw ((UserInterruption) e);
-		} else if (e instanceof SQLException) {
-			writer.writeln();
-			sessObj.setLastError(((SQLException) e).getErrorCode());
-			// catch the known errors report them with an user friendly text
-			if (((SQLException) e).getErrorCode() == SessionDefaults.SQL_ERR_CONN_MAX_LIMIT) {
-				System.out.println(SessionError.CONN_MAX_LIMIT_ERR);
-				if (doTrace)
-					e.printStackTrace();
-				System.exit(SessionDefaults.abruptExit);
-			} else {
-				String errStr = e.toString();
-
-				if (errStr.indexOf("org.trafodion.jdbc.t4") != -1)
-					errStr = errStr.substring(errStr.indexOf(":") + 1);
-
-				writer.write(errStr + SessionDefaults.lineSeperator);
-				// identify those args that caused the exception
-
-				if ((((SQLException) e).getErrorCode() == SessionDefaults.SQL_ERR_INVALID_AUTH)
-						|| (((SQLException) e).getErrorCode() == SessionDefaults.SQL_ERR_CLI_AUTH)) {
-					pa.userName = null;
-					pa.password = null;
-					pa.roleName = null;
-
-				} else
-					pa.serverName = null;
-
-				// rebuild args list and remove only those that caused the
-				// exception
-				args = pa.rebuildArgList(args);
-
-			}
-		} // end SQLException
-
-		return args;
-	}
-
-	private void handleDisConnect() throws IOException {
-		boolean exitFlag = false;
-		String errorCodeReturn = "";
-		int exitCode = SessionDefaults.DEFAULT_EXIT_CODE;
-		String strPendingAction = null;
-
-		if (parser.hasMoreTokens()) {
-
-			Matcher exitMat = parser.exitPat.matcher(parser.getRemainderStr());
-
-			if (exitMat.find()) {
-
-				errorCodeReturn = exitMat.group(3);
-				if (errorCodeReturn == null)
-					errorCodeReturn = exitMat.group(4);
-
-				errorCodeReturn = (errorCodeReturn == null || errorCodeReturn
-						.equals("")) ? SessionDefaults.DEFAULT_EXIT_CODE + ""
-						: errorCodeReturn;
-
-				try {
-					exitCode = Integer.parseInt(errorCodeReturn.trim());
-				} catch (NumberFormatException e) {
-					return;
-				}
-
-				String strCondition = exitMat.group(5);
-
-				if (strCondition != null) {
-					String strConditional = strCondition.trim() + " THEN EXIT"
-							+ sessObj.getSessionSQLTerminator();
-					ConditionalQuery cqObj = sessObj.getCQryObj();
-
-					sessObj.getQuery().setQueryId(IF_THEN);
-					sessObj.getQuery().resetQueryText(strConditional);
-
-					try {
-						cqObj.execute();
-						strPendingAction = cqObj.getPendingAction();
-						if (strPendingAction != null
-								&& strPendingAction.equals("EXIT"
-										+ sessObj.getSessionSQLTerminator())) {
-							exitFlag = true;
-							sessObj.getQuery().setQueryId(EXIT);
-						}
-
-					} catch (ConditionalQueryException ex) {
-						if (ex.getErrorMsg() != null)
-							writer.writeInterfaceErrors(sessObj,
-									ex.getErrorMsg());
-						else
-							writer.writeConditionalSyntaxError(sessObj,
-									cqObj.getQueryString());
-
-						return;
-					} catch (UserInterruption ui) {
-						if (sessObj.isQueryInterrupted()) {
-							sessObj.setQueryInterrupted(false);
-							writer.writeln();
-							writer.writeInterfaceErrors(sessObj,
-									SessionError.OPERATION_CANCELLED);
-						}
-						return;
-					} catch (IOException e) {
-						System.out
-								.println("IO Exception occurred while processing conditional query :"
-										+ e);
-					}
-
-				} else {
-					exitFlag = true;
-				}
-			} else
-				writeSyntaxError(this.queryStr, parser.getRemainderStr());
-		} else {
-			exitFlag = true;
-		}
-
-		if (sessObj.getQuery().getQueryId() == DISCONNECT && exitFlag) {
-			if (sessObj.getConnObj() != null) {
-				try {
-					// Added if statement  2010-03-25
-					// Move the if statement from handleModeCommand to here
-					// For Mode commmand can run on non-connection status.
-					if (sessObj.getMode() == SessionDefaults.WMS_MODE) {
-						sessObj.getStmtObj().execute("WMSCLOSE");
-						sessObj.qsOpen = false;
-					}
-
-					sessObj.getConnObj().getWarnings();
-					sessObj.getConnObj().close();
-				} catch (SQLException sqle) {
-
-				}
-			}
-			sessObj.setMxosrvrVersion(null);
-			sessObj.setSutVersion(null);
-			// sessObj.setConnObj(null);
-			sessionError('E', SessionError.SESSION_DISCONNECT_ERR);
-			sessObj.setDBConnExists(false);
-			return;
-		}
-
-		if (sessObj.getQuery().getQueryId() == EXIT && exitFlag) {
-			// Need to close the connection so that MXCS can do
-			// the cleanup of resources
-			try {
-				if (conn != null)
-					conn.close();
-			} catch (SQLException sqlEx) {
-				// Ignore the exception
-			}
-			sessObj.setPatternsLoaded(false);
-			sessObj.setSessionStatus(false);
-			sessObj.setExitCode(exitCode);
-		}
-	}
-
-	private void handleHostCommand() throws IOException {
-		if (sessObj.getCaller() != PRUNI)
-			try {
-				Signal.handle(INTSignal, LHCTRLCHandler);
-			} catch (Exception e) {
-			}
-
-		if (!parser.hasMoreTokens()) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		}
-
-		TerminalProcessBridge procStdOut = null;
-		TerminalProcessBridge procStdErr = null;
-		TerminalProcessBridge procStdIn = null;
-
-		try {
-//			int idx;
-			String osName = System.getProperty("os.name");
-			StringBuffer osCommand = new StringBuffer();
-
-			if ((null != osName)
-					&& osName.trim().toUpperCase().startsWith("WINDOW")) {
-				osCommand.append("cmd /c");
-
-				if (osName.trim().toUpperCase().equals("WINDOWS 95")) {
-					osCommand.setLength(0);
-					osCommand.append("command /c");
-				}
-			}
-			osCommand.append(parser.getRemainderStr());
-			if (osCommand.lastIndexOf(" cd ") >= 0)
-				System.out.println("cd is not supported by localhost command");
-			else {
-				if (TerminalProcessBridge._debugOn)
-					System.out.println("** Debug*** ==>  running command : "
-							+ osCommand.toString());
-				Process osProcess;
-				if ((null != osName)
-						&& osName.trim().toUpperCase().startsWith("WINDOW"))
-					osProcess = Runtime.getRuntime().exec(osCommand.toString());
-				else
-					osProcess = Runtime.getRuntime().exec(
-							new String[] { "sh", "-c", osCommand.toString() });
-
-				procStdOut = new TerminalProcessBridge(
-						osProcess.getInputStream(), writer);
-				procStdOut.setTag("STDOUT");
-				procStdErr = new TerminalProcessBridge(
-						osProcess.getErrorStream(), System.err);
-				procStdErr.setTag("STDERR");
-				procStdIn = new TerminalProcessBridge(System.in,
-						osProcess.getOutputStream(), false);
-				procStdIn.setTag("STDIN");
-
-				// Start the threads.
-				procStdOut.start();
-				procStdErr.start();
-				procStdIn.start();
-
-				// check for errors.
-				int exitVal = osProcess.waitFor();
-				if (TerminalProcessBridge._debugOn)
-					System.out
-							.println("** Debug*** ==>  ExitValue: " + exitVal);
-			}
-		} catch (Throwable t) {
-			String msg = t.getMessage();
-			writer.writeln(msg.substring(msg.indexOf(":") + 1));
-
-		} finally {
-			if (null != procStdIn)
-				procStdIn.stopReading();
-
-			try {
-//				Thread.currentThread().yield();
-				Thread.yield();
-			} catch (Exception e) {
-			}
-		}
-		sessObj.setQryEndTime();
-		printElapsedTime();
-		writer.writeEndTags(sessObj);
-	}
-
-	private void handleRepeatCommand(String cmdStr, int cmdNo)
-			throws IOException, SQLException, UserInterruption,
-			UnKnownInterfaceCommand {
-		// If no commands present in history return
-		List<Vector<String>> historyList = sessObj.getQryHistory();
-
-		if (sessObj.getQryHistory() == null) {
-			sessionError('E', SessionError.REPEAT_ERR);
-			sessObj.setQuery(null);
-			return;
-		}
-		int historySize = sessObj.getQryHistory().size();
-		// If no tokens present, return the previous command
-		if (!parser.hasMoreTokens()) {
-			cmdNo = historySize;
-		}
-
-		// FC could be followed by text or a command number
-		// first check for the number - this could be a negative
-		// integer too.
-		else {
-			try {
-				cmdStr = parser.getNextNumberToken();
-
-				if ((cmdStr != null) && !(cmdStr.equals(""))) {
-					if (parser.hasMoreTokens()) {
-						// throw a syntax error
-						writeSyntaxError(this.queryStr,
-								parser.getRemainderStr());
-						return;
-					}
-					cmdNo = Integer.parseInt(cmdStr);
-					if (cmdNo <= 0)
-						cmdNo = historySize + cmdNo;
-
-					if ((cmdNo >= 1) && (cmdNo <= historySize)) {
-						// sessObj.getQuery().resetQueryText(sessObj.getQryHistory().get(cmdNo-1).toString());
-					} else {
-						sessionError('E', SessionError.REPEAT_ERR);
-						sessObj.setQuery(null);
-						return;
-					}
-				} else // text is passed
-				{
-					cmdStr = parser.getNextKeyToken().toUpperCase();
-					if (cmdStr != null) {
-						// search the history buffer for a matching
-						// command
-						historyList = sessObj.getQryHistory();
-						if (historyList != null) {
-							int i;
-							for (i = historyList.size() - 1; i >= 0; i--) {
-								if ((historyList.get(i))
-										.get(1)
-										.toUpperCase()
-										.replaceAll("\\s+", " ")
-										.trim()
-										.startsWith(
-												(cmdStr + parser
-														.getRemainderStr()
-														.toUpperCase())
-														.replaceAll("\\s+", " "))) {
-									cmdNo = i + 1;
-									break;
-								}
-							}
-							if (i < 0) {
-								sessionError('E', SessionError.REPEAT_ERR);
-								sessObj.setQuery(null);
-								return;
-							}
-
-						}
-					}
-				}
-			} catch (NumberFormatException nfe) {
-				sessionError('E', SessionError.REPEAT_ERR);
-				sessObj.setQuery(null);
-				return;
-			}
-		}
-
-		String queryText = (historyList.get(cmdNo - 1)).get(1);
-		String termEvent = (historyList.get(cmdNo - 1)).get(2);
-		String sqlTerminator = sessObj.getTermEventMap().get(termEvent);
-
-		// if query ends with sqlterminator then trim and append new
-		// term else retain the same
-
-		if (queryText.toUpperCase().endsWith(sqlTerminator)) {
-			queryText = queryText.substring(0, queryText.length()
-					- sqlTerminator.length());
-			queryText = queryText + sessObj.getSessionSQLTerminator();
-		}
-		sessObj.getQuery().resetQueryText(queryText);
-		if (sessObj.getQuery().getQueryId() == FC) {
-			FCQuery fcQryObj = new FCQuery(sessObj, sessObj.getQuery());
-			boolean execute = fcQryObj.editCommand();
-			// If user has aborted the fc session do not
-			// execute the command, return to the prompt
-			if (!execute) {
-				sessObj.setQuery(null);
-				return;
-			}
-		}
-		try {
-			if (sessObj.getQuery().getQueryId() == REPEAT) {
-				writer.writeln(sessObj.getQuery().getQueryText());
-			}
-
-			sessObj.getVQryObj().validate(sessObj.getQuery(),
-					sessObj.getSessionSQLTerminator());
-
-			if (sessObj.getQuery().getQueryType() == SessionDefaults.IQ) {
-				this.execute();
-				return;
-			} else {
-				throw uic;
-			}
-		} catch (NullKeyWordException nke) {
-			// if blank lines entered ..its fine..move on
-			return;
-		}
-	}
-
-	private void handleClearCommand() throws IOException {
-		if (parser.hasMoreTokens()) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		}
-
-		String clsCmdString = "clear";
-
-		// if it is windows envrionment use the dll to clear the screen
-		if (System.getProperty("os.name").toUpperCase().startsWith("WINDOW")) {
-			try {
-				WCIUtils wcs = new WCIUtils();
-				wcs.cls();
-				wcs = null;
-				return;
-			} catch (Throwable t) {
-				if (sessObj.isDebugOn())
-					System.out.println(this.getClass().getName()
-							+ ": Clear command failed. Details = "
-							+ t.getMessage());
-			}
-			clsCmdString = "cmd /c cls";
-		}
-		/**
-		 * Only if wcs.cls failed, do we get down here and try to run a
-		 * localhost command (clear).
-		 */
-		try {
-			HostQuery hq = new HostQuery();
-			hq.startInputThread = false;
-			hq.execute(clsCmdString, sessObj.getReader(), sessObj.getWriter());
-			hq = null;
-
-		} catch (Exception e) {
-		}
-	}
-
-	private void handleRunCommand() throws IOException, SQLException,
-			UnKnownInterfaceCommand, UserInterruption {
-		String sqlTerminator = null;
-		if (parser.hasMoreTokens()) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			return;
-		}
-		if (sessObj.getPrevSQLQuery() == null) {
-			sessionError('E', SessionError.SLASH_ERR);
-			return;
-		}
-		if (!sessObj.isDBConnExists()) // Added  2010-03-19
-		{
-			displayNoConnInfo();
-			return;
-		}
-		if (isCreateTriggerCmd(sessObj.getPrevSQLQuery()))
-			sqlTerminator = "/";
-		else
-			sqlTerminator = sessObj.getSessionSQLTerminator();
-
-		sessObj.getQuery().resetQueryText(
-				sessObj.getPrevSQLQuery() + sqlTerminator);
-
-		try {
-			sessObj.getVQryObj().validate(sessObj.getQuery(),
-					sessObj.getSessionSQLTerminator());
-			if (sessObj.getQuery().getQueryType() == SessionDefaults.IQ) {
-				this.execute();
-				return;
-			} else {
-				throw uic;
-			}
-		} catch (NullKeyWordException nke) {
-			// if blank lines entered ..its fine..move on
-			return;
-		}
-	}
-
-	private void handleHelp() throws IOException {
-		String command = "";
-		String tmpStr = null;
-		Helper helpObj = new Helper();
-		String section = null;
-		while ((tmpStr = parser.getNextKeyToken()) != null) {
-			command += tmpStr + " ";
-		}
-
-		if (parser.hasMoreTokens()) {
-			writeSyntaxError(this.queryStr, parser.getRemainderStr());
-			helpObj = null;
-			return;
-		}
-		helpObj.printHelpText(sessObj.getWriter(), sessObj.getStrMode(),
-				s

<TRUNCATED>


[34/38] incubator-trafodion git commit: Merge branch 'master' of https://github.com/apache/incubator-trafodion into a_t2m

Posted by li...@apache.org.
Merge branch 'master' of https://github.com/apache/incubator-trafodion into a_t2m


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

Branch: refs/heads/master
Commit: 6fc87753e96b51639e175efdca4dd666c3cfebe8
Parents: f96ae2d 0bbd910
Author: AlexPeng19 <al...@hotmail.com>
Authored: Tue Nov 29 13:42:55 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Tue Nov 29 13:42:55 2016 +0800

----------------------------------------------------------------------
 core/conn/jdbcT4/pom.xml                        |  79 ++--
 core/sqf/.gitignore                             |   1 +
 core/sqf/Makefile                               |   4 +-
 core/sqf/build-scripts/genverhdr.ksh            |  15 +-
 core/sqf/export/include/dtm/tm.h                |  16 +-
 core/sqf/export/include/dtm/tmtransaction.h     |  13 +-
 .../hbase/client/transactional/RMInterface.java |  40 +-
 .../sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp |  34 +-
 core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.h  |  14 +-
 core/sqf/src/tm/tmddlrequests.cpp               | 292 +++++++++------
 core/sqf/src/tm/tmddlrequests.h                 |   8 +-
 core/sqf/src/tm/tmlib.cpp                       |  26 +-
 core/sqf/src/tm/tmlibmsg.h                      |   3 +
 core/sqf/src/tm/tmrmhbase.cpp                   |  23 +-
 core/sqf/src/tm/tmtransaction.cpp               |  52 ++-
 core/sql/bin/SqlciErrors.txt                    |   2 +
 core/sql/comexe/ComTdbExeUtil.cpp               |  26 +-
 core/sql/comexe/ComTdbExeUtil.h                 | 112 ++++--
 core/sql/common/ComSmallDefs.h                  |   8 +
 core/sql/common/NAType.cpp                      | 201 ++++++++++
 core/sql/common/NAType.h                        |   2 +
 core/sql/common/OperTypeEnum.h                  |   8 +-
 core/sql/executor/ExExeUtil.h                   |   8 +-
 core/sql/executor/ExExeUtilGet.cpp              | 365 +++++++++----------
 core/sql/executor/ExExeUtilLoad.cpp             |  46 ++-
 core/sql/executor/ExHbaseAccess.cpp             |  30 ++
 core/sql/executor/ExHbaseAccess.h               |   1 +
 core/sql/executor/HBaseClient_JNI.cpp           | 129 ++++++-
 core/sql/executor/HBaseClient_JNI.h             |  12 +
 core/sql/executor/SequenceFileReader.cpp        | 127 -------
 core/sql/executor/SequenceFileReader.h          |  12 -
 core/sql/executor/hiveHook.cpp                  | 168 +++++++--
 core/sql/exp/ExpHbaseDefs.h                     |   6 +
 core/sql/exp/ExpHbaseInterface.cpp              |  45 +++
 core/sql/exp/ExpHbaseInterface.h                |  12 +-
 core/sql/exp/ExpLOBaccess.cpp                   |   2 -
 core/sql/exp/ExpPackDefs.cpp                    |  10 +
 core/sql/exp/exp_clause.cpp                     |  35 +-
 core/sql/exp/exp_clause.h                       |   4 +-
 core/sql/exp/exp_clause_derived.h               | 169 +++++++++
 core/sql/exp/exp_function.cpp                   | 204 ++++++++++-
 core/sql/exp/exp_function.h                     |  35 +-
 core/sql/exp/exp_like.cpp                       |  80 ++++
 core/sql/generator/GenItemFunc.cpp              |  42 ++-
 core/sql/generator/GenRelExeUtil.cpp            |  77 ++--
 core/sql/optimizer/BindItemExpr.cpp             |  21 +-
 core/sql/optimizer/BindRelExpr.cpp              |   8 +
 core/sql/optimizer/ImplRule.cpp                 |   2 +-
 core/sql/optimizer/ItemCache.cpp                |   4 +-
 core/sql/optimizer/ItemExpr.cpp                 |  41 ++-
 core/sql/optimizer/ItemFunc.h                   | 104 +++++-
 core/sql/optimizer/NATable.cpp                  | 186 +---------
 core/sql/optimizer/NormItemExpr.cpp             |   2 +-
 core/sql/optimizer/RelRoutine.cpp               |   9 +-
 core/sql/optimizer/RelRoutine.h                 |  14 +-
 core/sql/optimizer/SynthType.cpp                |  67 +++-
 core/sql/optimizer/hiveHook.h                   | 116 +++---
 core/sql/parser/ParKeyWords.cpp                 |   2 +
 core/sql/parser/sqlparser.y                     | 123 ++++++-
 core/sql/regress/compGeneral/EXPECTED006.SB     | 150 ++++++++
 core/sql/regress/compGeneral/TEST006            |  40 ++
 core/sql/regress/executor/EXPECTED002.SB        |  99 ++++-
 core/sql/regress/executor/TEST002               |  29 +-
 core/sql/regress/seabase/EXPECTED002            | 266 +++++++++++---
 core/sql/regress/seabase/EXPECTED012            |  52 ++-
 core/sql/regress/seabase/TEST002                |  28 ++
 core/sql/regress/seabase/TEST012                |  11 +
 core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp         |  19 +-
 .../java/org/trafodion/sql/HBaseClient.java     |  40 ++
 .../java/org/trafodion/sql/HBulkLoadClient.java |   2 -
 .../org/trafodion/sql/SequenceFileWriter.java   |  70 +---
 core/sql/ustat/hs_util.h                        |   3 +-
 .../_chapters/sql_language_elements.adoc        |   3 +-
 .../src/asciidoc/_chapters/sql_statements.adoc  | 243 ++++++------
 74 files changed, 3149 insertions(+), 1203 deletions(-)
----------------------------------------------------------------------



[33/38] incubator-trafodion git commit: ignore directory structure in trafci.zip

Posted by li...@apache.org.
ignore directory structure in trafci.zip


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

Branch: refs/heads/master
Commit: f96ae2d43a344e6f359f87f085e1bc3a0993e127
Parents: d42fd51
Author: AlexPeng19 <al...@hotmail.com>
Authored: Wed Nov 23 16:06:12 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Wed Nov 23 16:06:12 2016 +0800

----------------------------------------------------------------------
 core/conn/trafci/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/f96ae2d4/core/conn/trafci/Makefile
----------------------------------------------------------------------
diff --git a/core/conn/trafci/Makefile b/core/conn/trafci/Makefile
index 6ecc68b..30a80cf 100644
--- a/core/conn/trafci/Makefile
+++ b/core/conn/trafci/Makefile
@@ -33,5 +33,5 @@ Trafci_installer:
 	export buildId=`head -n 1 buildId`$
 	mvn -f installer_pom.xml -DbldId=${buildId} clean package$
 Trafci_deploy:
-	zip -r ../clients/trafci.zip target/trafciInstaller.jar utils/README
+	zip -r ../clients/trafci.zip -j target/trafciInstaller.jar utils/README
 	java -jar target/trafciInstaller.jar -silent -jdbcFile ${MY_SQROOT}/export/lib/jdbcT4.jar -installDir ${MY_SQROOT}


[14/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Session.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Session.java b/core/conn/trafci/src/main/java/org/trafodion/ci/Session.java
new file mode 100644
index 0000000..5219679
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Session.java
@@ -0,0 +1,1908 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.Statement;
+import java.sql.ResultSet;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.text.SimpleDateFormat;
+import java.util.Vector;
+import java.lang.reflect.Method;
+import org.trafodion.jdbc.t4.TrafT4Connection;
+
+public class Session extends RepObjInterface
+{
+
+   private int caller=-1;                             // caller id. -1 nobody 0- USERI 1- PRUNI
+   private int mode=SessionDefaults.SQL_MODE; // 0 for sql 1 for cs 
+   private boolean sessionType=true; // true - interactive false - non interactive
+   private boolean sessionStatus=true; // true - active false- in active
+   private String sessionUser=null; // session user
+   private String sessionRole=null;
+   private String tempSessionRole="";
+   private String sessionPass=null; // session password
+   private String sessionServer=null;
+   private String sessionPort=null;
+   private String sessionDsn=null;
+   private String sessionCtlg="TRAFODION"; // session ctlg
+   private String sessionSchema="TRAFODION"; // session schema
+   private String sessionSQLPrompt=SessionDefaults.DEFAULT_SQL_PROMPT; // session prompt
+   private String sessionCprompt="+>";
+   private String sessionWMSPrompt= SessionDefaults.DEFAULT_WMS_PROMPT;
+   private String sessionCSPrompt= SessionDefaults.DEFAULT_CS_PROMPT;
+   private String sessionSQLTerminator=";"; // session sql terminator
+   private String sessionCSTerminator=";"; // session sql terminator
+   private String sessionColSep=" "; // column separator
+   private int sessionIdletime=30; // session idletimeout period
+   private HashMap<String,String> sessParams=null;
+   private HashMap<String,Object[]> prepStmtMap=null;
+   private boolean sessionTime=false; // false - if time off true - if time on
+   private boolean sessionTiming=false; // false - if timing off true - if timing on
+   private boolean sessionLogging=false; // is logging enabled
+   private String sessNull="NULL";
+   private Query qryObj=null; // current query properties
+   private Connection connObj=null; // current connection obj - one per session
+   private Statement stmtObj=null; // statement object to execute database queries
+   private PreparedStatement pstmtObj=null; // current statement obj - one per session
+   private FileReader frObj=null;
+   private FileWriter fwObj=null;
+   private ConsoleReader crObj=null;
+   private ConsoleWriter cwObj=null;
+   private boolean termOut=true; // print the output in the terminal
+   private boolean isQueryInterrupted=false; // set to true when the user cancels the current operation using ctrl +C
+   private boolean isDBConnExists=false; // flag to check if the database connection exists or not.
+   private FileWriter logWriter=null;
+   private FileReader scriptReader=null;
+   private Reader readObj=null;
+   private Writer writerObj=null;
+   private long lastQryExecTime=0;
+   private List<Vector<String>> qryHistory=null;
+   private String prevSQLQuery=null; // previous SQL query
+   private int prevQryStatusCode=0;
+   private int listCount=0;
+   private long qryStartTime=0;
+   private long qryEndTime=0;
+   private int sessLF=0; // Look and feel property
+   private int sqlWarningsCnt=0;
+   private int qsDisplayColSize = SessionDefaults.DISPLAY_COLSIZE;
+   private String strDisplayFormat=SessionDefaults.DEFAULT_DISPLAY_FORMAT;
+   private Object theEncryptObject=null;
+   private String processName=null;
+   private boolean patternsLoaded=false;
+   private String ndcsVersion = null;
+   private String databaseVersion = null;
+   private String databaseEdition = null;
+   public String serverType=null;
+
+   ValidateQuery     vQryObj    = null;
+   InterfaceQuery    iQryObj    = null;
+   ConditionalQuery  cQryObj    = null;
+   DatabaseQuery     dbQryObj   = null;
+   
+   SessionTimeoutTask sTimeoutTask=null;
+   boolean qsOpen=false;
+   private boolean sessionHistoryAll=false;
+   String serviceName=null;
+   String varSessionSQLPrompt=SessionDefaults.DEFAULT_SQL_PROMPT;
+   boolean ampmFmt = false;
+   boolean sessionStats = false;
+   LFProperties lfProps = null;
+   Process procObj=null;
+   private HTMLObject htmlObj=null;
+   private XMLObject xmlObj=null;
+   private String termEvent="0";
+   private int histCmdNo=0;
+   private HashMap<String,String> termEventMap=null;
+   private String prevTermEvent="0";
+   private boolean sessionAutoPrepare=false;
+   private String autoPrepStmtName="STMT_CI";
+   private int lastErrorCode = 0;
+   private String sutVersion = null;
+   private String mxosrvrVersion = null;
+   private long qryExecEndTime=0;
+   private boolean writeParams = false;
+   private String totalRecordCount = "0";
+   private float t4verNum = 0;
+   private boolean spjRs = false;
+   private int exitCode = 0;
+   private boolean inOutandRS=false;
+   private float dbProdVersion=0;
+   private boolean logCmdText = true;
+   private boolean quietEnabled = false;
+   private boolean logAppend = true;
+   Object currentDbExecObj=null;
+   String spoolFileName=null;
+   private boolean isInteractiveRead=false;
+   private boolean isImplicitGetStatsQry=false;
+   private boolean isCmdEchoEnabled=false;
+   // Changes for charset alignment
+   private int isoMapping=-1;
+   private boolean multiByteAlign=true;
+   private HashMap<String,String> aliasParamsMap=null;
+   private int fetchSize = SessionDefaults.DEFAULT_FETCH_SIZE;
+   private HashMap<String,RepObjInterface> patternHashMap=null;
+   private HashMap<String,String> envMap = null;
+   private HashMap<String,String> regExpMap = null;
+   private int maxPatternDepth = SessionDefaults.MAX_PATTERN_DEPTH;
+   private boolean debugOn = false;
+   private boolean logCmdEcho = true;
+   private boolean sessionStartup = false;
+   
+   private int prevMode = SessionDefaults.SQL_MODE;
+   private boolean dotModeCmd = false; 
+   
+   private boolean histOn = true; 
+   private String dotMode = null;
+
+   /*
+    *  Constants for CI's default connection timeout value and for a 
+    *  no timeout value. 
+    */
+   public static final int  DEFAULT_CONNECTION_TIMEOUT = -999; // Defaults.
+   public static final int  INFINITE_CONNECTION_TIMEOUT = 0;   // No timeout.
+
+
+   /*
+    *  Static variables containing the connection timeout and reset idle timer
+    *  method. The _s_ndcsConnTimeout value indicates whether or not the
+    *  user overrode the server side connection timeout defaults.
+    */
+   private static int _s_ndcsConnTimeout = DEFAULT_CONNECTION_TIMEOUT;
+   private static Method _s_resetIdleTimerMethod = null;
+
+   private int versionInfo = 2000;
+
+   public int getVersionInfo() {
+	return versionInfo;
+   }
+
+   public void setVersionInfo(int versionInfo) {
+	this.versionInfo = versionInfo;
+   }
+
+static {
+      String connTimeoutValue = "";
+
+      try {
+         /*
+          *  Check if there was a trafci.connectionTimeout property
+          *  passed to us and use its value if its valid.
+          */
+         connTimeoutValue = System.getProperty("trafci.connectionTimeout");
+         if (null != connTimeoutValue)
+            _s_ndcsConnTimeout = Integer.parseInt(connTimeoutValue);
+
+	  } catch(NumberFormatException nfe) {
+         /*
+          *  Parsing failed -- log an error and use the default value.
+          */
+         System.err.println("Invalid value specified for " + 
+                            "trafci.connectionTimeout [" + connTimeoutValue + 
+                            "]. Using defaults ... ");
+         _s_ndcsConnTimeout = DEFAULT_CONNECTION_TIMEOUT;
+      }
+
+
+      try {
+         /*
+          *  Get the class for the TrafT4Connection class and find the
+          *  reset connection (server) idle timer.
+          */
+         Class<?>  clz = Class.forName("org.trafodion.jdbc.t4.TrafT4Connection");
+         _s_resetIdleTimerMethod = clz.getMethod("resetServerIdleTimer",
+                                                 new Class[] { } );
+ 
+       } catch(Exception e) {
+         _s_resetIdleTimerMethod = null;
+       }
+
+
+   }  /*  End of  static initializer.  */
+
+
+
+   Session()
+   {
+
+   }
+
+   Session(String sessionUser,   String sessionPass, String sessionRole ,String sessionServer, String sessionPort,
+      String sessionDsn,ConsoleReader crObj, ConsoleWriter cwObj)
+   {
+      this.sessionUser=sessionUser;
+      this.sessionPass=sessionPass;
+      this.sessionRole=sessionRole;
+      this.sessionServer=sessionServer;
+      this.sessionPort=sessionPort;
+      this.sessionDsn=sessionDsn;
+      this.crObj=crObj;
+      this.cwObj=cwObj;
+
+
+   }
+
+   /*
+    *  Gets the Connection Timeout setting. This value can be overriden by 
+    *  the user by specifying a property "trafci.connectionTimeout".
+    *
+    *  @returns  the currently used Connection Timeout setting.  
+    */
+   public static int getConnectionTimeout() {
+      return _s_ndcsConnTimeout;
+
+   }  /*  End of  getConnectionTimeout  static method.  */
+
+
+
+   /*
+    *  Resets the connection idle timer on the server. Uses reflection to 
+    *  invoke the method, so that we don't need to compile with a specific
+    *  JDBC/T4 driver version.
+    */
+   public void resetConnectionIdleTimer() {
+        /*
+         *  Don't need to do any work, if we set an infinite timeout at
+         *  connection time.
+         */
+        if (INFINITE_CONNECTION_TIMEOUT == _s_ndcsConnTimeout)
+           return;
+
+
+        /*
+         *  Okay, gotta reset the connection idle timer if we have a valid
+         *  resetIdleTimer method handle.
+         */
+        if (null != _s_resetIdleTimerMethod) {
+		   //  System.out.println("@@@TRC: invoking reset timer.");
+
+           try {
+              _s_resetIdleTimerMethod.invoke(connObj, new Object[] { } );
+
+              //  We did our job, so just return back.
+              return;
+
+           } catch(Exception e) {
+		      //  System.out.println("@@@TRC: failed invoking reset timer. " + 
+              //                     "Details = " + e.getMessage() );
+
+
+              //  Don't want to do this again if it failed.
+              _s_resetIdleTimerMethod = null;
+
+             // if (Boolean.getBoolean("trafci.enableTrace") )
+             //    e.printStackTrace();
+
+           }
+
+        }   /*  End of  IF  resetIdleTimerMethod  is valid.  */
+
+
+
+        /*
+         *  Okay, if we got here -- means we failed to invoke the reset
+         *  connection idle timer method -- run a dummy query to reset 
+         *  the timer on the NDCS end.
+         */
+        try {
+		   //  System.out.println("@@@TRC: running infostats keepalive.");
+           Statement stmt = connObj.createStatement();
+           ResultSet rs = stmt.executeQuery("INFOSTATS _KEEPALIVE_HANDLE_");
+           rs.close();
+           stmt.close();
+
+        } catch(Exception exc) {
+           //  Ignore any errors.
+        }
+
+
+   }  /*  End of  resetConnectionIdleTimer  method.  */
+
+
+
+   public Connection getConnObj()
+   {
+      return connObj;
+   }
+
+   public void setConnObj(Connection connObj)
+   {
+      this.connObj = connObj;
+      this.prepStmtMap=null;
+
+   }
+
+   public int getMode()
+   {
+      return mode;
+   }
+
+   public int getDisplayFormat()
+   {
+      if (this.strDisplayFormat.equalsIgnoreCase("HTML"))
+         return SessionDefaults.HTML_FORMAT;
+      else if (this.strDisplayFormat.equalsIgnoreCase("XML"))
+         return SessionDefaults.XML_FORMAT;
+      else if (this.strDisplayFormat.equalsIgnoreCase("CSV") || this.strDisplayFormat.equalsIgnoreCase("COLSEP"))
+         return SessionDefaults.CSV_FORMAT;
+      else
+         return SessionDefaults.RAW_FORMAT;
+   }
+
+   public String getStrMode()
+   {
+      switch (this.mode)
+      {
+         case SessionDefaults.SQL_MODE:
+            return "SQL";
+         default:
+            return "SQL";
+      }
+   }
+
+   public String getEnv(String var)
+   {
+       var=var.toUpperCase();
+       
+       if(var.equals("RECCOUNT") || var.equals("ACTIVITYCOUNT"))
+       {
+           String tmp = this.getTotalRecordCount();
+           if(tmp == null)
+               return "-1";
+           else
+               return tmp;
+       }
+       
+       if(var.equals("LASTERROR") || var.equals("ERRORCODE"))
+           return this.getLastError() + "";
+       
+       if(var.equals("COLSEP"))
+           return this.getSessionColSep();
+       
+       if(var.equals("DATASOURCE"))
+           return this.getSessionDsn();
+       
+       if(var.equals("HISTOPT"))
+           return this.isSessionHistoryAll()?"ALL":"DEFAULT [No expansion of script files]";
+   
+       
+       if(var.equals("IDLETIMEOUT"))
+           return this.getSessionIdletime()+""; 
+       
+       if(var.equals("LIST_COUNT"))
+           return this.getListCount()+"";
+       
+       if(var.equals("LOG_FILE"))
+       {
+           if(this.isSessionLogging())
+               return this.getSpoolFileName();
+           else
+               return "OFF";  
+       }
+       
+       if(var.equals("LOOK_AND_FEEL"))
+           return this.getStrSessView();
+       
+       if(var.equals("MARKUP"))
+           return this.getStrDisplayFormat();
+       
+       if(var.equals("MODE"))
+           return this.getStrMode();
+       
+       if(var.equals("PROMPT"))
+           return this.getSessionPrompt();
+       
+       if(var.equals("ROLE"))
+    	   return this.getSessionRole();
+       
+       if(var.equals("SCHEMA"))
+           return this.getSessionSchema();
+       
+       if(var.equals("SERVER"))
+           return this.getSessionServer() + this.getSessionPort();
+       
+       if(var.equals("SQLTERMINATOR"))
+           return this.getSessionSQLTerminator();
+       
+       if(var.equals("TIME"))
+           return this.isSessionTimeOn()?"ON":"OFF";
+           
+       if(var.equals("TIMING"))
+           return this.isSessionTimingOn()?"ON":"OFF";
+           
+       if(var.equals("USER"))
+           return this.getSessionUser();
+       
+       return null;
+   }
+   
+   public void setNewPrompt()
+   {
+      // include all possible combinations of env variables here
+      String[][] envNameVal = { {"%USER",this.sessionUser},
+                              {"%SCHEMA",this.sessionSchema},
+                              {"%SERVER",this.sessionServer+this.sessionPort},
+                              {"%MODE",this.getStrMode()},
+                              {"%DATASOURCE", this.sessionDsn},
+                              {"%ROLE", this.sessionRole}
+                        };
+      String prompt=this.varSessionSQLPrompt;
+      switch (this.mode)
+      {
+         case SessionDefaults.SQL_MODE:
+            prompt = this.varSessionSQLPrompt;
+            break;
+         default:
+            break;
+      }
+      int envCount=0;
+      String replaceString;
+      while (this.connObj != null && prompt.indexOf("%") != -1 && envCount < envNameVal.length)
+      {
+    	
+      	// Every $ needs to be replaced with \$. Do not delete the backslashes.
+    	 replaceString = envNameVal[envCount][1];
+    	 replaceString = replaceString.replaceAll("\\$","\\\\\\$");
+         prompt=prompt.replaceAll("(?i)"+envNameVal[envCount][0]+"(?![^_\\W])",replaceString);
+         envCount++;
+      }
+
+      if (!prompt.trim().endsWith(">"))
+    	  prompt += ">";
+      switch (this.mode)
+      {
+         case SessionDefaults.SQL_MODE:
+            this.sessionSQLPrompt = prompt;
+            break;
+         default:
+            break;
+      }
+      
+      crObj.setPrompt(prompt,this.sessionTime, ampmFmt);
+   }
+
+   public void setMode(int mode)
+   {
+      this.mode = mode;
+      this.setNewPrompt();
+   }
+
+   public PreparedStatement getPreparedStmt()
+   {
+      return pstmtObj;
+   }
+
+   public void setPreparedStmt(PreparedStatement pstmtObj)
+   {
+      this.pstmtObj = pstmtObj;
+   }
+
+   public Query getQuery()
+   {
+      return qryObj;
+   }
+
+   public void setQuery(Query qryObj)
+   {
+      this.qryObj = qryObj;
+   }
+
+   public String getSessionCtlg()
+   {
+      return sessionCtlg;
+   }
+
+   public void setSessionCtlg(String sessionCtlg)
+   {
+      this.sessionCtlg = sessionCtlg;
+   }
+
+   public String getSessionPass()
+   {
+      return sessionPass;
+   }
+
+   public void setSessionPass(String sessionPass)
+   {
+      this.sessionPass = sessionPass;
+   }
+
+   public String getSessionPrompt()
+   {
+      String timeStamp = "";
+      SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss ");
+      String prompt="";
+
+      if (this.isSessionTimeOn())
+      {
+         if (this.ampmFmt)
+            timeStamp = DateFormat.getTimeInstance().format(new Date())+ " ";
+         else
+            timeStamp = sdf.format(new Date());
+      }
+      
+      prompt = this.getPrompt();
+      crObj.setPrompt(prompt, sessionTime, ampmFmt);
+      return (timeStamp + prompt);
+   }
+
+   public String getPrompt() {
+      
+      String prompt="";
+     
+      switch (this.mode)
+      {
+         case SessionDefaults.SQL_MODE:
+            prompt =  sessionSQLPrompt;
+            break;
+         default:
+            prompt =  sessionSQLPrompt;
+      }
+      return prompt;
+   }
+   
+   public void setSessionPrompt(String sessionPrompt)
+   {
+      switch (this.mode)
+      {
+         case SessionDefaults.SQL_MODE:
+            this.sessionSQLPrompt = this.varSessionSQLPrompt = sessionPrompt;
+            break;
+         default: break;
+      }
+      this.setNewPrompt();
+   }
+
+   public String getSessionSchema()
+   {
+      return sessionSchema;
+   }
+
+   public void setSessionSchema(String sessionSchema)
+   {
+      this.sessionSchema = sessionSchema;
+      this.setNewPrompt();
+   }
+
+   public boolean isSessionActive()
+   {
+      return sessionStatus;
+   }
+
+   public void setSessionStatus(boolean sessionStatus)
+   {
+      this.sessionStatus = sessionStatus;
+   }
+
+   public boolean isSessionTimeOn()
+   {
+      return sessionTime;
+   }
+
+   public void setSessionTime(boolean sessionTime)
+   {
+      this.sessionTime = sessionTime;
+   }
+
+   public boolean isSessionTimingOn()
+   {
+      return sessionTiming;
+   }
+
+   public void setSessionTiming(boolean sessionTiming)
+   {
+      this.sessionTiming = sessionTiming;
+   }
+
+   public boolean isSessionInteractive()
+   {
+      return sessionType;
+   }
+
+   public void setSessionType(boolean sessionType)
+   {
+      this.sessionType = sessionType;
+   }
+
+   public boolean getSessionType()
+   {
+      return this.sessionType;
+   }
+
+   public String getSessionUser()
+   {
+      return sessionUser;
+   }
+
+   public void setSessionUser(String sessionUser)
+   {
+      this.sessionUser = sessionUser;
+      this.setNewPrompt();
+   }
+
+
+   public ConsoleReader getConsoleReader()
+   {
+      return crObj;
+   }
+
+
+   public void setConsoleReader(ConsoleReader crObj)
+   {
+      this.crObj = crObj;
+   }
+
+
+   public ConsoleWriter getConsoleWriter()
+   {
+      return cwObj;
+   }
+
+
+   public void setConsoleWriter(ConsoleWriter cwObj)
+   {
+      this.cwObj = cwObj;
+   }
+
+
+   public FileReader getFileReader()
+   {
+      return frObj;
+   }
+
+
+   public void setFileReader(FileReader frObj)
+   {
+      if (frObj == null)
+      {
+         frObj=new FileReader();
+      }
+      this.frObj = frObj;
+   }
+
+
+   public FileWriter getFileWriter()
+   {
+      return fwObj;
+   }
+
+
+   public void setFileWriter(FileWriter fwObj)
+   {
+      if (fwObj == null)
+      {
+         fwObj=new FileWriter();
+      }
+      this.fwObj = fwObj;
+   }
+
+   public String getStrDisplayFormat()
+   {
+      return strDisplayFormat;
+   }
+
+   public void setStrDisplayFormat(String strDisplayFormat)
+   {
+      this.strDisplayFormat = strDisplayFormat;
+   }
+
+   public String getSessionDsn()
+   {
+      return sessionDsn;
+   }
+
+   public void setSessionDsn(String sessionDsn)
+   {
+      this.sessionDsn = sessionDsn;
+      this.setNewPrompt();
+   }
+
+   public String getSessionPort()
+   {
+      return sessionPort;
+   }
+
+   public void setSessionPort(String sessionPort)
+   {
+      this.sessionPort = sessionPort;
+   }
+
+   public String getSessionServer()
+   {
+      return sessionServer;
+   }
+
+   public void setSessionSever(String sessionServer)
+   {
+      this.sessionServer = sessionServer;
+      this.setNewPrompt();
+   }
+
+   public String getSessionSQLTerminator()
+   {
+      if (this.mode != SessionDefaults.SQL_MODE)
+      {
+         return sessionCSTerminator;
+      }
+      else
+      {
+         return sessionSQLTerminator;
+      }
+   }
+
+   public void setSessionSQLTerminator(String sessionSQLTerminator)
+   {
+      this.sessionSQLTerminator = sessionSQLTerminator.toUpperCase();
+   }
+
+   public int getSessionIdletime()
+   {
+      return sessionIdletime;
+   }
+
+   public void setSessionIdletime(int sessionIdletime)
+   {
+      this.sessionIdletime = sessionIdletime;
+      if (this.sTimeoutTask != null)
+      {
+         this.sTimeoutTask.idleTime=sessionIdletime;
+      }
+   }
+
+   public HashMap<String,Object[]> getPrepStmtMap()
+   {
+      return prepStmtMap;
+   }
+
+   public PreparedStatement getPrepStmtMap(String stmtName)
+   {
+      if (prepStmtMap !=null)
+      {
+         Object[] pStmtObj=(Object[]) prepStmtMap.get(stmtName);
+         if (pStmtObj != null)
+         {
+            return (PreparedStatement) (pStmtObj[0]);
+         }
+      }
+      return null;
+   }
+
+   public boolean getPrepTrimOut(String stmtName)
+   {
+      if (prepStmtMap !=null)
+      {
+         Object[] pStmtObj=(Object[]) prepStmtMap.get(stmtName);
+
+         return (Boolean.valueOf((String)pStmtObj[1]).booleanValue());
+      }
+      else
+         return false;
+   }
+
+   public void setPrepStmtMap(String stmtName,Object pStmtObj,boolean trimOut)
+   {
+      Object[] objectArr=new Object[2];
+      if (this.prepStmtMap == null)
+      {
+         this.prepStmtMap=new HashMap<String,Object[]>();
+      }
+      objectArr[0]=pStmtObj;
+      if (trimOut)
+      {
+         objectArr[1]="true";
+      }
+      else
+      {
+         objectArr[1]="false";
+      }
+      this.prepStmtMap.put(stmtName,objectArr);
+
+   }
+
+   public void removePrepStmtMap(String stmtName)
+   {
+      if (this.prepStmtMap != null)
+      {
+         this.prepStmtMap.remove(stmtName);
+      }
+   }
+
+   public HashMap<String,String> getSessParams()
+   {
+      return sessParams;
+   }
+
+   public void resetPrepStmtMap(HashMap<String,Object[]> prepStmtMap)
+   {
+      this.prepStmtMap=null;
+   }
+
+   public String getSessParams(String param)
+   {
+      if (sessParams!=null)
+         return (String) sessParams.get(param);
+      else
+         return null;
+
+   }
+
+   public void setSessParams(String param,String value)
+   {
+      if (this.sessParams == null)
+      {
+         this.sessParams=new HashMap<String,String>();
+      }
+      this.sessParams.put(param,value);
+   }
+
+   public void resetSessionParams(HashMap<String,String> sessParams)
+   {
+      this.sessParams=sessParams;
+   }
+
+   public void resetSessionParams(String param)
+   {
+      if (this.sessParams != null)
+      {
+         this.sessParams.remove(param);
+      }
+   }
+
+   public boolean isSessionLogging()
+   {
+      return sessionLogging;
+   }
+
+   public void setSessionLogging(boolean sessionLogging)
+   {
+      this.sessionLogging = sessionLogging;
+   }
+
+   public Statement getStmtObj()
+   {
+      return stmtObj;
+   }
+
+   public void setStmtObj(Statement stmtObj)
+   {
+      this.stmtObj = stmtObj;
+   }
+
+   public String getSessNull()
+   {
+      return sessNull;
+   }
+
+   public void setSessNull(String sessNull)
+   {
+      this.sessNull = sessNull;
+   }
+
+   public String getSessionCprompt()
+   {
+      return sessionCprompt;
+   }
+
+   public void setSessionCprompt(String sessionCprompt)
+   {
+      this.sessionCprompt = sessionCprompt;
+   }
+
+   public boolean isTermOut()
+   {
+      return termOut;
+   }
+
+   public void setTermOut(boolean termOut)
+   {
+      this.termOut = termOut;
+   }
+
+   public FileWriter getLogWriter()
+   {
+      return logWriter;
+   }
+
+   public void setLogWriter(FileWriter logWriter)
+   {
+      this.logWriter = logWriter;
+   }
+
+   public FileReader getScriptReader()
+   {
+      return scriptReader;
+   }
+
+   public void setScriptReader(FileReader scriptReader)
+   {
+      this.scriptReader = scriptReader;
+   }
+
+   public int getCaller()
+   {
+      return caller;
+   }
+
+   public void setCaller(int caller)
+   {
+      this.caller = caller;
+   }
+
+   public DatabaseQuery getDbQryObj()
+   {
+      return dbQryObj;
+   }
+
+   public void setDbQryObj(DatabaseQuery dbQryObj)
+   {
+      this.dbQryObj = dbQryObj;
+   }
+
+   public InterfaceQuery getIQryObj()
+   {
+      return iQryObj;
+   }
+
+   public void setIQryObj(InterfaceQuery qryObj)
+   {
+      iQryObj = qryObj;
+   }
+   
+   public ConditionalQuery getCQryObj(){
+       return cQryObj;
+   }
+   
+   public void setCQryObj(ConditionalQuery qryObj) {
+       cQryObj = qryObj;
+   }
+
+   public ValidateQuery getVQryObj()
+   {
+      return vQryObj;
+   }
+
+   public void setVQryObj(ValidateQuery qryObj)
+   {
+      vQryObj = qryObj;
+   }
+
+   public Reader getReader()
+   {
+      return readObj;
+   }
+
+   public void setReader(Reader readObj)
+   {
+      this.readObj = readObj;
+   }
+
+   public Writer getWriter()
+   {
+      return writerObj;
+   }
+
+   public void setWriter(Writer writerObj)
+   {
+      this.writerObj = writerObj;
+   }
+
+   public long getLastQryExecTime()
+   {
+      return lastQryExecTime;
+   }
+
+   public void setLastQryExecTime(long lastQryExecTime)
+   {
+      this.lastQryExecTime = lastQryExecTime;
+      if (this.sTimeoutTask != null)
+      {
+         this.sTimeoutTask.lastQueryExecTime=lastQryExecTime;
+         this.sTimeoutTask.checkRequired=true;
+      }
+   }
+
+   public SessionTimeoutTask getTimeoutTask()
+   {
+      return sTimeoutTask;
+   }
+
+   public void setTimeoutTask(SessionTimeoutTask timeoutTask)
+   {
+      sTimeoutTask = timeoutTask;
+
+      if (null != sTimeoutTask)
+         sTimeoutTask.setSessionObj(this);
+
+   }
+
+   public void setTimerHold()
+   {
+      if (this.sTimeoutTask != null)
+      {
+         this.sTimeoutTask.checkRequired=false;
+      }
+
+   }
+
+   public List<Vector<String>> getQryHistory()
+   {
+      return qryHistory;
+   }
+
+   public void addQryToHistory(String qryText)
+   {
+	   if (isDotModeCmd()) {
+		   qryText = "."+ this.getDotMode() + " " + qryText;
+		   if (this.debugOn)
+			   System.out.println(this.getClass().getName()+"::"+ qryText);
+	   }
+
+	   if (!histOn)
+	   {
+		   this.setHistOn(true);
+		   return;
+	   }
+		   
+      histCmdNo++;
+      if (this.qryHistory == null)
+      {
+         this.qryHistory =new ArrayList<Vector<String>>();
+      }
+      if (this.termEventMap == null)
+      {
+         this.termEventMap=new HashMap<String, String>();
+         termEventMap.put("0",";");
+      }
+      if (this.qryHistory.size() >= SessionDefaults.QRY_HISTORY_MAX_LMT)
+      {
+         this.qryHistory.remove(0);
+      }
+      Vector<String> histVect = new Vector<String>();
+      //mark
+      //histVect.add(new Integer(histCmdNo));
+      histVect.add(String.valueOf(histCmdNo));
+      histVect.add(qryText);
+      if (Integer.parseInt(termEvent) == histCmdNo)
+      {
+         histVect.add(prevTermEvent);
+      }
+      else
+      {
+         histVect.add(termEvent);
+      }
+      this.qryHistory.add(histVect);
+
+   }
+
+   public String getPrevSQLQuery()
+   {
+      return prevSQLQuery;
+   }
+
+   public void setPrevSQLQuery(String prevSQLQuery)
+   {
+      this.prevSQLQuery = prevSQLQuery;
+   }
+
+   public int getPrevQryStatusCode()
+   {
+      return prevQryStatusCode;
+   }
+
+   public void setPrevQryStatusCode(int prevQryStatusCode)
+   {
+      this.prevQryStatusCode = prevQryStatusCode;
+   }
+
+   public int getListCount()
+   {
+      return listCount;
+   }
+
+   public void setListCount(int listCount)
+   {
+      this.listCount = listCount;
+   }
+
+   public int getDisplayColSize()
+   {
+      return qsDisplayColSize;
+   }
+
+   public void setDisplayColSize(int colSize)
+   {
+      this.qsDisplayColSize = colSize;
+   }
+
+   public String getSessionColSep()
+   {
+      return sessionColSep;
+   }
+
+   public void setSessionColSep(String sessionColSep)
+   {
+      this.sessionColSep = sessionColSep;
+   }
+
+   public void setQryStartTime()
+   {
+      qryStartTime=System.currentTimeMillis();
+   }
+
+   public void setQryEndTime()
+   {
+      qryEndTime=System.currentTimeMillis();
+      if (qryObj != null)
+         qryObj.setElapsedTime(this.qryEndTime-this.qryStartTime);
+   }
+
+
+
+   public void resetQryStartEndTime()
+   {
+      qryStartTime=qryEndTime=0;
+   }
+
+   public int getSessView()
+   {
+      return sessLF;
+   }
+
+   public String getStrSessView()
+   {
+      switch (sessLF)
+      {
+         case SessionDefaults.CIDEFAULT_VIEW:
+            return "TRAFCI";
+
+         case SessionDefaults.MXCI_VIEW:
+            return "MXCI";
+
+         default:
+            return "TRAFCI";
+
+      }
+   }
+
+   public void setSessView(int sessLF)
+   {
+      this.sessLF = sessLF;
+   }
+
+   public int getSqlWarningsCnt()
+   {
+      return sqlWarningsCnt;
+   }
+
+   public void setSqlWarningsCnt(int sqlWarningsCnt)
+   {
+      this.sqlWarningsCnt = sqlWarningsCnt;
+   }
+
+   public boolean isQueryInterrupted()
+   {
+      return isQueryInterrupted;
+   }
+
+   public void setQueryInterrupted(boolean isQueryInterrupted)
+   {
+      this.isQueryInterrupted = isQueryInterrupted;
+   }
+
+   public boolean isDBConnExists()
+   {
+      return isDBConnExists;
+   }
+
+   public void setDBConnExists(boolean isDBConnExists)
+   {
+      this.isDBConnExists = isDBConnExists;
+      if (!isDBConnExists)
+      {
+         setMxosrvrVersion(null);
+      }
+   }
+
+   public void setCurrentStmtObj(Object currentDbExecObj)
+   {
+      this.currentDbExecObj=currentDbExecObj;
+   }
+   public Object getCurrentStmtObj()
+   {
+      return this.currentDbExecObj;
+   }
+
+   public boolean isSessionHistoryAll()
+   {
+      return sessionHistoryAll;
+   }
+
+   public void setSessionHistoryAll(boolean sessionHistoryAll)
+   {
+      this.sessionHistoryAll = sessionHistoryAll;
+   }
+
+
+   public boolean isSessionStatsEnabled()
+   {
+      return sessionStats;
+   }
+
+   public void setSessionStatsEnabled(boolean sessionStats)
+   {
+      this.sessionStats = sessionStats;
+   }
+
+   public LFProperties getLfProps()
+   {
+      return lfProps;
+   }
+
+   public void setLFProps(LFProperties lfProps)
+   {
+      this.lfProps = lfProps;
+   }
+
+   public boolean isAmPmFmt()
+   {
+      return ampmFmt;
+   }
+
+   public void setAmPmFmt(boolean ampmFmt)
+   {
+      this.ampmFmt = ampmFmt;
+   }
+
+   public Process getProcObj()
+   {
+      return procObj;
+   }
+
+   public void setProcObj(Process procObj)
+   {
+      this.procObj = procObj;
+   }
+
+   public HTMLObject getHtmlObj()
+   {
+      return htmlObj;
+   }
+
+   public void setHtmlObj(HTMLObject htmlObj)
+   {
+      this.htmlObj = htmlObj;
+   }
+
+   public XMLObject getXmlObj()
+   {
+      return xmlObj;
+   }
+
+   public void setXmlObj(XMLObject xmlObj)
+   {
+      this.xmlObj = xmlObj;
+   }
+
+   public String getTermEvent()
+   {
+      return termEvent;
+   }
+
+   public void setTermEvent(String termEvent)
+   {
+      prevTermEvent = this.termEvent;
+      this.termEvent = termEvent;
+   }
+
+   public int getHistCmdNo()
+   {
+      return histCmdNo;
+   }
+
+   public void setHistCmdNo(int histCmdNo)
+   {
+      this.histCmdNo = histCmdNo;
+   }
+
+   public HashMap<String, String> getTermEventMap()
+   {
+      return termEventMap;
+   }
+
+   public void setTermEventMap(String eventNum, String sqlTerminator)
+   {
+      if (this.termEventMap == null)
+      {
+         this.termEventMap=new HashMap<String, String>();
+         termEventMap.put("0",";");
+      }
+
+      this.termEventMap.put(eventNum,sqlTerminator);
+
+   }
+
+   public long getQryExecEndTime()
+   {
+      return qryExecEndTime;
+   }
+
+   public void setQryExecEndTime()
+   {
+      this.qryExecEndTime = (System.currentTimeMillis() - this.qryStartTime);
+   }
+
+   public boolean isSessionAutoPrepare()
+   {
+      return sessionAutoPrepare;
+   }
+
+   public void setSessionAutoPrepare(boolean sessionAutoPrepare)
+   {
+      this.sessionAutoPrepare = sessionAutoPrepare;
+   }
+
+   public String getAutoPrepStmtName()
+   {
+      return autoPrepStmtName;
+   }
+
+   public void setAutoPrepStmtName(String autoPrepStmtName)
+   {
+      this.autoPrepStmtName = autoPrepStmtName;
+   }
+
+   public int getLastError()
+   {
+      return lastErrorCode;
+   }
+
+   public void setLastError(int lastErrorCode)
+   {
+      this.lastErrorCode = lastErrorCode;
+   }
+   
+   public String getSutVersion()
+   {
+      return sutVersion;
+   }
+
+   public void setSutVersion(String sutVersion)
+   {
+      this.sutVersion = sutVersion;
+   }
+   
+   public String getMxosrvrVersion()
+   {
+      return mxosrvrVersion;
+   }
+
+   public void setMxosrvrVersion(String mxosrvrVersion)
+   {
+      this.mxosrvrVersion = mxosrvrVersion;
+   }
+
+/* public NSCmd getNscmd()
+   {
+      return nscmd;
+   }
+
+   public void setNscmd(NSCmd nscmd)
+   {
+      this.nscmd = nscmd;
+   }
+*/
+
+   public boolean isWriteParams()
+   {
+      return writeParams;
+   }
+
+   public void setWriteParams(boolean writeParams)
+   {
+      this.writeParams = writeParams;
+   }
+
+   public String getTotalRecordCount()
+   {
+      return totalRecordCount;
+   }
+
+   public void setTotalRecordCount(String totalRecordCount)
+   {
+      this.totalRecordCount = totalRecordCount;
+   }
+
+   public void setT4verNum(float num)
+   {
+      t4verNum = num;
+   }
+   public float getT4verNum()
+   {
+      return t4verNum;
+   }
+
+   public boolean isSPJRS()
+   {
+      return spjRs;
+   }
+
+   public void setSPJRS(boolean spjRs)
+   {
+      this.spjRs = spjRs;
+   }
+   
+   public void setExitCode(int code){
+       this.exitCode = code;
+   }
+   
+   public int getExitCode(){
+       return this.exitCode;
+   }
+
+   public boolean isInOutandRS()
+   {
+      return inOutandRS;
+   }
+
+   public void setInOutandRS(boolean inOutandRS)
+   {
+      this.inOutandRS = inOutandRS;
+   }
+
+   public float getDatabaseProdVersion()
+   {
+      return dbProdVersion;
+   }
+
+   public void setDatabaseProdVersion(float dbProdVersion)
+   {
+      this.dbProdVersion = dbProdVersion;
+   }
+
+   public boolean isLogCmdText()
+   {
+      return logCmdText;
+   }
+
+   public void setLogCmdText(boolean logCmdText)
+   {
+      this.logCmdText = logCmdText;
+   }
+
+   public boolean isQuietEnabled()
+   {
+      return quietEnabled;
+   }
+
+   public void setQuietEnabled(boolean quietEnabled)
+   {
+      this.quietEnabled = quietEnabled;
+   }
+
+   public boolean isLogAppend()
+   {
+      return logAppend;
+   }
+
+   public void setLogAppend(boolean logAppend)
+   {
+      this.logAppend = logAppend;
+   }
+
+   public String getSpoolFileName()
+   {
+      return spoolFileName;
+   }
+
+   public void setSpoolFileName(String spoolFileName)
+   {
+      this.spoolFileName = spoolFileName;
+   }
+   
+   protected void setSessionValues() 
+   {	  
+	   
+      try
+      { 
+    	this.sessionRole = ((TrafT4Connection)this.connObj).getRoleName();
+    	if (this.debugOn)
+    		System.out.println("Session::"  + this.sessionRole);
+    	if (0 == this.sessionRole.trim().length())  // If T4 returns empty string
+    	{
+    		this.sessionRole = this.getUserRoleName();
+        	if (this.debugOn)
+        		System.out.println("Session getUserRoleName::"  + this.sessionRole);
+ 		}    			  
+      } 
+      catch (NullPointerException npe) 
+      {    	 
+    	this.sessionRole = this.getUserRoleName();
+       	if (this.debugOn)
+    		System.out.println("Session NPE getUserRoleName::"  + this.sessionRole);
+      } 
+      catch (Exception se)
+      {
+      }
+      finally {
+    	  this.setNewPrompt();
+      }
+   }
+   
+   protected String getUserRoleName()
+   {
+
+      //String userName = null;
+      String userRole = null;
+      try
+      {
+         Statement stmt = this.connObj.createStatement();
+         ResultSet rs = stmt.executeQuery("VALUES(USER, CURRENT_ROLE)");
+         while (rs!=null && rs.next())
+         {
+            //userName = rs.getString(1);
+            userRole = rs.getString(2);
+         }
+         rs.close();
+         stmt.close();
+      } catch (Exception se)
+      {
+        // System.out.println("error:"+se.getMessage());
+      }
+      if (userRole != null)
+      {
+   		 int i = userRole.indexOf(".");
+   		 this.sessionRole = userRole.substring(i+1); // Prints the second half of the role
+      }
+      else
+      {
+    	  sessionRole = "Information not available";
+      }
+      return sessionRole;
+   }
+
+   
+   public boolean isInteractiveRead()
+   {
+      return isInteractiveRead;
+   }
+
+   public void setInteractiveRead(boolean isInteractiveRead)
+   {
+      this.isInteractiveRead = isInteractiveRead;
+   }
+
+   public boolean isImplicitGetStatsQry()
+   {
+      return isImplicitGetStatsQry;
+   }
+
+   public void setImplicitGetStatsQry(boolean isImplicitGetStatsQry)
+   {
+      this.isImplicitGetStatsQry = isImplicitGetStatsQry;
+   }
+
+   public boolean isCmdEchoEnabled()
+   {
+      return isCmdEchoEnabled;
+   }
+
+   public void setCmdEcho(boolean isCmdEchoEnabled)
+   {
+      this.isCmdEchoEnabled = isCmdEchoEnabled;
+   }
+
+   public int getISOMapping()
+   {
+      return isoMapping;
+   }
+
+   public void setISOMapping(int isoMapping)
+   {
+      this.isoMapping = isoMapping;
+   }
+
+   public boolean isMultiByteAlign()
+   {
+      return multiByteAlign;
+   }
+
+   public void setMultiByteAlign(boolean multiByteAlign)
+   {
+      this.multiByteAlign = multiByteAlign;
+   }
+   public String getSessionRole()
+   {
+      return sessionRole;
+   }
+   
+   public void setSessionRole(String sessionRole)
+   {
+	   this.sessionRole = sessionRole;
+	   this.setNewPrompt();
+   }
+  
+   public String getTempSessionRole() {
+	return tempSessionRole;
+   }
+
+  public void setTempSessionRole(String tempSessionRole) {
+	this.tempSessionRole = tempSessionRole;
+  }
+   public HashMap<String, String> getAliasMap()
+   {
+      return aliasParamsMap;
+   }
+   
+   public String getAlias(String param)
+   {
+      if (aliasParamsMap!=null)
+         return (String) aliasParamsMap.get(param);
+      else
+         return null;
+   }
+   
+   public void setAlias(String param,String value)
+   {	   
+	 if (this.aliasParamsMap == null)
+     {
+         this.aliasParamsMap=new HashMap<String, String>();
+     }
+     this.aliasParamsMap.put(param.toUpperCase(),value);
+    }
+
+	public int getFetchSize() {
+		return fetchSize;
+	}
+	
+	public void setFetchSize(int fetchSize) {
+		this.fetchSize = fetchSize;
+	}
+
+	public HashMap<String, RepObjInterface> getPatternHashMap() {
+		return patternHashMap;
+	}
+	
+	public void setPatternHashMap(HashMap<String, RepObjInterface> patternHashMap) {
+		this.patternHashMap = patternHashMap;
+	}
+
+	public void setPattern(String patternKey, String patternVal)
+	{
+		if (patternHashMap == null)
+			patternHashMap = new HashMap<String, RepObjInterface>();
+		patternHashMap.put(patternKey.toUpperCase(), new ReplacementObj(patternKey, patternVal));
+		
+	}
+	
+	
+	public String getValue (String key)
+	{
+		return (String)this.getEnvMap().get(key.toUpperCase());
+		
+	}
+	
+	public String getPatternValue(String key)
+	{
+		if (patternHashMap.containsKey(key.toUpperCase()))
+		{
+			RepObjInterface repObj = (RepObjInterface)(patternHashMap.get(key.toUpperCase()));
+			return (repObj).getValue(key);
+		}
+		return null;
+		
+	
+	}
+
+	public HashMap<String, String> getEnvMap() {
+		if (envMap == null)
+			envMap = new HashMap<String, String>();
+		return envMap;
+	}
+
+	public void setEnvMap(HashMap<String,String> envMap) {
+		this.envMap = envMap;
+	}
+
+	public HashMap<String, String> getRegExpMap() {
+		return regExpMap;
+	}
+
+		
+	public void setRegExpPattern(String patternKey, String patternVal)
+	{
+		if (regExpMap == null)
+			regExpMap = new HashMap<String, String>();
+		regExpMap.put(patternKey, patternVal);
+		
+	}
+
+	public int getMaxPatternDepth() {
+		return maxPatternDepth;
+	}
+
+	public void setMaxPatternDepth(int maxPatternDepth) {
+		this.maxPatternDepth = maxPatternDepth;
+	}
+
+	public boolean isDebugOn() {
+		return debugOn;
+	}
+
+	public void setDebugOn(boolean debugOn) {
+		this.debugOn = debugOn;
+	}
+	
+	public boolean isLogCmdEcho() {
+		return logCmdEcho;
+	}
+
+	public void setLogCmdEcho(boolean logCmdEcho) {
+		this.logCmdEcho = logCmdEcho;
+	}
+
+	public boolean isSessionStartup() {
+		return sessionStartup;
+	}
+
+	public void setSessionStartup(boolean sessionStartup) {
+		this.sessionStartup = sessionStartup;
+		setSessionLogging(sessionStartup);
+		this.logCmdEcho = !sessionStartup;
+	}
+
+	public int getPrevMode() {
+		return prevMode;
+	}
+
+	public void setPrevMode(int prevMode) {
+		this.prevMode = prevMode;
+	}
+
+	public boolean isDotModeCmd() {
+		return dotModeCmd;
+	}
+
+	public void setDotModeCmd(boolean dotModeCmd) {
+		this.dotModeCmd = dotModeCmd;
+	}
+
+	public boolean isHistOn() {
+		return histOn;
+	}
+
+	public void setHistOn(boolean histOn) {
+		this.histOn = histOn;
+	}
+
+	public void setTheEncryptObject(Object theEncryptObject) {
+		this.theEncryptObject = theEncryptObject;
+	}
+
+	public Object getTheEncryptObject() {
+		return theEncryptObject;
+	}
+
+	public String getNeoProcessName() {
+		return processName;
+	}
+
+	public void setNeoProcessName(String processName) {
+		this.processName = processName;
+	}
+
+	public boolean isPatternsLoaded() {
+		return patternsLoaded;
+	}
+
+	public void setPatternsLoaded(boolean patternsLoaded) {
+		this.patternsLoaded = patternsLoaded;
+	}
+
+	/**
+	 * @return
+	 * true : can get Platform version
+	 * false: can't get Platform version
+	 */
+	protected boolean getPlatformObjectVersions()
+	{
+	      try
+	      {
+	         Statement stmt = this.connObj.createStatement();
+	         ResultSet rs = null; 
+	         if (stmt.execute("info system"))
+	        	 rs = stmt.getResultSet();
+	         
+	    	  if (this.isDebugOn() ) {
+	    		  System.out.println("rs for info system = " + rs);
+	    	  }
+	    	  
+  	         if (rs!=null && rs.next()) {
+	             {
+	                ndcsVersion = rs.getString(2);
+	                if (ndcsVersion != null){
+	                     ndcsVersion = ndcsVersion.substring(ndcsVersion.indexOf("Version"));
+	                     sutVersion = ndcsVersion.substring(ndcsVersion.indexOf("Release"),ndcsVersion.indexOf("("));
+	                     String platformVersion = sutVersion.substring(8);
+	                }
+                        databaseVersion = rs.getString(5);
+                        databaseEdition = rs.getString(6);
+
+	             }
+	             if (this.debugOn) {
+	                System.out.println("ndcs version:: " + ndcsVersion);
+	                System.out.println("database version:: " + databaseVersion);
+	                System.out.println("database edition:: " + databaseEdition);
+	             }
+	             rs.close();
+	             stmt.close();
+	         }
+	      } catch (Exception se) {
+	    	  if (this.isDebugOn() ) {
+	    		  System.out.println("error:"+se.getMessage() );
+	    		  se.printStackTrace(System.out);
+	    	  }
+	    	  
+	    	  ndcsVersion = null;
+	    	  return false;
+	      }
+	      this.setNdcsVersion(ndcsVersion);
+	      return true;
+	   }
+
+	public String getNdcsVersion() {
+		return ndcsVersion;
+	}
+
+	public void setNdcsVersion(String ndcsVersion) {
+		this.ndcsVersion = ndcsVersion;
+	}
+
+	public String getDotMode() {
+		return dotMode;
+	}
+
+	public void setDotMode(String dotMode) {
+		this.dotMode = dotMode;
+	}
+
+	public String getServerType() {
+		return serverType;
+	}
+
+	public void setServerType(String serverType) {
+		this.serverType = serverType;
+	}
+
+	public String getDatabaseVersion() {
+		return databaseVersion;
+	}
+
+	public String getDatabaseEdition() {
+ 		return databaseEdition;
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/SessionDefaults.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/SessionDefaults.java b/core/conn/trafci/src/main/java/org/trafodion/ci/SessionDefaults.java
new file mode 100644
index 0000000..3639ce1
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/SessionDefaults.java
@@ -0,0 +1,342 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+public interface SessionDefaults {
+   final String DATABASE_EDITION = System.getenv("TRAFODION_VER_PROD");
+   final String PROD_NAME = System.getenv("TRAFODION_VER_PROD")+" Command Interface ";
+   final String APP_NAME = "TrafCI";
+   final String DRIVER_NAME = "org.trafodion.jdbc.t4.T4Driver"; 
+   final String PKG_NAME = "/org/trafodion/ci/";
+   final String PROP_DEFAULT_NAME = PKG_NAME + "Properties/trafciDefaultLookAndFeel.properties";
+   final String PROP_TRAFCILF = "trafciLF";
+   final String PROP_TRACE = "trafci.enableTrace";
+   final String PROP_OS = "os.name";
+   final String PROP_PRINT_TIME = "trafci.printConnTime";
+   final String PROP_MAX_DELAY = "trafci.maxDelayLimit";
+   
+   String dsnName="Default_DataSource";
+   String portNumber="18650";
+   String lineSeperator=System.getProperty("line.separator");
+   
+
+	String DEFAULT_SQL_PROMPT = "SQL>";
+	String DEFAULT_WMS_PROMPT = "WMS>";
+	String DEFAULT_CS_PROMPT = "CS>";
+	String SQL = "SQL";
+	String WMS = "WMS";
+	String CS = "CS";
+   
+   String DEFAULT_DISPLAY_FORMAT="RAW";
+   
+   final int trafciMajorVersion=1;
+   final int trafciMinorVersion=0;
+
+   final int QRY_HISTORY_MAX_LMT=100;
+   final String DEFAULT_DATA_SOURCE="Default_DataSource";
+
+   final int abruptExit=-9999;
+   final int DEFAULT_EXIT_CODE = 0;
+   
+   final int SQL_ERR_CONN_MAX_LIMIT=-29154;
+   final int NDCS_ERR_DSN_NOT_AVAILABLE = -29164;
+   final int UNKNOWN_DATA_SOURCE=29182;
+   final int MIN_COL_DISPLAY_SIZE = 4;
+   final int DISPLAY_COLSIZE = 160;
+   final int WMS_PROCESS_DOES_NOT_EXIST=-29162;
+   final int SQL_ERR_INVALID_AUTH=-29153;
+   final int MAX_DELAY_LIMIT=3600; //in seconds
+   final int DEFAULT_FETCH_SIZE=0; 
+   final int MAX_PATTERN_DEPTH=1; 
+   final int PATTERN_DEPTH_LIMIT = 10;
+   final int SQL_ERR_CLI_AUTH=-8837;
+   
+   /* don't ask me why mxci does this, but look at SqlCmd.cpp of
+    * mxci's code line 1534, and you'll see that 72 is their limit,
+    * after that they trim the whole last column header
+    */
+   final int MXCI_TRIM_FIX = 72;
+   
+   final int IQ=0;
+   final int SQLQ=1;
+   final int PRUNQ=2;
+   //final int CSQ=3;
+   final int NSQ=4;
+   final int CQ=5;      // conditional query
+   //final int SECQ=6; 
+   final int SPJQ=7;    // SPJ deployment
+
+   final int USERI=0;
+   final int PRUNI=1;
+   final int PERLI=2;
+   final int PYTHI=3;
+
+   final int SQL_MODE=0;
+   final int CS_MODE=2;
+   final int WMS_MODE=4;  
+
+   final int CONSOLE_INPUT=0;
+   final int FILE_INPUT=1;
+
+   final int CONSOLE_READ_MODE=0;
+   final int SCRIPT_READ_MODE=1;
+   final int OBEY_READ_MODE=2;
+
+   final int CONSOLE_WRITE_MODE=0;
+   final int LOG_WRITE_MODE=1;
+   final int SPOOL_WRITE_MODE=2;
+   final int CONSOLE_SPOOL_WRITE_MODE=3;
+   final int SILENT_SPOOL_WRITE_MODE=4;
+
+   final int CIDEFAULT_VIEW=0;
+   final int MXCI_VIEW=4;
+
+   final int RAW_FORMAT=0;
+   final int HTML_FORMAT=1;
+   final int XML_FORMAT=2;
+   final int CSV_FORMAT=3;
+
+   // include only the interface commands first tokens
+   final int iqKeyWordBase=100;
+   final int EXIT=iqKeyWordBase + 1;
+   //final int QUIT=iqKeyWordBase + 2;
+   final int DISCONNECT=iqKeyWordBase + 3;
+   final int SET=iqKeyWordBase + 4;
+   final int ED=iqKeyWordBase + 5;
+   final int EDIT=iqKeyWordBase + 6;
+   final int SPOOL=iqKeyWordBase + 7;
+   final int SLASH=iqKeyWordBase + 8;
+   final int RUN=iqKeyWordBase + 9;
+   final int SHOW=iqKeyWordBase + 10;
+   final int AT=iqKeyWordBase + 11;
+   final int OBEY=iqKeyWordBase + 12;
+   final int LOG=iqKeyWordBase + 13;
+   final int MODE=iqKeyWordBase+14;
+   final int RESET=iqKeyWordBase+15;
+   final int PRUN=iqKeyWordBase + 16;
+   final int SET_TIME=iqKeyWordBase+17;
+   final int SHOW_TIME=iqKeyWordBase+18;
+   final int SET_TIMING=iqKeyWordBase+19;
+   final int SHOW_TIMING=iqKeyWordBase+20;
+   final int SET_SQLPROMPT=iqKeyWordBase+21;
+   final int SHOW_SQLPROMPT=iqKeyWordBase+22;
+   final int SET_SQLTERMINATOR=iqKeyWordBase+23;
+   final int SHOW_SQLTERMINATOR=iqKeyWordBase+24;
+   final int SET_PARAM=iqKeyWordBase+25;
+   final int SHOW_PARAM=iqKeyWordBase+26;
+   final int SET_IDLETIMEOUT=iqKeyWordBase+27;
+   final int SHOW_IDLETIMEOUT=iqKeyWordBase+28;
+   final int SHOW_SCHEMA=iqKeyWordBase+29;
+   final int SHOW_CATALOG=iqKeyWordBase+30;
+   final int SHOW_CATALOGS=iqKeyWordBase+31;
+   final int SHOW_SCHEMAS=iqKeyWordBase+32;
+   final int SHOW_TABLES=iqKeyWordBase+33;
+   final int SHOW_VIEWS=iqKeyWordBase+34;
+   final int SHOW_TABLE=iqKeyWordBase+35;
+   final int SHOW_SYNONYMS=iqKeyWordBase+36;
+   final int SHOW_MVS=iqKeyWordBase+37;
+   final int SHOW_MVGROUPS=iqKeyWordBase+38;
+   final int HISTORY=iqKeyWordBase+39;
+   final int REPEAT=iqKeyWordBase+40;
+   final int FC=iqKeyWordBase+41;
+   final int CLEAR=iqKeyWordBase+42;
+   final int SET_LISTCOUNT=iqKeyWordBase+43;
+   final int SHOW_LISTCOUNT=iqKeyWordBase+44;
+   final int SECTION=iqKeyWordBase+45;
+   final int HELP=iqKeyWordBase+46;
+   final int SHOW_PROCEDURES=iqKeyWordBase+47;
+   final int ENV=iqKeyWordBase+48;
+   final int SHOW_MODE=iqKeyWordBase+49;
+   final int SESSION=iqKeyWordBase+50;
+   final int SHOW_SESSION=iqKeyWordBase+51;
+   final int SET_PROMPT=iqKeyWordBase+52;
+   final int SAVEHIST=iqKeyWordBase+53;
+   final int VERSION=iqKeyWordBase+54;
+   final int SET_LOOKANDFEEL=iqKeyWordBase+55;
+   final int SHOW_LOOKANDFEEL=iqKeyWordBase+56;
+   final int SET_SERVICE=iqKeyWordBase+57;
+   final int SHOW_SERVICE=iqKeyWordBase+58;
+   final int SET_DISPLAY_COLSIZE=iqKeyWordBase+59;
+   final int SHOW_DISPLAY_COLSIZE=iqKeyWordBase+60;
+   
+   final int SET_COLSEP=iqKeyWordBase+61;
+   final int SHOW_COLSEP=iqKeyWordBase+62;
+   final int CONNECT=iqKeyWordBase+63;
+   final int RECONNECT=iqKeyWordBase+64;
+   final int SHOW_PREPARED=iqKeyWordBase+65;
+   final int SET_HISTOPT=iqKeyWordBase+66;
+   final int SHOW_HISTOPT=iqKeyWordBase+67;
+   final int GET=iqKeyWordBase+68;
+   final int SET_STATISTICS=iqKeyWordBase+69;
+
+   final int LOCALHOST=iqKeyWordBase+70;
+
+   final int SET_MARKUP=iqKeyWordBase+71;
+   final int SHOW_MARKUP=iqKeyWordBase+72;
+   final int SHOW_PARAMS=iqKeyWordBase+73;
+   final int AUDIT=iqKeyWordBase+74;
+   final int SET_AUTOPREPARE=iqKeyWordBase+75;
+   final int SHOW_AUTOPREPARE=iqKeyWordBase+76;
+   final int ERROR=iqKeyWordBase+77;
+   final int SHOW_LASTERROR=iqKeyWordBase+78;
+   final int ONLINEDBDUMP=iqKeyWordBase+79;
+   final int SHOW_INVENTORY=iqKeyWordBase+80;
+   final int SHOW_RECCOUNT=iqKeyWordBase+81;
+   final int SRUN=iqKeyWordBase+82;
+   final int SHOW_STATISTICS=iqKeyWordBase+83;
+   final int ALLOW=iqKeyWordBase+84;
+   final int DENY=iqKeyWordBase+85;
+   final int SCHEDULE=iqKeyWordBase+86;
+   final int SHOW_ACCESS=iqKeyWordBase+87;
+   final int LIST=iqKeyWordBase+88;
+   final int LIST_OPENS=iqKeyWordBase+89;
+   final int LIST_LOCKS=iqKeyWordBase+90;
+   final int DELAY=iqKeyWordBase+91;
+   final int SHOW_ERRORCODE=iqKeyWordBase+92;
+   final int SHOW_ACTIVITYCOUNT=iqKeyWordBase+93;
+   final int SET_CMDECHO=iqKeyWordBase+94;
+
+   final int ALIAS=iqKeyWordBase+95;
+   final int SHOW_ALIAS=iqKeyWordBase+96;
+   final int SHOW_ALIASES=iqKeyWordBase+97;
+
+   final int SET_FETCHSIZE=iqKeyWordBase+98;
+   final int SHOW_FETCHSIZE=iqKeyWordBase+99;
+   
+   final int SET_PATTERN=iqKeyWordBase+100;
+   final int SHOW_PATTERN=iqKeyWordBase+101;
+   final int SHOW_PATTERNS=iqKeyWordBase+102;
+   final int SET_PATTERNDEPTH=iqKeyWordBase+103;
+   final int SHOW_PATTERNDEPTH=iqKeyWordBase+104;
+   final int SET_DEBUG=iqKeyWordBase+105;
+   final int SHOW_DEBUG=iqKeyWordBase+106;
+   
+   final int DOTSQL = iqKeyWordBase+107;
+   final int DOTCS  = iqKeyWordBase+108;
+   final int DOTNS  = iqKeyWordBase+109;
+   final int DOTWMS = iqKeyWordBase+110;
+   final int DOTSEC = iqKeyWordBase+111;
+   
+   final int SET_CMDDISPLAY  =  iqKeyWordBase+112;
+   final int SHOW_CMDDISPLAY =  iqKeyWordBase+113;
+   final int CREATE_SERVER   =  iqKeyWordBase+114;
+   final int ALTER_SERVER    =  iqKeyWordBase+115;
+   final int DROP_SERVER     =  iqKeyWordBase+116;
+   final int INFO_SERVER     =  iqKeyWordBase+117;
+   final int CREATE_USER     =  iqKeyWordBase+118;
+   final int ALTER_USER      =  iqKeyWordBase+119;
+   final int DROP_USER       =  iqKeyWordBase+120;
+   final int CREATE_CSR      =  iqKeyWordBase+121;
+   final int CREATE_CERT     =  iqKeyWordBase+122;
+   final int INFO_CERT_POLICY = iqKeyWordBase+123;
+   final int INSERT_CERT     =  iqKeyWordBase+124;
+   final int ALTER_CERT_POLICY = iqKeyWordBase+125;
+   final int CHANGE_PASS     =  iqKeyWordBase+126;
+   final int SHOW_PROCESSNAME=  iqKeyWordBase+127;
+   final int CREATE_ROLE     =  iqKeyWordBase+128;
+   final int DROP_ROLE       =  iqKeyWordBase+129;   
+   final int GRANT_ROLE      =  iqKeyWordBase+130;
+   final int REVOKE_ROLE     =  iqKeyWordBase+131;
+   final int SET_DEFAULTROLE =  iqKeyWordBase+132;   
+   final int CREATE_PLATFORM_USER     = iqKeyWordBase+133;
+   final int SHOW_USER       =  iqKeyWordBase+136;
+   final int SHOW_SERVER     =  iqKeyWordBase+137;
+   final int ALTER_ROLE      =  iqKeyWordBase+138;
+   final int SHOW_ROLE       =  iqKeyWordBase+139;
+   final int SET_CONNECTOPT  =  iqKeyWordBase+140;
+   final int SHOW_CONNECTOPT =  iqKeyWordBase+141; 
+   final int INFO_POLICY     =  iqKeyWordBase+142; 
+   final int ALTER_POLICY    =  iqKeyWordBase+143;
+   final int INFO_USER       =  iqKeyWordBase+144;
+   final int INFO_POLICY_WITH_OPTION  =  iqKeyWordBase+145;
+   final int ALTER_LOG_POLICY =  iqKeyWordBase+146;
+   final int ALTER_PWD_COMPLEXITY_POLICY =  iqKeyWordBase+147;
+   final int ALTER_RESET_PWD_POLICY =  iqKeyWordBase+148;
+   final int ALTER_RESET_MOSTSECURE =  iqKeyWordBase+149;
+   final int ALTER_RESET_ALLDEFAULT =  iqKeyWordBase+150; 
+   final int ALTER_PWD_QUALITY_POLICY =  iqKeyWordBase+151;
+   final int INFO_ROLE      =  iqKeyWordBase+152;
+
+   final int LIST_JAR	= iqKeyWordBase+153;
+   final int LIST_JARS	= iqKeyWordBase+154;
+   final int UPLOAD_JAR	= iqKeyWordBase+155;
+   final int DROP_JAR	= iqKeyWordBase+156;
+
+   final int ADD_LIB	= iqKeyWordBase+157;
+   final int MODIFY_LIB	= iqKeyWordBase+158;
+   final int REMOVE_LIB	= iqKeyWordBase+160;
+
+   final int SHOW_INDEXES=iqKeyWordBase+159;
+   
+   // these are special query cases for 
+   // only to trim the output
+   final int sqKeyBase=500;
+   final int SHOWDDL=sqKeyBase+ 1;
+   final int REORG=sqKeyBase + 2;
+   final int REORGANIZE=sqKeyBase + 3;
+   final int MAINTAIN=sqKeyBase + 4;
+   final int SHOWLABEL=sqKeyBase + 5;
+   final int SHOWPLAN=sqKeyBase + 6;
+   final int SHOWSHAPE=sqKeyBase + 7;
+   final int SHOWCONTROL=sqKeyBase + 8;
+   final int INVOKE=sqKeyBase + 9;
+   final int REPLICATE=sqKeyBase + 10;
+   final int SHOWTRANSACTION=sqKeyBase + 11;
+
+   // these are only db queries
+   // but not a pass thru
+
+   final int dbqKeyBase=1000;
+   final int PREPARE=dbqKeyBase+1;
+   final int EXECUTE=dbqKeyBase+2;
+   final int EXPLAIN=dbqKeyBase+3;
+   final int INFOSTATS=dbqKeyBase+4;
+   final int SET_SCHEMA=dbqKeyBase+5;
+   final int SET_CATALOG=dbqKeyBase+6;
+   final int CALL=dbqKeyBase+7;
+   final int CONTROL=dbqKeyBase+8;
+
+   // conditional queries
+   final int condKeyBase=1500;
+   final int IF_THEN=condKeyBase+1;
+   final int LABEL=condKeyBase+2;
+   final int GOTO=condKeyBase+3;
+   
+   //version queries
+   final int versionKeyBase = 2000; 
+   final int VERSION_M5 = versionKeyBase;
+   final int VERSION_M6 = versionKeyBase+100;
+   final int VERSION_M7 = versionKeyBase+200;
+   final int VERSION_M8 = versionKeyBase+300;
+   final int VERSION_M9 = versionKeyBase+400;
+   final int VERSION_M10 = versionKeyBase+500;
+   final int VERSION_M11 = versionKeyBase+600;
+   
+   //mode change command string
+	final String CMDOPEN = "CMDOPEN";
+	final String WMSOPEN = "WMSOPEN";
+	final String CMDCLOSE = "CMDCLOSE";
+	final String WMSCLOSE = "WMSCLOSE";
+   
+   
+   
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/SessionError.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/SessionError.java b/core/conn/trafci/src/main/java/org/trafodion/ci/SessionError.java
new file mode 100644
index 0000000..1aa55a9
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/SessionError.java
@@ -0,0 +1,181 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+public interface SessionError
+{
+
+         //The third arugment represents the ERROR TYPE. I = Informational, W = Warning
+       ErrorObject CONSOLE_READER_ERR = new ErrorObject("29400", "Could not initialize the console reader.");
+       ErrorObject CONSOLE_WRITER_ERR =  new ErrorObject("29401", "Could not initialize the console writer.");
+       ErrorObject CMD_LINE_ARGS_ERR = new ErrorObject("29402", "Invalid Number of arguments passed.");
+       ErrorObject SCRIPT_FILE_NOT_FOUND = new ErrorObject("29403", "Could not find the script file specified.");
+       ErrorObject DRIVER_INIT_ERR = new ErrorObject("29404", "Could not instantiate the driver class.");
+       ErrorObject DRIVER_INIT_ILLEGAL_ERR = new ErrorObject("29405", "Could not instantiate the driver class because of an IllegalAccessException.");
+       ErrorObject DRIVER_CLASS_ERR = new ErrorObject("29406", "Could not find JDBC Type 4 Driver in the classpath.");
+
+       ErrorObject CONN_MAX_LIMIT_ERR = new ErrorObject("29407", "Failed to connect to the database. Connection limit exceeded");
+
+       ErrorObject SET_NO_OPTION = new ErrorObject("29408", "SET command must have an option specified.");
+       ErrorObject SHOW_NO_OPTION = new ErrorObject("29409", "SHOW command must have an option specified.");
+       ErrorObject OBEY_FILE_NOT_FOUND = new ErrorObject("29410", "Could not find the file specified.");
+       ErrorObject SPOOL_FILE_NOT_FOUND = new ErrorObject("29411", "Could not create the spool file.");
+       ErrorObject CMD_NOT_CS_SUPPORTED = new ErrorObject("29412", "This command is not supported in CS mode.");
+       ErrorObject CMD_NOT_SQL_SUPPORTED = new ErrorObject("29414", "This command is not supported in SQL mode.");
+       ErrorObject CMD_NOT_MODE_SUPPORTED = new ErrorObject("29415", "This command is not supported in current mode.");   
+       
+       //Warnings
+       ErrorObject SHOW_TAB_NOT_FOUND = new ErrorObject("29416", "No tables found.", 'I');
+       ErrorObject SHOW_CAT_NOT_FOUND = new ErrorObject("29417", "No catalogs found.", 'I');
+       ErrorObject SHOW_SCH_NOT_FOUND = new ErrorObject("29418", "No schemas found.", 'I');
+       ErrorObject SHOW_VIEW_NOT_FOUND = new ErrorObject("29419", "No views found.", 'I');
+       ErrorObject SHOW_SYNONYM_NOT_FOUND = new ErrorObject("29420", "No synonyms found.", 'I');
+       ErrorObject SHOW_MV_NOT_FOUND = new ErrorObject("29421", "No materialized views found.", 'I');
+       ErrorObject SHOW_MVG_NOT_FOUND = new ErrorObject("29422", "No materialized view groups found.", 'I');
+       ErrorObject SHOW_PROC_NOT_FOUND = new ErrorObject("29423", "No procedures found.", 'I');
+       ErrorObject SHOW_TAB_IDX_NOT_FOUND = new ErrorObject("29424", "No indexes present for object, ", 'I');
+       ErrorObject SHOW_TAB_MVS_NOT_FOUND = new ErrorObject("29425", "No materialized views present for object, ", 'I');
+       ErrorObject SHOW_TAB_SYN_NOT_FOUND = new ErrorObject("29426", "No synonyms present for object, ", 'I');
+       ErrorObject SHOW_PREP_NOT_FOUND = new ErrorObject("29427", "No prepared statements found.", 'I');
+       ErrorObject SHOW_PARAM_NOT_FOUND = new ErrorObject("29428", "No parameters found.", 'I');
+       
+       //More Warnings
+       ErrorObject SPOOL_ON_ON = new ErrorObject("29429", "Spooling is already ON.", 'I');
+       ErrorObject SPOOL_OFF_OFF = new ErrorObject("29430", "Spooling is already OFF.", 'I');
+       ErrorObject STMT_NOT_FOUND = new ErrorObject("29431", "Prepared statement %s was not found.");
+       ErrorObject INVALID_PARAM_NUM = new ErrorObject("29432", "Invalid number of parameters for prepared statement %s.");
+       ErrorObject NUMERIC_VAL_REQ = new ErrorObject("29433", "Non-numeric value cannot be specified for numeric data type.");
+       ErrorObject SET_IDLETIMEOUT_VAL_ERR = new ErrorObject("29434", "Invalid IdleTimeout value. The value must be in the range 0-2147483647.");
+       ErrorObject SET_LISTCOUNT_VAL_ERR = new ErrorObject("29435", "Invalid ListCount value. The value must be in the range 0-2147483647.");
+       ErrorObject REPEAT_ERR = new ErrorObject("29436", "The specified statement does not exist in the history buffer.");
+       ErrorObject HISTORY_ERR = new ErrorObject("29437", "The maximum size of the history buffer is "+SessionDefaults.QRY_HISTORY_MAX_LMT+".");
+       ErrorObject HISTORY_BUF_ERR = new ErrorObject("29438", "The history buffer is empty.");
+       ErrorObject SLASH_ERR = new ErrorObject("29439", "The query buffer is empty.");
+       ErrorObject DIR_NOT_FOUND = new ErrorObject("29440", "Directory not found or"+SessionDefaults.lineSeperator+"does not have READ/WRITE permissions.");   
+       ErrorObject OBEY_SECTION_NOT_FOUND = new ErrorObject("29441", "was not found in file ");
+       ErrorObject SAVE_FILE_CREATE_ERROR = new ErrorObject("29442", "Could not create the specified file.");
+       ErrorObject DB_CONN_NOT_EXIST = new ErrorObject("29443", "Database connection does not exist. Please connect to the database by using the connect or the reconnect command.");
+       ErrorObject DB_DISCONNECT_ON_USER_REQ = new ErrorObject("29444", "The current operation has been cancelled and the connection to the database has been lost."+SessionDefaults.lineSeperator+"Please connect to the database by using the connect or the reconnect command.");
+       ErrorObject OPERATION_CANCELLED = new ErrorObject("29445", "The current operation has been cancelled.");
+       ErrorObject PRUN_CONN_CNT_ERR = new ErrorObject("29446", "Number of connections entered is not within the allowable range.");
+       ErrorObject INCORRECT_OVERWRITE_OPTION = new ErrorObject("29447", "Incorrect value specified for overwrite option.");
+       ErrorObject EXECUTE_PRIVILEGE_ERR = new ErrorObject("29448", "The user does not have EXECUTE privilege.");
+       ErrorObject SERVER_PRODUCT_ERR = new ErrorObject("29449", "Server product may not be installed or an internal error has occurred. Please contact support.");
+       ErrorObject CALL_ERR = new ErrorObject("29450", "This command is not supported by this JDBC Type 4 Driver version.");
+       ErrorObject INTERNAL_ERR = new ErrorObject("29451", "Internal error processing command.");
+       
+       ErrorObject INVALID_MAXCONN = new ErrorObject("29452", "Invalid value specified for property, trafci.prun.maxconn.");
+       ErrorObject NO_FILES_OF_EXTENSION = new ErrorObject("29453", "No files present with this extension.");
+       ErrorObject INVALID_CONN_VALUE = new ErrorObject("29454", "Invalid value specified for -c/connections option.");
+       ErrorObject UNKOWN_OPTION = new ErrorObject("29455", "Unknown option specified: ");
+       ErrorObject DEFAULT_OPTION_ERR = new ErrorObject("29456", "-d|defaults option cannot be specified with any other options.");
+       ErrorObject NWMS_NOT_STARTED = new ErrorObject("29457", "NWMS not started on this server.", 'W');
+       
+       ErrorObject SCRIPTS_DIR_NOT_FOUND = new ErrorObject("29458", "Scripts Directory not found or"+SessionDefaults.lineSeperator+"does not have READ/WRITE permissions.");
+       ErrorObject LOGS_DIR_NOT_FOUND = new ErrorObject("29459", "Logs Directory not found or"+SessionDefaults.lineSeperator+"does not have READ/WRITE permissions.");  
+       
+       
+       String GENERIC_SYNTAX_ERROR_CODE = "29460";
+       String SYNTAX_ERROR_PREFIX = "A syntax error occurred at or before:";
+       String ERROR_CODE_PREFIX = "*** ERROR[";
+       String ERROR_CODE_SUFFIX = "]";
+
+
+       ErrorObject LIST_NO_OPTION = new ErrorObject("29461", "LIST command must have an option specified.");
+       ErrorObject OBEY_PATH_NOT_FOUND = new ErrorObject("29462", "Could not find the file or directory specified.");
+       ErrorObject OBEY_WILDCARD_NOT_FOUND  =new ErrorObject("29463", "Could not find any file(s) with the specified extension.");
+       ErrorObject PARAM_NOT_FOUND = new ErrorObject("29464", "Param "); //Add Parameter name as suffix
+       
+       ErrorObject OBEY_BLANK_SESSION_ERR = new ErrorObject("29465","Obey commands inside of files are executed in non-interactive mode and require a filename or wildcard.");
+       ErrorObject OBEY_DEPTH_MAX = new ErrorObject("29466","The max obey depth has been reached, breaking current obey loop. Recursion detected in ");
+      String CS_SYNTAX_ERROR_CODE = "29467";
+      
+      ErrorObject SESSION_DISCONNECT_ERR = new ErrorObject("29468", "Session Disconnected. Please connect to the database by using connect/reconnect command.", 'I');
+      ErrorObject MULTIBYTE_DISP_WARN = new ErrorObject("29469", "Unable to align display for multibyte characters." +
+                                       " Try relaunching TrafCI with -Djava.awt.headless=true", 'W');
+
+      /* Conditional Errors */
+      ErrorObject VARIABLE_NOT_FOUND = new ErrorObject("29471", "Unable to find TrafCI variable ");
+      // use 29464 for PARAM_NOT_FOUND
+      ErrorObject INT_STR_COMPARISON = new ErrorObject("29472", "Unable to compare an integer with a string.");
+      ErrorObject STR_INT_COMPARISON = new ErrorObject("29473", "Unable to compare a string with an integer.");
+      ErrorObject INVALID_STRING_COMPARE = new ErrorObject("29474", "Unable to compare strings using the operator ");
+
+      ErrorObject MAX_DELAY_LIMIT = new ErrorObject("29475", "Invalid delay time specified. The value must be in the range 0-");
+      
+      // warning for label:
+      ErrorObject LABEL_WARNING = new ErrorObject("29476", "TrafCI encountered a blank label. Use the format LABEL <name>",'W');
+      ErrorObject OUT_OF_BOUNDS = new ErrorObject("29477","ArrayIndexOutOfBounds exception has occurred.");
+      ErrorObject MESSAGE_WARNING = new ErrorObject("29478", "Skipping command until a matching 'LABEL ",'W');
+      ErrorObject GOTO_MESSAGE = new ErrorObject("29479", "GOTO statement executed, ignoring all commands until a 'LABEL ",'W');
+      ErrorObject MATCHING_LABEL = new ErrorObject("29480", "Matching label encountered, no longer ignoring commands.",'I');
+      
+      /* Alias commands */
+      ErrorObject SHOW_ALIAS_NOT_FOUND = new ErrorObject("29481", "No aliases found.", 'I');
+      ErrorObject COMMAND_NAME_NOT_ALLOWED= new ErrorObject("29482", "Command name, ", 'I');
+      String COMMAND_NAME_NOT_ALLOWED_SUFFIX= " not allowed as Alias.";
+      ErrorObject INVALID_COMMAND_FOR_ALIAS = new ErrorObject("29483", "Alias on an alias not supported., ", 'I');
+            
+      ErrorObject SET_FETCHSIZE_VAL_ERR = new ErrorObject("29484", "Invalid fetch size value. The value must be in the range 0-2147483647.");
+            
+      /* Pattern commands */
+      ErrorObject SET_PATTERN_DEPTH_VAL_ERR = new ErrorObject("29485", "Invalid pattern depth value. The value must be in the range 0-" + SessionDefaults.PATTERN_DEPTH_LIMIT+ ".");
+      ErrorObject SHOW_PATTERN_NOT_FOUND = new ErrorObject("29486", "No patterns found.",'I');
+      String PATTERN_COMMAND_NAME_NOT_ALLOWED_SUFFIX= " not allowed as Pattern.";
+      ErrorObject INVALID_REGEXP = new ErrorObject("29487", "Invalid regular expression.",'I');
+      
+      /* Security commands */
+      ErrorObject CMD_NOT_SUPPORTED_SERVER = new ErrorObject("29488", "This command is not supported on this server version.");
+      ErrorObject FILE_NO_READ_PERMISSIONS = new ErrorObject("29489", "Unable to read the specified file.");
+      ErrorObject CMD_NOT_SEC_SUPPORTED = new ErrorObject("29490", "This command is not supported in SEC mode.");
+      ErrorObject CMD_NOT_WMS_SUPPORTED = new ErrorObject("29491", "This command is not supported in WMS mode.");
+      ErrorObject INVALID_NUMBER_FORMAT = new ErrorObject("29492", "Numeric value out of range ");
+      ErrorObject INFO_SEC_NO_ROWS = new ErrorObject("29493", "No server configuration found.",'I');
+      ErrorObject MISSING_PARM = new ErrorObject("29494", "Required Parameter ",'E');
+      ErrorObject INVALID_PWORD = new ErrorObject("29495", "Passwords do not match.",'E');
+      ErrorObject DUPLICATE_PARAM = new ErrorObject("29496", "Duplicate Parameter ",'E');
+      ErrorObject SET_DUMPPRIORITY_VAL_ERR = new ErrorObject("29497", "Invalid dump priority specified. The value must be in the range 1...199");
+      /* Param commands */
+      ErrorObject INVALID_PARAM_STRING_VALUE = new ErrorObject("29498", "Invalid parameter value. ");
+      ErrorObject SET_BACKUPSYNC_DURATION_ERR = new ErrorObject("29499", "Invalid backup sync duration specified. The value must be in the range 1...31");
+      //SPJ deployment error
+      ErrorObject JAR_EXTENSION_MISSING = new ErrorObject("29500", "JAR extension is missing. ");
+      ErrorObject JAR_EMPTY = new ErrorObject("29501", "JAR file is empty. Failed to upload jar file ", 'I');
+      ErrorObject JAR_EMPTY_FOLDER = new ErrorObject("29502", "Specified directory contains no JAR file. SPJ Uploading failed.");
+      
+      //Server Side errors start from 29550 - 29599
+      
+      ErrorObject MISSING_NODE_DUMP = new ErrorObject("29550","Missing Node Dump Pattern.");
+      ErrorObject MISSING_CORE_DUMP = new ErrorObject("29551","Missing Core File Pattern.");
+      ErrorObject MISSING_CORE_NODE_DUMP = new ErrorObject("29552","Missing Node Dump and Core File Pattern.");
+
+      ErrorObject NOT_SUPPORT = new ErrorObject("29553", "This platform does not support ", 'I');     
+      ErrorObject SHOW_TAB_TRIG_NOT_FOUND = new ErrorObject("29554", "No triggers present for object, ", 'I');
+     ErrorObject CMD_NOT_SEAQUEST_SUPPORTED = new ErrorObject("29555", "This command is not supported.");
+     ErrorObject CMD_ONLY_CS_SUPPORTED = new ErrorObject("29556", "This command is only supported in CS mode.");
+     ErrorObject CMD_ONLY_WMS_SUPPORTED = new ErrorObject("29557", "This command is only supported in WMS mode.");
+     ErrorObject CMD_ONLY_SQL_SUPPORTED = new ErrorObject("29558", "This command is only supported in SQL mode.");
+     ErrorObject CMD_SYNTAX_ERROR = new ErrorObject("29559", "A syntax error occurred in the command.");
+     ErrorObject SQL_RESERVED_WORD_ERROR = new ErrorObject("29560", "SQL is a reserved word. Please specify another string.");
+     ErrorObject WMS_RESERVED_WORD_ERROR = new ErrorObject("29561", "WMS is a reserved word. Please specify another string.");
+     ErrorObject CS_RESERVED_WORD_ERROR = new ErrorObject("29562", "CS is a reserved word. Please specify another string.");
+}


[10/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ConsoleReader.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ConsoleReader.java b/core/conn/trafci/src/org/trafodion/ci/ConsoleReader.java
deleted file mode 100644
index 4e8545e..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ConsoleReader.java
+++ /dev/null
@@ -1,218 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import sun.misc.Signal;
-import sun.misc.SignalHandler;
-
-public class ConsoleReader
-{
-
-   private BufferedReader br=null;
-   private InputStream in=null;
-   private String line=null;
-   String newLine=SessionDefaults.lineSeperator;
-   String defaultEncoding="ISO-8859-1";
-   SignalHandler CTRLCHandler=null;
-   Signal INTSignal=null;
-   private boolean queryInterrupted=false;
-   private boolean doTrace = Boolean.getBoolean("trafci.enableTrace");
-   
-   StringBuffer lineBuffer=null;
-   private String prompt = SessionDefaults.DEFAULT_SQL_PROMPT;
-   private boolean time = false;
-   private boolean ampmFmt = false;
-   private MaskingThread mt=null;
-   WCIUtils wcs=null;
-
-   ConsoleReader()
-   {
-      newLine=System.getProperty("line.separator");
-      defaultEncoding=System.getProperty("file.encoding");
-    
-      CTRLCHandler = new MySignalHandlerClass();
-      try {
-      INTSignal=new Signal("INT");
-      } catch (Exception e) {}
-   }
-
-   public void setPrompt(String ps, boolean time, boolean ampmFmt)
-   {
-      this.prompt = ps;
-      this.time = time;
-      this.ampmFmt = ampmFmt;
-   }
-
-   public void setMaskingThread(MaskingThread mt, WCIUtils wcs)
-   {
-      this.mt = mt;
-      this.wcs=wcs;
-   }
- 
-   private class MySignalHandlerClass implements SignalHandler
-   {
-      public void handle(Signal sig)
-      {
-         if (null != lineBuffer)  
-            lineBuffer.setLength(0);
-
-         queryInterrupted = true;
-        
-         if (mt!=null)
-         {
-            mt.stopMasking();
-            if (wcs!= null)wcs.enableEcho();
-         }
-
-         String timeStamp = "";
-         SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss ");
-         if (time)
-         {
-            if (ampmFmt)
-               timeStamp = DateFormat.getTimeInstance().format(new Date())+ " ";
-            else
-               timeStamp = sdf.format(new Date());
-         }
-
-         System.out.print("^C"+SessionDefaults.lineSeperator+SessionDefaults.lineSeperator + timeStamp+prompt);
-      }
-   }
-
-   public void initialize() throws IOException
-   {
-      this.in=System.in;
-   }
-
-   public String getLine() throws IOException, UserInterruption
-   {
-      next();
-      return this.line;
-   }
-
-   public String readLine() throws UnsupportedEncodingException, UserInterruption, IOException
-   {
-      StringBuffer lineBuffer=null;
-      lineBuffer=new StringBuffer();
-	  int i=-1;
-            
-      try {
-         if (CTRLCHandler != null)
-         {
-            Signal.handle(INTSignal, CTRLCHandler);
-         }
-      } catch (Exception e) {}
-
-      while (true)
-      {
-         queryInterrupted = false;
-         this.in.mark(1);
-         try{
-         if ((i = this.in.read()) != -1)
-         {
-            if (queryInterrupted)
-            {
-               in.reset();
-               throw new UserInterruption();
-            }
-
-            lineBuffer.append((char)i);
-            line = lineBuffer.toString();
-            
-            if (!defaultEncoding.equalsIgnoreCase("Cp1047")) 
-            {
-               byte[] ba=line.getBytes("ISO-8859-1"); // added for nls character support
-               line=new String(ba,defaultEncoding);
-            }
-            
-            if (line != null && line.endsWith(newLine))
-            {
-               return line.substring(0,line.length() - newLine.length());
-            }
-         }
-         }catch (ArrayIndexOutOfBoundsException e)
-         	{        	 
-        	 	 System.out.println(SessionError.OUT_OF_BOUNDS);
-        	 	 
-        	 if(doTrace)
-        	 {
-        		 e.printStackTrace();
-        	 }
-         	}
-                 
-         if (queryInterrupted)
-         {
-            in.reset();
-            throw new UserInterruption();
-
-         }
-      }
-
-   }
-
-   public boolean next() throws IOException, UserInterruption
-   {
-      //line=this.br.readLine();
-      line=this.readLine();
-      return true;
-   }
-
-   public void close() throws IOException
-   {
-      this.br.close();
-      this.br=null;
-   }
-
-   public boolean isQueryInterrupted()
-   {
-      return queryInterrupted;
-   }
-
-   public void setQueryInterrupted(boolean queryInterrupted)
-   {
-      this.queryInterrupted = queryInterrupted;
-   }
-
-   public boolean isInteractive()
-   {
-      int num = 1;
-      try
-      {
-         num = this.in.available();
-         //System.out.println("\nNumber of input stream bytes=" + num);
-      }
-      catch (IOException ioe)
-      {
-         return false;
-      }
-
-      return (num <= 0 ? true:false);
-   }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ConsoleWriter.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ConsoleWriter.java b/core/conn/trafci/src/org/trafodion/ci/ConsoleWriter.java
deleted file mode 100644
index dac2110..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ConsoleWriter.java
+++ /dev/null
@@ -1,130 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-
-public class ConsoleWriter
-{
-   private PrintStream ps=null;
-   private PrintStream systemOS = System.out;
-   private ByteArrayOutputStream out=null;
-   private boolean consoleOut=true;
-
-   ConsoleWriter()
-   {
-   }
-
-   /*public void initializeByteArray()
-   {
-   out=new ByteArrayOutputStream();
-   System.setOut(new PrintStream(out));
-   consoleOut=false;
-   }*/
-
-   public void initialize() throws IOException
-   {	   
-	   setupOutputStream();
-   }
-   
-   private void setupOutputStream() {
-      if (consoleOut) {
-    	  System.setOut(systemOS);
-      }
-      else
-      {
-         out=new ByteArrayOutputStream();
-         System.setOut(new PrintStream(out));
-      }
-      
-      this.ps = System.out;
-   }
-
-
-   public void println(String line)
-   {
-      this.ps.println(line);
-   }
-
-   public void print(String line)
-   {
-      this.ps.print(line);
-   }
-
-   public void println()
-   {
-      this.ps.println();
-   }
-
-   public void setConsoleOut(boolean consoleOut)
-   {
-      this.consoleOut=consoleOut;
-      setupOutputStream();
-   }
-
-   public boolean getConsoleOut()
-   {
-      return this.consoleOut;
-   }
-   /*
-   public void println(String line)
-   {
-   System.out.println(line);
-   }
-
-   public void print(String line)
-   {
-   System.out.print(line);
-   }
-
-   public void println()
-   {
-   System.out.println();
-   }
-   */
-   public String getResult()
-   {
-      if (out == null)
-      {
-         return null;
-      }
-      else
-      {
-         return out.toString();
-      }
-   }
-
-   public void resetStream()
-   {
-      if (this.out != null)
-      {
-         this.out.reset();
-      }
-   }
-
-   public void close()
-   {
-      this.ps.close();
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/DatabaseQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/DatabaseQuery.java b/core/conn/trafci/src/org/trafodion/ci/DatabaseQuery.java
deleted file mode 100644
index 8b8b2ac..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/DatabaseQuery.java
+++ /dev/null
@@ -1,1804 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.IOException;
-import java.sql.ParameterMetaData;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.Types;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.sql.PreparedStatement;
-import org.trafodion.jdbc.t4.TrafT4Connection;
-import org.trafodion.jdbc.t4.TrafT4Statement;
-import java.sql.CallableStatement;
-
-
-public class DatabaseQuery extends QueryWrapper
-{
-
-   private HashMap<String,String> dbKeyMap=null;
-   private int[] colSize={};
-   private int[] colAlign={};
-   private List<String> procParamList=null;
-   CallableStatement cStmt =null;
-   String[] columnNameArray={};
-   boolean getStatsDone = false;
-   boolean implicitQry  = false;
-   String qryText = null;
-   String getStatsCmd = "get statistics";
-   String getStatsNcCmd = "get statistics, options 'nc'";
-   public ResultSet rsObj = null;
-   String userQry = null;
-   boolean userQryTrimOut = false;
-   
-   //Create a pattern for matching parameter names
-   private static Pattern queryParamNamesPattern =
-	   Pattern.compile("^(.*)?([=\\+\\-~( ]\\s*\\?)([a-zA-Z0-9_]*)(.*)",Pattern.MULTILINE);
-
-   // this string array constants should match the cases grouped in ValidateQuery object.
-   // All commands beginning with SHOW have the trimOut flag set to true in the default case
-   // of executeInternal method. 
-   
-   private final String[] trimKeysList={ "INVOKE",
-                                "SHOWDDL",
-                                "SHOWSHAPE",
-                                "SHOWCONTROL",
-                                "SHOWTRANSACTION",
-                                "REORG",
-                                "REORGANIZE",
-                                "MAINTAIN",
-                                "REPLICATE",
-                                "SHOWLABEL",
-                                "SHOWPLAN",
-                                "EXPLAIN",
-                                "GET"
-                                       };
-
-   HashMap<Integer,String> inOutParamMap=null;
-   DatabaseQuery()
-   {
-
-   }
-
-   DatabaseQuery(Session sessObj)
-   {
-      super(sessObj);
-      loadDbKeyWordMap();
-   }
-   
-   public void execute() throws IOException, SQLException, UnKnownInterfaceCommand, UserInterruption
-   {
-	   try{
-           executeInternal();
-       }catch(IOException ioe){
-           throw ioe;
-       }catch(SQLException sqlex){
-           throw sqlex;
-       }catch(UnKnownInterfaceCommand uic){
-           throw uic;
-       }catch(UserInterruption ui){
-           throw ui;
-       }catch(Exception ex){
-           if(Boolean.getBoolean("trafci.enableTrace"))
-             ex.printStackTrace();
-           
-           ErrorObject internalError = new ErrorObject(SessionError.INTERNAL_ERR.errorCode(), 
-                   SessionError.INTERNAL_ERR.errorMessage() + " Details=" + ex.getMessage());
-           
-           writer.writeError(sessObj,internalError);
-                  
-           throw new UnKnownInterfaceCommand();
-       }
-   }
-   
-   public void executeInternal() throws IOException, SQLException, UnKnownInterfaceCommand, UserInterruption
-   {
-	   
-      String stmtName=null;
-      String cmdToken=null;
-      getStatsDone=false;
-      sessObj.setImplicitGetStatsQry(false);
-
-      init();
-
-      qryObj.resetRowCount();
-      qryObj.setStmtType(null);
-
-      readQuery();
-  
-      /* Check for pattern*/
-      String key,value=null;
-      boolean matchedPattern = false;
-      
-      for (int i=0;i < sessObj.getMaxPatternDepth() ; i++)
-      {
-    	  //Look for $$KEY$$ pattern
-    	  Matcher mat = parser.getKeyPatternMatcher(queryStr);
-    	  StringBuffer sb = new StringBuffer();
-    	  while (mat.find()) {
-    		  key = mat.group(2);
-    		  value = sessObj.getPatternValue(key);
-			  if (value!=null)
-			  {
-				  key = "$$" + key + "$$";
-			      key = key.replaceAll("\\$","\\\\\\$"); // Every $ needs to be replaced with \$. Do not delete the backslashes.se
-			      if (mat.group(1)!=null)
-			    	  mat.appendReplacement(sb,mat.group(1) + value);
-			      else
-			    	  mat.appendReplacement(sb, value);
-			      matchedPattern = true;
-		      }
-    	  }
-    	  
-    	  if (matchedPattern) 
-    	  {
-    		  mat.appendTail(sb);
-    		  queryStr = sb.toString();
-    		  parser.setRemainderStr(queryStr);
-    	  }
-    	 
-	      //Look for regular expression pattern
-    	  HashMap<String,String> regExpMap = sessObj.getRegExpMap();
-    	  if (regExpMap != null )
-    	  {
-    		  Iterator<String> regExpMapIt = regExpMap.keySet().iterator();
-    		  String regExpPat = null;
-    		  while (regExpMapIt.hasNext())
-    		  {
-    			  regExpPat =  (String)regExpMapIt.next();
-    			  if (sessObj.isDebugOn())
-                	  System.out.println(this.getClass().getName() +  ":: regExpPat :"+ regExpPat);
-    			  if (queryStr.matches(regExpPat))
-    			  {
-    				  matchedPattern = true;
-    				  queryStr = queryStr.replaceFirst(regExpPat,regExpMap.get(regExpPat).toString());
-    			  }
-    		  }
-	    	  
-	      }//End IF-ELSE
-    	  qryObj.setQueryId(sessObj.getVQryObj().getQueryId(queryStr));
-    	  parser.setRemainderStr(queryStr);
-      }//End For
-
-      if (sessObj.isDebugOn())
-    	  System.out.println(this.getClass().getName() +  ":: QueryStr :"+ queryStr);
-      
-      /* Commenting this for now until I fix all the issues for interface commands */
-      /*
-      if ((matchedPattern) && dbKeyMap.get(sessObj.getVQryObj().getFirstToken(queryStr))==null) {
-    	  InputStream theStream = new ByteArrayInputStream(queryStr.getBytes());
-    	  sessObj.setLogCmdEcho(false);
-    	  sessObj.iQryObj.execObeyStream(theStream, "Pattern Replacement");
-    	  return;
-      }
-      */
-
-      switch (qryObj.getQueryId())
-      {
-
-         // the first key word is set
-         case SessionDefaults.SET:
-            parser.getNextKeyToken();
-            execSet();
-            break;
-
-         case SessionDefaults.PREPARE:
-            parsePrepareStmt();
-            break;
-
-         case SessionDefaults.EXECUTE:
-            bind();
-            break;
-
-         case SessionDefaults.CALL:
-            procParamList = getParamNames(parser.getRemainderStr());
-            if (sessObj.isSessionAutoPrepare())
-            {
-               prepare(parser.getRemainderStr(), sessObj.getAutoPrepStmtName());
-               executeProcedure(procParamList,false);
-            }
-            else
-            {
-               prepareCallStmt(null);
-               executeProcedure(procParamList,true);
-            }
-
-            break;
-
-         case SessionDefaults.INFOSTATS:
-            cmdToken = parser.getNextKeyToken();
-            stmtName = parser.getNextValueToken();
-            if (cmdToken != null && (stmtName !=null && !stmtName.trim().equals("")))
-            {
-               stmtName = "\"" + stmtName + "\"";
-               if (parser.getRemainderStr() != null)
-               {
-                  queryStr=cmdToken + " " + stmtName + parser.getRemainderStr();
-               }
-               else
-               {
-                  queryStr=cmdToken + " " + stmtName ;
-               }
-
-            }
-            executeQuery(true);
-            break;
-
-         case SessionDefaults.GET:
-            execGet(true);
-            break;
-            
-         case SessionDefaults.CONTROL:
-             execControl();
-             break;
-            
-         default:
-            
-            //For commands beginning with SHOW (SHOWTRANSACTION,SHOWSET)
-            //set the trimout flag to true
-            if (qryObj.getQueryText().matches("(?is)SHOW.+"))
-               qryObj.setTrimOut(true);
-            if (sessObj.isSessionAutoPrepare())
-            {
-               prepare(parser.getRemainderStr(),sessObj.getAutoPrepStmtName());
-               parser.setRemainderStr("EXECUTE " + sessObj.getAutoPrepStmtName());
-               bind();
-            }
-            else
-            {
-               executeQuery(true);
-            }
-      }
-
-      /*
-      send an implicit GET STATISTICS command to
-      display the statistics for the previously
-      executed SQL statement. This is done only
-      when statistics in enabled via a SET STATISTICS
-      ON command.
-      */
-      if (sessObj.isSessionStatsEnabled() && !getStatsDone && !blockGetStats())
-      {
-         boolean oldstate = sessObj.isSessionTimingOn();
-         /* Store the query and reset the query text with this
-          * value once get statistics is executed. This is needed to
-          * avoid get statistics to be added in history.
-          */
-         userQry = qryObj.getQueryText();
-         userQryTrimOut = qryObj.isTrimOut();
-         sessObj.setImplicitGetStatsQry(true);
-         try 
-         {
-            sessObj.setSessionTiming(false);
-            writer.writeStatusMsg( sessObj,  qryObj,  utils,  writer);
-            writer.writeln();
-         } finally 
-         {
-            sessObj.setSessionTiming(oldstate);
-         }
-
-         //Overwrite the queryStr with the 'GET STATISTICS'
-         //command. dbExec executes the command stored in
-         //queryStr.
-         queryStr = getStatsCmd;
-         qryObj.resetQueryText(queryStr);
-         parser.setRemainderStr(queryStr);
-         String qryRowCnt = qryObj.getRowCount();
-         qryObj.setRowCount(null);
-         execGet(false);
-         //Reset the record count to row count of the
-         //original query
-         qryObj.setRowCount(qryRowCnt);
-                 
-         
-      }
-
-   }
-
-   private void parsePrepareStmt() throws IOException, SQLWarning, SQLException, UnKnownInterfaceCommand
-   {
-//      PreparedStatement pStmt=null;
-      String stmtName=null;
-      String query=null;
-      String fromKeyToken=null;
-
-      parser.getNextKeyToken();
-      stmtName = parser.getNextPreparedStmtNameToken();
-      if (stmtName==null)
-      {
-         writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
-         throw uic;
-      }
-      fromKeyToken = parser.getNextKeyToken();
-      if (fromKeyToken == null || !fromKeyToken.equalsIgnoreCase("FROM"))
-      {
-         writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
-         throw uic;
-      }
-      query = parser.getRemainderStr().trim();
-      if (query == null || query.equalsIgnoreCase(""))
-      {
-         writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
-         throw uic;
-      }
-
-      prepare(query,stmtName);
-   }
-
-   private void prepare(String qry,String stmtName) throws SQLException, IOException
-   {
-      PreparedStatement pStmt = null;
-      boolean trimFlag = false;
-      for (int i=0;i < trimKeysList.length;i++)
-      {
-         if (qry.toUpperCase().startsWith(trimKeysList[i]))
-         {
-            trimFlag=true;
-            break;
-         }
-      }
-
-      //Changes to support PREPARE on SPJ's
-      if (qry.toUpperCase().startsWith("CALL"))
-      {
-         // Assign the sql query to queryStr. queryStr will be used
-         // to prepare the statement
-         queryStr = qry;
-         try
-         {
-            prepareCallStmt(stmtName);
-         }catch (SQLException sqlEx)
-         {
-            sessObj.removePrepStmtMap(stmtName);
-            throw sqlEx;
-         }
-         sessObj.setPrepStmtMap(stmtName,(Object)cStmt,trimFlag);
-         return;
-      }
-
-      sessObj.setQryStartTime();
-      if(sessObj.getPrepStmtMap(stmtName) != null)
-      {
-         sessObj.getPrepStmtMap(stmtName).close();
-         sessObj.removePrepStmtMap(stmtName);
-      } 
-      try
-      {
-         pStmt =((TrafT4Connection)conn).prepareStatement(qry,"\"" + stmtName + "\"");
-      }catch (SQLException sqlEx)
-      {
-         sessObj.removePrepStmtMap(stmtName);
-         throw sqlEx;
-      }
-     
-      sessObj.setQryEndTime();
-      
-      sessObj.setPrepStmtMap(stmtName,(Object)pStmt,trimFlag);
-      writeAllSQLWarnings(pStmt.getWarnings());
-      pStmt.clearWarnings();
-      /* This is to print the status message for XML/HTML correctly */
-      qryObj.setRowCount("0");
-   }
-
-   /**
-    *  Returns the evaluated parameter value.
-    *
-    *  @param   inputStr  The input string as the user specified it
-    *  @return  the evaluated input string (parameter value)
-    *
-    */
-   private String evaluateParameterValue(String inputStr) {
-       try {
-          ParamStringObject psv = parser.getParamValue(inputStr);
-          return psv.getParameterValue();
-
-      } catch(Exception e) {
-      }
-
-      return  inputStr;
-
-   }   /*  End of  evaluateParameterValue  method.  */
-   
-   private void bind() throws IOException, UnKnownInterfaceCommand, SQLException, UserInterruption
-   {
-      String keyToken = null;
-      String stmtName = null;
-      PreparedStatement pStmt;
-      List<String> paramList=null;
-      String[] errParams=new String[1];
-
-      keyToken = parser.getNextKeyToken();
-      stmtName = parser.getNextPreparedStmtNameToken();
-      if (stmtName == null)
-      {
-         writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
-         throw uic;
-      }
-      if (parser.hasMoreTokens())
-      {
-         keyToken = parser.getNextKeyToken();
-         if ((keyToken == null) || !(keyToken.equalsIgnoreCase("USING")))
-         {
-            writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
-            throw uic;
-         }
-
-         paramList = parser.getNextParamListToken();
-         if (paramList == null || paramList.size()==0)
-         {
-            writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
-            throw uic;
-
-         }
-         for (int i=0;i < paramList.size(); i++)
-         {
-            String paramValue=null;
-            if (paramList.get(i).toString().matches("^\\?\\S+"))
-            {
-               paramValue=sessObj.getSessParams(paramList.get(i).toString().substring(1));
-               if (paramValue != null)
-               {
-                  paramList.remove(i);
-                  paramList.add(i,evaluateParameterValue(paramValue));
-               }
-
-            }
-         }
-      }
-
-      // code repeated in blockGetStats, any changes here needs to
-      // be updated in the blockGetStats method also.
-      pStmt = (PreparedStatement)sessObj.getPrepStmtMap(stmtName);
-      org.trafodion.jdbc.t4.TrafT4PreparedStatement hpt4Stmt=(org.trafodion.jdbc.t4.TrafT4PreparedStatement)sessObj.getPrepStmtMap(stmtName);
- 
-      if (pStmt == null)
-      {
-         errParams[0]=stmtName;
-         writer.writeError(sessObj, 'E',SessionError.STMT_NOT_FOUND,errParams);
-         throw uic;
-      }
-
-      String sqlQueryStr=((TrafT4Statement)pStmt).getSQL();
-      List<String> namedParamList=getParamNames(sqlQueryStr);
-      
-      // if using class is specified, merge the named parameters
-      // and unnamed params and create one param list
-      if (paramList != null)
-      {
-         int paramListIdx=0;
-         for (int j=0;j < namedParamList.size(); j++)
-         {
-            if (namedParamList.get(j).toString().matches("^\\?"))
-            {
-               if (paramList.size() < paramListIdx+1)
-               {
-                  break;
-               };
-               namedParamList.remove(j);
-               namedParamList.add(j,paramList.get(paramListIdx));
-               paramListIdx++;
-            };
-         }
-
-      }
-      paramList=namedParamList;
-
-      if (sqlQueryStr.toUpperCase().startsWith("CALL"))
-      {
-         qryObj.setStmtType(hpt4Stmt.getStatementType());
-         cStmt = (CallableStatement)pStmt;
-         sessObj.setQryStartTime();
-         executeProcedure(paramList,false);
-         return;
-      }
-
-      if (paramList !=null)
-      {
-         int namedParamErrors=0;
-         int index=0;
-
-         for (int i=0;i<paramList.size();i++)
-         {
-            String value=paramList.get(i).toString();
-            String paramName=value;
-            if (!(paramList.subList(0,i).contains(paramName)) || !paramList.get(i).toString().startsWith("?"))
-            {
-               if (value.matches("^\\?\\S+"))
-               {
-            	   String pv = (String) sessObj.getSessParams(value.substring(1));
-                   value = evaluateParameterValue(pv);
-               }
-               if ((value == null) || (paramName.equals("?")))
-               {
-                  if (paramName.equals("?"))
-                     paramName="?(UNNAMED_"+ (i+1) +")";
-
-                  writer.writeInterfaceErrors(sessObj, new ErrorObject(SessionError.PARAM_NOT_FOUND, "", paramName + " was not found"));
-                  
-                  namedParamErrors++;
-                  continue;
-
-               }
-//               dead code 
-//               if (value== null) 
-//            	   value=paramList.get(i).toString();
-               value=value.replaceAll("\'\'","\'");
-               try
-               {
-                  if (value!=null)
-                  {
-                     if (value.equalsIgnoreCase("NULL"))
-                        pStmt.setNull(index+1,Types.NULL);
-                     else
-                     {
-                        pStmt.setObject(index+1,new String(value.toString()));
-                     }
-                  }
-                  
-               }catch (NumberFormatException nfe)
-               {
-                  writer.writeError(sessObj,SessionError.NUMERIC_VAL_REQ);
-                  namedParamErrors++;
-                  continue;
-                  //throw uic;
-               }
-               finally
-               {
-            	   index++;
-               }
-            }
-         }
-
-         if (namedParamErrors >0)
-         {
-            throw uic;
-         }
-      }
-
-      sessObj.setQryStartTime();
-      if (!sessObj.getPrepTrimOut(stmtName))
-      {
-         pStmt.setMaxRows(sessObj.getListCount());
-      }else
-      {
-         qryObj.setTrimOut(true);
-      }
-               
-      boolean moreResults = dbExec(pStmt);
-      writeAllSQLWarnings(pStmt.getWarnings());
-      pStmt.clearWarnings();
-      qryObj.setStmtType(hpt4Stmt.getStatementType());
-
-      if (hpt4Stmt.getSQL().matches("(?i)\\s*CREATE\\s+((SET|VOLATILE|SET VOLATILE)\\s+)?TABLE\\s+.*\\s+AS\\s+SELECT\\s+.*"))
-    	  qryObj.setStmtType("CREATE_TABLE_AS");
-      
-      if (moreResults)
-      {
-         fetchResults(pStmt.getResultSet());
-      }
-      else
-      {
-         super.setQueryRowCount(pStmt);
-         
-         /* Modified this fix to call the execSet method for
-          * EXECUTE on SET SCHEMA and SET CATALOG
-          * instead of repeating the code again.
-          */
-         if ((sqlQueryStr.trim().matches("(?i)(?s)SET\\s+SCHEMA.*")) ||
-             (sqlQueryStr.trim().matches("(?i)(?s)SET\\s+CATALOG.*"))
-            )
-         {
-            String origQuery = qryObj.getQueryText();
-            qryObj.resetQueryText(sqlQueryStr);
-            queryStr = sqlQueryStr;
-            parser.setRemainderStr(sqlQueryStr);
-            parser.getNextKeyToken();
-            execSet();
-            qryObj.resetQueryText(origQuery);
-         }
-      
-         sessObj.setQryEndTime();
-         
-      }
-
-   }
-
-   private void prepareCallStmt(String stmtName) throws SQLException, IOException
-   {
-      sessObj.setQryStartTime();
-      //create a callable statement object for invoking SPJ's
-      try
-      {
-         if(sessObj.getPrepStmtMap(stmtName) != null)
-         {
-            sessObj.getPrepStmtMap(stmtName).close();
-            sessObj.removePrepStmtMap(stmtName);
-         } 
-      }catch(SQLException sqlEx){
-         ;
-      }
-      
-      try
-      {
-         cStmt = ((TrafT4Connection)conn).prepareCall(queryStr,"\"" + stmtName + "\"");
-      } catch (NoSuchMethodError nsme)
-      {
-         if (stmtName == null)
-            cStmt = conn.prepareCall(queryStr);
-         else
-         {
-            throw new SQLException(SessionError.CALL_ERR.errorMessage());
-         }
-      }
-      writeAllSQLWarnings(cStmt.getWarnings());
-      cStmt.clearWarnings();
-      sessObj.setQryEndTime();
-      /* This is to print the status message for XML/HTML correctly */
-      qryObj.setRowCount("0");
-
-   }
-
-   private void executeProcedure(List<String> callParamList,boolean deAllocStmt) throws IOException, UnKnownInterfaceCommand, SQLException
-   {
-      ParameterMetaData paramMetaData=null;
-      String paramName=null;
-      inOutParamMap = new HashMap<Integer,String>(); // contains the parameter index and the param name for INOUT and OUT params
-      boolean paramsExist = false; // this will be set to true only if the SPJ contains INOUT and OUT params
-      String value=null;
-      int namedParamErrors=0;
-      ResultSet rs=null;
-
-      if (callParamList.size() != 0)
-      {
-         paramMetaData = cStmt.getParameterMetaData();
-         if ((paramMetaData !=null))
-         {
-            //Set the values for dynamic parameters and register the
-            //out parameters
-            for (int i=1;i<=paramMetaData.getParameterCount();i++)
-            {
-               value = callParamList.get(i-1).toString();
-               paramName = value;
-
-               switch (paramMetaData.getParameterMode(i))
-               {
-                  case ParameterMetaData.parameterModeIn:
-                     //If named parameters have been specified, retrieve the value
-                     //from the session params hashmap and set the value in the
-                     //callable statement.
-                     if (value.matches("^\\?(\\S+)"))
-                     {
-                    	 String pv = (String) sessObj.getSessParams(value.substring(1));
-                         value = evaluateParameterValue(pv);
-                         if (sessObj.isDebugOn())
-                         {
-                        	 System.out.println("@@@Debug: DatabaseQuery:: pv = " +  pv);
-                             System.out.println("@@@Debug: DatabaseQuery:: value = " + value);
-                         }
-                     }
-                     if ((value == null) || paramName.equals("?"))
-                     {
-                        if (paramName.equals("?"))
-                           paramName="?(UNNAMED_"+ i +")";
-                        //writer.writeln("ERROR: Param "+paramName+ " was not found.");
-                        //String errorStr = "ERROR: Param "+paramName+ " was not found.";
-                        writer.writeInterfaceErrors(sessObj, new ErrorObject(SessionError.PARAM_NOT_FOUND, "", paramName + " was not found"));
-                        namedParamErrors++;
-                        continue;
-                     }
-                     try
-                     {
-                        if (value.equalsIgnoreCase("NULL"))
-                        {
-                           cStmt.setNull(i,Types.NULL);
-                        }
-                        else
-                        {
-                           cStmt.setObject(i,value);
-                        }
-                     }catch (NumberFormatException nfe)
-                     {
-                        writer.writeError(sessObj, SessionError.NUMERIC_VAL_REQ);
-                        namedParamErrors++;
-                        continue;
-                        //throw uic;
-                     }
-
-
-                     break;
-
-                  case ParameterMetaData.parameterModeInOut:
-
-                     if (value.matches("^\\?(\\S+)"))
-                     {
-                    	 String pv = (String) sessObj.getSessParams(value.substring(1));
-                         value = evaluateParameterValue(pv);
-                     }
-                     if ((value == null) || paramName.equals("?"))
-                     {
-                        if (paramName.equals("?"))
-                           paramName="?(UNNAMED_"+ i +")";
-                        //writer.writeln("ERROR: Param "+paramName+ " was not found.");
-                        //String errorStr = "ERROR: Param "+paramName+ " was not found.";
-                        writer.writeInterfaceErrors(sessObj, new ErrorObject(SessionError.PARAM_NOT_FOUND, "", paramName + " was not found"));
-                        namedParamErrors++;
-                        continue;
-                     }
-                     try
-                     {
-                        if (value.equalsIgnoreCase("NULL"))
-                        {
-                           cStmt.setNull(i,Types.NULL);
-                        }
-                        else
-                        {
-                           cStmt.setObject(i,value);
-                        }
-                     }catch (NumberFormatException nfe)
-                     {
-                        writer.writeError(sessObj, SessionError.NUMERIC_VAL_REQ);
-                        namedParamErrors++;
-                        continue;
-                        //throw uic;
-                     }
-
-                     if (paramName.matches("^\\?(\\S+)"))
-                        inOutParamMap.put(new Integer(i),paramName.substring(1));
-
-                     if (!paramsExist)
-                        paramsExist=true;
-
-                     break;
-
-                  case ParameterMetaData.parameterModeOut:
-                     cStmt.registerOutParameter(i,paramMetaData.getParameterType(i));
-                     // Add the param name and the index to the inOut Hashmap.
-                     // This will be used to bind the inout and out param values after
-                     // execute
-                     if (paramName.matches("^\\?(\\S+)"))
-                     {
-                        inOutParamMap.put(new Integer(i),paramName.substring(1));
-                     }
-
-                     if (!paramsExist)
-                        paramsExist=true;
-                     break;
-
-               } // end switch
-
-               //}// end if match()
-            } // end for
-         } //end if
-
-      }
-
-      if (namedParamErrors > 0)
-         throw uic;
-
-      sessObj.setInOutandRS(false);
-      qryText = qryObj.getQueryText();
-      ResultSetMetaData rsmd = cStmt.getMetaData();
-      boolean moreResults=dbExec(cStmt);
-      sessObj.setQryEndTime();
-      SQLWarning sqlWarn = cStmt.getWarnings();
-      writer.writeAllSQLWarnings(sessObj,sqlWarn);
-      qryObj.setRowCount(null);
-
-      if (rsmd !=null)
-      {
-         //call the write method only if the SPJ contains INOUT and OUT params
-         if (paramsExist)
-         {
-           if (sessObj.isSPJRS())
-               sessObj.setSPJRS(false);
-           writeOutParams(rsmd,rsmd.getColumnCount(),paramMetaData,cStmt);
-         
-         writer.writeln();
-         }
-      }
-
-      if (moreResults)
-      {
-         if (paramsExist)
-            sessObj.setInOutandRS(true);
-         sessObj.setSPJRS(true);
-         qryObj.setRsCount(0);
-         qryObj.setRowCount(null);
-         while (moreResults)
-         {
-            rs = cStmt.getResultSet();
-            fetchResults(rs);
-            qryObj.incrRsCount();
-            qryObj.resetQueryText("SELECT *"); // Need to reset the qrytext to display no. of rows selected for status msg
-            writer.writeStatusMsg(sessObj,qryObj,utils, writer);
-            qryObj.resetQueryText(qryText); // Resetting the qry back to the original query Text for final status msg
-            writer.writeln();
-            qryObj.setRowCount(null);
-            sessObj.setInOutandRS(false);
-            //Check this without type casting to TrafT4Statement
-            moreResults = ((TrafT4Statement)cStmt).getMoreResults();
-         }
-         qryObj.setRowCount(new Integer(qryObj.getRsCount()).toString());
-         sessObj.setSPJRS(false);
-      }
-      else if (paramsExist)
-      {
-         qryObj.setRowCount("1");
-      }
-      else
-         qryObj.setRowCount("0");
-      if (deAllocStmt)
-         cStmt.close();
-   }
-
-   
-   private void execControl() throws SQLException, IOException, UnKnownInterfaceCommand, UserInterruption
-   {
-	   String remStr = parser.getRemainderStr();
-	   
-	   if (remStr.matches("(?is)\\s*CONTROL\\s+QUERY\\s+DEFAULT\\s+SCHEMA\\s+(.*)") || 
-		   remStr.matches("(?is)\\s*CONTROL\\s+QUERY\\s+DEFAULT\\s+DEFAULT_SCHEMA_NAMETYPE\\s+(.*)"))
-	   {
-		   executeQuery(true);
-		   queryStr = "showcontrol default schema, match full, no header";
-		   try {
-			   java.sql.Statement stmtSch = conn.createStatement();
-			   ResultSet rs = stmtSch.executeQuery(queryStr);
-			   
-			   if (rs!=null && rs.next())
-		       {
-				   sessObj.setSessionSchema(rs.getString(1));
-		       }
-		       rs.close();
-		       stmtSch.close();
-		    } catch (Exception ex)
-		    {
-		        // System.out.println("Error : ExecControl :"+ex.getMessage());
-		    }
-	   }
-	   else
-	   {
-		   executeQuery(true);
-		  
-	   }
-   }
-   
-   private void execSet() throws SQLException, IOException, UnKnownInterfaceCommand, UserInterruption
-   {
-      String setOption=parser.getNextKeyToken();
-      
-      // not a keyword..then its not ours
-      if (setOption == null)
-      {
-         executeQuery(true);
-         return;
-      }
-      else
-      {
-         setOption=(String) dbKeyMap.get("SET_"+setOption.toUpperCase());
-
-         if (setOption == null)
-         {
-            executeQuery(true);
-            return;
-         }
-
-         int setId=Integer.parseInt(setOption);
-         switch (setId)
-         {
-            case SessionDefaults.SET_SCHEMA:
-               executeQuery(true);
-               List<String> csList=parser.getCSTList(parser.getRemainderStr());
-               switch (csList.size())
-               {
-                  case 2:
-                     conn.setCatalog(csList.get(0).toString());
-                     sessObj.setSessionCtlg(conn.getCatalog());
-                     sessObj.setSessionSchema(csList.get(1).toString());
-                     break;
-                  case 1:
-                     sessObj.setSessionSchema(csList.get(0).toString());
-                     break;
-               }
-               sessObj.getEnvMap().put("SCHEMA", sessObj.getSessionSchema());
-               // This is needed in the blockGetStats method
-               qryObj.setQueryId(setId);
-               break;
-               
-            case SessionDefaults.SET_CATALOG:
-               sessObj.setQryStartTime();
-               String ctlgValue = parser.getCatalogToken();
-               if (ctlgValue == null)
-                  ctlgValue="";
-               conn.setCatalog(ctlgValue);
-               sessObj.setQryEndTime();
-               sessObj.setSessionCtlg(conn.getCatalog());
-               sessObj.getEnvMap().put("CATALOG", sessObj.getSessionCtlg());
-               qryObj.setRowCount("0");
-               qryObj.setQueryId(setId);
-               break;
-
-            case SessionDefaults.SET_SERVICE:
-               executeQuery(true);
-               break;
-         
-               
-            default:
-               executeQuery(true);
-               break;
-         }
-      }
-
-
-
-   }
-   
-   public boolean  userExecutedGetStatistics()
-   {
-       return getStatsDone;
-   }
-
-
-   private void execGet(boolean setQueryStartTimeFlag) throws SQLException, IOException, UnKnownInterfaceCommand
-   {
-	  float prodVersion = 0.0f;
-     
-      parser.getNextKeyToken();
-      if (!Utils.trimSQLTerminator(qryObj.getQueryText(), sessObj.getSessionSQLTerminator()).matches("(?i)\\s*get\\s+service\\s*"))
-         qryObj.setTrimOut(true);
-      else
-         qryObj.setTrimOut(false);
-
-      String getOption=parser.getNextWordToken();
-      if ((getOption != null) && (getOption.toUpperCase().equals("STATISTICS")))
-      {
-         try {
-        	 
-        	 if (sessObj.isDebugOn())
-            	 System.out.println("Database Query::execGet:: " + prodVersion);
-
-         } catch (NullPointerException npe){}
-         getOption = parser.getNextKeyToken();
-         if (getOption == null)
-         {
-               queryStr = getStatsNcCmd;
-         }
-         if (sessObj.isDebugOn())
-         {
-        	 System.out.println("Database Query::execGet:: " + queryStr);
-         }
-         try
-         {
-            executeQuery(setQueryStartTimeFlag);
-            if (setQueryStartTimeFlag)
-               getStatsDone=true;
-            
-         }catch (SQLException sqlEx)
-         {
-            getStatsDone=false;
-            throw sqlEx;
-         }
-      }
-      else
-      {
-         executeQuery(true);
-      }
-
-   }
-   
-   public void resetQryObj()
-   {
-      if ((sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT) &&
-          (sessObj.getDisplayFormat() != SessionDefaults.HTML_FORMAT) &&
-          (sessObj.isImplicitGetStatsQry())
-          )
-      {
-         qryObj.resetQueryText(userQry);
-         qryObj.setTrimOut(userQryTrimOut);
-      }
-  
-   }
-
-
-   private void executeQuery(boolean setQueryStartTimeFlag) throws SQLException, IOException, UnKnownInterfaceCommand
-   {
-      if (setQueryStartTimeFlag)
-         sessObj.setQryStartTime();
-      //    if the list count is set..
-      if (!qryObj.isTrimOut() && sessObj.getListCount() !=0)
-      {
-         stmt.setMaxRows(sessObj.getListCount());
-      }else
-      {
-         stmt.setMaxRows(0);
-      }
-      
-      // Check to see if query string has ? mark characters
-      boolean paramsPatternFound = false;
-      boolean queryHasParams = ( queryStr.indexOf("?") != -1 );
-      if (queryHasParams)
-      {
-    	  // Doing a more expensive pattern matching check to see if the ? is a 
-    	  // parameter and not a literal.
-    	  try {
-    		  Matcher mat = queryParamNamesPattern.matcher(queryStr);
-    		  paramsPatternFound = mat.find();
-    		  if (sessObj.isDebugOn())
-    			  System.out.println(this.getClass().getName() +
-    					  ":: Matcher.find : " + queryHasParams);
-    	  } catch (Exception ex) 
-    	  {
-    		  if (sessObj.isDebugOn())
-    			  System.out.println(this.getClass().getName() +
-    					 ":: Param name regexp pattern error : " +
-    					 ex.getMessage());
-    	  }
-      }
-            
-      if ((queryHasParams || paramsPatternFound)  &&
-          (qryObj.getQueryId() != SessionDefaults.EXPLAIN)   &&
-          (qryObj.getQueryId() != SessionDefaults.SHOWPLAN)  &&
-          (qryObj.getQueryId() != SessionDefaults.SHOWSHAPE) )
-      {
-         List<String> paramList=getParamNames(queryStr);
-         if (paramList.size() > 0)
-         {
-            PreparedStatement ps=null;
-            ps=conn.prepareStatement(queryStr);
-            String paramName=null;
-            String paramValue=null;
-            int namedParamErrors=0;
-
-            int index=0;
-            for (int i=0;i < paramList.size(); i++)
-            {
-               paramName=paramList.get(i).toString();
-               if (!( paramList.subList(0,i).contains(paramName)))
-               {
-                  if (paramName.equals("?"))
-                  {
-                     paramName="?(UNNAMED_"+ (i+1) +")";
-                  }
-                  if ((paramValue=sessObj.getSessParams(paramName.substring(1))) == null)
-                  {
-                     writer.writeInterfaceErrors(sessObj, new ErrorObject(SessionError.PARAM_NOT_FOUND, "", paramName + " was not found"));
-                     namedParamErrors++;
-                     continue;
-                  }
-                  paramValue = evaluateParameterValue(paramValue);
-                  try
-                  {
-                     if (paramValue.equalsIgnoreCase("NULL"))
-                     {
-                        ps.setNull(index+1,Types.NULL);
-                     }else
-                     {
-                        ps.setObject(index+1,paramValue);
-                     }
-                  }catch (NumberFormatException nfe)
-                  {
-                     writer.writeError(sessObj, SessionError.NUMERIC_VAL_REQ);
-                     namedParamErrors++;
-                     //throw uic;
-                     continue;
-                  }
-                  finally
-                  {
-                	  index++;  
-                  }
-               }
-            }
-            if (namedParamErrors>0)
-            {
-               throw uic;
-            }
-            ps.setMaxRows(sessObj.getListCount());
-
-            sessObj.setCurrentStmtObj(ps);
-
-            if (dbExec(ps))
-            {
-              
-               writeAllSQLWarnings(ps.getWarnings());
-               ps.clearWarnings();
-               fetchResults(ps.getResultSet());
-            }
-            else
-            {
-               writeAllSQLWarnings(ps.getWarnings());
-               ps.clearWarnings();
-                
-               sessObj.setCurrentStmtObj(null);
-               super.setQueryRowCount(ps);
-               sessObj.setQryEndTime();
-            }
-            
-            resetQryObj();
-            return;
-         }
-      }
-
-      sessObj.setCurrentStmtObj(stmt);
-
-      if (dbExec(stmt))
-      {
-         writeAllSQLWarnings(stmt.getWarnings());
-         
-         stmt.clearWarnings();
-         rsObj= stmt.getResultSet();
-         if (qryObj.getQueryId()==SessionDefaults.SHOW_SERVICE)
-            return; 
-         fetchResults(stmt.getResultSet());
-      }
-      else
-      {
-         writeAllSQLWarnings(stmt.getWarnings());
-         stmt.clearWarnings();
-         super.setQueryRowCount(stmt);
-         sessObj.setQryEndTime();
-      }
-
-      stmt.close();
-      sessObj.setStmtObj(sessObj.getConnObj().createStatement());
-      this.stmt=sessObj.getStmtObj();
-      resetQryObj();
-   }
-
-   private void fetchResults(ResultSet rs) throws SQLException, IOException
-   {
-      boolean isHeadingPrinted=false;
-      ResultSetMetaData rsmd=rs.getMetaData();
-      int numColumns = rsmd.getColumnCount();
-      int rowCnt=0;
-      qryObj.setColCount(String.valueOf(numColumns));
-      if (sessObj.getFetchSize() > 0)
-      {
-    	  rs.setFetchSize(sessObj.getFetchSize());
-      }
-
-      try {
-    	  for (rowCnt=0; rs.next();rowCnt++)
-          {
-             sessObj.setCurrentStmtObj(null);
-             if (sessObj.isQueryInterrupted())
-             {
-                writer.writeln(SessionDefaults.lineSeperator+"*** WARNING: User interrupt [^C] received. Truncating data ... ");
-                break;
-             }
-             
-             /**
-              *   Warnings are returned as part of fetch so
-              *   we need to handle them.
-              */
-             isHeadingPrinted = printAnyWarningsDuringFetch(rs, isHeadingPrinted);
-             
-             if (!isHeadingPrinted)
-             {
-                writeHeader(rsmd,numColumns);
-                isHeadingPrinted=true;
-             }
-             writeData(rs,numColumns);
-          }
-      } catch(java.lang.OutOfMemoryError e) {
-    	  /**
-    	   * Internal Analysis: JDBC Driver throws java.lang.OutOfMemoryError: Heap Out Space
-    	   * the Exception was thrown by interfaceResultSet.fetch() method.
-    	   * BufferedSize in JDBC exceeds and only can hold up to certain limit. 
-    	   * "length = 1493630996", which value is  very big that caused
-           *  the OutofMemoryEror
-    	   * 
-    	   * catch the OutOfMemory Exception 
-    	   */
-    	  throw new SQLException(
-    	     "Unable to display result data - OutOfMemory.");
-      }
-      
-      /**
-       *   Warnings are returned as part of fetch so
-       *   we need to handle them even if there are no results.
-       */
-      isHeadingPrinted = printAnyWarningsDuringFetch(rs, isHeadingPrinted);
-       
-      
-      // if heading printed, then there are some rows retrieved from the db. so write a new line at the end
-      if (isHeadingPrinted && sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-      {
-         writer.writeln();
-      }
-
-      if (sessObj.getListCount() != 0 && sessObj.getListCount() == rowCnt && !qryObj.isTrimOut())
-      {
-         qryObj.setStmtType("SELECT_LIST_COUNT");
-      }
-      if (!sessObj.isImplicitGetStatsQry())
-         qryObj.setRowCount(String.valueOf(rowCnt));
-
-      try
-      {
-         rs.close();
-      } catch (SQLException sqle)
-      {
-      }
-      finally
-      {
-         sessObj.setQryEndTime();
-      }
-   }
-
-   /**
-    *  Prints any warnings encountered as part of the fetch and displays
-    *  them inline with the results. The method takes care of automatically
-    *  printing headings for XML and HTML markups before the warnings are
-    *  printed out.
-    *
-    *  @param   rs                The ResultSet object
-    *  @param   isHeadingPrinted  Controls whether or not we need to print
-    *                             the headings
-    *
-    *  @return  Whether or not headings were printed out
-    *
-    */
-   private boolean printAnyWarningsDuringFetch(ResultSet rs,
-                                               boolean isHeadingPrinted)
-              throws SQLException, IOException {
-
-      /**
-       *   Check if the ResultSet parameter is valid.
-       */
-      if (null == rs)
-         return isHeadingPrinted;
-
-
-      /**
-       *   Second check is to see if we have any warnings.
-       */
-      SQLWarning  rsWarnings = rs.getWarnings();
-      if (null == rsWarnings)
-         return isHeadingPrinted;
-
-
-
-      /**
-       *   We could have probably passed these down as parameters -- but
-       *   rather than "burden" the stack, we just call these APIs when
-       *   there are warnings. These calls should anyway be "thin" calls.
-       */
-      ResultSetMetaData rsmd       = rs.getMetaData();
-      int               numColumns = rsmd.getColumnCount();
-
-
-      /**
-       *   Warnings are returned as part of fetch and
-       *   need to be displayed along with the results. However we need 
-       *   to print headings for XML and HTML markups before the warnings.
-       */
-      if (!isHeadingPrinted) {
-         /*  Get the display format currently in use.  */
-         int displayFmt = sessObj.getDisplayFormat();
-
-
-         /*
-          *  If heading was not printed, do so for HTML and XML markups.
-          *  This allows any warnings to be embedded within the output.
-          */
-         if ((SessionDefaults.XML_FORMAT == displayFmt)  ||
-             (SessionDefaults.HTML_FORMAT == displayFmt) ) {
-            writeHeader(rsmd, numColumns);
-            isHeadingPrinted = true;
-         }
-
-      }    /*  End of  IF  headings weren't printed.  */
-
-
-
-      /**
-       *   Warnings are returned as part of fetch.
-       *   We already checked for warnings, now just print 'em out.
-       *   Note calling rs.getWarnings() should clear the warnings, so
-       *   we don't have any warnings to do the next time around.
-       *   But JDBC/T4 didn't implement that part of the spec correctly
-       *   in older drivers, so we do some double work here and call
-       *   ResultSet.clearWarnings(). That way:
-       *      1>  We will work w/ older T4 drivers, which don't clear these.
-       *          So we got to step in and give a bit of a nudge!!
-       *      2>  On newer well-behaved T4 drivers, this becomes a NOOP.
-       *          We do the clearWarnings work twice (automatically done in 
-       *          the T4 driver) and once here when we have any warnings.
-       */
-      writer.writeAllFetchWarnings(sessObj, rsWarnings, numColumns);
-      sessObj.setSqlWarningsCnt(sessObj.getSqlWarningsCnt() + 1);
-      rs.clearWarnings();
-
-
-      /**
-       *  Returns the state of whether or not we printed the headings out.
-       */
-      return isHeadingPrinted;
-
-   }  /*  End of  printAnyWarningsDuringFetch  method.  */
-
-   private String writeData(ResultSet rs,int numColumns) throws SQLException, IOException
-   {
-     
-      for (int i=1;i<=numColumns ;i++)
-      {
-         String value=null;
-         try
-         {
-            value=rs.getString(i);
-            if (sessObj.getQuery().getQueryId() == SessionDefaults.SHOW_SERVICE)
-               return value;
-         } catch (SQLException sqlEx)
-         {
-            //For blob objects, getString() throws a SQLException.
-            //Displaying null in this case.
-         }
-
-         ResultSetMetaData rsmd = rs.getMetaData();
-         if(value != null && rsmd.getColumnType(i)==Types.TIMESTAMP && value.length() < rsmd.getColumnDisplaySize(i))
-         {
-          	 value = (value.trim()+"000000").substring(0,rsmd.getColumnDisplaySize(i));
-         } 
-         
-         if (value == null)
-         {
-            value=sessObj.getSessNull();
-            if (sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
-                value = "?";
-         }
-        
-         switch (sessObj.getDisplayFormat())
-         {
-            case SessionDefaults.RAW_FORMAT :
-               if (qryObj.isTrimOut())
-               {
-                  formatOutput(value,value.length(),' ',0);
-               }
-               else
-               {
-                  formatOutput(value,colSize[i-1],' ',colAlign[i-1]);
-               }
-
-               if (i < numColumns)
-               {
-                  writeSeparator();
-               }
-               break;
-
-
-            case SessionDefaults.XML_FORMAT :
-               formatXmlOutput(columnNameArray[i-1],value);
-               break;
-
-            case SessionDefaults.HTML_FORMAT:
-               formatHtmlOutput(value);
-               break;
-
-            case SessionDefaults.CSV_FORMAT:
-               formatCsvOutput(value);
-               break;
-         }
-
-      }
-
-      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-         writeln();
-
-      return null;
-   }
-
-   private void writeHeader(ResultSetMetaData rsmd,int numColumns) throws SQLException, IOException
-   {
-      columnNameArray = new String[numColumns];
-      colSize=new int[numColumns];
-      colAlign=new int[numColumns];
-      
-      int totalWidth = 0;
-      
-      if (qryObj.isTrimOut())
-      {
-         return;
-      }
-      for (int i=1;i<=numColumns ;i++)
-      {
-          
-         int colNameSize = rsmd.getColumnName(i).length(); 
-         if (sessObj.isMultiByteAlign() && (isoMapping == 10 || isoMapping == 15)) //SJIS or UTF8
-         {
-             try
-             {
-                 colNameSize = getMultiByteColWidth(new StringBuffer(rsmd.getColumnName(i)));
-             }
-             catch (Exception ex)
-             {
-                 ex.printStackTrace();
-             }
-         }  
-         
-         if (colNameSize > rsmd.getColumnDisplaySize(i))
-            colSize[i-1]=colNameSize;
-         else
-            colSize[i-1]=rsmd.getColumnDisplaySize(i);
-
-         if (colSize[i-1] < SessionDefaults.MIN_COL_DISPLAY_SIZE)
-         {
-            colSize[i-1] = SessionDefaults.MIN_COL_DISPLAY_SIZE;
-         }
-
-         totalWidth += colSize[i-1];
-         
-         switch (sessObj.getDisplayFormat())
-         {
-            case SessionDefaults.RAW_FORMAT:
-               if (numColumns ==1)
-                  formatOutput(rsmd.getColumnName(i),colNameSize,' ',0);
-               else
-               {
-                  if(sessObj.getSessView() == SessionDefaults.MXCI_VIEW && i == numColumns && totalWidth > SessionDefaults.MXCI_TRIM_FIX)
-                      formatOutput(rsmd.getColumnName(i),colNameSize,' ',0);
-                  else
-                      formatOutput(rsmd.getColumnName(i),colSize[i-1],' ',0);
-               }
-               if (i < numColumns)
-               {
-                  writeSeparator();
-                  
-                  /* total width has to be added twice in MXCI mode b/c it has
-                   * two separators
-                   */
-                  if(sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
-                      totalWidth++;
-                  
-                  totalWidth++;
-               }
-               break;
-
-            case SessionDefaults.XML_FORMAT:
-               columnNameArray[i-1] = sessObj.getXmlObj().checkColumnNames(utils.removeSpaces(rsmd.getColumnName(i)));
-               break;
-
-            case SessionDefaults.HTML_FORMAT:
-               formatHtmlOutput(rsmd.getColumnName(i));
-               break;
-
-            default:
-               break;
-         }
-
-         switch (rsmd.getColumnType(i))
-         {
-            case Types.BIGINT:
-            case Types.BIT:
-            case Types.DECIMAL:
-            case Types.DOUBLE:
-            case Types.FLOAT:
-            case Types.INTEGER:
-            case Types.NUMERIC:
-            case Types.REAL:
-            case Types.SMALLINT:
-            case Types.TINYINT:
-               colAlign[i-1]=1;
-               break;
-            default:
-               colAlign[i-1]=0;
-               break;
-
-         }
-      }
-
-      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-      {
-         writeln();
-         for (int i=1;i<=numColumns ;i++)
-         {
-            formatOutput("",colSize[i-1],'-',0);
-            if (i < numColumns)
-            {
-               writeSeparator();
-            }
-         }
-         writeln();
-         if (sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
-            writeln();
-      }
-   }
-
-   private void writeOutParams(ResultSetMetaData rsmd,int numColumns,ParameterMetaData paramMetaData,CallableStatement callStmt) throws SQLException, IOException
-   {
-      sessObj.setWriteParams(true);
-      columnNameArray = new String[numColumns];
-      colSize=new int[numColumns];
-      colAlign=new int[numColumns];
-      qryObj.setColCount(String.valueOf(numColumns));
-
-      if (qryObj.isTrimOut())
-      {
-         return;
-      }
-      for (int i=1;i<=numColumns;i++)
-      {
-         if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
-            paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
-         {
-            int colNameSize = rsmd.getColumnName(i).length();
-            if (colNameSize > rsmd.getColumnDisplaySize(i))
-               colSize[i-1]=colNameSize;
-            else
-               colSize[i-1]=rsmd.getColumnDisplaySize(i);
-
-            if (colSize[i-1] < SessionDefaults.MIN_COL_DISPLAY_SIZE)
-            {
-               colSize[i-1] = SessionDefaults.MIN_COL_DISPLAY_SIZE;
-            }
-
-            switch (sessObj.getDisplayFormat())
-            {
-               case SessionDefaults.RAW_FORMAT:
-                  formatOutput(rsmd.getColumnName(i),colSize[i-1],' ',0);
-                  if (i < numColumns)
-                  {
-                     writeSeparator();
-                  }
-                  break;
-
-               case SessionDefaults.XML_FORMAT:
-                  columnNameArray[i-1] = sessObj.getXmlObj().checkColumnNames(rsmd.getColumnName(i));
-                  break;
-
-               case SessionDefaults.HTML_FORMAT:
-                  formatHtmlOutput(rsmd.getColumnName(i));
-                  break;
-
-               default:
-                  break;
-            }
-
-            switch (rsmd.getColumnType(i))
-            {
-               case Types.BIGINT:
-               case Types.BIT:
-               case Types.DECIMAL:
-               case Types.DOUBLE:
-               case Types.FLOAT:
-               case Types.INTEGER:
-               case Types.NUMERIC:
-               case Types.REAL:
-               case Types.SMALLINT:
-               case Types.TINYINT:
-                  colAlign[i-1]=1;
-                  break;
-               default:
-                  colAlign[i-1]=0;
-                  break;
-
-            }
-         }
-      }
-      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-      {
-         writeln();
-         for (int i=1;i<=numColumns ;i++)
-         {
-            if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
-               paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
-            {
-               formatOutput("",colSize[i-1],'-',0);
-               if (i < numColumns)
-               {
-                  writeSeparator();
-               }
-            }
-         }
-         writeln();
-
-         if (sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
-            writeln();
-      }
-      writeData(callStmt,numColumns,paramMetaData);
-      qryObj.setRowCount("1");
-   }
-
-   private void writeData(CallableStatement callStmt,int numColumns, ParameterMetaData paramMetaData) throws SQLException, IOException
-   {
-      for (int i=1;i<=numColumns ;i++)
-      {
-         if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
-            paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
-         {
-            String value=callStmt.getString(i);
-            if (value == null)
-            {
-               value=sessObj.getSessNull();
-            }
-            // bind the inout and out params
-            Integer paramIdxObj = new Integer(i);
-            if (inOutParamMap != null && inOutParamMap.containsKey(paramIdxObj))
-            {
-               sessObj.setSessParams(inOutParamMap.get(paramIdxObj).toString(),value);
-            }
-
-            switch (sessObj.getDisplayFormat())
-            {
-               case SessionDefaults.RAW_FORMAT :
-                  if (qryObj.isTrimOut())
-                  {
-                     formatOutput(value,value.length(),' ',0);
-                  }
-                  else
-                  {
-                     formatOutput(value,colSize[i-1],' ',colAlign[i-1]);
-                  }
-
-                  if (i < numColumns)
-                  {
-                     writeSeparator();
-                  }
-                  break;
-
-
-               case SessionDefaults.XML_FORMAT :
-                  formatXmlOutput(columnNameArray[i-1],value);
-                  break;
-
-               case SessionDefaults.HTML_FORMAT:
-                  formatHtmlOutput(value);
-                  break;
-
-               case SessionDefaults.CSV_FORMAT:
-                  formatCsvOutput(value);
-                  break;
-            }
-         }
-      }
-      inOutParamMap=null;
-      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-         writeln();
-   }
-
-   private void writeAllSQLWarnings(SQLWarning sqlw) throws IOException
-   {
-      if (sqlw != null)
-      {
-         writer.writeAllSQLWarnings(sessObj,sqlw);
-         sessObj.setSqlWarningsCnt(sessObj.getSqlWarningsCnt()+1);
-      }
-   }
-
-   private void loadDbKeyWordMap()
-   {
-
-      if (dbKeyMap == null)
-      {
-         dbKeyMap = new HashMap<String, String>();
-      }
-
-      dbKeyMap.put("SET_SCHEMA",""+SessionDefaults.SET_SCHEMA);
-      dbKeyMap.put("SET_CATALOG",""+SessionDefaults.SET_CATALOG);
-      dbKeyMap.put("SET_SERVICE",""+SessionDefaults.SET_SERVICE);
-      dbKeyMap.put("CALL",""+SessionDefaults.CALL);
-      dbKeyMap.put("INFOSTATS",""+SessionDefaults.INFOSTATS);
-      dbKeyMap.put("PREPARE",""+SessionDefaults.PREPARE);
-      dbKeyMap.put("EXECUTE",""+SessionDefaults.EXECUTE);
-   }
-   
-   public boolean blockGetStats()
-   {
-      String query=null;
-      switch(qryObj.getQueryId())
-      {
-         case SessionDefaults.SET_SCHEMA:
-         case SessionDefaults.SET_CATALOG:
-            return true;
-            
-         case SessionDefaults.EXECUTE :
-            query = Utils.trimSQLTerminator(qryObj.getQueryText(),sessObj.getSessionSQLTerminator());
-            parser.setRemainderStr(query);
-            parser.getNextKeyToken();
-            String stmtName = parser.getNextPreparedStmtNameToken();
-            PreparedStatement pStmt = (PreparedStatement)sessObj.getPrepStmtMap(stmtName);
-            String sqlQueryStr=((TrafT4Statement)pStmt).getSQL();
-            if ((sqlQueryStr.matches("(?i)(?s)^SET\\s+SCHEMA.*")) ||
-                (sqlQueryStr.matches("(?i)(?s)^SET\\s+CATALOG.*")))
-               return true;
-            else
-               return false;
-               
-         default:
-               return false;
-         
-      }
-   }
-
-   private List<String> getParamNames(String qryString)
-   {
-      qryString=qryString+" ";
-      char[] rQryStr=qryString.toCharArray();
-      boolean quoteFound=false;
-      final char sQUOTE='\'';
-      final char dQUOTE='"';
-      final char pIDENTITY='?';
-      char currentQuote=sQUOTE;
-      boolean paramFound=false;
-      int paramStartPos=0;
-      List<String> paramList=new java.util.ArrayList<String>();
-
-
-      for (int i=0;i < rQryStr.length;i++)
-      {
-         // if we encounter quote skip all the characters till another quote.
-
-         if ((quoteFound && rQryStr[i] != sQUOTE && rQryStr[i] != dQUOTE)    ||
-            (quoteFound && rQryStr[i] == sQUOTE && currentQuote != sQUOTE)  ||
-            (quoteFound && rQryStr[i] == dQUOTE && currentQuote != dQUOTE))
-         {
-            continue;
-         }
-
-
-         if ((quoteFound && rQryStr[i] == sQUOTE && currentQuote == sQUOTE) ||
-            (quoteFound && rQryStr[i] == dQUOTE && currentQuote == dQUOTE))
-         {
-            quoteFound=false;
-            continue;
-         }
-
-         if ((!quoteFound && rQryStr[i] == sQUOTE) ||
-            (!quoteFound && rQryStr[i] == dQUOTE))
-         {
-            quoteFound = true;
-            currentQuote=rQryStr[i];
-            continue;
-         }
-
-         if (rQryStr[i] == pIDENTITY && !paramFound)
-         {
-            paramFound=true;
-            paramStartPos=i;
-            continue;
-         }
-
-         if (paramFound && ( ( (int)rQryStr[i] >= 97 && (int)rQryStr[i] <= 122 ) || ((int)rQryStr[i] >= 65 && (int)rQryStr[i] <= 91 ) ||
-            ((int)rQryStr[i] >= 48 && (int)rQryStr[i] <= 57 ) || rQryStr[i]=='_'  ))
-         {
-            continue;
-         }
-
-         if (paramFound)
-         {
-            paramList.add(qryString.substring(paramStartPos,i));
-            paramFound=false;
-            paramStartPos=0;
-         }
-
-      }
-      return paramList;
-
-   }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Display.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Display.java b/core/conn/trafci/src/org/trafodion/ci/Display.java
deleted file mode 100644
index 892dae1..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Display.java
+++ /dev/null
@@ -1,68 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.IOException;
-
-public class Display {
-
-	private Session sessObj;
-	private IDisplay rawDisplay;
-	private IDisplay xmlDisplay;
-	private IDisplay htmlDisplay;
-	private IDisplay csvDisplay;
-	
-	public Display(Session sessObj)
-	{
-		this.sessObj = sessObj;
-		rawDisplay = new RawDisplay(sessObj);
-		xmlDisplay = new XMLDisplay(sessObj);
-		htmlDisplay = new HTMLDisplay(sessObj);
-		csvDisplay = new CSVDisplay(sessObj);
-	}
-	
-	public void output(OutputContents contents) throws IOException
-	{
-		IDisplay display=rawDisplay;
-		switch (sessObj.getDisplayFormat())
-	      {
-	         //HTML Format
-	         case SessionDefaults.HTML_FORMAT:
-	        	 display=htmlDisplay;
-	        	 break;
-	         //XML Format
-	         case SessionDefaults.XML_FORMAT:
-	        	 display=xmlDisplay;
-	        	 break;
-	         //CSV Format
-	         case SessionDefaults.CSV_FORMAT:
-	        	 display=csvDisplay;
-	        	 break;
-	         //Default Raw Format
-	         default:
-	        	 display=rawDisplay;
-	        	 break;
-	      }
-		display.output(contents);
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/DuplicateParamException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/DuplicateParamException.java b/core/conn/trafci/src/org/trafodion/ci/DuplicateParamException.java
deleted file mode 100644
index 4c8a010..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/DuplicateParamException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class DuplicateParamException extends Exception {
-
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = -3661178727942088670L;
-
-	DuplicateParamException()
-	{
-	
-	}
-	
-	DuplicateParamException(String msg)
-	{
-		super(msg);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ErrorObject.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ErrorObject.java b/core/conn/trafci/src/org/trafodion/ci/ErrorObject.java
deleted file mode 100644
index e3c778d..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ErrorObject.java
+++ /dev/null
@@ -1,103 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-public class ErrorObject {
-    private String errorCode = null;  
-    private String errorMessage = null;
-    public char errorType = 'E';
-    
-    public ErrorObject(String errorCode, String errorMessage) {
-        this.errorCode = errorCode;
-        this.errorMessage = errorMessage;
-        if (this.errorMessage.startsWith("*** WARNING["))
-           this.errorType = 'W'; 
-        else
-           this.errorType = 'E'; //Default
-    }
-    
-    public ErrorObject(String errorCode, String errorMessage, char errorType) {
-        this.errorCode = errorCode;
-        this.errorMessage = errorMessage;
-        this.errorType = errorType;
-    }
-    
-   // @Deprecated
-    //errStr may have no error code in itself
-    public ErrorObject(String errStr) {
-    	Parser parser = new Parser();
-    	this.errorCode = parser.getErrorCode(errStr);
-        this.errorMessage = parser.getErrorMsg(errStr);
-        /**
-         * Bug 2549: Expected warning message was converted into error 
-         * message by JDBC driver.
-         * Internal Analysis: some JDBC driver msg doesn't start with 
-         * *** [WARNING] will cause this error.
-         * Fix Description: instead of using startsWith, use indexOf method
-         */
-        if (errStr.indexOf("*** WARNING[" + errorCode + "]") > -1)
-           this.errorType = 'W'; 
-        else
-           this.errorType = 'E'; //Default
-    }
-
-    public ErrorObject(String errStr,int errorCode) {
-    	Parser parser = new Parser();
-		this.errorCode = parser.getErrorCode(errStr);
-        this.errorMessage = parser.getErrorMsg(errStr);
-		if (Parser.UNKNOWN_ERROR_CODE == this.errorCode)
-			this.errorCode = String.valueOf(Math.abs(errorCode));
-        /**
-         * Bug 2549: Expected warning message was converted into error 
-         * message by JDBC driver.
-         * Internal Analysis: some JDBC driver msg doesn't start with 
-         * *** [WARNING] will cause this error.
-         * Fix Description: instead of using startsWith, use indexOf method
-         */
-        if (errStr.indexOf("*** WARNING[" + errorCode + "]") > -1)
-           this.errorType = 'W'; 
-        else
-           this.errorType = 'E'; //Default
-    }
-    
-    public ErrorObject(ErrorObject errObj, String errStrPrefix, String errStrSuffix) {
-    	this.errorCode = errObj.errorCode;
-        this.errorMessage = errStrPrefix + errObj.errorMessage + errStrSuffix;
-        this.errorType = errObj.errorType;
-    }
-    
-    public String errorCode()   { return errorCode; }
-    
-    public String errorMessage() { return errorMessage; }
-
-    public String RAWOutputError() {
-    	String rawOutput = (this.errorType != 'E' || this.errorCode == Parser.UNKNOWN_ERROR_CODE) ? this.errorMessage : "*** ERROR[" + this.errorCode + "] " + this.errorMessage;
-      if (this.errorType == 'W') {
-          rawOutput =   "*** WARNING[" + this.errorCode + "] "+ this.errorMessage;        
-      }
-    	return (rawOutput);
-     }
-
-    public String toString() {
-         return this.RAWOutputError();
-      }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/FCQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/FCQuery.java b/core/conn/trafci/src/org/trafodion/ci/FCQuery.java
deleted file mode 100644
index f67d5a7..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/FCQuery.java
+++ /dev/null
@@ -1,334 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.IOException;
-
-public class FCQuery
-{
-
-   private Reader        reader;
-   private Writer        writer;
-   private Session       sessObj;
-   private StringBuffer  qryText;
-   private StringBuffer  newQryText;
-
-   private int qryTextMaxLen;
-   private int qryTextPos;
-   private int commandPos;
-   private char[] fcCommand;
-
-   private String  fcPrompt;
-
-   final static int INSERT_O             =  0;
-   final static int DELETE_O             =  1;
-   final static int REPLACE_O            =  2;
-   final static int EXPLICIT_REPLACE_O   =  3;
-   final static int ADVANCE_O            =  4;
-   final static int ABORT_O              =  5;
-   final static int END_O                =  6;
-   final static int DONE_O               =  7;
-   final static int AGAIN_O              =  8;
-   final static int EMPTY_O              =  9;
-
-   /*enum Option
-   {
-   INSERT_O, DELETE_O, REPLACE_O, EXPLICIT_REPLACE_O, 
-   ADVANCE_O, ABORT_O, END_O, DONE_O, AGAIN_O, EMPTY_O
-   };*/
-
-   FCQuery(Session sessObj,Query qryObj)
-   {
-      this.sessObj = sessObj;
-      this.reader = sessObj.getReader();
-      this.writer = sessObj.getWriter();
-      this.setFcPrompt();
-   }
-
-   public boolean editCommand() throws IOException, UserInterruption
-   {
-      boolean returnVal = true;
-      newQryText = new StringBuffer();
-      int option;
-
-      String[] multiLineQry = sessObj.getQuery().getQueryText().split(SessionDefaults.lineSeperator);
-      for (int lineNo=0; lineNo < multiLineQry.length ;lineNo++)
-      {
-         if (sessObj.isQuietEnabled() || !sessObj.isLogCmdText()) {
-            writer.getConsoleWriter().println(sessObj.getSessionPrompt() + multiLineQry[lineNo]);
-            writer.getConsoleWriter().print(fcPrompt);
-         } 
-         if (sessObj.isLogCmdText()) {
-               writer.writeln(sessObj.getSessionPrompt() + multiLineQry[lineNo]); // print the line to be edited
-               writer.write(fcPrompt); //print the fc prompt 
-         }
-         //read the fc command
-         fcCommand= reader.getLine().toCharArray();
-         qryText = new StringBuffer(multiLineQry[lineNo]);
-         qryTextMaxLen = qryText.length();
-         qryTextPos=0;
-         commandPos=0;
-         option=-1;
-
-         while ((option != DONE_O) && (option != ABORT_O))
-         {
-            option = nextOption();
-            switch (option)
-            {
-               case INSERT_O:
-                  processInsert();
-                  break;
-
-               case REPLACE_O:
-                  processReplace();
-                  break;
-
-               case EXPLICIT_REPLACE_O:
-                  processReplace();
-                  qryTextPos++;
-                  break;
-
-               case DELETE_O:
-                  processDelete();
-                  break;
-
-               case ADVANCE_O:
-                  qryTextPos += 1;
-                  break;
-
-               case END_O:
-                  qryTextPos += 2;
-                  break;
-
-               case ABORT_O:
-                  returnVal = false;
-                  break;
-
-               case AGAIN_O:
-                  if (sessObj.isQuietEnabled() || !sessObj.isLogCmdText()) {
-                     writer.getConsoleWriter().println(sessObj.getSessionPrompt() + qryText);
-                     writer.getConsoleWriter().print(fcPrompt);
-                  }
-                  if (sessObj.isLogCmdText()) {
-                       writer.writeln(sessObj.getSessionPrompt() + qryText );
-                       writer.write(fcPrompt);
-                  }
-                  fcCommand= reader.getLine().toCharArray();
-
-                  if (!(fcCommand.length==0))
-                  {
-                     commandPos = 0;
-                     qryTextPos = 0;
-                  }
-                  else
-                  {
-                     option = DONE_O;
-                  }
-
-                  break;
-
-               case DONE_O:
-                  break;
-
-               default:
-                  break;
-
-            }//switch
-         }//while
-
-         if (option != ABORT_O)
-         {
-            if (newQryText.length() == 0)
-               newQryText.append(qryText);
-            else
-               newQryText.append(SessionDefaults.lineSeperator + qryText);
-         }
-         else
-         {
-            return false;
-         }
-      }//for
-      sessObj.getQuery().resetQueryText(newQryText.toString());
-      return returnVal;
-   }
-
-
-   private int nextOption()
-   {
-      int option;
-
-      //If the user just hits an enter key for the command, then we are done
-      //with editing the current qryText
-      if (fcCommand.length==0)
-      {
-         return (DONE_O);
-      }
-      // If you have reached the end of the FC command
-      // give another chance to edit the command
-      if (commandPos >= fcCommand.length)
-      {
-         return (AGAIN_O);
-      }
-
-      switch (fcCommand[commandPos])
-      {
-         case 'i':
-         case 'I':
-            option = INSERT_O;
-            commandPos += 1;
-            break;
-
-         case 'd':
-         case 'D':
-            option = DELETE_O;
-            commandPos += 1;
-            break;
-
-         case 'r':
-         case 'R':
-            option = EXPLICIT_REPLACE_O;
-            commandPos += 1;
-            break;
-
-         case ' ':
-            option = ADVANCE_O;
-            commandPos += 1;
-            break;
-
-         case '/':
-
-            if ((commandPos < fcCommand.length-1) && (fcCommand[commandPos+1] == '/'))
-            {
-               if ((commandPos == 0) && (fcCommand.length == 2))
-                  option = ABORT_O;
-               else
-               {
-                  option = END_O;
-                  commandPos += 2;
-               }
-            }
-            else
-            {
-               option = REPLACE_O;
-            }
-
-            break;
-
-         default:
-            option = REPLACE_O;
-            break;
-      }
-
-      return option;
-   }  // nextOption()
-
-   private int getCommandLen()
-   {
-      int done = 0;
-      int i = 0;
-
-      while (done != -1)
-      {
-         if (commandPos + i >= fcCommand.length)
-            done = -1;
-         else if ((commandPos +i < fcCommand.length-1) && (fcCommand[commandPos+i] == '/') &&
-            (fcCommand[commandPos+i+1] == '/'))
-            done = -1;
-         else
-            i++;
-      }
-      return i;
-   }  // getCommandLen
-
-   void processInsert()
-   {
-      int commandLen = getCommandLen();
-
-      if (commandLen > 0)
-      {
-         if (qryTextPos > qryText.length())
-         {
-            for (int j=qryText.length();j<qryTextPos;j++)
-               qryText.append(" ");
-            qryText.append(new String(fcCommand).substring(commandPos,commandPos+commandLen));
-         }
-         else
-            qryText = qryText.insert(qryTextPos, fcCommand, commandPos, commandLen);
-
-         commandPos += commandLen;
-         qryTextPos += 2 * commandLen + 1;
-         qryTextMaxLen += commandLen;
-
-         if (qryTextPos > qryTextMaxLen)
-            qryTextMaxLen = qryTextPos;
-
-      }
-   }  // processInsert()
-
-
-   private void processDelete()
-   {
-      if (qryTextPos < qryTextMaxLen)
-      {
-         //qryText=new StringBuffer(qryText.substring(0,qryTextPos)+qryText.substring(qryTextPos+1));
-         qryText = qryText.deleteCharAt(qryTextPos);
-         qryTextMaxLen-=1;
-      }
-
-   }
-
-   private void processReplace()
-   {
-      int commandLen = getCommandLen();
-
-      if (commandLen > 0)
-      {
-         if (qryTextPos > qryText.length())
-         {
-            for (int j=qryText.length();j<qryTextPos;j++)
-               qryText.append(" ");
-            qryText.append(new String(fcCommand).substring(commandPos,commandPos+commandLen));
-         }
-         else
-            qryText.replace(qryTextPos, qryTextPos+commandLen, new String(fcCommand).substring(commandPos,commandPos+commandLen));
-         commandPos += commandLen;
-         qryTextPos += commandLen;
-         if (qryTextPos > qryTextMaxLen)
-            qryTextMaxLen = qryTextPos;
-      }
-   }  // processReplace()
-
-
-   public String getFcPrompt()
-   {
-      return this.fcPrompt;
-   }
-
-
-   public void setFcPrompt()
-   {
-      int len = sessObj.getSessionPrompt().length();
-      String fcPrompt="";
-      for (int i=0;i<len;i++)
-         fcPrompt+=".";
-      this.fcPrompt = fcPrompt;
-   }
-}



[03/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/SessionInterface.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/SessionInterface.java b/core/conn/trafci/src/org/trafodion/ci/SessionInterface.java
deleted file mode 100644
index 49db0b0..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/SessionInterface.java
+++ /dev/null
@@ -1,1487 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.Statement;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Properties;
-import java.util.Timer;
-import java.util.List;
-
-import sun.misc.Signal;
-import sun.misc.SignalHandler;
-
-import org.trafodion.jdbc.t4.TrafT4Connection;
-
-
-/**
- * Session Interface is a router interface and acts like a dispatcher for query execution.
- *
- * To request for a new session, call the method createSession with the required database credentials. Once the session is 
- * created, its returned to the caller.
- * Caller will then need to call invokeSession method with the sessionObject.
- * 
- */
-
-public class SessionInterface implements SessionDefaults
-{
-   private static String defaultDataSource=DEFAULT_DATA_SOURCE;
-   private ConsoleReader crObj=null;
-   private ConsoleWriter cwObj=null;
-   private FileReader scriptReader=null;
-   private FileWriter logWriter=null;
-   private String scriptFile=null;                    // script file used when in prun mode or -script option is specified thru command line
-   private String logFileName=null;                   // log file used for prun script file process logging
-   private boolean overWriteLog=false;                // log file overwrite mode
-   private Properties lfProps=null;                   // look & feel properties.
-   private Session sessObj=null;
-   //private int sessionInput=-1;                     // 0 - thru console 1- thru file
-   private int caller=-1;                             // caller id. -1 nobody 0- USERI 1- PRUNI
-   private int sqlErrorCount=0;                       // sql error count..Number of sql errors reported in a session. If a query more than one, then its counted as 1.Needed for prun summary
-   private int sqlQueryCount=0;                       // sql query count. Number of sqls executed in a session. Needed for prun summary
-   private int sqlWarningsCount=0;
-   private boolean queryMode=false;                   // set the session in query mode. As soon as the query is executed..the control is returned back to the caller
-   private boolean tmpQueryMode=false;                // temporary flag to identify if the current session is in query mode
-   private String qryString=null;                     // caller updates this query string when in query mode
-   private Utils utilObj;
-   private Parser parser=null;
-   Thread threadName=null;
-   SignalHandler CTRLCHandler=null;
-   Signal INTSignal=null;
-   boolean nestedObey=false;
-   boolean specialModeEnabled = false;
-   LFProperties lfPropsObj = new LFProperties();
-
-   Query qryObj= null;
-   private static SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SSS a");
-   private boolean showTimeInMillis = false;
-   //never used
-//   private boolean doTrace = Boolean.getBoolean("trafci.enableTrace");
-   private String remoteProcess=null;
-   
-   SessionInterface()
-   {
-
-   }
-
-
-   //Initializes the session interface with a console reader & writer objects
-   SessionInterface(ConsoleReader crObj,
-      ConsoleWriter cwObj)
-   {
-      this.crObj=crObj;
-      this.cwObj=cwObj;
-      CTRLCHandler =new SignalHandler ()
-      {
-         public void handle(Signal sig)
-         {
-            sessObj.setQueryInterrupted(true);
-         }
-      };
-      try {
-      INTSignal=new Signal("INT");
-      } catch (Exception e) {}
-   }
-
-   SessionInterface(Session sessObj)
-   {
-      this.sessObj=sessObj;
-      this.caller=sessObj.getCaller();
-   }
-
-
-   //get a statement handle for the current session
-   public Statement getStatement(Connection conn) throws SQLException
-   {
-      return conn.createStatement();
-   }
-
-   public Session createSession(String userName,
-	  String roleName,
-	  String password,
-      String serverName,
-      String portNumber,
-      String dsnName,
-      int caller,
-      boolean noConnectOption) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, FileNotFoundException, IOException
-   {
-
-      Session session=new Session(   userName,
-         password,
-         roleName,
-         serverName,
-         portNumber,
-         dsnName,
-         crObj,
-         cwObj);
-      
-      return createSession(session,
-         caller,
-         noConnectOption);
-   }
-
-   // create a new session and return it to the caller
-   // Any exceptions arise during this process should be returned to the caller,
-   // caller will decide where to report them (to the console or to the log file)
-   // Each session object is created with one connection, validateQueryObject,
-   // Interface query object, dbQuery objects for the entire session to use them 
-
-   public Session createSession(Session session,
-      int caller,
-      boolean noConnectOption) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, FileNotFoundException, IOException   {
-      utilObj = new Utils();
-      
-      parser = new Parser();
-
-      sessObj=session;
-
-      // if the user opts to connect to the UI without creating database connection then create db connection and stmt obj
-      if (!noConnectOption)
-      {
-         sessObj.setConnObj(getConnection());
-         sessObj.setStmtObj(getStatement(sessObj.getConnObj()));
-         sessObj.setSessionValues();
-         this.getDriverVersion();     
-      }
-            
-      sessObj.setCaller(caller);
-      sessObj.setVQryObj(new ValidateQuery(sessObj));
-      sessObj.setIQryObj(new InterfaceQuery(sessObj));
-      sessObj.setCQryObj(new ConditionalQuery(sessObj));
-      sessObj.setDbQryObj(new DatabaseQuery(sessObj));
-      sessObj.setHtmlObj(new HTMLObject(sessObj));
-      sessObj.setXmlObj(new XMLObject(sessObj));
-     
-
-      lfPropsObj.loadLookAndFeelProps(sessObj, specialModeEnabled);
-      sessObj.setLFProps(lfPropsObj);
-
-      // start the timer thread to monitor the session idletime.
-      // this is need only when the session is not in prun mode. PRUN can enjoy!!!
-      // this thread starts immediately after the first minute and runs every one minute then on
-      if ((caller != PRUNI) && (!noConnectOption))
-      {
-         sessObj.setTimeoutTask(new SessionTimeoutTask(sessObj.getConnObj()));
-         sessObj.getTimeoutTask().idleTime=sessObj.getSessionIdletime();
-         sessObj.getTimeoutTask().lastQueryExecTime=System.currentTimeMillis();
-         Timer timer = new Timer();
-         timer.schedule(sessObj.getTimeoutTask(), 1 * 60 * 1000, 1 * 60*1000);
-
-      }
-
-      String showTimeStr = System.getProperty("trafci.showTimeInMS");
-      if ((showTimeStr != null) && showTimeStr.trim().equalsIgnoreCase("true"))  
-         showTimeInMillis = true;
-
-      // return the session object to the caller.
-      return sessObj;
-   }
-
-   public Session createSession(String userName,
-	  String roleName,
-	  String password,
-      String serverName,
-      String portNumber,
-      String dsnName,
-      int caller
-      ) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, FileNotFoundException, IOException
-   {
-      return createSession(userName,
-    	 roleName,
-    	 password,
-         serverName,
-         portNumber,
-         dsnName,
-         caller,
-         false);
-   }
-
-   // start the session with the session object passed
-   // in prun mode, this method is called for each script file as prun has to some intermediate calculations between the file processing
-   // in useri mode, if the user has logged in non -q mode, called once
-   // in useri mode or any other modes which require just one query execution at a time, called as many as times depends on the number of queries
-   // returns exit status code
-   public int invokeSession(Session sessObj) throws IOException
-   {
-      this.sessObj=sessObj;
-      ValidateQuery vQryObj=sessObj.getVQryObj();
-      InterfaceQuery iQryObj=sessObj.getIQryObj();
-      ConditionalQuery cQryObj=sessObj.getCQryObj();
-      DatabaseQuery dbQryObj=sessObj.getDbQryObj();
-      this.caller=sessObj.getCaller();
-      Reader reader = new Reader();
-      Writer writer = new Writer(sessObj);
-      tmpQueryMode=false;
-      
-      // if the caller is interactive user interface
-      // set the reader and writer for the console
-      // the read and write modes are set to console modes assuming that there are no script files or obey files 
-      if (caller == USERI)
-      {
-         reader.setConsoleReader(this.crObj);
-         writer.setConsoleWriter(this.cwObj);
-         reader.setReadMode(CONSOLE_READ_MODE);
-         writer.setWriterMode(CONSOLE_WRITE_MODE);
-      }
-
-      // if the user has passed a script file to run it while launching the session
-      // so read the script file first and later can move to console mode
-      // set the read mode to script file read mode.
-      // for prun its always script file reading
-      // return an exception to the caller if the specified script file is not found or if some error occurred
-      
-      if (scriptFile != null)
-      {
-
-         try
-         {
-            scriptReader=new FileReader();
-            scriptReader.initialize(scriptFile);
-            reader.setReadMode(SCRIPT_READ_MODE);
-            reader.setScriptReader(scriptReader);
-         }catch (FileNotFoundException fnfe)
-         {
-            throw fnfe;
-         }catch (IOException ioe)
-         {
-            throw ioe;
-         }
-
-      }
-    
-    	  
-      // if the log file is specified. log all the results ( errors/warnings and output) to the logfile instead of 
-      // console
-      // write the header for the log file here..with all blaahhaa.blaah..start time
-      // return to the caller if the log file is not found or io exception occurred
-      if (logFileName != null)
-      {
-         try
-         {
-            logWriter=new FileWriter();
-            if (!this.overWriteLog)
-               logWriter.setAppend(true);
-            logWriter.initialize(logFileName);
-            logWriter.write((this.formatString(SessionDefaults.lineSeperator+"=",82,'=')));
-            logWriter.writeln();
-            if (!showTimeInMillis)
-            logWriter.write("Logging started at "+DateFormat.getDateTimeInstance().format(new Date())); //Feb 13, 2007 11:32:31 AM 
-            else
-               logWriter.write("Logging started at "+  sdf.format(new Date(System.currentTimeMillis())) ); //Feb 13, 2007 11:32:31.999 AM
-            logWriter.writeln();
-            logWriter.write((this.formatString("=",80,'=')));
-            logWriter.writeln();
-            writer.setLogWriter(logWriter);
-            writer.setWriterMode(LOG_WRITE_MODE);
-
-         }catch (FileNotFoundException fnfe)
-         {
-            throw fnfe;
-         }catch (IOException e)
-         {
-            throw e;
-         }
-
-      }
-
-      // at this point, we know from where to read and where to write. set them in the session so that all other
-      // objects will know
-      sessObj.setReader(reader);
-      sessObj.setWriter(writer);
-
-      // to handle sqlprompts when EOF is reached
-      boolean OS_EOF=false;  // obey file & script file EOF indicator
-      boolean OBEY_DEPTH_ERROR=false; // for use with OS_EOF, display prompt again after error
-      
-      threadName=Thread.currentThread();
-
-      try {
-         if (CTRLCHandler != null)
-         {
-            Signal.handle(INTSignal, CTRLCHandler);
-         }
-      }catch (Exception e) {}
-
-      boolean userPressedCtrlC = false;
-      boolean curQryConditionalAction = false;
-      String lastObeyFilename = "";
-
-      // loop thru till when the session is active
-      if (caller != PRUNI)
-         sessObj.setInteractiveRead(reader.getConsoleReader().isInteractive());
-    
-   
-      while (sessObj.isSessionActive())
-      {
-         sessObj.setQueryInterrupted(false);
-         curQryConditionalAction = false;
-
-        //store the previous query for history command
-
-         if (caller == USERI && sessObj.getQuery() != null && !sessObj.getQuery().getQueryText().trim().equals(""))
-         {
-            // If the history option is set to ALL add all commands  
-            // (except OBEY command) in the script file to the history buffer
-            // If the history option is set to default, do not add the 
-            // commands in script file to history. history should contain
-            // only the obey command.
-            if ((sessObj.getReader().getReadMode() != OBEY_READ_MODE || !sessObj.getReader().isReallyObeyfile()) ||
-               ( !sessObj.isSessionHistoryAll() && sessObj.getQuery().getQueryId() == SessionDefaults.OBEY && !nestedObey) ||
-               ( sessObj.isSessionHistoryAll() && sessObj.getQuery().getQueryId() != SessionDefaults.OBEY))
-            {
-                  sessObj.addQryToHistory(sessObj.getQuery().getQueryText());
-            	
-               nestedObey = sessObj.getReader().getReadMode() == OBEY_READ_MODE ? true : false;
-            }
-         }
-
-         // store the previous query's status code for conditional exit
-         if (sessObj.getQuery() != null && sessObj.getQuery().getQueryText() != null && !sessObj.getQuery().getQueryText().trim().equals(""))
-         {
-            sessObj.setPrevQryStatusCode(sessObj.getQuery().getStatusCode());
-         }
-         // write a new line before each prompt..
-         if (!OS_EOF && !cQryObj.isPendingAction())
-         {   
-            if ( (!userPressedCtrlC) &&  (caller != PRUNI) && sessObj.isLogCmdEcho() &&
-            	 !sessObj.isSessionStartup() &&
-                 (writer.getConsoleWriter().getConsoleOut()) &&
-                 !((sessObj.getSessView() == SessionDefaults.MXCI_VIEW))
-                 /* Commenting the following lines of code temporarily. 
-                  * When markup is set to csv, there are no new lines 
-                  * displayed before the sql prompt. Although commenting
-                  * these lines fixes this problem, it does not fix the extra
-                  * new lines for insert/update/delete commands in the log files
-                  * for CSV markup. Since the first issue was more visible, for 
-                  * now commenting this fix till we find a permanent solution
-                  * to both these problems.
-                  */
-                 /*&&
-                 !(sessObj.getDisplayFormat() == SessionDefaults.CSV_FORMAT && 
-                   (sessObj.getQuery()!= null) &&
-                     (sessObj.getQuery().getQueryText().trim().matches("^(?i)(INSERT|UPDATE|DELETE)(.*)")))
-                 */    
-                  ) 
-                  writer.writeln();
-         }
-         
-         // write the current time in the session object so that timer bud knows when to kill 
-         sessObj.setLastQryExecTime(System.currentTimeMillis());
-
-         // tmp query mode is initially set to false and when in query mode changed to true after the first query
-         // to break the current loop
-         if (tmpQueryMode && sessObj.isSessionInteractive())
-         {
-            break;
-         }
-         reader=sessObj.getReader();
-         writer=sessObj.getWriter();
-         //tmpQueryMode=this.queryMode;
-         try
-         {
-
-             curQryConditionalAction = cQryObj.isPendingAction();
-             if (!this.queryMode && !curQryConditionalAction)
-             {
-               if (!OS_EOF)
-               {
-            	   if(!sessObj.isSessionStartup()) {
-	                  if  (!userPressedCtrlC && sessObj.isLogCmdText() && sessObj.isLogCmdEcho() )
-	                  {
-	                     writer.write(sessObj.getSessionPrompt());
-	                  }
-	                  
-	                  // Need to show the prompt on Console for LOG command with QuietEnabled
-	                  if ((sessObj.isQuietEnabled()) && sessObj.isLogCmdEcho() ) 
-	                      writer.getConsoleWriter().print(SessionDefaults.lineSeperator+sessObj.getSessionPrompt());
-	                  else if(!sessObj.isLogCmdText() && sessObj.isLogCmdEcho())
-	                      writer.getConsoleWriter().print(sessObj.getSessionPrompt());
-            	  }
-               }
-               else
-               {
-                  OS_EOF=false;
-               }
-            }
-            userPressedCtrlC = false;
-            qryObj=null;
-            sessObj.setQuery(null);
-
-            // for each query create a new query object
-            qryObj=new Query();
-
-            String qryLine=cQryObj.getPendingAction();          // if conditional action passed, pendingAction exists
-
-            // only if not in query mode read from the console or script file
-            if (queryMode && sessObj.isSessionInteractive())
-            {
-               qryLine=this.qryString;
-               if (!qryLine.endsWith(sessObj.getSessionSQLTerminator()))
-               {
-                  qryLine+=sessObj.getSessionSQLTerminator();
-               }
-               tmpQueryMode=queryMode;
-
-            }
-            else
-            {
-               sessObj.setQueryInterrupted(false);      // to avoid the timing issues
-               boolean flag = true;
-               
-               
-               /* conditional stmts can set this to values other then null */
-               if(qryLine == null)
-               {
-                   while (flag)
-                   {
-                      try
-                      { 
-                         qryLine = reader.getNonBlankLine();
-                         if (sessObj.isCmdEchoEnabled() &&
-                        	(qryLine != null) && !qryLine.trim().equals(""))
-                             writer.getConsoleWriter().println(qryLine);
-                         flag = false;
-                      }
-                      catch (UserInterruption ui)
-                      {
-                        qryLine = "";
-                      }
-                      catch(IOException ex){  // thrown by Reader if the obey command loops
-                          writer.writeInterfaceErrors(sessObj, ex.getMessage());
-                          qryLine = null;
-                          flag = false;
-                          OBEY_DEPTH_ERROR = true;
-                      }
-                   }
-               }
-               if ((null != reader) && (null != reader.getConsoleReader()))
-                  reader.getConsoleReader().setQueryInterrupted(false);
-
-            }
-
-            // check if the db connection exists when processing the script or obey files
-            // if the connection doesnt exists, skip the remaining lines from the files
-            /*
-            if (!sessObj.isDBConnExists() && reader.getReadMode() != SessionDefaults.CONSOLE_READ_MODE)
-            {
-               qryLine=null;
-            }
-            */
-            // if the query is not null..write the query to log file if the current session is
-            // writing to the log file. or to the spool file if spooling is enabled
-            // if the query is read from an obey file. write the query to the console
-
-
-            if (qryLine != null) {
-               qryObj.setQueryText(parser.ignoreComments(qryLine));
-               
-               // do not write out a conditional action since it was already written during the IF...THEN statement
-               if(!curQryConditionalAction) {
-            	   /**
-            	    * Bug 2325- Password is saved in log
-            	    * Fix Description- if queryStr starts with Connect then log pwd to stars
-            	    */
-            	   if (qryLine.toUpperCase().startsWith("CONNECT")) {
-            		   
-            		   int slashIndex = qryLine.lastIndexOf("/");
-                		 if (slashIndex > -1) {
-                			 // connect user/pwd, mode
-                			 int lastCommaIndex = qryLine.lastIndexOf(",");
-                			 StringBuilder qryBuilder = new StringBuilder(qryLine);
-                			 if (lastCommaIndex > -1)
-                				 qryBuilder.replace(slashIndex+1, lastCommaIndex, "*****");
-                			 else
-                				 qryBuilder.replace(slashIndex+1, qryLine.length(), "*****");
-                			 
-                			 qryLine = qryBuilder.toString();
-                		 }
-                	 }
-            	   if ((writer.getWriterMode() == SessionDefaults.LOG_WRITE_MODE) && (!sessObj.isSessionStartup()) && sessObj.isLogCmdEcho())
-                      writer.getLogWriter().writeln(qryLine);
-                   else if (reader.getReadMode() == CONSOLE_READ_MODE && writer.getWriterMode() == SessionDefaults.CONSOLE_SPOOL_WRITE_MODE)
-                   {
-                      if (sessObj.isLogCmdText())
-                         writer.getSpoolWriter().writeln(qryLine);
-                   }else if (reader.getReadMode() == OBEY_READ_MODE || ( caller !=PRUNI && reader.getReadMode() == SCRIPT_READ_MODE ))
-                   {
-                       boolean showPromptAgain = false;
-
-                       if(reader.getReadMode() == OBEY_READ_MODE && reader.obeyMultipleFiles() && reader.getObeyReader()!=null && !sessObj.isDotModeCmd())
-                       {
-                           // test if we are reading a different obey file
-                           if(!lastObeyFilename.equals(reader.getObeyReader().getFileName()))
-                           {
-                               lastObeyFilename = reader.getObeyReader().getFileName();
-                               
-                               if(sessObj.isLogCmdText() && writer.getWriterMode() == CONSOLE_SPOOL_WRITE_MODE)
-                               {
-                                   writer.getSpoolWriter().writeln();
-                                   writer.getSpoolWriter().writeln(this.formatString("=",80,'='));
-                                   writer.getSpoolWriter().writeln("Script : " + lastObeyFilename);
-                                   writer.getSpoolWriter().writeln(this.formatString("=",80,'='));
-                                   showPromptAgain = true;
-                               }
-                           }
-                       }    
-                         
-                       if(sessObj.isLogCmdText() && writer.getWriterMode() == CONSOLE_SPOOL_WRITE_MODE && sessObj.isLogCmdEcho())
-                           writer.getSpoolWriter().writeln(((showPromptAgain == true) ? sessObj.getSessionPrompt() : "") + qryLine);
-                       
-                       if (sessObj.isLogCmdEcho())
-                    	   writer.getConsoleWriter().println(qryLine);
-                   }
-               }
-            }
-            else
-            {
-               // if the query line is null, then we have reached the end of line
-               // if the current mode is non-interactive mode(reading from  an obey file - Note- reading from script
-               // is treated as interactive)..close the obey file 
-               // and move to the previous mode
-                
-               OS_EOF=true;
-                             
-               if (!sessObj.isSessionInteractive())  // reading from an obey file
-               {
-                   
-                  // cleanup open files, close files listed in the obey hash map
-                  try
-                  {
-                     reader.getObeyReader().close();
-                     List<FileReader> obeyReaders = reader.getObeyReaderList();
-                     if(obeyReaders != null){
-                         for(int i=0;i<obeyReaders.size();i++)
-                             (obeyReaders.get(i)).close();
-                     }
-                  }catch (IOException ioe)
-                  {
-                    System.out.println(ioe);
-                  }finally
-                  {
-                     reader.setObeyReader(null);
-                     if(OBEY_DEPTH_ERROR)
-                     {
-                         OBEY_DEPTH_ERROR = false;
-                         OS_EOF = false;
-                     }
-                  }
-                  sessObj.setSessionType(true); // change it back to the interactive mode
-                  reader.setReadMode(reader.getPrevReadMode());
-                  nestedObey = sessObj.getReader().getReadMode() == OBEY_READ_MODE ? true : false;
-                  continue;
-               }
-
-               // if the session is interactive mode and the caller is PRUN, then we need to inform ParallelRun Thread to send us the next file
-               // close the current script file and log file and return to the prun
-               if (caller == PRUNI || caller == SessionDefaults.PYTHI)
-               {
-                  try
-                  {
-                     scriptReader.close();
-                  }catch (IOException ioe)
-                  {
-                     System.out.println(ioe);
-                  }finally
-                  {
-                     reader.setScriptReader((scriptReader =null));
-                  }
-
-                  if (writer.getLogWriter() != null)
-                  {
-                     try
-                     {
-                        writer.getLogWriter().write((this.formatString(SessionDefaults.lineSeperator+SessionDefaults.lineSeperator+"=",84,'=')));
-                        writer.getLogWriter().writeln();
-                        if (!showTimeInMillis)
-                        writer.getLogWriter().write("Logging ended at "+DateFormat.getDateTimeInstance().format(new Date())); //Feb 13, 2007 11:32:31 AM 
-                        else
-                           writer.getLogWriter().write("Logging ended at "+  sdf.format(new Date(System.currentTimeMillis())) ); //Feb 13, 2007 11:32:31.999 AM
-                        writer.getLogWriter().writeln();
-                        writer.getLogWriter().write((this.formatString("=",80,'=')));
-                        writer.getLogWriter().writeln();
-
-                        writer.getLogWriter().close();
-                     }catch (IOException ioe)
-                     {
-                     }finally
-                     {
-                        writer.setLogWriter((logWriter =null));
-                     }
-                  }
-                  return sessObj.getExitCode();
-               }
-
-               // for USERI, if the current mode is script read mode then move to the interactive 
-               if (caller == USERI)
-               {
-                  if (reader.getReadMode() == SCRIPT_READ_MODE)
-                  {
-                     try
-                     {
-                        scriptReader.close();
-                     }catch (IOException ioe)
-                     {
-                        System.out.println(ioe);
-                     }finally
-                     {
-                        reader.setScriptReader((scriptReader =null));
-                     }
-                     reader.setReadMode(CONSOLE_READ_MODE);
-                     continue;
-                  }
-                  else
-                  {
-                     if (reader.getReadMode() == SessionDefaults.CONSOLE_READ_MODE)
-                         return sessObj.getExitCode();
-                  }
-
-               }
-            }
-
-            // Now lets validate the query and route it to the correct object for execution
-            // identify the type of query 
-            try
-            {
-               vQryObj.validate(qryObj,sessObj.getSessionSQLTerminator());
-            } catch (NullKeyWordException nke)
-            {
-               // if blank lines entered ..its fine..move on
-               continue;
-            }
-
-            // at this point, we know the first key word..save the query object in the session object
-
-            sessObj.setQuery(qryObj);
-          
-            //"if" statement added  201002-26
-       	   //check whether we need add sql query count for prun.
-       	   if(caller==PRUNI && !sessObj.isSessionStartup() && !sessObj.isDotModeCmd())
-       	   {
-       		   this.sqlQueryCount++;
-       	   }
-       	 
-       	   //    check if the current session has database connection otherwise request user to connect to the db first
-
-           if (!sessObj.isDBConnExists())
-           {
-              if (qryObj.getQueryType() != IQ && qryObj.getQueryType() != CQ)
-              {
-                  if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-                  	  writer.writeln();
-                 //writer.writeln(SessionError.DB_CONN_NOT_EXIST);
-                 writer.writeInterfaceErrors(sessObj,SessionError.DB_CONN_NOT_EXIST );
-                 continue;
-              }
-              else if(qryObj.getQueryType()==IQ)
-              {
-              }
-           }
-           
-            boolean printIgnoringCmdMsg = true;            
-            
-            //if the query type is conditional query type execute using conditional query object
-            if(qryObj.getQueryType() == CQ){
-            	if (sessObj.getCQryObj().getGotoLabel().equals("") )
-                    printIgnoringCmdMsg = false;
-                try{
-                    cQryObj.execute();
-                }catch(ConditionalQueryException ex){
-                    
-                    if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-                        writer.writeln();
-                    
-                    if(ex.getErrorMsg() != null)
-                        writer.writeInterfaceErrors(sessObj,ex.getErrorMsg());
-                    else
-                        writer.writeConditionalSyntaxError(sessObj, cQryObj.getQueryString());
-                  
-                    //Added  2010-02-26
-                	if(caller == PRUNI && sessObj.getQuery().getStatusCode() == -1)
-                    {
-                  	  this.sqlErrorCount++;
-                    }
-                    continue;
-                }
-                catch(UserInterruption ui){
-                    userPressedCtrlC = true;
-                    if (sessObj.isQueryInterrupted())
-                    {
-                       sessObj.setQueryInterrupted(false);
-                       writer.writeln();
-                       writer.writeInterfaceErrors(sessObj,SessionError.OPERATION_CANCELLED);
-                    }
-                    continue;
-                }
-                catch (IOException e)
-                {
-                   System.out.println("IO Exception occurred while processing conditional query :"+e);
-                }
-
-            }
-            
-            /* Conditional Query:
-             *  if a GOTO <label> is set ignore all commands until
-             *  the <label> is hit, which unsets the "getGotoLabel()" value
-             */
-            if(!sessObj.getCQryObj().getGotoLabel().equals(""))
-            {
-                if(qryObj.getQueryType() != CQ)
-                {
-                    /* still show continuation prompts for ignored queries, 
-                     * useful for maintaining a correct command history
-                     * */
-                    try{
-                        cQryObj.execute();
-                        //For prun warning counting.
-                        int iGotoErrorCode = Integer.parseInt(SessionError.GOTO_MESSAGE.errorCode());
-	                    if (caller == PRUNI && sessObj.getLastError()==iGotoErrorCode)
-	                    {
-	                       this.sqlWarningsCount++;
-	                    }
-                    }catch(Exception ex){
-                    	if(caller == PRUNI)
-                        {
-                      	  this.sqlErrorCount++;
-                        }
-                    }
-                }
-                String currLabel = sessObj.getCQryObj().getGotoLabel();
-                if (printIgnoringCmdMsg  &&  !currLabel.equals("") )                 	
-                	{
-	                	ErrorObject msg_warning = new ErrorObject(SessionError.MESSAGE_WARNING.errorCode(), 
-	                								SessionError.MESSAGE_WARNING.errorMessage() + currLabel + "' command is encountered.",SessionError.MESSAGE_WARNING.errorType);
-	                	writer.write(SessionDefaults.lineSeperator);
-	                	writer.writeError(sessObj, msg_warning);
-	                    if (caller == PRUNI)
-	                    {
-	                       this.sqlWarningsCount++;
-	                    }
-	                    
-                	}
-                
-                continue;
-            }
-           
-            //if the query type is interface query type execute using interface query object
-            if (qryObj.getQueryType() == IQ)
-               try
-               {
-
-                  iQryObj.execute();
-                  //"if" statement added  2009-12-07
-                  //calculate error count for some exception(not throw out). 
-                  if(caller == PRUNI && sessObj.getQuery().getStatusCode() == -1)
-                  {
-                	  //Sometimes if we get no data, the statuscode will be set to -1.
-                	  //So here, we judge whether there is an error or not by last error code.
-                	  if(sessObj.getLastError()!=0) 
-                		  this.sqlErrorCount++;
-                  }
-
-                  continue;
-               } catch (UnKnownInterfaceCommand e)
-            {
-            	   //if the command is not an interface command and db connection does not exist,
-            	   //write error out and terminate the command;
-	               if (!sessObj.isDBConnExists())
-	               {
-	                  if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-	                      	  writer.writeln();
-	                 //writer.writeln(SessionError.SYNTAX_ERROR_PREFIX);
-	                 writer.writeInterfaceErrors(sessObj,SessionError.UNKOWN_OPTION );
-	                 continue;
-	                  
-	               }
-	               
-               // if the command is not an interface command set the query type to SQL/CQ command
-               // depends on the current session mode
-               if (qryObj.getQueryType() != PRUNQ)
-               {
-                  switch (sessObj.getMode())
-                  {
-                     case SQL_MODE:
-                        qryObj.setQueryType(SQLQ);
-                        break;
-                  }
-
-               }
-            }catch (UserInterruption ui)
-            {
-               userPressedCtrlC = true;
-               if (sessObj.isQueryInterrupted())
-               {
-                  userPressedCtrlC = true;
-                  sessObj.setQueryInterrupted(false);
-                  writer.writeln();
-                  // writer.writeln(SessionError.OPERATION_CANCELLED);
-                  writer.writeInterfaceErrors(sessObj,SessionError.OPERATION_CANCELLED);
-               }
-               //System.in.read();
-               continue;
-            }
-            catch (SQLException e)
-            {
-               sessObj.getQuery().setStatusCode(Math.abs(e.getErrorCode()));
-               //to handle unexpected server error message..connection does not exist occurs after socket error
-               if (e.getErrorCode()==-29154 || e.getErrorCode()==-29002)
-               {
-            	   if(sessObj.isDBConnExists())
-            		   sessObj.setSessionStatus(false);
-               }
-               if (e.getErrorCode() == -29157)
-               {
-                  sessObj.setDBConnExists(false);
-               }
-
-               if (sessObj.isQueryInterrupted() && !sessObj.isDBConnExists())
-               {
-                  writer.writeInterfaceErrors(sessObj,SessionError.DB_DISCONNECT_ON_USER_REQ);
-                  continue;
-               }
-               if (caller == PRUNI)
-               {
-                  this.sqlErrorCount++;
-               }
-               writer.writeln();
-               writer.writeAllSQLExceptions(sessObj,e);
-               continue;
-            }catch (IOException e)
-            {
-               System.out.println("IO Exception occurred while processing interface query :"+e);
-            }
-
-            //Prun not supported in CS mode
-            if (qryObj.getQueryType() == PRUNQ && sessObj.getMode() != SessionDefaults.SQL_MODE)
-            {
-               //String errorStr = "ERROR: This command is not supported in "+sessObj.getStrMode()+" mode.";
-               if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-             	  writer.writeln();
-               writer.writeInterfaceErrors(sessObj, SessionError.CMD_NOT_MODE_SUPPORTED);
-               continue;
-            }
-
-            //
-            //if the query is of type parallel run
-            //
-            if (qryObj.getQueryType() == PRUNQ && caller != PRUNI)
-            {
-               sessObj.setTimerHold();
-               ParallelRun prunObj=null;
-               try
-               {
-                  prunObj=new ParallelRun(crObj,cwObj,lfProps,sessObj);
-                  prunObj.execute();
-               } catch (PrunUserInterruption e)
-               {
-                  // if the user stop the prun session..no worries..continue
-                  continue;
-               } catch (UserInterruption ui)
-               {
-                  userPressedCtrlC = true;
-                  continue;
-               } catch (IOException ioe)
-               {
-                  // if the file processing is screwed up..
-                  System.out.println("IO Exception while processing prun: "+ioe);
-                  continue;
-
-               }
-               catch (InvalidNumberOfArguments e)
-               {
-                  // writer.writeln(e.getMessage());
-                  if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-                        writer.writeln();
-                  writer.writeInterfaceErrors(sessObj,e.getMessage());
-
-                  if(sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-                       prunObj.printUsage();
-                  continue;
-               }
-               catch (NumberFormatException  nfe)
-               {
-                  // Number Format Exception is caught in ParalleRun.java
-                  // and rethrown. Error message is printed in ParallelRun.java.
-                  // Just continue with the next command from here.
-                  continue;
-               }
-               finally
-               {
-                  prunObj=null;
-               }
-               continue;
-            }
-
-            try
-            {
-            	boolean showStatusMsg = true;
-               
-               /*
-                * Running EXPORT WMS command from the normal prompt 
-                */
-				int queryType = -1;
-				String queryText = null;
-				if(qryObj.getQueryText() != null)
-					queryText = qryObj.getQueryText().toUpperCase().trim();
-				if ((queryText != null && sessObj.qsOpen && SessionDefaults.WMS_MODE == sessObj .getMode()) || (queryText != null && queryText .startsWith("EXPORT WMS"))) {
-					qryObj.setQueryType(NSQ);
-					queryType = NSQ;
-				} else if (queryText != null && (queryText.startsWith(SessionDefaults.WMSOPEN) || queryText .startsWith(SessionDefaults.WMSCLOSE))) {
-					qryObj.setQueryType(NSQ);
-					queryType = NSQ;
-				} 
-				else
-					queryType = qryObj.getQueryType();
-				
-               switch (queryType)
-               {
-                  case SQLQ:
-                     try
-                     {
-						 queryText = Utils.trimSQLTerminator(queryText,sessObj.getSessionSQLTerminator()).trim();
-                    	 if(SessionDefaults.CMDOPEN.equalsIgnoreCase(queryText) && 
-                    			 SessionDefaults.CS_MODE == sessObj.getMode()){
-                    		 writer.writeln();
-                    		 writer.writeError(sessObj, SessionError.CMD_ONLY_SQL_SUPPORTED);
-                    		 showStatusMsg = false;
-                    		 break;
-                    	 }
-                         else if(SessionDefaults.CMDCLOSE.equalsIgnoreCase(queryText) && 
-                        		 SessionDefaults.SQL_MODE == sessObj.getMode()){
-                        	 writer.writeln();
-                    		 writer.writeError(sessObj, SessionError.CMD_ONLY_CS_SUPPORTED);
-                    		 showStatusMsg = false;
-                    		 break;
-                         }//prevent cmdopen;; and cmdclose;; like cheat
-							else if (queryText.toUpperCase().matches(
-									SessionDefaults.CMDOPEN + ".+")
-									|| queryText.toUpperCase().matches(
-											SessionDefaults.CMDCLOSE + ".+")) {
-							writer.writeln();
-							writer.writeError(sessObj,
-										SessionError.CMD_SYNTAX_ERROR);
-							showStatusMsg = false;
-							break;
-						}
-                        dbQryObj.execute();
-                        if(SessionDefaults.CMDOPEN.equalsIgnoreCase(queryText))
-                        	sessObj.setMode(SessionDefaults.CS_MODE);
-                        else if(SessionDefaults.CMDCLOSE.equalsIgnoreCase(queryText))
-                        	sessObj.setMode(SessionDefaults.SQL_MODE);
-                        if (sessObj.isSessionStatsEnabled() &&
-                           (false == dbQryObj.userExecutedGetStatistics()) &&
-                           (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT && !dbQryObj.blockGetStats() ))
-                           showStatusMsg = false;
-                        
-                        if (caller == PRUNI)
-                        {
-                           this.sqlWarningsCount= this.sqlWarningsCount + sessObj.getSqlWarningsCnt();
-                        }
-                     }catch (UnKnownInterfaceCommand e)
-                     {
-                        continue;
-                     }
-                     break;
-                	  
-                  default:
-                     continue;
-               }
-               if ((qryObj.isTrimOut() && 
-                   Utils.trimSQLTerminator(qryObj.getQueryText(), sessObj.getSessionSQLTerminator())
-                   .matches("(?i)get\\s+all\\s+volatile\\s+schemas\\s*")) ||
-                  (!qryObj.isTrimOut()) )
-            	   sessObj.setTotalRecordCount(qryObj.getRowCount());
-					if (!showStatusMsg) {
-						String elapsedTimeMsg = writer.getElapsedTime(sessObj,
-								qryObj, utilObj);
-						writer.writeStatusMsg(sessObj, null, elapsedTimeMsg,
-								writer);
-					} else {
-						writer.writeStatusMsg(sessObj, qryObj, utilObj, writer);
-					}
-
-               sessObj.setLastError(sessObj.getQuery().getStatusCode());
-            }catch (UserInterruption ui)
-            {
-               userPressedCtrlC = true;
-               if (sessObj.isQueryInterrupted())
-               {
-                  sessObj.setQueryInterrupted(false);
-                  if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-                  	  writer.writeln();
-                  writer.writeInterfaceErrors(sessObj,SessionError.OPERATION_CANCELLED);
-               }
-
-               continue;
-            } catch (SQLException e) {
-               if (e.getErrorCode() == -29157)
-               {
-                  sessObj.setDBConnExists(false);
-               }
-
-               if (sessObj.isQueryInterrupted() && !sessObj.isDBConnExists())
-               {
-                   if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-                   	  writer.writeln();
-                   writer.writeInterfaceErrors(sessObj,SessionError.DB_DISCONNECT_ON_USER_REQ);
-                   if (sessObj.isDotModeCmd())
-                	   sessObj.setLogCmdEcho(true);
-                  continue;
-               }
-
-               sessObj.getQuery().setStatusCode(Math.abs(e.getErrorCode()));
-               //  to handle unexpected server error message..connection does not exist occurs after socket error
-               if (e.getErrorCode()==-29154 || e.getErrorCode()==-29002)
-               {
-                  sessObj.setSessionStatus(false);
-               }
-               // if QSMGR is stopped. 
-               //  if (e.getErrorCode()==WMS_PROCESS_DOES_NOT_EXIST)
-               if (e.getMessage().matches("Unexpected.*(error message = error=201,.*)"))
-               {
-                  if (sessObj.qsOpen)
-                  {
-                     try
-                     {
-                        sessObj.getStmtObj().execute(SessionDefaults.WMSCLOSE);
-                     } catch (SQLException sqle)
-                     {
-                        System.out.println("Should not come here...");
-                     }
-                     sessObj.qsOpen = false;
-                  }
-               }
-               if (caller == PRUNI)
-               {
-                  this.sqlErrorCount++;
-               }
-               qryObj.setTrimOut(false);
-
-
-               sessObj.setTotalRecordCount("-1");
-               
-               writer.writeAllSQLExceptions(sessObj,e);
-              
-              
-               if (sessObj.getMode() != SessionDefaults.WMS_MODE)
-                  sessObj.setLastError(Math.abs(e.getErrorCode()));
-               else
-                  sessObj.setLastError(e.getErrorCode());
-               
-               sessObj.setQryEndTime();
-            } catch (IOException ioe)
-            {
-               System.out.println("IO Exception while processing "+sessObj.getStrMode()+" command: "+ioe);
-               sessObj.setQryEndTime();
-               continue;
-
-            }
-
-            continue;
-
-
-
-         } catch (IOException e)
-         {
-            throw e;
-         }
-      }
-
-      return sessObj.getExitCode();
-   }
-
-   // get the connection to the database
-   public Connection getConnection() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException
-   {
-
-      Driver driver=null;
-      Connection conn=null;
-      Properties connProp=new Properties();
-     
-      String connectStr="jdbc:t4jdbc://"+sessObj.getSessionServer()+sessObj.getSessionPort();
-
-      driver = (Driver)Class.forName(SessionDefaults.DRIVER_NAME).newInstance();
-
-      driver.getMajorVersion();
-      driver.getMinorVersion();
-
-      connProp.put("user",sessObj.getSessionUser());
-      connProp.put("password",sessObj.getSessionPass());
-
-      /*
-       *  Only set the connection timeout if its not the default.
-       */
-      int connTimeout = Session.getConnectionTimeout();
-      if (Session.DEFAULT_CONNECTION_TIMEOUT != connTimeout)
-         connProp.put("connectionTimeout", String.valueOf(connTimeout) );
-
-      //connProp.put("serverDataSource",sessObj.getSessionDsn());
-      //connProp.put("catalog",sessObj.getSessionCtlg());
-      //connProp.put("schema", sessObj.getSessionSchema());
-      String theRole = sessObj.getTempSessionRole();
- 
-      if ((null == theRole)  ||  (0 <= theRole.length() ) )
-    	  theRole = sessObj.getSessionRole();
-      
-      connProp.put("roleName", theRole);
-      connProp.put("applicationName", SessionDefaults.APP_NAME);
-      
-      if (sessObj.isDebugOn())
-      {
-    	  System.out.println("getConnection::" +
-    			  " HOST:" + sessObj.getSessionServer() +
-    			  "::PORT:" + sessObj.getSessionPort() + 
-    			  "::USR:" + sessObj.getSessionUser() +
-     			  "::ROLE:"+ theRole + 
-    			  "::DSN:" + defaultDataSource);
-    	  System.out.println("Driver version:: "+ sessObj.getT4verNum());
-      }
-      
-      conn = DriverManager.getConnection(connectStr,connProp);
-        
-      SQLWarning dsw=conn.getWarnings();
-      sessObj.setDBConnExists(true);
-
-      /*while ((dsw!=null))
-      {
-	      if (dsw.getErrorCode()==UNKNOWN_DATA_SOURCE)
-	      {
-	         defaultDataSource=(dsw.toString().lastIndexOf(": ")!= -1 ?dsw.toString().substring(dsw.toString().lastIndexOf(": ")+1).trim():defaultDataSource);
-	
-	         if (this.caller != PRUNI)
-	         {
-	            //System.out.println(SessionDefaults.lineSeperator+"WARNING: Data Source, "+sessObj.getSessionDsn()+", does not exist.");
-	         }
-	
-	         sessObj.setSessionDsn(defaultDataSource);
-	
-	      } else
-	      {
-	   		 System.out.println(SessionDefaults.lineSeperator + dsw.getMessage());
-	      }
-	      dsw=dsw.getNextWarning();
-	  } */
-      setDbProdVersion(conn);
-      setISOMapping(conn);
-      
-      specialModeEnabled = ((TrafT4Connection)conn).getDateConversion();
-      String schName = ((TrafT4Connection)conn).getSchema();
-      if (schName != null)
-    	  sessObj.setSessionSchema(schName);
-      
-      if (sessObj.isDebugOn())
-    	  System.out.println("schName:" + schName);
-      
-      // clear off any warnings generated
-      conn.clearWarnings();
-
-	  try {
-		  remoteProcess=((TrafT4Connection)conn).getRemoteProcess();
-	  	  sessObj.setNeoProcessName(remoteProcess);
-	  	  if (sessObj.isDebugOn())
-	  	  {
-	  		  System.out.println("Connected to process: " + remoteProcess);
-	  	  }
-	  } catch (Exception e) {}
-      return conn;
-   }
-
-   //  get the connection to the database
-   public Connection getConnection(String user, String password, String role, String server, String dataSource, String port) 
-      throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException
-   {
-
-      Driver driver=null;
-      Connection conn=null;
-      Properties connProp=new Properties();
-      
-
-      String connectStr="jdbc:t4jdbc://"+(server==null?sessObj.getSessionServer():server)+(port==null?sessObj.getSessionPort():port);
-
-      driver = (Driver)Class.forName(SessionDefaults.DRIVER_NAME).newInstance();
-
-      if (sessObj.isDebugOn())
-      {
-    	  System.out.println("getConnection with args::" + " HOST:" + server +
-    			"::PORT:" + port + "::USR:" + user +
-    			"::ROLE:"+ role + "::DSN:" + dataSource); 
-      }
-      
-      driver.getMajorVersion();
-      driver.getMinorVersion();
-
-      connProp.put("user", (user==null?sessObj.getSessionUser():user) );
-      connProp.put("password",(password==null?sessObj.getSessionPass():password));
-      connProp.put("roleName", (null==role?"":role));
-
-      /*
-       *  Only set the connection timeout if its not the default.
-       */
-      int connTimeout = Session.getConnectionTimeout();
-      if (Session.DEFAULT_CONNECTION_TIMEOUT != connTimeout)
-         connProp.put("connectionTimeout", String.valueOf(connTimeout) );
-
-      //connProp.put("serverDataSource",dataSource==null?sessObj.getSessionDsn():dataSource);
-      //connProp.put("catalog",sessObj.getSessionCtlg());
-      //connProp.put("schema", sessObj.getSessionSchema());
-      connProp.put("applicationName", "TrafCI");
-      conn = DriverManager.getConnection(connectStr,connProp);
-      
-      SQLWarning dsw=conn.getWarnings();
-      sessObj.setDBConnExists(true);
-      boolean wasSessionDsnSet=false;
-      
-      /*while ((dsw!=null))
-      {      
-     	  if (dsw.getErrorCode()==UNKNOWN_DATA_SOURCE)
-    	  {
-    		  defaultDataSource=(dsw.toString().lastIndexOf(": ")!= -1 ?dsw.toString().substring(dsw.toString().lastIndexOf(": ")+1).trim():defaultDataSource);
-
-    		  if (this.caller != PRUNI)
-    		  {
-    			  //System.out.println(SessionDefaults.lineSeperator+"WARNING: Data Source, "+ dataSource +", does not exist.");
-    		  }
-    		  sessObj.setSessionDsn(defaultDataSource); 
-    		  wasSessionDsnSet=true;
-    	  } else 
-    	  {
-    		  System.out.println(SessionDefaults.lineSeperator + dsw.getMessage());
-    	  }
-       	  dsw=dsw.getNextWarning();
-      } */
-      
-	  if (!wasSessionDsnSet) {
-		  wasSessionDsnSet=true;
-		  sessObj.setSessionDsn(dataSource);
-	  }
-      // clear off any warnings generated
-      conn.clearWarnings();
-
-      try
-      {
-         lfPropsObj.loadLookAndFeelProps(sessObj,specialModeEnabled);
-         sessObj.setLFProps(lfPropsObj);
-         
-       } catch (FileNotFoundException fnfe)
-      {
-      }
-      catch (IOException ioe)
-      {
-      }
-      catch (Exception e)
-      {
-      }
-      try {
-    	  remoteProcess=((TrafT4Connection)conn).getRemoteProcess();
-    	  sessObj.setNeoProcessName(remoteProcess);
-    	  if (sessObj.isDebugOn())
-    	  {
-    		  System.out.println("Connected to process: " + remoteProcess);
-    	  }     
-      } catch (Exception e) {}
-      
-      setDbProdVersion(conn);
-      setISOMapping(conn);
-      specialModeEnabled = ((TrafT4Connection)conn).getDateConversion();
-	  String schName = ((TrafT4Connection)conn).getSchema();
- 
-	  if (sessObj.isDebugOn())
-    	  System.out.println("schName:" + schName);
-
-      if (schName != null)
-    	  sessObj.setSessionSchema(schName);
-      return conn;
-
-   }
-   
-   public void setISOMapping(Connection conn) throws SQLException
-   {
-      
-      try{
-          sessObj.setISOMapping(((TrafT4Connection)conn).getISOMapping());
-      }catch(NoSuchMethodError nsme){
-         ;
-      }
-      String multibyteAlign = System.getProperty("trafci.charset.align");
-      if (multibyteAlign != null && multibyteAlign.equalsIgnoreCase("N"))
-         sessObj.setMultiByteAlign(false);
-      
-
-   }
-   
-   public void getDriverVersion() throws IOException
-   {
-      float verNum = 2.2F;
-      if (sessObj.getConnObj() != null)
-      {
-         try
-         {
-            if (parser == null)
-               parser = new Parser();
-            if (utilObj == null) 
-               utilObj = new Utils();
-            String versionStr = parser.gett4Version(sessObj.getConnObj().getMetaData().getDriverVersion());
-            verNum = Float.parseFloat(versionStr);
-         }
-         catch (Exception e) {}
-         finally {
-            sessObj.setT4verNum(verNum);
-            try {
-               if (sessObj.getPlatformObjectVersions())
-               {
-            	   sessObj.setMxosrvrVersion(sessObj.getNdcsVersion());
-               }
-            } catch( Exception e) {}
-         }
-      }
-   }
-
-   public void setDbProdVersion(Connection conn) throws SQLException
-   {
-      String prodVer = conn.getMetaData().getDatabaseProductVersion();
-      if (prodVer != null)
-         sessObj.setDatabaseProdVersion(Float.parseFloat(prodVer));
-   }
-   
-   private String formatString(String output,int colWidth,char fillchar)
-   {
-      StringBuffer outBuffer=null;
-
-      if (output == null)
-      {
-         return null;
-      }
-
-      outBuffer=new StringBuffer(output);
-
-
-      if (outBuffer.length() <= colWidth)
-      {
-         for (int i=outBuffer.length();i<colWidth;i++)
-            outBuffer.append(fillchar);
-
-      }
-
-      return outBuffer.toString();
-
-   }
-
-
-   public ConsoleReader getConsoleReader()
-   {
-      return crObj;
-   }
-
-
-   public void setConsoleReader(ConsoleReader crObj)
-   {
-      this.crObj = crObj;
-   }
-
-
-   public ConsoleWriter getConsoleWriter()
-   {
-      return cwObj;
-   }
-
-
-   public void setConsoleWriter(ConsoleWriter cwObj)
-   {
-      this.cwObj = cwObj;
-   }
-
-   public String getScriptFile()
-   {
-      return scriptFile;
-   }
-
-   public void setScriptFile(String scriptFile)
-   {
-      this.scriptFile = scriptFile;
-   }
-
-   public String getLogFile()
-   {
-      return logFileName;
-   }
-
-   public void setLogFile(String logFileName,boolean overWriteLog)
-   {
-      this.logFileName = logFileName;
-      this.overWriteLog=overWriteLog;
-
-   }
-
-   public int getSqlErrorCount()
-   {
-      return sqlErrorCount;
-   }
-
-   public void setSqlErrorCount(int sqlErrorCount)
-   {
-      this.sqlErrorCount = sqlErrorCount;
-   }
-
-   public int getSqlQueryCount()
-   {
-      return sqlQueryCount;
-   }
-
-   public void setSqlQueryCount(int sqlQueryCount)
-   {
-      this.sqlQueryCount = sqlQueryCount;
-   }
-
-   public boolean isQueryMode()
-   {
-      return queryMode;
-   }
-
-   public void setQueryOptions(boolean queryMode, String qryString)
-   {
-      this.queryMode = queryMode;
-      this.qryString=qryString;
-   }
-
-   public int getSqlWarningsCount()
-   {
-      return sqlWarningsCount;
-   }
-
-
-   public void setSqlWarningsCount(int sqlWarningsCount)
-   {
-      this.sqlWarningsCount = sqlWarningsCount;
-   }
-  
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/SessionTimeoutTask.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/SessionTimeoutTask.java b/core/conn/trafci/src/org/trafodion/ci/SessionTimeoutTask.java
deleted file mode 100644
index 430e205..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/SessionTimeoutTask.java
+++ /dev/null
@@ -1,93 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.sql.Connection;
-import java.util.TimerTask;
-
-public class SessionTimeoutTask extends TimerTask
-{
-   Connection conn=null;
-   int idleTime=0;
-   long lastQueryExecTime=0;
-   boolean checkRequired=true;
-
-   /*
-    *  Variable to hold the session we are associated with.
-    */
-   private Session _sessionObj = null;
-
-
-   SessionTimeoutTask(Connection conn)
-   {
-      this.conn=conn;
-   }
-
-
-
-
-   /*
-    *  Sets the session this timeout task is associated with.
-    *
-    *  @param sessObj  the session this timeout task is associated with.
-    */
-   public void setSessionObj(Session sessObj) {
-       this._sessionObj = sessObj;
-
-   }  /*  End of  setSessionObj  method.  */
-
-
-
-   public void run()
-   {
-
-      if (checkRequired)           // check if this task has to run
-      {
-         /*
-          *  Reset the connection idle timer (if we can!!).
-          */
-         if (null != this._sessionObj)
-            this._sessionObj.resetConnectionIdleTimer();
-
-
-         if (idleTime != 0)       // check only if the idletime is not set to 0
-         {
-            if (((System.currentTimeMillis() - this.lastQueryExecTime)/(1000*60)) > idleTime)
-            {
-               try
-               {
-                  conn.close();
-               }catch (Exception e)
-               {
-                  // dont care..
-               }
-               System.out.println();
-               System.out.println("Session Expired.");
-               System.exit(SessionDefaults.abruptExit);
-            }
-         }
-      }
-
-
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/SqlEnum.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/SqlEnum.java b/core/conn/trafci/src/org/trafodion/ci/SqlEnum.java
deleted file mode 100644
index 1fdca3e..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/SqlEnum.java
+++ /dev/null
@@ -1,83 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-
-public enum SqlEnum {
-	
-	ROLE,
-	SCHEMA,
-	SERVER,
-	USER,
-	
-	SCHEDULE,
-	ERROR,
-	ALLOW,
-	DENY,
-	AUDIT,
-	ONLINEDUMP,
-	
-	MV,
-	MVS,
-	MATERIALIZED_NAME ("MATERIALIZED VIEW NAME"),
-	
-	INDEX,
-	INDEXES,
-	INDEX_NAME ("INDEX NAME"),
-	
-	SYNONYM,
-	SYNONYMS,
-	SYNONYM_NAME ("SYNONYM NAME"),
-	
-	TRIGGER,
-	TRIGGERS,
-	TRIGGER_NAME ("TRIGGER NAME"),
-
-	TABLE,
-	TABLE_NAME,
-	TABLE_TYPE,
-	
-	VIEW,
-	VIEWS,
-	
-	ON,
-	DESCRIBE__COL
-	;
-	
-	private String label;
-	SqlEnum() {
-		this.label = "";
-	}
-	SqlEnum(String label) {
-		this.label = label;
-	}
-	/**
-	 * @return label of the SqlEnum
-	 */
-	public String getLabel() {
-		return this.label;
-	}
-	
-	public static String getFullQualifiedName(
-			final String cat, final String schema, final String table) {
-		return cat + "." + schema + "." + table;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/StatusThread.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/StatusThread.java b/core/conn/trafci/src/org/trafodion/ci/StatusThread.java
deleted file mode 100644
index d1ca00a..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/StatusThread.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-public class StatusThread extends Thread
-{
-
-   boolean stop=false;
-   String beforeStatus=" In Progress";
-   String afterStatus=" Complete";
-   ConsoleWriter cwObj=null;
-
-
-   /*
-    *  Variable to hold the session for resetting the connection idle timer.
-    */
-   Session _sessionObj = null;
-
-
-   StatusThread()
-   {
-   }
-
-
-   /*
-    *  Save the sessionObject as well to reset the connection idle timer.
-    */
-   StatusThread(ConsoleWriter cwObj, Session sessObj)
-   {
-      this.cwObj=cwObj;
-      this._sessionObj = sessObj;
-   }
-
-   public void run()
-   {
-      /*
-       *  Counter to hold the number of seconds that have elapsed since our
-       *  last I_AM_ALIVE message w/ the NDCS server.
-       */
-      int elapsedSeconds = 0;
-
-
-      cwObj.println();
-      while (!stop)
-      {
-         cwObj.print("\rStatus :"+beforeStatus);
-         for (int j=0;j<10;j++)
-         {
-            if (!stop)
-            {
-               try
-               {
-                  sleep(100);
-               }
-               catch (Exception e)
-               {
-               }
-               System.out.print(".");
-            }
-
-         }
-         cwObj.print("\rStatus:"+beforeStatus+"                       ");
-
-
-         /*
-          *  Reset the Connection idle timer if 60 seconds have elapsed.
-          */
-         elapsedSeconds++;
-         if (60 < elapsedSeconds) {
-            this._sessionObj.resetConnectionIdleTimer();
-            elapsedSeconds = 0;
-         }
-
-
-      }
-      cwObj.println("\rStatus:"+afterStatus+"                     ");
-
-   }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/TerminalProcessBridge.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/TerminalProcessBridge.java b/core/conn/trafci/src/org/trafodion/ci/TerminalProcessBridge.java
deleted file mode 100644
index 71bc05f..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/TerminalProcessBridge.java
+++ /dev/null
@@ -1,246 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.*;
-
-
-/**
- *   Virtual Terminal proxy (a process to a terminal bridge) -- reads from one end and writes to
- *   the other. Can't handle terminal sequences as yet. A "terminal" process bridge!! :^)
- */
-class  TerminalProcessBridge  extends  Thread
-{
-
-   /**
-   *   Static constants/defines -- DOOMDAY and time to yield the scheduler in milliseconds.
-   */
-   public  static  final  boolean  DOOMSDAY                  = true;
-   public  static  final  int      DEFAULT_CPU_YIELD_TIME_MS = 300;   // default/first yield processor every 300 milliseconds.
-   public  static  final  int      ONREAD_CPU_YIELD_TIME_MS  = 20;   // on read yield processor every 20 milliseconds.
-
-
-   /**
-   *   Static variable/knob to show/hide debugging details.
-   */
-   public  static  boolean  _debugOn = Boolean.getBoolean("trafci" + "." + "_lhdebug");
-
-
-   /**
-   *   Instance variables -- input and output streams + whether or not we should read 
-   *   waited and whether or not we should keep reading.
-   */
-   InputStream   _is        = null;
-   OutputStream  _os        = null;
-   String        _tag       = "";
-   boolean       _waitedOps = true;
-   boolean       _readOn    = true;
-   Writer        _writer     = null;
-
-
-
-
-   /**
-   *   TerminalProcessBridge Constructor. Serves as in output bridge between the 2 buddies.
-   *
-   *   @param  is  - Input stream to read from.
-   *   @param  os  - Output stream to write to.
-   */
-   protected  TerminalProcessBridge(InputStream is, OutputStream os)
-   {
-      this(is, os, true);
-   }
-
-
-   protected  TerminalProcessBridge(InputStream is, Writer writer)
-   {
-      this(is, writer, true);
-   }
-   
-   /**
-   *   TerminalProcessBridge Constructor. Serves as an output bridge between 'em.
-   *
-   *   @param  is      - Input stream to read from.
-   *   @param  os      - Output stream to write to.
-   *   @param  waited  - Do waited reads on the input stream.
-   */
-   protected  TerminalProcessBridge(InputStream is, OutputStream os, boolean waited)
-   {
-      this._is        = is;
-      this._os        = os;
-      this._waitedOps = waited;
-   }
-
-   protected  TerminalProcessBridge(InputStream is, Writer writer, boolean waited)
-   {
-      this._is        = is;
-      this._writer    = writer;
-      this._waitedOps = waited;
-   }
-
-
-   /**
-   *   Control method to indicate process went away and we don't need to read any more.
-   *   Job's all done -- let just bow out gracefully.
-   *
-   */
-   protected  void  stopReading()
-   {
-      synchronized(this)
-      {
-         this._readOn = false;
-      }
-   }
-
-
-
-   /**
-   *   Control method to set a tag for debugging purposes.
-   *   @param  tag  - Tag Name.
-   *
-   */
-   protected  void  setTag(String  tag)
-   {
-      this._tag = tag;
-
-   }
-
-
-
-   /**
-   *   Thread entry point (main method). Does all the work. Reads from console/obey file
-   *   as input is available and pipes it to the process' input stream.
-   *
-   *   @overrides  Thread.run
-   */
-   public void run()
-   {
-      try
-      {
-         BufferedWriter      output=null;
-         if (this._os != null) {
-            OutputStreamWriter  sendTo   = new OutputStreamWriter(this._os);
-                                output   = new BufferedWriter(sendTo);
-         }
-
-         int  yieldTime = DEFAULT_CPU_YIELD_TIME_MS;
-
-         /* put a new line at top of first output */
-         boolean firstLine = true;
-
-         /** 
-         *  Keep doing this until we know the process completed and we don't need to
-         *  read anymore.
-         */
-         while (DOOMSDAY)
-         {
-            synchronized(this)
-            {
-               if (!this._readOn)
-                  break;
-
-            }
-
-            if (this._waitedOps ||  (0 < this._is.available()))
-            {
-               String  line        = null;
-               int     numReadable = this._is.available();
-               byte[]  bytes       = new byte[1];
-
-               if (_debugOn)
-                  System.out.println("** Debug*** ==>  available : " + numReadable);
-
-               if (0 < numReadable)
-                  bytes = new byte[numReadable];
-
-
-               int  kitchenSink = this._is.read(bytes, 0, bytes.length);
-               if (-1 == kitchenSink)
-                  break;
-
-               if (_debugOn)
-                  System.out.println("** Debug*** ==>  read terminated with '" + kitchenSink +
-                     "' bytes [length asked for was " + bytes.length + "]. ");
-
-
-               line = new String(bytes);
-               
-               if(firstLine)
-               {
-                   line = "\n"+line;
-                   firstLine = false;
-               }
-               
-               if (_debugOn)
-                  line = this._tag + line;
-
-               if (_writer == null)
-               {
-                  output.write(line, 0, line.length() );
-                  output.flush();
-               }
-               else
-               {
-                  _writer.write(line);
-               }
-
-               yieldTime = ONREAD_CPU_YIELD_TIME_MS;
-
-            }
-            else
-            {
-               try
-               {
-//                  Thread.currentThread().sleep(yieldTime);
-            	   Thread.sleep(yieldTime);
-               } catch (Exception e)
-               {
-               }
-
-            }
-
-
-         }   /*  End of  while(DOOMSDAY)  loop.  */
-
-      } catch (Exception e)
-      {
-         if (TerminalProcessBridge._debugOn)
-         {
-            System.err.println("Internal error occurred.  Details : " + e.getMessage() );
-            e.printStackTrace();
-         }
-
-      }
-
-   }  /*  End of  run  method.  */
-
-
-}  /*  End of  inner class  TerminalProcessBridge.  */
-
-
-
-
-
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/UnKnownInterfaceCommand.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/UnKnownInterfaceCommand.java b/core/conn/trafci/src/org/trafodion/ci/UnKnownInterfaceCommand.java
deleted file mode 100644
index c9257c7..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/UnKnownInterfaceCommand.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class UnKnownInterfaceCommand extends Exception
-{
-
-   /**
-   * 
-   */
-   private static final long serialVersionUID = 1L;
-   UnKnownInterfaceCommand()
-   {
-      super();
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/UserInterface.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/UserInterface.java b/core/conn/trafci/src/org/trafodion/ci/UserInterface.java
deleted file mode 100644
index ac22141..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/UserInterface.java
+++ /dev/null
@@ -1,421 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-
-import org.trafodion.ci.pwdencrypt.RefLookup;
-
-
-public class UserInterface {
-
-	static String[] myArgs = null;
-
-	/**
-	 * Main program called when the user logins using the windows/*nux wrapper
-	 * scripts. Creates a console reader & console write for interactive
-	 * input/output from the user.
-	 */
-	public static void main(String[] args) {
-		// create the console reader and writer objects
-		// for interactive session
-		ConsoleReader crObj = null;
-		ConsoleWriter cwObj = null;
-		myArgs = args;
-		int exitCode = 0;
-		boolean doTrace = Boolean.getBoolean(SessionDefaults.PROP_TRACE);
-		String mySQRoot = System.getenv("MY_SQROOT");
-		
-
-
-		/* handle AWT exceptions */
-		try {
-			Class.forName("org.trafodion.ci.AWTExceptionHandler");
-			System.setProperty("sun.awt.exception.handler",
-					AWTExceptionHandler.class.getName());
-		} catch (Throwable t) {
-			if (doTrace)
-				t.printStackTrace();
-		}
-
-		cwObj = new ConsoleWriter();
-
-		try {
-			cwObj.initialize();
-		} catch (IOException e1) {
-			System.out.println(SessionError.CONSOLE_WRITER_ERR.errorMessage()
-					+ e1);
-			if (doTrace)
-				e1.printStackTrace();
-			System.exit(SessionDefaults.abruptExit);
-		}
-		crObj = new ConsoleReader();
-
-		try {
-			crObj.initialize();
-		} catch (IOException e1) {
-			System.out.println(SessionError.CONSOLE_READER_ERR.errorMessage()
-					+ e1);
-			if (doTrace)
-				e1.printStackTrace();
-			System.exit(SessionDefaults.abruptExit);
-		}
-
-		banner();
-        
-		// parse the arguments
-		ParseArguments paObj = new ParseArguments(crObj, cwObj);
-
-		// set default value to rolename
-		paObj.roleName = "";
-
-		paObj.setDefaults(SessionDefaults.dsnName, SessionDefaults.portNumber);
-
-		
-		if ( args.length %2 == 0 && mySQRoot != null && new File(mySQRoot).exists()) {
-			String uname=null, passwd = null, hostname = null, portNumber = null;
-			//EncryptUtil eu = new EncryptUtil();
-			Properties p = new Properties();
-			String matchedValue = null;
-			List<String> argsList= new ArrayList<String>(Arrays.asList(args));
-			int argLength=argsList.size();
-
-			for (int i=0;i < argLength; i++)
-		    {
-		         String option=args[i++].trim();
-		         String value=args[i].trim();
-		         
-		         if (option.equalsIgnoreCase("-u")|| option.equalsIgnoreCase("-user"))
-		         {
-		            uname=value;
-		         }
-		         else if (option.equalsIgnoreCase("-p")|| option.equalsIgnoreCase("-password"))
-		         {
-		            passwd=value;
-		         }
-		         else if (option.equalsIgnoreCase("-h")|| option.equalsIgnoreCase("-host"))
-		         {
-		            String[] hostAddr=value.split(":");
-		            if (hostAddr.length > 0)
-		            	hostname=hostAddr[0];
-		            
-		            String portValue="";
-
-		            for (int j=1; j < hostAddr.length;j++)
-		            {
-		               portValue+=":"+hostAddr[j];
-		            }
-		            if (portValue.length() > 0)
-		            {
-		               portNumber=portValue;
-		            }
-
-		         }
-		    }
-			
-			try 
-			{
-				
-				if (uname != null)
-				{
-					paObj.userName = uname;
-				}
-				else
-				{
-					paObj.userName = System.getProperty("user.name");
-				}
-				
-				if (passwd != null)
-				{
-					paObj.password = passwd;
-				}
-				else
-				{
-					String userHome =  System.getenv("USERHOME");//System.getProperty("user.dir");				
-					if (userHome != null)
-					{					
-						File f = new File(userHome + "/.trafciconf/encprops.txt");
-						if (f.exists())
-						{
-							try
-							{
-								p.load(new FileInputStream(f));
-								Enumeration<?> enumKeys = p.keys();
-								while (enumKeys.hasMoreElements())
-							      {
-									uname=enumKeys.nextElement().toString();
-									if (uname.equals(paObj.userName)){
-										matchedValue = p.getProperty(uname);
-										if (matchedValue != null)
-										{
-											passwd = RefLookup.resolve(uname+" = "+matchedValue);
-											break;
-										}
-									}
-							      }
-								
-								paObj.password = passwd;
-							}
-							catch(Exception e)
-							{
-								System.out.println("Error looking up user's password.");
-								if (doTrace)
-								{
-									System.out.println(e.getMessage());
-								}
-							}
-						}
-					}
-				}
-				
-				if (hostname != null)
-				{
-					paObj.serverName = hostname;
-				}
-				else
-				{
-					String serverName =  System.getenv("TRAFCI_SERVERNAME");										
-					if (serverName == null)
-					{					
-						//System.out.println("Can't obtain hostname, please enter hostname:port");
-						//System.exit(SessionDefaults.abruptExit);
-					}
-					else		
-						paObj.serverName = serverName;
-				}
-				
-				if (portNumber != null)
-				{
-					paObj.portNumber = portNumber;
-				}
-				else
-				{
-					String portName = System.getenv("TRAFCI_PORT");					
-					if (portName == null)
-					{					
-						//System.out.println("Can't obtain port number, please enter hostname:port");
-						//System.exit(SessionDefaults.abruptExit);
-					}		
-					paObj.portNumber = portName;
-				}
-					
-				if (paObj.serverName != null && paObj.portNumber != null)
-					System.out.println("Host Name/IP Address: "+paObj.serverName+paObj.portNumber);
-				if (paObj.userName != null)
-					System.out.println("User Name: "+paObj.userName);
-				
-         	} catch (Exception e)
-			{
-				e.printStackTrace();
-			}
-         	
-		}
-		
-		while (paObj.retryCnt > 0) {
-
-			try {
-				// validate the user credentials
-				myArgs = paObj.validateArgs(myArgs, true);
-			} catch (UserInterruption ui) {
-				System.exit(SessionDefaults.abruptExit);
-			} catch (InvalidNumberOfArguments e) {
-				System.out.println(e);
-				if (doTrace)
-					e.printStackTrace();
-				System.exit(SessionDefaults.abruptExit);
-			} catch (UnknownHostException e) {
-				if (doTrace)
-					e.printStackTrace();
-				System.exit(SessionDefaults.abruptExit);
-			} catch (IOException e) {
-				System.out.println(e);
-				if (doTrace)
-					e.printStackTrace();
-				System.exit(SessionDefaults.abruptExit);
-			}
-
-			// create a new session
-			// pass the required credentials details and caller id
-			// for this user interface the caller id will be USERI
-			// A session object is returned by SessionInterface
-			// with the required DB connection, writer and reader objects
-			SessionInterface siObj = new SessionInterface(crObj, cwObj);
-			Session sessObj = null;
-			try {
-				// set the script file if -script option is specified
-				siObj.setScriptFile(paObj.fileName);
-				sessObj = siObj.createSession(paObj.userName,
-						paObj.roleName, paObj.password, paObj.serverName,
-						paObj.portNumber, paObj.dsnName, SessionDefaults.USERI,
-						paObj.noConnectOption);
-
-				// DFM MXCI Migration Settings
-				if (paObj.dfm) {
-					sessObj.setSessView(SessionDefaults.MXCI_VIEW);
-					sessObj.setSessionPrompt(">>");
-					sessObj.setCmdEcho(true);
-				}
-
-				// All credentials are valid, do not prompt for login params
-				// again.
-				paObj.retryCnt = 0;
-
-				// set the mode to query mode if the -sql|-q is option is
-				// specified
-				// show the welcome banner only when the session is interactive
-				// mode ( non-query mode)
-				if (paObj.queryStr != null) {
-					siObj.setQueryOptions(true, paObj.queryStr);
-				} else {
-					System.out.println();
-					if (paObj.noConnectOption)
-						System.out.println("Not connected.");
-					else
-						System.out.println("Connected to " + sessObj.getDatabaseEdition());
-
-				}
-
-				// call the session
-				exitCode = siObj.invokeSession(sessObj);
-				siObj = null;
-			} catch (FileNotFoundException e) {
-				// thrown when the script file specified in the command line is
-				// not found
-				System.out.println();
-				System.out.println(SessionError.SCRIPT_FILE_NOT_FOUND);
-				if (doTrace)
-					e.printStackTrace();
-				System.exit(SessionDefaults.abruptExit);
-			} catch (SQLException sqle) {
-				if (doTrace) {
-					System.out.println("Caught a SQL exception. Error code = "
-							+ sqle.getErrorCode() + ", msg="
-							+ sqle.getMessage());
-					sqle.printStackTrace();
-				}
-
-				System.out.println();
-
-				// catch the known errors report them with an user friendly text
-				if (sqle.getErrorCode() == SessionDefaults.SQL_ERR_CONN_MAX_LIMIT) {
-					System.out.println(SessionError.CONN_MAX_LIMIT_ERR);
-					if (doTrace)
-						sqle.printStackTrace();
-					System.exit(SessionDefaults.abruptExit);
-				} else {
-					int errCode = sqle.getErrorCode();
-					String errStr = sqle.toString();
-
-					if (errStr.indexOf("org.trafodion.jdbc") != -1)
-						errStr = errStr.substring(errStr.indexOf(":") + 1)
-								.trim();
-
-					if (errStr.startsWith("***"))
-						System.out.println(errStr
-								+ SessionDefaults.lineSeperator);
-					else
-						System.out.println(SessionError.ERROR_CODE_PREFIX
-								+ Math.abs(errCode)
-								+ SessionError.ERROR_CODE_SUFFIX + " " + errStr
-								+ SessionDefaults.lineSeperator);
-
-					// identify those args that caused the exception
-					if (SessionDefaults.SQL_ERR_INVALID_AUTH == errCode
-							|| SessionDefaults.SQL_ERR_CLI_AUTH == errCode) {
-						paObj.userName = null;
-						paObj.password = null;
-						paObj.roleName = null;
-					} else if (SessionDefaults.NDCS_ERR_DSN_NOT_AVAILABLE == errCode) {
-						paObj.dsnName = null;
-					} else {
-						paObj.serverName = null;
-					}
-
-					// rebuild args list and remove only those that caused the
-					// exception
-					myArgs = paObj.rebuildArgList(myArgs);
-
-					if (--paObj.retryCnt == 0) {
-						if (doTrace)
-							sqle.printStackTrace();
-						System.exit(SessionDefaults.abruptExit);
-					}
-				}
-
-			} // end SQLException
-			catch (InstantiationException e) {
-				System.out.println(SessionError.DRIVER_INIT_ERR);
-				if (doTrace)
-					e.printStackTrace();
-				System.exit(SessionDefaults.abruptExit);
-			} catch (IllegalAccessException e) {
-				System.out.println(SessionError.DRIVER_INIT_ILLEGAL_ERR);
-				if (doTrace)
-					e.printStackTrace();
-				System.exit(SessionDefaults.abruptExit);
-			} catch (ClassNotFoundException e) {
-				System.out.println(SessionError.DRIVER_CLASS_ERR);
-				if (doTrace)
-					e.printStackTrace();
-				System.exit(SessionDefaults.abruptExit);
-			} catch (IOException e) {
-				System.out.println(e);
-				if (doTrace)
-					e.printStackTrace();
-				System.exit(SessionDefaults.abruptExit);
-			} catch (Exception e) {
-				System.out.println(e);
-				//if (doTrace)
-					e.printStackTrace();
-			} finally {
-				if (sessObj != null && sessObj.getConnObj() != null) {
-					try {
-						sessObj.getConnObj().close();
-					} catch (SQLException e) {
-					}
-				}
-			}
-
-			siObj = null;
-		} // end while
-
-		System.exit(exitCode);
-
-	}
-
-	private static void banner() {
-		System.out.println("\nWelcome to " + SessionDefaults.PROD_NAME);
-		String copyright_str = "Copyright (c) "+System.getenv("PRODUCT_COPYRIGHT_HEADER");
-		System.out.println(copyright_str);
-		System.out.println();
-	}
-}



[16/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ParseArguments.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ParseArguments.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ParseArguments.java
new file mode 100644
index 0000000..57944a0
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ParseArguments.java
@@ -0,0 +1,660 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+public class ParseArguments
+{
+
+   String[] args=null;
+   int noOfArgs=0;
+   String userName=null;
+   String roleName=null;
+   String password=null;
+   String serverName=null;
+   String portNumber=null;
+   String dsnName=null;
+   String queryStr=null;
+   String fileName=null;
+   String defaultDsnName=null;
+   String defaultPortNumber=null;
+   boolean noConnectOption=false;  // set to true if noconnection option is specified.
+   boolean isLaunchConnect=true;
+   boolean autoLogin=false;
+   boolean dfm=false; 
+   /*-------------------------------------------------------------------------------**
+   The isLaunchConnect flag is set to true when connection args are validated at
+   the application launch time to validate the type of args the can be entered 
+   for example -s and -sql can be entered only at launch.
+   **-------------------------------------------------------------------------------*/
+   ConsoleReader crObj=null;
+   ConsoleWriter cwObj=null;
+   static int retryCntProp=0;
+   int retryCnt=1;
+   String osName=null;
+   final String  EXIT_PROD_STR = "Exiting " + SessionDefaults.PROD_NAME + " - Please hit <Enter> ... ";
+   static
+   {
+      String loginRetries=null;
+
+      //Prompt for n login retries if property set
+      loginRetries=System.getProperty ("trafci.loginRetries");
+      if (loginRetries!=null) 
+         if ((retryCntProp = Integer.parseInt(loginRetries.trim())) <= 0)
+            retryCntProp = 1;
+   }
+
+   ParseArguments()
+   {
+
+   }
+
+   ParseArguments(ConsoleReader crObj,ConsoleWriter cwObj)
+   {
+      this.crObj=crObj;
+      this.cwObj=cwObj;
+
+      //Prompt for login input retries if in console/interactive mode
+      if (crObj.isInteractive()) 
+         this.retryCnt=3;
+
+      /*-------------------------------------------------------------------------**
+      //Prompt for n login retries if property set
+      String loginRetries=System.getProperty ("trafci.loginRetries");
+      if (loginRetries!=null) 
+      if ((this.retryCnt = Integer.parseInt(loginRetries.trim())) <= 0)
+      this.retryCnt = 1;
+      **-------------------------------------------------------------------------*/
+      if (retryCntProp > 0)
+         retryCnt = retryCntProp;
+
+   }
+
+   private void setArgs(String[] args)
+   {
+      noOfArgs=args.length;
+      this.args=args;
+   }
+
+   public void setDefaults(String dsnName,String portNumber)
+   {
+      this.defaultDsnName=dsnName;
+      this.defaultPortNumber=portNumber;
+   }
+
+   public String[] validateArgs(String[] args,boolean isLaunchConnect) 
+      throws InvalidNumberOfArguments, IOException, UserInterruption
+   {
+
+      osName = System.getProperty("os.name");
+      setArgs(args);
+      this.isLaunchConnect=isLaunchConnect;
+
+      List<String> argsList= new ArrayList<String>(Arrays.asList(args));
+      
+      //Pre-parse args for special cases
+      if (argsList.contains("-version"))
+      {
+         cwObj.print("JDBC Type 4 Driver Build ID : ");
+         cwObj.println(JDBCVproc.getVproc());
+         cwObj.print("Command Interface Build ID  : ");
+         org.trafodion.ci.Vproc.main(args) ;
+         cwObj.println("");
+         System.exit(0);   //any other args included w/version are ignored
+      }
+
+      //Display argument help if -help argument is passed
+      if (argsList.contains("-help"))
+      {
+    	   printUsage();
+         System.exit(0);   //any other args included w/help are ignored
+      }
+
+      
+      // No retries if in query mode
+      if (argsList.contains("-q") || argsList.contains("-sql"))
+         retryCnt = 1;
+
+      
+      if (argsList.remove("-noconnect"))
+      {
+          noConnectOption=true;
+      }
+
+      if (argsList.remove("-dfm"))
+      {
+          dfm = true;
+      }
+      
+      /* reset args b/c of -noconnect or -dfm, dont need the if but perhaps a small perf gain? */
+      if(dfm || noConnectOption)
+      {
+          args = null;
+          args = new String[argsList.size()];
+          //args = (String[])
+          argsList.toArray(args);
+          noOfArgs = args.length;
+      }
+
+      // the number of arguments must be an odd number if -noconnect option is specified
+      // otherwise it should be an even number
+
+      if (noOfArgs % 2 != 0 || noOfArgs > 14)
+      {
+         printUsage();
+         throw new InvalidNumberOfArguments();
+      }
+
+      
+      argsList=null;
+      
+      //Pre-parsing complete
+      
+      for (int i=0;i < noOfArgs; i++)
+      {
+         String option=args[i++].trim();
+         String value=args[i].trim();
+
+         if (option.equalsIgnoreCase("-u")|| option.equalsIgnoreCase("-user"))
+         {
+            userName=value;
+         }
+         else if (option.equalsIgnoreCase("-p")|| option.equalsIgnoreCase("-password"))
+         {
+            password=value;
+         }
+         else if (option.equalsIgnoreCase("-r")|| option.equalsIgnoreCase("-role"))
+         {
+        	 roleName=value;        	 
+         }              
+         else if (option.equalsIgnoreCase("-h")|| option.equalsIgnoreCase("-host"))
+         {
+            String[] hostAddr=value.split(":");
+            if (hostAddr.length > 0)
+               serverName=hostAddr[0];
+            else
+               serverName="";
+
+            String portValue="";
+
+            for (int j=1; j < hostAddr.length;j++)
+            {
+               portValue+=":"+hostAddr[j];
+            }
+            if (portValue.length() > 0)
+            {
+               portNumber=portValue;
+            }
+
+         }
+         else if (isLaunchConnect && (option.equalsIgnoreCase("-q")|| option.equalsIgnoreCase("-sql")))
+         {
+            queryStr=value;
+            if (fileName != null)
+            {
+               cwObj.println("-s|script and -q|sql options must not be specified together.");
+               this.printUsage();
+            }
+         }
+         else if (isLaunchConnect &&(option.equalsIgnoreCase("-s")|| option.equalsIgnoreCase("-script")))
+         {
+            fileName=value;
+            if (queryStr != null)
+            {
+               cwObj.println("-s|script and -q|sql options must not be specified together.");
+               this.printUsage();
+            }
+         }
+         /* Instead of -cmd we will implement a set cmdecho <on|off> command 
+          * and replace -cmd with -DFM which will execute both set lookandfeel mxci and
+          * set cmdecho on
+          * 
+          * else if (isLaunchConnect &&(option.equalsIgnoreCase("-cmd")))
+         {
+            if (value.equalsIgnoreCase("Y"))
+               cmdEcho = true;
+         }*/
+         else
+         {
+            cwObj.println("Unknown option " + option + " specified.");
+            printUsage();
+            throw new UnknownHostException();
+         }
+
+      } //end for
+      
+      if (!noConnectOption)
+      {
+         do
+         {
+
+            if (serverName == null)
+            {
+               String value= getRequiredArg("Host Name/IP Address: ");
+               String[] hostAddr=value.split(":");
+               if (hostAddr.length > 0)
+                  serverName=hostAddr[0];
+               else
+                  serverName="";
+               String portValue="";
+               for (int j=1; j < hostAddr.length;j++)
+               {
+                  portValue+=":"+hostAddr[j];
+               }
+               portNumber=null;
+               if (portValue.length() > 0)
+               {
+                  portNumber=portValue;
+               }
+            }
+
+
+            try
+            {
+               if (serverName.trim().equals(""))
+                  throw new UnknownHostException("Host Name is empty");
+               else
+                  InetAddress.getByName(serverName);
+            }
+            catch (UnknownHostException uh)
+            {
+               cwObj.println(SessionDefaults.lineSeperator+"Unknown Host: " + serverName + SessionDefaults.lineSeperator);
+               serverName=null;
+
+               //Rebuild the argument list to remove the hostname
+               args = this.rebuildArgList(args);
+               if ((--retryCnt) == 0)
+                  throw uh;
+            }
+
+         }while (serverName==null && retryCnt > 0);
+      }
+
+
+      if (!noConnectOption && userName == null)
+      {
+         do
+         {
+            userName=getRequiredArg("User Name: ");
+         }
+         while (userName.trim().equals(""));
+      }
+
+      if (!noConnectOption && password == null)
+      {
+         password=getPassword("Password: ");
+      }
+     
+      if (!noConnectOption && roleName == null) 
+      {    	 
+    		  roleName=getRequiredArg("Role Name [Primary Role]: "); 
+    		
+    		      	  
+      }
+      
+      if (portNumber == null)
+      {
+         portNumber=":"+defaultPortNumber;
+      }
+      
+      
+      return args;
+
+   }
+
+   public String[] validateArgs(String[] args) throws InvalidNumberOfArguments, IOException, UserInterruption
+   {
+      return (validateArgs(args,false));
+   }
+
+   private String getRequiredArg(String prompt) throws IOException, UserInterruption
+   {
+      String value=null;
+      String breakConnectPrompt = EXIT_PROD_STR;
+      if (!this.isLaunchConnect) 
+         breakConnectPrompt = "Command Interrupted - Please hit <Enter> ... "+SessionDefaults.lineSeperator;
+
+      crObj.setPrompt(breakConnectPrompt,false,false);
+      cwObj.print(prompt);
+
+      //set retry count to 0 if user hits a Ctrl+C while entering login parameters
+      try
+      {
+         value=crObj.getLine();
+      } catch (UserInterruption ui)
+      {
+         retryCnt = 0;
+         throw ui;
+      }
+      return value;
+   }
+
+   private void printUsage()
+   {
+	  String  os_specific_ci_cmd = "trafci";
+	  
+	  String spacedOutLine = SessionDefaults.lineSeperator;
+      for (int idx = 0; idx < os_specific_ci_cmd.length(); idx++)
+          spacedOutLine += " ";
+
+      cwObj.println(SessionDefaults.lineSeperator + os_specific_ci_cmd +
+              " -h[ost] <databaseserver:port> " +
+              spacedOutLine +
+              " -u[ser] <username> -p[assword] <password>" +
+              spacedOutLine +
+              " -r[ole] <rolename>" +
+              spacedOutLine +
+              " -s[cript] <scriptfilename> -q|-sql <\"querystring\">" +
+              spacedOutLine +
+              " -noconnect -version -help" );
+
+      cwObj.println(SessionDefaults.lineSeperator+"where:");
+      cwObj.println("\t-h[ost]     specifies the database server including the port number.");
+      cwObj.println("\t-u[ser]     specifies a user name to log into a database server.");
+      cwObj.println("\t-p[assword] specifies the user's password to log into a database server.");
+      cwObj.println("\t-r[ole]     specifies the role name associated with the user.");
+      cwObj.println("\t-s[cript]   specifies the command file used to customize a session.");
+      cwObj.println("\t-q|-sql     specifies the command to be run in non-interactive mode.");
+      cwObj.println("\t-noconnect  specifies the session login mode.");
+      cwObj.println("\t-version    displays the Trafodion Command Interface and JDBC Type 4 Driver versions, then exits.");
+      cwObj.println("\t-help       displays a list of accepted arguments with descriptions, then exits.");     
+      cwObj.println("");
+
+   }
+
+   /*------------------------------------------------------------------**
+   **    private String getPassword (String prompt) throws IOException { **
+   **          MaskingThread et = new MaskingThread(prompt);             **
+   **          Thread mask = new Thread(et);                             **
+   **          mask.start();                                             **
+   **                                                                  **
+   **         String password = "";                                      **
+   **                                                                  **
+   **          password = crObj.getLine();                               **
+   **          // stop masking                                           **
+   **          et.stopMasking();                                         **
+   **          // return the password entered by the user                **
+   **          return password;                                          **
+   **       }                                                            **
+   **------------------------------------------------------------------*/
+   
+   public String getPassword (String prompt) throws IOException, UserInterruption
+   {
+      String password = "";
+      WCIUtils wcs=null;
+      boolean isWindows = System.getProperty("os.name").toUpperCase().startsWith("WINDOW");
+
+      MaskingThread et = new MaskingThread(prompt);
+      Thread mask = new Thread(et);
+      mask.start();
+
+      // if it is windows envrionment use the dll to disable echo
+      if (isWindows)
+      {
+    	  try { 
+	         wcs=new WCIUtils();
+	         wcs.disableEcho();
+         
+    	  } catch(Throwable e) { }
+    	  
+      }
+      crObj.setMaskingThread(et,wcs);
+
+      String breakConnectPrompt = EXIT_PROD_STR;
+      if (!this.isLaunchConnect) 
+         breakConnectPrompt = "Command Interrupted - Please hit <Enter> ... "+SessionDefaults.lineSeperator;
+
+      crObj.setPrompt(breakConnectPrompt,false,false);
+
+
+      try
+      {
+         password = crObj.getLine();
+      }
+      catch (Throwable t)
+      {
+         UserInterruption  uie = null;
+         if (t instanceof UserInterruption)
+         {
+            uie =(UserInterruption) t;
+            retryCnt = 0;
+         }
+         else
+            uie = new UserInterruption();
+
+
+         throw uie;
+      }
+      finally
+      {
+
+         // stop masking
+         et.stopMasking();
+
+         if (isWindows)
+         {
+        	 try {
+	            wcs.enableEcho();
+	            
+        	 } catch(Exception e) { }
+        	 
+            wcs=null;
+         }
+         cwObj.print(SessionDefaults.lineSeperator);
+      }
+      // return the password entered by the user
+      return password;
+   }
+
+    public String getInputMask (String prompt, boolean isInputMask) throws IOException, UserInterruption
+   {
+      String password = "";
+      WCIUtils wcs=null;
+      boolean isWindows = System.getProperty("os.name").toUpperCase().startsWith("WINDOW");
+
+      MaskingThread et = new MaskingThread(prompt);
+      Thread mask = new Thread(et);
+      mask.start();
+
+      // if it is windows envrionment use the dll to disable echo
+      if (isWindows)
+      {
+    	  try {
+	         wcs=new WCIUtils();
+	         wcs.disableEcho();
+	         
+    	  } catch(Throwable e) { }
+      }
+      crObj.setMaskingThread(et,wcs);
+
+      String breakConnectPrompt = EXIT_PROD_STR;
+      if (!this.isLaunchConnect || isInputMask ) 
+         breakConnectPrompt = "Command Interrupted - Please hit <Enter> ... "+SessionDefaults.lineSeperator;
+
+      crObj.setPrompt(breakConnectPrompt,false,false);
+      
+      try
+      {
+         password = crObj.getLine();
+      }
+      catch (Throwable t)
+      {
+         UserInterruption  uie = null;
+         if (t instanceof UserInterruption)
+         {
+            uie =(UserInterruption) t;
+            retryCnt = 0;
+         }
+         else
+            uie = new UserInterruption();
+
+
+         throw uie;
+      }
+      finally
+      {
+
+         // stop masking
+         et.stopMasking();
+
+         if (isWindows)
+         {
+            try {
+            	wcs.enableEcho();
+            	
+            } catch(Exception e) { }
+            
+            wcs=null;
+         }
+         cwObj.print(SessionDefaults.lineSeperator);
+      }
+      // return the password entered by the user
+     
+      return password;
+   }
+
+
+   public String getInputNomask (String prompt, boolean isNotInputMask) throws IOException, UserInterruption
+   {
+      String userInput = "";
+
+      String breakConnectPrompt = EXIT_PROD_STR;
+      if (isNotInputMask) 
+         breakConnectPrompt = "Command Interrupted - Please hit <Enter> ... ";
+
+      crObj.setPrompt(breakConnectPrompt,false,false);
+     
+      try
+      {
+         System.out.print( "                                 \r" + prompt  );
+         userInput = crObj.getLine();
+      }
+      catch (Throwable t)
+      {
+         UserInterruption  uie = null;
+         if (t instanceof UserInterruption)
+         {
+            uie =(UserInterruption) t;
+            retryCnt = 0;
+         }
+         else
+            uie = new UserInterruption();
+
+
+         throw uie;
+      }
+      finally
+      {
+         cwObj.print(SessionDefaults.lineSeperator);
+      }
+      // return characters entered by the user
+      return userInput;
+   }
+
+
+   public String[] rebuildArgList(String[] oldArgs)
+   {
+      int i;
+      List<String> argsList= new ArrayList<String> (Arrays.asList (oldArgs));
+
+      if (argsList.isEmpty())
+         return oldArgs;
+
+      String argKey1 = null;
+      String argKey2 = null;
+      String argKey3 = null;
+      String argKey4 = null;
+      String argKey5 = null;
+      String argKey6 = null;
+
+      if (this.userName == null || this.password == null || this.roleName ==null)
+      {
+         argKey1 = "-u";
+         argKey2 = "-p";
+         argKey3 = "-user";
+         argKey4 = "-password";
+         argKey5 = "-r";
+         argKey6 = "-role";
+      }
+      else if (this.dsnName == null)
+      {
+          argKey1 = "-d";
+          argKey3 = "-dsn";
+      }
+      else if (this.serverName == null)
+      {
+         argKey1 = "-h";
+         argKey3 = "-host";
+      }
+      else
+         return oldArgs;
+
+      do
+      {
+         if (((i = argsList.indexOf(argKey1)) >= 0) || 
+        	 ((i = argsList.indexOf(argKey3)) >= 0) ||
+        	 ((i = argsList.indexOf(argKey5)) >= 0) )
+         {
+            argsList.remove(i);
+            argsList.remove(i);
+         }
+      }
+      while (i > -1);
+
+      do
+      {
+         if ((argKey2 != null) && (((i = argsList.indexOf(argKey2)) >= 0 ) || 
+        		                   ((i = argsList.indexOf(argKey4)) >= 0 )) ||
+        		                   ((i = argsList.indexOf(argKey6)) >= 0 ))
+         {
+            argsList.remove(i);
+            argsList.remove(i);
+         }
+      }
+      while (i > -1);
+
+      String[] newArgs=new String[argsList.size ()];
+      argsList.toArray (newArgs);
+      return newArgs;
+
+   }
+   
+   
+
+   public boolean isAutoLogin()
+   {
+      return autoLogin;
+   }
+
+   public void setAutoLogin(boolean autoLogin)
+   {
+      this.autoLogin = autoLogin;
+   }
+
+   
+   
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Parser.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Parser.java b/core/conn/trafci/src/main/java/org/trafodion/ci/Parser.java
new file mode 100644
index 0000000..a130032
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Parser.java
@@ -0,0 +1,1195 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Parser
+{
+   private String remainderStr=null;
+   Pattern filePat=Pattern.compile("^\\s*((\"(\"(?=\")|.)*\")|\\S*)(\\s+(.*)|$)");
+   Pattern numberPat=Pattern.compile("^\\s*((-)?\\d+)(\\s+(.*)|$)");
+   Pattern paramPat=Pattern.compile("^\\s*(\\??)([a-zA-Z_]\\w*)(\\s+(.*)|$)");
+   Pattern keyPat=Pattern.compile("^\\s*(\\S+)(\\s+(.*)|\\z)",Pattern.DOTALL);
+   Pattern ignoreCommentsPat=Pattern.compile("(?m)((^--)|^)((((?!--|\').)*)*(\\s*((\'(\'(?=\')|\\\\(?=\')|(?!\').)*\')*(((?!--|\').)*)*)\\s*)*)");
+   Pattern pstmtPat=Pattern.compile("^\\s*((\"[a-zA-Z_]\\w*\")|[a-zA-Z_]\\w*)(\\s+(.*)|$)",Pattern.DOTALL);
+   Pattern explainPat = Pattern.compile( "(^\\s*(?i)EXPLAIN(\\s+(?i)OPTIONS\\s+\'f\')?)\\s+((\"[a-zA-Z_]\\w*\")|[a-zA-Z_]\\w*)\\s*$",Pattern.DOTALL);
+   Pattern valPat=Pattern.compile("^\\s*((\"(\"(?=\")|\\\\(?=\")|.)*?\")|(\\S+))(\\s*(.*)|$)");
+   Pattern val2Pat=Pattern.compile("^\\s*((\'(\'(?=\')|\\\\(?=\')|.)*\')+|(\\S+))(\\s+(.*)|$)");
+   /**
+    * Support _UTF8 for set PARAM
+    */
+   Pattern paramValuePat=Pattern.compile("^\\s*(((_[iI][sS][oO]88591|_[uU][cC][sS]2|_[uU][tT][fF]8|_[kK][aA][nN][jJ][iI]|_[kK][sS][cC]5601)?(\\s*[xX])?(\'(.*)\'))|(\\S+))(\\s+(.*)|$)");
+   Pattern catalogPat=Pattern.compile("(\"(?:[^\"\\\\]|\"\"|\\\\.)*\"|\\S+)(\\s*.*|$)");   
+   Pattern tabPat=Pattern.compile("^\\s*((\"(\"(?=\")|\\\\(?=\")|.)*?\")|(\\w+));*\\s*(\\.(.*)|$|(,\\s*(?i)[A-Zz-z]*(.*)?$))",Pattern.DOTALL);
+   //Pattern paramListPat=Pattern.compile("^\\s*(\\??)((\'(\'(?=\')|\\\\(?=\')|.)*?\')|([^ ,]+))\\s*(,\\s*(.*)|$)",Pattern.DOTALL);
+   Pattern paramListPat=Pattern.compile("^\\s*((\'(\'(?=\')|\\\\(?=\')|.)*?\')|([^ ,]+))\\s*(,\\s*(.*)|$)",Pattern.DOTALL);
+   Pattern mapListPat=Pattern.compile("^\\s*((\"(\"(?=\")|\\\\(?=\")|.)*?\")*([^,]+))\\s*(,\\s*(.*)|$)",Pattern.DOTALL);
+   Pattern exitPat=Pattern.compile("(?i)^\\s*((WITH\\s+(-?\\d+))|(-?\\d+))?(\\s+IF(?!.*THEN.*).+)?$");
+   Pattern sectionPat=Pattern.compile("^\\s*\\(\\s*([a-zA-Z_]\\w*)\\s*\\)(\\s*$)");
+   Pattern mxciParamPat = Pattern.compile("^\\?(.*)");
+   Pattern dbFunctionPat = Pattern.compile("(?i)FN:(\\w+\\((.*)\\))");
+   Pattern mapFileFixedWidthColPat = Pattern.compile("^\\s*COLPOS\\((\\d+):(\\d+)\\).*$");
+   Pattern envPat=Pattern.compile("%([a-zA-Z]+)(.*)");
+   Pattern scriptPat=Pattern.compile("(?i)^\\s*(SRUN)\\s+(.*)");
+   Pattern connUserPat=Pattern.compile("([^,/@]+)(.*)");
+   Pattern connUserPreparePat=Pattern.compile("(^\".*?\")(.*)");
+   Pattern connPassPat=Pattern.compile("^/((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^@,]*)(@.*$|,.*$|$)");
+   Pattern connServerPat=Pattern.compile("^@([^,]+)(,.*$|$)");
+   Pattern connDsnPat=Pattern.compile("^,(.+)($)");
+   Pattern errPat = Pattern.compile("\\*\\*\\* (ERROR|WARNING)\\[(\\w*)\\](.*)",Pattern.DOTALL);
+   Pattern ndcsProductInfo = Pattern.compile("T7970([^ ])*",Pattern.DOTALL);
+   Pattern sysInfo = Pattern.compile("Current SYSnn(\\s+(.*))");
+   Pattern t4Version= Pattern.compile("T1249_.*[(]R(.[^)]*)");
+   Pattern wmsErrPat= Pattern.compile("Unexpected.*(error message = (.*))");
+   String showWildCardPattern = "(?<!\\\\)\\*";
+   String showWildCardPattern2 = "\\\\\\*";
+   String showWildCardPatternChar = "(?<!\\\\)\\?";
+   Pattern wordPattern=Pattern.compile("^\\s*(\\w+)(\\s*(.*)|$)");  
+   Pattern dbProdVersionPat=Pattern.compile("([A-Z]((\\d+)\\.(\\d+))(.*))((is the SUT identifier\\.)|(for NEO no ipms)|(plus integration build(.*)))");
+   Pattern condPat = Pattern.compile("^(?i:IF)(\\s|\\n)+((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^(\\s|\\n|~=|\\^=|!=|<>|>=|<=|>|<|=|==)]+)(\\s|\\n)*(~=|\\^=|!=|<>|>=|<=|>|<|==|=)(\\s|\\n)*((\"(\"(?=\")|\\\\(?=\")|.)*?\")|\\S+)(\\s|\\n)+(?i:THEN)(\\s|\\n)+(.+)\\z", Pattern.DOTALL);
+   Pattern delayTimePat = Pattern.compile("(?i)\\s*((-?\\d+)\\s*(((sec(ond)?(s)?)?)|(min(ute)?(s)?)))?");
+   String tmpTableName=null;
+   String showTableIdxRemainder=null;
+   static final String  UNKNOWN_ERROR_CODE = "UNKNOWN ERROR CODE";
+
+   Pattern patternKeyPat = Pattern.compile("\\s*\\$\\$([a-zA-Z0-9_]+)\\$\\$\\s+(.*)",Pattern.DOTALL);
+   Pattern patternValPat = Pattern.compile("\\s*(.*)(\\s*(.*)|$)");
+   Pattern containsKeyPat = Pattern.compile("(\\.)?\\$\\$([a-zA-Z0-9_]+)\\$\\$",Pattern.DOTALL);
+   Pattern regExpPat = Pattern.compile("\\s*/(.*)/(.*/)",Pattern.DOTALL);
+   Pattern regExpVal = Pattern.compile("(.+)/(.*)",Pattern.DOTALL);
+   
+   // For LDAP
+   Pattern errPosPat = Pattern.compile("(.*)\\s+at line \\d+, column (\\d+)(.*)",Pattern.DOTALL);
+   Pattern secErrPat = Pattern.compile(".*Details:[^:]*:(.*)", Pattern.DOTALL);
+
+   private boolean isTracingOn = Boolean.getBoolean("trafci.enableTrace");
+
+   
+   Parser() {
+	}
+   public String getRemainderStr()
+   {
+      return remainderStr;
+   }
+   public void setRemainderStr(String remainderStr)
+   {
+      this.remainderStr=remainderStr;
+   }
+
+   String getScriptToken()
+   {
+      Matcher mat=scriptPat.matcher(remainderStr);
+      if (mat.find())
+      {
+         return mat.group(2);
+      }
+      else
+         return null;
+   }
+
+   String getNextFileToken()
+   {
+      if (remainderStr == null)
+         return null;
+      Matcher mat=filePat.matcher(remainderStr);
+
+      if (mat.find())
+      {
+         remainderStr=mat.group(4);
+
+         if (mat.group(1) != null)
+         {
+
+            if (mat.group(1).startsWith("\"") && mat.group(1).endsWith("\""))
+               return mat.group(1).substring(1,mat.group(1).length()-1);
+            else
+               return mat.group(1);
+         }
+         else
+         {
+            return null;
+         }
+      }
+      else
+         return null;
+   }
+
+   String getNextSectionToken()
+   {
+      if (remainderStr == null)
+         return null;
+      Matcher mat=sectionPat.matcher(remainderStr);
+
+      if (mat.find())
+      {
+         remainderStr=mat.group(2);
+
+         if (mat.group(1)!=null)
+         {
+            return (mat.group(1));
+         }
+         else
+         {
+            return null;
+         }
+      }
+      else
+         return null;
+   }
+
+   String getNextNumberToken()
+   {
+      if (remainderStr == null)
+         return null;
+
+      Matcher mat=numberPat.matcher(remainderStr);
+      if (mat.find())
+      {
+         remainderStr=mat.group(4);
+         return mat.group(1);
+      }
+      else
+         return null;
+   }
+
+   String getNextKeyToken()
+   {
+      if (remainderStr == null)
+         return null;
+
+      Matcher mat=keyPat.matcher(remainderStr);
+      if (mat.find())
+      {
+         remainderStr=mat.group(2);
+         return mat.group(1);
+      }
+      else
+         return null;
+   }
+   
+   String lookAtNextToken()
+   {
+      if (remainderStr == null)
+         return null;
+
+      Matcher mat=valPat.matcher(remainderStr);
+      if (mat.find())
+      {
+         return mat.group(1);
+      }
+      else
+         return null;
+   }
+
+   String getNextParamToken()
+   {
+      if (remainderStr == null)
+         return null;
+
+      Matcher mat=paramPat.matcher(remainderStr);
+      if (mat.find())
+      {
+         remainderStr=mat.group(3);
+         return mat.group(2);
+      }
+      else
+         return null;
+   }
+
+   String getNextPreparedStmtNameToken()
+   {
+      if (remainderStr == null)
+         return null;
+      Matcher mat=pstmtPat.matcher(remainderStr);
+      if (mat.find())
+      {
+         remainderStr=mat.group(3);
+
+         if (mat.group(2)!=null)
+         {
+            return (mat.group(2).substring(1,mat.group(2).length()-1));
+         }
+         else
+         {
+            return mat.group(1).toUpperCase();
+         }
+      }
+      else
+         return null;
+
+   }
+
+   public List<String> getNextParamListToken()
+   {
+      List<String> paramList=null;
+      paramList=new ArrayList<String>();
+      String paramName=null;
+      while (true)
+      {
+         if ((paramName=getNextParam2Token()) != null)
+         {
+            paramList.add(paramName);
+         }
+         else
+         {
+            break;
+         }
+      }
+
+      return paramList;
+   }
+
+   public String getNextParam2Token()
+   {
+
+
+      if (remainderStr == null)
+      {
+         return null;
+      }
+      Matcher mat=paramListPat.matcher(remainderStr);
+      if (mat.find())
+      {
+         //System.out.println(mat.group(3));
+         remainderStr=mat.group(6);
+
+         //showTableIdxRemainder=mat.group(7);
+
+         if (mat.group(2) != null)
+         {
+            return mat.group(2).substring(1,mat.group(2).length()-1);
+         }
+         else if (mat.group(4) != null)
+         {
+            return mat.group(4).trim();
+         }
+         else
+         {
+            return null;
+         }
+      }
+      else
+      {
+         if (remainderStr != null)
+         {
+            String tmpStr=remainderStr.trim();
+            remainderStr=null;
+            return tmpStr;
+         }
+         return null;
+      }
+
+   }
+ //dead code. Removed by Kevin Xu
+/*
+   boolean matchExplainSyntax(List tokenList)
+   {
+      if (remainderStr == null)
+         return false;
+
+      Matcher mat=explainPat.matcher(remainderStr);
+      if (mat.find())
+      {
+         //System.out.println("Return true");
+         tokenList.add(mat.group(1));
+         if (mat.group(4)!=null)
+         {
+            tokenList.add(mat.group(4).substring(1,mat.group(4).length()-1));
+         }
+         else
+         {
+            tokenList.add(mat.group(3).toUpperCase());
+         }
+         return true;
+
+      }
+      //System.out.println("Return False");
+      return false;
+
+   }
+*/
+   // the value can be any word without quotes
+   // or any values including special characters enclosed within 
+   // double quotes
+   // if the value is enclosed within double quotes return value should 
+   // retain the case and remove the double quotes otherwise the return
+   // value should have all upper case 
+   String getNextValueToken()
+   {
+      if (remainderStr == null)
+         return null;
+
+      Matcher mat=valPat.matcher(remainderStr);
+
+      if (mat.find())
+      {
+         remainderStr=mat.group(5);
+         if (mat.group(2) != null)
+         {
+            return mat.group(2).substring(1,mat.group(2).length()-1);
+         }
+         else if (mat.group(4) != null)
+         {
+            return mat.group(4).toUpperCase();
+         }
+         else
+         {
+            return null;
+         }
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+
+   String getNextQValueToken()
+   {
+      if (remainderStr == null)
+         return null;
+
+      Matcher mat=valPat.matcher(remainderStr);
+
+      if (mat.find())
+      {
+         remainderStr=mat.group(5);
+         if (mat.group(2) != null)
+         {
+            return mat.group(2);
+         }
+         else if (mat.group(4) != null)
+         {
+            return mat.group(4).toUpperCase();
+         }
+         else
+         {
+            return null;
+         }
+      }
+      else
+      {
+         return null;
+      }
+   }
+   
+   String getCatalogToken()
+   {
+	  if (remainderStr == null)
+	     return null;
+
+	  Matcher mat=catalogPat.matcher(remainderStr);
+
+	  if (mat.find())
+	  {
+	    remainderStr=mat.group(2);
+	    if (mat.group(1).startsWith("\"") )
+           return mat.group(1);
+        else
+           return mat.group(1).toUpperCase();
+	  }
+	  else
+	  {
+	    return null;
+	  }
+   }
+
+   /**
+    *  Gets the value of a parameter (for a  set param call). Uses a
+    *  regular expression to match the input to a grammar/syntax.
+    *
+    *  @param   cmdInput  if its null uses the remainder string we have
+    *                     stored internally in here.
+    *  @return  Null or a parameter value object (with the charset and input)
+    *  @since   R2.4 SP2
+    *
+    */
+
+    ParamStringObject  getParamValue(String cmdInput) {
+    boolean  setRemainder = false;
+
+      try {
+
+         /**
+          *  Check if we any parameter passed -- if not use the remaining
+          *  input we have.  And also remember that we need to set the 
+          *  remainder if there's any input remaining.
+          */
+         if (null == cmdInput) {
+            cmdInput = remainderStr;
+            setRemainder = true;
+         }
+
+        
+         /**
+          *  Check if we have any input to work on.
+          */
+         if (null == cmdInput)
+            return null;
+
+
+         if (isTracingOn)
+            System.out.println("@@@Trace: getParamValue:: cmd input = " +
+                               cmdInput);
+
+         /**
+          *  Check if we have a match and get the value for the parameter.
+          */
+         Matcher mat = paramValuePat.matcher(cmdInput);
+
+         if (!mat.find() )
+            return null;
+
+
+         /**
+          *  All the unmatched portion is in the eighth group. Use that to
+          *  set the remainder string IFF we need to do that.
+          */
+         if (setRemainder)
+            remainderStr = mat.group(8);
+
+         if (isTracingOn)
+            System.out.println("@@@Trace: getParamValue:: remainderStr = " +
+                               mat.group(8) );
+
+
+         /**
+          *  The seventh group is any simple string values or error cases.
+          *  If we have a seventh group and its not null return that value.
+          *  This is match for the (\\S+) component of the regexp.
+          */
+         String theValue = mat.group(7);
+         if (null != theValue)
+            return  new ParamStringObject(null, null, theValue);
+
+
+         /**
+          *  Otherwise its a charset + hexinput + value type of string.
+          *  Group 3 is the charset, group 4 is the hex input prefix 'x'
+          *  and group 5 is the actual String value. Reassemble those.
+          */
+         ParamStringObject psv = new ParamStringObject(mat.group(3), mat.group(4),
+                                                   mat.group(5) );
+
+         if (isTracingOn)
+            System.out.println("@@@Trace: getParamValue:: theValue = " +
+                               psv.toString() );
+
+         return psv;
+
+      } catch(Throwable t) {
+         if (isTracingOn) {
+            System.out.println("Internal error getting parameter value. " + 
+                               "Details = " + t.getMessage() );
+
+            t.printStackTrace();
+         }
+
+      }
+
+      return null;
+
+   }   /*  End of  getParamValue  method.  */
+
+   String getNextValueType2Token()
+   {
+      if (remainderStr == null)
+         return null;
+
+      Matcher mat=val2Pat.matcher(remainderStr);
+
+      if (mat.find())
+      {
+         remainderStr=mat.group(5);
+         if (mat.group(2) != null)
+         {
+            return mat.group(2).substring(1,mat.group(2).length()-1);
+         }
+         else if (mat.group(4) != null)
+         {
+            return mat.group(4).toUpperCase();
+         }
+         else
+         {
+            return null;
+         }
+      }
+      else
+         return null;
+   }
+
+
+   boolean hasMoreTokens()
+   {
+      if (remainderStr == null || remainderStr.trim().length()== 0)
+      {
+         return false;
+      }
+      else
+      {
+         return true;
+      }
+   }
+ //dead code. Removed by Kevin Xu
+/*
+   String ignoreCommentsOld(String queryStr)
+   {
+      if (queryStr != null)
+      {
+         if (queryStr.indexOf("--") != -1)
+         {
+            StringBuffer outBuffer=null;
+            outBuffer=new StringBuffer();
+            Matcher ignoreCommentsPat = this.ignoreCommentsPat.matcher(queryStr);
+            while (ignoreCommentsPat.find())
+            {
+               if (ignoreCommentsPat.group(2) != null)
+               {
+                  //group 2 is not null..dont have to print anything
+
+               }
+               else if (ignoreCommentsPat.group(4) != null || ignoreCommentsPat.group(6) != null)
+               {
+                  outBuffer.append(ignoreCommentsPat.group(3));
+               }
+               else
+               {
+
+                  outBuffer.append(ignoreCommentsPat.group(0));
+               }
+            }
+            return outBuffer.toString();
+         }
+      }
+      return queryStr;
+   }
+*/
+   public List<String> getCSTList(String tablePattern)
+   {
+      List<String> cstList=null;
+      cstList=new ArrayList<String>();
+      String tabName=null;
+      tmpTableName=null;
+      tmpTableName=tablePattern;
+      while (true)
+      {
+         if ((tabName=getNextTableToken(tmpTableName)) != null)
+         {
+            cstList.add(tabName);
+         }
+         else
+         {
+            break;
+         }
+      }
+      return cstList;
+   }
+
+
+
+   public String getNextTableToken(String tablePattern)
+   {
+      if (tablePattern == null)
+      {
+         return null;
+      }
+      Matcher mat=tabPat.matcher(tablePattern);
+
+      if (mat.find())
+      {
+         tmpTableName=mat.group(6);
+
+         showTableIdxRemainder=mat.group(7);
+
+         if (mat.group(2) != null)
+         {
+            return mat.group(2).replaceAll("\"","\\\"");
+         }
+         else if (mat.group(4) != null)
+         {
+            return mat.group(4).toUpperCase();
+         }
+         else
+         {
+            return null;
+         }
+      }
+      else
+      {
+         return null;
+      }
+
+   }
+   
+ //dead code. Removed by Kevin Xu
+/*
+   boolean matchMxciParamPat(String param)
+   {
+      Matcher mat = mxciParamPat.matcher(param);
+      if (mat.find())
+      {
+         remainderStr = mat.group(1).trim();
+         return true;
+      }
+      else
+      {
+         remainderStr = null;
+         return false;
+      }
+   }
+*/
+   public List<String> splitLines()
+   {
+      List<String> paramList=null;
+      paramList=new ArrayList<String>();
+      String paramName=null;
+      while (true)
+      {
+         if ((paramName=getNextToken()) != null)
+         {
+            paramList.add(paramName);
+         }
+         else
+         {
+            break;
+         }
+      }
+
+      return paramList;
+   }
+
+   public String getNextToken()
+   {
+
+      if (remainderStr == null)
+      {
+         return null;
+      }
+      Matcher mat=mapListPat.matcher(remainderStr);
+      if (mat.find())
+      {
+         remainderStr=mat.group(6);
+
+         if (mat.group(1) != null)
+         {
+            return mat.group(1);
+         }
+         else
+         {
+            return null;
+         }
+      }
+      else
+      {
+         if (remainderStr != null)
+         {
+            String tmpStr=remainderStr.trim();
+            remainderStr=null;
+            return tmpStr;
+         }
+         return null;
+      }
+
+   }
+ //dead code. Removed by Kevin Xu
+/*
+   List split(String line)
+   {
+      List tokList=null;
+      tokList=new ArrayList();
+      String token=null;
+      this.setRemainderStr(line);
+
+      while (true)
+      {
+         if ((token=getNextValueType2Token()) != null)
+         {
+            tokList.add(token);
+         }
+         else
+         {
+            break;
+         }
+      }
+      return tokList;
+   }
+
+   List matchFixedWidthPattern(String param)
+   {
+      List posList=null;
+      Matcher mat = mapFileFixedWidthColPat.matcher(param);
+      if (mat.find())
+      {
+         posList = new ArrayList();
+         posList.add(mat.group(1));
+         posList.add(mat.group(2));
+
+      }
+      return posList;
+   }
+
+   public String matchDbFnPattern(String str)
+   {
+      Matcher  mat = dbFunctionPat.matcher(str);
+      if (mat.find())
+      {
+         String fnname = mat.group(1);
+         String tmp[] = mat.group(2).split(",");
+         if (tmp != null)
+            str = str.replaceFirst(tmp[0],"?");
+         else
+            str = str.replaceFirst(fnname,"?");
+         return fnname;
+      }
+      return null;
+   }
+
+   public String getEnvVarName()
+   {
+      if (remainderStr == null)
+         return null;
+      Matcher mat = envPat.matcher(remainderStr);
+      if (mat.find())
+      {
+         remainderStr=mat.group(2);
+         return mat.group(1);
+      }
+      else
+      {
+         return null;
+      }
+   }
+*/
+   public String getConnArg(String argString)
+   {
+      if (remainderStr == null || argString==null)
+      {
+         return null;
+      }
+      Matcher mat =null;
+      if (argString.equalsIgnoreCase("user"))
+      {
+    	  mat=connUserPreparePat.matcher(remainderStr.trim());
+     	 if(mat.find())
+     	 {
+     		 String userPrepare = mat.group(1).trim();
+			 if (userPrepare.indexOf("/") < 0
+						&& !(userPrepare.indexOf("\"") == 0 && userPrepare
+								.lastIndexOf("\"") == userPrepare.length() - 1))
+     			 mat=connUserPat.matcher(remainderStr);
+     		 else
+     			 mat.reset();
+     	 }
+     	 else
+     		 mat=connUserPat.matcher(remainderStr);
+      }
+      else if (argString.equalsIgnoreCase("pass"))
+         mat=connPassPat.matcher(remainderStr);
+      else if (argString.equalsIgnoreCase("server"))
+         mat=connServerPat.matcher(remainderStr);
+      else if (argString.equalsIgnoreCase("dsn"))
+         mat=connDsnPat.matcher(remainderStr);
+      else
+         return null;
+
+      if (mat.find())
+      {
+         remainderStr=mat.group(mat.groupCount());
+         if (argString.equalsIgnoreCase("pass") && 
+        		 mat.group(1).startsWith("\"") && mat.group(1).endsWith("\""))
+         {
+        	String password = mat.group(1).substring(1,mat.group(1).length()-1);
+        	password = password.replaceAll("\\\\\"","\\\"");
+            return password;
+         }
+         if (argString.equalsIgnoreCase("user"))
+         {
+        	 String user = mat.group(1).trim();
+        	 if (user.startsWith("\"") && user.endsWith("\""))
+        		 return user.substring(1,user.length()-1);
+         }
+                 
+         return mat.group(1);
+      }
+      else
+      {
+         return null;
+      }
+   }
+   
+	public String getErrorCode(String errStr) {
+		Matcher mat = errPat.matcher(errStr);
+		if (mat.find())
+			return mat.group(2);
+		else
+			return UNKNOWN_ERROR_CODE;
+	}
+	   
+	public String getErrorCode(String errStr, int errCode) {
+		Matcher mat = errPat.matcher(errStr);
+		if (mat.find())
+			return mat.group(2);
+		else if (errCode != 0)
+			return String.valueOf(errCode);
+		else
+			return UNKNOWN_ERROR_CODE;
+	}
+
+   public String getErrorMsg(String errStr)
+   {
+
+      Matcher mat = errPat.matcher(errStr);
+      if (mat.find())
+         return mat.group(3).trim();
+      else
+         return errStr;
+   }
+
+   public String getNDCSProduct(String vproc)
+   {
+      Matcher mat = ndcsProductInfo.matcher(vproc);
+      if (mat.find())
+      {
+         return mat.group();
+      }
+      else
+      {
+         return null;
+      }
+   }
+   public String getSysInfo(String sysinfo)
+   {
+
+      Matcher mat = sysInfo.matcher(sysinfo);
+      if (mat.find())
+         return mat.group(1);
+      else
+         return null;
+   }
+
+   public String gett4Version(String verTxt)
+   {
+
+      Matcher mat = t4Version.matcher(verTxt);
+      if (mat.find())
+         return mat.group(1);
+      else
+         return null;
+   }
+
+   public String getWMSErr(String errTxt)
+   {
+
+      Matcher mat = wmsErrPat.matcher(errTxt);
+      if (mat.find())
+         return mat.group(2);
+      else
+         return errTxt;
+   }
+    
+   /************** Begin Conditional Parser Functions ***************************/
+   // group(2) is condition
+   // group(6) is operator
+   // group(8) is value
+   // group(13) is action
+   
+   public String getConditionalVariable(String txt){
+       Matcher mat = condPat.matcher(txt);
+
+       if(mat.find())
+       {
+           return mat.group(2).trim();
+       }
+       else
+           return null;
+   }
+   
+   public String getConditionalOperator(String txt){
+       Matcher mat = condPat.matcher(txt);
+       if(mat.find())
+           return mat.group(6);
+       else
+           return null;
+   }
+   
+   public String getConditionalValue(String txt){
+       Matcher mat = condPat.matcher(txt);
+       if(mat.find())
+           return mat.group(8);
+       else
+           return null;
+   }
+   
+   public String getConditionalAction(String txt){
+       String action = null;
+       Matcher mat = condPat.matcher(txt);
+       if(mat.find())
+       {
+           action = mat.group(13).replaceAll("\\n", " ").trim();
+       }
+       
+       return action;
+   }
+
+   /************** End Conditional Parser Functions *****************************/   
+
+   //   Identifies the comments in a given SQL query line
+   // if a comment string "--" is embedded between single quotes
+   // then it is treated as string literal otherwise its a comment
+   String ignoreComments(String qryLine)
+   {
+      String qryLineCopy=qryLine;
+      int quoteStartPos=-1;                          // first single quote position
+      int quoteEndPos=-1;                            // second single quote or end quote position
+      int commentPos=-1;                             // comments position
+      int fromIndex=0;                               // search start position in the querystring for quotes
+      int commentFromIndex=0;                        // search start position in the querystring for comment
+      String quoteStr="'";
+      String commentStr="--";
+
+      while (qryLineCopy !=null)
+      {
+
+         quoteStartPos=qryLine.indexOf(quoteStr,fromIndex);
+         commentPos=qryLine.indexOf(commentStr,commentFromIndex);
+
+         // if no comments found return qryLine as it is.
+         if (commentPos == -1) return qryLine;
+
+         // if no quotes found or if the comment appears before the quote remove the comment portion
+         // from the query string and return it
+         // else set the fromIndex position to find the ending quote.
+         if (quoteStartPos == -1 || quoteStartPos > commentPos) return qryLine.substring(0,commentPos);
+         else
+            fromIndex=quoteStartPos+1;
+
+         quoteEndPos=qryLine.indexOf(quoteStr,fromIndex);
+
+         // if no ending quote is found remove the comments portion and return the string
+         if (quoteEndPos==-1 && commentPos != -1) return qryLine.substring(0,commentPos);
+
+         // if comment begins after ending quote , search for more quotes without resetting commentsPosition
+         if (quoteEndPos < commentPos)
+         {
+            qryLineCopy=qryLine.substring(quoteEndPos+1,qryLine.length());
+            fromIndex=quoteEndPos+1;
+            continue;
+         }
+
+         // if comment appears between quotes , search for more quotes and comments and repeat the while loop
+         // by resetting comments position
+         if (quoteStartPos < commentPos && commentPos < quoteEndPos && qryLine.length()>quoteEndPos+1)
+            qryLineCopy=qryLine.substring(quoteEndPos+1,qryLine.length()-1);
+
+         fromIndex=quoteEndPos+1;
+         commentFromIndex=fromIndex;
+
+      }
+
+      return qryLine;
+
+   }
+
+   public String replaceShowPattern(String showPatStr)
+   {
+      showPatStr = showPatStr.replaceAll(showWildCardPattern, "%");
+      showPatStr = showPatStr.replaceAll(showWildCardPatternChar, "_");
+      return showPatStr;
+
+   }
+
+   public String replaceShowPrepPattern(String showPatStr)
+   {
+      showPatStr = showPatStr.replaceAll(showWildCardPattern, ".*");
+      showPatStr = showPatStr.replaceAll(showWildCardPattern2, "*");
+      showPatStr = showPatStr.replaceAll(showWildCardPatternChar, "_");
+      return showPatStr;
+
+   }
+   
+   String getNextWordToken()
+   {
+      if(remainderStr == null)
+        return null;
+       
+      Matcher mat=wordPattern.matcher(remainderStr);
+      if(mat.find())
+      {
+         remainderStr=mat.group(2);
+         return mat.group(1);
+      }
+      else
+      {
+         return null;
+      }
+   }
+   
+   String getDbVersion(String sutVer)
+   {
+      if (sutVer == null)
+         return null;
+       
+      Matcher mat=dbProdVersionPat.matcher(sutVer);
+      if(mat.find())
+      {
+         String minorVersion = mat.group(4);
+         if (minorVersion.length() > 1 && minorVersion.startsWith("0"))
+            minorVersion = minorVersion.substring(1);
+         return mat.group(3) + "." + minorVersion;
+       }
+       else
+       {
+           return null;
+       }
+   }
+   
+   String formatSutVer(String sutVer)
+   {
+	   if (sutVer == null)
+	         return "Information not available";
+	       
+	   Matcher mat=dbProdVersionPat.matcher(sutVer);
+	   if(mat.find())
+	   {
+	         return mat.group(1);
+	   }
+	   else
+	   {
+	           return "Information not available";
+	   }
+	   
+   }
+   
+   public int getDelayTime(String cmdStr)
+   {
+      int timeVal=-1;
+      Matcher mat = delayTimePat.matcher(cmdStr);
+      if (mat.matches())
+      {
+         if (mat.group(2)!=null)
+         {
+            try {
+                timeVal = Integer.parseInt(mat.group(2)) * 1000;
+            }catch (NumberFormatException nfe)
+            {
+               return -1;
+            }
+         }
+         if (mat.group(8)!=null)
+         {
+            timeVal = timeVal * 60 ;
+         }
+       
+      }
+      return timeVal;
+   }
+   
+   
+   public String matchKeyPat(String cmdStr)
+   {
+	   Matcher patMat = containsKeyPat.matcher(cmdStr);
+	   if (patMat.matches())
+	   {
+		   return patMat.group(2);
+	   }
+	   return null;
+   }
+   
+   public Matcher getKeyPatternMatcher(String cmdStr)
+   {
+	   Matcher patMat = containsKeyPat.matcher(cmdStr);
+	   return patMat;
+	  
+   }
+   
+   public String getPatternKeyPattern()
+   {
+	   Matcher patMat = patternKeyPat.matcher(remainderStr);
+	   if (patMat.matches())
+	   {
+		  remainderStr=patMat.group(2);
+	   	  return patMat.group(1);
+	   	  
+	   }
+	   return null;
+   }
+   
+   public String getPatternValueToken()
+   {
+	   Matcher patMat = patternValPat.matcher(remainderStr);
+	   if (patMat.matches())
+	   {
+		  remainderStr=patMat.group(2);
+	   	  return patMat.group(1);
+	   	  
+	   }
+	   return null;
+   }
+   public String getRegexpPattern()
+   {
+	   Matcher regExpMat = regExpPat.matcher(remainderStr);
+	   if (regExpMat.matches())
+	   {
+		  remainderStr=regExpMat.group(2);
+	   	  return regExpMat.group(1);
+	   	  
+	   }
+	   return null;
+   }
+   
+   public String getRegexpValue()
+   {
+	   Matcher regExpMat = regExpVal.matcher(remainderStr);
+	   if (regExpMat.matches())
+	   {
+		  remainderStr=regExpMat.group(2);
+	   	  return regExpMat.group(1);
+	   	  
+	   }
+	   return null;
+   }
+   
+   
+   public int getErrorPos(String errorMsg)
+   {
+	   Matcher errorPosMat = errPosPat.matcher(errorMsg);
+	   if (errorPosMat.matches())
+	   {
+		 return new Integer(errorPosMat.group(2)).intValue();
+	   }
+	   return 0;
+   }
+   
+   
+   public String getSECErr(String errTxt)
+   {
+      Matcher mat = secErrPat.matcher(errTxt);
+      if (mat.find())
+         return mat.group(1);
+      else
+         return errTxt;
+   }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ParserMissingParamException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ParserMissingParamException.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ParserMissingParamException.java
new file mode 100644
index 0000000..314974e
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ParserMissingParamException.java
@@ -0,0 +1,42 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class ParserMissingParamException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 6253398014500719153L;
+
+	ParserMissingParamException()
+	{
+	
+	}
+	
+	ParserMissingParamException(String msg)
+	{
+		super(msg);
+	}
+
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Properties/trafciDefaultLookAndFeel.properties
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Properties/trafciDefaultLookAndFeel.properties b/core/conn/trafci/src/main/java/org/trafodion/ci/Properties/trafciDefaultLookAndFeel.properties
new file mode 100644
index 0000000..d867795
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Properties/trafciDefaultLookAndFeel.properties
@@ -0,0 +1,60 @@
+#
+# @@@ 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 @@@
+#
+
+WMS_.*=---\ WMS\ operation\ complete.
+SQL_UNKNOWN_CMD=---\ SQL\ operation\ complete.
+SQL_CREATE\ TABLE\ .*\ AS\ SELECT\ .*=---\ @rownum@ row(s)\ inserted.
+SQL_CREATE\ SET\ VOLATILE\ TABLE\ .*\ AS\ SELECT\ .*=---\ @rownum@ row(s)\inserted.
+SQL_CREATE\ SET\ TABLE\ .*\ AS\ SELECT\ .*=---\ @rownum@ row(s)\ inserted.
+SQL_CREATE\ VOLATILE\ TABLE\ .*\ AS\ SELECT\ .*=---\ @rownum@ row(s)\ inserted.
+SQL_DELETE\ .*=---\ @rownum@ row(s)\ deleted.
+SQL_DELETE\ SERVICE\ .*=---\ SQL\ operation\ complete.
+SQL_DELETE\ USER\ .*=---\ SQL\ operation\ complete.
+SQL_DELETE\ DS\ .*=---\ SQL\ operation\ complete.
+SQL_PREPARE\ .*=---\ SQL\ command\ prepared.
+SQL_EXECUTE\ .*=---\ SQL\ operation\ complete.
+SQL_INSERT\ .*=---\ @rownum@ row(s)\ inserted.
+SQL_INS\ .*=---\ @rownum@ row(s)\ inserted.
+SQL_SELECT\ .*=---\ @rownum@ row(s)\ selected.
+SQL_SELECT_LIST_COUNT\ .*=---\ @rownum@ row(s)\ selected.  LIST_COUNT was reached.
+SQL_VALUES.*=---\ @rownum@ row(s)\ selected.
+SQL_\\(\\s*SELECT\ .*=---\ @rownum@ row(s)\ selected.
+SQL_\\(\\s*SELECT_LIST_COUNT\ .*=---\ @rownum@ row(s)\ selected.  LIST_COUNT was reached.
+SQL_\\(\\s*VALUES.*=---\ @rownum@ row(s)\ selected.
+SQL_SEL\ .*=---\ @rownum@ row(s)\ selected.
+SQL_UPDATE\ .*=---\ @rownum@ row(s)\ updated.
+SQL_UPSERT\ .*=---\ @rownum@ row(s)\ inserted.
+SQL_UPDATE\ STATISTICS\ .*=---\ SQL\ operation\ complete.
+SQL_LOCK\ .*\ FOR\ ACCESS\ INS\ .*=---\ @rownum@ row(s)\ inserted.
+SQL_LOCK\ .*\ FOR\ ACCESS\ INSERT\ .*=---\ @rownum@ row(s)\ inserted. 
+SQL_LOCK\ .*\ FOR\ ACCESS\ SEL\ .*=---\ @rownum@ row(s)\ selected.
+SQL_LOCK\ .*\ FOR\ ACCESS\ SELECT\ .*=---\ @rownum@ row(s)\ selected.
+SQL_LOCKING\ .*\ FOR\ ACCESS\ INS\ .*=---\ @rownum@ row(s)\ inserted.
+SQL_LOCKING\ .*\ FOR\ ACCESS\ INSERT\ .*=---\ @rownum@ row(s)\ inserted. 
+SQL_LOCKING\ .*\ FOR\ ACCESS\ SEL\ .*=---\ @rownum@ row(s)\ selected.
+SQL_LOCKING\ .*\ FOR\ ACCESS\ SELECT\ .*=---\ @rownum@ row(s)\ selected.
+CS_.*=---\ CS\ operation\ complete.
+SQL_CMDCLOSE=---\ CS\ operation\ complete.
+SQL_WMSCLOSE=---\ WMS\ operation\ complete.
+
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/PrunSummary.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/PrunSummary.java b/core/conn/trafci/src/main/java/org/trafodion/ci/PrunSummary.java
new file mode 100644
index 0000000..f5d93e8
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/PrunSummary.java
@@ -0,0 +1,119 @@
+// @@@ 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 @@@
+/**
+ * 
+ * Object to handle PRUN summary fields 
+ * 
+ */
+package org.trafodion.ci;
+
+public class PrunSummary
+{
+
+   private int totalScriptFiles = 0;
+   private int totalScriptFilesProcessed = 0;
+   private int totalSQLsProcessed = 0;
+   private int totalSQLErrors = 0;
+   private int totalSQLWarnings = 0;
+   private int totalConnections = 0;
+   private int totalConnectionFailures = 0;
+   private int totalSQLSuccesses = 0;
+
+   public int getTotalConnections()
+   {
+      return totalConnections;
+   }
+
+   public void setTotalConnections(int totalConnections)
+   {
+      this.totalConnections = totalConnections;
+   }
+
+   public int getTotalScriptFiles()
+   {
+      return totalScriptFiles;
+   }
+
+   public void setTotalScriptFiles(int totalScriptFiles)
+   {
+      this.totalScriptFiles = totalScriptFiles;
+   }
+
+   public int getTotalScriptFilesProcessed()
+   {
+      return totalScriptFilesProcessed;
+   }
+
+   public void setTotalScriptFilesProcessed(int totalScriptFilesProcessed)
+   {
+      this.totalScriptFilesProcessed = totalScriptFilesProcessed;
+   }
+
+   public int getTotalSQLErrors()
+   {
+      return totalSQLErrors;
+   }
+
+   public void setTotalSQLErrors(int totalSQLErrors)
+   {
+      this.totalSQLErrors = totalSQLErrors;
+   }
+
+   public int getTotalSQLsProcessed()
+   {
+      return totalSQLsProcessed;
+   }
+
+   public void setTotalSQLsProcessed(int totalSQLsProcessed)
+   {
+      this.totalSQLsProcessed = totalSQLsProcessed;
+   }
+
+   public int getTotalSQLWarnings()
+   {
+      return totalSQLWarnings;
+   }
+
+   public void setTotalSQLWarnings(int totalSQLWarnings)
+   {
+      this.totalSQLWarnings = totalSQLWarnings;
+   }
+
+   public int getTotalSQLSuccess()
+   {
+      return totalSQLSuccesses;
+   }
+
+   public int getTotalConnectionFailures()
+   {
+      return totalConnectionFailures;
+   }
+
+   public void setTotalConnectionFailures(int totalConnectionFailures)
+   {
+      this.totalConnectionFailures = totalConnectionFailures;
+   }
+
+   public void setTotalSQLSuccess(int totalSQLSuccesses)
+   {
+      this.totalSQLSuccesses = totalSQLSuccesses;
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/PrunUserInterruption.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/PrunUserInterruption.java b/core/conn/trafci/src/main/java/org/trafodion/ci/PrunUserInterruption.java
new file mode 100644
index 0000000..8b7deac
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/PrunUserInterruption.java
@@ -0,0 +1,34 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class PrunUserInterruption extends Exception
+{
+   /**
+   * 
+   */
+   private static final long serialVersionUID = 794988996507793357L;
+
+   PrunUserInterruption()
+   {
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/PythonInterface.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/PythonInterface.java b/core/conn/trafci/src/main/java/org/trafodion/ci/PythonInterface.java
new file mode 100644
index 0000000..7ce827b
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/PythonInterface.java
@@ -0,0 +1,180 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.sql.SQLException;
+
+public class PythonInterface
+{
+   ConsoleReader crObj=null;
+   ConsoleWriter cwObj=null;
+   SessionInterface sessIntObj=null;
+   Session sessObj=null;
+   boolean doTrace=false;
+
+   public PythonInterface()
+   {
+      initialize();
+      sessIntObj=new SessionInterface(crObj,cwObj);
+
+      String enableTrace=System.getProperty ("trafci.enableTrace");
+      if ((enableTrace != null) && enableTrace.trim().equalsIgnoreCase("true"))
+         doTrace = true;
+
+   }
+
+   private void initialize()
+   {
+      cwObj=new ConsoleWriter();
+
+      try
+      {
+         cwObj.initialize();
+      } catch (IOException e1)
+      {
+         System.out.println("Could not able to initialize the writer"+e1);
+         if (doTrace)
+            e1.printStackTrace();
+         System.exit(1);
+      }
+      crObj=new ConsoleReader();
+
+      try
+      {
+         crObj.initialize();
+      } catch (IOException e1)
+      {
+         System.out.println("Could not able to initialize the reader"+e1);
+         if (doTrace)
+            e1.printStackTrace();
+         System.exit(1);
+      }
+   }
+
+   public void openConnection(String userName, String password, String serverName, String portNumber, String dsnName)
+   {
+	    String roleName = ""; //primary role
+	    openConnection(userName, password, roleName, serverName, portNumber, dsnName );   
+   }
+   
+   public void openConnection(String userName, String password,String roleName, String serverName, String portNumber, String dsnName)
+   {
+      try
+      {
+         sessObj=sessIntObj.createSession(userName,
+            password,
+            roleName,
+            serverName,
+            portNumber,
+            dsnName,
+            SessionDefaults.USERI);
+      } catch (FileNotFoundException e)
+      {
+         // TODO Auto-generated catch block
+         e.printStackTrace();
+      } catch (SQLException e)
+      {
+         // TODO Auto-generated catch block
+         e.printStackTrace();
+      } catch (InstantiationException e)
+      {
+         // TODO Auto-generated catch block
+         e.printStackTrace();
+      } catch (IllegalAccessException e)
+      {
+         // TODO Auto-generated catch block
+         e.printStackTrace();
+      } catch (ClassNotFoundException e)
+      {
+         // TODO Auto-generated catch block
+         e.printStackTrace();
+      } catch (IOException e)
+      {
+         // TODO Auto-generated catch block
+         e.printStackTrace();
+      }
+   }
+
+   public void executeUI()
+   {
+      try
+      {
+         sessIntObj.setQueryOptions(false,null);
+         sessIntObj.invokeSession(sessObj);
+      } catch (IOException e)
+      {
+         // TODO Auto-generated catch block
+         e.printStackTrace();
+      }
+   }
+
+   public void executeQuery(String qryString)
+   {
+      try
+      {
+         sessIntObj.setQueryOptions(true,qryString);
+         sessIntObj.invokeSession(sessObj);
+      } catch (IOException e)
+      {
+         // TODO Auto-generated catch block
+         e.printStackTrace();
+      }
+   }
+
+   public void executeFile(String fileName)
+   {
+      try
+      {
+         sessIntObj.setQueryOptions(false,null);
+         sessIntObj.setScriptFile(fileName);
+         //sessIntObj.setCaller(SessionDefaults.PYTHI);
+         sessIntObj.invokeSession(sessObj);
+
+      } catch (IOException e)
+      {
+         // TODO Auto-generated catch block
+         e.printStackTrace();
+      }
+   }
+
+   public void closeConnection()
+   {
+      if (this.sessIntObj != null)
+      {
+         if (sessObj.getConnObj() != null)
+         {
+            try
+            {
+               sessObj.getConnObj().close();
+            } catch (SQLException e)
+            {
+               // TODO Auto-generated catch block
+               e.printStackTrace();
+            }
+            sessObj=null;
+         }
+      }
+      sessIntObj=null;
+   }
+   
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Query.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Query.java b/core/conn/trafci/src/main/java/org/trafodion/ci/Query.java
new file mode 100644
index 0000000..e366a8d
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Query.java
@@ -0,0 +1,188 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+public class Query
+{
+   private int queryType=-1 ;  // 0 -tool query 1- sql query
+   private boolean passThrough=false; // false -for all interface query
+   private boolean multiLine=false; // false for all interface query
+   private StringBuffer queryText;
+   private String rowCount=null; // false if the query does not succeed
+   private int queryId=-1;// query identifier
+   private boolean trimOut=false;
+   private boolean isActive=false;
+   private long elapsedTime;
+   private String stmtType=null;
+   private int statusCode=0; // 0-after successful execution of the query. corresponding error number otherwise
+   private String colCount=null;
+   private int rsCount=0;
+
+	Query() {
+		queryText = new StringBuffer();
+	}
+
+   public void setQueryType(int queryType)
+   {
+      this.queryType=queryType;
+   }
+
+   public int getQueryType()
+   {
+      return this.queryType;
+   }
+
+   public void setPassThrough(boolean  passThrough)
+   {
+      this.passThrough=passThrough;
+   }
+
+   public boolean getPassThrough()
+   {
+      return this.passThrough;
+   }
+
+   public void setMultiLine(boolean  multiLine)
+   {
+      this.multiLine=multiLine;
+   }
+
+   public boolean isMultiLine()
+   {
+      return this.multiLine;
+   }
+
+   public void setQueryText(String queryText)
+   {
+      this.queryText.append(queryText);
+   }
+
+   public void resetQueryText(String queryText)
+   {
+      this.queryText.replace(0,this.queryText.length(),queryText);
+   }
+
+   public String getQueryText()
+   {
+      return this.queryText.toString();
+   }
+
+   public void setRowCount(String rowCount)
+   {
+      this.rowCount=rowCount;
+   }
+
+   public void resetRowCount()
+   {
+      this.rowCount=null;
+   }
+
+   public String getRowCount()
+   {
+      return this.rowCount;
+   }
+
+   public void setColCount(String colCount)
+   {
+      this.colCount=colCount;
+   }
+
+   public String getColCount()
+   {
+      return this.colCount;
+   }
+
+   public int getQueryId()
+   {
+      return queryId;
+   }
+
+   public void setQueryId(int queryId)
+   {
+      this.queryId = queryId;
+   }
+
+   public boolean isTrimOut()
+   {
+      return trimOut;
+   }
+
+   public void setTrimOut(boolean trimOut)
+   {
+      this.trimOut = trimOut;
+   }
+
+   public boolean isActive()
+   {
+      return isActive;
+   }
+
+   public void setActive(boolean isActive)
+   {
+      this.isActive = isActive;
+   }
+   public long getElapsedTime()
+   {
+      return this.elapsedTime;
+   }
+
+   public void setElapsedTime(long elapsedTime)
+   {
+      this.elapsedTime=elapsedTime;
+   }
+
+   public String getStmtType()
+   {
+      return stmtType;
+   }
+
+   public void setStmtType(String stmtType)
+   {
+      this.stmtType = stmtType;
+   }
+
+   public int getStatusCode()
+   {
+      return statusCode;
+   }
+
+   public void setStatusCode(int statusCode)
+   {
+      this.statusCode = statusCode;
+   }
+
+   public int getRsCount()
+   {
+      return rsCount;
+   }
+
+   public void incrRsCount()
+   {
+      rsCount++;
+
+   }
+
+   public void setRsCount(int rsCount)
+   {
+      this.rsCount = rsCount;
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/QueryUtils.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/QueryUtils.java b/core/conn/trafci/src/main/java/org/trafodion/ci/QueryUtils.java
new file mode 100644
index 0000000..c91edae
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/QueryUtils.java
@@ -0,0 +1,37 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+public class QueryUtils 
+{
+   QueryUtils()
+   {
+   }
+   
+   
+   public boolean isGetStatsCmd(Query qryObj)
+   {
+      if (qryObj.getQueryText().matches("(?i)(?s)get\\s+statistics.*") )
+         return true;
+      return false;
+   }
+}


[31/38] incubator-trafodion git commit: add file ignore

Posted by li...@apache.org.
add file ignore


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

Branch: refs/heads/master
Commit: 4eadefd8d8f18d820766192e78a4f3a2980d1eb7
Parents: abb23ee
Author: AlexPeng19 <al...@hotmail.com>
Authored: Tue Nov 22 18:01:12 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Tue Nov 22 18:01:12 2016 +0800

----------------------------------------------------------------------
 core/conn/trafci/.gitignore | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/4eadefd8/core/conn/trafci/.gitignore
----------------------------------------------------------------------
diff --git a/core/conn/trafci/.gitignore b/core/conn/trafci/.gitignore
index 4d6e252..13badcc 100644
--- a/core/conn/trafci/.gitignore
+++ b/core/conn/trafci/.gitignore
@@ -7,3 +7,5 @@ utils/trafci.sh
 install/Installer.java
 src/main/java/org/trafodion/ci/Vproc.java
 /target/
+/target/
+/target/


[27/38] incubator-trafodion git commit: add the copyright to installer_pom.xml

Posted by li...@apache.org.
add the copyright to installer_pom.xml


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

Branch: refs/heads/master
Commit: aba0352650026af5951c765a56d9e34a578976da
Parents: 9bac03e
Author: AlexPeng19 <al...@hotmail.com>
Authored: Tue Nov 22 12:55:21 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Tue Nov 22 12:55:21 2016 +0800

----------------------------------------------------------------------
 core/conn/trafci/installer_pom.xml | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/aba03526/core/conn/trafci/installer_pom.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/installer_pom.xml b/core/conn/trafci/installer_pom.xml
index 650c4c2..8c497af 100644
--- a/core/conn/trafci/installer_pom.xml
+++ b/core/conn/trafci/installer_pom.xml
@@ -1,5 +1,25 @@
-<!-- @@@ START COPYRIGHT @@@ (C) Copyright 2015 Esgyn Corporation @@@ END 
-	COPYRIGHT @@@ -->
+<!-- 
+ @@@ 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 @@@
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>


[24/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
convert trafci project into maven project


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

Branch: refs/heads/master
Commit: de7e7d4e6cb20a9a7a0c8cdb4e9a48f71945dd10
Parents: b7852a1
Author: AlexPeng19 <al...@hotmail.com>
Authored: Tue Nov 22 10:23:29 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Tue Nov 22 10:23:29 2016 +0800

----------------------------------------------------------------------
 core/conn/trafci/.gitignore                     |    3 +
 core/conn/trafci/Makefile                       |   11 +
 core/conn/trafci/install/Installer.java         | 3389 --------------
 core/conn/trafci/install/Installer.java-tmpl    | 3389 ++++++++++++++
 core/conn/trafci/installer_pom.xml              |   86 +
 core/conn/trafci/pom.xml                        |   97 +
 .../org/trafodion/ci/AWTExceptionHandler.java   |   36 +
 .../main/java/org/trafodion/ci/CSVDisplay.java  |   90 +
 .../src/main/java/org/trafodion/ci/Column.java  |  131 +
 .../java/org/trafodion/ci/ConditionalQuery.java |  435 ++
 .../trafodion/ci/ConditionalQueryException.java |   43 +
 .../trafodion/ci/ConditionalSyntaxError.java    |  123 +
 .../java/org/trafodion/ci/ConsoleReader.java    |  218 +
 .../java/org/trafodion/ci/ConsoleWriter.java    |  130 +
 .../java/org/trafodion/ci/DatabaseQuery.java    | 1804 ++++++++
 .../src/main/java/org/trafodion/ci/Display.java |   68 +
 .../trafodion/ci/DuplicateParamException.java   |   40 +
 .../main/java/org/trafodion/ci/ErrorObject.java |  103 +
 .../src/main/java/org/trafodion/ci/FCQuery.java |  334 ++
 .../main/java/org/trafodion/ci/FileReader.java  |  176 +
 .../main/java/org/trafodion/ci/FileWriter.java  |   80 +
 .../main/java/org/trafodion/ci/HTMLDisplay.java |   80 +
 .../main/java/org/trafodion/ci/HTMLObject.java  |  628 +++
 .../main/java/org/trafodion/ci/HelpIndexer.java |  134 +
 .../src/main/java/org/trafodion/ci/Helper.java  |  225 +
 .../main/java/org/trafodion/ci/HostQuery.java   |  289 ++
 .../main/java/org/trafodion/ci/IDisplay.java    |   28 +
 .../main/java/org/trafodion/ci/IndexStruct.java |   55 +
 .../java/org/trafodion/ci/InterfaceQuery.java   | 4378 ++++++++++++++++++
 .../trafodion/ci/InterfaceQueryException.java   |   35 +
 .../org/trafodion/ci/InterfaceSyntaxError.java  |   83 +
 .../trafodion/ci/InvalidNumberOfArguments.java  |   35 +
 .../main/java/org/trafodion/ci/JDBCVproc.java   |   38 +
 .../java/org/trafodion/ci/LFProperties.java     |  130 +
 .../java/org/trafodion/ci/MaskingThread.java    |   73 +
 .../java/org/trafodion/ci/MultiByteUtils.java   |   56 +
 .../org/trafodion/ci/NullKeyWordException.java  |   35 +
 .../org/trafodion/ci/OutputColumnAttribute.java |   47 +
 .../java/org/trafodion/ci/OutputContents.java   |  144 +
 .../main/java/org/trafodion/ci/ParallelRun.java | 1320 ++++++
 .../org/trafodion/ci/ParamStringObject.java     |  256 +
 .../java/org/trafodion/ci/ParseArguments.java   |  660 +++
 .../src/main/java/org/trafodion/ci/Parser.java  | 1195 +++++
 .../ci/ParserMissingParamException.java         |   42 +
 .../trafciDefaultLookAndFeel.properties         |   60 +
 .../main/java/org/trafodion/ci/PrunSummary.java |  119 +
 .../org/trafodion/ci/PrunUserInterruption.java  |   34 +
 .../java/org/trafodion/ci/PythonInterface.java  |  180 +
 .../src/main/java/org/trafodion/ci/Query.java   |  188 +
 .../main/java/org/trafodion/ci/QueryUtils.java  |   37 +
 .../java/org/trafodion/ci/QueryWrapper.java     |  700 +++
 .../main/java/org/trafodion/ci/RawDisplay.java  |  189 +
 .../src/main/java/org/trafodion/ci/Reader.java  |  286 ++
 .../java/org/trafodion/ci/RepObjInterface.java  |   27 +
 .../java/org/trafodion/ci/ReplacementObj.java   |   39 +
 .../org/trafodion/ci/ScriptSectionNotFound.java |   34 +
 .../java/org/trafodion/ci/ScriptsInterface.java |  153 +
 .../src/main/java/org/trafodion/ci/Session.java | 1908 ++++++++
 .../java/org/trafodion/ci/SessionDefaults.java  |  342 ++
 .../java/org/trafodion/ci/SessionError.java     |  181 +
 .../java/org/trafodion/ci/SessionInterface.java | 1487 ++++++
 .../org/trafodion/ci/SessionTimeoutTask.java    |   93 +
 .../src/main/java/org/trafodion/ci/SqlEnum.java |   83 +
 .../java/org/trafodion/ci/StatusThread.java     |  100 +
 .../org/trafodion/ci/TerminalProcessBridge.java |  246 +
 .../trafodion/ci/UnKnownInterfaceCommand.java   |   34 +
 .../java/org/trafodion/ci/UserInterface.java    |  421 ++
 .../java/org/trafodion/ci/UserInterruption.java |   36 +
 .../src/main/java/org/trafodion/ci/Utils.java   |  381 ++
 .../java/org/trafodion/ci/ValidateQuery.java    |  412 ++
 .../org/trafodion/ci/ValidationException.java   |   39 +
 .../main/java/org/trafodion/ci/Vproc.java-tmpl  |   36 +
 .../main/java/org/trafodion/ci/WCIUtils.java    |  122 +
 .../src/main/java/org/trafodion/ci/Writer.java  |  418 ++
 .../main/java/org/trafodion/ci/XMLDisplay.java  |   75 +
 .../main/java/org/trafodion/ci/XMLObject.java   |  607 +++
 .../org/trafodion/ci/help/common_common.help    |  457 ++
 .../java/org/trafodion/ci/help/help_file.idx    |   30 +
 .../java/org/trafodion/ci/help/sql_common.help  |  376 ++
 .../org/trafodion/ci/pwdencrypt/ArgMap.java     |   61 +
 .../org/trafodion/ci/pwdencrypt/ArgsDef.java    |   74 +
 .../trafodion/ci/pwdencrypt/EncryptUtil.java    |  249 +
 .../java/org/trafodion/ci/pwdencrypt/JCE.java   |  414 ++
 .../trafodion/ci/pwdencrypt/PasswordOpts.java   |  292 ++
 .../org/trafodion/ci/pwdencrypt/RefLookup.java  |  127 +
 .../org/trafodion/ci/pwdencrypt/WorkTypes.java  |   55 +
 .../trafci/src/main/resources/install_jar.xml   |   49 +
 .../trafci/src/main/resources/install_tar.xml   |   29 +
 .../org/trafodion/ci/AWTExceptionHandler.java   |   36 -
 .../trafci/src/org/trafodion/ci/CSVDisplay.java |   90 -
 .../trafci/src/org/trafodion/ci/Column.java     |  131 -
 .../src/org/trafodion/ci/ConditionalQuery.java  |  435 --
 .../trafodion/ci/ConditionalQueryException.java |   43 -
 .../trafodion/ci/ConditionalSyntaxError.java    |  123 -
 .../src/org/trafodion/ci/ConsoleReader.java     |  218 -
 .../src/org/trafodion/ci/ConsoleWriter.java     |  130 -
 .../src/org/trafodion/ci/DatabaseQuery.java     | 1804 --------
 .../trafci/src/org/trafodion/ci/Display.java    |   68 -
 .../trafodion/ci/DuplicateParamException.java   |   40 -
 .../src/org/trafodion/ci/ErrorObject.java       |  103 -
 .../trafci/src/org/trafodion/ci/FCQuery.java    |  334 --
 .../trafci/src/org/trafodion/ci/FileReader.java |  176 -
 .../trafci/src/org/trafodion/ci/FileWriter.java |   80 -
 .../src/org/trafodion/ci/HTMLDisplay.java       |   80 -
 .../trafci/src/org/trafodion/ci/HTMLObject.java |  628 ---
 .../src/org/trafodion/ci/HelpIndexer.java       |  134 -
 .../trafci/src/org/trafodion/ci/Helper.java     |  225 -
 .../trafci/src/org/trafodion/ci/HostQuery.java  |  289 --
 .../trafci/src/org/trafodion/ci/IDisplay.java   |   28 -
 .../src/org/trafodion/ci/IndexStruct.java       |   55 -
 .../src/org/trafodion/ci/InterfaceQuery.java    | 4378 ------------------
 .../trafodion/ci/InterfaceQueryException.java   |   35 -
 .../org/trafodion/ci/InterfaceSyntaxError.java  |   83 -
 .../trafodion/ci/InvalidNumberOfArguments.java  |   35 -
 .../trafci/src/org/trafodion/ci/JDBCVproc.java  |   38 -
 .../src/org/trafodion/ci/LFProperties.java      |  130 -
 .../src/org/trafodion/ci/MaskingThread.java     |   73 -
 .../src/org/trafodion/ci/MultiByteUtils.java    |   56 -
 .../org/trafodion/ci/NullKeyWordException.java  |   35 -
 .../org/trafodion/ci/OutputColumnAttribute.java |   47 -
 .../src/org/trafodion/ci/OutputContents.java    |  144 -
 .../src/org/trafodion/ci/ParallelRun.java       | 1320 ------
 .../src/org/trafodion/ci/ParamStringObject.java |  256 -
 .../src/org/trafodion/ci/ParseArguments.java    |  660 ---
 .../trafci/src/org/trafodion/ci/Parser.java     | 1195 -----
 .../ci/ParserMissingParamException.java         |   42 -
 .../trafciDefaultLookAndFeel.properties         |   60 -
 .../src/org/trafodion/ci/PrunSummary.java       |  119 -
 .../org/trafodion/ci/PrunUserInterruption.java  |   34 -
 .../src/org/trafodion/ci/PythonInterface.java   |  180 -
 .../conn/trafci/src/org/trafodion/ci/Query.java |  188 -
 .../trafci/src/org/trafodion/ci/QueryUtils.java |   37 -
 .../src/org/trafodion/ci/QueryWrapper.java      |  700 ---
 .../trafci/src/org/trafodion/ci/RawDisplay.java |  189 -
 .../trafci/src/org/trafodion/ci/Reader.java     |  286 --
 .../src/org/trafodion/ci/RepObjInterface.java   |   27 -
 .../src/org/trafodion/ci/ReplacementObj.java    |   39 -
 .../org/trafodion/ci/ScriptSectionNotFound.java |   34 -
 .../src/org/trafodion/ci/ScriptsInterface.java  |  153 -
 .../trafci/src/org/trafodion/ci/Session.java    | 1908 --------
 .../src/org/trafodion/ci/SessionDefaults.java   |  342 --
 .../src/org/trafodion/ci/SessionError.java      |  181 -
 .../src/org/trafodion/ci/SessionInterface.java  | 1487 ------
 .../org/trafodion/ci/SessionTimeoutTask.java    |   93 -
 .../trafci/src/org/trafodion/ci/SqlEnum.java    |   83 -
 .../src/org/trafodion/ci/StatusThread.java      |  100 -
 .../org/trafodion/ci/TerminalProcessBridge.java |  246 -
 .../trafodion/ci/UnKnownInterfaceCommand.java   |   34 -
 .../src/org/trafodion/ci/UserInterface.java     |  421 --
 .../src/org/trafodion/ci/UserInterruption.java  |   36 -
 .../conn/trafci/src/org/trafodion/ci/Utils.java |  381 --
 .../src/org/trafodion/ci/ValidateQuery.java     |  412 --
 .../org/trafodion/ci/ValidationException.java   |   39 -
 .../conn/trafci/src/org/trafodion/ci/Vproc.java |   36 -
 .../trafci/src/org/trafodion/ci/WCIUtils.java   |  122 -
 .../trafci/src/org/trafodion/ci/Writer.java     |  418 --
 .../trafci/src/org/trafodion/ci/XMLDisplay.java |   75 -
 .../trafci/src/org/trafodion/ci/XMLObject.java  |  607 ---
 .../org/trafodion/ci/help/common_common.help    |  457 --
 .../src/org/trafodion/ci/help/help_file.idx     |   30 -
 .../src/org/trafodion/ci/help/sql_common.help   |  376 --
 .../src/org/trafodion/ci/pwdencrypt/ArgMap.java |   61 -
 .../org/trafodion/ci/pwdencrypt/ArgsDef.java    |   74 -
 .../trafodion/ci/pwdencrypt/EncryptUtil.java    |  249 -
 .../src/org/trafodion/ci/pwdencrypt/JCE.java    |  414 --
 .../trafodion/ci/pwdencrypt/PasswordOpts.java   |  292 --
 .../org/trafodion/ci/pwdencrypt/RefLookup.java  |  127 -
 .../org/trafodion/ci/pwdencrypt/WorkTypes.java  |   55 -
 168 files changed, 28643 insertions(+), 28368 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/.gitignore
----------------------------------------------------------------------
diff --git a/core/conn/trafci/.gitignore b/core/conn/trafci/.gitignore
index df8f375..6ca6f71 100644
--- a/core/conn/trafci/.gitignore
+++ b/core/conn/trafci/.gitignore
@@ -3,3 +3,6 @@ temp/
 utils/trafci.cmd
 utils/trafci.sh
 /target/
+/target/
+install/Installer.java
+src/main/java/org/trafodion/ci/Vproc.java

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/Makefile
----------------------------------------------------------------------
diff --git a/core/conn/trafci/Makefile b/core/conn/trafci/Makefile
new file mode 100644
index 0000000..3a64c00
--- /dev/null
+++ b/core/conn/trafci/Makefile
@@ -0,0 +1,11 @@
+all:Trafci_deploy
+Trafci_deploy:Trafci_installer
+Trafci_installer:Trafci_jar
+Trafci_jar:
+	mvn clean install$
+Trafci_installer:
+	./getBuildInfo$
+	export buildId=`head -n 1 buildId`$
+	mvn -f installer_pom.xml -DbldId=${buildId} clean package$
+Trafci_deploy:
+	java -jar target/trafciInstaller.jar -silent -jdbcFile ${MY_SQROOT}/export/lib/jdbcT4.jar -installDir ${MY_SQROOT}


[21/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/installer_pom.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/installer_pom.xml b/core/conn/trafci/installer_pom.xml
new file mode 100644
index 0000000..650c4c2
--- /dev/null
+++ b/core/conn/trafci/installer_pom.xml
@@ -0,0 +1,86 @@
+<!-- @@@ START COPYRIGHT @@@ (C) Copyright 2015 Esgyn Corporation @@@ END 
+	COPYRIGHT @@@ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.trafodion</groupId>
+	<artifactId>trafciInstaller</artifactId>
+	<packaging>jar</packaging>
+	<version>2.2.0</version>
+	<name>Trafodion Trafci</name>
+	<properties>
+		<basedir>.</basedir>
+		<traf-jdbc-version>${env.TRAFODION_VER}</traf-jdbc-version>
+		<trafci-version>${env.TRAFODION_VER}</trafci-version>
+	</properties>
+	<build>
+		<finalName>trafciInstaller</finalName>
+		<sourceDirectory>install</sourceDirectory>
+		<resources>
+			<resource>
+				<directory>${basedir}/src/main/resources</directory>
+				<excludes>
+					<exclude>install_jar.xml</exclude>
+					<exclude>install_tar.xml</exclude>
+				</excludes>
+			</resource>
+		</resources>
+		<outputDirectory>target/installer-classes</outputDirectory>
+		<plugins>
+			<plugin>
+				<artifactId>maven-antrun-plugin</artifactId>
+				<version>1.8</version>
+				<executions>
+					<execution>
+						<phase>generate-sources</phase>
+						<configuration>
+							<target>
+								<copy file="${basedir}/utils/trafci.cmd-tmpl" tofile="${basedir}/utils/trafci.cmd"
+									overwrite="true"></copy>
+								<copy file="${basedir}/utils/trafci.sh-tmpl" tofile="${basedir}/utils/trafci.sh"
+									overwrite="true">
+								</copy>
+								<echo message="BUILD trafodion prod version ${env.TRAFODION_VER_PROD}" />
+								<replace file="${basedir}/utils/trafci.cmd" token="@prodver@"
+									value="${env.TRAFODION_VER_PROD}" />
+								<replace file="${basedir}/utils/trafci.cmd" token="@copyrighthdr@"
+									value="${env.PRODUCT_COPYRIGHT_HEADER}" />
+								<replace file="${basedir}/utils/trafci.sh" token="##prodver##"
+									value="${env.TRAFODION_VER_PROD}" />
+								<replace file="${basedir}/utils/trafci.sh" token="##copyrighthdr##"
+									value="${env.PRODUCT_COPYRIGHT_HEADER}" />
+							</target>
+						</configuration>
+						<goals>
+							<goal>run</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<configuration>
+					<appendAssemblyId>false</appendAssemblyId>
+					<descriptors>
+						<descriptor>src/main/resources/install_jar.xml</descriptor>
+						<descriptor>src/main/resources/install_tar.xml</descriptor>
+					</descriptors>
+					<archive>
+						<manifest>
+							<mainClass>Installer</mainClass>
+						</manifest>
+					</archive>
+				</configuration>
+				<executions>
+					<execution>
+						<id>make-assembly</id>
+						<phase>package</phase>
+						<goals>
+							<goal>single</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/pom.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/pom.xml b/core/conn/trafci/pom.xml
new file mode 100644
index 0000000..159b2c6
--- /dev/null
+++ b/core/conn/trafci/pom.xml
@@ -0,0 +1,97 @@
+<!-- @@@ START COPYRIGHT @@@ (C) Copyright 2015 Esgyn Corporation @@@ END 
+	COPYRIGHT @@@ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.trafodion</groupId>
+	<artifactId>trafci</artifactId>
+	<packaging>jar</packaging>
+	<version>2.2.0</version>
+	<name>Trafodion Trafci</name>
+	<properties>
+		<jettyVersion>9.2.6.v20141205</jettyVersion>
+		<env.TRAFODION_VER>2.2.0</env.TRAFODION_VER>
+		<traf-jdbc-version>${env.TRAFODION_VER}</traf-jdbc-version>
+		<trafci-version>${env.TRAFODION_VER}</trafci-version>
+	</properties>
+	<dependencies>
+		<dependency>
+			<groupId>org.trafodion.jdbc.t4</groupId>
+			<artifactId>jdbcT4</artifactId>
+			<version>${traf-jdbc-version}</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<finalName>trafci</finalName>
+		<resources>
+			<resource>
+				<directory>${basedir}/src/main/java</directory>
+				<includes>
+					<include>**/*.idx</include>
+					<include>**/*.help</include>
+					<include>**/*.properties</include>
+				</includes>
+			</resource>
+			<resource>
+				<directory>${basedir}/src/main/resources</directory>
+				<excludes>
+					<exclude>install_jar.xml</exclude>
+					<exclude>install_tar.xml</exclude>
+				</excludes>
+			</resource>
+			<!-- <resource><directory>${basedir}/src/main/java/org/trafodion/ci/help</directory></resource> -->
+		</resources>
+		<plugins>
+			<plugin>
+				<artifactId>maven-antrun-plugin</artifactId>
+				<version>1.8</version>
+				<executions>
+					<execution>
+						<phase>generate-sources</phase>
+						<configuration>
+							<target>
+							<property name="vproc.version" value="TrafCI_Build_${bldId}"/>
+							<property name="vproc.dir" value="${basedir}/src/main/java/org/trafodion/ci"/>
+							<property name="Install.dir" value="${basedir}/install"/>
+								<copy file="${vproc.dir}/Vproc.java-tmpl" tofile="${vproc.dir}/Vproc.java"
+									overwrite="true"></copy>
+								<copy file="${Install.dir}/Installer.java-tmpl" tofile="${Install.dir}/Installer.java"
+									overwrite="true"></copy>
+								<echo message="BUILD Vproc version ${vproc.version}" />
+								<replace file="${vproc.dir}/Vproc.java" token="@@@"
+									value="${vproc.version}" />
+								<replace file="${Install.dir}/Installer.java"
+									token="@@@VPROC@@@" value="${vproc.version}" />
+							</target>
+						</configuration>
+						<goals>
+							<goal>run</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>3.5.1</version>
+				<configuration>
+					<source>1.7</source>
+					<target>1.7</target>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<version>2.3.1</version>
+				<configuration>
+					<archive>
+						<manifest>
+							<mainClass>org/trafodion/ci/Vproc</mainClass>
+						</manifest>
+					</archive>
+					<outputDirectory>${basedir}/lib</outputDirectory>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/AWTExceptionHandler.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/AWTExceptionHandler.java b/core/conn/trafci/src/main/java/org/trafodion/ci/AWTExceptionHandler.java
new file mode 100644
index 0000000..eceaada
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/AWTExceptionHandler.java
@@ -0,0 +1,36 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class AWTExceptionHandler{
+    
+    public AWTExceptionHandler(){
+    }
+    
+    public void handle(Throwable t)
+    { 
+        if(Boolean.getBoolean("trafci.enableTrace"))
+        {
+            System.out.println("TrafCI Captured AWT Stack Trace:");
+            t.printStackTrace();
+        }
+    } 
+}  

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/CSVDisplay.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/CSVDisplay.java b/core/conn/trafci/src/main/java/org/trafodion/ci/CSVDisplay.java
new file mode 100644
index 0000000..2db7575
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/CSVDisplay.java
@@ -0,0 +1,90 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+public class CSVDisplay implements IDisplay {
+
+	private Query qryObj;
+	private Writer writer=null;
+	private Session sessObj=null;
+	private int colCount=1;
+	
+	public CSVDisplay(Session sessObj)
+	{
+		if (sessObj != null)
+		{
+			this.sessObj = sessObj;
+			this.writer=sessObj.getWriter();
+			this.qryObj=sessObj.getQuery();
+		}
+	}
+
+	public void output(OutputContents contents) throws IOException {
+		// TODO Auto-generated method stub
+		if(contents!=null)
+		{
+			this.writer=sessObj.getWriter();
+			this.qryObj=sessObj.getQuery();
+			//display contents
+			ArrayList<OutputColumnAttribute> columns = contents.getColumns();
+			ArrayList<ArrayList<String>> alRows = contents.getRows();
+			qryObj.setColCount(String.valueOf(columns.size()));
+			
+			if(alRows!=null && alRows.size()>0)
+			{
+				for(int i=0;i<alRows.size();i++)
+				{
+					ArrayList<String> alRow = alRows.get(i);
+					if(alRow!=null && alRow.size()>0)
+					{
+						for(int j=0;j<alRow.size();j++)
+						{
+							writer.write(alRow.get(j));
+				            if (qryObj.getColCount() != null)
+				            {
+				               if (colCount == Integer.parseInt(qryObj.getColCount()))
+				               {
+				                  writer.write(SessionDefaults.lineSeperator);
+				                  colCount=1;
+				                  break;
+				               }
+				            }
+				            colCount++;
+				            if (sessObj.getStrDisplayFormat().equalsIgnoreCase("COLSEP"))
+				               writer.write(sessObj.getSessionColSep());
+				            else
+				               writer.write(",");
+				            //wrong code
+//				            break;
+						}
+					}
+					
+				}
+
+			}
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Column.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Column.java b/core/conn/trafci/src/main/java/org/trafodion/ci/Column.java
new file mode 100644
index 0000000..ac506a1
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Column.java
@@ -0,0 +1,131 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class Column
+{
+
+   Column()
+   {
+   }
+
+   int maxColSize = 0;
+   int actualColValSize = 0;
+   int maxDisplayColSize = 0;
+   int currentIndexPos = 0;
+   String columnName = null;
+
+   boolean isColWrap = false;
+   boolean isLeftAligned = true;
+   boolean isDone = false;
+   boolean isTrim=false;
+   boolean isHeader = false;
+
+   String colVal = null;
+   String fillerStr = null;
+   char fillChar = ' ';
+
+   // This method set the length for each column
+   public void setLength (int maxColSize, int maxDisplayColSize)
+   {
+      this.maxColSize = maxColSize;
+      this.maxDisplayColSize = maxDisplayColSize;
+      //Set columns wrapped to true if metadata colsize is greater than display colsize
+      this.isColWrap = this.maxColSize >  this.maxDisplayColSize?true:false;
+      //If columns are wrapped then, set the maximum display size to be that set by the session object
+		if (!isColWrap)
+			this.maxDisplayColSize = this.maxColSize;
+
+      //this.maxDisplayColSize = this.isColWrap?this.maxDisplayColSize:this.maxColSize;
+   }
+
+   // This method sets the filler character of space for each column based on the data for each column
+   public void setFillChar(char fillChar)
+   {
+      StringBuffer fillBuf = new StringBuffer();
+
+      for (int i = 0; i < this.maxDisplayColSize; i++)
+      {
+         fillBuf.append(fillChar);
+      }
+
+      this.fillerStr = fillBuf.toString();
+      fillBuf = null;
+   }
+
+   // This method set the column value
+   public void setColValue(String colVal)
+   {
+      if (this.isTrim)
+      {
+         colVal= colVal.trim(); //Remove the extra blanks 
+      }
+      this.actualColValSize = colVal.length();
+      //if column data length is greater than meta data legth then substring it to metadata length
+      this.colVal = this.actualColValSize > this.maxColSize?colVal.substring(0, this.maxColSize):colVal;
+      this.currentIndexPos = 0;
+      this.isDone = false;
+      this.isHeader =false;
+   }
+
+   public String getColValue()
+   {
+
+      if (isDone)
+         return this.fillerStr;
+
+      if (!this.isColWrap)
+      {
+         isDone = true;
+
+         if (this.isLeftAligned || this.isHeader)
+            return this.colVal.substring(this.currentIndexPos)+this.fillerStr.substring(this.colVal.substring(this.currentIndexPos).length(),this.maxDisplayColSize);
+         else
+            return this.fillerStr.substring(this.colVal.substring(this.currentIndexPos).length(),this.maxDisplayColSize)+this.colVal.substring(this.currentIndexPos);
+      }
+
+      if (currentIndexPos + this.maxDisplayColSize <= this.actualColValSize)
+      {
+         this.currentIndexPos += this.maxDisplayColSize;
+         return this.colVal.substring(this.currentIndexPos - this.maxDisplayColSize,this.currentIndexPos);
+      }
+      isDone = true;
+      if (this.isLeftAligned || this.isHeader)
+         return this.colVal.substring(this.currentIndexPos)+this.fillerStr.substring(this.colVal.substring(this.currentIndexPos).length(),this.maxDisplayColSize);
+      else
+         return this.fillerStr.substring(this.colVal.substring(this.currentIndexPos).length(),this.maxDisplayColSize)+this.colVal.substring(this.currentIndexPos);
+   }
+
+   public void setLeftAligned(boolean isLeftAligned)
+   {
+      this.isLeftAligned = isLeftAligned;
+   }
+
+   public boolean isDone()
+   {
+      return this.isDone;
+   }
+
+   public void setTrim(boolean isTrim)
+   {
+      this.isTrim=isTrim;
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalQuery.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalQuery.java
new file mode 100644
index 0000000..fba85ba
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalQuery.java
@@ -0,0 +1,435 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.regex.Pattern;
+
+public class ConditionalQuery extends QueryWrapper implements SessionDefaults{
+	
+	private HashMap<String, String> cqKeyMap = null;
+   	private String gotoLabel = "";				// the label we are waiting to see
+   	private int variableType = -1;
+	private int valueType = -1;
+	private String strPendingAction = null;
+   	
+   	/* types of values passed to conditional statements */
+   	private static final int VARIABLE = 0;
+   	private static final int STRING = 1;
+   	private static final int INTEGER = 2;
+   	/* enums not available in 1.4 :( */
+   	
+   	
+	/* Constructor */
+	public ConditionalQuery(){}
+	
+	public ConditionalQuery(Session sessObj){
+	    super(sessObj);
+	    cqKeyMap = new HashMap<String, String>();
+	    loadCqKeyWordMap();
+	}
+	
+	public void execute() throws ConditionalQueryException, UserInterruption, IOException
+	{
+		// reset error
+		cqe.setError(null);
+		
+		String label = null;
+		init();
+		isMultiLine = sessObj.getQuery().isMultiLine();
+		blankLiner = false;
+		readQuery();
+		blankLiner = true;
+		
+        // get the QueryId and directly process that command
+        switch (sessObj.getQuery().getQueryId())
+        {
+        	case IF_THEN:
+				if(!getGotoLabel().equals(""))
+					break;
+				
+				// reset types
+				valueType = -1;
+				variableType = -1;
+				
+				String variable = parser.getConditionalVariable(this.queryStr);
+				String operator = parser.getConditionalOperator(this.queryStr);
+				String value = parser.getConditionalValue(this.queryStr);
+				String action = parser.getConditionalAction(this.queryStr);
+				
+				if(variable == null || operator == null || value == null || action == null){
+					throw cqe;
+				}
+				
+				/* strip begin/end quotes and beginning % from variable */
+				variable = format(variable, true);
+				
+				if(variableType != STRING)
+				{
+					Object tmpObj = getValue(variable);
+					
+					if(tmpObj == null)
+					{
+						if(isInteger(variable))
+						{
+							variableType = INTEGER;
+						}
+						else
+						{
+							/* not a valid integer, must have been an unresolved variable */
+						    ErrorObject varNotFound = new ErrorObject(SessionError.VARIABLE_NOT_FOUND.errorCode(), 
+						                                              SessionError.VARIABLE_NOT_FOUND.errorMessage() + "'" + variable + "'.");
+							cqe.setError(varNotFound);
+							throw cqe;
+						}
+					}
+					else
+					{
+						variable = tmpObj.toString();
+						variableType = VARIABLE;
+					}
+					
+				}
+				
+				/* strip begin/end quotes and beginning % from value */
+				value = format(value, false);
+				
+				if(valueType != STRING)
+				{
+					Object tmpObj = getValue(value);
+					
+					if(tmpObj == null)
+					{
+						if(isInteger(value))
+							valueType = INTEGER;
+						else
+						{
+							/* not a valid integer, must have been an unresolved variable */
+						    ErrorObject varNotFound = new ErrorObject(SessionError.VARIABLE_NOT_FOUND.errorCode(), 
+						                                              SessionError.VARIABLE_NOT_FOUND.errorMessage() + "'" + value + "'.");
+							cqe.setError(varNotFound);
+							throw cqe;
+						}
+					}
+					else
+					{
+						value = tmpObj.toString();
+						valueType = VARIABLE;
+					}
+				}
+				
+				if(compare(variable, operator, value))
+				{
+					/* condition passed, set pending action */
+					strPendingAction = action + sessObj.getSessionSQLTerminator();
+				}
+				else
+				{
+					/* condition failed, do not set a pending action */
+					strPendingAction = null;
+				}
+				break;
+				
+			case GOTO:
+				if(!getGotoLabel().equals(""))
+					break;
+				
+				parser.getNextKeyToken(); // skip first token
+				label = parser.getNextValueToken();
+                
+				if(parser.hasMoreTokens())
+                    writeSyntaxError(this.queryStr,parser.getRemainderStr());
+                else
+                {
+    				if(label != null){
+    					setGotoLabel(label);
+                        writer.writeln();
+                        
+                        ErrorObject goto_msg = new ErrorObject(SessionError.GOTO_MESSAGE.errorCode(), 
+												SessionError.GOTO_MESSAGE.errorMessage() + label + "'command is encountered.",SessionError.GOTO_MESSAGE.errorType);
+                        writer.writeError(sessObj, goto_msg);
+                        
+    				}else
+    				    writeSyntaxError(this.queryStr,parser.getRemainderStr());
+                }
+                
+				break;
+				
+			case LABEL:
+				parser.getNextKeyToken(); // skip first token
+				label = parser.getNextValueToken();
+				
+				if(parser.hasMoreTokens())
+				    writeSyntaxError(this.queryStr,parser.getRemainderStr());
+				else
+				{
+    				if(label != null)
+    				{
+    				    if(label.equals(getGotoLabel())){
+    				        writer.writeln();
+                            writer.writeError(sessObj, SessionError.MATCHING_LABEL);
+    				        setGotoLabel("");
+    				    }
+    				}else if(getGotoLabel().equals(""))
+    				    writeSyntaxError(this.queryStr,parser.getRemainderStr());
+    				else
+    				{
+                        /* give a warning */
+                        ErrorObject labelWarning = new ErrorObject(SessionError.LABEL_WARNING.errorCode(), 
+                                                                  SessionError.LABEL_WARNING.errorMessage(),'W');
+                        cqe.setError(labelWarning);
+                        throw cqe;
+    				}
+				}
+				
+				break;
+		}
+	}
+
+	// change throws UserInterruption to custom error
+	public Object getValue(String variable) throws ConditionalQueryException
+	{
+		/* get the variable's value */
+		Object variableValue = null;
+		
+		if(variable.startsWith("?"))
+		{
+			variableValue = sessObj.getSessParams(variable.substring(1));
+			if(variableValue == null)
+			{
+			    ErrorObject paramNotFound = new ErrorObject(SessionError.PARAM_NOT_FOUND.errorCode(), 
+			                                                SessionError.PARAM_NOT_FOUND.errorMessage() + variable + " was not found");
+				cqe.setError(paramNotFound);
+				throw cqe;
+			}
+		}
+		else
+		{
+			variableValue = sessObj.getEnv(variable);
+		}
+		
+		return variableValue;
+	}
+	public boolean compare(String variable, String operator, String value) throws ConditionalQueryException
+	{
+		int compareType = -1;
+		
+		if(valueType != variableType)
+		{
+			if(valueType == VARIABLE)
+				compareType = variableType;
+			else if(variableType == VARIABLE)
+				compareType = valueType;
+			else if(variableType == INTEGER && valueType == STRING ||
+						variableType == STRING && valueType == INTEGER)
+			{
+				if(variableType == STRING)
+					cqe.setError(SessionError.STR_INT_COMPARISON);
+				else
+					cqe.setError(SessionError.INT_STR_COMPARISON);
+				
+				throw cqe;
+			}
+		}
+		else{
+			/* if both are variables, see if both are integers, 
+			 * otherwise treat them as strings
+			 */
+			if(valueType == VARIABLE)
+			{
+				if(isInteger(variable) && isInteger(value))
+					valueType = INTEGER;
+				else
+					valueType = STRING;
+			}
+			compareType = valueType;
+		}
+		
+		switch(compareType){
+			case STRING:
+					if(operator.equals("=") || operator.equals("=="))
+					{
+						return variable.equals(value);	
+					}
+					else if(operator.equals("<>") || operator.equals("!=") || 
+					        operator.equals("~=") || operator.equals("^="))
+					{
+						return !variable.equals(value);
+					}
+					else
+					{
+						
+					    if(operator.equals("<") || operator.equals(">") || operator.equals("<=") ||  operator.equals(">="))
+					    {
+				             ErrorObject invalidStrComp = new ErrorObject(SessionError.INVALID_STRING_COMPARE.errorCode(), 
+                                                                         SessionError.INVALID_STRING_COMPARE.errorMessage() + "'" + operator + "'.");
+      
+					        cqe.setError(invalidStrComp);
+					    }
+					    
+					    // invalid operator exception
+						throw cqe;
+					}
+					/* break not necessary, this is unreachable */
+			case INTEGER:
+					try
+					{
+						if(!(isInteger(variable) && isInteger(value)))
+						{
+							if(isInteger(value))
+								cqe.setError(SessionError.STR_INT_COMPARISON);
+							else
+								cqe.setError(SessionError.INT_STR_COMPARISON);
+							
+							throw cqe;
+						}
+						else
+						{
+							
+							int variableInt = Integer.parseInt(variable);
+							int valueInt = Integer.parseInt(value);
+							
+							if(operator.equals("=") || operator.equals("=="))
+							{
+								return variableInt == valueInt;	
+							}
+							else if(operator.equals("<>") || operator.equals("!=") || 
+							        operator.equals("~=") || operator.equals("^="))
+							{
+								return variableInt != valueInt;
+							}
+							else if(operator.equals("<"))
+							{
+								return variableInt < valueInt;
+							}
+							else if(operator.equals(">"))
+							{
+								return variableInt > valueInt;
+							}
+							else if(operator.equals("<="))
+							{
+								return variableInt <= valueInt;
+							}
+							else if(operator.equals(">="))
+							{
+								return variableInt >= valueInt;
+							}
+							else
+							{
+								// invalid operator exception
+								throw cqe;
+							}
+						}
+					}
+					catch(NumberFormatException nfe)
+					{
+						// TODO: FIX ERROR
+						nfe.printStackTrace();
+					}
+					/* break not necessary, this is unreachable */
+		}
+		
+		return false;
+	}
+	
+	/* strip out beginning % and quotes */
+	private String format(String var, boolean isVariable)
+	{
+		String temp = var;
+		
+		if(var.startsWith("%"))
+			temp = var.substring(1, var.length());
+		
+		
+		if(temp.startsWith("\"") && temp.endsWith("\""))
+		{
+			if(temp.length() > 2)
+				temp = temp.substring(1, temp.length()-1);
+			else
+				temp = "";
+			
+			if(isVariable)
+				variableType = STRING;
+			else
+				valueType = STRING;
+		}
+		
+		return temp;
+	}
+	
+	private void loadCqKeyWordMap()
+	{
+		cqKeyMap.put("IF", ""+IF_THEN);
+		cqKeyMap.put("LABEL", ""+LABEL);
+		cqKeyMap.put("GOTO", ""+GOTO);
+	}
+	
+	public boolean isInteger(String str)
+	{
+		return Pattern.matches("^-?\\d+$",str); 
+	}
+	
+	
+	/* 
+     * repeated code from interface query, perhaps move out of IQ and make public somewhere else?
+     */
+    private void writeSyntaxError(String queryStr, String remainderStr) throws IOException
+    {
+        sessObj.getQuery().setStatusCode(-1); // update the error code to -1
+        
+        if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+            writer.writeln();
+        
+        writer.writeSyntaxError(sessObj, this.queryStr,remainderStr);
+    }
+    
+    /* Getter/Setter Methods ****/
+	
+	private void setGotoLabel(String label){
+		this.gotoLabel = label;
+	}
+	
+	public String getGotoLabel(){
+		return this.gotoLabel;
+	}
+
+	public String getPendingAction(){
+		String tmpAction = strPendingAction;
+		strPendingAction = null;
+		return tmpAction;
+	}
+	
+	public boolean isPendingAction()
+	{
+		return strPendingAction != null;
+	}
+	
+	public void setQueryString(String q){
+		this.queryStr = q;
+	}
+	
+	public String getQueryString(){
+		return this.queryStr;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalQueryException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalQueryException.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalQueryException.java
new file mode 100644
index 0000000..bbce043
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalQueryException.java
@@ -0,0 +1,43 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class ConditionalQueryException extends Exception{
+
+	/**
+	 * 
+	 */
+    ErrorObject errMsg = null;
+	private static final long serialVersionUID = 1L;
+
+	ConditionalQueryException()
+	{
+		super();
+	}
+	
+	public ErrorObject getErrorMsg(){
+		return this.errMsg;
+	}
+	
+	public void setError(ErrorObject err){
+	    this.errMsg = err;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalSyntaxError.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalSyntaxError.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalSyntaxError.java
new file mode 100644
index 0000000..b8d09e7
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ConditionalSyntaxError.java
@@ -0,0 +1,123 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+public class ConditionalSyntaxError  {
+
+	
+	private StringBuffer errMesg=null;
+	private String errPrefix= "";
+
+	Pattern patVariable = Pattern.compile("^((?i:IF)(\\s|\\n)+((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^(\\n|\\s|!=|<>|>=|<=|>|<|=|==)]+)?)(.+)?\\z", Pattern.DOTALL);
+	Pattern patOperator = Pattern.compile("^((?i:IF)(\\s|\\n)+((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^(\\n|\\s|!=|<>|>=|<=|>|<|=|==)]+)(\\s|\\n)*(!=|<>|>=|<=|>|<|==|=)?)(.*)\\z", Pattern.DOTALL);
+	Pattern patValue    = Pattern.compile("^((?i:IF)(\\s|\\n)+((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^(\\n|\\s|!=|<>|>=|<=|>|<|=|==)]+)(\\s|\\n)*(!=|<>|>=|<=|>|<|==|=)(\\s|\\n)*((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^(\\s|\\n|!=|<>|>=|<=|>|<|=|==)]+)?)(.+)\\z", Pattern.DOTALL);
+
+	ConditionalSyntaxError()
+	{
+		
+	}
+	
+	public String testVariable(String qryString){
+		Matcher m = patVariable.matcher(qryString);
+		if(m.find())
+			return m.group(m.groupCount());
+		
+		return null;
+	}
+	
+	public String testOperator(String qryString){
+		Matcher m = patOperator.matcher(qryString);
+		if(m.find())
+			return m.group(m.groupCount());
+		
+		return null;	
+	}
+	
+	public String testValue(String qryString){
+		Matcher m = patValue.matcher(qryString);
+		if(m.find())
+			return m.group(m.groupCount()).trim();		
+		
+		return null;
+	}
+	
+	public void setSyntaxError(String qryString, String errLoc)
+	{
+		if(errMesg == null)
+		{
+			errMesg=new StringBuffer();
+		}
+	
+		this.errMesg.delete(0,errMesg.length());
+		
+		this.errMesg.append(errPrefix);
+		this.errMesg.append("\n");
+		this.errMesg.append(qryString);
+		this.errMesg.append("\n");
+
+		for(int i=0; i < qryString.length()-errLoc.length();i++)
+			this.errMesg.append(" ");
+		
+		this.errMesg.append("^");		
+	}
+	
+	public ErrorObject getSyntaxError(String qryString)
+	{
+		
+		if(qryString != null)
+		{
+			qryString=qryString.replaceAll("\\n"," ").trim();
+		}
+
+		String testVar = testVariable(qryString);
+		String testOp = testOperator(qryString);
+		String testVal = testValue(qryString);
+
+		String errLoc = "";
+		
+		if(testVal != null)
+		{
+			errPrefix = "A conditional syntax error occurred at or before:";
+			errLoc = testVal;
+		}
+		else if(testOp != null)
+		{
+			errPrefix = "A conditional operator syntax error occurred at or before:";
+			errLoc = testOp;
+		}
+		else
+		{
+			errPrefix = "A conditional variable syntax error occurred at or before:";
+			if(testVar == null)
+				testVar = qryString.charAt(qryString.length()-1)+"";
+
+			errLoc = testVar;
+		}
+		
+		setSyntaxError(qryString, errLoc);
+		return new ErrorObject(SessionError.GENERIC_SYNTAX_ERROR_CODE, errMesg.toString());
+	}
+	
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleReader.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleReader.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleReader.java
new file mode 100644
index 0000000..4e8545e
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleReader.java
@@ -0,0 +1,218 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import sun.misc.Signal;
+import sun.misc.SignalHandler;
+
+public class ConsoleReader
+{
+
+   private BufferedReader br=null;
+   private InputStream in=null;
+   private String line=null;
+   String newLine=SessionDefaults.lineSeperator;
+   String defaultEncoding="ISO-8859-1";
+   SignalHandler CTRLCHandler=null;
+   Signal INTSignal=null;
+   private boolean queryInterrupted=false;
+   private boolean doTrace = Boolean.getBoolean("trafci.enableTrace");
+   
+   StringBuffer lineBuffer=null;
+   private String prompt = SessionDefaults.DEFAULT_SQL_PROMPT;
+   private boolean time = false;
+   private boolean ampmFmt = false;
+   private MaskingThread mt=null;
+   WCIUtils wcs=null;
+
+   ConsoleReader()
+   {
+      newLine=System.getProperty("line.separator");
+      defaultEncoding=System.getProperty("file.encoding");
+    
+      CTRLCHandler = new MySignalHandlerClass();
+      try {
+      INTSignal=new Signal("INT");
+      } catch (Exception e) {}
+   }
+
+   public void setPrompt(String ps, boolean time, boolean ampmFmt)
+   {
+      this.prompt = ps;
+      this.time = time;
+      this.ampmFmt = ampmFmt;
+   }
+
+   public void setMaskingThread(MaskingThread mt, WCIUtils wcs)
+   {
+      this.mt = mt;
+      this.wcs=wcs;
+   }
+ 
+   private class MySignalHandlerClass implements SignalHandler
+   {
+      public void handle(Signal sig)
+      {
+         if (null != lineBuffer)  
+            lineBuffer.setLength(0);
+
+         queryInterrupted = true;
+        
+         if (mt!=null)
+         {
+            mt.stopMasking();
+            if (wcs!= null)wcs.enableEcho();
+         }
+
+         String timeStamp = "";
+         SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss ");
+         if (time)
+         {
+            if (ampmFmt)
+               timeStamp = DateFormat.getTimeInstance().format(new Date())+ " ";
+            else
+               timeStamp = sdf.format(new Date());
+         }
+
+         System.out.print("^C"+SessionDefaults.lineSeperator+SessionDefaults.lineSeperator + timeStamp+prompt);
+      }
+   }
+
+   public void initialize() throws IOException
+   {
+      this.in=System.in;
+   }
+
+   public String getLine() throws IOException, UserInterruption
+   {
+      next();
+      return this.line;
+   }
+
+   public String readLine() throws UnsupportedEncodingException, UserInterruption, IOException
+   {
+      StringBuffer lineBuffer=null;
+      lineBuffer=new StringBuffer();
+	  int i=-1;
+            
+      try {
+         if (CTRLCHandler != null)
+         {
+            Signal.handle(INTSignal, CTRLCHandler);
+         }
+      } catch (Exception e) {}
+
+      while (true)
+      {
+         queryInterrupted = false;
+         this.in.mark(1);
+         try{
+         if ((i = this.in.read()) != -1)
+         {
+            if (queryInterrupted)
+            {
+               in.reset();
+               throw new UserInterruption();
+            }
+
+            lineBuffer.append((char)i);
+            line = lineBuffer.toString();
+            
+            if (!defaultEncoding.equalsIgnoreCase("Cp1047")) 
+            {
+               byte[] ba=line.getBytes("ISO-8859-1"); // added for nls character support
+               line=new String(ba,defaultEncoding);
+            }
+            
+            if (line != null && line.endsWith(newLine))
+            {
+               return line.substring(0,line.length() - newLine.length());
+            }
+         }
+         }catch (ArrayIndexOutOfBoundsException e)
+         	{        	 
+        	 	 System.out.println(SessionError.OUT_OF_BOUNDS);
+        	 	 
+        	 if(doTrace)
+        	 {
+        		 e.printStackTrace();
+        	 }
+         	}
+                 
+         if (queryInterrupted)
+         {
+            in.reset();
+            throw new UserInterruption();
+
+         }
+      }
+
+   }
+
+   public boolean next() throws IOException, UserInterruption
+   {
+      //line=this.br.readLine();
+      line=this.readLine();
+      return true;
+   }
+
+   public void close() throws IOException
+   {
+      this.br.close();
+      this.br=null;
+   }
+
+   public boolean isQueryInterrupted()
+   {
+      return queryInterrupted;
+   }
+
+   public void setQueryInterrupted(boolean queryInterrupted)
+   {
+      this.queryInterrupted = queryInterrupted;
+   }
+
+   public boolean isInteractive()
+   {
+      int num = 1;
+      try
+      {
+         num = this.in.available();
+         //System.out.println("\nNumber of input stream bytes=" + num);
+      }
+      catch (IOException ioe)
+      {
+         return false;
+      }
+
+      return (num <= 0 ? true:false);
+   }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleWriter.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleWriter.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleWriter.java
new file mode 100644
index 0000000..dac2110
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ConsoleWriter.java
@@ -0,0 +1,130 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+
+public class ConsoleWriter
+{
+   private PrintStream ps=null;
+   private PrintStream systemOS = System.out;
+   private ByteArrayOutputStream out=null;
+   private boolean consoleOut=true;
+
+   ConsoleWriter()
+   {
+   }
+
+   /*public void initializeByteArray()
+   {
+   out=new ByteArrayOutputStream();
+   System.setOut(new PrintStream(out));
+   consoleOut=false;
+   }*/
+
+   public void initialize() throws IOException
+   {	   
+	   setupOutputStream();
+   }
+   
+   private void setupOutputStream() {
+      if (consoleOut) {
+    	  System.setOut(systemOS);
+      }
+      else
+      {
+         out=new ByteArrayOutputStream();
+         System.setOut(new PrintStream(out));
+      }
+      
+      this.ps = System.out;
+   }
+
+
+   public void println(String line)
+   {
+      this.ps.println(line);
+   }
+
+   public void print(String line)
+   {
+      this.ps.print(line);
+   }
+
+   public void println()
+   {
+      this.ps.println();
+   }
+
+   public void setConsoleOut(boolean consoleOut)
+   {
+      this.consoleOut=consoleOut;
+      setupOutputStream();
+   }
+
+   public boolean getConsoleOut()
+   {
+      return this.consoleOut;
+   }
+   /*
+   public void println(String line)
+   {
+   System.out.println(line);
+   }
+
+   public void print(String line)
+   {
+   System.out.print(line);
+   }
+
+   public void println()
+   {
+   System.out.println();
+   }
+   */
+   public String getResult()
+   {
+      if (out == null)
+      {
+         return null;
+      }
+      else
+      {
+         return out.toString();
+      }
+   }
+
+   public void resetStream()
+   {
+      if (this.out != null)
+      {
+         this.out.reset();
+      }
+   }
+
+   public void close()
+   {
+      this.ps.close();
+   }
+
+}



[06/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ParseArguments.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ParseArguments.java b/core/conn/trafci/src/org/trafodion/ci/ParseArguments.java
deleted file mode 100644
index 57944a0..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ParseArguments.java
+++ /dev/null
@@ -1,660 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-public class ParseArguments
-{
-
-   String[] args=null;
-   int noOfArgs=0;
-   String userName=null;
-   String roleName=null;
-   String password=null;
-   String serverName=null;
-   String portNumber=null;
-   String dsnName=null;
-   String queryStr=null;
-   String fileName=null;
-   String defaultDsnName=null;
-   String defaultPortNumber=null;
-   boolean noConnectOption=false;  // set to true if noconnection option is specified.
-   boolean isLaunchConnect=true;
-   boolean autoLogin=false;
-   boolean dfm=false; 
-   /*-------------------------------------------------------------------------------**
-   The isLaunchConnect flag is set to true when connection args are validated at
-   the application launch time to validate the type of args the can be entered 
-   for example -s and -sql can be entered only at launch.
-   **-------------------------------------------------------------------------------*/
-   ConsoleReader crObj=null;
-   ConsoleWriter cwObj=null;
-   static int retryCntProp=0;
-   int retryCnt=1;
-   String osName=null;
-   final String  EXIT_PROD_STR = "Exiting " + SessionDefaults.PROD_NAME + " - Please hit <Enter> ... ";
-   static
-   {
-      String loginRetries=null;
-
-      //Prompt for n login retries if property set
-      loginRetries=System.getProperty ("trafci.loginRetries");
-      if (loginRetries!=null) 
-         if ((retryCntProp = Integer.parseInt(loginRetries.trim())) <= 0)
-            retryCntProp = 1;
-   }
-
-   ParseArguments()
-   {
-
-   }
-
-   ParseArguments(ConsoleReader crObj,ConsoleWriter cwObj)
-   {
-      this.crObj=crObj;
-      this.cwObj=cwObj;
-
-      //Prompt for login input retries if in console/interactive mode
-      if (crObj.isInteractive()) 
-         this.retryCnt=3;
-
-      /*-------------------------------------------------------------------------**
-      //Prompt for n login retries if property set
-      String loginRetries=System.getProperty ("trafci.loginRetries");
-      if (loginRetries!=null) 
-      if ((this.retryCnt = Integer.parseInt(loginRetries.trim())) <= 0)
-      this.retryCnt = 1;
-      **-------------------------------------------------------------------------*/
-      if (retryCntProp > 0)
-         retryCnt = retryCntProp;
-
-   }
-
-   private void setArgs(String[] args)
-   {
-      noOfArgs=args.length;
-      this.args=args;
-   }
-
-   public void setDefaults(String dsnName,String portNumber)
-   {
-      this.defaultDsnName=dsnName;
-      this.defaultPortNumber=portNumber;
-   }
-
-   public String[] validateArgs(String[] args,boolean isLaunchConnect) 
-      throws InvalidNumberOfArguments, IOException, UserInterruption
-   {
-
-      osName = System.getProperty("os.name");
-      setArgs(args);
-      this.isLaunchConnect=isLaunchConnect;
-
-      List<String> argsList= new ArrayList<String>(Arrays.asList(args));
-      
-      //Pre-parse args for special cases
-      if (argsList.contains("-version"))
-      {
-         cwObj.print("JDBC Type 4 Driver Build ID : ");
-         cwObj.println(JDBCVproc.getVproc());
-         cwObj.print("Command Interface Build ID  : ");
-         org.trafodion.ci.Vproc.main(args) ;
-         cwObj.println("");
-         System.exit(0);   //any other args included w/version are ignored
-      }
-
-      //Display argument help if -help argument is passed
-      if (argsList.contains("-help"))
-      {
-    	   printUsage();
-         System.exit(0);   //any other args included w/help are ignored
-      }
-
-      
-      // No retries if in query mode
-      if (argsList.contains("-q") || argsList.contains("-sql"))
-         retryCnt = 1;
-
-      
-      if (argsList.remove("-noconnect"))
-      {
-          noConnectOption=true;
-      }
-
-      if (argsList.remove("-dfm"))
-      {
-          dfm = true;
-      }
-      
-      /* reset args b/c of -noconnect or -dfm, dont need the if but perhaps a small perf gain? */
-      if(dfm || noConnectOption)
-      {
-          args = null;
-          args = new String[argsList.size()];
-          //args = (String[])
-          argsList.toArray(args);
-          noOfArgs = args.length;
-      }
-
-      // the number of arguments must be an odd number if -noconnect option is specified
-      // otherwise it should be an even number
-
-      if (noOfArgs % 2 != 0 || noOfArgs > 14)
-      {
-         printUsage();
-         throw new InvalidNumberOfArguments();
-      }
-
-      
-      argsList=null;
-      
-      //Pre-parsing complete
-      
-      for (int i=0;i < noOfArgs; i++)
-      {
-         String option=args[i++].trim();
-         String value=args[i].trim();
-
-         if (option.equalsIgnoreCase("-u")|| option.equalsIgnoreCase("-user"))
-         {
-            userName=value;
-         }
-         else if (option.equalsIgnoreCase("-p")|| option.equalsIgnoreCase("-password"))
-         {
-            password=value;
-         }
-         else if (option.equalsIgnoreCase("-r")|| option.equalsIgnoreCase("-role"))
-         {
-        	 roleName=value;        	 
-         }              
-         else if (option.equalsIgnoreCase("-h")|| option.equalsIgnoreCase("-host"))
-         {
-            String[] hostAddr=value.split(":");
-            if (hostAddr.length > 0)
-               serverName=hostAddr[0];
-            else
-               serverName="";
-
-            String portValue="";
-
-            for (int j=1; j < hostAddr.length;j++)
-            {
-               portValue+=":"+hostAddr[j];
-            }
-            if (portValue.length() > 0)
-            {
-               portNumber=portValue;
-            }
-
-         }
-         else if (isLaunchConnect && (option.equalsIgnoreCase("-q")|| option.equalsIgnoreCase("-sql")))
-         {
-            queryStr=value;
-            if (fileName != null)
-            {
-               cwObj.println("-s|script and -q|sql options must not be specified together.");
-               this.printUsage();
-            }
-         }
-         else if (isLaunchConnect &&(option.equalsIgnoreCase("-s")|| option.equalsIgnoreCase("-script")))
-         {
-            fileName=value;
-            if (queryStr != null)
-            {
-               cwObj.println("-s|script and -q|sql options must not be specified together.");
-               this.printUsage();
-            }
-         }
-         /* Instead of -cmd we will implement a set cmdecho <on|off> command 
-          * and replace -cmd with -DFM which will execute both set lookandfeel mxci and
-          * set cmdecho on
-          * 
-          * else if (isLaunchConnect &&(option.equalsIgnoreCase("-cmd")))
-         {
-            if (value.equalsIgnoreCase("Y"))
-               cmdEcho = true;
-         }*/
-         else
-         {
-            cwObj.println("Unknown option " + option + " specified.");
-            printUsage();
-            throw new UnknownHostException();
-         }
-
-      } //end for
-      
-      if (!noConnectOption)
-      {
-         do
-         {
-
-            if (serverName == null)
-            {
-               String value= getRequiredArg("Host Name/IP Address: ");
-               String[] hostAddr=value.split(":");
-               if (hostAddr.length > 0)
-                  serverName=hostAddr[0];
-               else
-                  serverName="";
-               String portValue="";
-               for (int j=1; j < hostAddr.length;j++)
-               {
-                  portValue+=":"+hostAddr[j];
-               }
-               portNumber=null;
-               if (portValue.length() > 0)
-               {
-                  portNumber=portValue;
-               }
-            }
-
-
-            try
-            {
-               if (serverName.trim().equals(""))
-                  throw new UnknownHostException("Host Name is empty");
-               else
-                  InetAddress.getByName(serverName);
-            }
-            catch (UnknownHostException uh)
-            {
-               cwObj.println(SessionDefaults.lineSeperator+"Unknown Host: " + serverName + SessionDefaults.lineSeperator);
-               serverName=null;
-
-               //Rebuild the argument list to remove the hostname
-               args = this.rebuildArgList(args);
-               if ((--retryCnt) == 0)
-                  throw uh;
-            }
-
-         }while (serverName==null && retryCnt > 0);
-      }
-
-
-      if (!noConnectOption && userName == null)
-      {
-         do
-         {
-            userName=getRequiredArg("User Name: ");
-         }
-         while (userName.trim().equals(""));
-      }
-
-      if (!noConnectOption && password == null)
-      {
-         password=getPassword("Password: ");
-      }
-     
-      if (!noConnectOption && roleName == null) 
-      {    	 
-    		  roleName=getRequiredArg("Role Name [Primary Role]: "); 
-    		
-    		      	  
-      }
-      
-      if (portNumber == null)
-      {
-         portNumber=":"+defaultPortNumber;
-      }
-      
-      
-      return args;
-
-   }
-
-   public String[] validateArgs(String[] args) throws InvalidNumberOfArguments, IOException, UserInterruption
-   {
-      return (validateArgs(args,false));
-   }
-
-   private String getRequiredArg(String prompt) throws IOException, UserInterruption
-   {
-      String value=null;
-      String breakConnectPrompt = EXIT_PROD_STR;
-      if (!this.isLaunchConnect) 
-         breakConnectPrompt = "Command Interrupted - Please hit <Enter> ... "+SessionDefaults.lineSeperator;
-
-      crObj.setPrompt(breakConnectPrompt,false,false);
-      cwObj.print(prompt);
-
-      //set retry count to 0 if user hits a Ctrl+C while entering login parameters
-      try
-      {
-         value=crObj.getLine();
-      } catch (UserInterruption ui)
-      {
-         retryCnt = 0;
-         throw ui;
-      }
-      return value;
-   }
-
-   private void printUsage()
-   {
-	  String  os_specific_ci_cmd = "trafci";
-	  
-	  String spacedOutLine = SessionDefaults.lineSeperator;
-      for (int idx = 0; idx < os_specific_ci_cmd.length(); idx++)
-          spacedOutLine += " ";
-
-      cwObj.println(SessionDefaults.lineSeperator + os_specific_ci_cmd +
-              " -h[ost] <databaseserver:port> " +
-              spacedOutLine +
-              " -u[ser] <username> -p[assword] <password>" +
-              spacedOutLine +
-              " -r[ole] <rolename>" +
-              spacedOutLine +
-              " -s[cript] <scriptfilename> -q|-sql <\"querystring\">" +
-              spacedOutLine +
-              " -noconnect -version -help" );
-
-      cwObj.println(SessionDefaults.lineSeperator+"where:");
-      cwObj.println("\t-h[ost]     specifies the database server including the port number.");
-      cwObj.println("\t-u[ser]     specifies a user name to log into a database server.");
-      cwObj.println("\t-p[assword] specifies the user's password to log into a database server.");
-      cwObj.println("\t-r[ole]     specifies the role name associated with the user.");
-      cwObj.println("\t-s[cript]   specifies the command file used to customize a session.");
-      cwObj.println("\t-q|-sql     specifies the command to be run in non-interactive mode.");
-      cwObj.println("\t-noconnect  specifies the session login mode.");
-      cwObj.println("\t-version    displays the Trafodion Command Interface and JDBC Type 4 Driver versions, then exits.");
-      cwObj.println("\t-help       displays a list of accepted arguments with descriptions, then exits.");     
-      cwObj.println("");
-
-   }
-
-   /*------------------------------------------------------------------**
-   **    private String getPassword (String prompt) throws IOException { **
-   **          MaskingThread et = new MaskingThread(prompt);             **
-   **          Thread mask = new Thread(et);                             **
-   **          mask.start();                                             **
-   **                                                                  **
-   **         String password = "";                                      **
-   **                                                                  **
-   **          password = crObj.getLine();                               **
-   **          // stop masking                                           **
-   **          et.stopMasking();                                         **
-   **          // return the password entered by the user                **
-   **          return password;                                          **
-   **       }                                                            **
-   **------------------------------------------------------------------*/
-   
-   public String getPassword (String prompt) throws IOException, UserInterruption
-   {
-      String password = "";
-      WCIUtils wcs=null;
-      boolean isWindows = System.getProperty("os.name").toUpperCase().startsWith("WINDOW");
-
-      MaskingThread et = new MaskingThread(prompt);
-      Thread mask = new Thread(et);
-      mask.start();
-
-      // if it is windows envrionment use the dll to disable echo
-      if (isWindows)
-      {
-    	  try { 
-	         wcs=new WCIUtils();
-	         wcs.disableEcho();
-         
-    	  } catch(Throwable e) { }
-    	  
-      }
-      crObj.setMaskingThread(et,wcs);
-
-      String breakConnectPrompt = EXIT_PROD_STR;
-      if (!this.isLaunchConnect) 
-         breakConnectPrompt = "Command Interrupted - Please hit <Enter> ... "+SessionDefaults.lineSeperator;
-
-      crObj.setPrompt(breakConnectPrompt,false,false);
-
-
-      try
-      {
-         password = crObj.getLine();
-      }
-      catch (Throwable t)
-      {
-         UserInterruption  uie = null;
-         if (t instanceof UserInterruption)
-         {
-            uie =(UserInterruption) t;
-            retryCnt = 0;
-         }
-         else
-            uie = new UserInterruption();
-
-
-         throw uie;
-      }
-      finally
-      {
-
-         // stop masking
-         et.stopMasking();
-
-         if (isWindows)
-         {
-        	 try {
-	            wcs.enableEcho();
-	            
-        	 } catch(Exception e) { }
-        	 
-            wcs=null;
-         }
-         cwObj.print(SessionDefaults.lineSeperator);
-      }
-      // return the password entered by the user
-      return password;
-   }
-
-    public String getInputMask (String prompt, boolean isInputMask) throws IOException, UserInterruption
-   {
-      String password = "";
-      WCIUtils wcs=null;
-      boolean isWindows = System.getProperty("os.name").toUpperCase().startsWith("WINDOW");
-
-      MaskingThread et = new MaskingThread(prompt);
-      Thread mask = new Thread(et);
-      mask.start();
-
-      // if it is windows envrionment use the dll to disable echo
-      if (isWindows)
-      {
-    	  try {
-	         wcs=new WCIUtils();
-	         wcs.disableEcho();
-	         
-    	  } catch(Throwable e) { }
-      }
-      crObj.setMaskingThread(et,wcs);
-
-      String breakConnectPrompt = EXIT_PROD_STR;
-      if (!this.isLaunchConnect || isInputMask ) 
-         breakConnectPrompt = "Command Interrupted - Please hit <Enter> ... "+SessionDefaults.lineSeperator;
-
-      crObj.setPrompt(breakConnectPrompt,false,false);
-      
-      try
-      {
-         password = crObj.getLine();
-      }
-      catch (Throwable t)
-      {
-         UserInterruption  uie = null;
-         if (t instanceof UserInterruption)
-         {
-            uie =(UserInterruption) t;
-            retryCnt = 0;
-         }
-         else
-            uie = new UserInterruption();
-
-
-         throw uie;
-      }
-      finally
-      {
-
-         // stop masking
-         et.stopMasking();
-
-         if (isWindows)
-         {
-            try {
-            	wcs.enableEcho();
-            	
-            } catch(Exception e) { }
-            
-            wcs=null;
-         }
-         cwObj.print(SessionDefaults.lineSeperator);
-      }
-      // return the password entered by the user
-     
-      return password;
-   }
-
-
-   public String getInputNomask (String prompt, boolean isNotInputMask) throws IOException, UserInterruption
-   {
-      String userInput = "";
-
-      String breakConnectPrompt = EXIT_PROD_STR;
-      if (isNotInputMask) 
-         breakConnectPrompt = "Command Interrupted - Please hit <Enter> ... ";
-
-      crObj.setPrompt(breakConnectPrompt,false,false);
-     
-      try
-      {
-         System.out.print( "                                 \r" + prompt  );
-         userInput = crObj.getLine();
-      }
-      catch (Throwable t)
-      {
-         UserInterruption  uie = null;
-         if (t instanceof UserInterruption)
-         {
-            uie =(UserInterruption) t;
-            retryCnt = 0;
-         }
-         else
-            uie = new UserInterruption();
-
-
-         throw uie;
-      }
-      finally
-      {
-         cwObj.print(SessionDefaults.lineSeperator);
-      }
-      // return characters entered by the user
-      return userInput;
-   }
-
-
-   public String[] rebuildArgList(String[] oldArgs)
-   {
-      int i;
-      List<String> argsList= new ArrayList<String> (Arrays.asList (oldArgs));
-
-      if (argsList.isEmpty())
-         return oldArgs;
-
-      String argKey1 = null;
-      String argKey2 = null;
-      String argKey3 = null;
-      String argKey4 = null;
-      String argKey5 = null;
-      String argKey6 = null;
-
-      if (this.userName == null || this.password == null || this.roleName ==null)
-      {
-         argKey1 = "-u";
-         argKey2 = "-p";
-         argKey3 = "-user";
-         argKey4 = "-password";
-         argKey5 = "-r";
-         argKey6 = "-role";
-      }
-      else if (this.dsnName == null)
-      {
-          argKey1 = "-d";
-          argKey3 = "-dsn";
-      }
-      else if (this.serverName == null)
-      {
-         argKey1 = "-h";
-         argKey3 = "-host";
-      }
-      else
-         return oldArgs;
-
-      do
-      {
-         if (((i = argsList.indexOf(argKey1)) >= 0) || 
-        	 ((i = argsList.indexOf(argKey3)) >= 0) ||
-        	 ((i = argsList.indexOf(argKey5)) >= 0) )
-         {
-            argsList.remove(i);
-            argsList.remove(i);
-         }
-      }
-      while (i > -1);
-
-      do
-      {
-         if ((argKey2 != null) && (((i = argsList.indexOf(argKey2)) >= 0 ) || 
-        		                   ((i = argsList.indexOf(argKey4)) >= 0 )) ||
-        		                   ((i = argsList.indexOf(argKey6)) >= 0 ))
-         {
-            argsList.remove(i);
-            argsList.remove(i);
-         }
-      }
-      while (i > -1);
-
-      String[] newArgs=new String[argsList.size ()];
-      argsList.toArray (newArgs);
-      return newArgs;
-
-   }
-   
-   
-
-   public boolean isAutoLogin()
-   {
-      return autoLogin;
-   }
-
-   public void setAutoLogin(boolean autoLogin)
-   {
-      this.autoLogin = autoLogin;
-   }
-
-   
-   
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Parser.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Parser.java b/core/conn/trafci/src/org/trafodion/ci/Parser.java
deleted file mode 100644
index a130032..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Parser.java
+++ /dev/null
@@ -1,1195 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.ArrayList;
-import java.util.List;
-
-public class Parser
-{
-   private String remainderStr=null;
-   Pattern filePat=Pattern.compile("^\\s*((\"(\"(?=\")|.)*\")|\\S*)(\\s+(.*)|$)");
-   Pattern numberPat=Pattern.compile("^\\s*((-)?\\d+)(\\s+(.*)|$)");
-   Pattern paramPat=Pattern.compile("^\\s*(\\??)([a-zA-Z_]\\w*)(\\s+(.*)|$)");
-   Pattern keyPat=Pattern.compile("^\\s*(\\S+)(\\s+(.*)|\\z)",Pattern.DOTALL);
-   Pattern ignoreCommentsPat=Pattern.compile("(?m)((^--)|^)((((?!--|\').)*)*(\\s*((\'(\'(?=\')|\\\\(?=\')|(?!\').)*\')*(((?!--|\').)*)*)\\s*)*)");
-   Pattern pstmtPat=Pattern.compile("^\\s*((\"[a-zA-Z_]\\w*\")|[a-zA-Z_]\\w*)(\\s+(.*)|$)",Pattern.DOTALL);
-   Pattern explainPat = Pattern.compile( "(^\\s*(?i)EXPLAIN(\\s+(?i)OPTIONS\\s+\'f\')?)\\s+((\"[a-zA-Z_]\\w*\")|[a-zA-Z_]\\w*)\\s*$",Pattern.DOTALL);
-   Pattern valPat=Pattern.compile("^\\s*((\"(\"(?=\")|\\\\(?=\")|.)*?\")|(\\S+))(\\s*(.*)|$)");
-   Pattern val2Pat=Pattern.compile("^\\s*((\'(\'(?=\')|\\\\(?=\')|.)*\')+|(\\S+))(\\s+(.*)|$)");
-   /**
-    * Support _UTF8 for set PARAM
-    */
-   Pattern paramValuePat=Pattern.compile("^\\s*(((_[iI][sS][oO]88591|_[uU][cC][sS]2|_[uU][tT][fF]8|_[kK][aA][nN][jJ][iI]|_[kK][sS][cC]5601)?(\\s*[xX])?(\'(.*)\'))|(\\S+))(\\s+(.*)|$)");
-   Pattern catalogPat=Pattern.compile("(\"(?:[^\"\\\\]|\"\"|\\\\.)*\"|\\S+)(\\s*.*|$)");   
-   Pattern tabPat=Pattern.compile("^\\s*((\"(\"(?=\")|\\\\(?=\")|.)*?\")|(\\w+));*\\s*(\\.(.*)|$|(,\\s*(?i)[A-Zz-z]*(.*)?$))",Pattern.DOTALL);
-   //Pattern paramListPat=Pattern.compile("^\\s*(\\??)((\'(\'(?=\')|\\\\(?=\')|.)*?\')|([^ ,]+))\\s*(,\\s*(.*)|$)",Pattern.DOTALL);
-   Pattern paramListPat=Pattern.compile("^\\s*((\'(\'(?=\')|\\\\(?=\')|.)*?\')|([^ ,]+))\\s*(,\\s*(.*)|$)",Pattern.DOTALL);
-   Pattern mapListPat=Pattern.compile("^\\s*((\"(\"(?=\")|\\\\(?=\")|.)*?\")*([^,]+))\\s*(,\\s*(.*)|$)",Pattern.DOTALL);
-   Pattern exitPat=Pattern.compile("(?i)^\\s*((WITH\\s+(-?\\d+))|(-?\\d+))?(\\s+IF(?!.*THEN.*).+)?$");
-   Pattern sectionPat=Pattern.compile("^\\s*\\(\\s*([a-zA-Z_]\\w*)\\s*\\)(\\s*$)");
-   Pattern mxciParamPat = Pattern.compile("^\\?(.*)");
-   Pattern dbFunctionPat = Pattern.compile("(?i)FN:(\\w+\\((.*)\\))");
-   Pattern mapFileFixedWidthColPat = Pattern.compile("^\\s*COLPOS\\((\\d+):(\\d+)\\).*$");
-   Pattern envPat=Pattern.compile("%([a-zA-Z]+)(.*)");
-   Pattern scriptPat=Pattern.compile("(?i)^\\s*(SRUN)\\s+(.*)");
-   Pattern connUserPat=Pattern.compile("([^,/@]+)(.*)");
-   Pattern connUserPreparePat=Pattern.compile("(^\".*?\")(.*)");
-   Pattern connPassPat=Pattern.compile("^/((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^@,]*)(@.*$|,.*$|$)");
-   Pattern connServerPat=Pattern.compile("^@([^,]+)(,.*$|$)");
-   Pattern connDsnPat=Pattern.compile("^,(.+)($)");
-   Pattern errPat = Pattern.compile("\\*\\*\\* (ERROR|WARNING)\\[(\\w*)\\](.*)",Pattern.DOTALL);
-   Pattern ndcsProductInfo = Pattern.compile("T7970([^ ])*",Pattern.DOTALL);
-   Pattern sysInfo = Pattern.compile("Current SYSnn(\\s+(.*))");
-   Pattern t4Version= Pattern.compile("T1249_.*[(]R(.[^)]*)");
-   Pattern wmsErrPat= Pattern.compile("Unexpected.*(error message = (.*))");
-   String showWildCardPattern = "(?<!\\\\)\\*";
-   String showWildCardPattern2 = "\\\\\\*";
-   String showWildCardPatternChar = "(?<!\\\\)\\?";
-   Pattern wordPattern=Pattern.compile("^\\s*(\\w+)(\\s*(.*)|$)");  
-   Pattern dbProdVersionPat=Pattern.compile("([A-Z]((\\d+)\\.(\\d+))(.*))((is the SUT identifier\\.)|(for NEO no ipms)|(plus integration build(.*)))");
-   Pattern condPat = Pattern.compile("^(?i:IF)(\\s|\\n)+((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^(\\s|\\n|~=|\\^=|!=|<>|>=|<=|>|<|=|==)]+)(\\s|\\n)*(~=|\\^=|!=|<>|>=|<=|>|<|==|=)(\\s|\\n)*((\"(\"(?=\")|\\\\(?=\")|.)*?\")|\\S+)(\\s|\\n)+(?i:THEN)(\\s|\\n)+(.+)\\z", Pattern.DOTALL);
-   Pattern delayTimePat = Pattern.compile("(?i)\\s*((-?\\d+)\\s*(((sec(ond)?(s)?)?)|(min(ute)?(s)?)))?");
-   String tmpTableName=null;
-   String showTableIdxRemainder=null;
-   static final String  UNKNOWN_ERROR_CODE = "UNKNOWN ERROR CODE";
-
-   Pattern patternKeyPat = Pattern.compile("\\s*\\$\\$([a-zA-Z0-9_]+)\\$\\$\\s+(.*)",Pattern.DOTALL);
-   Pattern patternValPat = Pattern.compile("\\s*(.*)(\\s*(.*)|$)");
-   Pattern containsKeyPat = Pattern.compile("(\\.)?\\$\\$([a-zA-Z0-9_]+)\\$\\$",Pattern.DOTALL);
-   Pattern regExpPat = Pattern.compile("\\s*/(.*)/(.*/)",Pattern.DOTALL);
-   Pattern regExpVal = Pattern.compile("(.+)/(.*)",Pattern.DOTALL);
-   
-   // For LDAP
-   Pattern errPosPat = Pattern.compile("(.*)\\s+at line \\d+, column (\\d+)(.*)",Pattern.DOTALL);
-   Pattern secErrPat = Pattern.compile(".*Details:[^:]*:(.*)", Pattern.DOTALL);
-
-   private boolean isTracingOn = Boolean.getBoolean("trafci.enableTrace");
-
-   
-   Parser() {
-	}
-   public String getRemainderStr()
-   {
-      return remainderStr;
-   }
-   public void setRemainderStr(String remainderStr)
-   {
-      this.remainderStr=remainderStr;
-   }
-
-   String getScriptToken()
-   {
-      Matcher mat=scriptPat.matcher(remainderStr);
-      if (mat.find())
-      {
-         return mat.group(2);
-      }
-      else
-         return null;
-   }
-
-   String getNextFileToken()
-   {
-      if (remainderStr == null)
-         return null;
-      Matcher mat=filePat.matcher(remainderStr);
-
-      if (mat.find())
-      {
-         remainderStr=mat.group(4);
-
-         if (mat.group(1) != null)
-         {
-
-            if (mat.group(1).startsWith("\"") && mat.group(1).endsWith("\""))
-               return mat.group(1).substring(1,mat.group(1).length()-1);
-            else
-               return mat.group(1);
-         }
-         else
-         {
-            return null;
-         }
-      }
-      else
-         return null;
-   }
-
-   String getNextSectionToken()
-   {
-      if (remainderStr == null)
-         return null;
-      Matcher mat=sectionPat.matcher(remainderStr);
-
-      if (mat.find())
-      {
-         remainderStr=mat.group(2);
-
-         if (mat.group(1)!=null)
-         {
-            return (mat.group(1));
-         }
-         else
-         {
-            return null;
-         }
-      }
-      else
-         return null;
-   }
-
-   String getNextNumberToken()
-   {
-      if (remainderStr == null)
-         return null;
-
-      Matcher mat=numberPat.matcher(remainderStr);
-      if (mat.find())
-      {
-         remainderStr=mat.group(4);
-         return mat.group(1);
-      }
-      else
-         return null;
-   }
-
-   String getNextKeyToken()
-   {
-      if (remainderStr == null)
-         return null;
-
-      Matcher mat=keyPat.matcher(remainderStr);
-      if (mat.find())
-      {
-         remainderStr=mat.group(2);
-         return mat.group(1);
-      }
-      else
-         return null;
-   }
-   
-   String lookAtNextToken()
-   {
-      if (remainderStr == null)
-         return null;
-
-      Matcher mat=valPat.matcher(remainderStr);
-      if (mat.find())
-      {
-         return mat.group(1);
-      }
-      else
-         return null;
-   }
-
-   String getNextParamToken()
-   {
-      if (remainderStr == null)
-         return null;
-
-      Matcher mat=paramPat.matcher(remainderStr);
-      if (mat.find())
-      {
-         remainderStr=mat.group(3);
-         return mat.group(2);
-      }
-      else
-         return null;
-   }
-
-   String getNextPreparedStmtNameToken()
-   {
-      if (remainderStr == null)
-         return null;
-      Matcher mat=pstmtPat.matcher(remainderStr);
-      if (mat.find())
-      {
-         remainderStr=mat.group(3);
-
-         if (mat.group(2)!=null)
-         {
-            return (mat.group(2).substring(1,mat.group(2).length()-1));
-         }
-         else
-         {
-            return mat.group(1).toUpperCase();
-         }
-      }
-      else
-         return null;
-
-   }
-
-   public List<String> getNextParamListToken()
-   {
-      List<String> paramList=null;
-      paramList=new ArrayList<String>();
-      String paramName=null;
-      while (true)
-      {
-         if ((paramName=getNextParam2Token()) != null)
-         {
-            paramList.add(paramName);
-         }
-         else
-         {
-            break;
-         }
-      }
-
-      return paramList;
-   }
-
-   public String getNextParam2Token()
-   {
-
-
-      if (remainderStr == null)
-      {
-         return null;
-      }
-      Matcher mat=paramListPat.matcher(remainderStr);
-      if (mat.find())
-      {
-         //System.out.println(mat.group(3));
-         remainderStr=mat.group(6);
-
-         //showTableIdxRemainder=mat.group(7);
-
-         if (mat.group(2) != null)
-         {
-            return mat.group(2).substring(1,mat.group(2).length()-1);
-         }
-         else if (mat.group(4) != null)
-         {
-            return mat.group(4).trim();
-         }
-         else
-         {
-            return null;
-         }
-      }
-      else
-      {
-         if (remainderStr != null)
-         {
-            String tmpStr=remainderStr.trim();
-            remainderStr=null;
-            return tmpStr;
-         }
-         return null;
-      }
-
-   }
- //dead code. Removed by Kevin Xu
-/*
-   boolean matchExplainSyntax(List tokenList)
-   {
-      if (remainderStr == null)
-         return false;
-
-      Matcher mat=explainPat.matcher(remainderStr);
-      if (mat.find())
-      {
-         //System.out.println("Return true");
-         tokenList.add(mat.group(1));
-         if (mat.group(4)!=null)
-         {
-            tokenList.add(mat.group(4).substring(1,mat.group(4).length()-1));
-         }
-         else
-         {
-            tokenList.add(mat.group(3).toUpperCase());
-         }
-         return true;
-
-      }
-      //System.out.println("Return False");
-      return false;
-
-   }
-*/
-   // the value can be any word without quotes
-   // or any values including special characters enclosed within 
-   // double quotes
-   // if the value is enclosed within double quotes return value should 
-   // retain the case and remove the double quotes otherwise the return
-   // value should have all upper case 
-   String getNextValueToken()
-   {
-      if (remainderStr == null)
-         return null;
-
-      Matcher mat=valPat.matcher(remainderStr);
-
-      if (mat.find())
-      {
-         remainderStr=mat.group(5);
-         if (mat.group(2) != null)
-         {
-            return mat.group(2).substring(1,mat.group(2).length()-1);
-         }
-         else if (mat.group(4) != null)
-         {
-            return mat.group(4).toUpperCase();
-         }
-         else
-         {
-            return null;
-         }
-      }
-      else
-      {
-         return null;
-      }
-   }
-
-
-   String getNextQValueToken()
-   {
-      if (remainderStr == null)
-         return null;
-
-      Matcher mat=valPat.matcher(remainderStr);
-
-      if (mat.find())
-      {
-         remainderStr=mat.group(5);
-         if (mat.group(2) != null)
-         {
-            return mat.group(2);
-         }
-         else if (mat.group(4) != null)
-         {
-            return mat.group(4).toUpperCase();
-         }
-         else
-         {
-            return null;
-         }
-      }
-      else
-      {
-         return null;
-      }
-   }
-   
-   String getCatalogToken()
-   {
-	  if (remainderStr == null)
-	     return null;
-
-	  Matcher mat=catalogPat.matcher(remainderStr);
-
-	  if (mat.find())
-	  {
-	    remainderStr=mat.group(2);
-	    if (mat.group(1).startsWith("\"") )
-           return mat.group(1);
-        else
-           return mat.group(1).toUpperCase();
-	  }
-	  else
-	  {
-	    return null;
-	  }
-   }
-
-   /**
-    *  Gets the value of a parameter (for a  set param call). Uses a
-    *  regular expression to match the input to a grammar/syntax.
-    *
-    *  @param   cmdInput  if its null uses the remainder string we have
-    *                     stored internally in here.
-    *  @return  Null or a parameter value object (with the charset and input)
-    *  @since   R2.4 SP2
-    *
-    */
-
-    ParamStringObject  getParamValue(String cmdInput) {
-    boolean  setRemainder = false;
-
-      try {
-
-         /**
-          *  Check if we any parameter passed -- if not use the remaining
-          *  input we have.  And also remember that we need to set the 
-          *  remainder if there's any input remaining.
-          */
-         if (null == cmdInput) {
-            cmdInput = remainderStr;
-            setRemainder = true;
-         }
-
-        
-         /**
-          *  Check if we have any input to work on.
-          */
-         if (null == cmdInput)
-            return null;
-
-
-         if (isTracingOn)
-            System.out.println("@@@Trace: getParamValue:: cmd input = " +
-                               cmdInput);
-
-         /**
-          *  Check if we have a match and get the value for the parameter.
-          */
-         Matcher mat = paramValuePat.matcher(cmdInput);
-
-         if (!mat.find() )
-            return null;
-
-
-         /**
-          *  All the unmatched portion is in the eighth group. Use that to
-          *  set the remainder string IFF we need to do that.
-          */
-         if (setRemainder)
-            remainderStr = mat.group(8);
-
-         if (isTracingOn)
-            System.out.println("@@@Trace: getParamValue:: remainderStr = " +
-                               mat.group(8) );
-
-
-         /**
-          *  The seventh group is any simple string values or error cases.
-          *  If we have a seventh group and its not null return that value.
-          *  This is match for the (\\S+) component of the regexp.
-          */
-         String theValue = mat.group(7);
-         if (null != theValue)
-            return  new ParamStringObject(null, null, theValue);
-
-
-         /**
-          *  Otherwise its a charset + hexinput + value type of string.
-          *  Group 3 is the charset, group 4 is the hex input prefix 'x'
-          *  and group 5 is the actual String value. Reassemble those.
-          */
-         ParamStringObject psv = new ParamStringObject(mat.group(3), mat.group(4),
-                                                   mat.group(5) );
-
-         if (isTracingOn)
-            System.out.println("@@@Trace: getParamValue:: theValue = " +
-                               psv.toString() );
-
-         return psv;
-
-      } catch(Throwable t) {
-         if (isTracingOn) {
-            System.out.println("Internal error getting parameter value. " + 
-                               "Details = " + t.getMessage() );
-
-            t.printStackTrace();
-         }
-
-      }
-
-      return null;
-
-   }   /*  End of  getParamValue  method.  */
-
-   String getNextValueType2Token()
-   {
-      if (remainderStr == null)
-         return null;
-
-      Matcher mat=val2Pat.matcher(remainderStr);
-
-      if (mat.find())
-      {
-         remainderStr=mat.group(5);
-         if (mat.group(2) != null)
-         {
-            return mat.group(2).substring(1,mat.group(2).length()-1);
-         }
-         else if (mat.group(4) != null)
-         {
-            return mat.group(4).toUpperCase();
-         }
-         else
-         {
-            return null;
-         }
-      }
-      else
-         return null;
-   }
-
-
-   boolean hasMoreTokens()
-   {
-      if (remainderStr == null || remainderStr.trim().length()== 0)
-      {
-         return false;
-      }
-      else
-      {
-         return true;
-      }
-   }
- //dead code. Removed by Kevin Xu
-/*
-   String ignoreCommentsOld(String queryStr)
-   {
-      if (queryStr != null)
-      {
-         if (queryStr.indexOf("--") != -1)
-         {
-            StringBuffer outBuffer=null;
-            outBuffer=new StringBuffer();
-            Matcher ignoreCommentsPat = this.ignoreCommentsPat.matcher(queryStr);
-            while (ignoreCommentsPat.find())
-            {
-               if (ignoreCommentsPat.group(2) != null)
-               {
-                  //group 2 is not null..dont have to print anything
-
-               }
-               else if (ignoreCommentsPat.group(4) != null || ignoreCommentsPat.group(6) != null)
-               {
-                  outBuffer.append(ignoreCommentsPat.group(3));
-               }
-               else
-               {
-
-                  outBuffer.append(ignoreCommentsPat.group(0));
-               }
-            }
-            return outBuffer.toString();
-         }
-      }
-      return queryStr;
-   }
-*/
-   public List<String> getCSTList(String tablePattern)
-   {
-      List<String> cstList=null;
-      cstList=new ArrayList<String>();
-      String tabName=null;
-      tmpTableName=null;
-      tmpTableName=tablePattern;
-      while (true)
-      {
-         if ((tabName=getNextTableToken(tmpTableName)) != null)
-         {
-            cstList.add(tabName);
-         }
-         else
-         {
-            break;
-         }
-      }
-      return cstList;
-   }
-
-
-
-   public String getNextTableToken(String tablePattern)
-   {
-      if (tablePattern == null)
-      {
-         return null;
-      }
-      Matcher mat=tabPat.matcher(tablePattern);
-
-      if (mat.find())
-      {
-         tmpTableName=mat.group(6);
-
-         showTableIdxRemainder=mat.group(7);
-
-         if (mat.group(2) != null)
-         {
-            return mat.group(2).replaceAll("\"","\\\"");
-         }
-         else if (mat.group(4) != null)
-         {
-            return mat.group(4).toUpperCase();
-         }
-         else
-         {
-            return null;
-         }
-      }
-      else
-      {
-         return null;
-      }
-
-   }
-   
- //dead code. Removed by Kevin Xu
-/*
-   boolean matchMxciParamPat(String param)
-   {
-      Matcher mat = mxciParamPat.matcher(param);
-      if (mat.find())
-      {
-         remainderStr = mat.group(1).trim();
-         return true;
-      }
-      else
-      {
-         remainderStr = null;
-         return false;
-      }
-   }
-*/
-   public List<String> splitLines()
-   {
-      List<String> paramList=null;
-      paramList=new ArrayList<String>();
-      String paramName=null;
-      while (true)
-      {
-         if ((paramName=getNextToken()) != null)
-         {
-            paramList.add(paramName);
-         }
-         else
-         {
-            break;
-         }
-      }
-
-      return paramList;
-   }
-
-   public String getNextToken()
-   {
-
-      if (remainderStr == null)
-      {
-         return null;
-      }
-      Matcher mat=mapListPat.matcher(remainderStr);
-      if (mat.find())
-      {
-         remainderStr=mat.group(6);
-
-         if (mat.group(1) != null)
-         {
-            return mat.group(1);
-         }
-         else
-         {
-            return null;
-         }
-      }
-      else
-      {
-         if (remainderStr != null)
-         {
-            String tmpStr=remainderStr.trim();
-            remainderStr=null;
-            return tmpStr;
-         }
-         return null;
-      }
-
-   }
- //dead code. Removed by Kevin Xu
-/*
-   List split(String line)
-   {
-      List tokList=null;
-      tokList=new ArrayList();
-      String token=null;
-      this.setRemainderStr(line);
-
-      while (true)
-      {
-         if ((token=getNextValueType2Token()) != null)
-         {
-            tokList.add(token);
-         }
-         else
-         {
-            break;
-         }
-      }
-      return tokList;
-   }
-
-   List matchFixedWidthPattern(String param)
-   {
-      List posList=null;
-      Matcher mat = mapFileFixedWidthColPat.matcher(param);
-      if (mat.find())
-      {
-         posList = new ArrayList();
-         posList.add(mat.group(1));
-         posList.add(mat.group(2));
-
-      }
-      return posList;
-   }
-
-   public String matchDbFnPattern(String str)
-   {
-      Matcher  mat = dbFunctionPat.matcher(str);
-      if (mat.find())
-      {
-         String fnname = mat.group(1);
-         String tmp[] = mat.group(2).split(",");
-         if (tmp != null)
-            str = str.replaceFirst(tmp[0],"?");
-         else
-            str = str.replaceFirst(fnname,"?");
-         return fnname;
-      }
-      return null;
-   }
-
-   public String getEnvVarName()
-   {
-      if (remainderStr == null)
-         return null;
-      Matcher mat = envPat.matcher(remainderStr);
-      if (mat.find())
-      {
-         remainderStr=mat.group(2);
-         return mat.group(1);
-      }
-      else
-      {
-         return null;
-      }
-   }
-*/
-   public String getConnArg(String argString)
-   {
-      if (remainderStr == null || argString==null)
-      {
-         return null;
-      }
-      Matcher mat =null;
-      if (argString.equalsIgnoreCase("user"))
-      {
-    	  mat=connUserPreparePat.matcher(remainderStr.trim());
-     	 if(mat.find())
-     	 {
-     		 String userPrepare = mat.group(1).trim();
-			 if (userPrepare.indexOf("/") < 0
-						&& !(userPrepare.indexOf("\"") == 0 && userPrepare
-								.lastIndexOf("\"") == userPrepare.length() - 1))
-     			 mat=connUserPat.matcher(remainderStr);
-     		 else
-     			 mat.reset();
-     	 }
-     	 else
-     		 mat=connUserPat.matcher(remainderStr);
-      }
-      else if (argString.equalsIgnoreCase("pass"))
-         mat=connPassPat.matcher(remainderStr);
-      else if (argString.equalsIgnoreCase("server"))
-         mat=connServerPat.matcher(remainderStr);
-      else if (argString.equalsIgnoreCase("dsn"))
-         mat=connDsnPat.matcher(remainderStr);
-      else
-         return null;
-
-      if (mat.find())
-      {
-         remainderStr=mat.group(mat.groupCount());
-         if (argString.equalsIgnoreCase("pass") && 
-        		 mat.group(1).startsWith("\"") && mat.group(1).endsWith("\""))
-         {
-        	String password = mat.group(1).substring(1,mat.group(1).length()-1);
-        	password = password.replaceAll("\\\\\"","\\\"");
-            return password;
-         }
-         if (argString.equalsIgnoreCase("user"))
-         {
-        	 String user = mat.group(1).trim();
-        	 if (user.startsWith("\"") && user.endsWith("\""))
-        		 return user.substring(1,user.length()-1);
-         }
-                 
-         return mat.group(1);
-      }
-      else
-      {
-         return null;
-      }
-   }
-   
-	public String getErrorCode(String errStr) {
-		Matcher mat = errPat.matcher(errStr);
-		if (mat.find())
-			return mat.group(2);
-		else
-			return UNKNOWN_ERROR_CODE;
-	}
-	   
-	public String getErrorCode(String errStr, int errCode) {
-		Matcher mat = errPat.matcher(errStr);
-		if (mat.find())
-			return mat.group(2);
-		else if (errCode != 0)
-			return String.valueOf(errCode);
-		else
-			return UNKNOWN_ERROR_CODE;
-	}
-
-   public String getErrorMsg(String errStr)
-   {
-
-      Matcher mat = errPat.matcher(errStr);
-      if (mat.find())
-         return mat.group(3).trim();
-      else
-         return errStr;
-   }
-
-   public String getNDCSProduct(String vproc)
-   {
-      Matcher mat = ndcsProductInfo.matcher(vproc);
-      if (mat.find())
-      {
-         return mat.group();
-      }
-      else
-      {
-         return null;
-      }
-   }
-   public String getSysInfo(String sysinfo)
-   {
-
-      Matcher mat = sysInfo.matcher(sysinfo);
-      if (mat.find())
-         return mat.group(1);
-      else
-         return null;
-   }
-
-   public String gett4Version(String verTxt)
-   {
-
-      Matcher mat = t4Version.matcher(verTxt);
-      if (mat.find())
-         return mat.group(1);
-      else
-         return null;
-   }
-
-   public String getWMSErr(String errTxt)
-   {
-
-      Matcher mat = wmsErrPat.matcher(errTxt);
-      if (mat.find())
-         return mat.group(2);
-      else
-         return errTxt;
-   }
-    
-   /************** Begin Conditional Parser Functions ***************************/
-   // group(2) is condition
-   // group(6) is operator
-   // group(8) is value
-   // group(13) is action
-   
-   public String getConditionalVariable(String txt){
-       Matcher mat = condPat.matcher(txt);
-
-       if(mat.find())
-       {
-           return mat.group(2).trim();
-       }
-       else
-           return null;
-   }
-   
-   public String getConditionalOperator(String txt){
-       Matcher mat = condPat.matcher(txt);
-       if(mat.find())
-           return mat.group(6);
-       else
-           return null;
-   }
-   
-   public String getConditionalValue(String txt){
-       Matcher mat = condPat.matcher(txt);
-       if(mat.find())
-           return mat.group(8);
-       else
-           return null;
-   }
-   
-   public String getConditionalAction(String txt){
-       String action = null;
-       Matcher mat = condPat.matcher(txt);
-       if(mat.find())
-       {
-           action = mat.group(13).replaceAll("\\n", " ").trim();
-       }
-       
-       return action;
-   }
-
-   /************** End Conditional Parser Functions *****************************/   
-
-   //   Identifies the comments in a given SQL query line
-   // if a comment string "--" is embedded between single quotes
-   // then it is treated as string literal otherwise its a comment
-   String ignoreComments(String qryLine)
-   {
-      String qryLineCopy=qryLine;
-      int quoteStartPos=-1;                          // first single quote position
-      int quoteEndPos=-1;                            // second single quote or end quote position
-      int commentPos=-1;                             // comments position
-      int fromIndex=0;                               // search start position in the querystring for quotes
-      int commentFromIndex=0;                        // search start position in the querystring for comment
-      String quoteStr="'";
-      String commentStr="--";
-
-      while (qryLineCopy !=null)
-      {
-
-         quoteStartPos=qryLine.indexOf(quoteStr,fromIndex);
-         commentPos=qryLine.indexOf(commentStr,commentFromIndex);
-
-         // if no comments found return qryLine as it is.
-         if (commentPos == -1) return qryLine;
-
-         // if no quotes found or if the comment appears before the quote remove the comment portion
-         // from the query string and return it
-         // else set the fromIndex position to find the ending quote.
-         if (quoteStartPos == -1 || quoteStartPos > commentPos) return qryLine.substring(0,commentPos);
-         else
-            fromIndex=quoteStartPos+1;
-
-         quoteEndPos=qryLine.indexOf(quoteStr,fromIndex);
-
-         // if no ending quote is found remove the comments portion and return the string
-         if (quoteEndPos==-1 && commentPos != -1) return qryLine.substring(0,commentPos);
-
-         // if comment begins after ending quote , search for more quotes without resetting commentsPosition
-         if (quoteEndPos < commentPos)
-         {
-            qryLineCopy=qryLine.substring(quoteEndPos+1,qryLine.length());
-            fromIndex=quoteEndPos+1;
-            continue;
-         }
-
-         // if comment appears between quotes , search for more quotes and comments and repeat the while loop
-         // by resetting comments position
-         if (quoteStartPos < commentPos && commentPos < quoteEndPos && qryLine.length()>quoteEndPos+1)
-            qryLineCopy=qryLine.substring(quoteEndPos+1,qryLine.length()-1);
-
-         fromIndex=quoteEndPos+1;
-         commentFromIndex=fromIndex;
-
-      }
-
-      return qryLine;
-
-   }
-
-   public String replaceShowPattern(String showPatStr)
-   {
-      showPatStr = showPatStr.replaceAll(showWildCardPattern, "%");
-      showPatStr = showPatStr.replaceAll(showWildCardPatternChar, "_");
-      return showPatStr;
-
-   }
-
-   public String replaceShowPrepPattern(String showPatStr)
-   {
-      showPatStr = showPatStr.replaceAll(showWildCardPattern, ".*");
-      showPatStr = showPatStr.replaceAll(showWildCardPattern2, "*");
-      showPatStr = showPatStr.replaceAll(showWildCardPatternChar, "_");
-      return showPatStr;
-
-   }
-   
-   String getNextWordToken()
-   {
-      if(remainderStr == null)
-        return null;
-       
-      Matcher mat=wordPattern.matcher(remainderStr);
-      if(mat.find())
-      {
-         remainderStr=mat.group(2);
-         return mat.group(1);
-      }
-      else
-      {
-         return null;
-      }
-   }
-   
-   String getDbVersion(String sutVer)
-   {
-      if (sutVer == null)
-         return null;
-       
-      Matcher mat=dbProdVersionPat.matcher(sutVer);
-      if(mat.find())
-      {
-         String minorVersion = mat.group(4);
-         if (minorVersion.length() > 1 && minorVersion.startsWith("0"))
-            minorVersion = minorVersion.substring(1);
-         return mat.group(3) + "." + minorVersion;
-       }
-       else
-       {
-           return null;
-       }
-   }
-   
-   String formatSutVer(String sutVer)
-   {
-	   if (sutVer == null)
-	         return "Information not available";
-	       
-	   Matcher mat=dbProdVersionPat.matcher(sutVer);
-	   if(mat.find())
-	   {
-	         return mat.group(1);
-	   }
-	   else
-	   {
-	           return "Information not available";
-	   }
-	   
-   }
-   
-   public int getDelayTime(String cmdStr)
-   {
-      int timeVal=-1;
-      Matcher mat = delayTimePat.matcher(cmdStr);
-      if (mat.matches())
-      {
-         if (mat.group(2)!=null)
-         {
-            try {
-                timeVal = Integer.parseInt(mat.group(2)) * 1000;
-            }catch (NumberFormatException nfe)
-            {
-               return -1;
-            }
-         }
-         if (mat.group(8)!=null)
-         {
-            timeVal = timeVal * 60 ;
-         }
-       
-      }
-      return timeVal;
-   }
-   
-   
-   public String matchKeyPat(String cmdStr)
-   {
-	   Matcher patMat = containsKeyPat.matcher(cmdStr);
-	   if (patMat.matches())
-	   {
-		   return patMat.group(2);
-	   }
-	   return null;
-   }
-   
-   public Matcher getKeyPatternMatcher(String cmdStr)
-   {
-	   Matcher patMat = containsKeyPat.matcher(cmdStr);
-	   return patMat;
-	  
-   }
-   
-   public String getPatternKeyPattern()
-   {
-	   Matcher patMat = patternKeyPat.matcher(remainderStr);
-	   if (patMat.matches())
-	   {
-		  remainderStr=patMat.group(2);
-	   	  return patMat.group(1);
-	   	  
-	   }
-	   return null;
-   }
-   
-   public String getPatternValueToken()
-   {
-	   Matcher patMat = patternValPat.matcher(remainderStr);
-	   if (patMat.matches())
-	   {
-		  remainderStr=patMat.group(2);
-	   	  return patMat.group(1);
-	   	  
-	   }
-	   return null;
-   }
-   public String getRegexpPattern()
-   {
-	   Matcher regExpMat = regExpPat.matcher(remainderStr);
-	   if (regExpMat.matches())
-	   {
-		  remainderStr=regExpMat.group(2);
-	   	  return regExpMat.group(1);
-	   	  
-	   }
-	   return null;
-   }
-   
-   public String getRegexpValue()
-   {
-	   Matcher regExpMat = regExpVal.matcher(remainderStr);
-	   if (regExpMat.matches())
-	   {
-		  remainderStr=regExpMat.group(2);
-	   	  return regExpMat.group(1);
-	   	  
-	   }
-	   return null;
-   }
-   
-   
-   public int getErrorPos(String errorMsg)
-   {
-	   Matcher errorPosMat = errPosPat.matcher(errorMsg);
-	   if (errorPosMat.matches())
-	   {
-		 return new Integer(errorPosMat.group(2)).intValue();
-	   }
-	   return 0;
-   }
-   
-   
-   public String getSECErr(String errTxt)
-   {
-      Matcher mat = secErrPat.matcher(errTxt);
-      if (mat.find())
-         return mat.group(1);
-      else
-         return errTxt;
-   }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ParserMissingParamException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ParserMissingParamException.java b/core/conn/trafci/src/org/trafodion/ci/ParserMissingParamException.java
deleted file mode 100644
index 314974e..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ParserMissingParamException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class ParserMissingParamException extends Exception {
-
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = 6253398014500719153L;
-
-	ParserMissingParamException()
-	{
-	
-	}
-	
-	ParserMissingParamException(String msg)
-	{
-		super(msg);
-	}
-
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Properties/trafciDefaultLookAndFeel.properties
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Properties/trafciDefaultLookAndFeel.properties b/core/conn/trafci/src/org/trafodion/ci/Properties/trafciDefaultLookAndFeel.properties
deleted file mode 100644
index d867795..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Properties/trafciDefaultLookAndFeel.properties
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# @@@ 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 @@@
-#
-
-WMS_.*=---\ WMS\ operation\ complete.
-SQL_UNKNOWN_CMD=---\ SQL\ operation\ complete.
-SQL_CREATE\ TABLE\ .*\ AS\ SELECT\ .*=---\ @rownum@ row(s)\ inserted.
-SQL_CREATE\ SET\ VOLATILE\ TABLE\ .*\ AS\ SELECT\ .*=---\ @rownum@ row(s)\inserted.
-SQL_CREATE\ SET\ TABLE\ .*\ AS\ SELECT\ .*=---\ @rownum@ row(s)\ inserted.
-SQL_CREATE\ VOLATILE\ TABLE\ .*\ AS\ SELECT\ .*=---\ @rownum@ row(s)\ inserted.
-SQL_DELETE\ .*=---\ @rownum@ row(s)\ deleted.
-SQL_DELETE\ SERVICE\ .*=---\ SQL\ operation\ complete.
-SQL_DELETE\ USER\ .*=---\ SQL\ operation\ complete.
-SQL_DELETE\ DS\ .*=---\ SQL\ operation\ complete.
-SQL_PREPARE\ .*=---\ SQL\ command\ prepared.
-SQL_EXECUTE\ .*=---\ SQL\ operation\ complete.
-SQL_INSERT\ .*=---\ @rownum@ row(s)\ inserted.
-SQL_INS\ .*=---\ @rownum@ row(s)\ inserted.
-SQL_SELECT\ .*=---\ @rownum@ row(s)\ selected.
-SQL_SELECT_LIST_COUNT\ .*=---\ @rownum@ row(s)\ selected.  LIST_COUNT was reached.
-SQL_VALUES.*=---\ @rownum@ row(s)\ selected.
-SQL_\\(\\s*SELECT\ .*=---\ @rownum@ row(s)\ selected.
-SQL_\\(\\s*SELECT_LIST_COUNT\ .*=---\ @rownum@ row(s)\ selected.  LIST_COUNT was reached.
-SQL_\\(\\s*VALUES.*=---\ @rownum@ row(s)\ selected.
-SQL_SEL\ .*=---\ @rownum@ row(s)\ selected.
-SQL_UPDATE\ .*=---\ @rownum@ row(s)\ updated.
-SQL_UPSERT\ .*=---\ @rownum@ row(s)\ inserted.
-SQL_UPDATE\ STATISTICS\ .*=---\ SQL\ operation\ complete.
-SQL_LOCK\ .*\ FOR\ ACCESS\ INS\ .*=---\ @rownum@ row(s)\ inserted.
-SQL_LOCK\ .*\ FOR\ ACCESS\ INSERT\ .*=---\ @rownum@ row(s)\ inserted. 
-SQL_LOCK\ .*\ FOR\ ACCESS\ SEL\ .*=---\ @rownum@ row(s)\ selected.
-SQL_LOCK\ .*\ FOR\ ACCESS\ SELECT\ .*=---\ @rownum@ row(s)\ selected.
-SQL_LOCKING\ .*\ FOR\ ACCESS\ INS\ .*=---\ @rownum@ row(s)\ inserted.
-SQL_LOCKING\ .*\ FOR\ ACCESS\ INSERT\ .*=---\ @rownum@ row(s)\ inserted. 
-SQL_LOCKING\ .*\ FOR\ ACCESS\ SEL\ .*=---\ @rownum@ row(s)\ selected.
-SQL_LOCKING\ .*\ FOR\ ACCESS\ SELECT\ .*=---\ @rownum@ row(s)\ selected.
-CS_.*=---\ CS\ operation\ complete.
-SQL_CMDCLOSE=---\ CS\ operation\ complete.
-SQL_WMSCLOSE=---\ WMS\ operation\ complete.
-
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/PrunSummary.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/PrunSummary.java b/core/conn/trafci/src/org/trafodion/ci/PrunSummary.java
deleted file mode 100644
index f5d93e8..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/PrunSummary.java
+++ /dev/null
@@ -1,119 +0,0 @@
-// @@@ 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 @@@
-/**
- * 
- * Object to handle PRUN summary fields 
- * 
- */
-package org.trafodion.ci;
-
-public class PrunSummary
-{
-
-   private int totalScriptFiles = 0;
-   private int totalScriptFilesProcessed = 0;
-   private int totalSQLsProcessed = 0;
-   private int totalSQLErrors = 0;
-   private int totalSQLWarnings = 0;
-   private int totalConnections = 0;
-   private int totalConnectionFailures = 0;
-   private int totalSQLSuccesses = 0;
-
-   public int getTotalConnections()
-   {
-      return totalConnections;
-   }
-
-   public void setTotalConnections(int totalConnections)
-   {
-      this.totalConnections = totalConnections;
-   }
-
-   public int getTotalScriptFiles()
-   {
-      return totalScriptFiles;
-   }
-
-   public void setTotalScriptFiles(int totalScriptFiles)
-   {
-      this.totalScriptFiles = totalScriptFiles;
-   }
-
-   public int getTotalScriptFilesProcessed()
-   {
-      return totalScriptFilesProcessed;
-   }
-
-   public void setTotalScriptFilesProcessed(int totalScriptFilesProcessed)
-   {
-      this.totalScriptFilesProcessed = totalScriptFilesProcessed;
-   }
-
-   public int getTotalSQLErrors()
-   {
-      return totalSQLErrors;
-   }
-
-   public void setTotalSQLErrors(int totalSQLErrors)
-   {
-      this.totalSQLErrors = totalSQLErrors;
-   }
-
-   public int getTotalSQLsProcessed()
-   {
-      return totalSQLsProcessed;
-   }
-
-   public void setTotalSQLsProcessed(int totalSQLsProcessed)
-   {
-      this.totalSQLsProcessed = totalSQLsProcessed;
-   }
-
-   public int getTotalSQLWarnings()
-   {
-      return totalSQLWarnings;
-   }
-
-   public void setTotalSQLWarnings(int totalSQLWarnings)
-   {
-      this.totalSQLWarnings = totalSQLWarnings;
-   }
-
-   public int getTotalSQLSuccess()
-   {
-      return totalSQLSuccesses;
-   }
-
-   public int getTotalConnectionFailures()
-   {
-      return totalConnectionFailures;
-   }
-
-   public void setTotalConnectionFailures(int totalConnectionFailures)
-   {
-      this.totalConnectionFailures = totalConnectionFailures;
-   }
-
-   public void setTotalSQLSuccess(int totalSQLSuccesses)
-   {
-      this.totalSQLSuccesses = totalSQLSuccesses;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/PrunUserInterruption.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/PrunUserInterruption.java b/core/conn/trafci/src/org/trafodion/ci/PrunUserInterruption.java
deleted file mode 100644
index 8b7deac..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/PrunUserInterruption.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class PrunUserInterruption extends Exception
-{
-   /**
-   * 
-   */
-   private static final long serialVersionUID = 794988996507793357L;
-
-   PrunUserInterruption()
-   {
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/PythonInterface.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/PythonInterface.java b/core/conn/trafci/src/org/trafodion/ci/PythonInterface.java
deleted file mode 100644
index 7ce827b..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/PythonInterface.java
+++ /dev/null
@@ -1,180 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.sql.SQLException;
-
-public class PythonInterface
-{
-   ConsoleReader crObj=null;
-   ConsoleWriter cwObj=null;
-   SessionInterface sessIntObj=null;
-   Session sessObj=null;
-   boolean doTrace=false;
-
-   public PythonInterface()
-   {
-      initialize();
-      sessIntObj=new SessionInterface(crObj,cwObj);
-
-      String enableTrace=System.getProperty ("trafci.enableTrace");
-      if ((enableTrace != null) && enableTrace.trim().equalsIgnoreCase("true"))
-         doTrace = true;
-
-   }
-
-   private void initialize()
-   {
-      cwObj=new ConsoleWriter();
-
-      try
-      {
-         cwObj.initialize();
-      } catch (IOException e1)
-      {
-         System.out.println("Could not able to initialize the writer"+e1);
-         if (doTrace)
-            e1.printStackTrace();
-         System.exit(1);
-      }
-      crObj=new ConsoleReader();
-
-      try
-      {
-         crObj.initialize();
-      } catch (IOException e1)
-      {
-         System.out.println("Could not able to initialize the reader"+e1);
-         if (doTrace)
-            e1.printStackTrace();
-         System.exit(1);
-      }
-   }
-
-   public void openConnection(String userName, String password, String serverName, String portNumber, String dsnName)
-   {
-	    String roleName = ""; //primary role
-	    openConnection(userName, password, roleName, serverName, portNumber, dsnName );   
-   }
-   
-   public void openConnection(String userName, String password,String roleName, String serverName, String portNumber, String dsnName)
-   {
-      try
-      {
-         sessObj=sessIntObj.createSession(userName,
-            password,
-            roleName,
-            serverName,
-            portNumber,
-            dsnName,
-            SessionDefaults.USERI);
-      } catch (FileNotFoundException e)
-      {
-         // TODO Auto-generated catch block
-         e.printStackTrace();
-      } catch (SQLException e)
-      {
-         // TODO Auto-generated catch block
-         e.printStackTrace();
-      } catch (InstantiationException e)
-      {
-         // TODO Auto-generated catch block
-         e.printStackTrace();
-      } catch (IllegalAccessException e)
-      {
-         // TODO Auto-generated catch block
-         e.printStackTrace();
-      } catch (ClassNotFoundException e)
-      {
-         // TODO Auto-generated catch block
-         e.printStackTrace();
-      } catch (IOException e)
-      {
-         // TODO Auto-generated catch block
-         e.printStackTrace();
-      }
-   }
-
-   public void executeUI()
-   {
-      try
-      {
-         sessIntObj.setQueryOptions(false,null);
-         sessIntObj.invokeSession(sessObj);
-      } catch (IOException e)
-      {
-         // TODO Auto-generated catch block
-         e.printStackTrace();
-      }
-   }
-
-   public void executeQuery(String qryString)
-   {
-      try
-      {
-         sessIntObj.setQueryOptions(true,qryString);
-         sessIntObj.invokeSession(sessObj);
-      } catch (IOException e)
-      {
-         // TODO Auto-generated catch block
-         e.printStackTrace();
-      }
-   }
-
-   public void executeFile(String fileName)
-   {
-      try
-      {
-         sessIntObj.setQueryOptions(false,null);
-         sessIntObj.setScriptFile(fileName);
-         //sessIntObj.setCaller(SessionDefaults.PYTHI);
-         sessIntObj.invokeSession(sessObj);
-
-      } catch (IOException e)
-      {
-         // TODO Auto-generated catch block
-         e.printStackTrace();
-      }
-   }
-
-   public void closeConnection()
-   {
-      if (this.sessIntObj != null)
-      {
-         if (sessObj.getConnObj() != null)
-         {
-            try
-            {
-               sessObj.getConnObj().close();
-            } catch (SQLException e)
-            {
-               // TODO Auto-generated catch block
-               e.printStackTrace();
-            }
-            sessObj=null;
-         }
-      }
-      sessIntObj=null;
-   }
-   
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Query.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Query.java b/core/conn/trafci/src/org/trafodion/ci/Query.java
deleted file mode 100644
index e366a8d..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Query.java
+++ /dev/null
@@ -1,188 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-public class Query
-{
-   private int queryType=-1 ;  // 0 -tool query 1- sql query
-   private boolean passThrough=false; // false -for all interface query
-   private boolean multiLine=false; // false for all interface query
-   private StringBuffer queryText;
-   private String rowCount=null; // false if the query does not succeed
-   private int queryId=-1;// query identifier
-   private boolean trimOut=false;
-   private boolean isActive=false;
-   private long elapsedTime;
-   private String stmtType=null;
-   private int statusCode=0; // 0-after successful execution of the query. corresponding error number otherwise
-   private String colCount=null;
-   private int rsCount=0;
-
-	Query() {
-		queryText = new StringBuffer();
-	}
-
-   public void setQueryType(int queryType)
-   {
-      this.queryType=queryType;
-   }
-
-   public int getQueryType()
-   {
-      return this.queryType;
-   }
-
-   public void setPassThrough(boolean  passThrough)
-   {
-      this.passThrough=passThrough;
-   }
-
-   public boolean getPassThrough()
-   {
-      return this.passThrough;
-   }
-
-   public void setMultiLine(boolean  multiLine)
-   {
-      this.multiLine=multiLine;
-   }
-
-   public boolean isMultiLine()
-   {
-      return this.multiLine;
-   }
-
-   public void setQueryText(String queryText)
-   {
-      this.queryText.append(queryText);
-   }
-
-   public void resetQueryText(String queryText)
-   {
-      this.queryText.replace(0,this.queryText.length(),queryText);
-   }
-
-   public String getQueryText()
-   {
-      return this.queryText.toString();
-   }
-
-   public void setRowCount(String rowCount)
-   {
-      this.rowCount=rowCount;
-   }
-
-   public void resetRowCount()
-   {
-      this.rowCount=null;
-   }
-
-   public String getRowCount()
-   {
-      return this.rowCount;
-   }
-
-   public void setColCount(String colCount)
-   {
-      this.colCount=colCount;
-   }
-
-   public String getColCount()
-   {
-      return this.colCount;
-   }
-
-   public int getQueryId()
-   {
-      return queryId;
-   }
-
-   public void setQueryId(int queryId)
-   {
-      this.queryId = queryId;
-   }
-
-   public boolean isTrimOut()
-   {
-      return trimOut;
-   }
-
-   public void setTrimOut(boolean trimOut)
-   {
-      this.trimOut = trimOut;
-   }
-
-   public boolean isActive()
-   {
-      return isActive;
-   }
-
-   public void setActive(boolean isActive)
-   {
-      this.isActive = isActive;
-   }
-   public long getElapsedTime()
-   {
-      return this.elapsedTime;
-   }
-
-   public void setElapsedTime(long elapsedTime)
-   {
-      this.elapsedTime=elapsedTime;
-   }
-
-   public String getStmtType()
-   {
-      return stmtType;
-   }
-
-   public void setStmtType(String stmtType)
-   {
-      this.stmtType = stmtType;
-   }
-
-   public int getStatusCode()
-   {
-      return statusCode;
-   }
-
-   public void setStatusCode(int statusCode)
-   {
-      this.statusCode = statusCode;
-   }
-
-   public int getRsCount()
-   {
-      return rsCount;
-   }
-
-   public void incrRsCount()
-   {
-      rsCount++;
-
-   }
-
-   public void setRsCount(int rsCount)
-   {
-      this.rsCount = rsCount;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/QueryUtils.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/QueryUtils.java b/core/conn/trafci/src/org/trafodion/ci/QueryUtils.java
deleted file mode 100644
index c91edae..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/QueryUtils.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-public class QueryUtils 
-{
-   QueryUtils()
-   {
-   }
-   
-   
-   public boolean isGetStatsCmd(Query qryObj)
-   {
-      if (qryObj.getQueryText().matches("(?i)(?s)get\\s+statistics.*") )
-         return true;
-      return false;
-   }
-}


[20/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/DatabaseQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/DatabaseQuery.java b/core/conn/trafci/src/main/java/org/trafodion/ci/DatabaseQuery.java
new file mode 100644
index 0000000..8b8b2ac
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/DatabaseQuery.java
@@ -0,0 +1,1804 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.IOException;
+import java.sql.ParameterMetaData;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Types;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.sql.PreparedStatement;
+import org.trafodion.jdbc.t4.TrafT4Connection;
+import org.trafodion.jdbc.t4.TrafT4Statement;
+import java.sql.CallableStatement;
+
+
+public class DatabaseQuery extends QueryWrapper
+{
+
+   private HashMap<String,String> dbKeyMap=null;
+   private int[] colSize={};
+   private int[] colAlign={};
+   private List<String> procParamList=null;
+   CallableStatement cStmt =null;
+   String[] columnNameArray={};
+   boolean getStatsDone = false;
+   boolean implicitQry  = false;
+   String qryText = null;
+   String getStatsCmd = "get statistics";
+   String getStatsNcCmd = "get statistics, options 'nc'";
+   public ResultSet rsObj = null;
+   String userQry = null;
+   boolean userQryTrimOut = false;
+   
+   //Create a pattern for matching parameter names
+   private static Pattern queryParamNamesPattern =
+	   Pattern.compile("^(.*)?([=\\+\\-~( ]\\s*\\?)([a-zA-Z0-9_]*)(.*)",Pattern.MULTILINE);
+
+   // this string array constants should match the cases grouped in ValidateQuery object.
+   // All commands beginning with SHOW have the trimOut flag set to true in the default case
+   // of executeInternal method. 
+   
+   private final String[] trimKeysList={ "INVOKE",
+                                "SHOWDDL",
+                                "SHOWSHAPE",
+                                "SHOWCONTROL",
+                                "SHOWTRANSACTION",
+                                "REORG",
+                                "REORGANIZE",
+                                "MAINTAIN",
+                                "REPLICATE",
+                                "SHOWLABEL",
+                                "SHOWPLAN",
+                                "EXPLAIN",
+                                "GET"
+                                       };
+
+   HashMap<Integer,String> inOutParamMap=null;
+   DatabaseQuery()
+   {
+
+   }
+
+   DatabaseQuery(Session sessObj)
+   {
+      super(sessObj);
+      loadDbKeyWordMap();
+   }
+   
+   public void execute() throws IOException, SQLException, UnKnownInterfaceCommand, UserInterruption
+   {
+	   try{
+           executeInternal();
+       }catch(IOException ioe){
+           throw ioe;
+       }catch(SQLException sqlex){
+           throw sqlex;
+       }catch(UnKnownInterfaceCommand uic){
+           throw uic;
+       }catch(UserInterruption ui){
+           throw ui;
+       }catch(Exception ex){
+           if(Boolean.getBoolean("trafci.enableTrace"))
+             ex.printStackTrace();
+           
+           ErrorObject internalError = new ErrorObject(SessionError.INTERNAL_ERR.errorCode(), 
+                   SessionError.INTERNAL_ERR.errorMessage() + " Details=" + ex.getMessage());
+           
+           writer.writeError(sessObj,internalError);
+                  
+           throw new UnKnownInterfaceCommand();
+       }
+   }
+   
+   public void executeInternal() throws IOException, SQLException, UnKnownInterfaceCommand, UserInterruption
+   {
+	   
+      String stmtName=null;
+      String cmdToken=null;
+      getStatsDone=false;
+      sessObj.setImplicitGetStatsQry(false);
+
+      init();
+
+      qryObj.resetRowCount();
+      qryObj.setStmtType(null);
+
+      readQuery();
+  
+      /* Check for pattern*/
+      String key,value=null;
+      boolean matchedPattern = false;
+      
+      for (int i=0;i < sessObj.getMaxPatternDepth() ; i++)
+      {
+    	  //Look for $$KEY$$ pattern
+    	  Matcher mat = parser.getKeyPatternMatcher(queryStr);
+    	  StringBuffer sb = new StringBuffer();
+    	  while (mat.find()) {
+    		  key = mat.group(2);
+    		  value = sessObj.getPatternValue(key);
+			  if (value!=null)
+			  {
+				  key = "$$" + key + "$$";
+			      key = key.replaceAll("\\$","\\\\\\$"); // Every $ needs to be replaced with \$. Do not delete the backslashes.se
+			      if (mat.group(1)!=null)
+			    	  mat.appendReplacement(sb,mat.group(1) + value);
+			      else
+			    	  mat.appendReplacement(sb, value);
+			      matchedPattern = true;
+		      }
+    	  }
+    	  
+    	  if (matchedPattern) 
+    	  {
+    		  mat.appendTail(sb);
+    		  queryStr = sb.toString();
+    		  parser.setRemainderStr(queryStr);
+    	  }
+    	 
+	      //Look for regular expression pattern
+    	  HashMap<String,String> regExpMap = sessObj.getRegExpMap();
+    	  if (regExpMap != null )
+    	  {
+    		  Iterator<String> regExpMapIt = regExpMap.keySet().iterator();
+    		  String regExpPat = null;
+    		  while (regExpMapIt.hasNext())
+    		  {
+    			  regExpPat =  (String)regExpMapIt.next();
+    			  if (sessObj.isDebugOn())
+                	  System.out.println(this.getClass().getName() +  ":: regExpPat :"+ regExpPat);
+    			  if (queryStr.matches(regExpPat))
+    			  {
+    				  matchedPattern = true;
+    				  queryStr = queryStr.replaceFirst(regExpPat,regExpMap.get(regExpPat).toString());
+    			  }
+    		  }
+	    	  
+	      }//End IF-ELSE
+    	  qryObj.setQueryId(sessObj.getVQryObj().getQueryId(queryStr));
+    	  parser.setRemainderStr(queryStr);
+      }//End For
+
+      if (sessObj.isDebugOn())
+    	  System.out.println(this.getClass().getName() +  ":: QueryStr :"+ queryStr);
+      
+      /* Commenting this for now until I fix all the issues for interface commands */
+      /*
+      if ((matchedPattern) && dbKeyMap.get(sessObj.getVQryObj().getFirstToken(queryStr))==null) {
+    	  InputStream theStream = new ByteArrayInputStream(queryStr.getBytes());
+    	  sessObj.setLogCmdEcho(false);
+    	  sessObj.iQryObj.execObeyStream(theStream, "Pattern Replacement");
+    	  return;
+      }
+      */
+
+      switch (qryObj.getQueryId())
+      {
+
+         // the first key word is set
+         case SessionDefaults.SET:
+            parser.getNextKeyToken();
+            execSet();
+            break;
+
+         case SessionDefaults.PREPARE:
+            parsePrepareStmt();
+            break;
+
+         case SessionDefaults.EXECUTE:
+            bind();
+            break;
+
+         case SessionDefaults.CALL:
+            procParamList = getParamNames(parser.getRemainderStr());
+            if (sessObj.isSessionAutoPrepare())
+            {
+               prepare(parser.getRemainderStr(), sessObj.getAutoPrepStmtName());
+               executeProcedure(procParamList,false);
+            }
+            else
+            {
+               prepareCallStmt(null);
+               executeProcedure(procParamList,true);
+            }
+
+            break;
+
+         case SessionDefaults.INFOSTATS:
+            cmdToken = parser.getNextKeyToken();
+            stmtName = parser.getNextValueToken();
+            if (cmdToken != null && (stmtName !=null && !stmtName.trim().equals("")))
+            {
+               stmtName = "\"" + stmtName + "\"";
+               if (parser.getRemainderStr() != null)
+               {
+                  queryStr=cmdToken + " " + stmtName + parser.getRemainderStr();
+               }
+               else
+               {
+                  queryStr=cmdToken + " " + stmtName ;
+               }
+
+            }
+            executeQuery(true);
+            break;
+
+         case SessionDefaults.GET:
+            execGet(true);
+            break;
+            
+         case SessionDefaults.CONTROL:
+             execControl();
+             break;
+            
+         default:
+            
+            //For commands beginning with SHOW (SHOWTRANSACTION,SHOWSET)
+            //set the trimout flag to true
+            if (qryObj.getQueryText().matches("(?is)SHOW.+"))
+               qryObj.setTrimOut(true);
+            if (sessObj.isSessionAutoPrepare())
+            {
+               prepare(parser.getRemainderStr(),sessObj.getAutoPrepStmtName());
+               parser.setRemainderStr("EXECUTE " + sessObj.getAutoPrepStmtName());
+               bind();
+            }
+            else
+            {
+               executeQuery(true);
+            }
+      }
+
+      /*
+      send an implicit GET STATISTICS command to
+      display the statistics for the previously
+      executed SQL statement. This is done only
+      when statistics in enabled via a SET STATISTICS
+      ON command.
+      */
+      if (sessObj.isSessionStatsEnabled() && !getStatsDone && !blockGetStats())
+      {
+         boolean oldstate = sessObj.isSessionTimingOn();
+         /* Store the query and reset the query text with this
+          * value once get statistics is executed. This is needed to
+          * avoid get statistics to be added in history.
+          */
+         userQry = qryObj.getQueryText();
+         userQryTrimOut = qryObj.isTrimOut();
+         sessObj.setImplicitGetStatsQry(true);
+         try 
+         {
+            sessObj.setSessionTiming(false);
+            writer.writeStatusMsg( sessObj,  qryObj,  utils,  writer);
+            writer.writeln();
+         } finally 
+         {
+            sessObj.setSessionTiming(oldstate);
+         }
+
+         //Overwrite the queryStr with the 'GET STATISTICS'
+         //command. dbExec executes the command stored in
+         //queryStr.
+         queryStr = getStatsCmd;
+         qryObj.resetQueryText(queryStr);
+         parser.setRemainderStr(queryStr);
+         String qryRowCnt = qryObj.getRowCount();
+         qryObj.setRowCount(null);
+         execGet(false);
+         //Reset the record count to row count of the
+         //original query
+         qryObj.setRowCount(qryRowCnt);
+                 
+         
+      }
+
+   }
+
+   private void parsePrepareStmt() throws IOException, SQLWarning, SQLException, UnKnownInterfaceCommand
+   {
+//      PreparedStatement pStmt=null;
+      String stmtName=null;
+      String query=null;
+      String fromKeyToken=null;
+
+      parser.getNextKeyToken();
+      stmtName = parser.getNextPreparedStmtNameToken();
+      if (stmtName==null)
+      {
+         writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
+         throw uic;
+      }
+      fromKeyToken = parser.getNextKeyToken();
+      if (fromKeyToken == null || !fromKeyToken.equalsIgnoreCase("FROM"))
+      {
+         writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
+         throw uic;
+      }
+      query = parser.getRemainderStr().trim();
+      if (query == null || query.equalsIgnoreCase(""))
+      {
+         writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
+         throw uic;
+      }
+
+      prepare(query,stmtName);
+   }
+
+   private void prepare(String qry,String stmtName) throws SQLException, IOException
+   {
+      PreparedStatement pStmt = null;
+      boolean trimFlag = false;
+      for (int i=0;i < trimKeysList.length;i++)
+      {
+         if (qry.toUpperCase().startsWith(trimKeysList[i]))
+         {
+            trimFlag=true;
+            break;
+         }
+      }
+
+      //Changes to support PREPARE on SPJ's
+      if (qry.toUpperCase().startsWith("CALL"))
+      {
+         // Assign the sql query to queryStr. queryStr will be used
+         // to prepare the statement
+         queryStr = qry;
+         try
+         {
+            prepareCallStmt(stmtName);
+         }catch (SQLException sqlEx)
+         {
+            sessObj.removePrepStmtMap(stmtName);
+            throw sqlEx;
+         }
+         sessObj.setPrepStmtMap(stmtName,(Object)cStmt,trimFlag);
+         return;
+      }
+
+      sessObj.setQryStartTime();
+      if(sessObj.getPrepStmtMap(stmtName) != null)
+      {
+         sessObj.getPrepStmtMap(stmtName).close();
+         sessObj.removePrepStmtMap(stmtName);
+      } 
+      try
+      {
+         pStmt =((TrafT4Connection)conn).prepareStatement(qry,"\"" + stmtName + "\"");
+      }catch (SQLException sqlEx)
+      {
+         sessObj.removePrepStmtMap(stmtName);
+         throw sqlEx;
+      }
+     
+      sessObj.setQryEndTime();
+      
+      sessObj.setPrepStmtMap(stmtName,(Object)pStmt,trimFlag);
+      writeAllSQLWarnings(pStmt.getWarnings());
+      pStmt.clearWarnings();
+      /* This is to print the status message for XML/HTML correctly */
+      qryObj.setRowCount("0");
+   }
+
+   /**
+    *  Returns the evaluated parameter value.
+    *
+    *  @param   inputStr  The input string as the user specified it
+    *  @return  the evaluated input string (parameter value)
+    *
+    */
+   private String evaluateParameterValue(String inputStr) {
+       try {
+          ParamStringObject psv = parser.getParamValue(inputStr);
+          return psv.getParameterValue();
+
+      } catch(Exception e) {
+      }
+
+      return  inputStr;
+
+   }   /*  End of  evaluateParameterValue  method.  */
+   
+   private void bind() throws IOException, UnKnownInterfaceCommand, SQLException, UserInterruption
+   {
+      String keyToken = null;
+      String stmtName = null;
+      PreparedStatement pStmt;
+      List<String> paramList=null;
+      String[] errParams=new String[1];
+
+      keyToken = parser.getNextKeyToken();
+      stmtName = parser.getNextPreparedStmtNameToken();
+      if (stmtName == null)
+      {
+         writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
+         throw uic;
+      }
+      if (parser.hasMoreTokens())
+      {
+         keyToken = parser.getNextKeyToken();
+         if ((keyToken == null) || !(keyToken.equalsIgnoreCase("USING")))
+         {
+            writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
+            throw uic;
+         }
+
+         paramList = parser.getNextParamListToken();
+         if (paramList == null || paramList.size()==0)
+         {
+            writeln(ise.getSyntaxError(this.queryStr,parser.getRemainderStr()).errorMessage());
+            throw uic;
+
+         }
+         for (int i=0;i < paramList.size(); i++)
+         {
+            String paramValue=null;
+            if (paramList.get(i).toString().matches("^\\?\\S+"))
+            {
+               paramValue=sessObj.getSessParams(paramList.get(i).toString().substring(1));
+               if (paramValue != null)
+               {
+                  paramList.remove(i);
+                  paramList.add(i,evaluateParameterValue(paramValue));
+               }
+
+            }
+         }
+      }
+
+      // code repeated in blockGetStats, any changes here needs to
+      // be updated in the blockGetStats method also.
+      pStmt = (PreparedStatement)sessObj.getPrepStmtMap(stmtName);
+      org.trafodion.jdbc.t4.TrafT4PreparedStatement hpt4Stmt=(org.trafodion.jdbc.t4.TrafT4PreparedStatement)sessObj.getPrepStmtMap(stmtName);
+ 
+      if (pStmt == null)
+      {
+         errParams[0]=stmtName;
+         writer.writeError(sessObj, 'E',SessionError.STMT_NOT_FOUND,errParams);
+         throw uic;
+      }
+
+      String sqlQueryStr=((TrafT4Statement)pStmt).getSQL();
+      List<String> namedParamList=getParamNames(sqlQueryStr);
+      
+      // if using class is specified, merge the named parameters
+      // and unnamed params and create one param list
+      if (paramList != null)
+      {
+         int paramListIdx=0;
+         for (int j=0;j < namedParamList.size(); j++)
+         {
+            if (namedParamList.get(j).toString().matches("^\\?"))
+            {
+               if (paramList.size() < paramListIdx+1)
+               {
+                  break;
+               };
+               namedParamList.remove(j);
+               namedParamList.add(j,paramList.get(paramListIdx));
+               paramListIdx++;
+            };
+         }
+
+      }
+      paramList=namedParamList;
+
+      if (sqlQueryStr.toUpperCase().startsWith("CALL"))
+      {
+         qryObj.setStmtType(hpt4Stmt.getStatementType());
+         cStmt = (CallableStatement)pStmt;
+         sessObj.setQryStartTime();
+         executeProcedure(paramList,false);
+         return;
+      }
+
+      if (paramList !=null)
+      {
+         int namedParamErrors=0;
+         int index=0;
+
+         for (int i=0;i<paramList.size();i++)
+         {
+            String value=paramList.get(i).toString();
+            String paramName=value;
+            if (!(paramList.subList(0,i).contains(paramName)) || !paramList.get(i).toString().startsWith("?"))
+            {
+               if (value.matches("^\\?\\S+"))
+               {
+            	   String pv = (String) sessObj.getSessParams(value.substring(1));
+                   value = evaluateParameterValue(pv);
+               }
+               if ((value == null) || (paramName.equals("?")))
+               {
+                  if (paramName.equals("?"))
+                     paramName="?(UNNAMED_"+ (i+1) +")";
+
+                  writer.writeInterfaceErrors(sessObj, new ErrorObject(SessionError.PARAM_NOT_FOUND, "", paramName + " was not found"));
+                  
+                  namedParamErrors++;
+                  continue;
+
+               }
+//               dead code 
+//               if (value== null) 
+//            	   value=paramList.get(i).toString();
+               value=value.replaceAll("\'\'","\'");
+               try
+               {
+                  if (value!=null)
+                  {
+                     if (value.equalsIgnoreCase("NULL"))
+                        pStmt.setNull(index+1,Types.NULL);
+                     else
+                     {
+                        pStmt.setObject(index+1,new String(value.toString()));
+                     }
+                  }
+                  
+               }catch (NumberFormatException nfe)
+               {
+                  writer.writeError(sessObj,SessionError.NUMERIC_VAL_REQ);
+                  namedParamErrors++;
+                  continue;
+                  //throw uic;
+               }
+               finally
+               {
+            	   index++;
+               }
+            }
+         }
+
+         if (namedParamErrors >0)
+         {
+            throw uic;
+         }
+      }
+
+      sessObj.setQryStartTime();
+      if (!sessObj.getPrepTrimOut(stmtName))
+      {
+         pStmt.setMaxRows(sessObj.getListCount());
+      }else
+      {
+         qryObj.setTrimOut(true);
+      }
+               
+      boolean moreResults = dbExec(pStmt);
+      writeAllSQLWarnings(pStmt.getWarnings());
+      pStmt.clearWarnings();
+      qryObj.setStmtType(hpt4Stmt.getStatementType());
+
+      if (hpt4Stmt.getSQL().matches("(?i)\\s*CREATE\\s+((SET|VOLATILE|SET VOLATILE)\\s+)?TABLE\\s+.*\\s+AS\\s+SELECT\\s+.*"))
+    	  qryObj.setStmtType("CREATE_TABLE_AS");
+      
+      if (moreResults)
+      {
+         fetchResults(pStmt.getResultSet());
+      }
+      else
+      {
+         super.setQueryRowCount(pStmt);
+         
+         /* Modified this fix to call the execSet method for
+          * EXECUTE on SET SCHEMA and SET CATALOG
+          * instead of repeating the code again.
+          */
+         if ((sqlQueryStr.trim().matches("(?i)(?s)SET\\s+SCHEMA.*")) ||
+             (sqlQueryStr.trim().matches("(?i)(?s)SET\\s+CATALOG.*"))
+            )
+         {
+            String origQuery = qryObj.getQueryText();
+            qryObj.resetQueryText(sqlQueryStr);
+            queryStr = sqlQueryStr;
+            parser.setRemainderStr(sqlQueryStr);
+            parser.getNextKeyToken();
+            execSet();
+            qryObj.resetQueryText(origQuery);
+         }
+      
+         sessObj.setQryEndTime();
+         
+      }
+
+   }
+
+   private void prepareCallStmt(String stmtName) throws SQLException, IOException
+   {
+      sessObj.setQryStartTime();
+      //create a callable statement object for invoking SPJ's
+      try
+      {
+         if(sessObj.getPrepStmtMap(stmtName) != null)
+         {
+            sessObj.getPrepStmtMap(stmtName).close();
+            sessObj.removePrepStmtMap(stmtName);
+         } 
+      }catch(SQLException sqlEx){
+         ;
+      }
+      
+      try
+      {
+         cStmt = ((TrafT4Connection)conn).prepareCall(queryStr,"\"" + stmtName + "\"");
+      } catch (NoSuchMethodError nsme)
+      {
+         if (stmtName == null)
+            cStmt = conn.prepareCall(queryStr);
+         else
+         {
+            throw new SQLException(SessionError.CALL_ERR.errorMessage());
+         }
+      }
+      writeAllSQLWarnings(cStmt.getWarnings());
+      cStmt.clearWarnings();
+      sessObj.setQryEndTime();
+      /* This is to print the status message for XML/HTML correctly */
+      qryObj.setRowCount("0");
+
+   }
+
+   private void executeProcedure(List<String> callParamList,boolean deAllocStmt) throws IOException, UnKnownInterfaceCommand, SQLException
+   {
+      ParameterMetaData paramMetaData=null;
+      String paramName=null;
+      inOutParamMap = new HashMap<Integer,String>(); // contains the parameter index and the param name for INOUT and OUT params
+      boolean paramsExist = false; // this will be set to true only if the SPJ contains INOUT and OUT params
+      String value=null;
+      int namedParamErrors=0;
+      ResultSet rs=null;
+
+      if (callParamList.size() != 0)
+      {
+         paramMetaData = cStmt.getParameterMetaData();
+         if ((paramMetaData !=null))
+         {
+            //Set the values for dynamic parameters and register the
+            //out parameters
+            for (int i=1;i<=paramMetaData.getParameterCount();i++)
+            {
+               value = callParamList.get(i-1).toString();
+               paramName = value;
+
+               switch (paramMetaData.getParameterMode(i))
+               {
+                  case ParameterMetaData.parameterModeIn:
+                     //If named parameters have been specified, retrieve the value
+                     //from the session params hashmap and set the value in the
+                     //callable statement.
+                     if (value.matches("^\\?(\\S+)"))
+                     {
+                    	 String pv = (String) sessObj.getSessParams(value.substring(1));
+                         value = evaluateParameterValue(pv);
+                         if (sessObj.isDebugOn())
+                         {
+                        	 System.out.println("@@@Debug: DatabaseQuery:: pv = " +  pv);
+                             System.out.println("@@@Debug: DatabaseQuery:: value = " + value);
+                         }
+                     }
+                     if ((value == null) || paramName.equals("?"))
+                     {
+                        if (paramName.equals("?"))
+                           paramName="?(UNNAMED_"+ i +")";
+                        //writer.writeln("ERROR: Param "+paramName+ " was not found.");
+                        //String errorStr = "ERROR: Param "+paramName+ " was not found.";
+                        writer.writeInterfaceErrors(sessObj, new ErrorObject(SessionError.PARAM_NOT_FOUND, "", paramName + " was not found"));
+                        namedParamErrors++;
+                        continue;
+                     }
+                     try
+                     {
+                        if (value.equalsIgnoreCase("NULL"))
+                        {
+                           cStmt.setNull(i,Types.NULL);
+                        }
+                        else
+                        {
+                           cStmt.setObject(i,value);
+                        }
+                     }catch (NumberFormatException nfe)
+                     {
+                        writer.writeError(sessObj, SessionError.NUMERIC_VAL_REQ);
+                        namedParamErrors++;
+                        continue;
+                        //throw uic;
+                     }
+
+
+                     break;
+
+                  case ParameterMetaData.parameterModeInOut:
+
+                     if (value.matches("^\\?(\\S+)"))
+                     {
+                    	 String pv = (String) sessObj.getSessParams(value.substring(1));
+                         value = evaluateParameterValue(pv);
+                     }
+                     if ((value == null) || paramName.equals("?"))
+                     {
+                        if (paramName.equals("?"))
+                           paramName="?(UNNAMED_"+ i +")";
+                        //writer.writeln("ERROR: Param "+paramName+ " was not found.");
+                        //String errorStr = "ERROR: Param "+paramName+ " was not found.";
+                        writer.writeInterfaceErrors(sessObj, new ErrorObject(SessionError.PARAM_NOT_FOUND, "", paramName + " was not found"));
+                        namedParamErrors++;
+                        continue;
+                     }
+                     try
+                     {
+                        if (value.equalsIgnoreCase("NULL"))
+                        {
+                           cStmt.setNull(i,Types.NULL);
+                        }
+                        else
+                        {
+                           cStmt.setObject(i,value);
+                        }
+                     }catch (NumberFormatException nfe)
+                     {
+                        writer.writeError(sessObj, SessionError.NUMERIC_VAL_REQ);
+                        namedParamErrors++;
+                        continue;
+                        //throw uic;
+                     }
+
+                     if (paramName.matches("^\\?(\\S+)"))
+                        inOutParamMap.put(new Integer(i),paramName.substring(1));
+
+                     if (!paramsExist)
+                        paramsExist=true;
+
+                     break;
+
+                  case ParameterMetaData.parameterModeOut:
+                     cStmt.registerOutParameter(i,paramMetaData.getParameterType(i));
+                     // Add the param name and the index to the inOut Hashmap.
+                     // This will be used to bind the inout and out param values after
+                     // execute
+                     if (paramName.matches("^\\?(\\S+)"))
+                     {
+                        inOutParamMap.put(new Integer(i),paramName.substring(1));
+                     }
+
+                     if (!paramsExist)
+                        paramsExist=true;
+                     break;
+
+               } // end switch
+
+               //}// end if match()
+            } // end for
+         } //end if
+
+      }
+
+      if (namedParamErrors > 0)
+         throw uic;
+
+      sessObj.setInOutandRS(false);
+      qryText = qryObj.getQueryText();
+      ResultSetMetaData rsmd = cStmt.getMetaData();
+      boolean moreResults=dbExec(cStmt);
+      sessObj.setQryEndTime();
+      SQLWarning sqlWarn = cStmt.getWarnings();
+      writer.writeAllSQLWarnings(sessObj,sqlWarn);
+      qryObj.setRowCount(null);
+
+      if (rsmd !=null)
+      {
+         //call the write method only if the SPJ contains INOUT and OUT params
+         if (paramsExist)
+         {
+           if (sessObj.isSPJRS())
+               sessObj.setSPJRS(false);
+           writeOutParams(rsmd,rsmd.getColumnCount(),paramMetaData,cStmt);
+         
+         writer.writeln();
+         }
+      }
+
+      if (moreResults)
+      {
+         if (paramsExist)
+            sessObj.setInOutandRS(true);
+         sessObj.setSPJRS(true);
+         qryObj.setRsCount(0);
+         qryObj.setRowCount(null);
+         while (moreResults)
+         {
+            rs = cStmt.getResultSet();
+            fetchResults(rs);
+            qryObj.incrRsCount();
+            qryObj.resetQueryText("SELECT *"); // Need to reset the qrytext to display no. of rows selected for status msg
+            writer.writeStatusMsg(sessObj,qryObj,utils, writer);
+            qryObj.resetQueryText(qryText); // Resetting the qry back to the original query Text for final status msg
+            writer.writeln();
+            qryObj.setRowCount(null);
+            sessObj.setInOutandRS(false);
+            //Check this without type casting to TrafT4Statement
+            moreResults = ((TrafT4Statement)cStmt).getMoreResults();
+         }
+         qryObj.setRowCount(new Integer(qryObj.getRsCount()).toString());
+         sessObj.setSPJRS(false);
+      }
+      else if (paramsExist)
+      {
+         qryObj.setRowCount("1");
+      }
+      else
+         qryObj.setRowCount("0");
+      if (deAllocStmt)
+         cStmt.close();
+   }
+
+   
+   private void execControl() throws SQLException, IOException, UnKnownInterfaceCommand, UserInterruption
+   {
+	   String remStr = parser.getRemainderStr();
+	   
+	   if (remStr.matches("(?is)\\s*CONTROL\\s+QUERY\\s+DEFAULT\\s+SCHEMA\\s+(.*)") || 
+		   remStr.matches("(?is)\\s*CONTROL\\s+QUERY\\s+DEFAULT\\s+DEFAULT_SCHEMA_NAMETYPE\\s+(.*)"))
+	   {
+		   executeQuery(true);
+		   queryStr = "showcontrol default schema, match full, no header";
+		   try {
+			   java.sql.Statement stmtSch = conn.createStatement();
+			   ResultSet rs = stmtSch.executeQuery(queryStr);
+			   
+			   if (rs!=null && rs.next())
+		       {
+				   sessObj.setSessionSchema(rs.getString(1));
+		       }
+		       rs.close();
+		       stmtSch.close();
+		    } catch (Exception ex)
+		    {
+		        // System.out.println("Error : ExecControl :"+ex.getMessage());
+		    }
+	   }
+	   else
+	   {
+		   executeQuery(true);
+		  
+	   }
+   }
+   
+   private void execSet() throws SQLException, IOException, UnKnownInterfaceCommand, UserInterruption
+   {
+      String setOption=parser.getNextKeyToken();
+      
+      // not a keyword..then its not ours
+      if (setOption == null)
+      {
+         executeQuery(true);
+         return;
+      }
+      else
+      {
+         setOption=(String) dbKeyMap.get("SET_"+setOption.toUpperCase());
+
+         if (setOption == null)
+         {
+            executeQuery(true);
+            return;
+         }
+
+         int setId=Integer.parseInt(setOption);
+         switch (setId)
+         {
+            case SessionDefaults.SET_SCHEMA:
+               executeQuery(true);
+               List<String> csList=parser.getCSTList(parser.getRemainderStr());
+               switch (csList.size())
+               {
+                  case 2:
+                     conn.setCatalog(csList.get(0).toString());
+                     sessObj.setSessionCtlg(conn.getCatalog());
+                     sessObj.setSessionSchema(csList.get(1).toString());
+                     break;
+                  case 1:
+                     sessObj.setSessionSchema(csList.get(0).toString());
+                     break;
+               }
+               sessObj.getEnvMap().put("SCHEMA", sessObj.getSessionSchema());
+               // This is needed in the blockGetStats method
+               qryObj.setQueryId(setId);
+               break;
+               
+            case SessionDefaults.SET_CATALOG:
+               sessObj.setQryStartTime();
+               String ctlgValue = parser.getCatalogToken();
+               if (ctlgValue == null)
+                  ctlgValue="";
+               conn.setCatalog(ctlgValue);
+               sessObj.setQryEndTime();
+               sessObj.setSessionCtlg(conn.getCatalog());
+               sessObj.getEnvMap().put("CATALOG", sessObj.getSessionCtlg());
+               qryObj.setRowCount("0");
+               qryObj.setQueryId(setId);
+               break;
+
+            case SessionDefaults.SET_SERVICE:
+               executeQuery(true);
+               break;
+         
+               
+            default:
+               executeQuery(true);
+               break;
+         }
+      }
+
+
+
+   }
+   
+   public boolean  userExecutedGetStatistics()
+   {
+       return getStatsDone;
+   }
+
+
+   private void execGet(boolean setQueryStartTimeFlag) throws SQLException, IOException, UnKnownInterfaceCommand
+   {
+	  float prodVersion = 0.0f;
+     
+      parser.getNextKeyToken();
+      if (!Utils.trimSQLTerminator(qryObj.getQueryText(), sessObj.getSessionSQLTerminator()).matches("(?i)\\s*get\\s+service\\s*"))
+         qryObj.setTrimOut(true);
+      else
+         qryObj.setTrimOut(false);
+
+      String getOption=parser.getNextWordToken();
+      if ((getOption != null) && (getOption.toUpperCase().equals("STATISTICS")))
+      {
+         try {
+        	 
+        	 if (sessObj.isDebugOn())
+            	 System.out.println("Database Query::execGet:: " + prodVersion);
+
+         } catch (NullPointerException npe){}
+         getOption = parser.getNextKeyToken();
+         if (getOption == null)
+         {
+               queryStr = getStatsNcCmd;
+         }
+         if (sessObj.isDebugOn())
+         {
+        	 System.out.println("Database Query::execGet:: " + queryStr);
+         }
+         try
+         {
+            executeQuery(setQueryStartTimeFlag);
+            if (setQueryStartTimeFlag)
+               getStatsDone=true;
+            
+         }catch (SQLException sqlEx)
+         {
+            getStatsDone=false;
+            throw sqlEx;
+         }
+      }
+      else
+      {
+         executeQuery(true);
+      }
+
+   }
+   
+   public void resetQryObj()
+   {
+      if ((sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT) &&
+          (sessObj.getDisplayFormat() != SessionDefaults.HTML_FORMAT) &&
+          (sessObj.isImplicitGetStatsQry())
+          )
+      {
+         qryObj.resetQueryText(userQry);
+         qryObj.setTrimOut(userQryTrimOut);
+      }
+  
+   }
+
+
+   private void executeQuery(boolean setQueryStartTimeFlag) throws SQLException, IOException, UnKnownInterfaceCommand
+   {
+      if (setQueryStartTimeFlag)
+         sessObj.setQryStartTime();
+      //    if the list count is set..
+      if (!qryObj.isTrimOut() && sessObj.getListCount() !=0)
+      {
+         stmt.setMaxRows(sessObj.getListCount());
+      }else
+      {
+         stmt.setMaxRows(0);
+      }
+      
+      // Check to see if query string has ? mark characters
+      boolean paramsPatternFound = false;
+      boolean queryHasParams = ( queryStr.indexOf("?") != -1 );
+      if (queryHasParams)
+      {
+    	  // Doing a more expensive pattern matching check to see if the ? is a 
+    	  // parameter and not a literal.
+    	  try {
+    		  Matcher mat = queryParamNamesPattern.matcher(queryStr);
+    		  paramsPatternFound = mat.find();
+    		  if (sessObj.isDebugOn())
+    			  System.out.println(this.getClass().getName() +
+    					  ":: Matcher.find : " + queryHasParams);
+    	  } catch (Exception ex) 
+    	  {
+    		  if (sessObj.isDebugOn())
+    			  System.out.println(this.getClass().getName() +
+    					 ":: Param name regexp pattern error : " +
+    					 ex.getMessage());
+    	  }
+      }
+            
+      if ((queryHasParams || paramsPatternFound)  &&
+          (qryObj.getQueryId() != SessionDefaults.EXPLAIN)   &&
+          (qryObj.getQueryId() != SessionDefaults.SHOWPLAN)  &&
+          (qryObj.getQueryId() != SessionDefaults.SHOWSHAPE) )
+      {
+         List<String> paramList=getParamNames(queryStr);
+         if (paramList.size() > 0)
+         {
+            PreparedStatement ps=null;
+            ps=conn.prepareStatement(queryStr);
+            String paramName=null;
+            String paramValue=null;
+            int namedParamErrors=0;
+
+            int index=0;
+            for (int i=0;i < paramList.size(); i++)
+            {
+               paramName=paramList.get(i).toString();
+               if (!( paramList.subList(0,i).contains(paramName)))
+               {
+                  if (paramName.equals("?"))
+                  {
+                     paramName="?(UNNAMED_"+ (i+1) +")";
+                  }
+                  if ((paramValue=sessObj.getSessParams(paramName.substring(1))) == null)
+                  {
+                     writer.writeInterfaceErrors(sessObj, new ErrorObject(SessionError.PARAM_NOT_FOUND, "", paramName + " was not found"));
+                     namedParamErrors++;
+                     continue;
+                  }
+                  paramValue = evaluateParameterValue(paramValue);
+                  try
+                  {
+                     if (paramValue.equalsIgnoreCase("NULL"))
+                     {
+                        ps.setNull(index+1,Types.NULL);
+                     }else
+                     {
+                        ps.setObject(index+1,paramValue);
+                     }
+                  }catch (NumberFormatException nfe)
+                  {
+                     writer.writeError(sessObj, SessionError.NUMERIC_VAL_REQ);
+                     namedParamErrors++;
+                     //throw uic;
+                     continue;
+                  }
+                  finally
+                  {
+                	  index++;  
+                  }
+               }
+            }
+            if (namedParamErrors>0)
+            {
+               throw uic;
+            }
+            ps.setMaxRows(sessObj.getListCount());
+
+            sessObj.setCurrentStmtObj(ps);
+
+            if (dbExec(ps))
+            {
+              
+               writeAllSQLWarnings(ps.getWarnings());
+               ps.clearWarnings();
+               fetchResults(ps.getResultSet());
+            }
+            else
+            {
+               writeAllSQLWarnings(ps.getWarnings());
+               ps.clearWarnings();
+                
+               sessObj.setCurrentStmtObj(null);
+               super.setQueryRowCount(ps);
+               sessObj.setQryEndTime();
+            }
+            
+            resetQryObj();
+            return;
+         }
+      }
+
+      sessObj.setCurrentStmtObj(stmt);
+
+      if (dbExec(stmt))
+      {
+         writeAllSQLWarnings(stmt.getWarnings());
+         
+         stmt.clearWarnings();
+         rsObj= stmt.getResultSet();
+         if (qryObj.getQueryId()==SessionDefaults.SHOW_SERVICE)
+            return; 
+         fetchResults(stmt.getResultSet());
+      }
+      else
+      {
+         writeAllSQLWarnings(stmt.getWarnings());
+         stmt.clearWarnings();
+         super.setQueryRowCount(stmt);
+         sessObj.setQryEndTime();
+      }
+
+      stmt.close();
+      sessObj.setStmtObj(sessObj.getConnObj().createStatement());
+      this.stmt=sessObj.getStmtObj();
+      resetQryObj();
+   }
+
+   private void fetchResults(ResultSet rs) throws SQLException, IOException
+   {
+      boolean isHeadingPrinted=false;
+      ResultSetMetaData rsmd=rs.getMetaData();
+      int numColumns = rsmd.getColumnCount();
+      int rowCnt=0;
+      qryObj.setColCount(String.valueOf(numColumns));
+      if (sessObj.getFetchSize() > 0)
+      {
+    	  rs.setFetchSize(sessObj.getFetchSize());
+      }
+
+      try {
+    	  for (rowCnt=0; rs.next();rowCnt++)
+          {
+             sessObj.setCurrentStmtObj(null);
+             if (sessObj.isQueryInterrupted())
+             {
+                writer.writeln(SessionDefaults.lineSeperator+"*** WARNING: User interrupt [^C] received. Truncating data ... ");
+                break;
+             }
+             
+             /**
+              *   Warnings are returned as part of fetch so
+              *   we need to handle them.
+              */
+             isHeadingPrinted = printAnyWarningsDuringFetch(rs, isHeadingPrinted);
+             
+             if (!isHeadingPrinted)
+             {
+                writeHeader(rsmd,numColumns);
+                isHeadingPrinted=true;
+             }
+             writeData(rs,numColumns);
+          }
+      } catch(java.lang.OutOfMemoryError e) {
+    	  /**
+    	   * Internal Analysis: JDBC Driver throws java.lang.OutOfMemoryError: Heap Out Space
+    	   * the Exception was thrown by interfaceResultSet.fetch() method.
+    	   * BufferedSize in JDBC exceeds and only can hold up to certain limit. 
+    	   * "length = 1493630996", which value is  very big that caused
+           *  the OutofMemoryEror
+    	   * 
+    	   * catch the OutOfMemory Exception 
+    	   */
+    	  throw new SQLException(
+    	     "Unable to display result data - OutOfMemory.");
+      }
+      
+      /**
+       *   Warnings are returned as part of fetch so
+       *   we need to handle them even if there are no results.
+       */
+      isHeadingPrinted = printAnyWarningsDuringFetch(rs, isHeadingPrinted);
+       
+      
+      // if heading printed, then there are some rows retrieved from the db. so write a new line at the end
+      if (isHeadingPrinted && sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+      {
+         writer.writeln();
+      }
+
+      if (sessObj.getListCount() != 0 && sessObj.getListCount() == rowCnt && !qryObj.isTrimOut())
+      {
+         qryObj.setStmtType("SELECT_LIST_COUNT");
+      }
+      if (!sessObj.isImplicitGetStatsQry())
+         qryObj.setRowCount(String.valueOf(rowCnt));
+
+      try
+      {
+         rs.close();
+      } catch (SQLException sqle)
+      {
+      }
+      finally
+      {
+         sessObj.setQryEndTime();
+      }
+   }
+
+   /**
+    *  Prints any warnings encountered as part of the fetch and displays
+    *  them inline with the results. The method takes care of automatically
+    *  printing headings for XML and HTML markups before the warnings are
+    *  printed out.
+    *
+    *  @param   rs                The ResultSet object
+    *  @param   isHeadingPrinted  Controls whether or not we need to print
+    *                             the headings
+    *
+    *  @return  Whether or not headings were printed out
+    *
+    */
+   private boolean printAnyWarningsDuringFetch(ResultSet rs,
+                                               boolean isHeadingPrinted)
+              throws SQLException, IOException {
+
+      /**
+       *   Check if the ResultSet parameter is valid.
+       */
+      if (null == rs)
+         return isHeadingPrinted;
+
+
+      /**
+       *   Second check is to see if we have any warnings.
+       */
+      SQLWarning  rsWarnings = rs.getWarnings();
+      if (null == rsWarnings)
+         return isHeadingPrinted;
+
+
+
+      /**
+       *   We could have probably passed these down as parameters -- but
+       *   rather than "burden" the stack, we just call these APIs when
+       *   there are warnings. These calls should anyway be "thin" calls.
+       */
+      ResultSetMetaData rsmd       = rs.getMetaData();
+      int               numColumns = rsmd.getColumnCount();
+
+
+      /**
+       *   Warnings are returned as part of fetch and
+       *   need to be displayed along with the results. However we need 
+       *   to print headings for XML and HTML markups before the warnings.
+       */
+      if (!isHeadingPrinted) {
+         /*  Get the display format currently in use.  */
+         int displayFmt = sessObj.getDisplayFormat();
+
+
+         /*
+          *  If heading was not printed, do so for HTML and XML markups.
+          *  This allows any warnings to be embedded within the output.
+          */
+         if ((SessionDefaults.XML_FORMAT == displayFmt)  ||
+             (SessionDefaults.HTML_FORMAT == displayFmt) ) {
+            writeHeader(rsmd, numColumns);
+            isHeadingPrinted = true;
+         }
+
+      }    /*  End of  IF  headings weren't printed.  */
+
+
+
+      /**
+       *   Warnings are returned as part of fetch.
+       *   We already checked for warnings, now just print 'em out.
+       *   Note calling rs.getWarnings() should clear the warnings, so
+       *   we don't have any warnings to do the next time around.
+       *   But JDBC/T4 didn't implement that part of the spec correctly
+       *   in older drivers, so we do some double work here and call
+       *   ResultSet.clearWarnings(). That way:
+       *      1>  We will work w/ older T4 drivers, which don't clear these.
+       *          So we got to step in and give a bit of a nudge!!
+       *      2>  On newer well-behaved T4 drivers, this becomes a NOOP.
+       *          We do the clearWarnings work twice (automatically done in 
+       *          the T4 driver) and once here when we have any warnings.
+       */
+      writer.writeAllFetchWarnings(sessObj, rsWarnings, numColumns);
+      sessObj.setSqlWarningsCnt(sessObj.getSqlWarningsCnt() + 1);
+      rs.clearWarnings();
+
+
+      /**
+       *  Returns the state of whether or not we printed the headings out.
+       */
+      return isHeadingPrinted;
+
+   }  /*  End of  printAnyWarningsDuringFetch  method.  */
+
+   private String writeData(ResultSet rs,int numColumns) throws SQLException, IOException
+   {
+     
+      for (int i=1;i<=numColumns ;i++)
+      {
+         String value=null;
+         try
+         {
+            value=rs.getString(i);
+            if (sessObj.getQuery().getQueryId() == SessionDefaults.SHOW_SERVICE)
+               return value;
+         } catch (SQLException sqlEx)
+         {
+            //For blob objects, getString() throws a SQLException.
+            //Displaying null in this case.
+         }
+
+         ResultSetMetaData rsmd = rs.getMetaData();
+         if(value != null && rsmd.getColumnType(i)==Types.TIMESTAMP && value.length() < rsmd.getColumnDisplaySize(i))
+         {
+          	 value = (value.trim()+"000000").substring(0,rsmd.getColumnDisplaySize(i));
+         } 
+         
+         if (value == null)
+         {
+            value=sessObj.getSessNull();
+            if (sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
+                value = "?";
+         }
+        
+         switch (sessObj.getDisplayFormat())
+         {
+            case SessionDefaults.RAW_FORMAT :
+               if (qryObj.isTrimOut())
+               {
+                  formatOutput(value,value.length(),' ',0);
+               }
+               else
+               {
+                  formatOutput(value,colSize[i-1],' ',colAlign[i-1]);
+               }
+
+               if (i < numColumns)
+               {
+                  writeSeparator();
+               }
+               break;
+
+
+            case SessionDefaults.XML_FORMAT :
+               formatXmlOutput(columnNameArray[i-1],value);
+               break;
+
+            case SessionDefaults.HTML_FORMAT:
+               formatHtmlOutput(value);
+               break;
+
+            case SessionDefaults.CSV_FORMAT:
+               formatCsvOutput(value);
+               break;
+         }
+
+      }
+
+      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+         writeln();
+
+      return null;
+   }
+
+   private void writeHeader(ResultSetMetaData rsmd,int numColumns) throws SQLException, IOException
+   {
+      columnNameArray = new String[numColumns];
+      colSize=new int[numColumns];
+      colAlign=new int[numColumns];
+      
+      int totalWidth = 0;
+      
+      if (qryObj.isTrimOut())
+      {
+         return;
+      }
+      for (int i=1;i<=numColumns ;i++)
+      {
+          
+         int colNameSize = rsmd.getColumnName(i).length(); 
+         if (sessObj.isMultiByteAlign() && (isoMapping == 10 || isoMapping == 15)) //SJIS or UTF8
+         {
+             try
+             {
+                 colNameSize = getMultiByteColWidth(new StringBuffer(rsmd.getColumnName(i)));
+             }
+             catch (Exception ex)
+             {
+                 ex.printStackTrace();
+             }
+         }  
+         
+         if (colNameSize > rsmd.getColumnDisplaySize(i))
+            colSize[i-1]=colNameSize;
+         else
+            colSize[i-1]=rsmd.getColumnDisplaySize(i);
+
+         if (colSize[i-1] < SessionDefaults.MIN_COL_DISPLAY_SIZE)
+         {
+            colSize[i-1] = SessionDefaults.MIN_COL_DISPLAY_SIZE;
+         }
+
+         totalWidth += colSize[i-1];
+         
+         switch (sessObj.getDisplayFormat())
+         {
+            case SessionDefaults.RAW_FORMAT:
+               if (numColumns ==1)
+                  formatOutput(rsmd.getColumnName(i),colNameSize,' ',0);
+               else
+               {
+                  if(sessObj.getSessView() == SessionDefaults.MXCI_VIEW && i == numColumns && totalWidth > SessionDefaults.MXCI_TRIM_FIX)
+                      formatOutput(rsmd.getColumnName(i),colNameSize,' ',0);
+                  else
+                      formatOutput(rsmd.getColumnName(i),colSize[i-1],' ',0);
+               }
+               if (i < numColumns)
+               {
+                  writeSeparator();
+                  
+                  /* total width has to be added twice in MXCI mode b/c it has
+                   * two separators
+                   */
+                  if(sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
+                      totalWidth++;
+                  
+                  totalWidth++;
+               }
+               break;
+
+            case SessionDefaults.XML_FORMAT:
+               columnNameArray[i-1] = sessObj.getXmlObj().checkColumnNames(utils.removeSpaces(rsmd.getColumnName(i)));
+               break;
+
+            case SessionDefaults.HTML_FORMAT:
+               formatHtmlOutput(rsmd.getColumnName(i));
+               break;
+
+            default:
+               break;
+         }
+
+         switch (rsmd.getColumnType(i))
+         {
+            case Types.BIGINT:
+            case Types.BIT:
+            case Types.DECIMAL:
+            case Types.DOUBLE:
+            case Types.FLOAT:
+            case Types.INTEGER:
+            case Types.NUMERIC:
+            case Types.REAL:
+            case Types.SMALLINT:
+            case Types.TINYINT:
+               colAlign[i-1]=1;
+               break;
+            default:
+               colAlign[i-1]=0;
+               break;
+
+         }
+      }
+
+      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+      {
+         writeln();
+         for (int i=1;i<=numColumns ;i++)
+         {
+            formatOutput("",colSize[i-1],'-',0);
+            if (i < numColumns)
+            {
+               writeSeparator();
+            }
+         }
+         writeln();
+         if (sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
+            writeln();
+      }
+   }
+
+   private void writeOutParams(ResultSetMetaData rsmd,int numColumns,ParameterMetaData paramMetaData,CallableStatement callStmt) throws SQLException, IOException
+   {
+      sessObj.setWriteParams(true);
+      columnNameArray = new String[numColumns];
+      colSize=new int[numColumns];
+      colAlign=new int[numColumns];
+      qryObj.setColCount(String.valueOf(numColumns));
+
+      if (qryObj.isTrimOut())
+      {
+         return;
+      }
+      for (int i=1;i<=numColumns;i++)
+      {
+         if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
+            paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
+         {
+            int colNameSize = rsmd.getColumnName(i).length();
+            if (colNameSize > rsmd.getColumnDisplaySize(i))
+               colSize[i-1]=colNameSize;
+            else
+               colSize[i-1]=rsmd.getColumnDisplaySize(i);
+
+            if (colSize[i-1] < SessionDefaults.MIN_COL_DISPLAY_SIZE)
+            {
+               colSize[i-1] = SessionDefaults.MIN_COL_DISPLAY_SIZE;
+            }
+
+            switch (sessObj.getDisplayFormat())
+            {
+               case SessionDefaults.RAW_FORMAT:
+                  formatOutput(rsmd.getColumnName(i),colSize[i-1],' ',0);
+                  if (i < numColumns)
+                  {
+                     writeSeparator();
+                  }
+                  break;
+
+               case SessionDefaults.XML_FORMAT:
+                  columnNameArray[i-1] = sessObj.getXmlObj().checkColumnNames(rsmd.getColumnName(i));
+                  break;
+
+               case SessionDefaults.HTML_FORMAT:
+                  formatHtmlOutput(rsmd.getColumnName(i));
+                  break;
+
+               default:
+                  break;
+            }
+
+            switch (rsmd.getColumnType(i))
+            {
+               case Types.BIGINT:
+               case Types.BIT:
+               case Types.DECIMAL:
+               case Types.DOUBLE:
+               case Types.FLOAT:
+               case Types.INTEGER:
+               case Types.NUMERIC:
+               case Types.REAL:
+               case Types.SMALLINT:
+               case Types.TINYINT:
+                  colAlign[i-1]=1;
+                  break;
+               default:
+                  colAlign[i-1]=0;
+                  break;
+
+            }
+         }
+      }
+      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+      {
+         writeln();
+         for (int i=1;i<=numColumns ;i++)
+         {
+            if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
+               paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
+            {
+               formatOutput("",colSize[i-1],'-',0);
+               if (i < numColumns)
+               {
+                  writeSeparator();
+               }
+            }
+         }
+         writeln();
+
+         if (sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
+            writeln();
+      }
+      writeData(callStmt,numColumns,paramMetaData);
+      qryObj.setRowCount("1");
+   }
+
+   private void writeData(CallableStatement callStmt,int numColumns, ParameterMetaData paramMetaData) throws SQLException, IOException
+   {
+      for (int i=1;i<=numColumns ;i++)
+      {
+         if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
+            paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
+         {
+            String value=callStmt.getString(i);
+            if (value == null)
+            {
+               value=sessObj.getSessNull();
+            }
+            // bind the inout and out params
+            Integer paramIdxObj = new Integer(i);
+            if (inOutParamMap != null && inOutParamMap.containsKey(paramIdxObj))
+            {
+               sessObj.setSessParams(inOutParamMap.get(paramIdxObj).toString(),value);
+            }
+
+            switch (sessObj.getDisplayFormat())
+            {
+               case SessionDefaults.RAW_FORMAT :
+                  if (qryObj.isTrimOut())
+                  {
+                     formatOutput(value,value.length(),' ',0);
+                  }
+                  else
+                  {
+                     formatOutput(value,colSize[i-1],' ',colAlign[i-1]);
+                  }
+
+                  if (i < numColumns)
+                  {
+                     writeSeparator();
+                  }
+                  break;
+
+
+               case SessionDefaults.XML_FORMAT :
+                  formatXmlOutput(columnNameArray[i-1],value);
+                  break;
+
+               case SessionDefaults.HTML_FORMAT:
+                  formatHtmlOutput(value);
+                  break;
+
+               case SessionDefaults.CSV_FORMAT:
+                  formatCsvOutput(value);
+                  break;
+            }
+         }
+      }
+      inOutParamMap=null;
+      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+         writeln();
+   }
+
+   private void writeAllSQLWarnings(SQLWarning sqlw) throws IOException
+   {
+      if (sqlw != null)
+      {
+         writer.writeAllSQLWarnings(sessObj,sqlw);
+         sessObj.setSqlWarningsCnt(sessObj.getSqlWarningsCnt()+1);
+      }
+   }
+
+   private void loadDbKeyWordMap()
+   {
+
+      if (dbKeyMap == null)
+      {
+         dbKeyMap = new HashMap<String, String>();
+      }
+
+      dbKeyMap.put("SET_SCHEMA",""+SessionDefaults.SET_SCHEMA);
+      dbKeyMap.put("SET_CATALOG",""+SessionDefaults.SET_CATALOG);
+      dbKeyMap.put("SET_SERVICE",""+SessionDefaults.SET_SERVICE);
+      dbKeyMap.put("CALL",""+SessionDefaults.CALL);
+      dbKeyMap.put("INFOSTATS",""+SessionDefaults.INFOSTATS);
+      dbKeyMap.put("PREPARE",""+SessionDefaults.PREPARE);
+      dbKeyMap.put("EXECUTE",""+SessionDefaults.EXECUTE);
+   }
+   
+   public boolean blockGetStats()
+   {
+      String query=null;
+      switch(qryObj.getQueryId())
+      {
+         case SessionDefaults.SET_SCHEMA:
+         case SessionDefaults.SET_CATALOG:
+            return true;
+            
+         case SessionDefaults.EXECUTE :
+            query = Utils.trimSQLTerminator(qryObj.getQueryText(),sessObj.getSessionSQLTerminator());
+            parser.setRemainderStr(query);
+            parser.getNextKeyToken();
+            String stmtName = parser.getNextPreparedStmtNameToken();
+            PreparedStatement pStmt = (PreparedStatement)sessObj.getPrepStmtMap(stmtName);
+            String sqlQueryStr=((TrafT4Statement)pStmt).getSQL();
+            if ((sqlQueryStr.matches("(?i)(?s)^SET\\s+SCHEMA.*")) ||
+                (sqlQueryStr.matches("(?i)(?s)^SET\\s+CATALOG.*")))
+               return true;
+            else
+               return false;
+               
+         default:
+               return false;
+         
+      }
+   }
+
+   private List<String> getParamNames(String qryString)
+   {
+      qryString=qryString+" ";
+      char[] rQryStr=qryString.toCharArray();
+      boolean quoteFound=false;
+      final char sQUOTE='\'';
+      final char dQUOTE='"';
+      final char pIDENTITY='?';
+      char currentQuote=sQUOTE;
+      boolean paramFound=false;
+      int paramStartPos=0;
+      List<String> paramList=new java.util.ArrayList<String>();
+
+
+      for (int i=0;i < rQryStr.length;i++)
+      {
+         // if we encounter quote skip all the characters till another quote.
+
+         if ((quoteFound && rQryStr[i] != sQUOTE && rQryStr[i] != dQUOTE)    ||
+            (quoteFound && rQryStr[i] == sQUOTE && currentQuote != sQUOTE)  ||
+            (quoteFound && rQryStr[i] == dQUOTE && currentQuote != dQUOTE))
+         {
+            continue;
+         }
+
+
+         if ((quoteFound && rQryStr[i] == sQUOTE && currentQuote == sQUOTE) ||
+            (quoteFound && rQryStr[i] == dQUOTE && currentQuote == dQUOTE))
+         {
+            quoteFound=false;
+            continue;
+         }
+
+         if ((!quoteFound && rQryStr[i] == sQUOTE) ||
+            (!quoteFound && rQryStr[i] == dQUOTE))
+         {
+            quoteFound = true;
+            currentQuote=rQryStr[i];
+            continue;
+         }
+
+         if (rQryStr[i] == pIDENTITY && !paramFound)
+         {
+            paramFound=true;
+            paramStartPos=i;
+            continue;
+         }
+
+         if (paramFound && ( ( (int)rQryStr[i] >= 97 && (int)rQryStr[i] <= 122 ) || ((int)rQryStr[i] >= 65 && (int)rQryStr[i] <= 91 ) ||
+            ((int)rQryStr[i] >= 48 && (int)rQryStr[i] <= 57 ) || rQryStr[i]=='_'  ))
+         {
+            continue;
+         }
+
+         if (paramFound)
+         {
+            paramList.add(qryString.substring(paramStartPos,i));
+            paramFound=false;
+            paramStartPos=0;
+         }
+
+      }
+      return paramList;
+
+   }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/Display.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Display.java b/core/conn/trafci/src/main/java/org/trafodion/ci/Display.java
new file mode 100644
index 0000000..892dae1
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Display.java
@@ -0,0 +1,68 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.IOException;
+
+public class Display {
+
+	private Session sessObj;
+	private IDisplay rawDisplay;
+	private IDisplay xmlDisplay;
+	private IDisplay htmlDisplay;
+	private IDisplay csvDisplay;
+	
+	public Display(Session sessObj)
+	{
+		this.sessObj = sessObj;
+		rawDisplay = new RawDisplay(sessObj);
+		xmlDisplay = new XMLDisplay(sessObj);
+		htmlDisplay = new HTMLDisplay(sessObj);
+		csvDisplay = new CSVDisplay(sessObj);
+	}
+	
+	public void output(OutputContents contents) throws IOException
+	{
+		IDisplay display=rawDisplay;
+		switch (sessObj.getDisplayFormat())
+	      {
+	         //HTML Format
+	         case SessionDefaults.HTML_FORMAT:
+	        	 display=htmlDisplay;
+	        	 break;
+	         //XML Format
+	         case SessionDefaults.XML_FORMAT:
+	        	 display=xmlDisplay;
+	        	 break;
+	         //CSV Format
+	         case SessionDefaults.CSV_FORMAT:
+	        	 display=csvDisplay;
+	        	 break;
+	         //Default Raw Format
+	         default:
+	        	 display=rawDisplay;
+	        	 break;
+	      }
+		display.output(contents);
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/DuplicateParamException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/DuplicateParamException.java b/core/conn/trafci/src/main/java/org/trafodion/ci/DuplicateParamException.java
new file mode 100644
index 0000000..4c8a010
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/DuplicateParamException.java
@@ -0,0 +1,40 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class DuplicateParamException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -3661178727942088670L;
+
+	DuplicateParamException()
+	{
+	
+	}
+	
+	DuplicateParamException(String msg)
+	{
+		super(msg);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/ErrorObject.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/ErrorObject.java b/core/conn/trafci/src/main/java/org/trafodion/ci/ErrorObject.java
new file mode 100644
index 0000000..e3c778d
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/ErrorObject.java
@@ -0,0 +1,103 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+public class ErrorObject {
+    private String errorCode = null;  
+    private String errorMessage = null;
+    public char errorType = 'E';
+    
+    public ErrorObject(String errorCode, String errorMessage) {
+        this.errorCode = errorCode;
+        this.errorMessage = errorMessage;
+        if (this.errorMessage.startsWith("*** WARNING["))
+           this.errorType = 'W'; 
+        else
+           this.errorType = 'E'; //Default
+    }
+    
+    public ErrorObject(String errorCode, String errorMessage, char errorType) {
+        this.errorCode = errorCode;
+        this.errorMessage = errorMessage;
+        this.errorType = errorType;
+    }
+    
+   // @Deprecated
+    //errStr may have no error code in itself
+    public ErrorObject(String errStr) {
+    	Parser parser = new Parser();
+    	this.errorCode = parser.getErrorCode(errStr);
+        this.errorMessage = parser.getErrorMsg(errStr);
+        /**
+         * Bug 2549: Expected warning message was converted into error 
+         * message by JDBC driver.
+         * Internal Analysis: some JDBC driver msg doesn't start with 
+         * *** [WARNING] will cause this error.
+         * Fix Description: instead of using startsWith, use indexOf method
+         */
+        if (errStr.indexOf("*** WARNING[" + errorCode + "]") > -1)
+           this.errorType = 'W'; 
+        else
+           this.errorType = 'E'; //Default
+    }
+
+    public ErrorObject(String errStr,int errorCode) {
+    	Parser parser = new Parser();
+		this.errorCode = parser.getErrorCode(errStr);
+        this.errorMessage = parser.getErrorMsg(errStr);
+		if (Parser.UNKNOWN_ERROR_CODE == this.errorCode)
+			this.errorCode = String.valueOf(Math.abs(errorCode));
+        /**
+         * Bug 2549: Expected warning message was converted into error 
+         * message by JDBC driver.
+         * Internal Analysis: some JDBC driver msg doesn't start with 
+         * *** [WARNING] will cause this error.
+         * Fix Description: instead of using startsWith, use indexOf method
+         */
+        if (errStr.indexOf("*** WARNING[" + errorCode + "]") > -1)
+           this.errorType = 'W'; 
+        else
+           this.errorType = 'E'; //Default
+    }
+    
+    public ErrorObject(ErrorObject errObj, String errStrPrefix, String errStrSuffix) {
+    	this.errorCode = errObj.errorCode;
+        this.errorMessage = errStrPrefix + errObj.errorMessage + errStrSuffix;
+        this.errorType = errObj.errorType;
+    }
+    
+    public String errorCode()   { return errorCode; }
+    
+    public String errorMessage() { return errorMessage; }
+
+    public String RAWOutputError() {
+    	String rawOutput = (this.errorType != 'E' || this.errorCode == Parser.UNKNOWN_ERROR_CODE) ? this.errorMessage : "*** ERROR[" + this.errorCode + "] " + this.errorMessage;
+      if (this.errorType == 'W') {
+          rawOutput =   "*** WARNING[" + this.errorCode + "] "+ this.errorMessage;        
+      }
+    	return (rawOutput);
+     }
+
+    public String toString() {
+         return this.RAWOutputError();
+      }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/FCQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/FCQuery.java b/core/conn/trafci/src/main/java/org/trafodion/ci/FCQuery.java
new file mode 100644
index 0000000..f67d5a7
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/FCQuery.java
@@ -0,0 +1,334 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.IOException;
+
+public class FCQuery
+{
+
+   private Reader        reader;
+   private Writer        writer;
+   private Session       sessObj;
+   private StringBuffer  qryText;
+   private StringBuffer  newQryText;
+
+   private int qryTextMaxLen;
+   private int qryTextPos;
+   private int commandPos;
+   private char[] fcCommand;
+
+   private String  fcPrompt;
+
+   final static int INSERT_O             =  0;
+   final static int DELETE_O             =  1;
+   final static int REPLACE_O            =  2;
+   final static int EXPLICIT_REPLACE_O   =  3;
+   final static int ADVANCE_O            =  4;
+   final static int ABORT_O              =  5;
+   final static int END_O                =  6;
+   final static int DONE_O               =  7;
+   final static int AGAIN_O              =  8;
+   final static int EMPTY_O              =  9;
+
+   /*enum Option
+   {
+   INSERT_O, DELETE_O, REPLACE_O, EXPLICIT_REPLACE_O, 
+   ADVANCE_O, ABORT_O, END_O, DONE_O, AGAIN_O, EMPTY_O
+   };*/
+
+   FCQuery(Session sessObj,Query qryObj)
+   {
+      this.sessObj = sessObj;
+      this.reader = sessObj.getReader();
+      this.writer = sessObj.getWriter();
+      this.setFcPrompt();
+   }
+
+   public boolean editCommand() throws IOException, UserInterruption
+   {
+      boolean returnVal = true;
+      newQryText = new StringBuffer();
+      int option;
+
+      String[] multiLineQry = sessObj.getQuery().getQueryText().split(SessionDefaults.lineSeperator);
+      for (int lineNo=0; lineNo < multiLineQry.length ;lineNo++)
+      {
+         if (sessObj.isQuietEnabled() || !sessObj.isLogCmdText()) {
+            writer.getConsoleWriter().println(sessObj.getSessionPrompt() + multiLineQry[lineNo]);
+            writer.getConsoleWriter().print(fcPrompt);
+         } 
+         if (sessObj.isLogCmdText()) {
+               writer.writeln(sessObj.getSessionPrompt() + multiLineQry[lineNo]); // print the line to be edited
+               writer.write(fcPrompt); //print the fc prompt 
+         }
+         //read the fc command
+         fcCommand= reader.getLine().toCharArray();
+         qryText = new StringBuffer(multiLineQry[lineNo]);
+         qryTextMaxLen = qryText.length();
+         qryTextPos=0;
+         commandPos=0;
+         option=-1;
+
+         while ((option != DONE_O) && (option != ABORT_O))
+         {
+            option = nextOption();
+            switch (option)
+            {
+               case INSERT_O:
+                  processInsert();
+                  break;
+
+               case REPLACE_O:
+                  processReplace();
+                  break;
+
+               case EXPLICIT_REPLACE_O:
+                  processReplace();
+                  qryTextPos++;
+                  break;
+
+               case DELETE_O:
+                  processDelete();
+                  break;
+
+               case ADVANCE_O:
+                  qryTextPos += 1;
+                  break;
+
+               case END_O:
+                  qryTextPos += 2;
+                  break;
+
+               case ABORT_O:
+                  returnVal = false;
+                  break;
+
+               case AGAIN_O:
+                  if (sessObj.isQuietEnabled() || !sessObj.isLogCmdText()) {
+                     writer.getConsoleWriter().println(sessObj.getSessionPrompt() + qryText);
+                     writer.getConsoleWriter().print(fcPrompt);
+                  }
+                  if (sessObj.isLogCmdText()) {
+                       writer.writeln(sessObj.getSessionPrompt() + qryText );
+                       writer.write(fcPrompt);
+                  }
+                  fcCommand= reader.getLine().toCharArray();
+
+                  if (!(fcCommand.length==0))
+                  {
+                     commandPos = 0;
+                     qryTextPos = 0;
+                  }
+                  else
+                  {
+                     option = DONE_O;
+                  }
+
+                  break;
+
+               case DONE_O:
+                  break;
+
+               default:
+                  break;
+
+            }//switch
+         }//while
+
+         if (option != ABORT_O)
+         {
+            if (newQryText.length() == 0)
+               newQryText.append(qryText);
+            else
+               newQryText.append(SessionDefaults.lineSeperator + qryText);
+         }
+         else
+         {
+            return false;
+         }
+      }//for
+      sessObj.getQuery().resetQueryText(newQryText.toString());
+      return returnVal;
+   }
+
+
+   private int nextOption()
+   {
+      int option;
+
+      //If the user just hits an enter key for the command, then we are done
+      //with editing the current qryText
+      if (fcCommand.length==0)
+      {
+         return (DONE_O);
+      }
+      // If you have reached the end of the FC command
+      // give another chance to edit the command
+      if (commandPos >= fcCommand.length)
+      {
+         return (AGAIN_O);
+      }
+
+      switch (fcCommand[commandPos])
+      {
+         case 'i':
+         case 'I':
+            option = INSERT_O;
+            commandPos += 1;
+            break;
+
+         case 'd':
+         case 'D':
+            option = DELETE_O;
+            commandPos += 1;
+            break;
+
+         case 'r':
+         case 'R':
+            option = EXPLICIT_REPLACE_O;
+            commandPos += 1;
+            break;
+
+         case ' ':
+            option = ADVANCE_O;
+            commandPos += 1;
+            break;
+
+         case '/':
+
+            if ((commandPos < fcCommand.length-1) && (fcCommand[commandPos+1] == '/'))
+            {
+               if ((commandPos == 0) && (fcCommand.length == 2))
+                  option = ABORT_O;
+               else
+               {
+                  option = END_O;
+                  commandPos += 2;
+               }
+            }
+            else
+            {
+               option = REPLACE_O;
+            }
+
+            break;
+
+         default:
+            option = REPLACE_O;
+            break;
+      }
+
+      return option;
+   }  // nextOption()
+
+   private int getCommandLen()
+   {
+      int done = 0;
+      int i = 0;
+
+      while (done != -1)
+      {
+         if (commandPos + i >= fcCommand.length)
+            done = -1;
+         else if ((commandPos +i < fcCommand.length-1) && (fcCommand[commandPos+i] == '/') &&
+            (fcCommand[commandPos+i+1] == '/'))
+            done = -1;
+         else
+            i++;
+      }
+      return i;
+   }  // getCommandLen
+
+   void processInsert()
+   {
+      int commandLen = getCommandLen();
+
+      if (commandLen > 0)
+      {
+         if (qryTextPos > qryText.length())
+         {
+            for (int j=qryText.length();j<qryTextPos;j++)
+               qryText.append(" ");
+            qryText.append(new String(fcCommand).substring(commandPos,commandPos+commandLen));
+         }
+         else
+            qryText = qryText.insert(qryTextPos, fcCommand, commandPos, commandLen);
+
+         commandPos += commandLen;
+         qryTextPos += 2 * commandLen + 1;
+         qryTextMaxLen += commandLen;
+
+         if (qryTextPos > qryTextMaxLen)
+            qryTextMaxLen = qryTextPos;
+
+      }
+   }  // processInsert()
+
+
+   private void processDelete()
+   {
+      if (qryTextPos < qryTextMaxLen)
+      {
+         //qryText=new StringBuffer(qryText.substring(0,qryTextPos)+qryText.substring(qryTextPos+1));
+         qryText = qryText.deleteCharAt(qryTextPos);
+         qryTextMaxLen-=1;
+      }
+
+   }
+
+   private void processReplace()
+   {
+      int commandLen = getCommandLen();
+
+      if (commandLen > 0)
+      {
+         if (qryTextPos > qryText.length())
+         {
+            for (int j=qryText.length();j<qryTextPos;j++)
+               qryText.append(" ");
+            qryText.append(new String(fcCommand).substring(commandPos,commandPos+commandLen));
+         }
+         else
+            qryText.replace(qryTextPos, qryTextPos+commandLen, new String(fcCommand).substring(commandPos,commandPos+commandLen));
+         commandPos += commandLen;
+         qryTextPos += commandLen;
+         if (qryTextPos > qryTextMaxLen)
+            qryTextMaxLen = qryTextPos;
+      }
+   }  // processReplace()
+
+
+   public String getFcPrompt()
+   {
+      return this.fcPrompt;
+   }
+
+
+   public void setFcPrompt()
+   {
+      int len = sessObj.getSessionPrompt().length();
+      String fcPrompt="";
+      for (int i=0;i<len;i++)
+         fcPrompt+=".";
+      this.fcPrompt = fcPrompt;
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/FileReader.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/FileReader.java b/core/conn/trafci/src/main/java/org/trafodion/ci/FileReader.java
new file mode 100644
index 0000000..bf4dcde
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/FileReader.java
@@ -0,0 +1,176 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+public class FileReader
+{
+   private BufferedReader br=null;
+   private String fileName=null;
+   private String line=null;
+   private boolean isSectionRead=false;
+//   private String sectionName=null;
+   String sectionLine=null;
+   private boolean isSectionLineRead=false;
+   Pattern sectionPat=null;
+   Matcher sectionMat=null;
+
+   FileReader()
+   {
+
+   }
+
+   public void initialize(String fileName) throws IOException
+   {
+      this.fileName=fileName;
+      java.io.FileReader fr=new java.io.FileReader(this.fileName);
+      this.br = new BufferedReader(fr);
+   }
+   
+   public void initializeStream(InputStream theStream, String clzName) throws IOException
+   {
+      this.fileName=clzName;
+      InputStreamReader ir= new InputStreamReader(theStream);
+      //dead code
+//      if (null == ir)
+//    	  throw new IOException("Unable to load stream from class '" + clzName + "' ");
+      this.br = new BufferedReader(ir);
+   }
+   
+
+   public String getLine() throws IOException
+   {
+      if (next(true))
+      {
+         return this.line;
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   public String getNonBlankLine() throws IOException
+   {
+      if (next(false))
+      {
+         return this.line;
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   public boolean next(boolean readBlanks) throws IOException
+   {
+
+      while (true)
+      {
+         // if section option is enabled , return the section line which was read already
+         // before reading the remaining lines from the file
+         if (this.isSectionRead && !this.isSectionLineRead)
+         {
+            line=this.sectionLine;
+            this.sectionLine=null;
+            this.isSectionLineRead=true;
+            return true;
+         }
+         line=this.br.readLine();
+         if (line == null)
+         {
+            return false;
+         }
+         else if (readBlanks)
+         {
+            return true;
+         }
+         else if (!line.trim().equals(""))
+         {
+            if (this.isSectionRead && line.trim().toUpperCase().startsWith("?SECTION"))
+            {
+               return false;
+            }
+            return true;
+         }
+      }
+   }
+
+   public String getFileName()
+   {
+      return this.fileName;
+   }
+
+   public void close() throws IOException
+   {
+      this.br.close();
+      this.br=null;
+   
+   }
+
+   public boolean isSectionRead()
+   {
+      return isSectionRead;
+   }
+
+   public void setSectionRead(boolean isSectionRead,String sectionName) throws IOException, ScriptSectionNotFound
+   {
+      if (isSectionRead && sectionName != null)
+      {
+         sectionPat=Pattern.compile("(?i)^\\s*\\?SECTION\\s+"+sectionName+"\\s*$");
+         seekToSection();
+//         this.sectionName=sectionName;
+         this.isSectionRead = isSectionRead;
+
+      }else
+      {
+//         this.sectionName=null;
+         this.isSectionRead = false;
+      }
+
+   }
+
+   private void seekToSection() throws IOException, ScriptSectionNotFound
+   {
+      String line=null;
+      while ((line=this.getNonBlankLine()) != null)
+      {
+         sectionMat=sectionPat.matcher(line);
+         if (sectionMat.find())
+         {
+            sectionLine=line;
+            //section found..
+            return;
+         }
+      }
+      throw new ScriptSectionNotFound();
+   }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/FileWriter.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/FileWriter.java b/core/conn/trafci/src/main/java/org/trafodion/ci/FileWriter.java
new file mode 100644
index 0000000..10c153f
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/FileWriter.java
@@ -0,0 +1,80 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+
+public class FileWriter
+{
+   private BufferedWriter bw=null;
+   private boolean append=false;
+   private java.io.FileWriter fw=null;
+   FileWriter()
+   {
+
+   }
+
+   public void setAppend(boolean append)
+   {
+      this.append=append;
+   }
+
+   public void initialize(String fileName) throws IOException
+   {
+      fw=new java.io.FileWriter(fileName,append);
+      bw=new BufferedWriter(fw);
+   }
+
+   public void write(String line) throws IOException
+   {
+      if (line != null)
+      {
+         if (SessionDefaults.lineSeperator.equals(line))
+         {
+            writeln();
+         }
+         else
+         {
+            bw.write(line);
+         }
+         bw.flush();
+      }
+   }
+
+   public void writeln() throws IOException
+   {
+      bw.newLine();
+   }
+
+   public void writeln(String line) throws IOException
+   {
+      write(line);
+      writeln();
+   }
+
+   public void close() throws IOException
+   {
+      bw.close();
+      bw=null;
+      fw=null;
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/HTMLDisplay.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/HTMLDisplay.java b/core/conn/trafci/src/main/java/org/trafodion/ci/HTMLDisplay.java
new file mode 100644
index 0000000..106d842
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/HTMLDisplay.java
@@ -0,0 +1,80 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+public class HTMLDisplay implements IDisplay {
+
+	private Query qryObj;
+	private Writer writer=null;
+	private Session sessObj=null;
+	
+	public HTMLDisplay(Session sessObj)
+	{
+		if(sessObj!=null)
+		{
+			this.sessObj = sessObj;
+			this.writer=sessObj.getWriter();
+			this.qryObj=sessObj.getQuery();
+		}
+	}
+
+	public void output(OutputContents contents) throws IOException {
+		// TODO Auto-generated method stub
+		if(contents!=null)
+		{
+			this.writer=sessObj.getWriter();
+			this.qryObj=sessObj.getQuery();
+			//display header
+			ArrayList<OutputColumnAttribute> columns = contents.getColumns();
+			qryObj.setColCount(String.valueOf(columns.size()));
+			//display columns name
+			for(int i=0;i<columns.size();i++)
+			{
+				OutputColumnAttribute columnAttr = columns.get(i);
+				sessObj.getHtmlObj().processHtml(columnAttr.getDisplayFormatName());
+	            writer.writeln();
+			}
+			
+			ArrayList<ArrayList<String>> alRows = contents.getRows();
+			if(alRows!=null && alRows.size()>0)
+			{
+				for(int i=0;i<alRows.size();i++)
+				{
+					ArrayList<String> alRow = alRows.get(i);
+					if(alRow!=null && alRow.size()>0)
+					{
+						for(int j=0;j<alRow.size();j++)
+						{
+							sessObj.getHtmlObj().processHtml(alRow.get(j));
+				            writer.writeln();
+						}
+					}
+					
+				}
+			}
+		}
+	}
+
+}



[36/38] incubator-trafodion git commit: add the copyright declaration

Posted by li...@apache.org.
add the copyright declaration


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

Branch: refs/heads/master
Commit: 3cea666b5f97982bd760c4e6fa2b51bf1dbd6084
Parents: 95b9f27
Author: AlexPeng19 <al...@hotmail.com>
Authored: Wed Nov 30 09:20:49 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Wed Nov 30 09:20:49 2016 +0800

----------------------------------------------------------------------
 .../org/trafodion/ci/UserInterfaceTest.java     | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/3cea666b/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java b/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
index cc8f52f..4020e12 100644
--- a/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
+++ b/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
@@ -1,3 +1,23 @@
+// @@@ 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 @@@
 package org.trafodion.ci;
 
 import static org.junit.Assert.*;


[18/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQuery.java b/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQuery.java
new file mode 100644
index 0000000..5bd73cb
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQuery.java
@@ -0,0 +1,4378 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.InputStream;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.DateFormat;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Timer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+import java.sql.PreparedStatement;
+
+import org.trafodion.jdbc.t4.TrafT4Statement;
+
+import java.lang.InterruptedException;
+
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Vector;
+import java.sql.Connection;
+import sun.misc.Signal;
+import sun.misc.SignalHandler;
+import java.net.UnknownHostException;
+
+public class InterfaceQuery extends QueryWrapper implements SessionDefaults {
+	private HashMap<String, String> iqKeyMap = null;
+	private HashMap<String, String> envMap = null;
+	private FileWriter spoolWriter = null;
+	private FileReader obeyReader = null;
+	private String spoolFileName = null;
+	private Connection newConn = null;
+	private SignalHandler LHCTRLCHandler = null;
+	private SignalHandler DelayCTRLCHandler = null;
+	private Signal INTSignal = null;
+	private int totalCount = 0;
+	private boolean doTrace = Boolean.getBoolean(SessionDefaults.PROP_TRACE);
+	private boolean printConnTime = false;
+	private String strFilter = "";
+
+	private Thread curThread = null;
+	private int maxDelayVal = -1;
+
+	/**
+	 * Final String Initialization.
+	 */
+	private final String infoNotAvailable = "Information not available.";
+	private final String ciServerErrMsg = "An internal server error has occurred. Please contact support.";
+
+	InterfaceQuery() {
+	}
+
+	InterfaceQuery(Session sessObj) {
+		super(sessObj);
+		iqKeyMap = new HashMap<String,String>();
+		envMap = sessObj.getEnvMap();
+		loadIqKeyWordMap();
+		loadEnvVarMap(); // loads the env variables in the pattern hashmap
+		addEnvValuesMap(); // loads env values into the env hash map
+		if (sessObj.getCaller() != SessionDefaults.PRUNI) {
+			LHCTRLCHandler = new SignalHandler() {
+				public void handle(Signal sig) {
+					killProcess();
+				}
+			};
+
+			/* Ctrl+C handler for the delay command */
+			DelayCTRLCHandler = new SignalHandler() {
+				public void handle(Signal sig) {
+					if (curThread != null)
+						curThread.interrupt();
+
+				}
+			};
+
+			try {
+				INTSignal = new Signal("INT");
+				Signal.handle(INTSignal, LHCTRLCHandler);
+			} catch (Exception e) {
+			}
+		}
+
+		String strConnTime = System
+				.getProperty(SessionDefaults.PROP_PRINT_TIME);
+		if ((strConnTime != null) && strConnTime.equalsIgnoreCase("y")) {
+			printConnTime = true;
+		}
+
+		String maxDelayStr = System.getProperty(SessionDefaults.PROP_MAX_DELAY);
+		if (maxDelayStr != null)
+			maxDelayVal = Integer.parseInt(maxDelayStr) * 1000;
+	}
+
+	void killProcess() {
+		Query qryObj = sessObj.getQuery();
+		if (qryObj != null && qryObj.getQueryId() == LOCALHOST) {
+			if (sessObj.getProcObj() != null) {
+				sessObj.getProcObj().destroy();
+				sessObj.setProcObj(null);
+			}
+		}
+	}
+
+	public void execute() throws UnKnownInterfaceCommand, SQLException,
+			IOException, UserInterruption {
+		String cmdStr = null;
+		int cmdNo = 0;
+		init();
+		isMultiLine = false; // flag to check if the input line can be entered
+		// in multline.
+		blankLiner = false;
+
+		readQuery();
+
+		// Move the pointer to the next key word as we already know the
+		// first key word for all interface commands which would have been
+		// set by the validateQuery
+		//
+		String fToken = parser.getNextKeyToken();
+
+		// put the timer on hold
+		// sessObj.setTimerHold();
+
+		// get the QueryId and directly process that command
+		sessObj.setQryStartTime();
+
+		switch (sessObj.getQuery().getQueryId()) {
+
+		case SECTION:
+			sessObj.getQuery().resetQueryText("");
+			break;
+
+		case HELP:
+			handleHelp();
+			break;
+
+		case CLEAR:
+			handleClearCommand();
+			break;
+
+		case MODE:
+			writer.writeln();
+			writer.writeError(sessObj, SessionError.CMD_NOT_SEAQUEST_SUPPORTED);
+			break;
+
+		case SET:
+			execSet();
+			break;
+
+		case SHOW:
+			execShow();
+			break;
+
+		case GET:
+			execGet();
+			break;
+
+		case CONNECT:
+			handleConnect();
+			break;
+
+		case RECONNECT:
+			handleReconnect();
+			break;
+
+		case EXIT:
+		case DISCONNECT:
+			handleDisConnect();
+			break;
+
+		case ED:
+		case EDIT:
+			break;
+
+		case SPOOL:
+		case LOG:
+			execSpool();
+			break;
+
+		case SLASH:
+		case RUN:
+			handleRunCommand();
+			break;
+
+		case AT:
+		case OBEY:
+			execObey();
+			break;
+
+		case RESET:
+			handleResetCommand();
+			break;
+
+		case HISTORY:
+			handleHistory();
+			break;
+
+		case FC:
+		case REPEAT:
+			handleRepeatCommand(cmdStr, cmdNo);
+			break;
+
+		case SESSION:
+		case ENV:
+			execEnv();
+			break;
+
+		case SAVEHIST:
+			handleSaveHistory();
+			break;
+
+		case VERSION:
+			handleVersion();
+			break;
+
+		case ERROR:
+			formatResults(SessionError.NOT_SUPPORT + SqlEnum.ERROR.toString() + " command.");
+			break;
+
+		case LOCALHOST:
+			handleHostCommand();
+			break;
+
+		case DELAY:
+			handleDelay();
+			break;
+
+		case ALIAS:
+			handleAlias();
+			break;
+
+		case DOTSEC:
+		case DOTCS:
+		case DOTSQL:
+		case DOTNS:
+		case DOTWMS:
+
+			if (!sessObj.isDBConnExists()) // Added  2010-03-01
+			{
+				displayNoConnInfo();
+				break;
+			}
+
+			if (!parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			String secondToken = parser.lookAtNextToken().toUpperCase();
+
+			if (secondToken.equalsIgnoreCase(".SEC")
+					|| secondToken.equalsIgnoreCase(".CS")
+					|| secondToken.equalsIgnoreCase(".NS")) {
+				formatResults(SessionError.NOT_SUPPORT
+						+ secondToken.substring(1) + " mode.");
+			}
+
+			if (secondToken.equalsIgnoreCase(".SQL")
+					|| secondToken.equalsIgnoreCase(".WMS")) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			rewriteQryString(sessObj.getStrMode(), fToken.substring(1));
+			sessObj.setDotMode(fToken.substring(1));
+			ByteArrayInputStream bais = new ByteArrayInputStream(qryObj
+					.getQueryText().getBytes());
+			sessObj.setLogCmdEcho(false);
+			sessObj.setDotModeCmd(true);
+			sessObj.setHistOn(false);
+			sessObj.setPrevMode(sessObj.getMode());
+			this.execObeyStream(bais, "");
+			break;
+
+		} // end switch
+		sessObj.setQryEndTime();
+		// sessObj.setLastError(sessObj.getQuery().getStatusCode());
+	} // end execute
+
+	/* parameterized types not available in 1.4, must cast below */
+	class FilenameComparator implements Comparator<File> {
+
+		// sort alphabetically
+		public int compare(File fa, File fb) {
+			return fb.getName().compareToIgnoreCase(
+					fa.getName());
+		}
+	}
+
+	public void execObeyStream(InputStream theStream, String clzName)
+			throws IOException {
+		obeyReader = new FileReader();
+
+		try {
+			obeyReader.initializeStream(theStream, clzName);
+			sessObj.getReader().setObeyReader(obeyReader);
+			if (sessObj.getReader().getReadMode() != SessionDefaults.OBEY_READ_MODE) {
+				sessObj.getReader().setReadMode(OBEY_READ_MODE);
+				sessObj.setSessionType(false);
+			}
+
+		} catch (IOException e) {
+			throw e;
+		}
+
+	}
+
+	public void execObey() throws IOException {
+		FilenameFilter filter;
+		File file = null;
+		Comparator<File> fileAlphabetize = new FilenameComparator();
+
+		String obeyFileName = parser.getNextFileToken();
+		obeyFileName = (obeyFileName == null) ? "" : obeyFileName.trim();
+
+		if (obeyFileName.equals("")) {
+			// if user just hit enter, prompt for a file
+			if (sessObj.isSessionInteractive()) {
+				try {
+
+					String defaultVal = "*.sql";
+					String prompt = "Enter the script filename [" + defaultVal
+							+ "]      :";
+					sessObj.getConsoleWriter()
+							.print(utils.formatString(prompt,
+									prompt.length() + 1, ' '));
+					obeyFileName = sessObj.getReader().getLine();
+					if ((obeyFileName == null || obeyFileName.trim().equals(""))) {
+						obeyFileName = defaultVal;
+					}
+
+					obeyFileName = obeyFileName.trim();
+
+				} catch (UserInterruption ui) {
+					return;
+				}
+			} else {
+				sessionError('E', new ErrorObject(
+						SessionError.OBEY_BLANK_SESSION_ERR.errorCode(),
+						SessionError.OBEY_BLANK_SESSION_ERR.errorMessage()));
+				return;
+			}
+		}
+
+		// obtain filter at the end of the filename
+		file = new File(obeyFileName);
+
+		// test for slash, add on at end
+		boolean addSlash = obeyFileName.endsWith(File.separator) ? true : false;
+		if (file.getParent() != null) {
+			obeyFileName = file.getAbsolutePath(); // java strips last slash
+			if (addSlash)
+				obeyFileName += File.separator;
+		} else if (file.exists() && file.isDirectory() && !addSlash) {
+			obeyFileName += File.separator;
+			file = new File(obeyFileName);
+		}
+
+		if (file.exists()) {
+			if (file.isDirectory())
+				strFilter = "*.sql";
+			else
+				file = new File(obeyFileName);
+		} else if (!obeyFileName.endsWith(File.separator)
+				&& (obeyFileName.indexOf("*") != -1 || obeyFileName
+						.indexOf("?") != -1)) {
+			strFilter = file.getName();
+			obeyFileName = file.getParent();
+			if (obeyFileName == null)
+				obeyFileName = System.getProperty("user.dir");
+
+			file = new File(obeyFileName);
+		} else {
+			sessionError(
+					'E',
+					new ErrorObject(SessionError.OBEY_PATH_NOT_FOUND
+							.errorCode(), SessionError.OBEY_PATH_NOT_FOUND
+							.errorMessage()));
+			return;
+		}
+
+		// windows/dos-style wildcards, * really means .* and ? means . in regex
+		// terms
+		// replace asterisks with regex something like .* but remember to
+		// replace existing dots with \.
+		strFilter = strFilter.replaceAll("\\.", "\\\\.");
+		strFilter = strFilter.replaceAll("\\*", "\\.\\*");
+		strFilter = strFilter.replaceAll("\\?", ".");
+
+		// escape all other regex symbols
+		Pattern p = Pattern.compile("([$+|\\[\\](){}])");
+		Matcher m = p.matcher(strFilter);
+		strFilter = m.replaceAll("\\\\$1");
+
+		filter = new FilenameFilter() {
+			public boolean accept(File dir, String name) {
+				File testFile = new File(dir.getAbsolutePath() + File.separator
+						+ name);
+
+				Pattern pattern;
+				if (System.getProperty("os.name").toUpperCase()
+						.startsWith("WINDOW"))
+					pattern = Pattern.compile(strFilter,
+							Pattern.CASE_INSENSITIVE);
+				else
+					pattern = Pattern.compile(strFilter);
+
+				Matcher matcher = pattern.matcher(name);
+				return matcher.matches() && testFile.isFile();
+			}
+		};
+
+		File[] fl;
+		if (file != null && file.exists() && file.isDirectory()) {
+			fl = file.listFiles(filter);
+			Arrays.sort(fl, fileAlphabetize);
+		} else {
+			fl = new File[1];
+			fl[0] = file;
+		}
+
+		if (obeyFileName == null || obeyFileName.trim().equals("")) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		}
+
+		String sectionName = parser.getNextSectionToken();
+
+		if (parser.hasMoreTokens()) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		}
+
+		if (fl.length == 0) {
+
+			sessionError('E', SessionError.OBEY_WILDCARD_NOT_FOUND);
+			return;
+		}
+
+		if (sessObj.isSessionInteractive()
+				|| sessObj.getReader().getReadMode() == SessionDefaults.OBEY_READ_MODE) {
+
+			File f;
+			for (int i = 0; i < fl.length; i++) {
+				f = fl[i];
+
+				/* ignore the log file if its in the obey list */
+				if (sessObj.isSessionLogging()) {
+					if (f.getAbsolutePath().equals(sessObj.getSpoolFileName()))
+						continue;
+				}
+
+				obeyReader = new FileReader();
+
+				try {
+					obeyReader.initialize(f.getAbsolutePath());
+
+					if (sectionName != null) {
+						try {
+							obeyReader.setSectionRead(true, sectionName);
+						} catch (ScriptSectionNotFound e) {
+							sessionError(
+									'E',
+									new ErrorObject(
+											SessionError.OBEY_SECTION_NOT_FOUND
+													.errorCode(),
+											"Section "
+													+ sectionName
+													+ SessionError.OBEY_SECTION_NOT_FOUND
+															.errorMessage()
+													+ f.getName()));
+							obeyReader.close();
+							obeyReader = null;
+							return;
+						}
+					}
+					sessObj.getReader().setObeyReader(obeyReader);
+					if (sessObj.getReader().getReadMode() != SessionDefaults.OBEY_READ_MODE) {
+						sessObj.getReader().setReadMode(OBEY_READ_MODE);
+						sessObj.setSessionType(false);
+					}
+
+				} catch (FileNotFoundException fnfe) {
+					sessionError('E', new ErrorObject(
+							SessionError.OBEY_FILE_NOT_FOUND.errorCode(),
+							SessionError.OBEY_FILE_NOT_FOUND.errorMessage()));
+					return;
+				} catch (IOException e) {
+					throw e;
+				}
+			}
+		}
+
+	}
+
+	private void resetSpoolOptions(FileWriter sWriter) throws IOException {
+		sessObj.setSessionLogging(false);
+		sessObj.getWriter().setWriterMode(CONSOLE_WRITE_MODE);
+		sessObj.setQuietEnabled(false);
+		sessObj.setLogCmdText(true);
+		sessObj.setLogAppend(true);
+		sessObj.setLogCmdEcho(true);
+		sessObj.setSessionStartup(false);
+		try {
+			if (sWriter != null)
+				sWriter.close();
+			sWriter = null;
+		} catch (IOException e) {
+			throw e;
+		}
+	}
+
+	private void execSpool() throws IOException {
+		spoolFileName = parser.getNextFileToken();
+		if (sessObj.getCaller() == PRUNI) {
+			if (spoolFileName.equalsIgnoreCase("OFF")) {
+				sessObj.setSessionStartup(false);
+				sessObj.setSessionLogging(false);
+			}
+			return;
+		}
+		if (spoolFileName == null || spoolFileName.trim().equals("")) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		}
+		if (spoolFileName.endsWith(","))
+			spoolFileName = spoolFileName.substring(0,
+					spoolFileName.length() - 1);
+
+		if (!spoolFileName.equalsIgnoreCase("OFF")) {
+			if (spoolFileName.equalsIgnoreCase("ON")) {
+				spoolFileName = "sqlspool.lst";
+			}
+			if (sessObj.isSessionLogging()) {
+				resetSpoolOptions(spoolWriter);
+				spoolWriter = null;
+			}
+		} else if (spoolFileName.equalsIgnoreCase("OFF")) {
+
+			if ((spoolWriter == null) && !sessObj.isSessionStartup()) {
+				sessionError('E', SessionError.SPOOL_OFF_OFF);
+				return;
+			} else {
+				resetSpoolOptions(spoolWriter);
+				spoolWriter = null;
+				return;
+			}
+		}
+		sessObj.setSpoolFileName(spoolFileName);
+		String spoolOption = null;
+		String cmdStr, cmdTextValue = null;
+		String[] formatStrArr = parser.getRemainderStr().trim().split(",");
+
+		for (int i = 0; i < formatStrArr.length; i++) {
+			spoolOption = parser.getNextToken().trim();
+			if (spoolOption != null
+					&& !spoolOption.equalsIgnoreCase("")
+					&& !spoolOption
+							.matches("(?i)\\s*((CMDTEXT|CMDECHO)\\s+(ON|OFF))|(QUIET|CLEAR)")) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				resetSpoolOptions(spoolWriter);
+				return;
+			}
+			if (spoolOption.matches("(?i)\\s*(CMDTEXT|CMDECHO)\\s+(ON|OFF)")) {
+				cmdStr = spoolOption.substring(0, 7);
+				cmdTextValue = spoolOption.trim().substring(8);
+				if (cmdStr.equalsIgnoreCase("CMDECHO")) {
+					if (cmdTextValue == null
+							|| cmdTextValue.trim().equalsIgnoreCase("ON"))
+						sessObj.setLogCmdEcho(true);
+					else
+						sessObj.setLogCmdEcho(false);
+
+				} else if (cmdTextValue == null
+						|| cmdTextValue.trim().equalsIgnoreCase("ON"))
+					sessObj.setLogCmdText(true);
+				else
+					sessObj.setLogCmdText(false);
+			} else if (spoolOption.equalsIgnoreCase("QUIET")) {
+				sessObj.setQuietEnabled(true);
+			} else if (spoolOption.equalsIgnoreCase("CLEAR")) {
+				sessObj.setLogAppend(false);
+			}
+		}
+		if (!spoolFileName.equalsIgnoreCase("OFF")) {
+			try {
+				spoolWriter = new FileWriter();
+
+				if (sessObj.isLogAppend())
+					spoolWriter.setAppend(true);
+				spoolWriter.initialize(spoolFileName);
+				sessObj.setSessionLogging(true);
+				sessObj.getWriter().setSpoolWriter(spoolWriter);
+				sessObj.getWriter().setWriterMode(CONSOLE_SPOOL_WRITE_MODE);
+				if (sessObj.isLogCmdText()
+						&& sessObj.getSessView() != SessionDefaults.MXCI_VIEW) {
+					spoolWriter.writeln((utils.formatString("=", 80, '=')));
+					spoolWriter.writeln("Spooling started at "
+							+ DateFormat.getDateTimeInstance().format(
+									new Date()));
+					spoolWriter.writeln((utils.formatString("=", 80, '=')));
+				}
+			} catch (FileNotFoundException fnfe) {
+				sessionError('E',
+						new ErrorObject(SessionError.INTERNAL_ERR.errorCode(),
+								fnfe.getMessage()));
+				spoolWriter = null;
+				return;
+			} catch (IOException e) {
+				spoolWriter = null;
+				throw e;
+			}
+		}
+	}
+
+	private void execEnv() throws IOException, UnKnownInterfaceCommand,
+			UserInterruption {
+		if (parser.hasMoreTokens()) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		}
+
+		// writer.writeln("CATALOG        ",(sessObj.getSessionCtlg()));
+		handleOutput("COLSEP         ", "\"" + sessObj.getSessionColSep()
+				+ "\"");
+		handleOutput("HISTOPT        ", (sessObj.isSessionHistoryAll() ? "ALL"
+				: "DEFAULT [No expansion of script files]"), false);
+		handleOutput("IDLETIMEOUT    ", (sessObj.getSessionIdletime())
+				+ " min(s) "
+				+ (sessObj.getSessionIdletime() == 0 ? "[Never Expires]" : ""),
+				false);
+		if (sessObj.getListCount() == 0)
+			handleOutput("LIST_COUNT     ", (sessObj.getListCount())
+					+ " [All Rows]", false);
+		else
+			handleOutput("LIST_COUNT     ",
+					String.valueOf((sessObj.getListCount())), false);
+		if (sessObj.isSessionLogging()) {
+			handleOutput("LOG FILE       ", sessObj.getSpoolFileName(), false);
+			handleOutput("LOG OPTIONS    ", (sessObj.isLogAppend() ? "APPEND"
+					: "CLEAR")
+					+ (sessObj.isQuietEnabled() ? ",QUIET" : "")
+					+ ",CMDTEXT " + (sessObj.isLogCmdText() ? "ON" : "OFF"),
+					false);
+		} else
+			handleOutput("LOG            ", "OFF", false);
+		handleOutput("MARKUP         ", (sessObj.getStrDisplayFormat()), false);
+		handleOutput("PROMPT         ", (sessObj.getSessionPrompt()), false);
+		if (sessObj.isDBConnExists())
+		{
+			handleOutput("SCHEMA         ", (sessObj.getSessionSchema()), false);
+			handleOutput("SERVER         ", sessObj.getSessionServer()
+					+ sessObj.getSessionPort(), false);
+		} else {
+			handleOutput("SCHEMA         ", (this.infoNotAvailable), false);
+			handleOutput("SERVER         ", (this.infoNotAvailable), false);
+		}
+
+		handleOutput("SQLTERMINATOR  ", (sessObj.getSessionSQLTerminator()),
+				false);
+		handleOutput("STATISTICS     ", (sessObj.isSessionStatsEnabled() ? "ON"
+				: "OFF"), false);
+		handleOutput("TIME           ", (sessObj.isSessionTimeOn() ? "ON"
+				: "OFF"), false);
+		handleOutput("TIMING         ", (sessObj.isSessionTimingOn() ? "ON"
+				: "OFF"), false);
+		if (sessObj.isDBConnExists())// Changed  2010-03-01
+		{
+			handleOutput("USER           ", (sessObj.getSessionUser()), false);
+		} else {
+			handleOutput("USER           ", (this.infoNotAvailable), false);
+		}
+		writer.writeEndTags(sessObj);
+	}
+
+	private void execShow() throws UnKnownInterfaceCommand, SQLException,
+			IOException, UserInterruption {
+		String showOption = parser.getNextKeyToken();
+
+		if (showOption == null) {
+			if (parser.hasMoreTokens()) {
+				throw uic;
+			}
+			sessionError('E', SessionError.SHOW_NO_OPTION);
+			return;
+		}
+
+		showOption = iqKeyMap.get("SHOW_" + showOption.toUpperCase());
+
+		if (showOption == null) {
+			throw uic;
+		}
+
+		int showId = Integer.parseInt(showOption);
+		sessObj.getQuery().setQueryId(showId);
+
+//		String setValue;
+
+		switch (showId) {
+		case SHOW_TIME:
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			handleOutput("TIME", (sessObj.isSessionTimeOn() ? "ON" : "OFF"));
+			break;
+
+		case SHOW_TIMING:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			handleOutput("TIMING", (sessObj.isSessionTimingOn() ? "ON" : "OFF"));
+			break;
+
+		case SHOW_SQLTERMINATOR:
+
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			handleOutput("SQLTERMINATOR", (sessObj.getSessionSQLTerminator()));
+			break;
+
+		case SHOW_SQLPROMPT:
+
+			//change for show schemas can't executed in cs mode
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE && sessObj.getMode() != SessionDefaults.CS_MODE) {
+//			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			handleOutput("SQLPROMPT", (sessObj.getSessionPrompt()));
+			break;
+
+		case SHOW_CATALOG:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (sessObj.isDBConnExists()) // Modified  2010-03-01
+			{
+				handleOutput("CATALOG", (sessObj.getSessionCtlg()));
+			} else {
+				displayNoConnInfo();
+			}
+			break;
+
+		case SHOW_SESSION:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			execEnv();
+			break;
+
+		case SHOW_SCHEMA:
+
+			if (parser.getNextKeyToken() != null
+					|| parser.getNextValueToken() != null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (sessObj.isDBConnExists()) // Modified  2010-03-01
+			{
+				handleOutput("SCHEMA", (sessObj.getSessionSchema()));
+			} else {
+				displayNoConnInfo();
+			}
+
+			break;
+
+		case SHOW_ROLE:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (sessObj.isDBConnExists()) // Modified  2010-03-01
+			{
+				handleOutput("ROLE", (sessObj.getSessionRole()));
+			} else {
+				displayNoConnInfo();
+			}
+
+			break;
+
+		case SHOW_IDLETIMEOUT:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			handleOutput("IDLETIMEOUT", (sessObj.getSessionIdletime())
+					+ " min(s) "
+					+ (sessObj.getSessionIdletime() == 0 ? "[Never Expires]"
+							: ""));
+			break;
+
+		case SHOW_LISTCOUNT:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			handleOutput(
+					"LIST_COUNT",
+					(sessObj.getListCount())
+							+ (sessObj.getListCount() == 0 ? " [All Rows]" : ""));
+			break;
+
+		case SHOW_DISPLAY_COLSIZE:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			handleOutput("DISPLAY COLSIZE",
+					String.valueOf(sessObj.getDisplayColSize()));
+			break;
+
+		case SHOW_PROCESSNAME:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (sessObj.isDBConnExists()) // Modified  2010-03-01
+			{
+				String processName = sessObj.getNeoProcessName();
+				handleOutput("REMOTE PROCESS", processName);
+			} else {
+				displayNoConnInfo();
+			}
+
+			break;
+
+		case SHOW_MODE:
+			writer.writeln();
+			writer.writeError(sessObj, SessionError.CMD_NOT_SEAQUEST_SUPPORTED);
+/*
+ * remove show mode command for seaquest
+ */
+//			if (parser.hasMoreTokens()) {
+//				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+//				break;
+//			}
+//			handleOutput("MODE", sessObj.getStrMode());
+			break;
+
+		case SHOW_COLSEP:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			handleOutput("COLSEP", ("\"" + sessObj.getSessionColSep() + "\""));
+			break;
+
+		case SHOW_MARKUP:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			handleOutput("MARKUP", sessObj.getStrDisplayFormat());
+			break;
+
+		case SHOW_PARAM:
+		case SHOW_PARAMS:
+
+			totalCount = 0;
+			String paramName = parser.getNextParamToken();
+			if (paramName != null) {
+				if (parser.hasMoreTokens()) {
+					writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				} else if (sessObj.getSessParams() != null) {
+					if (sessObj.getSessParams(paramName) != null) {
+						handleOutput(paramName,
+								sessObj.getSessParams(paramName), false);
+						totalCount++;
+					} else {
+						sessionError('E', SessionError.SHOW_PARAM_NOT_FOUND);
+					}
+
+				}
+				break;
+			}
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				HashMap<String,String> paramHash = sessObj.getSessParams();
+				if ((paramHash != null) && !paramHash.isEmpty()) {
+					Map<String, String> sortedMap = new TreeMap<String, String>(paramHash);
+					Iterator<String> paramNames = sortedMap.keySet().iterator();
+					for (int paramCnt = 0; paramCnt < paramHash.size(); paramCnt++) {
+						if (paramNames.hasNext()) {
+							String pName = (String) paramNames.next();
+							handleOutput(pName,
+									paramHash.get(pName).toString(), false);
+							totalCount++;
+						}
+					}
+					printElapsedTime();
+					writer.writeEndTags(sessObj);
+				} else {
+					sessionError('E', SessionError.SHOW_PARAM_NOT_FOUND);
+				}
+
+			}
+
+			sessObj.setTotalRecordCount(String.valueOf(totalCount));
+			break;
+
+		case SHOW_TABLES:
+		case SHOW_SCHEMAS:
+		case SHOW_CATALOGS:
+		case SHOW_VIEWS:
+		case SHOW_SYNONYMS:
+		case SHOW_MVS:
+		case SHOW_MVGROUPS:
+		case SHOW_PROCEDURES:
+
+			totalCount = 0;
+			String tableNamePattern = null;
+
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE && sessObj.getMode() != SessionDefaults.CS_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+			tableNamePattern = parser.getNextQValueToken();
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (!sessObj.isDBConnExists()) // Modified  2010-03-01
+			{
+				displayNoConnInfo();
+				break;
+			}
+
+			ResultSet rsmd = null;
+			// default is TABLE_NAME
+			String getStr = SqlEnum.TABLE_NAME.toString();
+			;
+
+			DatabaseMetaData dbmd = conn.getMetaData();
+
+			String displayStr = null;
+			ErrorObject errObj = null;
+
+			if (tableNamePattern != null) {
+
+				if ((tableNamePattern.indexOf("*") != -1)
+						|| (tableNamePattern.indexOf("?") != -1))
+
+					tableNamePattern = parser
+							.replaceShowPattern(tableNamePattern);
+
+			}
+			try {
+				switch (showId) {
+				case SHOW_TABLES:
+					String[] ttype = { SqlEnum.TABLE.toString() };
+					rsmd = dbmd
+							.getTables(sessObj.getSessionCtlg(),
+									sessObj.getSessionSchema(),
+									tableNamePattern, ttype);
+					displayStr = "TABLE NAMES";
+					errObj = SessionError.SHOW_TAB_NOT_FOUND;
+					tableNamePattern = null;
+					break;
+
+				case SHOW_VIEWS:
+					String[] vtype = { "VIEW" };
+					rsmd = dbmd
+							.getTables(sessObj.getSessionCtlg(),
+									sessObj.getSessionSchema(),
+									tableNamePattern, vtype);
+					displayStr = "VIEW NAMES";
+					errObj = SessionError.SHOW_VIEW_NOT_FOUND;
+					tableNamePattern = null;
+					break;
+
+				case SHOW_SYNONYMS:
+					String[] stype = { SqlEnum.SYNONYM.toString() };
+					rsmd = dbmd
+							.getTables(sessObj.getSessionCtlg(),
+									sessObj.getSessionSchema(),
+									tableNamePattern, stype);
+					displayStr = "SYNONYM NAMES";
+					errObj = SessionError.SHOW_SYNONYM_NOT_FOUND;
+					tableNamePattern = null;
+					break;
+
+				case SHOW_MVS:
+					String[] mvtype = { "MV" };
+					rsmd = dbmd.getTables(sessObj.getSessionCtlg(),
+							sessObj.getSessionSchema(), tableNamePattern,
+							mvtype);
+					displayStr = "MATERIALIZED VIEW NAMES";
+					errObj = SessionError.SHOW_MV_NOT_FOUND;
+					tableNamePattern = null;
+					break;
+
+				case SHOW_MVGROUPS:
+					String[] mvgtype = { "MVG" };
+					rsmd = dbmd.getTables(sessObj.getSessionCtlg(),
+							sessObj.getSessionSchema(), tableNamePattern,
+							mvgtype);
+					displayStr = "MATERIALIZED VIEW GROUP NAMES";
+					errObj = SessionError.SHOW_MVG_NOT_FOUND;
+					tableNamePattern = null;
+					break;
+
+				case SHOW_CATALOGS:
+					rsmd = dbmd.getCatalogs();
+					getStr = "TABLE_CAT";
+					displayStr = "CATALOG NAMES";
+					errObj = SessionError.SHOW_CAT_NOT_FOUND;
+					break;
+
+				case SHOW_SCHEMAS:
+					rsmd = dbmd.getSchemas();
+					getStr = "TABLE_SCHEM";
+					displayStr = "SCHEMA NAMES";
+					errObj = SessionError.SHOW_SCH_NOT_FOUND;
+					break;
+
+				case SHOW_PROCEDURES:
+					rsmd = dbmd.getProcedures(sessObj.getSessionCtlg(),
+							sessObj.getSessionSchema(), tableNamePattern);
+					getStr = "PROCEDURE_NAME";
+					displayStr = "PROCEDURE NAMES";
+					errObj = SessionError.SHOW_PROC_NOT_FOUND;
+					tableNamePattern = null;
+					break;
+
+				}
+				// Temporary fix till JDBC fixes this issue.
+			} catch (NullPointerException npe) {
+				errObj = SessionError.INTERNAL_ERR;
+			}
+
+			if ((tableNamePattern != null)
+					&& (tableNamePattern.trim().equals(""))) {
+				tableNamePattern = null;
+			}
+			if (tableNamePattern != null) {
+				tableNamePattern = utils.trimDoubleQuote(tableNamePattern);
+				try {
+					tableNamePattern = tableNamePattern.replaceAll("_", ".");
+					tableNamePattern = tableNamePattern.replaceAll("%", ".*");
+				} catch (PatternSyntaxException pse) {
+					tableNamePattern = "";
+				}
+
+			}
+
+			List<String> results = new ArrayList<String>();
+			int maxDisplaySize = 0;
+			int displayCols = 0;
+			if (rsmd == null || !rsmd.next()) {
+				sessionError('E', errObj);
+			} else {
+				int currentColLength = 0;
+
+				do {
+					if ((currentColLength = rsmd.getString(getStr).getBytes().length) > maxDisplaySize) {
+						maxDisplaySize = currentColLength;
+					}
+					if (tableNamePattern == null) {
+						results.add(rsmd.getString(getStr));
+
+					} else {
+						try {
+							if (rsmd.getString(getStr)
+									.matches(tableNamePattern)) {
+								results.add(rsmd.getString(getStr));
+
+							}
+						} catch (PatternSyntaxException pse) {
+							tableNamePattern = "";
+						}
+
+					}
+				} while (rsmd.next());
+
+				if (results.size() == 0) {
+					sessionError('E', errObj);
+				} else {
+
+					switch (sessObj.getDisplayFormat()) {
+					case SessionDefaults.HTML_FORMAT:
+						sessObj.getHtmlObj().init();
+						sessObj.getHtmlObj().handleStartTags();
+						writer.writeln("<tr>");
+						writer.writeln("  <th>" + displayStr + "</th>");
+						writer.writeln("</tr>");
+						break;
+					case SessionDefaults.XML_FORMAT:
+						sessObj.getXmlObj().init();
+						sessObj.getXmlObj().handleStartTags();
+						writer.writeln("   <" + utils.removeSpaces(displayStr)
+								+ ">");
+						break;
+					case SessionDefaults.CSV_FORMAT:
+						writer.writeln();
+						break;
+					default:
+						// print the header label
+						writer.writeln();
+						writer.writeln(displayStr);
+						writer.write(utils.formatString("-", 80, '-'));
+						writer.writeln();
+						break;
+					}
+
+					if (maxDisplaySize == 0 || maxDisplaySize > 60) {
+						displayCols = 1;
+					} else {
+						displayCols = (int) Math
+								.floor(96 / (maxDisplaySize + 2));
+
+					}
+
+					for (int j = 0; j < results.size(); j++) {
+						switch (sessObj.getDisplayFormat()) {
+						case SessionDefaults.XML_FORMAT:
+							writer.writeln("     <Name>"
+									+ utils.formatXMLdata(results.get(j)
+											.toString()) + "</Name>");
+							break;
+						case SessionDefaults.HTML_FORMAT:
+							writer.writeln("<tr>");
+							writer.writeln("  <td>" + results.get(j).toString()
+									+ "</td>");
+							writer.writeln("</tr>");
+							break;
+						case SessionDefaults.CSV_FORMAT:
+							writer.writeln(results.get(j).toString());
+							break;
+						default:
+							formatOutput(results.get(j).toString(),
+									maxDisplaySize + 2, ' ', 0);
+							if ((j + 1) % displayCols == 0) {
+								writer.writeln();
+							}
+							break;
+						}
+						totalCount++;
+					}
+
+					sessObj.setQryEndTime();
+
+				}
+			}
+
+			switch (sessObj.getDisplayFormat()) {
+			case SessionDefaults.HTML_FORMAT:
+				if (sessObj.isSessionTimingOn())
+					writer.writeln(sessObj.getHtmlObj()._startCommentTag
+							+ writer.getElapsedTime(sessObj, qryObj, utils)
+							+ sessObj.getHtmlObj()._endCommentTag);
+				writer.printElapsedQuietMode(writer.getElapsedTime(sessObj,
+						qryObj, utils));
+				sessObj.getHtmlObj().handleEndTags();
+				break;
+			case SessionDefaults.XML_FORMAT:
+				if (results.size() != 0)
+					writer.writeln("   </" + utils.removeSpaces(displayStr)
+							+ ">");
+				if (sessObj.isSessionTimingOn())
+					writer.writeln(sessObj.getXmlObj()._beginCdataTag
+							+ writer.getElapsedTime(sessObj, qryObj, utils)
+							+ sessObj.getXmlObj()._endCdataTag);
+
+				writer.printElapsedQuietMode(writer.getElapsedTime(sessObj,
+						qryObj, utils));
+				sessObj.getXmlObj().handleEndTags();
+				break;
+			case SessionDefaults.CSV_FORMAT:
+				writer.writeln();
+				if (results.size() != 0 && sessObj.isSessionTimingOn()) {
+					writer.writeln(writer
+							.getElapsedTime(sessObj, qryObj, utils));
+					writer.printElapsedQuietMode(writer.getElapsedTime(sessObj,
+							qryObj, utils));
+				}
+				break;
+			default:
+				if (results.size() != 0 && results.size() % displayCols != 0) {
+					writer.writeln();
+				}
+				if (sessObj.isSessionTimingOn()) {
+					writer.writeln();
+					writer.writeln(writer
+							.getElapsedTime(sessObj, qryObj, utils));
+					writer.printElapsedQuietMode(writer.getElapsedTime(sessObj,
+							qryObj, utils));
+				}
+				break;
+			}
+			results = null;
+
+			sessObj.setTotalRecordCount(String.valueOf(totalCount));
+			sessObj.setLastError(0);
+			break;
+		/**
+		 * show indexes [order by table] By default: order by index names
+		 */
+		case SHOW_INDEXES:
+			boolean orderByIndex = true;
+			if (parser.hasMoreTokens()) {
+				String remainderStr = parser.getRemainderStr();
+				if (!remainderStr.equalsIgnoreCase(" order by table")) {
+					writeSyntaxError(this.queryStr, remainderStr);
+					break;
+				} else
+					orderByIndex = false;
+			}
+			if (sessObj.isDBConnExists())
+				this.handleShowIndexes(orderByIndex);
+			else
+				displayNoConnInfo();
+
+			break;
+
+		case SHOW_TABLE:
+
+			String ctlgName = null;
+			String schemaName = null;
+			String tableName = null;
+			String prepTableName = null;
+			String[] validOptions = { SqlEnum.INDEXES.toString(),
+					SqlEnum.SYNONYMS.toString(), SqlEnum.MVS.toString(),
+					SqlEnum.TRIGGERS.toString() };
+			int headingLength = 80;
+
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+
+			if (!parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				return;
+			}
+
+			if (!sessObj.isDBConnExists()) {
+				displayNoConnInfo();
+				break;
+			}
+
+			List<String> cstList = parser.getCSTList(parser.getRemainderStr());
+
+			if (cstList.size() == 0) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (parser.showTableIdxRemainder != null) {
+				prepTableName = parser.getRemainderStr().substring(
+						0,
+						parser.getRemainderStr().length()
+								- parser.showTableIdxRemainder.length());
+				parser.setRemainderStr(parser.getRemainderStr().substring(
+						prepTableName.length(),
+						parser.getRemainderStr().length()));
+			} else {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (!parser.getRemainderStr().trim().startsWith(",")) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				parser.setRemainderStr(parser.getRemainderStr().substring(1,
+						parser.getRemainderStr().length()));
+			}
+
+			switch (cstList.size()) {
+			case 3:
+				ctlgName = cstList.get(0);
+				schemaName = cstList.get(1);
+				tableName = cstList.get(2);
+				break;
+			case 2:
+				ctlgName = sessObj.getSessionCtlg();
+				schemaName = cstList.get(0);
+				tableName = cstList.get(1);
+				break;
+			case 1:
+				ctlgName = sessObj.getSessionCtlg();
+				schemaName = sessObj.getSessionSchema();
+				tableName = cstList.get(0);
+
+				break;
+			}
+
+			String keyWordToken = parser.getNextKeyToken();
+			String[] tmpOptions = null;
+			if (keyWordToken == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (keyWordToken.equalsIgnoreCase("ALL")) {
+				tmpOptions = validOptions;
+			} else {
+				tmpOptions = new String[1];
+				tmpOptions[0] = keyWordToken;
+			}
+
+			int howManyOptions = tmpOptions.length;
+			handleShowTableOptions(howManyOptions, keyWordToken, prepTableName,
+					tmpOptions, ctlgName, schemaName, tableName, headingLength);
+			break;
+
+		case SHOW_PREPARED:
+
+			totalCount = 0;
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+
+			PreparedStatement pStmt = null;
+			String stmtNamePattern = parser.getNextQValueToken();
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (!sessObj.isDBConnExists()) // Modified  2010-03-01
+			{
+				displayNoConnInfo();
+				break;
+			}
+
+			HashMap<String, Object[]> prepStmtMap = sessObj.getPrepStmtMap();
+			if ((prepStmtMap == null) || (prepStmtMap.isEmpty())) {
+				sessionError('E', SessionError.SHOW_PREP_NOT_FOUND);
+				break;
+			}
+			if (stmtNamePattern != null) {
+
+				if ((stmtNamePattern.indexOf("*") != -1)
+						|| (stmtNamePattern.indexOf("?") != -1))
+
+					stmtNamePattern = parser
+							.replaceShowPrepPattern(stmtNamePattern);
+
+				stmtNamePattern = utils.trimDoubleQuote(stmtNamePattern);
+				try {
+					stmtNamePattern = stmtNamePattern.replaceAll("_", ".");
+					stmtNamePattern = stmtNamePattern.replaceAll("%", ".*");
+				} catch (PatternSyntaxException pse) {
+					stmtNamePattern = "";
+				}
+			}
+			Map<String, Object[]> sortedMap = new TreeMap<String, Object[]>(prepStmtMap);
+			Iterator<String> it = sortedMap.keySet().iterator();
+			String key = null;
+			boolean found = false;
+
+			while (it.hasNext()) {
+				key = it.next();
+				try {
+					if ((stmtNamePattern == null || key
+							.matches(stmtNamePattern))
+							&& !key.equals(sessObj.getAutoPrepStmtName())) {
+						pStmt = (PreparedStatement) sessObj.getPrepStmtMap(key);
+						handleOutput(key, ((TrafT4Statement) pStmt).getSQL(),
+								false);
+						found = true;
+						totalCount++;
+					}
+				} catch (PatternSyntaxException pse) {
+					// No action required here
+				}
+			}
+
+			// If no matching statement names were found
+			// display a status message
+			if (!found) {
+				sessionError('E', SessionError.SHOW_PREP_NOT_FOUND);
+			}
+			sessObj.setTotalRecordCount(String.valueOf(totalCount));
+			printElapsedTime();
+			writer.writeEndTags(sessObj);
+			break;
+
+		case SHOW_HISTOPT:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			handleOutput("HISTOPT", (sessObj.isSessionHistoryAll() ? "ALL"
+					: "DEFAULT [No expansion of script files]"));
+			break;
+
+		case SHOW_AUTOPREPARE:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			handleOutput("AUTOPREPARE", (sessObj.isSessionAutoPrepare() ? "ON"
+					: "OFF"));
+			break;
+
+		case SHOW_ERRORCODE:
+		case SHOW_LASTERROR:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (showId == SHOW_LASTERROR)
+				handleOutput("LASTERROR",
+						String.valueOf(sessObj.getLastError()));
+			else
+				handleOutput("ERRORCODE",
+						String.valueOf(sessObj.getLastError()));
+
+			break;
+
+		case SHOW_ACTIVITYCOUNT:
+		case SHOW_RECCOUNT:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (!sessObj.isDBConnExists()) // Modified  2010-03-01
+			{
+				displayNoConnInfo();
+				break;
+			}
+
+			String recCount = sessObj.getTotalRecordCount();
+			if (showId == SHOW_RECCOUNT)
+				handleOutput("RECCOUNT", (recCount != null ? recCount : "0"));
+			else
+				handleOutput("ACTIVITYCOUNT", (recCount != null ? recCount
+						: "0"));
+
+			break;
+
+		case SHOW_STATISTICS:
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			handleOutput("STATISTICS", (sessObj.isSessionStatsEnabled() ? "ON"
+					: "OFF"));
+			break;
+
+		case SHOW_ACCESS:
+			if (!parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			handleDumpFileAccess();
+
+			break;
+
+		case SHOW_LOOKANDFEEL:
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			handleOutput("LOOK AND FEEL", (sessObj.getStrSessView()));
+			break;
+
+		case SHOW_ALIAS:
+			handleShowAlias();
+			break;
+
+		case SHOW_ALIASES:
+			handleShowAliases();
+			break;
+
+		case SHOW_FETCHSIZE:
+
+			if (!checkForMoreTokens())
+				handleOutput(
+						"FETCHSIZE",
+						String.valueOf(sessObj.getFetchSize())
+								+ (sessObj.getFetchSize() == 0 ? " [Default]"
+										: ""));
+			break;
+
+		case SHOW_PATTERNDEPTH:
+
+			if (!checkForMoreTokens())
+				handleOutput("PATTERNDEPTH",
+						String.valueOf(sessObj.getMaxPatternDepth()));
+			break;
+
+		case SHOW_PATTERN:
+			handleShowPattern();
+			break;
+
+		case SHOW_PATTERNS:
+			handleShowPatterns();
+			break;
+
+		case SHOW_DEBUG:
+			checkForMoreTokens();
+			handleOutput("DEBUG", (sessObj.isDebugOn() ? "ON" : "OFF"));
+			break;
+
+		case SHOW_CMDDISPLAY:
+			checkForMoreTokens();
+			handleOutput("CMDDISPLAY", (sessObj.isLogCmdEcho() ? "ON" : "OFF"));
+			break;
+
+		case SHOW_USER:
+			checkForMoreTokens();
+			if (sessObj.isDBConnExists()) {
+				handleOutput(
+						"USER",
+						sessObj.getSessionUser() + " ("
+								+ sessObj.getSessionRole() + ")");
+			} else {
+				displayNoConnInfo();
+			}
+			break;
+
+		case SHOW_SERVER:
+			checkForMoreTokens();
+			if (sessObj.isDBConnExists())
+				handleOutput("SERVER:PORT", sessObj.getSessionServer()
+						+ sessObj.getSessionPort());
+			else
+				displayNoConnInfo();
+			break;
+
+		case SHOW_CONNECTOPT:
+			checkForMoreTokens();
+			handleOutput("CONNECTOPT",
+					(sessObj.getTempSessionRole().length() == 0 ? "DEFAULT"
+							: sessObj.getTempSessionRole()));
+			break;
+		}
+	}
+
+	private void execSet() throws UnKnownInterfaceCommand, IOException,
+			SQLException, UserInterruption {
+
+		String setOption = parser.getNextKeyToken();
+		int setOpt;
+
+		// not a keyword..then its not ours
+
+		if (setOption == null) {
+			if (parser.hasMoreTokens()) {
+				throw uic;
+			}
+			sessionError('E', SessionError.SET_NO_OPTION);
+			return;
+		}
+
+		setOption = iqKeyMap.get("SET_" + setOption.toUpperCase());
+
+		if (setOption == null) {
+			throw uic;
+		}
+
+		int setId = Integer.parseInt(setOption);
+
+		String setValue = "";
+
+		switch (setId) {
+		case SET_CONNECTOPT:
+			setValue = parser.getNextKeyToken();
+			if (setValue == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (!setValue.toUpperCase().equals("ROLE")) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			setValue = parser.getNextValueToken();
+			if (setValue == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				sessObj.setTempSessionRole(setValue);
+			}
+			break;
+
+		case SET_TIME:
+
+			setValue = parser.getNextKeyToken();
+			if (setValue == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			setValue = setValue.toUpperCase();
+			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
+				writeSyntaxError(this.queryStr,
+						setValue + parser.getRemainderStr());
+				break;
+			}
+			if (setValue.equals("OFF") && parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr,
+						setValue + parser.getRemainderStr());
+				break;
+			}
+			String timeFormat = parser.getNextKeyToken();
+
+			if ((timeFormat != null) && !timeFormat.equalsIgnoreCase("12h")) {
+				writeSyntaxError(this.queryStr,
+						setValue + parser.getRemainderStr());
+				break;
+			}
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (setValue.equals("ON")) {
+				sessObj.setSessionTime(true);
+				if ((timeFormat != null)
+						&& (timeFormat.equalsIgnoreCase("12h")))
+					sessObj.setAmPmFmt(true);
+				else
+					sessObj.setAmPmFmt(false);
+
+			} else {
+				sessObj.setSessionTime(false);
+			}
+			envMap.put("TIME", (sessObj.isSessionTimeOn() ? "ON" : "OFF"));
+
+			break;
+
+		case SET_TIMING:
+
+			setOpt = getSetValue();
+			if (setOpt != -1) {
+				sessObj.setSessionTiming(setOpt == 1 ? true : false);
+			}
+			envMap.put("TIMING", (sessObj.isSessionTimingOn() ? "ON" : "OFF"));
+			break;
+
+		case SET_SQLPROMPT:
+
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+
+		case SET_PROMPT:
+
+			setValue = parser.getNextValueToken();
+			String regx1 = "\\s*(?i)";
+			String regx2 = "\\s*[>\\s]*\\s*";
+			if (setValue == null) {
+				if (SessionDefaults.SQL_MODE == sessObj.getMode())
+					sessObj.setSessionPrompt(SessionDefaults.DEFAULT_SQL_PROMPT);
+				else if (SessionDefaults.CS_MODE == sessObj.getMode())
+					sessObj.setSessionPrompt(SessionDefaults.DEFAULT_CS_PROMPT);
+				else if (SessionDefaults.WMS_MODE == sessObj.getMode())
+					sessObj.setSessionPrompt(SessionDefaults.DEFAULT_WMS_PROMPT);
+				envMap.put("PROMPT", sessObj.getSessionPrompt());
+				break;
+			} else if (setValue.matches(regx1 + SessionDefaults.SQL + regx2)) {
+				sessionError('E', SessionError.SQL_RESERVED_WORD_ERROR);
+				break;
+			} else if (setValue.matches(regx1 + SessionDefaults.CS + regx2)) {
+				sessionError('E', SessionError.CS_RESERVED_WORD_ERROR);
+				break;
+			} else if (setValue.matches(regx1 + SessionDefaults.WMS + regx2)) {
+				sessionError('E', SessionError.WMS_RESERVED_WORD_ERROR);
+				break;
+			}
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				// Added  to deal with non-connection situation
+				if (!sessObj.isDBConnExists()
+						&& (setValue.toUpperCase().indexOf("%USER") != -1
+								|| setValue.toUpperCase().indexOf("%SCHEMA") != -1
+								|| setValue.toUpperCase().indexOf("%SERVER") != -1
+								|| setValue.toUpperCase().indexOf("%MODE") != -1
+								|| setValue.toUpperCase()
+										.indexOf("%DATASOURCE") != -1 || setValue
+								.toUpperCase().indexOf("%ROLE") != -1)) {
+					displayNoConnInfo();
+					break;
+				}
+				sessObj.setSessionPrompt(setValue);
+			}
+			envMap.put("PROMPT", sessObj.getSessionPrompt());
+			break;
+
+		case SET_SQLTERMINATOR:
+
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+			setValue = parser.getNextValueToken();
+			if (setValue == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				sessObj.setSessionSQLTerminator(setValue);
+				sessObj.setTermEventMap(
+						Integer.toString(sessObj.getHistCmdNo() + 1), setValue);
+				sessObj.setTermEvent(Integer.toString(sessObj.getHistCmdNo() + 1));
+			}
+			envMap.put("SQLTERMINATOR", sessObj.getSessionSQLTerminator());
+			break;
+
+		case SET_IDLETIMEOUT:
+			int intSetValue = 0;
+			setValue = parser.getNextNumberToken();
+			if (setValue == null || setValue.trim().equals("")) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				try {
+					intSetValue = Integer.parseInt(setValue);
+					if (intSetValue < 0)
+						throw (new NumberFormatException());
+					else
+						sessObj.setSessionIdletime(intSetValue);
+					envMap.put("IDLETIMEOUT",
+							Integer.toString(sessObj.getSessionIdletime()));
+				} catch (NumberFormatException nfe) {
+					sessionError('E', SessionError.SET_IDLETIMEOUT_VAL_ERR);
+				}
+			}
+
+			break;
+
+		case SET_PARAM:
+
+			String paramName = parser.getNextParamToken();
+			if (paramName == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			/**
+			 * Use the new method to get the parameter value and validate that
+			 * the value is syntactically correct.
+			 */
+			ParamStringObject psv = parser.getParamValue(null);
+			if (null != psv) {
+				setValue = psv.toString();
+
+				try {
+					if (sessObj.isDebugOn())
+						System.out.println("@@@Debug: InterfaceQuery:: psv = "
+								+ psv.toString());
+
+					String theActualValue = psv.getParameterValue();
+
+					if (sessObj.isDebugOn())
+						System.out.println("@@@Debug: InterfaceQuery:: psv "
+								+ "getParamValue= " + theActualValue);
+
+				} catch (Exception exc) {
+					setValue = null;
+
+					ErrorObject eo = new ErrorObject(
+							SessionError.INVALID_PARAM_STRING_VALUE, "",
+							exc.getMessage());
+					sessionError('E', eo);
+					break;
+				}
+
+			} else
+				setValue = null;
+
+			if (sessObj.isDebugOn())
+				System.out.println("@@@Debug: InterfaceQuery:: setValue "
+						+ setValue);
+
+			if (setValue == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (sessObj.isDebugOn())
+				System.out.println("@@@Debug: InterfaceQuery:: parser has "
+						+ "more tokens = " + parser.hasMoreTokens());
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			sessObj.setSessParams(paramName, setValue);
+			break;
+
+		case SET_DISPLAY_COLSIZE:
+			if (sessObj.getMode() != SessionDefaults.WMS_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+			setValue = parser.getNextValueToken();
+			if (setValue == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				try {
+					int dispColSize = Integer.parseInt(setValue);
+					if (dispColSize <= 0)
+						throw (new NumberFormatException());
+					else {
+						sessObj.setDisplayColSize(dispColSize);
+					}
+				} catch (NumberFormatException nfe) {
+					// sessionError('E',SessionError.SET_LISTCOUNT_VAL_ERR);
+				}
+			}
+			break;
+
+		case SET_LISTCOUNT:
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+			int intListCntValue = 0;
+			setValue = parser.getNextNumberToken();
+			if (setValue == null || setValue.trim().equals("")) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				try {
+					intListCntValue = Integer.parseInt(setValue);
+					if (intListCntValue < 0)
+						throw (new NumberFormatException());
+					else {
+						sessObj.setListCount(intListCntValue);
+					}
+					envMap.put("LIST_COUNT",
+							Integer.toString(sessObj.getListCount()));
+				} catch (NumberFormatException nfe) {
+					sessionError('E', SessionError.SET_LISTCOUNT_VAL_ERR);
+				}
+			}
+			break;
+
+		case SET_COLSEP:
+
+			setValue = parser.getNextValueToken();
+			if (setValue == null) {
+				sessObj.setSessionColSep(" ");
+				break;
+			}
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				sessObj.setSessionColSep(setValue);
+			}
+			envMap.put("COLSEP", sessObj.getSessionColSep());
+			break;
+
+		case SET_HISTOPT:
+
+			setValue = parser.getNextKeyToken();
+			if (setValue == null) {
+				sessObj.setSessionHistoryAll(false);
+				break;
+			}
+			setValue = setValue.toUpperCase();
+			if (!setValue.equals("ALL") && !setValue.equals("DEFAULT")) {
+				writeSyntaxError(this.queryStr,
+						setValue + parser.getRemainderStr());
+				break;
+			}
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (setValue.equals("ALL")) {
+				sessObj.setSessionHistoryAll(true);
+			} else {
+				sessObj.setSessionHistoryAll(false);
+			}
+			envMap.put("HISTOPT", sessObj.isSessionHistoryAll() ? "ALL"
+					: "DEFAULT [No expansion of script files]");
+			break;
+
+		case SET_STATISTICS:
+
+			setValue = parser.getNextKeyToken();
+			if (setValue == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			setValue = setValue.toUpperCase();
+			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
+				writeSyntaxError(this.queryStr,
+						setValue + parser.getRemainderStr());
+				break;
+			}
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (setValue.equals("ON")) {
+				sessObj.setSessionStatsEnabled(true);
+			} else {
+				sessObj.setSessionStatsEnabled(false);
+			}
+			envMap.put("STATISTICS", sessObj.isSessionStatsEnabled() ? "ON"
+					: "OFF");
+			break;
+
+		case SET_MARKUP:
+
+			setValue = parser.getNextValueToken();
+			if (setValue == null) {
+				sessObj.setStrDisplayFormat("RAW");
+				break;
+			}
+
+			if ((!setValue.toUpperCase().equals("RAW"))
+					&& (!setValue.toUpperCase().equals("XML"))
+					&& (!setValue.toUpperCase().equals("HTML"))
+					&& (!setValue.toUpperCase().equals("CSV"))
+					&& (!setValue.toUpperCase().equals("COLSEP"))) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				sessObj.setStrDisplayFormat(setValue);
+			}
+			envMap.put("MARKUP", sessObj.getStrDisplayFormat());
+			break;
+
+		case SET_AUTOPREPARE:
+
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+			setOpt = getSetValue();
+			if (setOpt != -1) {
+				sessObj.setSessionAutoPrepare(setOpt == 1 ? true : false);
+			}
+			break;
+
+		case SET_LOOKANDFEEL:
+
+			setValue = parser.getNextValueToken();
+			if (setValue == null || setValue == "") {
+				sessObj.setSessView(SessionDefaults.CIDEFAULT_VIEW);
+				sessObj.setSessionPrompt(SessionDefaults.DEFAULT_SQL_PROMPT);
+				break;
+			}
+			if ((!setValue.matches("(?i)\\s*(MXCI|TRAFCI)"))
+					|| parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			} else {
+				if (setValue.equalsIgnoreCase("MXCI")) {
+					sessObj.setSessView(SessionDefaults.MXCI_VIEW);
+					sessObj.setSessionPrompt(">>");
+				} else {
+					if (sessObj.isCmdEchoEnabled()
+							&& sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
+						sessObj.setCmdEcho(false);
+
+					sessObj.setSessView(SessionDefaults.CIDEFAULT_VIEW);
+					sessObj.setSessionPrompt(SessionDefaults.DEFAULT_SQL_PROMPT);
+				}
+			}
+			envMap.put("LOOK_AND_FEEL", sessObj.getStrSessView());
+			break;
+
+		case SET_CMDECHO:
+
+			setValue = parser.getNextKeyToken();
+			if (setValue == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			setValue = setValue.toUpperCase();
+			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
+				writeSyntaxError(this.queryStr,
+						setValue + parser.getRemainderStr());
+				break;
+			}
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (setValue.equals("ON")) {
+				sessObj.setCmdEcho(true);
+			} else {
+				sessObj.setCmdEcho(false);
+			}
+			break;
+
+		case SET_FETCHSIZE:
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+			setValue = parser.getNextNumberToken();
+			if (setValue == null || parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			try {
+				int fetchSize = Integer.parseInt(setValue);
+
+				if (fetchSize < 0)
+					throw (new NumberFormatException());
+				else {
+					sessObj.setFetchSize(fetchSize);
+				}
+			} catch (NumberFormatException nfe) {
+				sessionError('E', SessionError.SET_FETCHSIZE_VAL_ERR);
+			}
+			break;
+
+		case SET_PATTERN:
+			String key = null;
+
+			if ((key = parser.getPatternKeyPattern()) != null) {
+				if (envMap.containsKey(key.toUpperCase())) {
+					sessionError(
+							'E',
+							new ErrorObject(
+									SessionError.COMMAND_NAME_NOT_ALLOWED,
+									"",
+									key.toUpperCase()
+											+ SessionError.PATTERN_COMMAND_NAME_NOT_ALLOWED_SUFFIX));
+					return;
+				}
+				if (sessObj.isDebugOn())
+					System.out.println("SET_PATTERN :: key:" + key);
+
+				setValue = parser.getPatternValueToken();
+
+				if (sessObj.isDebugOn())
+					System.out.println("SET_PATTERN :: value:" + setValue + "");
+
+				if (setValue == null || parser.hasMoreTokens()) {
+					writeSyntaxError(this.queryStr, parser.getRemainderStr());
+					break;
+				}
+				sessObj.setPattern(key, setValue);
+				break;
+			} else if ((key = parser.getRegexpPattern()) != null) {
+				try {
+					Pattern.compile(key);
+				} catch (PatternSyntaxException pse) {
+					sessionError('E', SessionError.INVALID_REGEXP);
+					break;
+				}
+				if (sessObj.isDebugOn())
+					System.out.println("SET_PATTERN :: RegExp:" + key);
+
+				setValue = parser.getRegexpValue();
+
+				if (sessObj.isDebugOn())
+					System.out.println("SET_PATTERN :: value:" + setValue);
+
+				if ((setValue == null) || parser.hasMoreTokens()) {
+					writeSyntaxError(this.queryStr, "");
+					break;
+				}
+				sessObj.setRegExpPattern(key, setValue);
+			} else {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			break;
+
+		case SET_PATTERNDEPTH:
+			if (sessObj.getMode() != SessionDefaults.SQL_MODE) {
+				this.invalidCmdforMode(sessObj.getMode());
+				break;
+			}
+			setValue = parser.getNextNumberToken();
+			if (setValue == null || parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			try {
+				int maxPatternDepth = Integer.parseInt(setValue);
+
+				if (maxPatternDepth < 0
+						|| maxPatternDepth > SessionDefaults.PATTERN_DEPTH_LIMIT)
+					throw (new NumberFormatException());
+				else {
+					sessObj.setMaxPatternDepth(maxPatternDepth);
+				}
+			} catch (NumberFormatException nfe) {
+				sessionError('E', SessionError.SET_PATTERN_DEPTH_VAL_ERR);
+			}
+			break;
+
+		case SET_DEBUG:
+			setValue = parser.getNextKeyToken();
+			if (setValue == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			setValue = setValue.toUpperCase();
+			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
+				writeSyntaxError(this.queryStr,
+						setValue + parser.getRemainderStr());
+				break;
+			}
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			if (setValue.equals("ON")) {
+				sessObj.setDebugOn(true);
+			} else {
+				sessObj.setDebugOn(false);
+			}
+			break;
+
+		case SET_CMDDISPLAY:
+
+			setValue = parser.getNextKeyToken();
+			if (setValue == null) {
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+				break;
+			}
+			setValue = setValue.toUpperCase();
+			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
+				writeSyntaxError(this.queryStr,
+						setValue + parser.getRemainderStr());
+				break;
+			}
+			if (parser.hasMoreTokens()) {
+				writeSyntaxError(this.queryStr,
+						setValue + parser.getRemainderStr());
+				break;
+			}
+			if (setValue.equals("ON")) {
+				sessObj.setLogCmdEcho(true);
+				if (sessObj.isDotModeCmd()) {
+					sessObj.setDotModeCmd(false);
+					sessObj.setHistOn(false);
+				}
+			} else {
+				sessObj.setLogCmdEcho(false);
+			}
+			break;
+		}
+	}
+
+	int getSetValue() throws IOException {
+		String setValue = parser.getNextKeyToken();
+		if (setValue == null) {
+			return 0;
+		}
+		if (parser.hasMoreTokens()) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return -1;
+		}
+		if (setValue.equalsIgnoreCase("ON"))
+			return (1);
+		else if (setValue.equalsIgnoreCase("OFF"))
+			return (0);
+		else {
+			writeSyntaxError(this.queryStr, setValue + parser.getRemainderStr());
+			return -1;
+		}
+	}
+
+	private void writeSyntaxError(String queryStr, String remainderStr)
+			throws IOException {
+		sessObj.getQuery().setStatusCode(-1); // update the error code to -1
+
+		if (sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+			writer.writeln();
+
+		writer.writeSyntaxError(sessObj, this.queryStr, remainderStr);
+	}
+
+	private void invalidCmdforMode(int mode) throws IOException {
+		switch (mode) {
+		case SessionDefaults.WMS_MODE:
+			sessionError('E', SessionError.CMD_NOT_WMS_SUPPORTED);
+			break;
+		case SessionDefaults.SQL_MODE:
+			sessionError('E', SessionError.CMD_NOT_SQL_SUPPORTED);
+			break;
+		case SessionDefaults.CS_MODE:
+			sessionError('E', SessionError.CMD_NOT_CS_SUPPORTED);
+			break;
+		}
+	}
+
+	private void sessionError(char errType, ErrorObject errObj)
+			throws IOException {
+		sessObj.getQuery().setStatusCode(-1); // update the error code to -1
+
+		if (sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+			writer.writeln();
+
+		sessObj.setLastError(Integer.parseInt(errObj.errorCode()));
+		writer.writeError(sessObj, errObj);
+	}
+
+	void saveFile(String fileName, boolean append) throws IOException {
+		FileWriter historyWriter = new FileWriter();
+		try {
+			historyWriter.setAppend(append);
+			historyWriter.initialize(fileName);
+
+			List<Vector<String>> historyList = sessObj.getQryHistory();
+			if (historyList != null) {
+				for (int i = 0; i < historyList.size(); i++) {
+					historyWriter.writeln((historyList.get(i)).get(1));
+				}
+			}
+			historyWriter.close();
+		} catch (FileNotFoundException fnfe) {
+			sessionError('E', SessionError.SAVE_FILE_CREATE_ERROR);
+			return;
+		} catch (IOException e) {
+			historyWriter = null;
+			throw e;
+		}
+	}
+
+	private void execGet() throws UnKnownInterfaceCommand, IOException,
+			SQLException {
+
+		// We dont have any interface commands with GET currently
+		// This method has been created for future use
+		throw uic;
+	}
+
+	private void handleVersion() throws IOException, SQLException {
+		if (parser.hasMoreTokens()) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		} else
+			displayVersionInfo(!sessObj.getPlatformObjectVersions());
+	}
+
+	private void displayVersionInfo(boolean srvrErrMsg) throws IOException {
+		String platformVersion = sessObj.getSutVersion();
+		String mxoSrvrVersion  = sessObj.getNdcsVersion();
+                String databaseVersion = sessObj.getDatabaseVersion();
+                String databaseEdition = sessObj.getDatabaseEdition();
+
+		if (databaseVersion != null &&  databaseEdition != null) {
+                    handleOutput("Database Version            : Release ", databaseVersion);
+                    handleOutput("Database Edition            :", databaseEdition,false);
+                } else {
+                    handleOutput("Database Version            :", this.infoNotAvailable, false);
+                    handleOutput("Database Edition            :", this.infoNotAvailable, false);
+                }
+                handleOutput("JDBC Type 4 Driver Build ID :", JDBCVproc.getVproc(), false);
+                handleOutput("Command Interface Build ID  :", Vproc.getVproc(), false);
+               
+		writer.writeEndTags(sessObj);
+	}
+
+	private void handleConnect() throws IOException, UserInterruption {
+		List<String> connectArgsList = new ArrayList<String>();
+
+		String connArgStr = null;
+		String newServer = null;
+		connArgStr = parser.getConnArg("user");
+
+		// if the user name is not specified but other args are specified..then
+		// throw an error
+		if (connArgStr != null) {
+			connectArgsList.add("-u");
+			connectArgsList.add(connArgStr);
+		} else if (connArgStr == null && parser.hasMoreTokens()) {
+			connectArgsList = null;
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		}
+		connArgStr = parser.getConnArg("pass");
+
+		// if the password is not specified but the other args specified..then
+		// throw syntax error
+		if (connArgStr != null) {
+			connectArgsList.add("-p");
+			connectArgsList.add(connArgStr);
+		}
+		connArgStr = newServer = parser.getConnArg("server");
+
+		if (connArgStr != null) {
+			connectArgsList.add("-h");
+			connectArgsList.add(connArgStr);
+		}
+		/*connArgStr = parser.getConnArg("dsn");
+
+		if (connArgStr != null) {
+			connectArgsList.add("-dsn");
+			connectArgsList.add(connArgStr);
+		} */
+
+		if (parser.hasMoreTokens()) {
+			connectArgsList = null;
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		}
+
+		String[] connectArgs = new String[connectArgsList.size()];
+		connectArgsList.toArray(connectArgs);
+
+		// parse the arguments and validate the user credentials
+		ParseArguments paObj = new ParseArguments(sessObj.getConsoleReader(),
+				sessObj.getConsoleWriter());
+		SessionInterface siObj = null;
+		paObj.setDefaults(SessionDefaults.dsnName, SessionDefaults.portNumber);
+
+		paObj.serverName = sessObj.getSessionServer();
+		if (sessObj.isDebugOn()) {
+			System.out.println(this.getClass().getName() + "NewServer:: "
+					+ newServer);
+			System.out.println(this.getClass().getName() + ":: "
+					+ paObj.serverName);
+			System.out.println(this.getClass().getName() + "::SessionPort:: "
+					+ sessObj.getSessionPort());
+			System.out.println(this.getClass().getName() + "::SessionServer:: "
+					+ sessObj.getSessionServer());
+		}
+		if (newServer != null) {
+			String newServer1[] = newServer.split(":");
+			if (newServer1.length > 0
+					&& newServer1[0].equalsIgnoreCase(sessObj
+							.getSessionServer()))
+				paObj.portNumber = sessObj.getSessionPort();
+			else
+				paObj.portNumber = ":" + SessionDefaults.portNumber;
+		} else
+			paObj.portNumber = sessObj.getSessionPort();
+
+		//paObj.dsnName = sessObj.getSessionDsn();
+
+		if (sessObj.isDebugOn()) {
+			System.out.println("Session Role::" + sessObj.getSessionRole());
+			System.out.println("Temp Session Role::"
+					+ sessObj.getTempSessionRole());
+		}
+
+		// String theRole=null;
+		// if (sessObj.getConnObj() != null) {
+		String theRole = sessObj.getTempSessionRole();
+		if ((null == theRole) || (0 >= theRole.length()))
+			theRole = "";
+		// }
+		paObj.roleName = theRole;
+
+		// Set the retry count to 1 if connect command is being invoked
+		// from OBEY or PRUN script files.
+		if ((sessObj.getReader().getReadMode() == SessionDefaults.OBEY_READ_MODE)
+				|| (sessObj.getCaller() == PRUNI)) {
+			paObj.retryCnt = 1;
+		}
+		while (paObj.retryCnt > 0) {
+			sessObj.setLastError(0);
+			try {
+				paObj.setAutoLogin(false);
+				connectArgs = paObj.validateArgs(connectArgs);
+				siObj = new SessionInterface(sessObj);
+				sessObj.setQryStartTime();
+
+				if (sessObj.isDebugOn())
+					System.out.println("CONNECT: " + paObj.userName + "|"
+							+ paObj.roleName + "|" + paObj.serverName + "|"
+							+ paObj.dsnName + "|" + paObj.portNumber);
+				// Get a new connection with the args specified, if success then
+				// close the previous connection
+				newConn = siObj.getConnection(paObj.userName, paObj.password,
+						paObj.roleName, paObj.serverName, paObj.dsnName,
+						paObj.portNumber);
+
+				if (newConn != null) {
+					try {
+						if (sessObj.getConnObj() != null) {
+							sessObj.getConnObj().getWarnings();
+							sessObj.getConnObj().close();
+							sessObj.setDBConnExists(false);
+						} else {
+							startTimerTask(newConn);
+						}
+					} catch (SQLException sqle) {
+					}
+
+					sessObj.setConnObj(newConn);
+					sessObj.setSessionUser(paObj.userName);
+					sessObj.setSessionPass(paObj.password);
+					sessObj.setSessionSever(paObj.serverName);
+					sessObj.setSessionPort(paObj.portNumber);
+					sessObj.setSessionValues();
+					sessObj.setStmtObj(siObj.getStatement(newConn));
+					sessObj.qsOpen = false;
+					sessObj.setDBConnExists(true);
+                                        boolean trafver = sessObj.getPlatformObjectVersions();
+
+					// Uncomment this line if you need to reset role to DEFAULT;
+					// TempSessionRole is set using SET CONNECTIOPT command
+					// sessObj.setTempSessionRole("");
+					//writer.writeln();
+
+			                writer.writeln("Connected to " + sessObj.getDatabaseEdition());
+
+					sessObj.setQryEndTime();
+					if (printConnTime) {
+						printElapsedTime();
+						writer.writeEndTags(sessObj);
+					}
+
+				}
+
+				paObj.retryCnt = 0;
+
+			} // end try
+			catch (Exception e) {
+				paObj.retryCnt--;
+				connectArgs = handleConnException(e, paObj, connectArgs);
+			}
+
+			finally {
+				newConn = null;
+			}
+		} // end while
+
+	}
+
+	private void handleReconnect() throws IOException, UserInterruption {
+		boolean prevConn = false;
+		if (parser.hasMoreTokens()) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		}
+
+		// if a connection exists already, close it before creating new one.
+		if (sessObj.getConnObj() != null) {
+			prevConn = true;
+			try {
+				sessObj.getConnObj().getWarnings();
+				sessObj.getConnObj().close();
+				// sessObj.setConnObj(null);
+			} catch (SQLException sqle) {
+
+			}
+		}
+		sessObj.setDBConnExists(false);
+
+		List<String> reconnectArgsList = new ArrayList<String>();
+
+		if (sessObj.getSessionUser() != null) {
+			reconnectArgsList.add("-u");
+			reconnectArgsList.add(sessObj.getSessionUser());
+		}
+		if (sessObj.getSessionPass() != null) {
+			reconnectArgsList.add("-p");
+			reconnectArgsList.add(sessObj.getSessionPass());
+		}
+		if (sessObj.getSessionServer() != null) {
+			reconnectArgsList.add("-h");
+			reconnectArgsList.add(sessObj.getSessionServer()
+					+ sessObj.getSessionPort());
+		}
+		/*if (sessObj.getSessionDsn() != null) {
+			reconnectArgsList.add("-dsn");
+			reconnectArgsList.add(sessObj.getSessionDsn());
+		}*/
+
+		if (sessObj.getSessionRole() != null) {
+			reconnectArgsList.add("-r");
+			reconnectArgsList.add(sessObj.getSessionRole());
+		}
+
+		String[] reconnectArgs = new String[reconnectArgsList.size()];
+		reconnectArgsList.toArray(reconnectArgs);
+		reconnectArgsList = null;
+
+		// parse the arguments and validate the user credentials
+		ParseArguments rcPaObj = new ParseArguments(sessObj.getConsoleReader(),
+				sessObj.getConsoleWriter());
+		SessionInterface rcSIObj = null;
+
+		rcPaObj.setDefaults(SessionDefaults.dsnName, SessionDefaults.portNumber);
+
+		// Set the retry count to 1 if connect command is being invoked
+		// from OBEY or PRUN script files.
+		if ((sessObj.getReader().getReadMode() == SessionDefaults.OBEY_READ_MODE)
+				|| (sessObj.getCaller() == PRUNI)) {
+			rcPaObj.retryCnt = 1;
+		}
+		while (rcPaObj.retryCnt > 0) {
+			sessObj.setLastError(0);
+			try {
+				rcPaObj.setAutoLogin(false);
+				reconnectArgs = rcPaObj.validateArgs(reconnectArgs);
+				sessObj.setQryStartTime();
+
+				sessObj.setSessionUser(rcPaObj.userName);
+				sessObj.setSessionPass(rcPaObj.password);
+				sessObj.setSessionSever(rcPaObj.serverName);
+				sessObj.setSessionPort(rcPaObj.portNumber);
+				//sessObj.setSessionDsn(rcPaObj.dsnName);
+				// Session role will be null only in noconnect mode
+				if (sessObj.getSessionRole() == null)
+					sessObj.setSessionRole(rcPaObj.roleName);
+
+				rcSIObj = new SessionInterface(sessObj);
+
+				if (sessObj.isDebugOn())
+					System.out.println("RECONNECT: " + rcPaObj.userName + "|"
+							+ rcPaObj.roleName + "|" + rcPaObj.serverName + "|"
+							+ rcPaObj.dsnName + "|" + rcPaObj.portNumber);
+
+				sessObj.setConnObj(rcSIObj.getConnection());
+				sessObj.setSessionValues();
+				if (!sessObj.isDBConnExists())
+					startTimerTask(sessObj.getConnObj());
+				sessObj.setStmtObj(rcSIObj.getStatement(sessObj.getConnObj()));
+				sessObj.qsOpen = false;
+				sessObj.setDBConnExists(true);
+                                boolean trafver = sessObj.getPlatformObjectVersions();
+				writer.writeln();
+				writer.writeln("Connected to " + sessObj.getDatabaseEdition());
+				rcPaObj.retryCnt = 0;
+
+				sessObj.setQryEndTime();
+
+			} catch (Exception ex) {
+				rcPaObj.retryCnt--;
+				reconnectArgs = handleConnException(ex, rcPaObj, reconnectArgs);
+			}
+
+		} // end while
+		if (printConnTime) {
+			printElapsedTime();
+			writer.writeEndTags(sessObj);
+		}
+
+	}
+
+	private String[] handleConnException(Exception e, ParseArguments pa,
+			String[] args) throws IOException, UserInterruption {
+		sessObj.getQuery().setStatusCode(-1); // update the error code to -1
+		sessObj.setLastError(-1);
+		if (e instanceof InvalidNumberOfArguments) {
+			writer.writeln(e.toString());
+		} else if (e instanceof IOException) {
+			if (!(e instanceof UnknownHostException))
+				writer.writeln(e.toString());
+
+		} else if (e instanceof InstantiationException) {
+			writer.writeln(e.toString());
+		} else if (e instanceof IllegalAccessException) {
+			writer.writeln(e.toString());
+		} else if (e instanceof ClassNotFoundException) {
+			writer.writeln(e.toString());
+		} else if (e instanceof UserInterruption) {
+			throw ((UserInterruption) e);
+		} else if (e instanceof SQLException) {
+			writer.writeln();
+			sessObj.setLastError(((SQLException) e).getErrorCode());
+			// catch the known errors report them with an user friendly text
+			if (((SQLException) e).getErrorCode() == SessionDefaults.SQL_ERR_CONN_MAX_LIMIT) {
+				System.out.println(SessionError.CONN_MAX_LIMIT_ERR);
+				if (doTrace)
+					e.printStackTrace();
+				System.exit(SessionDefaults.abruptExit);
+			} else {
+				String errStr = e.toString();
+
+				if (errStr.indexOf("org.trafodion.jdbc.t4") != -1)
+					errStr = errStr.substring(errStr.indexOf(":") + 1);
+
+				writer.write(errStr + SessionDefaults.lineSeperator);
+				// identify those args that caused the exception
+
+				if ((((SQLException) e).getErrorCode() == SessionDefaults.SQL_ERR_INVALID_AUTH)
+						|| (((SQLException) e).getErrorCode() == SessionDefaults.SQL_ERR_CLI_AUTH)) {
+					pa.userName = null;
+					pa.password = null;
+					pa.roleName = null;
+
+				} else
+					pa.serverName = null;
+
+				// rebuild args list and remove only those that caused the
+				// exception
+				args = pa.rebuildArgList(args);
+
+			}
+		} // end SQLException
+
+		return args;
+	}
+
+	private void handleDisConnect() throws IOException {
+		boolean exitFlag = false;
+		String errorCodeReturn = "";
+		int exitCode = SessionDefaults.DEFAULT_EXIT_CODE;
+		String strPendingAction = null;
+
+		if (parser.hasMoreTokens()) {
+
+			Matcher exitMat = parser.exitPat.matcher(parser.getRemainderStr());
+
+			if (exitMat.find()) {
+
+				errorCodeReturn = exitMat.group(3);
+				if (errorCodeReturn == null)
+					errorCodeReturn = exitMat.group(4);
+
+				errorCodeReturn = (errorCodeReturn == null || errorCodeReturn
+						.equals("")) ? SessionDefaults.DEFAULT_EXIT_CODE + ""
+						: errorCodeReturn;
+
+				try {
+					exitCode = Integer.parseInt(errorCodeReturn.trim());
+				} catch (NumberFormatException e) {
+					return;
+				}
+
+				String strCondition = exitMat.group(5);
+
+				if (strCondition != null) {
+					String strConditional = strCondition.trim() + " THEN EXIT"
+							+ sessObj.getSessionSQLTerminator();
+					ConditionalQuery cqObj = sessObj.getCQryObj();
+
+					sessObj.getQuery().setQueryId(IF_THEN);
+					sessObj.getQuery().resetQueryText(strConditional);
+
+					try {
+						cqObj.execute();
+						strPendingAction = cqObj.getPendingAction();
+						if (strPendingAction != null
+								&& strPendingAction.equals("EXIT"
+										+ sessObj.getSessionSQLTerminator())) {
+							exitFlag = true;
+							sessObj.getQuery().setQueryId(EXIT);
+						}
+
+					} catch (ConditionalQueryException ex) {
+						if (ex.getErrorMsg() != null)
+							writer.writeInterfaceErrors(sessObj,
+									ex.getErrorMsg());
+						else
+							writer.writeConditionalSyntaxError(sessObj,
+									cqObj.getQueryString());
+
+						return;
+					} catch (UserInterruption ui) {
+						if (sessObj.isQueryInterrupted()) {
+							sessObj.setQueryInterrupted(false);
+							writer.writeln();
+							writer.writeInterfaceErrors(sessObj,
+									SessionError.OPERATION_CANCELLED);
+						}
+						return;
+					} catch (IOException e) {
+						System.out
+								.println("IO Exception occurred while processing conditional query :"
+										+ e);
+					}
+
+				} else {
+					exitFlag = true;
+				}
+			} else
+				writeSyntaxError(this.queryStr, parser.getRemainderStr());
+		} else {
+			exitFlag = true;
+		}
+
+		if (sessObj.getQuery().getQueryId() == DISCONNECT && exitFlag) {
+			if (sessObj.getConnObj() != null) {
+				try {
+					// Added if statement  2010-03-25
+					// Move the if statement from handleModeCommand to here
+					// For Mode commmand can run on non-connection status.
+					if (sessObj.getMode() == SessionDefaults.WMS_MODE) {
+						sessObj.getStmtObj().execute("WMSCLOSE");
+						sessObj.qsOpen = false;
+					}
+
+					sessObj.getConnObj().getWarnings();
+					sessObj.getConnObj().close();
+				} catch (SQLException sqle) {
+
+				}
+			}
+			sessObj.setMxosrvrVersion(null);
+			sessObj.setSutVersion(null);
+			// sessObj.setConnObj(null);
+			sessionError('E', SessionError.SESSION_DISCONNECT_ERR);
+			sessObj.setDBConnExists(false);
+			return;
+		}
+
+		if (sessObj.getQuery().getQueryId() == EXIT && exitFlag) {
+			// Need to close the connection so that MXCS can do
+			// the cleanup of resources
+			try {
+				if (conn != null)
+					conn.close();
+			} catch (SQLException sqlEx) {
+				// Ignore the exception
+			}
+			sessObj.setPatternsLoaded(false);
+			sessObj.setSessionStatus(false);
+			sessObj.setExitCode(exitCode);
+		}
+	}
+
+	private void handleHostCommand() throws IOException {
+		if (sessObj.getCaller() != PRUNI)
+			try {
+				Signal.handle(INTSignal, LHCTRLCHandler);
+			} catch (Exception e) {
+			}
+
+		if (!parser.hasMoreTokens()) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		}
+
+		TerminalProcessBridge procStdOut = null;
+		TerminalProcessBridge procStdErr = null;
+		TerminalProcessBridge procStdIn = null;
+
+		try {
+//			int idx;
+			String osName = System.getProperty("os.name");
+			StringBuffer osCommand = new StringBuffer();
+
+			if ((null != osName)
+					&& osName.trim().toUpperCase().startsWith("WINDOW")) {
+				osCommand.append("cmd /c");
+
+				if (osName.trim().toUpperCase().equals("WINDOWS 95")) {
+					osCommand.setLength(0);
+					osCommand.append("command /c");
+				}
+			}
+			osCommand.append(parser.getRemainderStr());
+			if (osCommand.lastIndexOf(" cd ") >= 0)
+				System.out.println("cd is not supported by localhost command");
+			else {
+				if (TerminalProcessBridge._debugOn)
+					System.out.println("** Debug*** ==>  running command : "
+							+ osCommand.toString());
+				Process osProcess;
+				if ((null != osName)
+						&& osName.trim().toUpperCase().startsWith("WINDOW"))
+					osProcess = Runtime.getRuntime().exec(osCommand.toString());
+				else
+					osProcess = Runtime.getRuntime().exec(
+							new String[] { "sh", "-c", osCommand.toString() });
+
+				procStdOut = new TerminalProcessBridge(
+						osProcess.getInputStream(), writer);
+				procStdOut.setTag("STDOUT");
+				procStdErr = new TerminalProcessBridge(
+						osProcess.getErrorStream(), System.err);
+				procStdErr.setTag("STDERR");
+				procStdIn = new TerminalProcessBridge(System.in,
+						osProcess.getOutputStream(), false);
+				procStdIn.setTag("STDIN");
+
+				// Start the threads.
+				procStdOut.start();
+				procStdErr.start();
+				procStdIn.start();
+
+				// check for errors.
+				int exitVal = osProcess.waitFor();
+				if (TerminalProcessBridge._debugOn)
+					System.out
+							.println("** Debug*** ==>  ExitValue: " + exitVal);
+			}
+		} catch (Throwable t) {
+			String msg = t.getMessage();
+			writer.writeln(msg.substring(msg.indexOf(":") + 1));
+
+		} finally {
+			if (null != procStdIn)
+				procStdIn.stopReading();
+
+			try {
+//				Thread.currentThread().yield();
+				Thread.yield();
+			} catch (Exception e) {
+			}
+		}
+		sessObj.setQryEndTime();
+		printElapsedTime();
+		writer.writeEndTags(sessObj);
+	}
+
+	private void handleRepeatCommand(String cmdStr, int cmdNo)
+			throws IOException, SQLException, UserInterruption,
+			UnKnownInterfaceCommand {
+		// If no commands present in history return
+		List<Vector<String>> historyList = sessObj.getQryHistory();
+
+		if (sessObj.getQryHistory() == null) {
+			sessionError('E', SessionError.REPEAT_ERR);
+			sessObj.setQuery(null);
+			return;
+		}
+		int historySize = sessObj.getQryHistory().size();
+		// If no tokens present, return the previous command
+		if (!parser.hasMoreTokens()) {
+			cmdNo = historySize;
+		}
+
+		// FC could be followed by text or a command number
+		// first check for the number - this could be a negative
+		// integer too.
+		else {
+			try {
+				cmdStr = parser.getNextNumberToken();
+
+				if ((cmdStr != null) && !(cmdStr.equals(""))) {
+					if (parser.hasMoreTokens()) {
+						// throw a syntax error
+						writeSyntaxError(this.queryStr,
+								parser.getRemainderStr());
+						return;
+					}
+					cmdNo = Integer.parseInt(cmdStr);
+					if (cmdNo <= 0)
+						cmdNo = historySize + cmdNo;
+
+					if ((cmdNo >= 1) && (cmdNo <= historySize)) {
+						// sessObj.getQuery().resetQueryText(sessObj.getQryHistory().get(cmdNo-1).toString());
+					} else {
+						sessionError('E', SessionError.REPEAT_ERR);
+						sessObj.setQuery(null);
+						return;
+					}
+				} else // text is passed
+				{
+					cmdStr = parser.getNextKeyToken().toUpperCase();
+					if (cmdStr != null) {
+						// search the history buffer for a matching
+						// command
+						historyList = sessObj.getQryHistory();
+						if (historyList != null) {
+							int i;
+							for (i = historyList.size() - 1; i >= 0; i--) {
+								if ((historyList.get(i))
+										.get(1)
+										.toUpperCase()
+										.replaceAll("\\s+", " ")
+										.trim()
+										.startsWith(
+												(cmdStr + parser
+														.getRemainderStr()
+														.toUpperCase())
+														.replaceAll("\\s+", " "))) {
+									cmdNo = i + 1;
+									break;
+								}
+							}
+							if (i < 0) {
+								sessionError('E', SessionError.REPEAT_ERR);
+								sessObj.setQuery(null);
+								return;
+							}
+
+						}
+					}
+				}
+			} catch (NumberFormatException nfe) {
+				sessionError('E', SessionError.REPEAT_ERR);
+				sessObj.setQuery(null);
+				return;
+			}
+		}
+
+		String queryText = (historyList.get(cmdNo - 1)).get(1);
+		String termEvent = (historyList.get(cmdNo - 1)).get(2);
+		String sqlTerminator = sessObj.getTermEventMap().get(termEvent);
+
+		// if query ends with sqlterminator then trim and append new
+		// term else retain the same
+
+		if (queryText.toUpperCase().endsWith(sqlTerminator)) {
+			queryText = queryText.substring(0, queryText.length()
+					- sqlTerminator.length());
+			queryText = queryText + sessObj.getSessionSQLTerminator();
+		}
+		sessObj.getQuery().resetQueryText(queryText);
+		if (sessObj.getQuery().getQueryId() == FC) {
+			FCQuery fcQryObj = new FCQuery(sessObj, sessObj.getQuery());
+			boolean execute = fcQryObj.editCommand();
+			// If user has aborted the fc session do not
+			// execute the command, return to the prompt
+			if (!execute) {
+				sessObj.setQuery(null);
+				return;
+			}
+		}
+		try {
+			if (sessObj.getQuery().getQueryId() == REPEAT) {
+				writer.writeln(sessObj.getQuery().getQueryText());
+			}
+
+			sessObj.getVQryObj().validate(sessObj.getQuery(),
+					sessObj.getSessionSQLTerminator());
+
+			if (sessObj.getQuery().getQueryType() == SessionDefaults.IQ) {
+				this.execute();
+				return;
+			} else {
+				throw uic;
+			}
+		} catch (NullKeyWordException nke) {
+			// if blank lines entered ..its fine..move on
+			return;
+		}
+	}
+
+	private void handleClearCommand() throws IOException {
+		if (parser.hasMoreTokens()) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		}
+
+		String clsCmdString = "clear";
+
+		// if it is windows envrionment use the dll to clear the screen
+		if (System.getProperty("os.name").toUpperCase().startsWith("WINDOW")) {
+			try {
+				WCIUtils wcs = new WCIUtils();
+				wcs.cls();
+				wcs = null;
+				return;
+			} catch (Throwable t) {
+				if (sessObj.isDebugOn())
+					System.out.println(this.getClass().getName()
+							+ ": Clear command failed. Details = "
+							+ t.getMessage());
+			}
+			clsCmdString = "cmd /c cls";
+		}
+		/**
+		 * Only if wcs.cls failed, do we get down here and try to run a
+		 * localhost command (clear).
+		 */
+		try {
+			HostQuery hq = new HostQuery();
+			hq.startInputThread = false;
+			hq.execute(clsCmdString, sessObj.getReader(), sessObj.getWriter());
+			hq = null;
+
+		} catch (Exception e) {
+		}
+	}
+
+	private void handleRunCommand() throws IOException, SQLException,
+			UnKnownInterfaceCommand, UserInterruption {
+		String sqlTerminator = null;
+		if (parser.hasMoreTokens()) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			return;
+		}
+		if (sessObj.getPrevSQLQuery() == null) {
+			sessionError('E', SessionError.SLASH_ERR);
+			return;
+		}
+		if (!sessObj.isDBConnExists()) // Added  2010-03-19
+		{
+			displayNoConnInfo();
+			return;
+		}
+		if (isCreateTriggerCmd(sessObj.getPrevSQLQuery()))
+			sqlTerminator = "/";
+		else
+			sqlTerminator = sessObj.getSessionSQLTerminator();
+
+		sessObj.getQuery().resetQueryText(
+				sessObj.getPrevSQLQuery() + sqlTerminator);
+
+		try {
+			sessObj.getVQryObj().validate(sessObj.getQuery(),
+					sessObj.getSessionSQLTerminator());
+			if (sessObj.getQuery().getQueryType() == SessionDefaults.IQ) {
+				this.execute();
+				return;
+			} else {
+				throw uic;
+			}
+		} catch (NullKeyWordException nke) {
+			// if blank lines entered ..its fine..move on
+			return;
+		}
+	}
+
+	private void handleHelp() throws IOException {
+		String command = "";
+		String tmpStr = null;
+		Helper helpObj = new Helper();
+		String section = null;
+		while ((tmpStr = parser.getNextKeyToken()) != null) {
+			command += tmpStr + " ";
+		}
+
+		if (parser.hasMoreTokens()) {
+			writeSyntaxError(this.queryStr, parser.getRemainderStr());
+			helpObj = null;
+			return;
+		}
+		helpObj.printHelpText(sessObj.getWr

<TRUNCATED>


[13/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/SessionInterface.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/SessionInterface.java b/core/conn/trafci/src/main/java/org/trafodion/ci/SessionInterface.java
new file mode 100644
index 0000000..49db0b0
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/SessionInterface.java
@@ -0,0 +1,1487 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Properties;
+import java.util.Timer;
+import java.util.List;
+
+import sun.misc.Signal;
+import sun.misc.SignalHandler;
+
+import org.trafodion.jdbc.t4.TrafT4Connection;
+
+
+/**
+ * Session Interface is a router interface and acts like a dispatcher for query execution.
+ *
+ * To request for a new session, call the method createSession with the required database credentials. Once the session is 
+ * created, its returned to the caller.
+ * Caller will then need to call invokeSession method with the sessionObject.
+ * 
+ */
+
+public class SessionInterface implements SessionDefaults
+{
+   private static String defaultDataSource=DEFAULT_DATA_SOURCE;
+   private ConsoleReader crObj=null;
+   private ConsoleWriter cwObj=null;
+   private FileReader scriptReader=null;
+   private FileWriter logWriter=null;
+   private String scriptFile=null;                    // script file used when in prun mode or -script option is specified thru command line
+   private String logFileName=null;                   // log file used for prun script file process logging
+   private boolean overWriteLog=false;                // log file overwrite mode
+   private Properties lfProps=null;                   // look & feel properties.
+   private Session sessObj=null;
+   //private int sessionInput=-1;                     // 0 - thru console 1- thru file
+   private int caller=-1;                             // caller id. -1 nobody 0- USERI 1- PRUNI
+   private int sqlErrorCount=0;                       // sql error count..Number of sql errors reported in a session. If a query more than one, then its counted as 1.Needed for prun summary
+   private int sqlQueryCount=0;                       // sql query count. Number of sqls executed in a session. Needed for prun summary
+   private int sqlWarningsCount=0;
+   private boolean queryMode=false;                   // set the session in query mode. As soon as the query is executed..the control is returned back to the caller
+   private boolean tmpQueryMode=false;                // temporary flag to identify if the current session is in query mode
+   private String qryString=null;                     // caller updates this query string when in query mode
+   private Utils utilObj;
+   private Parser parser=null;
+   Thread threadName=null;
+   SignalHandler CTRLCHandler=null;
+   Signal INTSignal=null;
+   boolean nestedObey=false;
+   boolean specialModeEnabled = false;
+   LFProperties lfPropsObj = new LFProperties();
+
+   Query qryObj= null;
+   private static SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SSS a");
+   private boolean showTimeInMillis = false;
+   //never used
+//   private boolean doTrace = Boolean.getBoolean("trafci.enableTrace");
+   private String remoteProcess=null;
+   
+   SessionInterface()
+   {
+
+   }
+
+
+   //Initializes the session interface with a console reader & writer objects
+   SessionInterface(ConsoleReader crObj,
+      ConsoleWriter cwObj)
+   {
+      this.crObj=crObj;
+      this.cwObj=cwObj;
+      CTRLCHandler =new SignalHandler ()
+      {
+         public void handle(Signal sig)
+         {
+            sessObj.setQueryInterrupted(true);
+         }
+      };
+      try {
+      INTSignal=new Signal("INT");
+      } catch (Exception e) {}
+   }
+
+   SessionInterface(Session sessObj)
+   {
+      this.sessObj=sessObj;
+      this.caller=sessObj.getCaller();
+   }
+
+
+   //get a statement handle for the current session
+   public Statement getStatement(Connection conn) throws SQLException
+   {
+      return conn.createStatement();
+   }
+
+   public Session createSession(String userName,
+	  String roleName,
+	  String password,
+      String serverName,
+      String portNumber,
+      String dsnName,
+      int caller,
+      boolean noConnectOption) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, FileNotFoundException, IOException
+   {
+
+      Session session=new Session(   userName,
+         password,
+         roleName,
+         serverName,
+         portNumber,
+         dsnName,
+         crObj,
+         cwObj);
+      
+      return createSession(session,
+         caller,
+         noConnectOption);
+   }
+
+   // create a new session and return it to the caller
+   // Any exceptions arise during this process should be returned to the caller,
+   // caller will decide where to report them (to the console or to the log file)
+   // Each session object is created with one connection, validateQueryObject,
+   // Interface query object, dbQuery objects for the entire session to use them 
+
+   public Session createSession(Session session,
+      int caller,
+      boolean noConnectOption) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, FileNotFoundException, IOException   {
+      utilObj = new Utils();
+      
+      parser = new Parser();
+
+      sessObj=session;
+
+      // if the user opts to connect to the UI without creating database connection then create db connection and stmt obj
+      if (!noConnectOption)
+      {
+         sessObj.setConnObj(getConnection());
+         sessObj.setStmtObj(getStatement(sessObj.getConnObj()));
+         sessObj.setSessionValues();
+         this.getDriverVersion();     
+      }
+            
+      sessObj.setCaller(caller);
+      sessObj.setVQryObj(new ValidateQuery(sessObj));
+      sessObj.setIQryObj(new InterfaceQuery(sessObj));
+      sessObj.setCQryObj(new ConditionalQuery(sessObj));
+      sessObj.setDbQryObj(new DatabaseQuery(sessObj));
+      sessObj.setHtmlObj(new HTMLObject(sessObj));
+      sessObj.setXmlObj(new XMLObject(sessObj));
+     
+
+      lfPropsObj.loadLookAndFeelProps(sessObj, specialModeEnabled);
+      sessObj.setLFProps(lfPropsObj);
+
+      // start the timer thread to monitor the session idletime.
+      // this is need only when the session is not in prun mode. PRUN can enjoy!!!
+      // this thread starts immediately after the first minute and runs every one minute then on
+      if ((caller != PRUNI) && (!noConnectOption))
+      {
+         sessObj.setTimeoutTask(new SessionTimeoutTask(sessObj.getConnObj()));
+         sessObj.getTimeoutTask().idleTime=sessObj.getSessionIdletime();
+         sessObj.getTimeoutTask().lastQueryExecTime=System.currentTimeMillis();
+         Timer timer = new Timer();
+         timer.schedule(sessObj.getTimeoutTask(), 1 * 60 * 1000, 1 * 60*1000);
+
+      }
+
+      String showTimeStr = System.getProperty("trafci.showTimeInMS");
+      if ((showTimeStr != null) && showTimeStr.trim().equalsIgnoreCase("true"))  
+         showTimeInMillis = true;
+
+      // return the session object to the caller.
+      return sessObj;
+   }
+
+   public Session createSession(String userName,
+	  String roleName,
+	  String password,
+      String serverName,
+      String portNumber,
+      String dsnName,
+      int caller
+      ) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, FileNotFoundException, IOException
+   {
+      return createSession(userName,
+    	 roleName,
+    	 password,
+         serverName,
+         portNumber,
+         dsnName,
+         caller,
+         false);
+   }
+
+   // start the session with the session object passed
+   // in prun mode, this method is called for each script file as prun has to some intermediate calculations between the file processing
+   // in useri mode, if the user has logged in non -q mode, called once
+   // in useri mode or any other modes which require just one query execution at a time, called as many as times depends on the number of queries
+   // returns exit status code
+   public int invokeSession(Session sessObj) throws IOException
+   {
+      this.sessObj=sessObj;
+      ValidateQuery vQryObj=sessObj.getVQryObj();
+      InterfaceQuery iQryObj=sessObj.getIQryObj();
+      ConditionalQuery cQryObj=sessObj.getCQryObj();
+      DatabaseQuery dbQryObj=sessObj.getDbQryObj();
+      this.caller=sessObj.getCaller();
+      Reader reader = new Reader();
+      Writer writer = new Writer(sessObj);
+      tmpQueryMode=false;
+      
+      // if the caller is interactive user interface
+      // set the reader and writer for the console
+      // the read and write modes are set to console modes assuming that there are no script files or obey files 
+      if (caller == USERI)
+      {
+         reader.setConsoleReader(this.crObj);
+         writer.setConsoleWriter(this.cwObj);
+         reader.setReadMode(CONSOLE_READ_MODE);
+         writer.setWriterMode(CONSOLE_WRITE_MODE);
+      }
+
+      // if the user has passed a script file to run it while launching the session
+      // so read the script file first and later can move to console mode
+      // set the read mode to script file read mode.
+      // for prun its always script file reading
+      // return an exception to the caller if the specified script file is not found or if some error occurred
+      
+      if (scriptFile != null)
+      {
+
+         try
+         {
+            scriptReader=new FileReader();
+            scriptReader.initialize(scriptFile);
+            reader.setReadMode(SCRIPT_READ_MODE);
+            reader.setScriptReader(scriptReader);
+         }catch (FileNotFoundException fnfe)
+         {
+            throw fnfe;
+         }catch (IOException ioe)
+         {
+            throw ioe;
+         }
+
+      }
+    
+    	  
+      // if the log file is specified. log all the results ( errors/warnings and output) to the logfile instead of 
+      // console
+      // write the header for the log file here..with all blaahhaa.blaah..start time
+      // return to the caller if the log file is not found or io exception occurred
+      if (logFileName != null)
+      {
+         try
+         {
+            logWriter=new FileWriter();
+            if (!this.overWriteLog)
+               logWriter.setAppend(true);
+            logWriter.initialize(logFileName);
+            logWriter.write((this.formatString(SessionDefaults.lineSeperator+"=",82,'=')));
+            logWriter.writeln();
+            if (!showTimeInMillis)
+            logWriter.write("Logging started at "+DateFormat.getDateTimeInstance().format(new Date())); //Feb 13, 2007 11:32:31 AM 
+            else
+               logWriter.write("Logging started at "+  sdf.format(new Date(System.currentTimeMillis())) ); //Feb 13, 2007 11:32:31.999 AM
+            logWriter.writeln();
+            logWriter.write((this.formatString("=",80,'=')));
+            logWriter.writeln();
+            writer.setLogWriter(logWriter);
+            writer.setWriterMode(LOG_WRITE_MODE);
+
+         }catch (FileNotFoundException fnfe)
+         {
+            throw fnfe;
+         }catch (IOException e)
+         {
+            throw e;
+         }
+
+      }
+
+      // at this point, we know from where to read and where to write. set them in the session so that all other
+      // objects will know
+      sessObj.setReader(reader);
+      sessObj.setWriter(writer);
+
+      // to handle sqlprompts when EOF is reached
+      boolean OS_EOF=false;  // obey file & script file EOF indicator
+      boolean OBEY_DEPTH_ERROR=false; // for use with OS_EOF, display prompt again after error
+      
+      threadName=Thread.currentThread();
+
+      try {
+         if (CTRLCHandler != null)
+         {
+            Signal.handle(INTSignal, CTRLCHandler);
+         }
+      }catch (Exception e) {}
+
+      boolean userPressedCtrlC = false;
+      boolean curQryConditionalAction = false;
+      String lastObeyFilename = "";
+
+      // loop thru till when the session is active
+      if (caller != PRUNI)
+         sessObj.setInteractiveRead(reader.getConsoleReader().isInteractive());
+    
+   
+      while (sessObj.isSessionActive())
+      {
+         sessObj.setQueryInterrupted(false);
+         curQryConditionalAction = false;
+
+        //store the previous query for history command
+
+         if (caller == USERI && sessObj.getQuery() != null && !sessObj.getQuery().getQueryText().trim().equals(""))
+         {
+            // If the history option is set to ALL add all commands  
+            // (except OBEY command) in the script file to the history buffer
+            // If the history option is set to default, do not add the 
+            // commands in script file to history. history should contain
+            // only the obey command.
+            if ((sessObj.getReader().getReadMode() != OBEY_READ_MODE || !sessObj.getReader().isReallyObeyfile()) ||
+               ( !sessObj.isSessionHistoryAll() && sessObj.getQuery().getQueryId() == SessionDefaults.OBEY && !nestedObey) ||
+               ( sessObj.isSessionHistoryAll() && sessObj.getQuery().getQueryId() != SessionDefaults.OBEY))
+            {
+                  sessObj.addQryToHistory(sessObj.getQuery().getQueryText());
+            	
+               nestedObey = sessObj.getReader().getReadMode() == OBEY_READ_MODE ? true : false;
+            }
+         }
+
+         // store the previous query's status code for conditional exit
+         if (sessObj.getQuery() != null && sessObj.getQuery().getQueryText() != null && !sessObj.getQuery().getQueryText().trim().equals(""))
+         {
+            sessObj.setPrevQryStatusCode(sessObj.getQuery().getStatusCode());
+         }
+         // write a new line before each prompt..
+         if (!OS_EOF && !cQryObj.isPendingAction())
+         {   
+            if ( (!userPressedCtrlC) &&  (caller != PRUNI) && sessObj.isLogCmdEcho() &&
+            	 !sessObj.isSessionStartup() &&
+                 (writer.getConsoleWriter().getConsoleOut()) &&
+                 !((sessObj.getSessView() == SessionDefaults.MXCI_VIEW))
+                 /* Commenting the following lines of code temporarily. 
+                  * When markup is set to csv, there are no new lines 
+                  * displayed before the sql prompt. Although commenting
+                  * these lines fixes this problem, it does not fix the extra
+                  * new lines for insert/update/delete commands in the log files
+                  * for CSV markup. Since the first issue was more visible, for 
+                  * now commenting this fix till we find a permanent solution
+                  * to both these problems.
+                  */
+                 /*&&
+                 !(sessObj.getDisplayFormat() == SessionDefaults.CSV_FORMAT && 
+                   (sessObj.getQuery()!= null) &&
+                     (sessObj.getQuery().getQueryText().trim().matches("^(?i)(INSERT|UPDATE|DELETE)(.*)")))
+                 */    
+                  ) 
+                  writer.writeln();
+         }
+         
+         // write the current time in the session object so that timer bud knows when to kill 
+         sessObj.setLastQryExecTime(System.currentTimeMillis());
+
+         // tmp query mode is initially set to false and when in query mode changed to true after the first query
+         // to break the current loop
+         if (tmpQueryMode && sessObj.isSessionInteractive())
+         {
+            break;
+         }
+         reader=sessObj.getReader();
+         writer=sessObj.getWriter();
+         //tmpQueryMode=this.queryMode;
+         try
+         {
+
+             curQryConditionalAction = cQryObj.isPendingAction();
+             if (!this.queryMode && !curQryConditionalAction)
+             {
+               if (!OS_EOF)
+               {
+            	   if(!sessObj.isSessionStartup()) {
+	                  if  (!userPressedCtrlC && sessObj.isLogCmdText() && sessObj.isLogCmdEcho() )
+	                  {
+	                     writer.write(sessObj.getSessionPrompt());
+	                  }
+	                  
+	                  // Need to show the prompt on Console for LOG command with QuietEnabled
+	                  if ((sessObj.isQuietEnabled()) && sessObj.isLogCmdEcho() ) 
+	                      writer.getConsoleWriter().print(SessionDefaults.lineSeperator+sessObj.getSessionPrompt());
+	                  else if(!sessObj.isLogCmdText() && sessObj.isLogCmdEcho())
+	                      writer.getConsoleWriter().print(sessObj.getSessionPrompt());
+            	  }
+               }
+               else
+               {
+                  OS_EOF=false;
+               }
+            }
+            userPressedCtrlC = false;
+            qryObj=null;
+            sessObj.setQuery(null);
+
+            // for each query create a new query object
+            qryObj=new Query();
+
+            String qryLine=cQryObj.getPendingAction();          // if conditional action passed, pendingAction exists
+
+            // only if not in query mode read from the console or script file
+            if (queryMode && sessObj.isSessionInteractive())
+            {
+               qryLine=this.qryString;
+               if (!qryLine.endsWith(sessObj.getSessionSQLTerminator()))
+               {
+                  qryLine+=sessObj.getSessionSQLTerminator();
+               }
+               tmpQueryMode=queryMode;
+
+            }
+            else
+            {
+               sessObj.setQueryInterrupted(false);      // to avoid the timing issues
+               boolean flag = true;
+               
+               
+               /* conditional stmts can set this to values other then null */
+               if(qryLine == null)
+               {
+                   while (flag)
+                   {
+                      try
+                      { 
+                         qryLine = reader.getNonBlankLine();
+                         if (sessObj.isCmdEchoEnabled() &&
+                        	(qryLine != null) && !qryLine.trim().equals(""))
+                             writer.getConsoleWriter().println(qryLine);
+                         flag = false;
+                      }
+                      catch (UserInterruption ui)
+                      {
+                        qryLine = "";
+                      }
+                      catch(IOException ex){  // thrown by Reader if the obey command loops
+                          writer.writeInterfaceErrors(sessObj, ex.getMessage());
+                          qryLine = null;
+                          flag = false;
+                          OBEY_DEPTH_ERROR = true;
+                      }
+                   }
+               }
+               if ((null != reader) && (null != reader.getConsoleReader()))
+                  reader.getConsoleReader().setQueryInterrupted(false);
+
+            }
+
+            // check if the db connection exists when processing the script or obey files
+            // if the connection doesnt exists, skip the remaining lines from the files
+            /*
+            if (!sessObj.isDBConnExists() && reader.getReadMode() != SessionDefaults.CONSOLE_READ_MODE)
+            {
+               qryLine=null;
+            }
+            */
+            // if the query is not null..write the query to log file if the current session is
+            // writing to the log file. or to the spool file if spooling is enabled
+            // if the query is read from an obey file. write the query to the console
+
+
+            if (qryLine != null) {
+               qryObj.setQueryText(parser.ignoreComments(qryLine));
+               
+               // do not write out a conditional action since it was already written during the IF...THEN statement
+               if(!curQryConditionalAction) {
+            	   /**
+            	    * Bug 2325- Password is saved in log
+            	    * Fix Description- if queryStr starts with Connect then log pwd to stars
+            	    */
+            	   if (qryLine.toUpperCase().startsWith("CONNECT")) {
+            		   
+            		   int slashIndex = qryLine.lastIndexOf("/");
+                		 if (slashIndex > -1) {
+                			 // connect user/pwd, mode
+                			 int lastCommaIndex = qryLine.lastIndexOf(",");
+                			 StringBuilder qryBuilder = new StringBuilder(qryLine);
+                			 if (lastCommaIndex > -1)
+                				 qryBuilder.replace(slashIndex+1, lastCommaIndex, "*****");
+                			 else
+                				 qryBuilder.replace(slashIndex+1, qryLine.length(), "*****");
+                			 
+                			 qryLine = qryBuilder.toString();
+                		 }
+                	 }
+            	   if ((writer.getWriterMode() == SessionDefaults.LOG_WRITE_MODE) && (!sessObj.isSessionStartup()) && sessObj.isLogCmdEcho())
+                      writer.getLogWriter().writeln(qryLine);
+                   else if (reader.getReadMode() == CONSOLE_READ_MODE && writer.getWriterMode() == SessionDefaults.CONSOLE_SPOOL_WRITE_MODE)
+                   {
+                      if (sessObj.isLogCmdText())
+                         writer.getSpoolWriter().writeln(qryLine);
+                   }else if (reader.getReadMode() == OBEY_READ_MODE || ( caller !=PRUNI && reader.getReadMode() == SCRIPT_READ_MODE ))
+                   {
+                       boolean showPromptAgain = false;
+
+                       if(reader.getReadMode() == OBEY_READ_MODE && reader.obeyMultipleFiles() && reader.getObeyReader()!=null && !sessObj.isDotModeCmd())
+                       {
+                           // test if we are reading a different obey file
+                           if(!lastObeyFilename.equals(reader.getObeyReader().getFileName()))
+                           {
+                               lastObeyFilename = reader.getObeyReader().getFileName();
+                               
+                               if(sessObj.isLogCmdText() && writer.getWriterMode() == CONSOLE_SPOOL_WRITE_MODE)
+                               {
+                                   writer.getSpoolWriter().writeln();
+                                   writer.getSpoolWriter().writeln(this.formatString("=",80,'='));
+                                   writer.getSpoolWriter().writeln("Script : " + lastObeyFilename);
+                                   writer.getSpoolWriter().writeln(this.formatString("=",80,'='));
+                                   showPromptAgain = true;
+                               }
+                           }
+                       }    
+                         
+                       if(sessObj.isLogCmdText() && writer.getWriterMode() == CONSOLE_SPOOL_WRITE_MODE && sessObj.isLogCmdEcho())
+                           writer.getSpoolWriter().writeln(((showPromptAgain == true) ? sessObj.getSessionPrompt() : "") + qryLine);
+                       
+                       if (sessObj.isLogCmdEcho())
+                    	   writer.getConsoleWriter().println(qryLine);
+                   }
+               }
+            }
+            else
+            {
+               // if the query line is null, then we have reached the end of line
+               // if the current mode is non-interactive mode(reading from  an obey file - Note- reading from script
+               // is treated as interactive)..close the obey file 
+               // and move to the previous mode
+                
+               OS_EOF=true;
+                             
+               if (!sessObj.isSessionInteractive())  // reading from an obey file
+               {
+                   
+                  // cleanup open files, close files listed in the obey hash map
+                  try
+                  {
+                     reader.getObeyReader().close();
+                     List<FileReader> obeyReaders = reader.getObeyReaderList();
+                     if(obeyReaders != null){
+                         for(int i=0;i<obeyReaders.size();i++)
+                             (obeyReaders.get(i)).close();
+                     }
+                  }catch (IOException ioe)
+                  {
+                    System.out.println(ioe);
+                  }finally
+                  {
+                     reader.setObeyReader(null);
+                     if(OBEY_DEPTH_ERROR)
+                     {
+                         OBEY_DEPTH_ERROR = false;
+                         OS_EOF = false;
+                     }
+                  }
+                  sessObj.setSessionType(true); // change it back to the interactive mode
+                  reader.setReadMode(reader.getPrevReadMode());
+                  nestedObey = sessObj.getReader().getReadMode() == OBEY_READ_MODE ? true : false;
+                  continue;
+               }
+
+               // if the session is interactive mode and the caller is PRUN, then we need to inform ParallelRun Thread to send us the next file
+               // close the current script file and log file and return to the prun
+               if (caller == PRUNI || caller == SessionDefaults.PYTHI)
+               {
+                  try
+                  {
+                     scriptReader.close();
+                  }catch (IOException ioe)
+                  {
+                     System.out.println(ioe);
+                  }finally
+                  {
+                     reader.setScriptReader((scriptReader =null));
+                  }
+
+                  if (writer.getLogWriter() != null)
+                  {
+                     try
+                     {
+                        writer.getLogWriter().write((this.formatString(SessionDefaults.lineSeperator+SessionDefaults.lineSeperator+"=",84,'=')));
+                        writer.getLogWriter().writeln();
+                        if (!showTimeInMillis)
+                        writer.getLogWriter().write("Logging ended at "+DateFormat.getDateTimeInstance().format(new Date())); //Feb 13, 2007 11:32:31 AM 
+                        else
+                           writer.getLogWriter().write("Logging ended at "+  sdf.format(new Date(System.currentTimeMillis())) ); //Feb 13, 2007 11:32:31.999 AM
+                        writer.getLogWriter().writeln();
+                        writer.getLogWriter().write((this.formatString("=",80,'=')));
+                        writer.getLogWriter().writeln();
+
+                        writer.getLogWriter().close();
+                     }catch (IOException ioe)
+                     {
+                     }finally
+                     {
+                        writer.setLogWriter((logWriter =null));
+                     }
+                  }
+                  return sessObj.getExitCode();
+               }
+
+               // for USERI, if the current mode is script read mode then move to the interactive 
+               if (caller == USERI)
+               {
+                  if (reader.getReadMode() == SCRIPT_READ_MODE)
+                  {
+                     try
+                     {
+                        scriptReader.close();
+                     }catch (IOException ioe)
+                     {
+                        System.out.println(ioe);
+                     }finally
+                     {
+                        reader.setScriptReader((scriptReader =null));
+                     }
+                     reader.setReadMode(CONSOLE_READ_MODE);
+                     continue;
+                  }
+                  else
+                  {
+                     if (reader.getReadMode() == SessionDefaults.CONSOLE_READ_MODE)
+                         return sessObj.getExitCode();
+                  }
+
+               }
+            }
+
+            // Now lets validate the query and route it to the correct object for execution
+            // identify the type of query 
+            try
+            {
+               vQryObj.validate(qryObj,sessObj.getSessionSQLTerminator());
+            } catch (NullKeyWordException nke)
+            {
+               // if blank lines entered ..its fine..move on
+               continue;
+            }
+
+            // at this point, we know the first key word..save the query object in the session object
+
+            sessObj.setQuery(qryObj);
+          
+            //"if" statement added  201002-26
+       	   //check whether we need add sql query count for prun.
+       	   if(caller==PRUNI && !sessObj.isSessionStartup() && !sessObj.isDotModeCmd())
+       	   {
+       		   this.sqlQueryCount++;
+       	   }
+       	 
+       	   //    check if the current session has database connection otherwise request user to connect to the db first
+
+           if (!sessObj.isDBConnExists())
+           {
+              if (qryObj.getQueryType() != IQ && qryObj.getQueryType() != CQ)
+              {
+                  if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+                  	  writer.writeln();
+                 //writer.writeln(SessionError.DB_CONN_NOT_EXIST);
+                 writer.writeInterfaceErrors(sessObj,SessionError.DB_CONN_NOT_EXIST );
+                 continue;
+              }
+              else if(qryObj.getQueryType()==IQ)
+              {
+              }
+           }
+           
+            boolean printIgnoringCmdMsg = true;            
+            
+            //if the query type is conditional query type execute using conditional query object
+            if(qryObj.getQueryType() == CQ){
+            	if (sessObj.getCQryObj().getGotoLabel().equals("") )
+                    printIgnoringCmdMsg = false;
+                try{
+                    cQryObj.execute();
+                }catch(ConditionalQueryException ex){
+                    
+                    if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+                        writer.writeln();
+                    
+                    if(ex.getErrorMsg() != null)
+                        writer.writeInterfaceErrors(sessObj,ex.getErrorMsg());
+                    else
+                        writer.writeConditionalSyntaxError(sessObj, cQryObj.getQueryString());
+                  
+                    //Added  2010-02-26
+                	if(caller == PRUNI && sessObj.getQuery().getStatusCode() == -1)
+                    {
+                  	  this.sqlErrorCount++;
+                    }
+                    continue;
+                }
+                catch(UserInterruption ui){
+                    userPressedCtrlC = true;
+                    if (sessObj.isQueryInterrupted())
+                    {
+                       sessObj.setQueryInterrupted(false);
+                       writer.writeln();
+                       writer.writeInterfaceErrors(sessObj,SessionError.OPERATION_CANCELLED);
+                    }
+                    continue;
+                }
+                catch (IOException e)
+                {
+                   System.out.println("IO Exception occurred while processing conditional query :"+e);
+                }
+
+            }
+            
+            /* Conditional Query:
+             *  if a GOTO <label> is set ignore all commands until
+             *  the <label> is hit, which unsets the "getGotoLabel()" value
+             */
+            if(!sessObj.getCQryObj().getGotoLabel().equals(""))
+            {
+                if(qryObj.getQueryType() != CQ)
+                {
+                    /* still show continuation prompts for ignored queries, 
+                     * useful for maintaining a correct command history
+                     * */
+                    try{
+                        cQryObj.execute();
+                        //For prun warning counting.
+                        int iGotoErrorCode = Integer.parseInt(SessionError.GOTO_MESSAGE.errorCode());
+	                    if (caller == PRUNI && sessObj.getLastError()==iGotoErrorCode)
+	                    {
+	                       this.sqlWarningsCount++;
+	                    }
+                    }catch(Exception ex){
+                    	if(caller == PRUNI)
+                        {
+                      	  this.sqlErrorCount++;
+                        }
+                    }
+                }
+                String currLabel = sessObj.getCQryObj().getGotoLabel();
+                if (printIgnoringCmdMsg  &&  !currLabel.equals("") )                 	
+                	{
+	                	ErrorObject msg_warning = new ErrorObject(SessionError.MESSAGE_WARNING.errorCode(), 
+	                								SessionError.MESSAGE_WARNING.errorMessage() + currLabel + "' command is encountered.",SessionError.MESSAGE_WARNING.errorType);
+	                	writer.write(SessionDefaults.lineSeperator);
+	                	writer.writeError(sessObj, msg_warning);
+	                    if (caller == PRUNI)
+	                    {
+	                       this.sqlWarningsCount++;
+	                    }
+	                    
+                	}
+                
+                continue;
+            }
+           
+            //if the query type is interface query type execute using interface query object
+            if (qryObj.getQueryType() == IQ)
+               try
+               {
+
+                  iQryObj.execute();
+                  //"if" statement added  2009-12-07
+                  //calculate error count for some exception(not throw out). 
+                  if(caller == PRUNI && sessObj.getQuery().getStatusCode() == -1)
+                  {
+                	  //Sometimes if we get no data, the statuscode will be set to -1.
+                	  //So here, we judge whether there is an error or not by last error code.
+                	  if(sessObj.getLastError()!=0) 
+                		  this.sqlErrorCount++;
+                  }
+
+                  continue;
+               } catch (UnKnownInterfaceCommand e)
+            {
+            	   //if the command is not an interface command and db connection does not exist,
+            	   //write error out and terminate the command;
+	               if (!sessObj.isDBConnExists())
+	               {
+	                  if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+	                      	  writer.writeln();
+	                 //writer.writeln(SessionError.SYNTAX_ERROR_PREFIX);
+	                 writer.writeInterfaceErrors(sessObj,SessionError.UNKOWN_OPTION );
+	                 continue;
+	                  
+	               }
+	               
+               // if the command is not an interface command set the query type to SQL/CQ command
+               // depends on the current session mode
+               if (qryObj.getQueryType() != PRUNQ)
+               {
+                  switch (sessObj.getMode())
+                  {
+                     case SQL_MODE:
+                        qryObj.setQueryType(SQLQ);
+                        break;
+                  }
+
+               }
+            }catch (UserInterruption ui)
+            {
+               userPressedCtrlC = true;
+               if (sessObj.isQueryInterrupted())
+               {
+                  userPressedCtrlC = true;
+                  sessObj.setQueryInterrupted(false);
+                  writer.writeln();
+                  // writer.writeln(SessionError.OPERATION_CANCELLED);
+                  writer.writeInterfaceErrors(sessObj,SessionError.OPERATION_CANCELLED);
+               }
+               //System.in.read();
+               continue;
+            }
+            catch (SQLException e)
+            {
+               sessObj.getQuery().setStatusCode(Math.abs(e.getErrorCode()));
+               //to handle unexpected server error message..connection does not exist occurs after socket error
+               if (e.getErrorCode()==-29154 || e.getErrorCode()==-29002)
+               {
+            	   if(sessObj.isDBConnExists())
+            		   sessObj.setSessionStatus(false);
+               }
+               if (e.getErrorCode() == -29157)
+               {
+                  sessObj.setDBConnExists(false);
+               }
+
+               if (sessObj.isQueryInterrupted() && !sessObj.isDBConnExists())
+               {
+                  writer.writeInterfaceErrors(sessObj,SessionError.DB_DISCONNECT_ON_USER_REQ);
+                  continue;
+               }
+               if (caller == PRUNI)
+               {
+                  this.sqlErrorCount++;
+               }
+               writer.writeln();
+               writer.writeAllSQLExceptions(sessObj,e);
+               continue;
+            }catch (IOException e)
+            {
+               System.out.println("IO Exception occurred while processing interface query :"+e);
+            }
+
+            //Prun not supported in CS mode
+            if (qryObj.getQueryType() == PRUNQ && sessObj.getMode() != SessionDefaults.SQL_MODE)
+            {
+               //String errorStr = "ERROR: This command is not supported in "+sessObj.getStrMode()+" mode.";
+               if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+             	  writer.writeln();
+               writer.writeInterfaceErrors(sessObj, SessionError.CMD_NOT_MODE_SUPPORTED);
+               continue;
+            }
+
+            //
+            //if the query is of type parallel run
+            //
+            if (qryObj.getQueryType() == PRUNQ && caller != PRUNI)
+            {
+               sessObj.setTimerHold();
+               ParallelRun prunObj=null;
+               try
+               {
+                  prunObj=new ParallelRun(crObj,cwObj,lfProps,sessObj);
+                  prunObj.execute();
+               } catch (PrunUserInterruption e)
+               {
+                  // if the user stop the prun session..no worries..continue
+                  continue;
+               } catch (UserInterruption ui)
+               {
+                  userPressedCtrlC = true;
+                  continue;
+               } catch (IOException ioe)
+               {
+                  // if the file processing is screwed up..
+                  System.out.println("IO Exception while processing prun: "+ioe);
+                  continue;
+
+               }
+               catch (InvalidNumberOfArguments e)
+               {
+                  // writer.writeln(e.getMessage());
+                  if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+                        writer.writeln();
+                  writer.writeInterfaceErrors(sessObj,e.getMessage());
+
+                  if(sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
+                       prunObj.printUsage();
+                  continue;
+               }
+               catch (NumberFormatException  nfe)
+               {
+                  // Number Format Exception is caught in ParalleRun.java
+                  // and rethrown. Error message is printed in ParallelRun.java.
+                  // Just continue with the next command from here.
+                  continue;
+               }
+               finally
+               {
+                  prunObj=null;
+               }
+               continue;
+            }
+
+            try
+            {
+            	boolean showStatusMsg = true;
+               
+               /*
+                * Running EXPORT WMS command from the normal prompt 
+                */
+				int queryType = -1;
+				String queryText = null;
+				if(qryObj.getQueryText() != null)
+					queryText = qryObj.getQueryText().toUpperCase().trim();
+				if ((queryText != null && sessObj.qsOpen && SessionDefaults.WMS_MODE == sessObj .getMode()) || (queryText != null && queryText .startsWith("EXPORT WMS"))) {
+					qryObj.setQueryType(NSQ);
+					queryType = NSQ;
+				} else if (queryText != null && (queryText.startsWith(SessionDefaults.WMSOPEN) || queryText .startsWith(SessionDefaults.WMSCLOSE))) {
+					qryObj.setQueryType(NSQ);
+					queryType = NSQ;
+				} 
+				else
+					queryType = qryObj.getQueryType();
+				
+               switch (queryType)
+               {
+                  case SQLQ:
+                     try
+                     {
+						 queryText = Utils.trimSQLTerminator(queryText,sessObj.getSessionSQLTerminator()).trim();
+                    	 if(SessionDefaults.CMDOPEN.equalsIgnoreCase(queryText) && 
+                    			 SessionDefaults.CS_MODE == sessObj.getMode()){
+                    		 writer.writeln();
+                    		 writer.writeError(sessObj, SessionError.CMD_ONLY_SQL_SUPPORTED);
+                    		 showStatusMsg = false;
+                    		 break;
+                    	 }
+                         else if(SessionDefaults.CMDCLOSE.equalsIgnoreCase(queryText) && 
+                        		 SessionDefaults.SQL_MODE == sessObj.getMode()){
+                        	 writer.writeln();
+                    		 writer.writeError(sessObj, SessionError.CMD_ONLY_CS_SUPPORTED);
+                    		 showStatusMsg = false;
+                    		 break;
+                         }//prevent cmdopen;; and cmdclose;; like cheat
+							else if (queryText.toUpperCase().matches(
+									SessionDefaults.CMDOPEN + ".+")
+									|| queryText.toUpperCase().matches(
+											SessionDefaults.CMDCLOSE + ".+")) {
+							writer.writeln();
+							writer.writeError(sessObj,
+										SessionError.CMD_SYNTAX_ERROR);
+							showStatusMsg = false;
+							break;
+						}
+                        dbQryObj.execute();
+                        if(SessionDefaults.CMDOPEN.equalsIgnoreCase(queryText))
+                        	sessObj.setMode(SessionDefaults.CS_MODE);
+                        else if(SessionDefaults.CMDCLOSE.equalsIgnoreCase(queryText))
+                        	sessObj.setMode(SessionDefaults.SQL_MODE);
+                        if (sessObj.isSessionStatsEnabled() &&
+                           (false == dbQryObj.userExecutedGetStatistics()) &&
+                           (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT && !dbQryObj.blockGetStats() ))
+                           showStatusMsg = false;
+                        
+                        if (caller == PRUNI)
+                        {
+                           this.sqlWarningsCount= this.sqlWarningsCount + sessObj.getSqlWarningsCnt();
+                        }
+                     }catch (UnKnownInterfaceCommand e)
+                     {
+                        continue;
+                     }
+                     break;
+                	  
+                  default:
+                     continue;
+               }
+               if ((qryObj.isTrimOut() && 
+                   Utils.trimSQLTerminator(qryObj.getQueryText(), sessObj.getSessionSQLTerminator())
+                   .matches("(?i)get\\s+all\\s+volatile\\s+schemas\\s*")) ||
+                  (!qryObj.isTrimOut()) )
+            	   sessObj.setTotalRecordCount(qryObj.getRowCount());
+					if (!showStatusMsg) {
+						String elapsedTimeMsg = writer.getElapsedTime(sessObj,
+								qryObj, utilObj);
+						writer.writeStatusMsg(sessObj, null, elapsedTimeMsg,
+								writer);
+					} else {
+						writer.writeStatusMsg(sessObj, qryObj, utilObj, writer);
+					}
+
+               sessObj.setLastError(sessObj.getQuery().getStatusCode());
+            }catch (UserInterruption ui)
+            {
+               userPressedCtrlC = true;
+               if (sessObj.isQueryInterrupted())
+               {
+                  sessObj.setQueryInterrupted(false);
+                  if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+                  	  writer.writeln();
+                  writer.writeInterfaceErrors(sessObj,SessionError.OPERATION_CANCELLED);
+               }
+
+               continue;
+            } catch (SQLException e) {
+               if (e.getErrorCode() == -29157)
+               {
+                  sessObj.setDBConnExists(false);
+               }
+
+               if (sessObj.isQueryInterrupted() && !sessObj.isDBConnExists())
+               {
+                   if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
+                   	  writer.writeln();
+                   writer.writeInterfaceErrors(sessObj,SessionError.DB_DISCONNECT_ON_USER_REQ);
+                   if (sessObj.isDotModeCmd())
+                	   sessObj.setLogCmdEcho(true);
+                  continue;
+               }
+
+               sessObj.getQuery().setStatusCode(Math.abs(e.getErrorCode()));
+               //  to handle unexpected server error message..connection does not exist occurs after socket error
+               if (e.getErrorCode()==-29154 || e.getErrorCode()==-29002)
+               {
+                  sessObj.setSessionStatus(false);
+               }
+               // if QSMGR is stopped. 
+               //  if (e.getErrorCode()==WMS_PROCESS_DOES_NOT_EXIST)
+               if (e.getMessage().matches("Unexpected.*(error message = error=201,.*)"))
+               {
+                  if (sessObj.qsOpen)
+                  {
+                     try
+                     {
+                        sessObj.getStmtObj().execute(SessionDefaults.WMSCLOSE);
+                     } catch (SQLException sqle)
+                     {
+                        System.out.println("Should not come here...");
+                     }
+                     sessObj.qsOpen = false;
+                  }
+               }
+               if (caller == PRUNI)
+               {
+                  this.sqlErrorCount++;
+               }
+               qryObj.setTrimOut(false);
+
+
+               sessObj.setTotalRecordCount("-1");
+               
+               writer.writeAllSQLExceptions(sessObj,e);
+              
+              
+               if (sessObj.getMode() != SessionDefaults.WMS_MODE)
+                  sessObj.setLastError(Math.abs(e.getErrorCode()));
+               else
+                  sessObj.setLastError(e.getErrorCode());
+               
+               sessObj.setQryEndTime();
+            } catch (IOException ioe)
+            {
+               System.out.println("IO Exception while processing "+sessObj.getStrMode()+" command: "+ioe);
+               sessObj.setQryEndTime();
+               continue;
+
+            }
+
+            continue;
+
+
+
+         } catch (IOException e)
+         {
+            throw e;
+         }
+      }
+
+      return sessObj.getExitCode();
+   }
+
+   // get the connection to the database
+   public Connection getConnection() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException
+   {
+
+      Driver driver=null;
+      Connection conn=null;
+      Properties connProp=new Properties();
+     
+      String connectStr="jdbc:t4jdbc://"+sessObj.getSessionServer()+sessObj.getSessionPort();
+
+      driver = (Driver)Class.forName(SessionDefaults.DRIVER_NAME).newInstance();
+
+      driver.getMajorVersion();
+      driver.getMinorVersion();
+
+      connProp.put("user",sessObj.getSessionUser());
+      connProp.put("password",sessObj.getSessionPass());
+
+      /*
+       *  Only set the connection timeout if its not the default.
+       */
+      int connTimeout = Session.getConnectionTimeout();
+      if (Session.DEFAULT_CONNECTION_TIMEOUT != connTimeout)
+         connProp.put("connectionTimeout", String.valueOf(connTimeout) );
+
+      //connProp.put("serverDataSource",sessObj.getSessionDsn());
+      //connProp.put("catalog",sessObj.getSessionCtlg());
+      //connProp.put("schema", sessObj.getSessionSchema());
+      String theRole = sessObj.getTempSessionRole();
+ 
+      if ((null == theRole)  ||  (0 <= theRole.length() ) )
+    	  theRole = sessObj.getSessionRole();
+      
+      connProp.put("roleName", theRole);
+      connProp.put("applicationName", SessionDefaults.APP_NAME);
+      
+      if (sessObj.isDebugOn())
+      {
+    	  System.out.println("getConnection::" +
+    			  " HOST:" + sessObj.getSessionServer() +
+    			  "::PORT:" + sessObj.getSessionPort() + 
+    			  "::USR:" + sessObj.getSessionUser() +
+     			  "::ROLE:"+ theRole + 
+    			  "::DSN:" + defaultDataSource);
+    	  System.out.println("Driver version:: "+ sessObj.getT4verNum());
+      }
+      
+      conn = DriverManager.getConnection(connectStr,connProp);
+        
+      SQLWarning dsw=conn.getWarnings();
+      sessObj.setDBConnExists(true);
+
+      /*while ((dsw!=null))
+      {
+	      if (dsw.getErrorCode()==UNKNOWN_DATA_SOURCE)
+	      {
+	         defaultDataSource=(dsw.toString().lastIndexOf(": ")!= -1 ?dsw.toString().substring(dsw.toString().lastIndexOf(": ")+1).trim():defaultDataSource);
+	
+	         if (this.caller != PRUNI)
+	         {
+	            //System.out.println(SessionDefaults.lineSeperator+"WARNING: Data Source, "+sessObj.getSessionDsn()+", does not exist.");
+	         }
+	
+	         sessObj.setSessionDsn(defaultDataSource);
+	
+	      } else
+	      {
+	   		 System.out.println(SessionDefaults.lineSeperator + dsw.getMessage());
+	      }
+	      dsw=dsw.getNextWarning();
+	  } */
+      setDbProdVersion(conn);
+      setISOMapping(conn);
+      
+      specialModeEnabled = ((TrafT4Connection)conn).getDateConversion();
+      String schName = ((TrafT4Connection)conn).getSchema();
+      if (schName != null)
+    	  sessObj.setSessionSchema(schName);
+      
+      if (sessObj.isDebugOn())
+    	  System.out.println("schName:" + schName);
+      
+      // clear off any warnings generated
+      conn.clearWarnings();
+
+	  try {
+		  remoteProcess=((TrafT4Connection)conn).getRemoteProcess();
+	  	  sessObj.setNeoProcessName(remoteProcess);
+	  	  if (sessObj.isDebugOn())
+	  	  {
+	  		  System.out.println("Connected to process: " + remoteProcess);
+	  	  }
+	  } catch (Exception e) {}
+      return conn;
+   }
+
+   //  get the connection to the database
+   public Connection getConnection(String user, String password, String role, String server, String dataSource, String port) 
+      throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException
+   {
+
+      Driver driver=null;
+      Connection conn=null;
+      Properties connProp=new Properties();
+      
+
+      String connectStr="jdbc:t4jdbc://"+(server==null?sessObj.getSessionServer():server)+(port==null?sessObj.getSessionPort():port);
+
+      driver = (Driver)Class.forName(SessionDefaults.DRIVER_NAME).newInstance();
+
+      if (sessObj.isDebugOn())
+      {
+    	  System.out.println("getConnection with args::" + " HOST:" + server +
+    			"::PORT:" + port + "::USR:" + user +
+    			"::ROLE:"+ role + "::DSN:" + dataSource); 
+      }
+      
+      driver.getMajorVersion();
+      driver.getMinorVersion();
+
+      connProp.put("user", (user==null?sessObj.getSessionUser():user) );
+      connProp.put("password",(password==null?sessObj.getSessionPass():password));
+      connProp.put("roleName", (null==role?"":role));
+
+      /*
+       *  Only set the connection timeout if its not the default.
+       */
+      int connTimeout = Session.getConnectionTimeout();
+      if (Session.DEFAULT_CONNECTION_TIMEOUT != connTimeout)
+         connProp.put("connectionTimeout", String.valueOf(connTimeout) );
+
+      //connProp.put("serverDataSource",dataSource==null?sessObj.getSessionDsn():dataSource);
+      //connProp.put("catalog",sessObj.getSessionCtlg());
+      //connProp.put("schema", sessObj.getSessionSchema());
+      connProp.put("applicationName", "TrafCI");
+      conn = DriverManager.getConnection(connectStr,connProp);
+      
+      SQLWarning dsw=conn.getWarnings();
+      sessObj.setDBConnExists(true);
+      boolean wasSessionDsnSet=false;
+      
+      /*while ((dsw!=null))
+      {      
+     	  if (dsw.getErrorCode()==UNKNOWN_DATA_SOURCE)
+    	  {
+    		  defaultDataSource=(dsw.toString().lastIndexOf(": ")!= -1 ?dsw.toString().substring(dsw.toString().lastIndexOf(": ")+1).trim():defaultDataSource);
+
+    		  if (this.caller != PRUNI)
+    		  {
+    			  //System.out.println(SessionDefaults.lineSeperator+"WARNING: Data Source, "+ dataSource +", does not exist.");
+    		  }
+    		  sessObj.setSessionDsn(defaultDataSource); 
+    		  wasSessionDsnSet=true;
+    	  } else 
+    	  {
+    		  System.out.println(SessionDefaults.lineSeperator + dsw.getMessage());
+    	  }
+       	  dsw=dsw.getNextWarning();
+      } */
+      
+	  if (!wasSessionDsnSet) {
+		  wasSessionDsnSet=true;
+		  sessObj.setSessionDsn(dataSource);
+	  }
+      // clear off any warnings generated
+      conn.clearWarnings();
+
+      try
+      {
+         lfPropsObj.loadLookAndFeelProps(sessObj,specialModeEnabled);
+         sessObj.setLFProps(lfPropsObj);
+         
+       } catch (FileNotFoundException fnfe)
+      {
+      }
+      catch (IOException ioe)
+      {
+      }
+      catch (Exception e)
+      {
+      }
+      try {
+    	  remoteProcess=((TrafT4Connection)conn).getRemoteProcess();
+    	  sessObj.setNeoProcessName(remoteProcess);
+    	  if (sessObj.isDebugOn())
+    	  {
+    		  System.out.println("Connected to process: " + remoteProcess);
+    	  }     
+      } catch (Exception e) {}
+      
+      setDbProdVersion(conn);
+      setISOMapping(conn);
+      specialModeEnabled = ((TrafT4Connection)conn).getDateConversion();
+	  String schName = ((TrafT4Connection)conn).getSchema();
+ 
+	  if (sessObj.isDebugOn())
+    	  System.out.println("schName:" + schName);
+
+      if (schName != null)
+    	  sessObj.setSessionSchema(schName);
+      return conn;
+
+   }
+   
+   public void setISOMapping(Connection conn) throws SQLException
+   {
+      
+      try{
+          sessObj.setISOMapping(((TrafT4Connection)conn).getISOMapping());
+      }catch(NoSuchMethodError nsme){
+         ;
+      }
+      String multibyteAlign = System.getProperty("trafci.charset.align");
+      if (multibyteAlign != null && multibyteAlign.equalsIgnoreCase("N"))
+         sessObj.setMultiByteAlign(false);
+      
+
+   }
+   
+   public void getDriverVersion() throws IOException
+   {
+      float verNum = 2.2F;
+      if (sessObj.getConnObj() != null)
+      {
+         try
+         {
+            if (parser == null)
+               parser = new Parser();
+            if (utilObj == null) 
+               utilObj = new Utils();
+            String versionStr = parser.gett4Version(sessObj.getConnObj().getMetaData().getDriverVersion());
+            verNum = Float.parseFloat(versionStr);
+         }
+         catch (Exception e) {}
+         finally {
+            sessObj.setT4verNum(verNum);
+            try {
+               if (sessObj.getPlatformObjectVersions())
+               {
+            	   sessObj.setMxosrvrVersion(sessObj.getNdcsVersion());
+               }
+            } catch( Exception e) {}
+         }
+      }
+   }
+
+   public void setDbProdVersion(Connection conn) throws SQLException
+   {
+      String prodVer = conn.getMetaData().getDatabaseProductVersion();
+      if (prodVer != null)
+         sessObj.setDatabaseProdVersion(Float.parseFloat(prodVer));
+   }
+   
+   private String formatString(String output,int colWidth,char fillchar)
+   {
+      StringBuffer outBuffer=null;
+
+      if (output == null)
+      {
+         return null;
+      }
+
+      outBuffer=new StringBuffer(output);
+
+
+      if (outBuffer.length() <= colWidth)
+      {
+         for (int i=outBuffer.length();i<colWidth;i++)
+            outBuffer.append(fillchar);
+
+      }
+
+      return outBuffer.toString();
+
+   }
+
+
+   public ConsoleReader getConsoleReader()
+   {
+      return crObj;
+   }
+
+
+   public void setConsoleReader(ConsoleReader crObj)
+   {
+      this.crObj = crObj;
+   }
+
+
+   public ConsoleWriter getConsoleWriter()
+   {
+      return cwObj;
+   }
+
+
+   public void setConsoleWriter(ConsoleWriter cwObj)
+   {
+      this.cwObj = cwObj;
+   }
+
+   public String getScriptFile()
+   {
+      return scriptFile;
+   }
+
+   public void setScriptFile(String scriptFile)
+   {
+      this.scriptFile = scriptFile;
+   }
+
+   public String getLogFile()
+   {
+      return logFileName;
+   }
+
+   public void setLogFile(String logFileName,boolean overWriteLog)
+   {
+      this.logFileName = logFileName;
+      this.overWriteLog=overWriteLog;
+
+   }
+
+   public int getSqlErrorCount()
+   {
+      return sqlErrorCount;
+   }
+
+   public void setSqlErrorCount(int sqlErrorCount)
+   {
+      this.sqlErrorCount = sqlErrorCount;
+   }
+
+   public int getSqlQueryCount()
+   {
+      return sqlQueryCount;
+   }
+
+   public void setSqlQueryCount(int sqlQueryCount)
+   {
+      this.sqlQueryCount = sqlQueryCount;
+   }
+
+   public boolean isQueryMode()
+   {
+      return queryMode;
+   }
+
+   public void setQueryOptions(boolean queryMode, String qryString)
+   {
+      this.queryMode = queryMode;
+      this.qryString=qryString;
+   }
+
+   public int getSqlWarningsCount()
+   {
+      return sqlWarningsCount;
+   }
+
+
+   public void setSqlWarningsCount(int sqlWarningsCount)
+   {
+      this.sqlWarningsCount = sqlWarningsCount;
+   }
+  
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/SessionTimeoutTask.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/SessionTimeoutTask.java b/core/conn/trafci/src/main/java/org/trafodion/ci/SessionTimeoutTask.java
new file mode 100644
index 0000000..430e205
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/SessionTimeoutTask.java
@@ -0,0 +1,93 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.sql.Connection;
+import java.util.TimerTask;
+
+public class SessionTimeoutTask extends TimerTask
+{
+   Connection conn=null;
+   int idleTime=0;
+   long lastQueryExecTime=0;
+   boolean checkRequired=true;
+
+   /*
+    *  Variable to hold the session we are associated with.
+    */
+   private Session _sessionObj = null;
+
+
+   SessionTimeoutTask(Connection conn)
+   {
+      this.conn=conn;
+   }
+
+
+
+
+   /*
+    *  Sets the session this timeout task is associated with.
+    *
+    *  @param sessObj  the session this timeout task is associated with.
+    */
+   public void setSessionObj(Session sessObj) {
+       this._sessionObj = sessObj;
+
+   }  /*  End of  setSessionObj  method.  */
+
+
+
+   public void run()
+   {
+
+      if (checkRequired)           // check if this task has to run
+      {
+         /*
+          *  Reset the connection idle timer (if we can!!).
+          */
+         if (null != this._sessionObj)
+            this._sessionObj.resetConnectionIdleTimer();
+
+
+         if (idleTime != 0)       // check only if the idletime is not set to 0
+         {
+            if (((System.currentTimeMillis() - this.lastQueryExecTime)/(1000*60)) > idleTime)
+            {
+               try
+               {
+                  conn.close();
+               }catch (Exception e)
+               {
+                  // dont care..
+               }
+               System.out.println();
+               System.out.println("Session Expired.");
+               System.exit(SessionDefaults.abruptExit);
+            }
+         }
+      }
+
+
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/SqlEnum.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/SqlEnum.java b/core/conn/trafci/src/main/java/org/trafodion/ci/SqlEnum.java
new file mode 100644
index 0000000..1fdca3e
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/SqlEnum.java
@@ -0,0 +1,83 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+
+public enum SqlEnum {
+	
+	ROLE,
+	SCHEMA,
+	SERVER,
+	USER,
+	
+	SCHEDULE,
+	ERROR,
+	ALLOW,
+	DENY,
+	AUDIT,
+	ONLINEDUMP,
+	
+	MV,
+	MVS,
+	MATERIALIZED_NAME ("MATERIALIZED VIEW NAME"),
+	
+	INDEX,
+	INDEXES,
+	INDEX_NAME ("INDEX NAME"),
+	
+	SYNONYM,
+	SYNONYMS,
+	SYNONYM_NAME ("SYNONYM NAME"),
+	
+	TRIGGER,
+	TRIGGERS,
+	TRIGGER_NAME ("TRIGGER NAME"),
+
+	TABLE,
+	TABLE_NAME,
+	TABLE_TYPE,
+	
+	VIEW,
+	VIEWS,
+	
+	ON,
+	DESCRIBE__COL
+	;
+	
+	private String label;
+	SqlEnum() {
+		this.label = "";
+	}
+	SqlEnum(String label) {
+		this.label = label;
+	}
+	/**
+	 * @return label of the SqlEnum
+	 */
+	public String getLabel() {
+		return this.label;
+	}
+	
+	public static String getFullQualifiedName(
+			final String cat, final String schema, final String table) {
+		return cat + "." + schema + "." + table;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/StatusThread.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/StatusThread.java b/core/conn/trafci/src/main/java/org/trafodion/ci/StatusThread.java
new file mode 100644
index 0000000..d1ca00a
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/StatusThread.java
@@ -0,0 +1,100 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+public class StatusThread extends Thread
+{
+
+   boolean stop=false;
+   String beforeStatus=" In Progress";
+   String afterStatus=" Complete";
+   ConsoleWriter cwObj=null;
+
+
+   /*
+    *  Variable to hold the session for resetting the connection idle timer.
+    */
+   Session _sessionObj = null;
+
+
+   StatusThread()
+   {
+   }
+
+
+   /*
+    *  Save the sessionObject as well to reset the connection idle timer.
+    */
+   StatusThread(ConsoleWriter cwObj, Session sessObj)
+   {
+      this.cwObj=cwObj;
+      this._sessionObj = sessObj;
+   }
+
+   public void run()
+   {
+      /*
+       *  Counter to hold the number of seconds that have elapsed since our
+       *  last I_AM_ALIVE message w/ the NDCS server.
+       */
+      int elapsedSeconds = 0;
+
+
+      cwObj.println();
+      while (!stop)
+      {
+         cwObj.print("\rStatus :"+beforeStatus);
+         for (int j=0;j<10;j++)
+         {
+            if (!stop)
+            {
+               try
+               {
+                  sleep(100);
+               }
+               catch (Exception e)
+               {
+               }
+               System.out.print(".");
+            }
+
+         }
+         cwObj.print("\rStatus:"+beforeStatus+"                       ");
+
+
+         /*
+          *  Reset the Connection idle timer if 60 seconds have elapsed.
+          */
+         elapsedSeconds++;
+         if (60 < elapsedSeconds) {
+            this._sessionObj.resetConnectionIdleTimer();
+            elapsedSeconds = 0;
+         }
+
+
+      }
+      cwObj.println("\rStatus:"+afterStatus+"                     ");
+
+   }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/TerminalProcessBridge.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/TerminalProcessBridge.java b/core/conn/trafci/src/main/java/org/trafodion/ci/TerminalProcessBridge.java
new file mode 100644
index 0000000..71bc05f
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/TerminalProcessBridge.java
@@ -0,0 +1,246 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+import java.io.*;
+
+
+/**
+ *   Virtual Terminal proxy (a process to a terminal bridge) -- reads from one end and writes to
+ *   the other. Can't handle terminal sequences as yet. A "terminal" process bridge!! :^)
+ */
+class  TerminalProcessBridge  extends  Thread
+{
+
+   /**
+   *   Static constants/defines -- DOOMDAY and time to yield the scheduler in milliseconds.
+   */
+   public  static  final  boolean  DOOMSDAY                  = true;
+   public  static  final  int      DEFAULT_CPU_YIELD_TIME_MS = 300;   // default/first yield processor every 300 milliseconds.
+   public  static  final  int      ONREAD_CPU_YIELD_TIME_MS  = 20;   // on read yield processor every 20 milliseconds.
+
+
+   /**
+   *   Static variable/knob to show/hide debugging details.
+   */
+   public  static  boolean  _debugOn = Boolean.getBoolean("trafci" + "." + "_lhdebug");
+
+
+   /**
+   *   Instance variables -- input and output streams + whether or not we should read 
+   *   waited and whether or not we should keep reading.
+   */
+   InputStream   _is        = null;
+   OutputStream  _os        = null;
+   String        _tag       = "";
+   boolean       _waitedOps = true;
+   boolean       _readOn    = true;
+   Writer        _writer     = null;
+
+
+
+
+   /**
+   *   TerminalProcessBridge Constructor. Serves as in output bridge between the 2 buddies.
+   *
+   *   @param  is  - Input stream to read from.
+   *   @param  os  - Output stream to write to.
+   */
+   protected  TerminalProcessBridge(InputStream is, OutputStream os)
+   {
+      this(is, os, true);
+   }
+
+
+   protected  TerminalProcessBridge(InputStream is, Writer writer)
+   {
+      this(is, writer, true);
+   }
+   
+   /**
+   *   TerminalProcessBridge Constructor. Serves as an output bridge between 'em.
+   *
+   *   @param  is      - Input stream to read from.
+   *   @param  os      - Output stream to write to.
+   *   @param  waited  - Do waited reads on the input stream.
+   */
+   protected  TerminalProcessBridge(InputStream is, OutputStream os, boolean waited)
+   {
+      this._is        = is;
+      this._os        = os;
+      this._waitedOps = waited;
+   }
+
+   protected  TerminalProcessBridge(InputStream is, Writer writer, boolean waited)
+   {
+      this._is        = is;
+      this._writer    = writer;
+      this._waitedOps = waited;
+   }
+
+
+   /**
+   *   Control method to indicate process went away and we don't need to read any more.
+   *   Job's all done -- let just bow out gracefully.
+   *
+   */
+   protected  void  stopReading()
+   {
+      synchronized(this)
+      {
+         this._readOn = false;
+      }
+   }
+
+
+
+   /**
+   *   Control method to set a tag for debugging purposes.
+   *   @param  tag  - Tag Name.
+   *
+   */
+   protected  void  setTag(String  tag)
+   {
+      this._tag = tag;
+
+   }
+
+
+
+   /**
+   *   Thread entry point (main method). Does all the work. Reads from console/obey file
+   *   as input is available and pipes it to the process' input stream.
+   *
+   *   @overrides  Thread.run
+   */
+   public void run()
+   {
+      try
+      {
+         BufferedWriter      output=null;
+         if (this._os != null) {
+            OutputStreamWriter  sendTo   = new OutputStreamWriter(this._os);
+                                output   = new BufferedWriter(sendTo);
+         }
+
+         int  yieldTime = DEFAULT_CPU_YIELD_TIME_MS;
+
+         /* put a new line at top of first output */
+         boolean firstLine = true;
+
+         /** 
+         *  Keep doing this until we know the process completed and we don't need to
+         *  read anymore.
+         */
+         while (DOOMSDAY)
+         {
+            synchronized(this)
+            {
+               if (!this._readOn)
+                  break;
+
+            }
+
+            if (this._waitedOps ||  (0 < this._is.available()))
+            {
+               String  line        = null;
+               int     numReadable = this._is.available();
+               byte[]  bytes       = new byte[1];
+
+               if (_debugOn)
+                  System.out.println("** Debug*** ==>  available : " + numReadable);
+
+               if (0 < numReadable)
+                  bytes = new byte[numReadable];
+
+
+               int  kitchenSink = this._is.read(bytes, 0, bytes.length);
+               if (-1 == kitchenSink)
+                  break;
+
+               if (_debugOn)
+                  System.out.println("** Debug*** ==>  read terminated with '" + kitchenSink +
+                     "' bytes [length asked for was " + bytes.length + "]. ");
+
+
+               line = new String(bytes);
+               
+               if(firstLine)
+               {
+                   line = "\n"+line;
+                   firstLine = false;
+               }
+               
+               if (_debugOn)
+                  line = this._tag + line;
+
+               if (_writer == null)
+               {
+                  output.write(line, 0, line.length() );
+                  output.flush();
+               }
+               else
+               {
+                  _writer.write(line);
+               }
+
+               yieldTime = ONREAD_CPU_YIELD_TIME_MS;
+
+            }
+            else
+            {
+               try
+               {
+//                  Thread.currentThread().sleep(yieldTime);
+            	   Thread.sleep(yieldTime);
+               } catch (Exception e)
+               {
+               }
+
+            }
+
+
+         }   /*  End of  while(DOOMSDAY)  loop.  */
+
+      } catch (Exception e)
+      {
+         if (TerminalProcessBridge._debugOn)
+         {
+            System.err.println("Internal error occurred.  Details : " + e.getMessage() );
+            e.printStackTrace();
+         }
+
+      }
+
+   }  /*  End of  run  method.  */
+
+
+}  /*  End of  inner class  TerminalProcessBridge.  */
+
+
+
+
+
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/UnKnownInterfaceCommand.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/UnKnownInterfaceCommand.java b/core/conn/trafci/src/main/java/org/trafodion/ci/UnKnownInterfaceCommand.java
new file mode 100644
index 0000000..c9257c7
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/UnKnownInterfaceCommand.java
@@ -0,0 +1,34 @@
+// @@@ 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 @@@
+package org.trafodion.ci;
+
+public class UnKnownInterfaceCommand extends Exception
+{
+
+   /**
+   * 
+   */
+   private static final long serialVersionUID = 1L;
+   UnKnownInterfaceCommand()
+   {
+      super();
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/UserInterface.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/UserInterface.java b/core/conn/trafci/src/main/java/org/trafodion/ci/UserInterface.java
new file mode 100644
index 0000000..ac22141
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/UserInterface.java
@@ -0,0 +1,421 @@
+// @@@ 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 @@@
+
+package org.trafodion.ci;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+
+import org.trafodion.ci.pwdencrypt.RefLookup;
+
+
+public class UserInterface {
+
+	static String[] myArgs = null;
+
+	/**
+	 * Main program called when the user logins using the windows/*nux wrapper
+	 * scripts. Creates a console reader & console write for interactive
+	 * input/output from the user.
+	 */
+	public static void main(String[] args) {
+		// create the console reader and writer objects
+		// for interactive session
+		ConsoleReader crObj = null;
+		ConsoleWriter cwObj = null;
+		myArgs = args;
+		int exitCode = 0;
+		boolean doTrace = Boolean.getBoolean(SessionDefaults.PROP_TRACE);
+		String mySQRoot = System.getenv("MY_SQROOT");
+		
+
+
+		/* handle AWT exceptions */
+		try {
+			Class.forName("org.trafodion.ci.AWTExceptionHandler");
+			System.setProperty("sun.awt.exception.handler",
+					AWTExceptionHandler.class.getName());
+		} catch (Throwable t) {
+			if (doTrace)
+				t.printStackTrace();
+		}
+
+		cwObj = new ConsoleWriter();
+
+		try {
+			cwObj.initialize();
+		} catch (IOException e1) {
+			System.out.println(SessionError.CONSOLE_WRITER_ERR.errorMessage()
+					+ e1);
+			if (doTrace)
+				e1.printStackTrace();
+			System.exit(SessionDefaults.abruptExit);
+		}
+		crObj = new ConsoleReader();
+
+		try {
+			crObj.initialize();
+		} catch (IOException e1) {
+			System.out.println(SessionError.CONSOLE_READER_ERR.errorMessage()
+					+ e1);
+			if (doTrace)
+				e1.printStackTrace();
+			System.exit(SessionDefaults.abruptExit);
+		}
+
+		banner();
+        
+		// parse the arguments
+		ParseArguments paObj = new ParseArguments(crObj, cwObj);
+
+		// set default value to rolename
+		paObj.roleName = "";
+
+		paObj.setDefaults(SessionDefaults.dsnName, SessionDefaults.portNumber);
+
+		
+		if ( args.length %2 == 0 && mySQRoot != null && new File(mySQRoot).exists()) {
+			String uname=null, passwd = null, hostname = null, portNumber = null;
+			//EncryptUtil eu = new EncryptUtil();
+			Properties p = new Properties();
+			String matchedValue = null;
+			List<String> argsList= new ArrayList<String>(Arrays.asList(args));
+			int argLength=argsList.size();
+
+			for (int i=0;i < argLength; i++)
+		    {
+		         String option=args[i++].trim();
+		         String value=args[i].trim();
+		         
+		         if (option.equalsIgnoreCase("-u")|| option.equalsIgnoreCase("-user"))
+		         {
+		            uname=value;
+		         }
+		         else if (option.equalsIgnoreCase("-p")|| option.equalsIgnoreCase("-password"))
+		         {
+		            passwd=value;
+		         }
+		         else if (option.equalsIgnoreCase("-h")|| option.equalsIgnoreCase("-host"))
+		         {
+		            String[] hostAddr=value.split(":");
+		            if (hostAddr.length > 0)
+		            	hostname=hostAddr[0];
+		            
+		            String portValue="";
+
+		            for (int j=1; j < hostAddr.length;j++)
+		            {
+		               portValue+=":"+hostAddr[j];
+		            }
+		            if (portValue.length() > 0)
+		            {
+		               portNumber=portValue;
+		            }
+
+		         }
+		    }
+			
+			try 
+			{
+				
+				if (uname != null)
+				{
+					paObj.userName = uname;
+				}
+				else
+				{
+					paObj.userName = System.getProperty("user.name");
+				}
+				
+				if (passwd != null)
+				{
+					paObj.password = passwd;
+				}
+				else
+				{
+					String userHome =  System.getenv("USERHOME");//System.getProperty("user.dir");				
+					if (userHome != null)
+					{					
+						File f = new File(userHome + "/.trafciconf/encprops.txt");
+						if (f.exists())
+						{
+							try
+							{
+								p.load(new FileInputStream(f));
+								Enumeration<?> enumKeys = p.keys();
+								while (enumKeys.hasMoreElements())
+							      {
+									uname=enumKeys.nextElement().toString();
+									if (uname.equals(paObj.userName)){
+										matchedValue = p.getProperty(uname);
+										if (matchedValue != null)
+										{
+											passwd = RefLookup.resolve(uname+" = "+matchedValue);
+											break;
+										}
+									}
+							      }
+								
+								paObj.password = passwd;
+							}
+							catch(Exception e)
+							{
+								System.out.println("Error looking up user's password.");
+								if (doTrace)
+								{
+									System.out.println(e.getMessage());
+								}
+							}
+						}
+					}
+				}
+				
+				if (hostname != null)
+				{
+					paObj.serverName = hostname;
+				}
+				else
+				{
+					String serverName =  System.getenv("TRAFCI_SERVERNAME");										
+					if (serverName == null)
+					{					
+						//System.out.println("Can't obtain hostname, please enter hostname:port");
+						//System.exit(SessionDefaults.abruptExit);
+					}
+					else		
+						paObj.serverName = serverName;
+				}
+				
+				if (portNumber != null)
+				{
+					paObj.portNumber = portNumber;
+				}
+				else
+				{
+					String portName = System.getenv("TRAFCI_PORT");					
+					if (portName == null)
+					{					
+						//System.out.println("Can't obtain port number, please enter hostname:port");
+						//System.exit(SessionDefaults.abruptExit);
+					}		
+					paObj.portNumber = portName;
+				}
+					
+				if (paObj.serverName != null && paObj.portNumber != null)
+					System.out.println("Host Name/IP Address: "+paObj.serverName+paObj.portNumber);
+				if (paObj.userName != null)
+					System.out.println("User Name: "+paObj.userName);
+				
+         	} catch (Exception e)
+			{
+				e.printStackTrace();
+			}
+         	
+		}
+		
+		while (paObj.retryCnt > 0) {
+
+			try {
+				// validate the user credentials
+				myArgs = paObj.validateArgs(myArgs, true);
+			} catch (UserInterruption ui) {
+				System.exit(SessionDefaults.abruptExit);
+			} catch (InvalidNumberOfArguments e) {
+				System.out.println(e);
+				if (doTrace)
+					e.printStackTrace();
+				System.exit(SessionDefaults.abruptExit);
+			} catch (UnknownHostException e) {
+				if (doTrace)
+					e.printStackTrace();
+				System.exit(SessionDefaults.abruptExit);
+			} catch (IOException e) {
+				System.out.println(e);
+				if (doTrace)
+					e.printStackTrace();
+				System.exit(SessionDefaults.abruptExit);
+			}
+
+			// create a new session
+			// pass the required credentials details and caller id
+			// for this user interface the caller id will be USERI
+			// A session object is returned by SessionInterface
+			// with the required DB connection, writer and reader objects
+			SessionInterface siObj = new SessionInterface(crObj, cwObj);
+			Session sessObj = null;
+			try {
+				// set the script file if -script option is specified
+				siObj.setScriptFile(paObj.fileName);
+				sessObj = siObj.createSession(paObj.userName,
+						paObj.roleName, paObj.password, paObj.serverName,
+						paObj.portNumber, paObj.dsnName, SessionDefaults.USERI,
+						paObj.noConnectOption);
+
+				// DFM MXCI Migration Settings
+				if (paObj.dfm) {
+					sessObj.setSessView(SessionDefaults.MXCI_VIEW);
+					sessObj.setSessionPrompt(">>");
+					sessObj.setCmdEcho(true);
+				}
+
+				// All credentials are valid, do not prompt for login params
+				// again.
+				paObj.retryCnt = 0;
+
+				// set the mode to query mode if the -sql|-q is option is
+				// specified
+				// show the welcome banner only when the session is interactive
+				// mode ( non-query mode)
+				if (paObj.queryStr != null) {
+					siObj.setQueryOptions(true, paObj.queryStr);
+				} else {
+					System.out.println();
+					if (paObj.noConnectOption)
+						System.out.println("Not connected.");
+					else
+						System.out.println("Connected to " + sessObj.getDatabaseEdition());
+
+				}
+
+				// call the session
+				exitCode = siObj.invokeSession(sessObj);
+				siObj = null;
+			} catch (FileNotFoundException e) {
+				// thrown when the script file specified in the command line is
+				// not found
+				System.out.println();
+				System.out.println(SessionError.SCRIPT_FILE_NOT_FOUND);
+				if (doTrace)
+					e.printStackTrace();
+				System.exit(SessionDefaults.abruptExit);
+			} catch (SQLException sqle) {
+				if (doTrace) {
+					System.out.println("Caught a SQL exception. Error code = "
+							+ sqle.getErrorCode() + ", msg="
+							+ sqle.getMessage());
+					sqle.printStackTrace();
+				}
+
+				System.out.println();
+
+				// catch the known errors report them with an user friendly text
+				if (sqle.getErrorCode() == SessionDefaults.SQL_ERR_CONN_MAX_LIMIT) {
+					System.out.println(SessionError.CONN_MAX_LIMIT_ERR);
+					if (doTrace)
+						sqle.printStackTrace();
+					System.exit(SessionDefaults.abruptExit);
+				} else {
+					int errCode = sqle.getErrorCode();
+					String errStr = sqle.toString();
+
+					if (errStr.indexOf("org.trafodion.jdbc") != -1)
+						errStr = errStr.substring(errStr.indexOf(":") + 1)
+								.trim();
+
+					if (errStr.startsWith("***"))
+						System.out.println(errStr
+								+ SessionDefaults.lineSeperator);
+					else
+						System.out.println(SessionError.ERROR_CODE_PREFIX
+								+ Math.abs(errCode)
+								+ SessionError.ERROR_CODE_SUFFIX + " " + errStr
+								+ SessionDefaults.lineSeperator);
+
+					// identify those args that caused the exception
+					if (SessionDefaults.SQL_ERR_INVALID_AUTH == errCode
+							|| SessionDefaults.SQL_ERR_CLI_AUTH == errCode) {
+						paObj.userName = null;
+						paObj.password = null;
+						paObj.roleName = null;
+					} else if (SessionDefaults.NDCS_ERR_DSN_NOT_AVAILABLE == errCode) {
+						paObj.dsnName = null;
+					} else {
+						paObj.serverName = null;
+					}
+
+					// rebuild args list and remove only those that caused the
+					// exception
+					myArgs = paObj.rebuildArgList(myArgs);
+
+					if (--paObj.retryCnt == 0) {
+						if (doTrace)
+							sqle.printStackTrace();
+						System.exit(SessionDefaults.abruptExit);
+					}
+				}
+
+			} // end SQLException
+			catch (InstantiationException e) {
+				System.out.println(SessionError.DRIVER_INIT_ERR);
+				if (doTrace)
+					e.printStackTrace();
+				System.exit(SessionDefaults.abruptExit);
+			} catch (IllegalAccessException e) {
+				System.out.println(SessionError.DRIVER_INIT_ILLEGAL_ERR);
+				if (doTrace)
+					e.printStackTrace();
+				System.exit(SessionDefaults.abruptExit);
+			} catch (ClassNotFoundException e) {
+				System.out.println(SessionError.DRIVER_CLASS_ERR);
+				if (doTrace)
+					e.printStackTrace();
+				System.exit(SessionDefaults.abruptExit);
+			} catch (IOException e) {
+				System.out.println(e);
+				if (doTrace)
+					e.printStackTrace();
+				System.exit(SessionDefaults.abruptExit);
+			} catch (Exception e) {
+				System.out.println(e);
+				//if (doTrace)
+					e.printStackTrace();
+			} finally {
+				if (sessObj != null && sessObj.getConnObj() != null) {
+					try {
+						sessObj.getConnObj().close();
+					} catch (SQLException e) {
+					}
+				}
+			}
+
+			siObj = null;
+		} // end while
+
+		System.exit(exitCode);
+
+	}
+
+	private static void banner() {
+		System.out.println("\nWelcome to " + SessionDefaults.PROD_NAME);
+		String copyright_str = "Copyright (c) "+System.getenv("PRODUCT_COPYRIGHT_HEADER");
+		System.out.println(copyright_str);
+		System.out.println();
+	}
+}



[07/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/InterfaceQueryException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/InterfaceQueryException.java b/core/conn/trafci/src/org/trafodion/ci/InterfaceQueryException.java
deleted file mode 100644
index a4115a4..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/InterfaceQueryException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class InterfaceQueryException extends Exception
-{
-
-   /**
-   * 
-   */
-   private static final long serialVersionUID = 1L;
-
-   InterfaceQueryException()
-   {
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/InterfaceSyntaxError.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/InterfaceSyntaxError.java b/core/conn/trafci/src/org/trafodion/ci/InterfaceSyntaxError.java
deleted file mode 100644
index f81373a..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/InterfaceSyntaxError.java
+++ /dev/null
@@ -1,83 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class InterfaceSyntaxError
-{
-
-
-   private StringBuffer errMesg=null;
-   private String errPrefix = SessionError.SYNTAX_ERROR_PREFIX; //"ERROR: A syntax error occurred at or before:";
-
-   InterfaceSyntaxError()
-   {
-
-   }
-
-   public void setSyntaxError(String qryString ,String remainderStr)
-   {
-      if (errMesg == null)
-      {
-         errMesg=new StringBuffer();
-      }
-      this.errMesg.delete(0,errMesg.length());
-      //this.errMesg.append(SessionDefaults.lineSeperator);
-      this.errMesg.append(errPrefix);
-      this.errMesg.append(SessionDefaults.lineSeperator);
-      this.errMesg.append(qryString);
-      this.errMesg.append(SessionDefaults.lineSeperator);
-
-      this.errMesg.append(qryString.replaceAll("\\S"," "));
-
-      /*for(int i=0; i < (qryString.length()-remainderStr.length());i++)
-      this.errMesg.append(" ");*/
-      for (int i=0; i < remainderStr.length();i++)
-         this.errMesg.delete(errMesg.length()-1,errMesg.length());
-
-      this.errMesg.append("^");
-
-      this.errMesg.replace(0,this.errMesg.length(),this.errMesg.toString().replaceAll("(?m)^\\s+$",""));
-      //this.errMesg.append("^");
-   }
-
-   public ErrorObject getSyntaxError(String qryString,String remainderStr )
-   {
-
-      if (qryString != null)
-      {
-         qryString=qryString.replaceAll("\\s+$","");
-      }
-
-      if (remainderStr == null)
-      {
-         remainderStr="";
-      }
-      else
-      {
-         remainderStr=remainderStr.trim();
-      }
-
-      setSyntaxError(qryString,remainderStr);
-      return new ErrorObject(SessionError.GENERIC_SYNTAX_ERROR_CODE, errMesg.toString());
-   }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/InvalidNumberOfArguments.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/InvalidNumberOfArguments.java b/core/conn/trafci/src/org/trafodion/ci/InvalidNumberOfArguments.java
deleted file mode 100644
index e01b988..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/InvalidNumberOfArguments.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class InvalidNumberOfArguments extends Exception
-{
-
-   /**
-   * 
-   */
-   private static final long serialVersionUID = 1L;
-   InvalidNumberOfArguments()
-   {
-      super(SessionError.CMD_LINE_ARGS_ERR.RAWOutputError());
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/JDBCVproc.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/JDBCVproc.java b/core/conn/trafci/src/org/trafodion/ci/JDBCVproc.java
deleted file mode 100644
index d81c896..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/JDBCVproc.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-public class JDBCVproc
-{
-   public static String getVproc() 
-   {
-      try {
-         return (org.trafodion.jdbc.t4.Vproc.getVproc());
-      } catch (java.lang.IllegalAccessError iae)
-      {
-         return iae.getMessage();
-   
-      }
-      
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/LFProperties.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/LFProperties.java b/core/conn/trafci/src/org/trafodion/ci/LFProperties.java
deleted file mode 100644
index 0b80f90..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/LFProperties.java
+++ /dev/null
@@ -1,130 +0,0 @@
-// @@@ 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 @@@
-
-/**
- * 
- * Class to load and display the look and feel properties file.
- * 
- */
-
-package org.trafodion.ci;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class LFProperties
-{
-
-   private Properties lfProps=null;
-   private Session sessObj=null;
-
-   LFProperties(){}
-
-   public String getStatus(Query qryObj) {
-	  String qryString = Utils.trimSQLTerminator(deleteCStyleComments(qryObj.getQueryText().trim()),sessObj.getSessionSQLTerminator());
-      String queryString=sessObj.getStrMode()+"_"+qryString.trim().toUpperCase().replaceAll("\\s+"," ");
-      Enumeration<Object> enumKeys=lfProps.keys();
-      int keySize=0;
-      String matchedElement=null;
-      String matchedValue=null;
-
-      while (enumKeys.hasMoreElements())
-      {
-         String nextElement=enumKeys.nextElement().toString();
-
-         if (queryString.matches(nextElement))
-         {
-            if (nextElement.length() > keySize)
-            {
-               keySize=nextElement.length();
-               matchedElement=nextElement;
-            }
-         }
-
-      }
-
-      if (keySize > 0)
-      {
-         String stmtType=qryObj.getStmtType();
-
-         if (((matchedElement.startsWith("SQL_EXECUTE")) && !qryObj.isTrimOut() &&
-            ( (stmtType.equalsIgnoreCase("SELECT"))  ||
-            (stmtType.equalsIgnoreCase("INSERT"))  ||
-            (stmtType.equalsIgnoreCase("UPDATE"))  ||
-            (stmtType.equalsIgnoreCase("DELETE"))  ) ) || ( stmtType != null && stmtType.equals("SELECT_LIST_COUNT")))
-         {
-            matchedElement=sessObj.getStrMode()+"_"+stmtType+" .*";
-         }
-
-         if ((matchedElement.startsWith("SQL_EXECUTE")) && !qryObj.isTrimOut() &&
-                 (stmtType.equalsIgnoreCase("CREATE_TABLE_AS")))
-         {
-        	 matchedElement = "SQL_CREATE TABLE .* AS SELECT .*";
-         }
-
-         
-         matchedValue = lfProps.getProperty(matchedElement);
-         if (matchedValue.indexOf("@rownum@") != -1)
-         {
-               return (matchedValue.replaceFirst("@rownum@",qryObj.getRowCount()));
-         }
-         return (matchedValue);
-      }
-      return (lfProps.getProperty(sessObj.getStrMode()+"_UNKNOWN_CMD"));
-   }
-
-   /*
-    * Delete C-style comments in a String
-    */
-   private String deleteCStyleComments(String originalString)
-   {
-	   Pattern p = Pattern.compile( "/[*]{1,2}.*?[*]/",Pattern.DOTALL); 
-	   Matcher m = p.matcher(originalString); 
-	   return m.replaceAll("");
-   }
-
-   //  load the look and feel properties 
-   public void loadLookAndFeelProps(Session sessObj, boolean specialModeEnabled) 
-   		throws FileNotFoundException, IOException {
-	  String laFileName=null;
-      String laOption=System.getProperty(SessionDefaults.PROP_TRAFCILF);
-      this.sessObj = sessObj;
-      
-      laFileName= SessionDefaults.PROP_DEFAULT_NAME;
-      sessObj.setSessView(SessionDefaults.CIDEFAULT_VIEW);
-
-      loadProperties(laFileName);
-   }
-
-   public void loadProperties(String fileName) throws FileNotFoundException, IOException
-   {
-
-      lfProps=new Properties();
-      lfProps.load(this.getClass().getResourceAsStream(fileName));
-
-   }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/MaskingThread.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/MaskingThread.java b/core/conn/trafci/src/org/trafodion/ci/MaskingThread.java
deleted file mode 100644
index 5df4d86..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/MaskingThread.java
+++ /dev/null
@@ -1,73 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class MaskingThread extends Thread
-{
-   private boolean stop = false;
-   private String prompt = null;
-
-   /**
-   * @param thePrompt The prompt displayed to the user
-   */
-   public MaskingThread(String thePrompt)
-   {
-      prompt = thePrompt;
-   }
-
-   /**
-   * Begin masking until asked to stop.
-   */
-   public void run()
-   {
-      int priority = Thread.currentThread().getPriority();
-      Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
-
-      while (!stop)
-      {
-         if (!stop)
-            System.out.print( "                                 \r" + prompt  );
-         //System.out.flush();
-         try
-         {
-            // attempt masking at this rate (refresh every 1 ms.)
-            sleep(1);
-         }
-         catch (InterruptedException iex)
-         {
-            iex.printStackTrace();
-         }
-         finally
-         { // restore the original priority
-            Thread.currentThread().setPriority(priority);
-         }
-
-      }
-   }
-
-   /**
-   * Instruct the thread to stop masking.
-   */
-   public void stopMasking()
-   {
-      stop = true;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/MultiByteUtils.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/MultiByteUtils.java b/core/conn/trafci/src/org/trafodion/ci/MultiByteUtils.java
deleted file mode 100644
index 220243c..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/MultiByteUtils.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-
-import java.awt.FontMetrics;
-import java.awt.Font;
-import java.awt.Panel;
-
-public class MultiByteUtils {
-   
-   private static MultiByteUtils mbUtils = new MultiByteUtils();
-   private FontMetrics fm = null;
-   
-   MultiByteUtils()
-   {
-      try {
-         System.setProperty("java.awt.headless", "true");
-      }catch(Throwable t)
-      {
-      }
-      try {
-         Panel pan = new Panel();
-         fm = pan.getFontMetrics(new Font("Monospaced",Font.PLAIN, 12));
-      } catch (Throwable t)
-      {
-            System.out.println(SessionError.MULTIBYTE_DISP_WARN.errorMessage());
-      }
-  }
-  
-      
-   public static FontMetrics getFontMetrics()
-   {
-     return mbUtils.fm;
-   }
- 
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/NullKeyWordException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/NullKeyWordException.java b/core/conn/trafci/src/org/trafodion/ci/NullKeyWordException.java
deleted file mode 100644
index a7854d5..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/NullKeyWordException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class NullKeyWordException extends InterfaceQueryException
-{
-
-   /**
-   * 
-   */
-   private static final long serialVersionUID = 1L;
-
-   NullKeyWordException()
-   {
-      super();
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/OutputColumnAttribute.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/OutputColumnAttribute.java b/core/conn/trafci/src/org/trafodion/ci/OutputColumnAttribute.java
deleted file mode 100644
index d84dce4..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/OutputColumnAttribute.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-public class OutputColumnAttribute {
-	public String name;
-	public int width = SessionDefaults.MIN_COL_DISPLAY_SIZE;
-	public int align=OutputContents.LiftAlign;
-	
-	public String getDisplayFormatName()
-	{
-		if(width>name.length())
-		{
-			StringBuilder sbName = new StringBuilder(width);
-			sbName.append(name);
-			for(int i=0;i<width-name.length();i++)
-			{
-				sbName.append(" ");
-			}
-			return sbName.toString();
-		}
-		else
-		{
-			return name;
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/OutputContents.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/OutputContents.java b/core/conn/trafci/src/org/trafodion/ci/OutputContents.java
deleted file mode 100644
index 41c2c41..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/OutputContents.java
+++ /dev/null
@@ -1,144 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.util.ArrayList;
-
-public class OutputContents {
-
-	public static int LiftAlign = 0;
-	public static int RightAlign = 1;
-	public static int CenterAlign = 2;
-	
-	private String title="";
-	private String itemName="";
-	private String headerSeparator = "-";
-	private String columnSeparator = " ";
-	private ArrayList<OutputColumnAttribute> alColumns;
-	private ArrayList<ArrayList<String>> alRows;
-	
-	public OutputContents()
-	{
-		alColumns = new ArrayList<OutputColumnAttribute>();
-		alRows = new ArrayList<ArrayList<String>>();
-	}
-
-	public OutputContents(int columnCount)
-	{
-		alColumns = new ArrayList<OutputColumnAttribute>(columnCount);
-		alRows = new ArrayList<ArrayList<String>>();
-	}
-	
-	public ArrayList<String> newRow()
-	{
-		ArrayList<String> row = new ArrayList<String>(alColumns.size());
-		alRows.add(row);
-		return row;
-	}
-	
-	public ArrayList<ArrayList<String>> getRows()
-	{
-		return this.alRows;
-	}
-	
-	public OutputColumnAttribute newColumn()
-	{
-		OutputColumnAttribute column = new OutputColumnAttribute();
-		alColumns.add(column);
-		
-		return column;
-	}
-	
-	public void setColumnWidth(String columnName, int width)
-	{
-		for(int i=0; i<alColumns.size();i++)
-		{
-			OutputColumnAttribute column = (OutputColumnAttribute)alColumns.get(i);
-			if(column!=null && column.name.equals(columnName))
-			{
-				if(column.width<width)
-					column.width=width;
-				break;
-			}
-		}
-	}
-
-	public void setColumnAlign(String columnName, int align)
-	{
-		for(int i=0; i<alColumns.size();i++)
-		{
-			OutputColumnAttribute column = (OutputColumnAttribute)alColumns.get(i);
-			if(column!=null && column.name.equals(columnName))
-			{
-				column.align=align;
-				break;
-			}
-		}
-	}
-	
-	public String getHeaderSeparator()
-	{
-		return this.headerSeparator;
-	}
-
-	public void setHeaderSeparator(String hdSeparator)
-	{
-		this.headerSeparator = hdSeparator;
-	}
-
-	public String getColumnSeparator()
-	{
-		return this.columnSeparator;
-	}
-
-	public void setColumnSeparator(String clSeparator)
-	{
-		this.columnSeparator = clSeparator;
-	}
-	
-	public String getTitle()
-	{
-		return this.title;
-	}
-	
-	public void setTitle(String t)
-	{
-		this.title=t;
-	}
-	
-	public String getItemName()
-	{
-		return itemName;
-	}
-
-	public void setItemName(String name)
-	{
-		itemName = name;
-	}
-	public ArrayList<OutputColumnAttribute> getColumns()
-	{
-		return alColumns;
-	}
-	
-	
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ParallelRun.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ParallelRun.java b/core/conn/trafci/src/org/trafodion/ci/ParallelRun.java
deleted file mode 100644
index 2e91975..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ParallelRun.java
+++ /dev/null
@@ -1,1320 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Properties;
-import java.sql.ResultSet;
-import java.util.Vector;
-import sun.misc.Signal;
-import sun.misc.SignalHandler;
-
-public class ParallelRun extends Thread
-{
-
-   String scriptsDir=null;
-   String scriptsExt=null;
-   String logsDir=null;
-   boolean overwriteLogs=false;
-   int connectionCnt=2;
-   ConsoleReader crObj=null;
-   ConsoleWriter cwObj=null;
-   String summaryFile=null;
-   PrunUserInterruption pui=null;
-   Properties lfProps=null;
-   final String SCRIPT_EXT="sql";
-   int MAX_THREADS=64;
-   int MIN_THREADS=2;
-   List<String> scriptsList=null;
-   Session sessObj=null;
-   FileWriter summaryWriter=null;
-   int threadNumber=0;
-   int totalScriptFiles=0;
-   int totalScriptFilesProcessed=0;
-   int totalSQLsProcessed=0;
-   int totalSQLErrors=0;
-   int totalSQLWarnings=0;
-   int totalConnections=0;
-   int seqNo=0;
-   Utils utils=null;
-   SignalHandler CTRLCHandler=null;
-   Signal INTSignal=null;
-   boolean isUserInterrupt=false;
-   ThreadGroup prunGroup=null;
-   List<Session> activeSessionLists=null;
-   StatusThread status=null;
-   int noOfArgs=0;
-   String[] args=null;
-   HTMLObject htmlObj = null;
-   XMLObject xmlObj = null;
-   boolean errorMsg = false;
-   Writer writeObj = null;
-   PrunSummary summaryObj = new PrunSummary();
-   Query qryObj=null;
-
-   final String TIMER_DEFAULT="60";
-   int timerValue = 60;
-   long endTime = 0;
-   long nowTime = 0;
-   boolean timerMode = false;
-   List<String> scriptsListBak=null;
-   int connDelta = 0;
-   
-   //Added for debugging prun
-   boolean prunDebug=false; 
-
-
-   ParallelRun()
-   {
-
-   }
-
-   ParallelRun(ConsoleReader crObj, ConsoleWriter cwObj,Properties lfProps,Session sessObj) throws IOException
-   {
-      threadNumber=0;
-      this.lfProps=lfProps;
-      this.sessObj=sessObj;
-      this.htmlObj = sessObj.getHtmlObj();
-      this.xmlObj = sessObj.getXmlObj();
-      this.crObj=crObj;
-      this.cwObj=cwObj;
-      this.summaryWriter=new FileWriter();
-      pui=new PrunUserInterruption();
-      utils=new Utils();
-      writeObj = sessObj.getWriter();
-      qryObj = sessObj.getQuery();
-      CTRLCHandler =new SignalHandler ()
-      {
-         public void handle(Signal sig)
-         {
-            isUserInterrupt=true;
-            if (prunGroup  != null)
-            {
-               status.beforeStatus="Cancelling";
-               status.afterStatus="Cancelled";
-            }
-            while (activeSessionLists !=null && activeSessionLists.size() > 0)
-            {
-
-               ((Session)(activeSessionLists.get(0))).setQueryInterrupted(true);
-               ((Session)(activeSessionLists.get(0))).setDBConnExists(false);
-               if (((Session)(activeSessionLists.get(0))).getCurrentStmtObj() != null)
-               {
-                  try
-                  {
-                     ((Statement)((Session)(activeSessionLists.get(0))).getCurrentStmtObj()).cancel();
-                  } catch (Exception e)
-                  {
-
-                  }
-               }
-               activeSessionLists.remove(0);
-            }
-         }
-      };
-      try {
-      INTSignal=new Signal("INT");
-      } catch (Exception e) {}
-
-      // get the maxservers allowed for the current datasource
-      // undocumented arg to disable calling getMaxServers(), -Dtrafci.prun.maxconn=n
-      int maxThreads=0;
-      String maxConn=System.getProperty("trafci.prun.maxconn");
-
-      try
-      {
-         if ((maxConn!=null) && ((maxThreads = Integer.parseInt(maxConn.trim() )) > MAX_THREADS ))
-            MAX_THREADS=maxThreads;
-         else
-            MAX_THREADS=getMaxServers();
-      } catch (NumberFormatException nfe)
-      {
-       	this.writePrunErrors(SessionError.INVALID_MAXCONN);
-         throw nfe;
-      }
-      MIN_THREADS = MAX_THREADS == 1 ? MAX_THREADS:MIN_THREADS;
-
-      String strTimerMode = System.getProperty("trafci.prun.timermode");
-      if ((strTimerMode!=null) &&  strTimerMode.equalsIgnoreCase("y"))
-      {
-         timerMode=true;
-         String strConnDelta = System.getProperty("trafci.prun.connection.delta");
-         if (strConnDelta != null)
-            connDelta = Integer.parseInt(strConnDelta);
-      }
-
-   }
-
-   public void execute() throws IOException, PrunUserInterruption, InvalidNumberOfArguments, UserInterruption
-   {
-      //Signal.handle(INTSignal, CTRLCHandler);
-      String queryStr = sessObj.getQuery().getQueryText();
-      queryStr = queryStr.replaceAll("\\s+"," ").trim();
-      boolean okay = validateArgs(queryStr);
-      if (!okay)
-      {
-         throw new PrunUserInterruption();
-      }
-
-      if (noOfArgs == 1)
-         getInputs();
-      try {
-      Signal.handle(INTSignal, CTRLCHandler);
-      }catch (Exception e) {}
-      
-      scriptsList=null;
-
-      scriptsList=new ArrayList<String>();
-
-      activeSessionLists=new ArrayList<Session>();
-
-      FilenameFilter filter = new FilenameFilter()
-      {
-         public boolean accept(File dir, String name)
-         {
-            if (System.getProperty("os.name").toUpperCase()
-                  .startsWith("WINDOW"))
-            {
-               return name.matches("(?i).*\\." + scriptsExt +"$" );
-            }
-            else
-            {
-               return name.endsWith("."+scriptsExt);
-            }
-         }
-         
-         
-       };
-
-      File dir=new File(scriptsDir);
-      File[] fl=dir.listFiles(filter);
-      //String separator=File.separator;
-      for (int i=0;i< fl.length; i++)
-      {
-         scriptsList.add(fl[i].getName().toString());
-      }
-
-      prunDebug = Boolean.getBoolean("trafci.prun.debug");
-      if (scriptsList.size() == 0)
-      {
-         if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-         {
-            htmlObj.init();
-            cwObj.println(htmlObj._beginTableTag);
-            cwObj.println(htmlObj._startCommentTag);
-            cwObj.println("No files present with this extension.");
-            cwObj.println(htmlObj._endCommentTag);
-            cwObj.println(htmlObj._endTableTag);
-         }
-         else if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-         {
-            xmlObj.init();
-            xmlObj.handleStartTags();
-            cwObj.println(xmlObj._beginStatusTag);
-            cwObj.println(xmlObj._beginCdataTag + "No files present with this extension." + xmlObj._endCdataTag);
-            cwObj.println(xmlObj._endStatusTag);
-            xmlObj.handleEndTags();
-         }
-         else
-         {
-            cwObj.println();
-            cwObj.println("No files present with this extension.");
-         }
-         return;
-      }
-
-      scriptsListBak=new ArrayList<String>(scriptsList);
-
-      totalScriptFiles=this.scriptsList.size();
-
-      try
-      {
-         String summaryDir=logsDir+File.separator+ "error" ;
-         if (!isValid(summaryDir,"dir","write"))
-         {
-            if (new File(summaryDir).mkdir())
-            {
-               if (!isValid(summaryDir,"dir","write"))
-               {
-                  summaryDir=logsDir;
-               }
-            }
-            else
-            {
-               summaryDir=logsDir;
-            }
-         }
-         summaryFile=summaryDir+File.separator+"prun.err.log";
-         String summaryTitle = "PRUN started at "+DateFormat.getDateTimeInstance().format(new Date());
-         if (!this.overwriteLogs)
-            summaryWriter.setAppend(true);
-         summaryWriter.initialize(summaryFile);
-         if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-         {
-            summaryWriter.writeln(htmlObj._beginTableTag);
-            summaryWriter.writeln(htmlObj._startCommentTag + summaryTitle + htmlObj._endCommentTag);
-            summaryWriter.writeln(htmlObj._beginRowTag);
-            summaryWriter.writeln(htmlObj._beginTblHeadTag +"Scripts directory " + htmlObj._endTblHeadTag);
-            summaryWriter.writeln(htmlObj._beginTblDataTag + this.scriptsDir + htmlObj._endTblDataTag);
-            summaryWriter.writeln(htmlObj._endRowTag);
-            summaryWriter.writeln(htmlObj._beginRowTag);
-            summaryWriter.writeln(htmlObj._beginTblHeadTag +"Logs directory " + htmlObj._endTblHeadTag);
-            summaryWriter.writeln(htmlObj._beginTblDataTag + this.logsDir + htmlObj._endTblDataTag);
-            summaryWriter.writeln(htmlObj._endRowTag);
-            summaryWriter.writeln(htmlObj._beginRowTag);
-            summaryWriter.writeln(htmlObj._beginTblHeadTag +"Logs overwritten " + htmlObj._endTblHeadTag);
-            summaryWriter.writeln(htmlObj._beginTblDataTag + (this.overwriteLogs ? "y":"n") + htmlObj._endTblDataTag);
-            summaryWriter.writeln(htmlObj._endRowTag);
-            summaryWriter.writeln(htmlObj._beginRowTag);
-            summaryWriter.writeln(htmlObj._beginTblHeadTag +"Number of connections " + htmlObj._endTblHeadTag);
-            summaryWriter.writeln(htmlObj._beginTblDataTag + this.connectionCnt + htmlObj._endTblDataTag);
-            summaryWriter.writeln(htmlObj._endRowTag);
-            if (timerMode)
-            {
-               summaryWriter.writeln(htmlObj._beginRowTag);
-               summaryWriter.writeln(htmlObj._beginTblHeadTag +"Time to run (mins) " + htmlObj._endTblHeadTag);
-               summaryWriter.writeln(htmlObj._beginTblDataTag + this.timerValue + htmlObj._endTblDataTag);
-               summaryWriter.writeln(htmlObj._endRowTag);
-            }
-         }
-         else if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-         {
-            summaryWriter.writeln(xmlObj._xmlNameSpaceTag);
-            summaryWriter.writeln(xmlObj._beginRootTag);
-            summaryWriter.writeln(xmlObj._beginCdataTag + summaryTitle + xmlObj._endCdataTag);
-            summaryWriter.writeln(xmlObj._beginScriptsDirTag + this.scriptsDir + xmlObj._endStriptsDirTag);
-            summaryWriter.writeln(xmlObj._beginLogsDirTag + this.logsDir + xmlObj._endLogsDirTag);
-            summaryWriter.writeln(xmlObj._beginLogsO + (this.overwriteLogs ? "y":"n") + xmlObj._endLogsO);
-            summaryWriter.writeln(xmlObj._beginConnTag + this.connectionCnt + xmlObj._endConnTag);
-            if (timerMode)
-               summaryWriter.writeln(xmlObj._beginMinTag + this.timerValue + xmlObj._endMinTag);
-
-         }
-         else
-         {
-            summaryWriter.write((utils.formatString("=",80,'=')));
-            summaryWriter.writeln();
-            summaryWriter.write(summaryTitle);
-            summaryWriter.writeln();
-            summaryWriter.write((utils.formatString("=",80,'=')));
-            summaryWriter.writeln();
-            summaryWriter.writeln();
-            summaryWriter.writeln("Scripts directory: "+this.scriptsDir);
-            summaryWriter.writeln("Logs directory: "+this.logsDir);
-            summaryWriter.writeln("Logs overwritten: "+ (this.overwriteLogs ? "y":"n") );
-            summaryWriter.writeln("Number of connections: "+this.connectionCnt);
-            if (timerMode)
-            {
-               summaryWriter.writeln("Time to run (mins): "+this.timerValue);
-               summaryWriter.writeln("Connection delay (secs): "+this.connDelta);
-            }
-            if (prunDebug)
-            {
-               summaryWriter.writeln();
-            }
-
-         }
-      }
-      catch (IOException ioe)
-      {
-         cwObj.println("Could not create the summary file.");
-         return;
-      }
-
-
-      prunGroup=new ThreadGroup("prgroup");
-      Thread prunThread=null;
-
-      status = new StatusThread(cwObj, sessObj);
-
-      // start the status thread
-      if (cwObj.getConsoleOut())
-         status.start();
-
-      if (this.connectionCnt > totalScriptFiles)
-      {
-         this.connectionCnt=totalScriptFiles;
-      }
-
-      sessObj.setQryStartTime();
-      for (int i=1; i <= this.connectionCnt ; i++)
-      {
-         if (this.scriptsList.size()== 0 || this.isUserInterrupt)
-            break;
-         prunThread =new Thread(prunGroup,this);
-         prunThread.setName("Thread"+i);
-         prunThread.start();
-
-         try
-         {
-            Thread.sleep(connDelta * 1000);
-
-         } catch (InterruptedException ie)
-         {
-         }
-
-      }
-      //this.start();
-
-      //Lets wait for all child threads to complete before proceeding further
-      Thread[] activeLists= new Thread[prunGroup.activeCount()];
-      int activeCounts=prunGroup.enumerate(activeLists);
-      for (int t=0;t < activeCounts; t++)
-      {
-         try
-         {
-            activeLists[t].join();
-         } catch (InterruptedException e)
-         {
-
-         }
-      }
-
-      // this loop is not required but need
-      while (prunGroup.activeCount() > 0)
-      {
-         status.stop=false;
-      }
-
-
-      status.stop=true;
-
-      if (cwObj.getConsoleOut())
-      {
-         try
-         {
-            status.join();
-         } catch (InterruptedException e)
-         {
-            // TODO Auto-generated catch block
-            //e.printStackTrace();
-         }
-         while (status.isAlive())
-         {
-
-         }
-      }
-
-      summaryObj.setTotalScriptFiles(this.totalScriptFiles);
-      summaryObj.setTotalScriptFilesProcessed(this.totalScriptFilesProcessed);
-      summaryObj.setTotalSQLsProcessed(this.totalSQLsProcessed);
-      summaryObj.setTotalSQLErrors(this.totalSQLErrors);
-      summaryObj.setTotalSQLWarnings(this.totalSQLWarnings);
-      summaryObj.setTotalConnections(this.totalConnections);
-      summaryObj.setTotalSQLSuccess(this.totalSQLsProcessed - this.totalSQLErrors);
-      summaryObj.setTotalConnectionFailures(this.connectionCnt - this.totalConnections);
-
-      sessObj.setQryEndTime();
-      String elapsedTime = writeObj.getElapsedTime(sessObj,qryObj,utils);
-      if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-      {
-         sessObj.getXmlObj().handlePrunSummary(cwObj,summaryObj, elapsedTime);
-      }
-      else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-      {
-         sessObj.getHtmlObj().handlePrunSummary(cwObj,summaryObj, elapsedTime);
-      }
-      else
-      {
-         cwObj.println();
-         cwObj.println("\t"+utils.formatString("_",45,'_'));
-         cwObj.println("\t"+utils.formatString("          PARALLELRUN(PRUN) SUMMARY",45,' '));
-         cwObj.println("\t"+utils.formatString("_",45,'_'));
-         cwObj.println("\t"+utils.formatString("Total files present ",45,'.',""+this.totalScriptFiles));
-         cwObj.println("\t"+utils.formatString("Total files processed ",45,'.',""+(this.totalScriptFilesProcessed)));
-         cwObj.println("\t"+utils.formatString("Total queries processed ",45,'.',""+this.totalSQLsProcessed));
-         cwObj.println("\t"+utils.formatString("Total errors ",45,'.',""+this.totalSQLErrors));
-         cwObj.println("\t"+utils.formatString("Total warnings ",45,'.',""+this.totalSQLWarnings));
-         cwObj.println("\t"+utils.formatString("Total successes ",45,'.',""+(this.totalSQLsProcessed-this.totalSQLErrors)));
-         cwObj.println("\t"+utils.formatString("Total connections ",45,'.',""+ (this.totalConnections) ));
-         cwObj.println("\t"+utils.formatString("Total connection failures ",45,'.',""+ (connectionCnt-this.totalConnections) ));
-         cwObj.println(SessionDefaults.lineSeperator + writeObj.getElapsedTime(sessObj,qryObj,utils));
-         cwObj.println();
-      }
-      if (this.totalSQLErrors > 0)
-      {
-         String errorLogInfo = "Please verify the error log file " + summaryFile + " for error summary.";
-         cwObj.println(formatSummaryStr(errorLogInfo));
-      } 
-      endPrunConsoleTags();
-      
-      if ((this.totalScriptFiles - this.scriptsList.size()) == 0)
-      {
-         String errorMsgStr = "";
-         if (errorMsg) 
-            errorMsgStr = "No script files have been processed. See preceeding error message(s).";
-         else
-            errorMsgStr = "No script files have been processed successfully.";
-
-         summaryWriter.writeln(formatSummaryStr(errorMsgStr));
-      }
-      else if ((this.totalScriptFiles - this.scriptsList.size()) < this.totalScriptFiles)
-      {
-         String scriptFileMsg ="";
-         if (errorMsg) 
-            scriptFileMsg = "Not all script files have been processed successfully. See preceeding error message(s).";
-         else
-            scriptFileMsg = "Not all script files have been processed successfully.";
-         
-         summaryWriter.writeln(formatSummaryStr(scriptFileMsg));
-      }
-      else
-      {
-         String finalMsg = "";
-         if (errorMsg)
-         {
-            finalMsg = "All the script files have been processed successfully. See preceeding error message(s).";
-         }
-         else if (this.totalSQLErrors == 0)
-         {
-            finalMsg = "All the script files have been processed successfully.";
-         }
-
-         summaryWriter.writeln(formatSummaryStr( finalMsg));
-      }
-
-      String summaryEnd = "PRUN completed at " + DateFormat.getDateTimeInstance().format(new Date());
-
-
-      if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-      {
-         sessObj.getXmlObj().handlePrunSummary(summaryWriter, summaryObj, summaryEnd, elapsedTime);
-      }
-      else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-      {
-         sessObj.getHtmlObj().handlePrunSummary(summaryWriter,summaryObj, summaryEnd, elapsedTime);
-      }
-      else
-      {
-         summaryWriter.writeln();
-         summaryWriter.writeln("\t"+utils.formatString("_",45,'_'));
-         summaryWriter.writeln("\t"+utils.formatString("          PARALLELRUN(PRUN) SUMMARY",45,' '));
-         summaryWriter.writeln("\t"+utils.formatString("_",45,'_'));
-         summaryWriter.writeln("\t"+utils.formatString("Total files present ",45,'.',""+this.totalScriptFiles));
-         summaryWriter.writeln("\t"+utils.formatString("Total files processed ",45,'.',""+(this.totalScriptFilesProcessed)));
-         summaryWriter.writeln("\t"+utils.formatString("Total queries processed ",45,'.',""+this.totalSQLsProcessed));
-         summaryWriter.writeln("\t"+utils.formatString("Total errors ",45,'.',""+this.totalSQLErrors));
-         summaryWriter.writeln("\t"+utils.formatString("Total warnings ",45,'.',""+this.totalSQLWarnings));
-         summaryWriter.writeln("\t"+utils.formatString("Total successes ",45,'.',""+(this.totalSQLsProcessed-this.totalSQLErrors)));
-         summaryWriter.writeln("\t"+utils.formatString("Total connections ",45,'.',""+ (this.totalConnections) ));
-         summaryWriter.writeln("\t"+utils.formatString("Total connection failures ",45,'.',""+ (connectionCnt-this.totalConnections) ));
-         summaryWriter.writeln();
-         summaryWriter.write((utils.formatString("=",80,'=')));
-         summaryWriter.writeln();
-         summaryWriter.write(summaryEnd);
-         summaryWriter.write(" " + elapsedTime);
-         summaryWriter.writeln();
-         summaryWriter.write((utils.formatString("=",80,'=')));
-         summaryWriter.writeln();
-      }
-
-      this.summaryWriter.close();
-      errorMsg = false;
-   }
-
-   private void getInputs() throws IOException, PrunUserInterruption, UserInterruption
-   {
-      cwObj.print(utils.formatString("Enter * as input to stop the current prun session",50,' '));
-      cwObj.println();
-      cwObj.println(utils.formatString("-",50,'-'));
-      cwObj.println();
-
-      while (true)
-      {
-         this.scriptsDir=getInput("Enter the scripts directory               :",null);
-
-         if (isValid(scriptsDir,"dir","read"))
-         {
-            scriptsDir = this.getCanonicalPath(scriptsDir);
-            break;
-         }
-         cwObj.println(SessionError.DIR_NOT_FOUND.errorMessage());
-         cwObj.println();
-
-      }
-
-      this.scriptsExt=getInput("Enter the script file extension["+SCRIPT_EXT+"]      :",SCRIPT_EXT);
-
-      while (true)
-      {
-         this.logsDir=getInput("Enter the logs directory[scripts dir]     :",this.scriptsDir);
-
-         if (isValid(logsDir,"dir","write"))
-         {
-            logsDir = this.getCanonicalPath(logsDir);
-            break;
-         }
-         cwObj.println(SessionError.DIR_NOT_FOUND.errorMessage());
-         cwObj.println();
-
-      }
-
-      while (true)
-      {
-         String overWriteVal=getInput("Overwrite the log files (y/n)[n]?         :","n");
-         if (overWriteVal.equalsIgnoreCase("y"))
-         {
-            this.overwriteLogs=true;
-            break;
-         }
-         else if (overWriteVal.equalsIgnoreCase("n"))
-         {
-            this.overwriteLogs=false;
-            break;
-         }
-         else
-         {
-            cwObj.println(SessionError.INCORRECT_OVERWRITE_OPTION.errorMessage());
-            cwObj.println();
-         }
-
-      }
-
-      while (true)
-      {
-         String connValue=getInput("Enter the number of connections("+ MIN_THREADS + "-" + utils.formatString(MAX_THREADS+")["+MIN_THREADS+"]",8,' ')+":",""+MIN_THREADS);
-         try
-         {
-            this.connectionCnt=Integer.parseInt(connValue);
-            if (this.connectionCnt >= MIN_THREADS && this.connectionCnt <= MAX_THREADS)
-            {
-               break;
-            }
-            cwObj.println(SessionError.PRUN_CONN_CNT_ERR.errorMessage());
-            cwObj.println();
-
-         }catch (NumberFormatException nfe)
-         {
-            cwObj.println("Invalid value specified for connections."+SessionDefaults.lineSeperator);
-         }
-
-      }
-
-      if (timerMode)
-      {
-         while (true)
-         {
-            String strTimerValue=getInput("Enter the time to run in minutes (0=single interation) ["+TIMER_DEFAULT+"]:",TIMER_DEFAULT);   //0=run to completion
-            try
-            {
-
-               timerValue= Integer.parseInt(strTimerValue);
-
-               if (timerValue >= 0)
-               {
-                  if (timerValue > 0)
-                  {
-                     this.endTime = (timerValue*1000*60) + System.currentTimeMillis();
-                     timerMode=true;
-                  }
-                  else
-                     timerMode=false;
-
-                  break;
-               }
-
-               cwObj.println("Invalid timer value");
-               cwObj.println();
-
-            }
-            catch (NumberFormatException nfe)
-            {
-
-            }
-
-         } //end while
-      }
-
-
-   }
-
-   private boolean isValid(String input,String type, String permissions)
-   {
-      if (input != null)
-      {
-         File file=new File(input);
-
-         if (!file.exists())
-         {
-            return false;
-         }
-         if ("dir".equals(type) && !file.isDirectory())
-         {
-            return false;
-         }
-         else if ("file".equals(type) && file.isDirectory())
-         {
-            return false;
-         }
-
-         if (("read".equals(permissions)) && !file.canRead())
-         {
-            return false;
-         }
-         if (("write".equals(permissions)) && !file.canWrite())
-         {
-            return false;
-         }
-         return true;
-
-      }
-      return false;
-   }
-
-   private String getInput(String requestString,String defaultVal) throws IOException, PrunUserInterruption, UserInterruption
-   {
-
-      cwObj.print((utils.formatString(requestString,46,' ')));
-      String input=crObj.getLine();
-      if ((input == null || input.trim().equals("")) && defaultVal != null)
-      {
-         input=defaultVal;
-      }
-      else if (input != null)
-      {
-         input=input.trim();
-      }
-      if ((input != null && input.equals("*")) || isUserInterrupt)
-      {
-         throw pui;
-      }
-
-      return input;
-   }
-
-   /*
-   *  Gets the number of connection available for parallelload
-   *  the maxthread value is set by the return value of this method
-   */
-   int getMaxServers()
-   {
-      boolean moreResults=false;
-      int defaultservercnt=MAX_THREADS;
-      Statement statement=null;
-      try
-      {
-         if ((statement=sessObj.getStmtObj()) != null)
-         {
-            moreResults=statement.execute("cfgcmd:INFO DS "+sessObj.getSessionDsn());
-         }
-
-         if (moreResults)
-         {
-            ResultSet resultSet=statement.getResultSet();
-            if (resultSet.next())
-               defaultservercnt=resultSet.getInt("MAX_SRVR_CNT");
-
-         }
-      }
-      catch (SQLException sqle)
-      {
-         //printAllExceptions(sqle);
-      }
-      return defaultservercnt;
-
-   }
-
-
-   public void run()
-   {
-
-      SessionInterface shareObj=new SessionInterface();
-      Session sessObjt=null;
-      ErrorObject errObj=null;
-      StringBuffer errBuf = new StringBuffer();
-      String threadName=currentThread().getName();
-      String logFile=null;
-      ArrayList<Vector<String>> errArr = new ArrayList<Vector<String>>();
-      Vector<String> errVec=null;
-
-
-      try
-      {
-         sessObjt=new Session(   this.sessObj.getSessionUser(),
-            this.sessObj.getSessionPass(),
-            this.sessObj.getSessionRole(),
-            this.sessObj.getSessionServer(),
-            this.sessObj.getSessionPort(),
-            this.sessObj.getSessionDsn(),
-            crObj,
-            cwObj);
-         // copy the required values from the main session
-         sessObjt.setSessionCtlg(this.sessObj.getSessionCtlg());
-         sessObjt.setSessionSchema(this.sessObj.getSessionSchema());
-         sessObjt.setSessionSQLTerminator(this.sessObj.getSessionSQLTerminator());
-         sessObjt.setSessionPrompt(this.sessObj.getPrompt());
-         sessObjt.setSessionTiming(this.sessObj.isSessionTimingOn());
-         sessObjt.setSessionTime(this.sessObj.isSessionTimeOn());
-         sessObjt.setSessionColSep(this.sessObj.getSessionColSep());
-         sessObjt.setListCount(this.sessObj.getListCount());
-         sessObjt.setStrDisplayFormat(this.sessObj.getStrDisplayFormat());
-         sessObjt.setMxosrvrVersion(this.sessObj.getMxosrvrVersion());
-         sessObjt.setSutVersion(this.sessObj.getSutVersion());
-         sessObjt.setT4verNum(sessObj.getT4verNum());
-         sessObjt.setSessionAutoPrepare(sessObj.isSessionAutoPrepare());
-         sessObjt.setSessionStatsEnabled(sessObj.isSessionStatsEnabled());
-
-         sessObjt= shareObj.createSession(sessObjt, 1, false);
-
-      } catch (FileNotFoundException e)
-      {
-    	  errObj=SessionError.SCRIPT_FILE_NOT_FOUND;
-         return;
-      } catch (SQLException e)
-      {
-         if (e.getErrorCode() == SessionDefaults.SQL_ERR_CONN_MAX_LIMIT)
-         {
-        	 errObj=SessionError.CONN_MAX_LIMIT_ERR;
-         }else
-         {
-			errObj = new ErrorObject(e.toString(), e.getErrorCode());
-         }
-
-         return;
-      } catch (InstantiationException e)
-      {
-    	  errObj=SessionError.DRIVER_INIT_ERR;
-         return;
-      } catch (IllegalAccessException e)
-      {
-    	  errObj=SessionError.DRIVER_INIT_ILLEGAL_ERR;
-         return;
-      } catch (ClassNotFoundException e)
-      {
-    	  errObj=SessionError.DRIVER_CLASS_ERR;
-         return;
-      } catch (IOException e)
-      {
-    	  errObj=new ErrorObject(SessionError.INTERNAL_ERR, "", " "+e.toString());
-         return;
-      }
-      finally
-      {
-         if (this.isUserInterrupt)
-         {
-            try
-            {
-
-               if (sessObjt.getConnObj() != null)
-               {
-                  sessObjt.getConnObj().close();
-               }
-            } catch (SQLException e)
-            {
-               //
-            }
-            sessObjt.setConnObj(null);
-            shareObj=null;
-            return;
-         }
-         if (errObj != null)
-         {
-            synchronized(this)
-            {
-               //if(this.summaryWriter !=null)
-               //this.summaryWriter.write(" Failed");
-               try
-               {
-                  this.summaryWriter.writeln();
-                  this.summaryWriter.writeln(DateFormat.getDateTimeInstance().format(new Date()) + " An error occurred in "+threadName+" when connecting to the database: "+errObj.errorMessage());
-                  errorMsg = true;
-               } catch (IOException e)
-               {
-
-               }
-            }
-         }
-         synchronized(this)
-         {
-            activeSessionLists.add(sessObjt);
-         }
-
-
-      } //end finally
-
-      this.totalConnections++;
-      //cwObj.println("\nConnection made for "+threadName);
-
-      while (true)
-      {
-
-         if (timerMode && ((nowTime=System.currentTimeMillis()) >= endTime))
-         {
-            //cwObj.println("\n" + threadName + " run time reached, terminating ..."); 
-            break;
-         }
-
-         logFile=null;
-         synchronized(this.scriptsList)
-         {
-            if (this.scriptsList.size() > 0)
-            {
-
-               if (this.isUserInterrupt)
-               {
-                  break;
-               }
-               String fileName=this.scriptsList.get(0).toString();
-               logFile=fileName+".log";
-               shareObj.setLogFile(this.logsDir+File.separator+logFile,this.overwriteLogs);
-               shareObj.setScriptFile(this.scriptsDir+File.separator+fileName);
-               this.scriptsList.remove(0);
-               this.totalScriptFilesProcessed++;
-               //debug information, prints the thread name and the script file it picks up for processing
-               if (prunDebug ){
-                  try
-                  {
-                     String debugMsg = DateFormat.getDateTimeInstance().format(new Date()) + ": Thread " + threadName +  " processing " + shareObj.getScriptFile();
-                     if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-                        this.summaryWriter.writeln(xmlObj._beginCdataTag + debugMsg + xmlObj._endCdataTag);
-                     else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)   
-                        this.summaryWriter.writeln(htmlObj._startCommentTag + debugMsg + htmlObj._endCommentTag);
-                     else
-                        this.summaryWriter.writeln( debugMsg );
-                  } catch (IOException ioEx)
-                  {
-                  }
-               }
-
-            }
-            else
-            { // no more files to process
-
-               if (timerMode)
-               {
-                  this.scriptsList.addAll(this.scriptsListBak);
-                  //cwObj.println("List addAll");
-                  continue;
-               }
-
-               break;
-            }
-         }
-         try
-         {
-            int sqlerrCnt=shareObj.getSqlErrorCount();
-            int sqlQueryCnt=shareObj.getSqlQueryCount();
-            int sqlWarningsCnt=shareObj.getSqlWarningsCount();
-            shareObj.invokeSession(sessObjt);
-            //if there are any error occurred in the current file ..write them in to the errBuf
-            if (shareObj.getSqlErrorCount() > sqlerrCnt || shareObj.getSqlWarningsCount() > sqlWarningsCnt)
-            {
-               errVec = new Vector<String>();
-               String scriptSqls=""+(shareObj.getSqlQueryCount() - sqlQueryCnt);
-               String scriptErrs=""+(shareObj.getSqlErrorCount() - sqlerrCnt);
-               String scriptWarns=""+(shareObj.getSqlWarningsCount() - sqlWarningsCnt);
-               if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT || sessObj.getDisplayFormat() == SessionDefaults.CSV_FORMAT)
-               {
-                  errBuf.append(utils.formatString(logFile,65,' ',"")+"  "+utils.formatString("",10,' ',""+scriptSqls)+"  "+utils.formatString("",7,' ',""+scriptErrs)+"  "+utils.formatString("",10,' ',""+scriptWarns));
-                  errBuf.append("####");
-               }
-               else
-               {
-                  errVec.add(0,logFile);
-                  errVec.add(1,scriptSqls);
-                  errVec.add(2, scriptErrs);
-                  errVec.add(3, scriptWarns);
-                  errArr.add(errVec);
-               }
-
-            }
-         } catch (IOException e)
-         {
-            // where to write this exception
-         }
-      }
-      try
-      {
-         //if(sessObjt.getConnObj() != null)
-         sessObjt.getConnObj().close();
-         sessObjt.setConnObj(null);
-      }catch (SQLException sqle)
-      {
-
-      }finally
-      {
-         sessObjt.setConnObj(null);
-         synchronized(this)
-         {
-            //this.totalScriptFilesProcessed++;
-            int sqlerrors=this.totalSQLErrors;
-            int sqlwarnings=this.totalSQLWarnings;
-            boolean isErrHeadPrinted=true;
-            this.totalSQLErrors+=shareObj.getSqlErrorCount();
-            this.totalSQLWarnings+=shareObj.getSqlWarningsCount();
-            if ((sqlerrors == 0 && this.totalSQLErrors != 0) || 
-                (sqlwarnings == 0 && this.totalSQLWarnings !=0) )
-            {
-               isErrHeadPrinted=false;
-            }
-            this.totalSQLsProcessed+=shareObj.getSqlQueryCount();
-            try
-            {
-               if (!isErrHeadPrinted)
-               {
-                  if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT || sessObj.getDisplayFormat() == SessionDefaults.CSV_FORMAT)
-                  {
-
-                     this.summaryWriter.writeln();
-                     this.summaryWriter.writeln("Check the following log files for the detailed error message.");
-                     this.summaryWriter.writeln(utils.formatString("-",4+65+27+8,'-'));  // 65 - size of the log file name + 27 - size of the remaining fields + 6 - spaces between the heading columns
-                     this.summaryWriter.writeln(utils.formatString("Seq#",4,' ',"")+"  "+utils.formatString("Log File Name",65,' ',"")+"  "+utils.formatString("",10,' ',"Total Qrys")+"  "+utils.formatString("",7,' ',"Errors")+"  "+utils.formatString("",10,' ',""+"Warnings"));
-                     this.summaryWriter.writeln(utils.formatString("-",4+65+27+8,'-',""));
-                  }
-                  else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-                  {
-                     this.summaryWriter.writeln(htmlObj._beginRowTag);
-                     this.summaryWriter.writeln(htmlObj._beginTblHeadTag + "Seq # " + htmlObj._endTblHeadTag);
-                     this.summaryWriter.writeln(htmlObj._beginTblHeadTag + "Logfile " + htmlObj._endTblHeadTag);
-                     this.summaryWriter.writeln(htmlObj._beginTblHeadTag + "Total Qrys" + htmlObj._endTblHeadTag);
-                     this.summaryWriter.writeln(htmlObj._beginTblHeadTag + "Errors" + htmlObj._endTblHeadTag);
-                     this.summaryWriter.writeln(htmlObj._beginTblHeadTag + "Warnings" + htmlObj._endTblHeadTag);
-                     this.summaryWriter.writeln(htmlObj._endRowTag);
-                  }
-                  isErrHeadPrinted=true;
-               }
-
-               if (errBuf.length() > 0)
-               {
-                  int newLineIdx=-1;
-
-                  while ((newLineIdx=errBuf.indexOf("####")) != -1)
-                  {
-                     this.seqNo++;
-                     this.summaryWriter.writeln(utils.formatString("",4,' ',this.seqNo+"")+"  "+errBuf.substring(0,newLineIdx).toString());
-                     errBuf.delete(0,newLineIdx+4);
-                  }
-               }
-               else
-               {
-                  for (int i=0; i< errArr.size();i++)
-                  {
-                     Vector<String> vect = errArr.get(i);
-                     this.seqNo++;
-                     if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-                     {
-                        this.summaryWriter.writeln(xmlObj._beginSeqIdTag + this.seqNo + xmlObj._endAttributeTag);
-                        this.summaryWriter.writeln(xmlObj._beginLogFileNameTag + vect.get(0).trim() + xmlObj._endLogFileNameTag);
-                        this.summaryWriter.writeln(xmlObj._beginTotalSqlsTag + vect.get(1).trim() + xmlObj._endTotalSqlsTag);
-                        this.summaryWriter.writeln(xmlObj._beginTotalErrors + vect.get(2).trim() + xmlObj._endTotalErrors);
-                        this.summaryWriter.writeln(xmlObj._beginTotalWarnings + vect.get(3).trim() +xmlObj._endTotalWarnings);
-                        this.summaryWriter.writeln(xmlObj._endSeqIdTag);
-                     }
-                     else if ((sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT))
-                     {
-                        this.summaryWriter.writeln(htmlObj._beginRowTag);
-                        this.summaryWriter.writeln(htmlObj._beginTblDataAlignTag + this.seqNo + htmlObj._endTblDataTag);
-                        this.summaryWriter.writeln(htmlObj._beginTblDataTag + vect.get(0) + htmlObj._endTblDataTag);
-                        this.summaryWriter.writeln(htmlObj._beginTblDataAlignTag +vect.get(1) + htmlObj._endTblDataTag);
-                        this.summaryWriter.writeln(htmlObj._beginTblDataAlignTag + vect.get(2)+ htmlObj._endTblDataTag);
-                        this.summaryWriter.writeln(htmlObj._beginTblDataAlignTag + vect.get(3) + htmlObj._endTblDataTag);
-                        this.summaryWriter.writeln(htmlObj._endRowTag);
-                     }
-                  }
-               }
-               errBuf=null;
-            } catch (IOException e)
-            {
-
-            }
-         }
-      }
-      sessObjt=null;
-
-
-
-   } //end run
-
-   public boolean validateArgs(String query) throws InvalidNumberOfArguments, IOException
-   {
-      if (query.endsWith(sessObj.getSessionSQLTerminator()))
-      {
-         query = query.substring(0, query.length()-sessObj.getSessionSQLTerminator().length());
-      }
-
-      setArgs(query.split(" "));
-
-      if (noOfArgs == 1)
-         return true;
-
-      if (sessObj.isDebugOn())
-    	  System.out.println("No.of args :: " + noOfArgs);
-      if (noOfArgs > 11)
-      {
-         //writeObj.writeln();
-         throw new InvalidNumberOfArguments();
-      }
-
-      //Set defaults for non-interactive mode
-      scriptsDir=System.getProperty("user.dir");
-      scriptsExt = SCRIPT_EXT;
-      connectionCnt = MIN_THREADS;
-
-      for (int i=1; i < noOfArgs; i++)
-      {
-         String value = null;
-         String option=this.args[i++].trim();
-
-         if (i < noOfArgs)
-         {
-            value=this.args[i].trim();
-         }
-         else
-         {
-            if (!option.equalsIgnoreCase("-d") && !option.equalsIgnoreCase("-defaults"))
-            {
-               //writeObj.writeln();
-               throw new InvalidNumberOfArguments();
-            }
-         }
-
-         if (option.equalsIgnoreCase("-sd")|| option.equalsIgnoreCase("-scriptsdir"))
-         {
-            scriptsDir=this.getCanonicalPath(value);
-         }
-         else if (option.equalsIgnoreCase("-e")|| option.equalsIgnoreCase("-extension"))
-         {
-            scriptsExt=value;
-         }
-         else if (option.equalsIgnoreCase("-ld")|| option.equalsIgnoreCase("-logsdir"))
-         {
-            logsDir=this.getCanonicalPath(value);
-         }
-         else if (option.equalsIgnoreCase("-o")|| option.equalsIgnoreCase("-overwrite"))
-         {
-            if (value.equalsIgnoreCase("y"))
-            {
-               this.overwriteLogs=true;
-            }
-            else if (value.equalsIgnoreCase("n"))
-            {
-               this.overwriteLogs=false;
-            }
-            else
-            {
-               this.writePrunErrors(SessionError.INCORRECT_OVERWRITE_OPTION);
-               return false;
-            }
-         }
-         else if (option.equalsIgnoreCase("-c")|| option.equalsIgnoreCase("-connections"))
-         {
-            try
-            {
-               connectionCnt = Integer.parseInt(value);
-            } catch (NumberFormatException nfe)
-            {
-               this.writePrunErrors(SessionError.INVALID_CONN_VALUE);
-               return false;
-            }
-         }
-         else if (option.equalsIgnoreCase("-m")|| option.equalsIgnoreCase("-minutes"))
-         {
-            if (!timerMode)
-            {
-                   this.writePrunErrors(new ErrorObject(SessionError.UNKOWN_OPTION, "" ,option));
-                   //If not in XML, HTML, or CSV markup mode, display help usage.
-                   if(sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-                        printUsage();
-               return (false);
-            }
-
-            timerValue = Integer.parseInt(value);
-
-         }
-         else if (option.equalsIgnoreCase("-d")|| option.equalsIgnoreCase("-defaults"))
-         {
-            if (noOfArgs > 2)
-            {
-             	this.writePrunErrors(SessionError.DEFAULT_OPTION_ERR);
-                //If not in XML, HTML, or CSV markup mode, display help usage.
-                if(sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-                       printUsage();
-               return (false);
-            }
-         }
-         else
-         {
-         	this.writePrunErrors(new ErrorObject(SessionError.UNKOWN_OPTION.errorCode(),SessionError.UNKOWN_OPTION.errorMessage()+ option));
-             //If not in XML, HTML, or CSV markup mode, display help usage.
-            if(sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-                printUsage();
-            return (false);
-         }
-
-      } //end for
-
-      if (!isValid(scriptsDir,"dir","read"))
-      {
-       	this.writePrunErrors(SessionError.SCRIPTS_DIR_NOT_FOUND);
-         return (false);
-      }
-
-      if (logsDir == null)
-         logsDir = scriptsDir;
-      else if (!isValid(logsDir,"dir","read"))
-      {
-       	this.writePrunErrors(SessionError.LOGS_DIR_NOT_FOUND);
-         return (false);
-      }
-
-      if (connectionCnt < MIN_THREADS || connectionCnt > MAX_THREADS)
-      {
-       	this.writePrunErrors(SessionError.PRUN_CONN_CNT_ERR);
-         return (false);
-      }
-
-      if (timerMode)
-      {
-         if (timerValue > 0)
-         {
-            endTime= (timerValue * 1000*60) + System.currentTimeMillis();
-         }
-         else if (timerValue < 0)
-         {
-            cwObj.println("Invalid timer value");
-            cwObj.println();
-            return (false);
-         }
-         else //timerValue=0
-         {
-            cwObj.println(SessionDefaults.lineSeperator+"Timer mode ignored, -m is 0"+SessionDefaults.lineSeperator);
-            timerMode = false;
-         }
-
-      }
-
-      if (cwObj.getConsoleOut())
-      {
-         cwObj.println(SessionDefaults.lineSeperator+"PRUN options are -scriptsdir  " + scriptsDir +
-            SessionDefaults.lineSeperator+"                 -logsdir     " + logsDir +
-            SessionDefaults.lineSeperator+"                 -extension   " + scriptsExt +
-            SessionDefaults.lineSeperator+"                 -overwrite   " + (this.overwriteLogs ? "y":"n") +
-            SessionDefaults.lineSeperator+"                 -connections " + connectionCnt);
-
-         if (timerMode)
-            cwObj.println(SessionDefaults.lineSeperator+"                 -minutes     " + timerValue );
-      }
-
-      return (true);
-
-
-   } //end validateArgs
-
-   private void setArgs(String[] args)
-   {
-      noOfArgs=args.length;
-      this.args=args;
-   }
-
-   private String getCanonicalPath(String fileName)
-   {
-      File file = new File(fileName);
-
-      try
-      {
-         return (file.getCanonicalPath());
-      }catch (IOException io)
-      {
-
-      }
-      return (fileName);
-   }
-
-   public void printUsage() throws IOException
-   {
-      writeObj.writeln();
-      writeObj.writeln("prun -sd|scriptsdir <directory-name> -e|extension <extension> ");
-      writeObj.writeln("     -ld|logsdir <directory-name>  -o|overwrite {y|n} ");
-      writeObj.writeln("     -c|connections <no-of-connections>" );
-      if (timerMode)
-         writeObj.writeln("     -m|minutes <no-of-minutes>" );
-
-      writeObj.writeln();
-      writeObj.writeln("\t----- OR -----");
-      writeObj.writeln();
-      writeObj.writeln("prun -d|defaults");
-      writeObj.writeln();
-      writeObj.writeln("where:");
-      writeObj.writeln("\t-defaults \tspecifies default values for all the options.");
-      writeObj.writeln("\t-scriptsdir \tspecifies the directory containing the script files.");
-      writeObj.writeln("\t-extension \tspecifies the extension of script files.");
-      writeObj.writeln("\t-logsdir \tspecifies the directory where logs files are created.");
-      writeObj.writeln("\t-overwrite \tspecifies if the log files have to be overwritten.");
-      writeObj.writeln("\t-connections \tspecifies the number of connections.");
-      if (timerMode)
-      {
-         writeObj.writeln("\t-minutes \tspecifies the time to run test.");
-         writeObj.writeln();
-         writeObj.writeln("\t[ optional property -Dtrafci.prun.connection.delta=n ]");
-      }
-   }
-
-   private String formatSummaryStr(String msg) 
-   {
-      String summaryStr = null;
-      if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-      {
-         summaryStr = xmlObj._beginCdataTag + msg + xmlObj._endCdataTag;
-      }
-      else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-      {
-         summaryStr = htmlObj._startCommentTag + msg + htmlObj._endCommentTag;
-      }
-      else
-      {
-         summaryStr = "\t" + msg + SessionDefaults.lineSeperator;
-      }
-      return summaryStr;
-   }
-   
-   private void writePrunErrors(ErrorObject prunError) throws IOException
-   {
-       if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-           writeObj.writeln();
-       
-       writeObj.writeInterfaceErrors(this.sessObj, prunError);
-   }
-
-   private void endPrunConsoleTags() 
-   {
-      if (sessObj.getDisplayFormat() == SessionDefaults.XML_FORMAT)
-      {
-         cwObj.println(xmlObj._endRootTag);
-         xmlObj._beginRootElement = false;
-      }
-      else if (sessObj.getDisplayFormat() == SessionDefaults.HTML_FORMAT)
-      {
-         cwObj.println(htmlObj._endTableTag);
-         htmlObj._startTags = false;
-      }
-   }
-   
-} //end class

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ParamStringObject.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ParamStringObject.java b/core/conn/trafci/src/org/trafodion/ci/ParamStringObject.java
deleted file mode 100644
index 263b98a..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ParamStringObject.java
+++ /dev/null
@@ -1,256 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-
-import java.io.UnsupportedEncodingException;
-
-
-
-/**
- *  Implementation of a CI or SQL parameter value.
- *
- *
- */
-public class ParamStringObject {
-
-
-   /**
-    *  Member variables containing the charset name, is hexadecimal value and
-    *  actual parameter value string specified.
-    */
-   private  String  _charsetName  = null;
-   private  String  _hexPrefixStr = null;
-   private  String  _inputValue   = null;
-
-
-   /**
-    *  Boolean flag indicating whether or not the input value is in hex.
-    */
-   private  boolean _isHexInput   = false;
-
-
-
-   /**
-    *  Default Parameter value constructor.
-    *
-    *  @param   charsetName  The character set name
-    *  @param   hexInput     Prefix if the parameter value is in hex (x'')
-    *  @param   theValue     The actual parameter value
-    *
-    *  @since   R2.4 SP2
-    *
-    */
-   public ParamStringObject(String charsetName, String hexInputPrefix,
-                           String theValue) {
-      this._charsetName  = charsetName;
-      this._hexPrefixStr = hexInputPrefix;
-      this._inputValue   = theValue;
-
-      if (null != this._hexPrefixStr) {
-         this._hexPrefixStr = this._hexPrefixStr.trim();
-
-         if (this._hexPrefixStr.toLowerCase().equals("x") )
-            this._isHexInput = true;
-
-      }
-
-
-   }  /*  End of  ParamStringValue  Constructor.  */
-
-
-
-   /**
-    *  Returns the character set name specified for this parameter value.
-    *
-    *  @return  the SQL character set name
-    *
-    */
-   public  String  getCharacterSetName() {
-      return  this._charsetName;
-
-   }  /*  End of  getCharacterSetName  method.  */
-
-
-
-   /**
-    *  Returns the evaluated parameter value -- any hex input is converted.
-    *
-    *  @return  the evaluated parameter value.
-    *  @since   R2.4 SP2
-    *
-    */
-   public  String  getParameterValue()  throws Exception {
-      /**
-       *  Trim out the quotes.
-       */
-      String  theInput = this._inputValue.trim();
-      if (theInput.startsWith("'")  &&  theInput.endsWith("'") )
-         theInput = theInput.substring(1, theInput.length() - 1);
-
-
-      /**
-       *  If its plain and simple text -- return it as is.
-       */
-      if (!this._isHexInput)
-         return  theInput;
-
-
-      /**
-       *  For hexadecimal values, trim out the spaces inside the quotes.
-       */
-      theInput = theInput.trim();
-
-
-      /**
-       *  Okay its a hexadecimal stream that we need to convert.
-       */
-      String[] inputBits = theInput.split(" ");
-      String  retValue = ""; 
-      int lengthOfInputByte = 0;
-      for (int i = 0; i < inputBits.length; i++) {
-    	  if (inputBits[i].length() % 2 == 1)
-    		  throw new Exception("'" + theInput + "' is not a valid "
-						+ "character encoding value. ");
-    	  lengthOfInputByte += inputBits[i].length() / 2;
-		}
-      byte[] inputByte = new byte[lengthOfInputByte];
-      int inputPos = 0;
-
-      for (int idx = 0; idx < inputBits.length; idx++) {
-    	  String aChunk = inputBits[idx];
-    	  int length = aChunk.length() & -4;
-		  if (this._charsetName == null
-					|| (!this._charsetName.equalsIgnoreCase("_UCS2") && !this._charsetName
-							.equalsIgnoreCase("_UTF8"))) {
-    		  do {
-    	          	 String bitVal = aChunk;
-    	          	 if (4 < aChunk.length() )  {
-    	          		 bitVal = aChunk.substring(0, 4);
-    	          		 aChunk = aChunk.substring(4, aChunk.length() );
-    	             } else
-    	                aChunk = "";
-    	          	 
-    	             try {
-    	                int val = Integer.parseInt(bitVal, 16);
-    	                
-    	                byte  b1 = (byte) (val & 0xFF);
-    	                byte  b2 = (byte) ((val >> 8) & 0xFF);
-    	                byte  b3 = (byte) ((val >> 16) & 0xFF);
-    	                byte  b4 = (byte) ((val >> 24) & 0xFF);
-
-    	                if ((0 != b4) ||  (0 != b3) )
-    	                   retValue += new String(new byte[] { b4, b3, b2, b1 } );
-    	                else if (0 != b2) 
-    	                   retValue += new String(new byte[] { b2, b1 } );
-    	                else
-    	                   retValue += new String(new byte[] { b1 });
-    	             } catch(Exception e) {
-    	            	 throw new Exception("'" + inputBits[idx]
-    	            	         							+ "' is not a valid " + "hexadecimal value. ");
-    	             }
-    		  } while (0 < aChunk.length() );
-    	  }/**
-    	    * for UTF-8
-		    * modify to fix the defect CRID1331
-		    */
-			else if (this._charsetName.equalsIgnoreCase("_UTF8")) {
-				for (int pos = 0; pos < aChunk.length(); pos += 2) {
-					try {
-						int val = Integer.parseInt(
-								aChunk.substring(pos, pos + 2), 16);
-						inputByte[inputPos++] = (byte) (val & 0xFF);
-					} catch (NumberFormatException NF_Ex) {
-						throw new Exception("'" + aChunk + "' is not a valid "
-								+ "hexadecimal value. ");
-					}
-					//when it comes to the end of the bits, convert it
-					if (idx == inputBits.length - 1
-							&& pos == aChunk.length() - 2)
-						try {
-							retValue = new String(inputByte, "UTF8");
-						} catch (UnsupportedEncodingException e) {
-							throw new Exception(
-									"The input hexadecimal is not a valid UTF-8 hexadecimal value. ");
-						}
-				}
-			}else{ // UCS2
-    		  /**
-        	   * set Param is used to set ucs2 values. CI gives wrong data
-        	   * Internal Analysis: by shifting all low bits to right causes UCS2 hex
-        	   * to get the first byte chopped off & turn into invalid character
-        	   * Fix Description: simply convert hex values to String
-        	   */
-    		  for ( int pos=0; pos < length; pos += 4) {
-        		  int this_char = 0;
-        		  try { 
-                	   this_char = Integer.parseInt( aChunk.substring( pos,pos+4), 16);
-        		  }
-        		  catch ( NumberFormatException NF_Ex) { 
-        			  throw new Exception("'" 
-        			     + aChunk + "' is not a valid " + "hexadecimal value. ");
-        		  }
-        		  retValue += (char) this_char;
-               }
-    	  }
-      }  /*  End of  FOR  loop  for all the parts in the input.  */
-      
-      return  retValue;
-
-   }  /*  End of  getParameterValue  method.  */
-
-
-
-
-   /**
-    *  Returns the Stringified form of this parameter value.
-    *
-    *  @return  the stringified form of this parameter value.
-    *  @since   R2.4 SP2
-    *
-    */
-   public String toString() {
-      String theValue = null;
-
-      if (null != this._charsetName)
-         theValue = this._charsetName.toUpperCase();
-
-      if (null == theValue)
-         theValue = this._hexPrefixStr;
-      else if (null != this._hexPrefixStr)
-         theValue += " " + this._hexPrefixStr;
-
-
-      if (null == theValue)
-         theValue = this._inputValue;
-      else
-         theValue += this._inputValue;
-
-      return  theValue;
- 
-   }  /*  End of  toString  method.  */
-
-
-
-}  /*  End of  class  ParamStringValue.  */
-
-


[30/38] incubator-trafodion git commit: replace env.TRAFODION_VER with TRAFODION_VER

Posted by li...@apache.org.
replace env.TRAFODION_VER with TRAFODION_VER


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

Branch: refs/heads/master
Commit: abb23ee423dfe5d49959f9c7689d2de1d8fb9903
Parents: 3894730
Author: AlexPeng19 <al...@hotmail.com>
Authored: Tue Nov 22 16:44:09 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Tue Nov 22 16:44:09 2016 +0800

----------------------------------------------------------------------
 core/conn/trafci/installer_pom.xml | 6 +++---
 core/conn/trafci/pom.xml           | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/abb23ee4/core/conn/trafci/installer_pom.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/installer_pom.xml b/core/conn/trafci/installer_pom.xml
index 3fee491..a2399ed 100644
--- a/core/conn/trafci/installer_pom.xml
+++ b/core/conn/trafci/installer_pom.xml
@@ -26,12 +26,12 @@
 	<groupId>org.trafodion</groupId>
 	<artifactId>trafciInstaller</artifactId>
 	<packaging>jar</packaging>
-	<version>${env.TRAFODION_VER}</version>
+	<version>${TRAFODION_VER}</version>
 	<name>Trafodion Trafci</name>
 	<properties>
 		<basedir>.</basedir>
-		<traf-jdbc-version>${env.TRAFODION_VER}</traf-jdbc-version>
-		<trafci-version>${env.TRAFODION_VER}</trafci-version>
+		<traf-jdbc-version>${TRAFODION_VER}</traf-jdbc-version>
+		<trafci-version>${TRAFODION_VER}</trafci-version>
 	</properties>
 	<build>
 		<finalName>trafciInstaller</finalName>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/abb23ee4/core/conn/trafci/pom.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/pom.xml b/core/conn/trafci/pom.xml
index 2a223c7..7f74250 100644
--- a/core/conn/trafci/pom.xml
+++ b/core/conn/trafci/pom.xml
@@ -26,12 +26,12 @@
 	<groupId>org.trafodion</groupId>
 	<artifactId>trafci</artifactId>
 	<packaging>jar</packaging>
-	<version>${env.TRAFODION_VER}</version>
+	<version>${TRAFODION_VER}</version>
 	<name>Trafodion Trafci</name>
 	<properties>
 		<jettyVersion>9.2.6.v20141205</jettyVersion>
-		<traf-jdbc-version>${env.TRAFODION_VER}</traf-jdbc-version>
-		<trafci-version>${env.TRAFODION_VER}</trafci-version>
+		<traf-jdbc-version>${TRAFODION_VER}</traf-jdbc-version>
+		<trafci-version>${TRAFODION_VER}</trafci-version>
 	</properties>
 	<dependencies>
 		<dependency>


[05/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/QueryWrapper.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/QueryWrapper.java b/core/conn/trafci/src/org/trafodion/ci/QueryWrapper.java
deleted file mode 100644
index 75086c5..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/QueryWrapper.java
+++ /dev/null
@@ -1,700 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.awt.FontMetrics;
-import java.io.IOException;
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-
-import org.trafodion.jdbc.t4.TrafT4Statement;
-
-
-
-import sun.misc.Signal;
-import sun.misc.SignalHandler;
-
-/**
- * 
- * 
- * Abstract class for executing queries and formatting the result sets.
- *
- */
-
-public abstract class QueryWrapper
-{
-
-   Session sessObj=null;
-   Writer writer=null;
-   Reader reader=null;
-   Query qryObj=null;
-   String queryStr=null;
-   Parser parser=null;
-   Connection conn=null;
-   Statement stmt=null;
-   Utils utils=null;
-   UnKnownInterfaceCommand uic=null;
-   InterfaceSyntaxError ise=null;
-   ConditionalQueryException cqe=null;
-   ConditionalSyntaxError cse=null;
-   UserInterruption ui=null;
-   boolean isMultiLine=true;
-   boolean blankLiner=true;
-   SignalHandler CTRLCHandler=null;
-   Signal INTSignal=null;
-   int i = 0;
-   HTMLObject htmlObj = null;
-   XMLObject xmlObj = null;
-   String columnName="";
-   int colCount=1;
-   String crTrigTerminator ="/";
-   FontMetrics fontMetrics = null;
-   protected int isoMapping;
-   boolean useGetUpdateCount64 = true;
-   // false-show complete msg, true-no show
-   public boolean showStatusMsg = false;
-   
-   int[] colSize   ={};
-   int[] colAlign  ={};
-   String[] columnNameArray={};   
-   
-   /**
-   * creates an empty constructor.
-   *
-   */
-   QueryWrapper()
-   {
-
-   }
-
-   /**
-   * creates the query wrapper for t
-   */
-   QueryWrapper(Session sessObj)
-   {
-      this.sessObj=sessObj;
-      this.parser=new Parser();
-      this.utils=new Utils();
-      this.uic=new UnKnownInterfaceCommand();
-      this.ise=new InterfaceSyntaxError();
-      this.cqe=new ConditionalQueryException();
-      this.cse=new ConditionalSyntaxError();
-      this.ui=new UserInterruption();
-      if (sessObj.getCaller() != SessionDefaults.PRUNI)
-      {
-         CTRLCHandler =new SignalHandler ()
-         {
-            public void handle(Signal sig)
-            {
-               cancelQuery();
-            }
-         };
-         try {
-         INTSignal=new Signal("INT");
-         } catch (Exception e) {}
-      }
-      
-      fontMetrics = MultiByteUtils.getFontMetrics();
-      isoMapping = sessObj.getISOMapping();
-    
-      
-   }
-
-
-   /**
-   * Initializes the reader and writer objects
-   *
-   */
-   void init()
-   {
-      this.writer=sessObj.getWriter();
-      this.reader=sessObj.getReader();
-      this.qryObj=sessObj.getQuery();
-      this.conn=sessObj.getConnObj();
-      this.stmt=sessObj.getStmtObj();
-      try {
-         if (CTRLCHandler != null)
-         {
-            Signal.handle(INTSignal, CTRLCHandler);
-         }
-      }catch (Exception e) {}
-      sessObj.setCurrentStmtObj(null);
-
-   }
-
-
-
-   /**
-   * Reads the query string from the console or from a file depending on the 
-   * read mode.
-   * @throws IOException
-   * @throws UserInterruption 
-   */
-   void readQuery() throws IOException, UserInterruption
-   {
-      boolean matchTrigStmt=false;
-      String[] qryLineArr = null;
-      //queryStr=qryObj.getQueryText().trim();
-      queryStr=qryObj.getQueryText();
-
-      try {
-         if (CTRLCHandler != null)
-         {
-            Signal.handle(INTSignal, CTRLCHandler);
-         }
-      }catch (Exception e) {}
-
-      matchTrigStmt = isCreateTriggerCmd(qryObj.getQueryText());
-      //This is needed if user does a repeat
-      //on create trigger
-      if ((matchTrigStmt) && (queryStr.indexOf(SessionDefaults.lineSeperator) != -1))
-      {
-         qryLineArr = queryStr.split(SessionDefaults.lineSeperator);
-         if (qryLineArr[qryLineArr.length-1].equals(crTrigTerminator))
-         {
-            isMultiLine = false;
-         }
-      }
-
-      while (isMultiLine)
-      {
-         if ((matchTrigStmt)&& (utils.rtrim(queryStr).equals(crTrigTerminator)))
-            break;
-         else if ((!matchTrigStmt) && (queryStr.trim().toUpperCase().endsWith(sessObj.getSessionSQLTerminator())))
-            break;
-         if (( (writer.getWriterMode() == SessionDefaults.CONSOLE_WRITE_MODE ||
-            writer.getWriterMode() == SessionDefaults.CONSOLE_SPOOL_WRITE_MODE))  )
-         {
-            if((reader.getReadMode() == SessionDefaults.OBEY_READ_MODE  && !sessObj.isQuietEnabled()) || !(reader.getReadMode() == SessionDefaults.OBEY_READ_MODE) )            
-                writer.getConsoleWriter().print(sessObj.getSessionCprompt());
-         }
-         try
-         {
-           
-            queryStr = reader.getNonBlankLine();
-            if (sessObj.isCmdEchoEnabled())
-               writer.getConsoleWriter().println(queryStr);
-         }
-         catch (UserInterruption ui)
-         {
-            sessObj.setQuery(null);
-            sessObj.setQueryInterrupted(false);
-            throw ui;
-         }
-
-         if ((queryStr == null))
-         {
-            if (matchTrigStmt)
-               queryStr = crTrigTerminator;
-            else
-               queryStr=sessObj.getSessionSQLTerminator();
-         }
-
-         if (writer.getWriterMode() == SessionDefaults.LOG_WRITE_MODE)
-            writer.getLogWriter().writeln(queryStr);
-         else if (reader.getReadMode() == SessionDefaults.CONSOLE_READ_MODE && writer.getWriterMode() == SessionDefaults.CONSOLE_SPOOL_WRITE_MODE)
-         {
-            if (sessObj.isLogCmdText())
-               writer.getSpoolWriter().writeln(queryStr);
-         }else if ((reader.getReadMode() == SessionDefaults.OBEY_READ_MODE ) || ( sessObj.getCaller() !=SessionDefaults.PRUNI && reader.getReadMode() == SessionDefaults.SCRIPT_READ_MODE ))
-         {
-            writer.getConsoleWriter().println(queryStr);
-            if (sessObj.isLogCmdText() && writer.getWriterMode() == SessionDefaults.CONSOLE_SPOOL_WRITE_MODE)
-               writer.getSpoolWriter().writeln(queryStr);
-         }
-
-         queryStr=parser.ignoreComments(queryStr);
-         qryObj.setQueryText(SessionDefaults.lineSeperator+queryStr);
-         matchTrigStmt = isCreateTriggerCmd(qryObj.getQueryText());
-
-         //queryStr=queryStr.trim();
-      }
-      sessObj.setTimerHold();
-      if ((blankLiner) && (sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT))
-      {
-          writer.writeln();
-      }
-      if (matchTrigStmt)
-      {
-         this.queryStr = Utils.trimSQLTerminator(sessObj.getQuery().getQueryText().trim(),"/");
-         isMultiLine = true;
-      }
-      else
-         this.queryStr = Utils.trimSQLTerminator(sessObj.getQuery().getQueryText().trim(),sessObj.getSessionSQLTerminator());
-      
-      this.queryStr = utils.rtrim(this.queryStr);
-      if (qryObj.getQueryType()==SessionDefaults.SQLQ)
-         sessObj.setPrevSQLQuery(this.queryStr);
-      parser.setRemainderStr(null);
-      parser.setRemainderStr(this.queryStr);
-
-      this.fixPopIndxUpdStatsCmds();
-   }
-   
-   protected void setQueryRowCount(Statement theStmt) throws SQLException
-   {
-       if(!useGetUpdateCount64){
-           qryObj.setRowCount(String.valueOf(theStmt.getUpdateCount()));
-           return;
-       }
-           
-       try
-       {
-           qryObj.setRowCount(String.valueOf(((TrafT4Statement)theStmt).getUpdateCount64())); 
-       }
-       catch(NoSuchMethodError nsme)
-       {
-           // for backwards compatibility
-           useGetUpdateCount64 = false;
-           qryObj.setRowCount(String.valueOf(theStmt.getUpdateCount()));
-       }
-    }
-
-   boolean isCreateTriggerCmd(String qryText)
-   {
-      if (qryText.toUpperCase().matches("(?s)^\\s*CREATE\\s+TRIGGER\\s+(.*)"))
-      {
-         return true;
-      }
-      return false;
-   }
-
-   void fixPopIndxUpdStatsCmds()
-   {
-      if ((qryObj.getQueryText().toUpperCase().matches("(?s)^\\s*POPULATE\\s+INDEX\\s+(.*)"))  
-         )
-      {
-         queryStr = queryStr.replaceAll(SessionDefaults.lineSeperator," ");
-      }
-   }
-   
-   /**
-   * cancels the current query if ctrl + C is pressed. 
-   * 
-   */
-   void cancelQuery()
-   {
-      sessObj.setQueryInterrupted(true);
-      if (sessObj.getCurrentStmtObj() != null)
-      {
-         try
-         {
-            ((Statement)sessObj.getCurrentStmtObj()).cancel();
-              sessObj.setDBConnExists(false);
-              if (sessObj.isDotModeCmd() ){
-            	sessObj.setLogCmdEcho(true);
-            	sessObj.setMode(sessObj.getPrevMode());
-              }
-         } catch (SQLException e){}
-      }
-      
-   }
-
-
-
-   public abstract void execute() throws IOException, SQLException, UnKnownInterfaceCommand, UserInterruption, ConditionalQueryException ;
-
-   boolean dbExecute(Object st ) throws SQLException, IOException
-   {
-	   boolean status=false;
-
-      try {
-         if (CTRLCHandler != null)
-         {
-            Signal.handle(INTSignal, CTRLCHandler);
-         }
-      }catch (Exception e) {}
-
-      try
-      {
-
-         sessObj.setCurrentStmtObj(st);
-         sessObj.setQueryInterrupted(false);
-
-         if (st instanceof CallableStatement)
-         {
-            status=((CallableStatement)st).execute();
-            sessObj.setSPJRS(status);
-         }else if (st instanceof PreparedStatement)
-         {
-            status=((PreparedStatement)st).execute();
-         }
-         else if (st instanceof Statement)
-         {
-            status=((Statement)st).execute(queryStr);
-         }
-
-      }catch (SQLException sqle)
-      {
-         if (sessObj.isQueryInterrupted() && sqle.getErrorCode() == -29157)
-         {
-            sessObj.setDBConnExists(false);
-
-         }
-         throw sqle;
-      }
-	   sessObj.setQryExecEndTime();
-	   
-      return status;
-   }
-   
-   boolean dbExec(Object st) throws SQLException, IOException
-   {
-	   boolean status = dbExecute(st);
-	   
-	   /*if (sessObj.getMode() == SessionDefaults.SQL_MODE &&
-	         writer != null &&
-	         qryObj.getQueryType() != SessionDefaults.IQ)
-	         writer.writeExecutionTime(sessObj, utils, writer);
-           */	   
-	   return status;
-   }
-
-   void writeSeparator() throws IOException
-   {
-      if (sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
-         write(sessObj.getSessionColSep());
-      write(sessObj.getSessionColSep());
-   }
-
-   void write(String output) throws IOException
-   {
-      switch (sessObj.getDisplayFormat())
-      {
-         //HTML Format
-         case SessionDefaults.HTML_FORMAT:
-            sessObj.getHtmlObj().processHtml(output);
-            writer.writeln();
-            break;
-
-         //XML Format
-         case SessionDefaults.XML_FORMAT:
-            sessObj.getXmlObj().processXml(this.columnName,output);
-            writer.writeln();
-            break;
-
-         //CSV Format
-         case SessionDefaults.CSV_FORMAT:
-            writer.write(output);
-            if (qryObj.getColCount() != null)
-            {
-               if (colCount == Integer.parseInt(qryObj.getColCount()))
-               {
-                  writer.write(SessionDefaults.lineSeperator);
-                  colCount=1;
-                  break;
-               }
-            }
-            colCount++;
-            if (sessObj.getStrDisplayFormat().equalsIgnoreCase("COLSEP"))
-               writer.write(sessObj.getSessionColSep());
-            else
-               writer.write(",");
-            break;
-
-         //Default Raw Format
-         default: writer.write(output);
-            break;
-      }
-   }
-
-
-   void writeln(String output) throws IOException
-   {
-      write(output);
-      write(SessionDefaults.lineSeperator);
-   }
-
-   void writeln() throws IOException
-   {
-      write(SessionDefaults.lineSeperator);
-   }
-
-   void formatOutput(String output,int colWidth,char fillchar,int align) throws IOException
-   {
-
-     int outputStrLen = 0;
-      
-      if (output != null && output.length() > colWidth)
-      {
-         output=output.substring(0,colWidth);
-      } 
-      StringBuffer outBuffer=new StringBuffer(output);
-
-      if (sessObj.isMultiByteAlign() && (isoMapping == 10 || isoMapping == 15)) //SJIS or UTF8
-      {
-         try {
-         outputStrLen = getMultiByteColWidth(outBuffer);
-         }catch (Exception ex)
-         {
-            ex.printStackTrace();
-            throw new IOException(ex.getMessage());
-         }
-      }
-      else
-      {
-         outputStrLen = outBuffer.length();
-      }
-      //If the output is greater than the column width,
-      //truncate the output
-      
-      if (outputStrLen > colWidth)
-      {
-         outBuffer = new StringBuffer(outBuffer.substring(0,Math.min(colWidth, outBuffer.length())));
-         outputStrLen = outBuffer.length();
-      }
-
-      if ( outputStrLen <= colWidth)
-      {
-    	 if (colWidth > 128)
-    		 colWidth = 128;
-         for (int i=outputStrLen;i<colWidth;i++)
-         {
-            if (align == 0)
-            {
-               outBuffer.append(fillchar);
-            }
-            else
-            {
-               outBuffer.insert(0,fillchar);
-            }
-         }
-
-         write( outBuffer.toString());
-
-      }
-      outBuffer=null;
-   }
-
-   void formatHtmlOutput(String output) throws IOException
-   {
-      write(output);
-   }
-
-   void formatXmlOutput(String columnName, String output) throws IOException
-   {
-      this.columnName = columnName;
-      write(output);
-   }
-
-   void formatCsvOutput(String output) throws IOException
-   {
-      write(output);
-   }
-
-   protected int getMultiByteColWidth(StringBuffer output)
-   {
-      if (null == fontMetrics)
-         return output.length();
-      
-      int refWidth = fontMetrics.charWidth('w');
-      int width=0;
-     
-       for (int i=0; i< output.length(); i++)
-      {
-         int tmpLen=fontMetrics.charWidth(output.charAt(i));
-         //incorrect value of char width. Treat it as no-ASCII.
-         if(tmpLen==0 || tmpLen>fontMetrics.getMaxAdvance())
-         {
-        	 if(output.charAt(i)>256)
-        	 {
-        		 tmpLen=refWidth*2-1;
-        	 }
-        	 else
-        	 {
-        		 tmpLen=refWidth;
-        	 }
-         } 
-         
-         width += (tmpLen/refWidth) + (tmpLen%refWidth>0?1:0);
-      }
-      
-      return width;
-   }
-
-   void writeQryOutParams(ResultSetMetaData rsmd,int numColumns,ParameterMetaData paramMetaData,CallableStatement callStmt) throws SQLException, IOException
-   {
-	   //   sessObj.setWriteParams(true);
-	      columnNameArray = new String[numColumns];
-	      colSize=new int[numColumns];
-	      colAlign=new int[numColumns];
-	      //qryObj.setColCount(String.valueOf(numColumns));
-	      for (int i=1;i<=numColumns;i++)
-	      {
-	         if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
-	            paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
-	         {
-	            int colNameSize = rsmd.getColumnName(i).length();
-	            if (colNameSize > rsmd.getColumnDisplaySize(i))
-	               colSize[i-1]=colNameSize;
-	            else
-	               colSize[i-1]=rsmd.getColumnDisplaySize(i);
-
-	            if (colSize[i-1] < SessionDefaults.MIN_COL_DISPLAY_SIZE)
-	            {
-	               colSize[i-1] = SessionDefaults.MIN_COL_DISPLAY_SIZE;
-	            }
-
-	            switch (sessObj.getDisplayFormat())
-	            {
-	               case SessionDefaults.RAW_FORMAT:
-	                  formatOutput(rsmd.getColumnName(i),colSize[i-1],' ',0);
-	                  if (i < numColumns)
-	                  {
-	                     writeSeparator();
-	                  }
-	                  break;
-
-	               case SessionDefaults.XML_FORMAT:
-	                  columnNameArray[i-1] = sessObj.getXmlObj().checkColumnNames(rsmd.getColumnName(i));
-	                  break;
-
-	               case SessionDefaults.HTML_FORMAT:
-	                  formatHtmlOutput(rsmd.getColumnName(i));
-	                  break;
-	               case SessionDefaults.CSV_FORMAT:
-	            	  formatCsvOutput(rsmd.getColumnName(i));
-	                  break;
-
-	               default:
-	                  break;
-	            }
-
-	            switch (rsmd.getColumnType(i))
-	            {
-	               case Types.BIGINT:
-	               case Types.BIT:
-	               case Types.DECIMAL:
-	               case Types.DOUBLE:
-	               case Types.FLOAT:
-	               case Types.INTEGER:
-	               case Types.NUMERIC:
-	               case Types.REAL:
-	               case Types.SMALLINT:
-	               case Types.TINYINT:
-	                  colAlign[i-1]=1;
-	                  break;
-	               default:
-	                  colAlign[i-1]=0;
-	                  break;
-
-	            }
-	         }
-	      }
-	      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-	      {
-	         writeln();
-	         for (int i=1;i<=numColumns ;i++)
-	         {
-	            if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
-	               paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
-	            {
-	               formatOutput("",colSize[i-1],'-',0);
-	               if (i < numColumns)
-	               {
-	                  writeSeparator();
-	               }
-	            }
-	         }
-	         writeln();
-
-	         if (sessObj.getSessView() == SessionDefaults.MXCI_VIEW)
-	            writeln();
-	      }
-	      writeQryData(callStmt,numColumns,paramMetaData);
-	      qryObj.setRowCount("1");		      
-   }
-
-   private void writeQryData(CallableStatement callStmt,int numColumns, ParameterMetaData paramMetaData) throws SQLException, IOException
-   {
-      for (int i=1;i<=numColumns ;i++)
-      {
-         if (paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeIn &&
-            paramMetaData.getParameterMode(i) != ParameterMetaData.parameterModeUnknown)
-         {
-            String value=callStmt.getString(i);
-            if (value == null)
-            {
-               value=sessObj.getSessNull();
-            }
-
-            switch (sessObj.getDisplayFormat())
-            {
-               case SessionDefaults.RAW_FORMAT :
-                  if (qryObj.isTrimOut())
-                  {
-                     formatOutput(value,value.length(),' ',0);
-                  }
-                  else
-                  {
-                     formatOutput(value,colSize[i-1],' ',colAlign[i-1]);
-                  }
-
-                  if (i < numColumns)
-                  {
-                     writeSeparator();
-                  }
-                  break;
-
-
-               case SessionDefaults.XML_FORMAT :
-                  formatXmlOutput(columnNameArray[i-1],value);
-                  break;
-
-               case SessionDefaults.HTML_FORMAT:
-                  formatHtmlOutput(value);
-                  break;
-
-               case SessionDefaults.CSV_FORMAT:
-                  formatCsvOutput(value.trim());
-                  break;
-            }
-         }
-      }
-
-      if (sessObj.getDisplayFormat() == SessionDefaults.RAW_FORMAT)
-         writeln();
-   }
-   
-   void formatOutputVertical(String colHeading, String output) throws IOException
-   {
-	   if (colHeading != null)
-		   write( colHeading + ": " + output + SessionDefaults.lineSeperator);
-	   else
-		   write( output + SessionDefaults.lineSeperator);
-   }
-   
-	public boolean getShowStatusMsg() {
-		return this.showStatusMsg;
-	}
-
-	public void setShowStatusMsg(boolean showStatusMsg) {
-		this.showStatusMsg = showStatusMsg;
-	}
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/RawDisplay.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/RawDisplay.java b/core/conn/trafci/src/org/trafodion/ci/RawDisplay.java
deleted file mode 100644
index 84be925..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/RawDisplay.java
+++ /dev/null
@@ -1,189 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.awt.FontMetrics;
-import java.io.IOException;
-import java.util.ArrayList;
-
-public class RawDisplay implements IDisplay {
-
-	private Writer writer=null;
-	private Session sessObj=null;
-	private int isoMapping;
-	private FontMetrics fontMetrics = null;
-	
-	public RawDisplay(Session sessObj)
-	{
-		if(sessObj!=null)
-		{
-			this.sessObj = sessObj;
-			this.writer=sessObj.getWriter();
-			isoMapping = sessObj.getISOMapping();
-		}
-		fontMetrics = MultiByteUtils.getFontMetrics();
-	}
-
-	public void output(OutputContents contents) throws IOException {
-		// TODO Auto-generated method stub
-
-		if(contents!=null)
-		{
-			this.writer=sessObj.getWriter();
-			//display header
-			ArrayList<OutputColumnAttribute> columns = contents.getColumns();
-			if(columns!=null && columns.size()>0)
-			{
-				//display columns name
-				for(int i=0;i<columns.size();i++)
-				{
-					OutputColumnAttribute columnAttr = columns.get(i);
-					formatOutput(columnAttr.name,columnAttr.width,' ',columnAttr.align);					
-					writer.write(contents.getColumnSeparator());
-				}
-				writeln();
-				
-				//display column header separator
-				for(int i=0;i<columns.size();i++)
-				{
-					OutputColumnAttribute columnAttr = columns.get(i);
-					formatOutput("",columnAttr.width,'-',columnAttr.align);
-					writer.write(contents.getColumnSeparator());
-				}
-				writeln();
-			}
-			
-			//display contents
-			ArrayList<ArrayList<String>> alRows = contents.getRows();
-			if(alRows!=null && alRows.size()>0)
-			{
-				for(int i=0;i<alRows.size();i++)
-				{
-					ArrayList<String> alRow = alRows.get(i);
-					if(alRow!=null && alRow.size()>0)
-					{
-						for(int j=0;j<alRow.size();j++)
-						{
-							OutputColumnAttribute columnAttr = columns.get(j);
-							formatOutput(alRow.get(j),columnAttr.width,' ',columnAttr.align);
-							
-							writer.write(contents.getColumnSeparator());
-						}
-						writeln();
-					}
-					
-				}
-				writeln();
-			}
-		}
-	}
-
-	   void formatOutput(String output,int colWidth,char fillchar,int align) throws IOException
-	   {
-
-	     int outputStrLen = 0;
-	      
-	      if (output != null && output.length() > colWidth)
-	      {
-	         output=output.substring(0,colWidth);
-	      } 
-	      StringBuffer outBuffer=new StringBuffer(output);
-
-	      if (sessObj.isMultiByteAlign() && (isoMapping == 10 || isoMapping == 15)) //SJIS or UTF8
-	      {
-	         try {
-	         outputStrLen = getMultiByteColWidth(outBuffer);
-	         }catch (Exception ex)
-	         {
-	            ex.printStackTrace();
-	            throw new IOException(ex.getMessage());
-	         }
-	      }
-	      else
-	      {
-	         outputStrLen = outBuffer.length();
-	      }
-	      //If the output is greater than the column width,
-	      //truncate the output
-	      
-	      if (outputStrLen > colWidth)
-	      {
-	         outBuffer = new StringBuffer(outBuffer.substring(0,Math.min(colWidth, outBuffer.length())));
-	         outputStrLen = outBuffer.length();
-	      }
-
-	      if ( outputStrLen <= colWidth)
-	      {
-	         for (int i=outputStrLen;i<colWidth;i++)
-	         {
-	            if (align == 0)
-	            {
-	               outBuffer.append(fillchar);
-	            }
-	            else
-	            {
-	               outBuffer.insert(0,fillchar);
-	            }
-	         }
-
-	         writer.write( outBuffer.toString());
-
-	      }
-	      outBuffer=null;
-	   }
-
-	   protected int getMultiByteColWidth(StringBuffer output)
-	   {
-	      if (null == fontMetrics)
-	         return output.length();
-	      
-	      int refWidth = fontMetrics.charWidth('w');
-	      int width=0;
-	     
-	       for (int i=0; i< output.length(); i++)
-	      {
-	         int tmpLen=fontMetrics.charWidth(output.charAt(i));
-	         //incorrect value of char width. Treat it as no-ASCII.
-	         if(tmpLen==0 || tmpLen>fontMetrics.getMaxAdvance())
-	         {
-	        	 if(output.charAt(i)>256)
-	        	 {
-	        		 tmpLen=refWidth*2-1;
-	        	 }
-	        	 else
-	        	 {
-	        		 tmpLen=refWidth;
-	        	 }
-	         } 
-	         
-	         width += (tmpLen/refWidth) + (tmpLen%refWidth>0?1:0);
-	      }
-	      
-	      return width;
-	   }
-
-	   void writeln() throws IOException
-	   {
-		   writer.write(SessionDefaults.lineSeperator);
-	   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Reader.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Reader.java b/core/conn/trafci/src/org/trafodion/ci/Reader.java
deleted file mode 100644
index f216f09..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Reader.java
+++ /dev/null
@@ -1,286 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-public class Reader
-{
-   private ConsoleReader cReader=null;
-   private FileReader sReader=null;
-   private FileReader oReader=null;
-   private List<FileReader> nestedObeyReaders=null;
-
-//   private boolean obeyFileList = false;
-   private int readMode=SessionDefaults.CONSOLE_READ_MODE;
-   private int prevReadMode=SessionDefaults.CONSOLE_READ_MODE;
-   private String tmpString=null;
-   private FileReader tmpReader=null;
-   
-   private HashMap<String, String> obeyHashMap = null;
-   private int MAX_OBEY_DEPTH;
-   
-   Reader()
-   {
-       int defaultDepth = 10;
-       
-       MAX_OBEY_DEPTH = defaultDepth;
-       try
-       {
-           if(System.getProperty("trafci.obeydepth") != null)
-               MAX_OBEY_DEPTH = Integer.parseInt(System.getProperty("trafci.obeydepth"));
-           
-           if(MAX_OBEY_DEPTH < 0)
-               MAX_OBEY_DEPTH = defaultDepth;
-       }
-       catch(Exception ex)
-       {
-               MAX_OBEY_DEPTH = defaultDepth;
-       }
-   } 
-   
-   public String getNonBlankLine() throws IOException, UserInterruption
-   {
-      
-      switch (readMode)
-      {
-         case SessionDefaults.CONSOLE_READ_MODE:
-            return cReader.getLine();
-         case SessionDefaults.SCRIPT_READ_MODE:
-            return sReader.getNonBlankLine();
-         case SessionDefaults.OBEY_READ_MODE:
-             
-             if(isObeyDepthMax(oReader.getFileName()))
-             {
-                 obeyHashMap = null;
-                 throw new IOException("\n\nERROR: " + SessionError.OBEY_DEPTH_MAX + oReader.getFileName());
-             }
-
-            tmpString=oReader.getNonBlankLine();
-            if (tmpString == null && ((tmpReader=getLastObeyReader()) != null))
-            {
-               obeyHashMap.remove(oReader.getFileName());
-               decrementHashMap(tmpReader.getFileName());
-               oReader.close();
-               
-               oReader=tmpReader;
-               return getNonBlankLine();
-            }
-            else
-                return tmpString;
-      }
-      return null;
-   }
-
-   public String getLine() throws IOException, UserInterruption
-   {
-
-      switch (readMode)
-      {
-         case SessionDefaults.CONSOLE_READ_MODE:
-            return cReader.getLine();
-         case SessionDefaults.SCRIPT_READ_MODE:
-            return sReader.getLine();
-         case SessionDefaults.OBEY_READ_MODE:
-            tmpString=oReader.getLine();
-            if (tmpString == null && ((tmpReader=getLastObeyReader()) != null))
-            {
-               oReader=tmpReader;
-               getLine();
-            }
-            return tmpString;
-      }
-      return null;
-   }
-
-   public ConsoleReader getConsoleReader()
-   {
-      return cReader;
-   }
-
-   public void setConsoleReader(ConsoleReader reader)
-   {
-      cReader = reader;
-   }
-
-   public FileReader getObeyReader()
-   {
-      return oReader;
-   }
-   
-   public List<FileReader> getObeyReaderList()
-   {
-       return this.nestedObeyReaders;
-   }
-
-   public void setObeyReader(FileReader reader)
-   {
-      // if the current mode is already obey read mode..then push the current object to the nested buffer
-      // and set the current reader
-
-      if (reader != null && readMode == SessionDefaults.OBEY_READ_MODE)
-      {
-         this.addObeyReader(oReader);
-         //this.obeyFileList = true;
-      }
-      else
-      {
-         //this.obeyFileList = false;
-         this.nestedObeyReaders = null;
-      }
-      
-      oReader = reader;
-   }
-
-   public FileReader getScriptReader()
-   {
-      return sReader;
-   }
-
-   public void setScriptReader(FileReader reader)
-   {
-      sReader = reader;
-   }
-
-   public int getReadMode()
-   {
-      return readMode;
-   }
-
-   public int getPrevReadMode()
-   {
-      return this.prevReadMode;
-   }
-
-   public void setReadMode(int readMode)
-   {
-      this.prevReadMode=this.readMode;
-      this.readMode = readMode;
-   }
-
-   private FileReader getLastObeyReader()
-   {
-      if (this.nestedObeyReaders == null)
-      {
-         return null;
-      }
-      FileReader fr=(FileReader)this.nestedObeyReaders.get(this.nestedObeyReaders.size()-1);
-      this.nestedObeyReaders.remove(this.nestedObeyReaders.size()-1);
-      if (this.nestedObeyReaders.size() == 0)
-      {
-         this.nestedObeyReaders=null;
-      }
-      return fr;
-   }
-
-   private void addObeyReader(FileReader obeyReader)
-   {
-      if (this.nestedObeyReaders == null)
-      {
-         this.nestedObeyReaders = new ArrayList<FileReader>();
-      }
-
-      if(this.obeyHashMap == null)
-      {
-          this.obeyHashMap = new HashMap<String, String>();
-      }
-      
-      incrementHashMap(obeyReader);
-   }
-   
-   public boolean obeyMultipleFiles(){
-     /* if (this.nestedObeyReaders == null){
-			     return false; 
-      } 
-     */
-	   
-      if (oReader.getFileName().equals(""))
-	 	   return false;
-	  else
-		   return true;
-   }
-   
-   private boolean isObeyDepthMax(String path)
-   {
-       if(obeyHashMap != null)
-       {
-           String tmpHashObject = obeyHashMap.get(path);
-           
-           if(tmpHashObject != null)
-           {
-               int obeyFileCount = Integer.parseInt(tmpHashObject); 
-               if(obeyFileCount == MAX_OBEY_DEPTH)
-               {
-                   return true;
-               }
-           }
-       }
-       return false;
-   }
-   
-   private void incrementHashMap(FileReader obeyReader){
-       String path = obeyReader.getFileName();
-       int obeyFileCount = 1;
-       
-       if(obeyHashMap.get(path) == null)
-       {
-           obeyHashMap.put(path, obeyFileCount + "");
-       }
-       else
-       {
-           obeyFileCount = Integer.parseInt(obeyHashMap.get(path));
-           obeyFileCount++;
-           obeyHashMap.put(path, obeyFileCount + "");  
-       }
-       
-       if(obeyFileCount <= MAX_OBEY_DEPTH)
-           this.nestedObeyReaders.add(obeyReader);
-   }
-
-   private void decrementHashMap(String path){
-       if(obeyHashMap.get(path) != null){
-           int obeyFileCount = Integer.parseInt(obeyHashMap.get(path));
-           obeyFileCount--;
-           obeyHashMap.put(path, obeyFileCount + "");   
-       }
-   }
-   
-   public boolean isReallyObeyfile()
-   {
-	   // Try an determine if this is really an obey file or
-	   // a stream of multiple commands constructed to run .sec
-	   
-	   // No obey files are being processed right now
-	   if (oReader == null || readMode != SessionDefaults.OBEY_READ_MODE)
-		   return false;
-	   //Only one obey file see if its for .sec
-	   if (this.nestedObeyReaders == null){
-		   if ( oReader.getFileName()== "")
-			     return false; 
-	   }
-   	   // One actual obey file or nested obey files
-	   return true;
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/RepObjInterface.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/RepObjInterface.java b/core/conn/trafci/src/org/trafodion/ci/RepObjInterface.java
deleted file mode 100644
index 19b27b2..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/RepObjInterface.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-public abstract class RepObjInterface {
-
-	public abstract String getValue(String key);
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ReplacementObj.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ReplacementObj.java b/core/conn/trafci/src/org/trafodion/ci/ReplacementObj.java
deleted file mode 100644
index d06fac6..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ReplacementObj.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-public class ReplacementObj extends RepObjInterface {
-
-//	private String patternKey;
-	private String patternValue;
-	
-	ReplacementObj(String patternKey, String patternValue)
-	{
-//		this.patternKey = patternKey;
-		this.patternValue = patternValue;
-	}
-	
-	public String getValue(String patternKey)
-	{
-		return this.patternValue;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ScriptSectionNotFound.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ScriptSectionNotFound.java b/core/conn/trafci/src/org/trafodion/ci/ScriptSectionNotFound.java
deleted file mode 100644
index 5456157..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ScriptSectionNotFound.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class ScriptSectionNotFound extends Exception
-{
-   /**
-   * 
-   */
-   private static final long serialVersionUID = 1L;
-
-   ScriptSectionNotFound()
-   {
-
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ScriptsInterface.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ScriptsInterface.java b/core/conn/trafci/src/org/trafodion/ci/ScriptsInterface.java
deleted file mode 100644
index 2413a2b..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ScriptsInterface.java
+++ /dev/null
@@ -1,153 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.sql.SQLException;
-
-public class ScriptsInterface
-{
-   Session sessObj=null;
-   SessionInterface siObj=null;
-   ConsoleReader crObj=null;
-   ConsoleWriter cwObj=null;
-
-
-   public ScriptsInterface()
-   {
-
-   }
-
-   public void openConnection(String userName,
-		      String password,
-		      String serverName,
-		      String portNumber,
-		      String dsnName) throws IOException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException
-  {
-	   String roleName = ""; //primary role
-	   openConnection( userName, password, roleName, serverName, portNumber, dsnName);
-	   
-  }
-
-   public void openConnection(String userName,
-      String password,
-      String roleName,
-      String serverName,
-      String portNumber,
-      String dsnName) throws IOException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException
-   {
-
-      //System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream("c:\\output.dat"))));
-      cwObj=new ConsoleWriter();
-      cwObj.setConsoleOut(false);
-      cwObj.initialize();
-      crObj=new ConsoleReader();
-      crObj.initialize();
-      siObj=new SessionInterface(crObj,cwObj);
-      if (portNumber == null || portNumber.trim().equals(""))
-      {
-         portNumber=SessionDefaults.portNumber;
-      }
-      portNumber=":"+portNumber;
-
-	  if (portNumber.endsWith("#"))
-
-	  {
-
-		  portNumber = portNumber.substring(0, portNumber.length() - 1);
-
-	  }
-
-
-        try {
-      sessObj=siObj.createSession(userName,
-         roleName,
-         password,
-         serverName,
-         portNumber,
-         dsnName,
-         0);
-  } finally {
-		  cwObj.setConsoleOut(true);
-	  }
-
-   }
-
-   public String executeQuery(String query) throws IOException
-   {
-      cwObj.resetStream();
-      cwObj.setConsoleOut(false);
-      sessObj.setCaller(SessionDefaults.USERI);
-      siObj.setScriptFile(null);
-      siObj.setLogFile(null,false);
-      if (sessObj == null)
-      {
-         System.out.println("session object is null");
-
-      }
-
-      if (sessObj.getConnObj() == null)
-      {
-         System.out.println("connection object is null");
-      }
-
-      if (sessObj.getConsoleWriter() == null)
-      {
-         System.out.println("Console writer is null");
-      }
-      siObj.setConsoleWriter(cwObj);
-      siObj.setConsoleReader(crObj);
-      siObj.setQueryOptions(true, query);
-      String cmdOutput = "";
-      
-      try {
-      siObj.invokeSession(sessObj);
-      cmdOutput = cwObj.getResult();
-      } finally {
-    	  cwObj.setConsoleOut(true);
-      }
-      
-      return cmdOutput;
-   }
-
-   public void executeScript(String scriptFile, String logFile) throws IOException
-   {
-      cwObj.setConsoleOut(true);
-      siObj.setScriptFile(scriptFile);
-      siObj.setLogFile(logFile,true);
-      siObj.setQueryOptions(false,null);
-      sessObj.setCaller(SessionDefaults.PRUNI);
-      siObj.invokeSession(sessObj);
-   }
-
-   public void disconnect() throws SQLException
-   {
-      this.sessObj.getConnObj().close();
-      this.sessObj=null;
-      this.siObj=null;
-   // This will support multiple connections
-   //     System.exit(0); 
-   }
-
-
-}



[11/38] incubator-trafodion git commit: convert trafci project into maven project

Posted by li...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/help/sql_common.help
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/help/sql_common.help b/core/conn/trafci/src/main/java/org/trafodion/ci/help/sql_common.help
new file mode 100644
index 0000000..be2e14c
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/help/sql_common.help
@@ -0,0 +1,376 @@
+// @@@ 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 @@@
+
+ @@@@@HELP
+
+   The command interface supports these commands:
+
+    @           LOG                     SET TIMING
+    ALIAS       OBEY                    SHOW ALIAS
+    CLEAR       QUIT                    SHOW ALIASES
+    CONNECT     RECONNECT               SHOW COLSEP
+    DELAY       REPEAT                  SHOW ERRORCODE
+    DISCONNECT  RESET LASTERROR         SHOW HISTOPT
+    ENV         SAVEHIST                SHOW IDLETIMEOUT
+    EXIT        SESSION (SHOW SESSION)  SHOW LASTERROR
+                SET COLSEP              SHOW MARKUP
+    FC          SET CONNECTOPT ROLE     SHOW ROLE
+    GOTO        SET HISTOPT             SHOW SESSION
+    HELP        SET IDLETIMEOUT         SHOW TIME
+    HISTORY     SET MARKUP              SHOW TIMING
+    IF...THEN   SET PROMPT              SPOOL
+    LABEL       SET TIME                VERSION
+    LOCALHOST  
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET
+
+   The command interface supports these SET commands:
+
+    SET COLSEP           SET IDLETIMEOUT  SET TIME    
+    SET CONNECTOPT ROLE  SET MARKUP       SET TIMING  
+    SET HISTOPT          SET PROMPT                   
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW
+
+   The command interface supports these SHOW commands:
+
+    SHOW ALIAS      SHOW IDLETIMEOUT  SHOW SESSION   
+    SHOW ALIASES    SHOW LASTERROR    SHOW TIME      
+    SHOW COLSEP     SHOW MARKUP       SHOW TIMING    
+    SHOW ERRORCODE  SHOW ROLE           
+    SHOW HISTOPT                            
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@HELP
+
+   These interface commands can be run only in SQL mode, which
+   is the default mode in TRAFCI:
+
+    /               SET PARAM           SHOW PROCEDURES             
+    GET STATISTICS  SET SQLPROMPT       SHOW RECCOUNT              
+    PRUN            SET SQLTERMINATOR   SHOW SCHEMA        
+    RESET PARAM     SET STATISTICS      SHOW SCHEMAS           
+    RUN             SHOW ACTIVITYCOUNT  SHOW SQLPROMPT        
+    SET FETCHSIZE   SHOW FETCHSIZE      SHOW SQLTERMINATOR  
+    SET LIST_COUNT  SHOW LIST_COUNT     SHOW SYNONYMS                         
+                    SHOW MVGROUPS       SHOW TABLE  
+                    SHOW MVS            SHOW TABLES               
+                    SHOW PARAM          SHOW VIEWS                
+                    SHOW PREPARED       
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+   SQL mode also supports SQL statements. For descriptions of 
+   the SQL statements, see the SQL Reference Manual.
+
+ @@@@@SET
+
+   SQL mode supports these SET commands:
+
+    SET FETCHSIZE   SET PARAM      SET SQLTERMINATOR  
+    SET LIST_COUNT  SET SQLPROMPT  SET STATISTICS     
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW
+
+   SQL mode supports these SHOW commands:
+
+    SHOW ACTIVITYCOUNT  SHOW PARAM       SHOW SQLTERMINATOR  
+    SHOW FETCHSIZE      SHOW PREPARED    SHOW STATISTICS     
+    SHOW INDEXES        SHOW PROCEDURES  SHOW SYNONYMS       
+    SHOW LIST_COUNT     SHOW RECCOUNT    SHOW TABLE          
+    SHOW MVGROUPS       SHOW SCHEMA      SHOW TABLES         
+    SHOW MVS            SHOW SCHEMAS     SHOW VIEWS        
+                        SHOW SQLPROMPT            
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@/
+
+   The / command executes the previously executed SQL statement. This command
+   does not repeat an interface command.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+
+ @@@@@GET STATISTICS
+
+   The GET STATISTICS command returns formatted statistics for the last
+   executed SQL statement.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@PRUN
+
+   The PRUN command runs script files in parallel.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@RESET PARAM
+
+   The RESET PARAM command clears all parameter values or a specified
+   parameter value in the current session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@RUN
+
+   The RUN command executes the previously executed SQL statement. This
+   command does not repeat an interface command.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET FETCHSIZE
+
+   The SET FETCHSIZE command allows you to change the default fetchsize used
+   by JDBC. Setting the value to 0 sets the fetchsize to the default value
+   used in JDBC.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET LIST_COUNT
+
+   The SET LIST_COUNT command sets the maximum number of rows to be returned
+   by SELECT statements that are executed after this command. The default is
+   zero, which means that all rows are returned.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET PARAM
+
+   The SET PARAM command associates a parameter name with a parameter value
+   in the current session. 
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET SQLPROMPT
+
+   The SET SQLPROMPT command sets the SQL prompt of the current session to a
+   specified string. The default is SQL>.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET SQLTERMINATOR
+
+   The SET SQLTERMINATOR command sets the SQL statement terminator of the
+   current session. The default is a semicolon (;).
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SET STATISTICS
+
+   The SET STATISTICS command automatically retrieves the statistics
+   information for a query being executed. The results returned are the same
+   as would have been returned if the GET STATISTICS command was executed.
+   The default is OFF which means the statistics information is not
+   automatically printed for any queries.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+
+ @@@@@SHOW ACTIVITYCOUNT
+
+   The SHOW ACTIVITYCOUNT command provides an alias for SHOW RECCOUNT.
+   ACTIVITYCOUNT is an alias for RECCOUNT.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW FETCHSIZE
+
+   The SHOW FETCHSIZE command displays the fetch size value for the current
+   Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW INDEXES
+
+   The SHOW INDEXES command displays all indexes on all tables and 
+   materialized views in the current schema of the Command Interface
+   session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW LIST_COUNT
+
+   The SHOW LIST_COUNT command displays the maximum number of rows to be
+   returned by SELECT statements in the current Command Interface session.
+   The default is zero, which means that all rows are returned.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW MVGROUPS
+
+   The SHOW MVGROUPS command displays all or a set of the materialized view
+   groups in the current schema of the Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW MVS
+
+   The SHOW MVS command displays all or a set of the materialized views in
+   the current schema of the Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW PARAM
+
+   The SHOW PARAM command displays the parameters that are set in the current
+   Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW PREPARED
+
+   The SHOW PREPARED command displays the prepared statements in the current
+   Command Interface session. If a pattern is specified, all prepared
+   statements matching the prepared statement name pattern are displayed. By
+   default, all prepared statements in the current session are displayed.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW PROCEDURES
+
+   The SHOW PROCEDURES command displays the procedures (Stored Procedures in
+   Java) in the current schema of the Command Interface session. If a
+   pattern is specified, all procedures matching the pattern are displayed.
+   By default, all procedures in the current schema of the Command Interface
+   session are displayed.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW RECCOUNT
+
+   The SHOW RECCOUNT command displays the record count of the previously
+   executed SQL statement. If the previously executed command was an
+   interface command, the Command Interface returns zero. Otherwise, the
+   Command Interface returns the count of the previously executed SQL
+   statement. For commands that invoke the catalog APIs-SHOW TABLES, VIEWS,
+   SYNONYMS, MVS, and so on-SHOW RECCOUNT returns the count of the database
+   objects.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW SCHEMA
+
+   The SHOW SCHEMA command displays the current schema of the Command
+   Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW SCHEMAS
+
+   The SHOW SCHEMAS command displays all or a set of the schemas that exist
+   in the default catalog of the current Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW SQLPROMPT
+
+   The SHOW SQLPROMPT command displays the value of the SQL prompt for the
+   current Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW SQLTERMINATOR
+
+   The SHOW SQLTERMINATOR command displays the SQL statement terminator of
+   the current Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW STATISTICS
+
+   The SHOW STATISTICS command displays if statistics has been enabled or
+   disabled for the current session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW SYNONYMS
+
+   The SHOW SYNONYMS command displays all or a set of the synonyms in the
+   current schema of the Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW TABLE
+
+   The SHOW TABLE command displays information about the indexes,
+   materialized views, synonyms, or triggers associated with a 
+   specified table or materialized view.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW TABLES
+
+   The SHOW TABLES command displays all or a set of the tables that exist in
+   the current schema of the Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+
+ @@@@@SHOW VIEWS
+
+   The SHOW VIEWS command displays all or a set of the views that exist in
+   the current schema of the Command Interface session.
+
+   For more information, see the Trafodion Command Interface
+   (TRAFCI) Guide.
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/ArgMap.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/ArgMap.java b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/ArgMap.java
new file mode 100644
index 0000000..3112771
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/ArgMap.java
@@ -0,0 +1,61 @@
+/**********************************************************************
+// @@@ 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 @@@
+**********************************************************************/
+package org.trafodion.ci.pwdencrypt;
+
+import java.util.HashMap;
+/**
+ * The map of valid arguments.
+ *
+ */
+public class ArgMap {
+
+	/**
+	 * Map of valid arguments.
+	 */
+	public static final HashMap<Character, ArgsDef> ARGMAP = argMapBuilder();
+	
+	/**
+	 * Constructor.
+	 * @return ArgMap
+	 */
+	private static HashMap<Character, ArgsDef> argMapBuilder() {
+		HashMap<Character, ArgsDef> constructmap = 
+			new HashMap<Character, ArgsDef>();
+		constructmap.put('o', new ArgsDef(
+				"option", true, 'o', 
+				"either \"install\", \"add\", or \"del\""));
+		constructmap.put('u', new ArgsDef(
+				"username", true, 'u', 
+				"username valid only for \"add\" and \"del\""));
+		constructmap.put('p', new ArgsDef(
+				"password", true, 'p', 
+				"password valid only for \"add\""));
+		constructmap.put('l', new ArgsDef(
+				"logdir",  true, 'l', "Specify log file directory"));
+		constructmap.put('f', new ArgsDef(
+				"logfile", true, 'f', "Specify log file name"));
+		constructmap.put('h', new ArgsDef(
+				"help", false, 'h', "Display this message"));
+		return constructmap;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/ArgsDef.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/ArgsDef.java b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/ArgsDef.java
new file mode 100644
index 0000000..0ef9581
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/ArgsDef.java
@@ -0,0 +1,74 @@
+/**********************************************************************
+// @@@ 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 @@@
+**********************************************************************/
+package org.trafodion.ci.pwdencrypt;
+
+public class ArgsDef {
+
+
+	private String name;
+	private boolean argrequired;
+	private char ident;
+	private String error;
+	
+	/**
+	 * Constructor.
+	 * @param name name of option rule
+	 * @param argrequired is option required
+	 * @param ident char that coralates command to arg
+	 */
+	public ArgsDef(String name, boolean argrequired, char ident, String error) {
+		this.name = name;
+		this.argrequired = argrequired;
+		this.ident = ident;
+		this.error = error;
+	}
+
+	/**
+	 * Returns ident char.
+	 * @return the ident
+	 */
+	public final char getIdent() {
+		return ident;
+	}
+
+	/**
+	 * @return the name
+	 */
+	public final String getName() {
+		return name;
+	}
+
+	/**
+	 * @return the required
+	 */
+	public final boolean isArgRequired() {
+		return argrequired;
+	}
+
+	/**
+	 * @return the error
+	 */
+	public final String getError() {
+		return error;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/EncryptUtil.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/EncryptUtil.java b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/EncryptUtil.java
new file mode 100644
index 0000000..6df66e4
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/EncryptUtil.java
@@ -0,0 +1,249 @@
+/**********************************************************************
+// @@@ 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 @@@
+**********************************************************************/
+/**
+ *
+ */
+package org.trafodion.ci.pwdencrypt;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+public class EncryptUtil {
+
+	/**
+	 * Java Cryptor.
+	 */
+	private static JCE j = new JCE();
+	static boolean doTrace = Boolean.getBoolean("trafci.enableTrace");
+
+
+	/**
+	 * Main method.
+	 * @param args arguments from command line
+	 */
+	public static void main(final String[] args) {
+		PasswordOpts settings = new PasswordOpts();
+		settings.parseCommandLine(args);
+		try {
+			if (settings.getWktype().equalsIgnoreCase(WorkTypes.ADD)) {
+				add(settings.getRef(), settings.getText());
+			//	System.out.println("Decrypting the password::");
+				//j.initSiteEncryptionService();
+				//	read encrypt file
+				ArrayList<String> refs = readLines();
+				if (!refs.isEmpty()) {
+					for (int i=0; i < refs.size(); i++) {
+					//	System.out.println("refs["+i+"]" + refs.get(i));
+						RefLookup.resolve(refs.get(i));
+						/*System.out.println("ref stri = " + ss.substring(3, ss.length()-1));
+                        System.out.println("Pw::" + ss);*/
+					}
+				}
+				
+				//System.out.println((j.decrypt("{DES}44SnpMxWui2uqvrrVzJwZA==")).toString());
+			} else if (settings.getWktype().equalsIgnoreCase(WorkTypes.DEL)) {
+				del(settings.getRef());
+			} else if (settings.getWktype()
+					.equalsIgnoreCase(WorkTypes.INSTALL)) {
+				j.setupSiteEncryptionService();
+			}
+		} catch (Exception e) {
+			StringBuffer msg = new StringBuffer();
+			msg.append("\n\tError Message: ").append(e.getMessage());
+			if (doTrace) { 
+				e.printStackTrace();
+			}
+			System.exit(1);
+		}
+	}
+
+	/**
+	 * Adds a encryption map to the secfile.
+	 * @param ref reference test
+	 * @param tw text word
+	 * @throws DBTransporterException on error
+	 */
+	private static void add(final String ref, final String tw)
+	throws Exception {
+		//init encryptor
+		j.initSiteEncryptionService();
+		final String en =
+			j.encrypt(j.sitePair.encryptor, tw);
+
+		//read encrypt file
+		ArrayList<String> refs = readLines();
+
+		//remove existing entry
+		for (int i=0; i< refs.size(); i++) {
+			if (ref != null){
+				if (0 == refs.get(i).indexOf(ref + " = {DES}")) {
+					refs.remove(refs.get(i));
+					break;
+					//System.exit(0);
+				}
+			}
+		}
+		//add the new entry
+		refs.add(ref + " = {DES}" + en);
+		writelines(refs);
+	}
+
+	/**
+	 * Deletes encryption reference.
+	 * @param ref reference name
+	 */
+	private static void del(final String ref) {
+		//read in encrypt file
+		ArrayList<String> refs = readLines();
+		//locate by ref and delete
+		//For on-platform, clear the encrypted file when option is del
+		for (int i=0; i< refs.size(); i++) {
+			if (ref != null){
+				if (0 == refs.get(i).indexOf(ref + " = {DES}")) {
+					refs.remove(refs.get(i));
+					break;
+					//System.exit(0);
+				}
+			}
+		}
+		if (refs != null){
+			//refs.clear();
+			writelines(refs);
+		}
+		//if(doTrace) 
+				//System.out.println("Failed in del:: " + ref);
+
+	}
+	
+	/**
+	 * Reads encctlprops file.
+	 * @return ArrayList of the reference maps.
+	 */
+	public static ArrayList<String> readLines() {
+		ArrayList<String> refs = new ArrayList<String>();
+		
+		try {
+			//get file in stream
+
+
+
+
+
+
+			StringBuilder buff = new StringBuilder();
+			StringBuilder ref = new StringBuilder();
+			
+			File secfile = new File(j.getSecDir() + JCE.encfilename);
+			FileInputStream fis = new FileInputStream(secfile);
+			InputStreamReader converter = new InputStreamReader(fis);
+			BufferedReader in = new BufferedReader(converter);
+			String tmpStr="";
+			String prevStr=null, nextStr=null;
+			
+			//This loop will read the complete reference string even if it
+			//spans to multiple lines. This way the partial delete or addition 	
+			//to the reference is avoided.
+			prevStr = in.readLine();
+			while(prevStr != null ){
+				nextStr = in.readLine();
+				
+				if (prevStr.contains(" = {DES}")){
+					if( nextStr == null || (nextStr!= null && nextStr.contains(" = {DES}"))){
+						buff.append(prevStr);
+						buff.append('\n');						
+					}
+					else {
+						tmpStr = prevStr;
+					}
+				}
+				else{
+					tmpStr = tmpStr + prevStr; 
+					if (nextStr == null || nextStr.contains(" = {DES}")){
+						buff.append(tmpStr);
+						buff.append('\n');						
+					}
+				}
+				prevStr = nextStr;
+				
+			}
+		
+			// read and assign to refs list
+			char c;
+			for(int i =0; i< buff.length(); i++){
+				if((c = buff.charAt(i)) != '\n' ){
+					ref.append(c);
+				}
+				else{
+					refs.add(ref.toString());
+					ref =  new StringBuilder();
+				}	
+			}
+			
+			//close stream
+			fis.close();
+			
+		} catch (IOException e) {
+			StringBuffer msg = new StringBuffer();
+			msg.append("\n\tError Message: ").append(e.getMessage());
+			if (doTrace) { // log stack trace
+				
+				e.printStackTrace();
+			}
+			
+		}
+		return refs;
+	}
+	
+	/**
+	 * Writes encctlprops using list provided by add or del.
+	 * @param refs list provided by add or del
+	 */
+	private static void writelines(final ArrayList<String> refs) {
+		StringBuilder buff = new StringBuilder();
+		
+		for (String ref : refs) {
+			buff.append(ref + '\n');
+		}
+		
+		try {
+			String pathName = j.getSecDir() + JCE.encfilename;
+			File secfile = new File(pathName);
+			FileOutputStream fos = new FileOutputStream(secfile);
+			fos.write(buff.toString().getBytes());
+			fos.flush();
+			fos.close();
+			Runtime.getRuntime().exec("chmod 600 " + pathName);
+		} catch (IOException e) {
+			StringBuffer msg = new StringBuffer();
+			msg.append("\n\tError Message: ").append(e.getMessage());
+			if (doTrace) { // log stack trace
+			e.printStackTrace();
+			}
+			
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/JCE.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/JCE.java b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/JCE.java
new file mode 100644
index 0000000..fb03403
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/JCE.java
@@ -0,0 +1,414 @@
+/**********************************************************************
+// @@@ 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 @@@
+**********************************************************************/
+package org.trafodion.ci.pwdencrypt;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.AlgorithmParameterSpec;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.KeySpec;
+import java.util.Arrays;
+import java.util.Properties;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.KeyGenerator;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESKeySpec;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.PBEParameterSpec;
+
+
+public class JCE {
+	public static final String SECRETKEY_ALGORITHM = "PBEWithMD5AndDES";
+	public static final String SYMMETRICKEY_ALGORITHM = "DES";
+	public static final String DIGEST_ALGORITHM = "MD5";
+
+    private static final byte[] salt = { (byte)0xFF, (byte)0x20, (byte)0xDF,
+    	(byte)0xA6, (byte)0x5D, (byte)0x0D, (byte)0x34, (byte)0xD2 };
+
+    private static final char[] pass = { '\u00FF','\u0010','\u00EF', '\u00F6',
+    	 '\u004B', '\u0004', '\u0056', '\u0088' };
+
+    protected static final String encfilename = "/encprops.txt";
+	private static final int count = 20;
+
+	private String ciHome;
+
+	private String secDir;
+
+	private String secFile;
+
+	private static final String securityDir = ".ciconf";
+
+	private static final String securityFile = "security.props";
+
+	CipherPair basePair;
+
+	CipherPair sitePair;
+
+	MessageDigest md5;
+
+
+	/**
+	 *
+	 */
+	public JCE() {
+		this.ciHome = System.getenv("USERHOME"); //System.getProperty("user.dir");
+		if (ciHome ==null){
+			System.out.println("USERHOME set failed, Please check trafci/bin/ciencr.sh");
+		}
+		this.secDir = this.ciHome + '/' + securityDir; // "/sql/scripts/" + securityDir;
+		this.secFile = this.secDir + '/' + securityFile;
+		
+		try {
+			md5 = initDigest();
+			basePair = initCiphers(pass, salt, count);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+
+	public void setupSiteEncryptionService() throws Exception {
+		try {
+			makeSecurityDir();
+
+			KeyGenerator keyGen = KeyGenerator.getInstance("DES");
+
+			SecretKey sKey = keyGen.generateKey();
+			byte[] encKey = sKey.getEncoded();
+			// We write two files, a digest of the key and the
+			// encrypted key itself
+			md5.reset();
+			byte[] digest = md5.digest(encKey);
+			sun.misc.BASE64Encoder ben = new sun.misc.BASE64Encoder();
+			String d = ben.encode(digest);
+			// Now encrypt the generated key with DBT cipher
+			byte[] enc = basePair.getEncryptor().doFinal(encKey);
+			String k = ben.encode(enc);
+			Properties props = new Properties();
+			props.put("d", d);
+			props.put("k", k);
+			File theSecFile = new File(secFile);
+			FileOutputStream fos = new FileOutputStream(theSecFile);
+			props.store(fos, "TRAFCI Security Initialization File");
+			fos.flush();
+			fos.close();
+			Runtime.getRuntime().exec("chmod 600 " + secFile);
+		} catch (IllegalBlockSizeException ibse) {
+			throw (Exception) new Exception("Invalid cipher block size")
+					.initCause(ibse);
+		} catch (BadPaddingException bpe) {
+			throw (Exception) new Exception("Incorrect cipher padding")
+					.initCause(bpe);
+		} catch (FileNotFoundException fnfe) {
+			throw (Exception) new Exception("Encryption utility not installed under current NVTHOME")
+					.initCause(fnfe);
+
+		} catch (NoSuchAlgorithmException nsae) {
+			throw (Exception) new Exception("Invalid cipher algorithm")
+					.initCause(nsae);
+		} catch (IOException ioe) {
+			throw (Exception) new Exception("IO Exception")
+					.initCause(ioe);
+		}
+	}
+
+	public void initSiteEncryptionService() throws Exception {
+		try {
+			FileInputStream fis = new FileInputStream(secFile);
+			Properties props = new Properties();
+			props.load(fis);
+			String k = props.getProperty("k");
+			String d = props.getProperty("d");
+			sun.misc.BASE64Decoder bde = new sun.misc.BASE64Decoder();
+			// Decrypt the key
+			byte[] key = decrypt(basePair.getDecryptor(), k);
+			byte[] digest = bde.decodeBuffer(d);
+			md5.reset();
+			byte[] d2 = md5.digest(key);
+			if (!Arrays.equals(digest, d2)) {
+				throw (Exception) new Exception("FATAL -- Tampered key");
+			}
+			sitePair = initCiphers(key);
+
+			// Get rid of the base pair
+
+			basePair.setEncryptor(null);
+			basePair.setDecryptor(null);
+			basePair = null;
+		} catch (FileNotFoundException fnfe) {
+			throw (Exception) new Exception("Encryption utility not installed under current TRAFCIHOME")
+					.initCause(fnfe);
+
+		} catch (IOException ioe) {
+			throw (Exception) new Exception("IO Exception")
+					.initCause(ioe);
+		}
+	}
+
+	private void makeSecurityDir() throws Exception {
+		final File dir = new File(secDir);
+
+		if (!dir.exists()) {
+			dir.mkdirs();
+		}
+		final File encfile = new File(
+				secDir + '/' + "encprops.txt");
+		
+		try{
+			if (!encfile.exists()) {
+				encfile.createNewFile();
+				Runtime.getRuntime().exec("chmod 600 " + secDir + '/' + "encprops.txt");
+			}
+			
+		} catch (IOException e) {
+			throw (Exception) new Exception("IO Exception")
+			.initCause(e);
+		}
+			
+		
+		
+
+	}
+
+	public MessageDigest initDigest() throws Exception {
+		try {
+			MessageDigest md5 = MessageDigest.getInstance(DIGEST_ALGORITHM);
+			return md5;
+		} catch (NoSuchAlgorithmException nsae) {
+			throw (Exception) new Exception("Unknown digest")
+					.initCause(nsae);
+		}
+	}
+
+	public CipherPair initCiphers(byte[] keyData) throws Exception {
+		try {
+
+			DESKeySpec dspec = new DESKeySpec(keyData);
+
+			SecretKeyFactory skf = SecretKeyFactory.getInstance(SYMMETRICKEY_ALGORITHM);
+			SecretKey sKey = skf.generateSecret(dspec);
+
+			Cipher encryptor = Cipher.getInstance(SYMMETRICKEY_ALGORITHM);
+			Cipher decryptor = Cipher.getInstance(SYMMETRICKEY_ALGORITHM);
+			encryptor.init(Cipher.ENCRYPT_MODE, sKey);
+			decryptor.init(Cipher.DECRYPT_MODE, sKey);
+			return new CipherPair(encryptor, decryptor);
+
+		} catch (InvalidKeySpecException ikse) {
+			throw (Exception) new Exception("Invalid Key specification")
+					.initCause(ikse);
+		} catch (InvalidKeyException ikse) {
+			throw (Exception) new Exception("Invalid Key")
+					.initCause(ikse);
+		} catch (NoSuchAlgorithmException nsae) {
+			throw (Exception) new Exception("No such algorithm")
+					.initCause(nsae);
+		} catch (NoSuchPaddingException nsae) {
+			throw (Exception) new Exception("No such padding")
+					.initCause(nsae);
+		}
+	}
+
+	public CipherPair initCiphers(SecretKey key, byte[] salt, int count)
+			throws Exception {
+		try {
+			Cipher encryptor = Cipher.getInstance(SECRETKEY_ALGORITHM);
+
+			Cipher decryptor = Cipher.getInstance(SECRETKEY_ALGORITHM);
+
+			AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, count);
+
+			encryptor.init(Cipher.ENCRYPT_MODE, key, paramSpec);
+
+			decryptor.init(Cipher.DECRYPT_MODE, key, paramSpec);
+
+			return new CipherPair(encryptor, decryptor);
+		} catch (NoSuchAlgorithmException nsae) {
+			throw (Exception) new Exception("Invalid cipher algorithm")
+					.initCause(nsae);
+		} catch (InvalidAlgorithmParameterException iape) {
+			throw (Exception) new Exception("Invalid algorithm parameter")
+					.initCause(iape);
+		} catch (InvalidKeyException ike) {
+			throw (Exception) new Exception("Invalid Key").initCause(ike);
+		} catch (NoSuchPaddingException nspe) {
+			throw (Exception) new Exception("Unknown padding")
+					.initCause(nspe);
+		}
+
+	}
+
+
+	private char[] getPass(char ePass[]) {
+		int len = ePass.length;
+		byte p[] = new byte[len];
+		char ret[] = new char[len];
+
+		Arrays.fill(p, (byte)0);
+		for (int row = 0; row < len; ++row) {
+			for (int col = 0; col < len; ++col) {
+				int bit = (int)((ePass[row] >>> ( len - 1 - col)) & 0x1);
+				p[col] |= (int)(bit << (len - 1 - row));
+			}
+		}
+
+		for (int i = 0; i <  len; ++i) {
+			ret[i] = (char) (~p[i] & 0xFF);
+		}
+		return ret;
+	}
+
+	public CipherPair initCiphers(char[] pass, byte[] salt, int count)
+			throws Exception {
+		try {
+
+			KeySpec keySpec = new PBEKeySpec(getPass(pass), salt, count);
+
+			SecretKey key = SecretKeyFactory.getInstance(SECRETKEY_ALGORITHM)
+					.generateSecret(keySpec);
+
+			return initCiphers(key, salt, count);
+
+		} catch (NoSuchAlgorithmException nsae) {
+			throw (Exception) new Exception("Invalid cipher algorithm")
+					.initCause(nsae);
+		} catch (InvalidKeySpecException ike) {
+			throw (Exception) new Exception("Invalid Key specification")
+					.initCause(ike);
+		}
+	}
+
+	public String encrypt(Cipher encryptor, String msg) throws Exception {
+
+		byte[] bytes;
+
+		bytes = msg.getBytes();
+		byte[] enc = null;
+		try {
+			enc = encryptor.doFinal(bytes);
+		} catch (IllegalBlockSizeException ibse) {
+			throw (Exception) new Exception("Invalid cipher block size")
+					.initCause(ibse);
+		} catch (BadPaddingException bpe) {
+			throw (Exception) new Exception("Incorrect cipher padding")
+					.initCause(bpe);
+		}
+		String encrypted = new sun.misc.BASE64Encoder().encode(enc);
+		
+		if (encrypted.contains("\n")){
+			encrypted.replaceAll("\r\n", "");
+		}
+		return  encrypted;
+	}
+
+	/**
+	 * This calls the other version of encrypt which requires access to this
+	 * class' package protected sitePair.  Allows callers outside of this
+	 * package to encrypt strings.
+	 * @param msg the string to be encrypted
+	 * @return the encrypted string
+	 * @throws DBTransporterException when encryption fails
+	 */
+	public String encrypt(String msg) throws Exception {
+		return encrypt(sitePair.encryptor, msg);
+	}
+
+	public byte[] decrypt(Cipher decryptor, String enc) throws Exception {
+		byte[] bytes = null;
+		try {
+			byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(enc);
+			bytes = decryptor.doFinal(dec);
+		} catch (java.io.IOException ioe) {
+			throw (Exception) new Exception("Decoding exception")
+					.initCause(ioe);
+		} catch (IllegalBlockSizeException ibse) {
+			throw (Exception) new Exception("Invalid cipher block size")
+					.initCause(ibse);
+		} catch (BadPaddingException bpe) {
+			throw (Exception) new Exception("Incorrect cipher padding")
+					.initCause(bpe);
+		}
+		return bytes;
+	}
+
+	/**
+	 * This calls the other version of decrypt which requires access to this
+	 * class' package protected sitePair.  Allows callers outside of this
+	 * package to decrypt strings.
+	 * @param msg the string to be decrypted
+	 * @return the decrypted string
+	 * @throws DBTransporterException when decryption fails
+	 */
+	public byte[] decrypt(String msg) throws Exception {
+		return decrypt(sitePair.decryptor, msg);
+	}
+
+	public class CipherPair {
+		Cipher encryptor;
+
+		Cipher decryptor;
+
+		private CipherPair() {
+		}
+
+		private CipherPair(Cipher encryptor, Cipher decryptor) {
+			this.encryptor = encryptor;
+			this.decryptor = decryptor;
+		}
+
+		private Cipher getDecryptor() {
+			return decryptor;
+		}
+
+		private void setDecryptor(Cipher decryptor) {
+			this.decryptor = decryptor;
+		}
+
+		private Cipher getEncryptor() {
+			return encryptor;
+		}
+
+		private void setEncryptor(Cipher encryptor) {
+			this.encryptor = encryptor;
+		}
+	}
+
+	/**
+	 * @return the secDir
+	 */
+	public String getSecDir() {
+		return secDir;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/PasswordOpts.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/PasswordOpts.java b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/PasswordOpts.java
new file mode 100644
index 0000000..16eac9a
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/PasswordOpts.java
@@ -0,0 +1,292 @@
+/**********************************************************************
+// @@@ 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 @@@
+**********************************************************************/
+/**
+ *
+ */
+package org.trafodion.ci.pwdencrypt;
+import java.util.Arrays;
+import java.util.Vector;
+
+public class PasswordOpts {
+
+	/**
+	 * Max length of encryptable text.
+	 */
+	private final int maxtextlen = 128;
+
+	/**
+	 * referencename.
+	 */
+	private String ref;
+	/**
+	 * text to be add/deleted.
+	 */
+	private String text;
+	/**
+	 * directory of the log file.
+	 */
+	private String dir;
+	/**
+	 * file name of the log file.
+	 */
+	private String file;
+	/**
+	 * work type to be done.
+	 */
+	private String wktype;
+      
+	static boolean doTrace = Boolean.getBoolean("trafci.enableTrace");
+	
+    
+
+	public static final Vector<String> OPTIONTYPES = new Vector<String>(
+			Arrays.asList("option", "username", "password", "logdir","logfile","help"));
+
+	/**
+	 * @param optsMap
+	 */
+	public PasswordOpts() {
+		ref = null;
+		text = null;
+		dir = null;
+		file = null;
+		wktype = null;
+
+	}
+
+	/**
+	 * Display help.
+	 *
+	 */
+	private void displayHelp() {
+		System.out.println("Usage: \n" +
+						  "	ciencr.sh -o [options] [args...] \n"+
+				          "where options include:\n"+
+				          "	add			add username and password\n"+
+				          "	del			del username and password\n"+
+				          "where args include:\n"+
+				          "	-u			specify username\n"+
+				          "	-p			specify password\n\n" +
+						  "Example to ecnrypt a user's password \n\n"+
+						  " ciencr.sh -o add -u <user name> -p <password>\n\n"+
+						  "Example to remove a user's password \n\n"+
+						  " ciencr.sh -o del -u <user name>\n\n");
+		/*System.out.println("-o/--option         "
+				+ "either add or del");
+		System.out.println("-u/--username       "
+				+ "username valid only for add and del");
+		System.out.println("-p/--password       "
+				+ "password valid only for add");
+		System.out.println("-l/--logdir         "
+				+ "Specify log file directory");
+		System.out.println("-f/--logfile        "
+				+ "Specify log file name");
+		System.out.println("-h/--help           "
+				+ "Display this message");*/
+
+	}
+
+	/**
+	 * Parse Commandline Args.
+	 * @param args The command to parsed
+	 */
+	public final void parseCommandLine(final String[] args) {
+
+			
+		if (args.length < 2 ) {			
+			displayHelp();
+			if(!(args.length > 0 && 
+				(args[0].contains("h") || 
+				args[0].equalsIgnoreCase("help")))){
+				System.exit(6);
+			}
+			System.exit(0);
+		}
+		
+		char flag;
+//		Matcher matcher = null;
+
+		boolean hasO = false;
+		for (int i = 0; i < args.length; i++) {
+			flag = '?';
+			try {
+				flag = args[i].charAt(1)=='-'? args[i].charAt(2): args[i].charAt(1);
+				if(args[i].length()> 2 && !(OPTIONTYPES.contains(args[i].substring(1).toLowerCase()))){
+						if (doTrace) 
+							System.out.println("Invalid option");
+						displayHelp();
+						System.exit(5);
+				}
+			} catch (Exception e) {
+				StringBuffer msg = new StringBuffer("\n\tError message: ");
+				msg.append(e.getMessage());
+				if (doTrace) { 
+					e.printStackTrace();
+				}
+				System.exit(5);
+			}
+			switch (flag) {
+			case 'o':
+				if (ArgMap.ARGMAP.get('o').isArgRequired()) {
+					i++;
+					if (WorkTypes.WORKTYPES.contains(args[i].toLowerCase())) {
+						wktype = args[i];
+					}else{
+						if (doTrace)
+							System.out.println("Option '"+args[i]+"' is not valid.");
+						displayHelp();
+						System.exit(5);
+					}
+				}
+				if(wktype == null){
+					if (doTrace)
+						System.out.println("Option is required.");
+					displayHelp();
+					System.exit(5);
+				}
+				hasO = true;
+				break;
+
+			case 'u':
+				if (ArgMap.ARGMAP.get('u').isArgRequired()) {
+					i++;
+					ref = args[i];
+					if(ref.charAt(0)=='-' || ref == null){	 if (doTrace)
+						System.out.println("Arg is u");
+						displayHelp();
+						System.exit(5);
+					}
+				}
+				break;
+
+			case 'p':
+				if (ArgMap.ARGMAP.get('p').isArgRequired()) {
+					i++;
+					if (i>=args.length){
+						displayHelp();
+						System.exit(5);
+					}						
+					text = args[i];
+					if (text == null || text.length() > maxtextlen) {
+						if (doTrace)
+							System.out.println("Arg is p");
+						displayHelp();
+						System.exit(5);
+					}
+				}
+				break;
+
+			case 'l':
+				if (ArgMap.ARGMAP.get('l').isArgRequired()) {
+					i++;
+					dir = args[i];
+				}
+				break;
+			case 'f':
+				if (ArgMap.ARGMAP.get('f').isArgRequired()) {
+					i++;
+					file = args[i];
+				}
+				break;
+			case 'h':
+				displayHelp();
+				System.exit(0);
+				break;
+			default:
+				if (doTrace) {
+					System.out.println("Default arg");
+					displayHelp();
+				}
+
+			break;
+			}
+
+		}
+		if (!hasO) {
+			if (doTrace)
+				System.out
+						.println("Error: '-o' is required");
+			displayHelp();
+			System.exit(0);
+		}
+		checkArgs();
+	}
+
+	/**
+	 * Checks the required args for add and del worktypes.
+	 *
+	 */
+	private void checkArgs() {
+
+			if (wktype.equalsIgnoreCase(WorkTypes.ADD)) {
+				if (ref == null || text == null) {
+					if (doTrace)
+						System.out.println("Errors in ADD WrkType ");
+					displayHelp();
+					System.exit(5);
+				}
+			}
+			else if (wktype.equalsIgnoreCase(WorkTypes.DEL)) {
+				/*if (ref == null) {
+					if (doTrace)
+						System.out.println("Errors in del WrkType ");
+				System.exit(5);
+				}*/
+			}
+	}
+
+	/**
+	 * @return the dir
+	 */
+	public final String getDir() {
+		return dir;
+	}
+
+	/**
+	 * @return the file
+	 */
+	public final String getFile() {
+		return file;
+	}
+
+	/**
+	 * @return the ref
+	 */
+	public final String getRef() {
+		return ref;
+	}
+
+	/**
+	 * @return the text
+	 */
+	public final String getText() {
+		return text;
+	}
+
+	/**
+	 * @return the wktype
+	 */
+	public final String getWktype() {
+		return wktype;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/RefLookup.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/RefLookup.java b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/RefLookup.java
new file mode 100644
index 0000000..a2a9a75
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/RefLookup.java
@@ -0,0 +1,127 @@
+/**********************************************************************
+// @@@ 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 @@@
+**********************************************************************/
+package org.trafodion.ci.pwdencrypt;
+
+import java.io.FileInputStream;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+import java.io.IOException;
+import java.io.File;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class RefLookup {
+	/** This pattern describes something like 
+	 * 'password = {DES}B/+8B2OcDkKWCFaCfwSwgQ==$'.
+	 * Or more specifically, the word "password" (case insensitive),
+	 * followed by any number of spaces, followed by an equal sign and any
+	 * number of spaces.  Then with or without quotes is any word or non-word 
+	 * characters .  The reference String is identified as group 1 and encrypted 
+	 * strinf * is identified as group 4 in the pattern "refPattern"
+	 */
+	private static Pattern refPattern = Pattern.compile(
+			"([^\\-]([^=](\\w*))*)((\\s*=\\s*\"*)([\\W*\\w*])*(\"*))", 
+			Pattern.CASE_INSENSITIVE);
+
+	public static String resolve(final String ref) {
+		if (ref == null || ref.length() == 0) {
+			return ref;
+		}
+		try {
+			//if (ref.charAt(0) == '$') {
+				JCE j = new JCE();
+
+			//	if (ref.charAt(1) == 'E') {
+					try{
+						if(! new File(j.getSecDir()).exists()){
+							System.out.println("File exists !!!");
+						}
+					//	System.out.println("File being read from ...encprops" + j.getSecDir());
+						FileInputStream fis = new FileInputStream(j.getSecDir() + "/encprops.txt");
+						j.initSiteEncryptionService();
+						String userName = ref.substring(0, ref.indexOf("=")-1);
+					//	System.out.println("ref stri = " + userName);
+						return new String(j.decrypt(j.sitePair.decryptor, findRef(fis, userName))); //ref.substring(0, ref.length()))));
+					}catch (IOException e) {
+
+						e.printStackTrace();
+					}
+
+			/*	}else {
+					try{
+					FileInputStream fis = new FileInputStream(j.getSecDir() + "/ctlprops.txt");
+					return findRef(fis, ref.substring(2,ref.length()-1));
+			      } catch (IOException e) {
+						e.printStackTrace();
+					}
+
+				} 
+			} */
+
+		} catch (Exception e) {
+			StringBuffer msg = new StringBuffer();
+			msg.append("\n\tError Message: ").append(e.getMessage());
+			e.printStackTrace();
+
+
+		}
+		return ref;
+	}
+
+	private static String findRef(FileInputStream fis, String ref) throws IOException{
+
+	  String strLine;
+//		String str[] = null;
+	    boolean match = false;
+	    String enc = null;
+	    String refStr=null;
+	    //Fixed the password reference matching logic , so now the partial reference inputs
+	    //will not be accepted and reports error in that case
+
+	    BufferedReader br = new BufferedReader(new InputStreamReader(fis));
+	    
+	    while ((strLine = br.readLine()) != null)   {
+	    	Matcher matcher = refPattern.matcher(strLine);
+	    	if(matcher.find()) {
+	    		refStr = matcher.group(1).trim(); //group(1) gives the reference String
+		    	//	System.out.println("strLine1=" + refStr);
+				if( refStr.equals(ref)){
+				       // The password to be encrypted
+					enc = matcher.group(4).trim(); //group(4) gives the encrypted value
+					match = true;
+				//	System.out.println("strLine2=" + enc);
+				}
+				if(match)
+					break;
+	    	}
+	    }
+	    if(!match){
+	    	System.out.println("Match failed!!");
+	    	System.exit(0);
+	    }
+	    	
+	    //Trims lead " = {DES}" if present. Would be present when Encrypted.
+		return enc.replaceFirst("=", "").trim().replace("{DES}", "");
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/WorkTypes.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/WorkTypes.java b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/WorkTypes.java
new file mode 100644
index 0000000..9bd34e1
--- /dev/null
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/pwdencrypt/WorkTypes.java
@@ -0,0 +1,55 @@
+/**********************************************************************
+// @@@ 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 @@@
+**********************************************************************/
+package org.trafodion.ci.pwdencrypt;
+import java.util.Arrays;
+import java.util.Vector;
+
+/**
+ * Defines the valid options for the -o arg.
+ *
+ */
+public class WorkTypes {
+
+	/**
+	 * Install type.
+	 */
+	public static final String INSTALL = "install";
+	/**
+	 * Add text work type.
+	 */
+	public static final String ADD = "add";
+	/**
+	 * Delete text work type.
+	 */
+	public static final String DEL = "del";
+	/**
+	 * Unknown work type.
+	 */
+	public static final String UNKNOWN = "unknown";
+	
+	/**
+	 * Valid set of worktypes. 
+	 */
+	public static final Vector<String> WORKTYPES = new Vector<String>(
+			Arrays.asList(INSTALL, ADD, DEL, UNKNOWN));
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/resources/install_jar.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/resources/install_jar.xml b/core/conn/trafci/src/main/resources/install_jar.xml
new file mode 100644
index 0000000..a79fdd5
--- /dev/null
+++ b/core/conn/trafci/src/main/resources/install_jar.xml
@@ -0,0 +1,49 @@
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+	<id>install_jar</id>
+	<formats>
+		<format>jar</format>
+	</formats>
+	<includeBaseDirectory>false</includeBaseDirectory>
+	<fileSets>
+		<fileSet>
+			<directory>${basedir}/utils/</directory>
+			<includes>
+			<include>ciencr.sh</include>
+			<include>trafci</include>
+			<include>trafci-perl.pl</include>
+			<include>trafci.cmd</include>
+			<include>trafci.sh</include>
+			<include>trafci-python.py</include>
+			<include>trafci.pl</include>
+			<include>trafci.py</include>
+			</includes>
+			<outputDirectory>/bin</outputDirectory>
+		</fileSet>
+		<fileSet>
+			<directory>${basedir}/lib</directory>
+			<outputDirectory>/lib</outputDirectory>
+		</fileSet>
+		<fileSet>
+			<directory>${basedir}/samples</directory>
+			<outputDirectory>/samples</outputDirectory>
+		</fileSet>
+		<fileSet>
+			<directory>${basedir}/target/installer-classes</directory>
+			<outputDirectory>/</outputDirectory>
+		</fileSet>
+	</fileSets>
+	<!-- <files>
+		<file>
+			<source>${basedir}/utils/trafci.cmd</source>
+			<outputDirectory>/bin</outputDirectory>
+			<destName>trafci.cmd</destName>
+		</file>
+		<file>
+			<source>${basedir}/utils/trafci.sh</source>
+			<outputDirectory>/bin</outputDirectory>
+			<destName>trafci.sh</destName>
+		</file>
+	</files> -->
+</assembly>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/main/resources/install_tar.xml
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/resources/install_tar.xml b/core/conn/trafci/src/main/resources/install_tar.xml
new file mode 100644
index 0000000..391e74b
--- /dev/null
+++ b/core/conn/trafci/src/main/resources/install_tar.xml
@@ -0,0 +1,29 @@
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+	<id>install_tar</id>
+	<formats>
+		<format>tar</format>
+	</formats>
+	<includeBaseDirectory>false</includeBaseDirectory>
+	<fileSets>
+		<fileSet>
+			<directory>${basedir}/utils/</directory>
+			<outputDirectory>/</outputDirectory>
+			<includes><include>README</include>
+			</includes>
+		</fileSet>
+		<fileSet>
+			<directory>target</directory>
+			<includes><include>trafciInstaller.jar</include></includes>
+			<outputDirectory>/</outputDirectory>
+		</fileSet>
+	</fileSets>
+	<!-- <files>
+		<file>
+			<source>target/trafciInstaller.tar</source>
+			<outputDirectory>/</outputDirectory>
+			<destName>trafci.tar</destName>
+		</file>
+	</files> -->
+</assembly>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/AWTExceptionHandler.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/AWTExceptionHandler.java b/core/conn/trafci/src/org/trafodion/ci/AWTExceptionHandler.java
deleted file mode 100644
index eceaada..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/AWTExceptionHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class AWTExceptionHandler{
-    
-    public AWTExceptionHandler(){
-    }
-    
-    public void handle(Throwable t)
-    { 
-        if(Boolean.getBoolean("trafci.enableTrace"))
-        {
-            System.out.println("TrafCI Captured AWT Stack Trace:");
-            t.printStackTrace();
-        }
-    } 
-}  

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/CSVDisplay.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/CSVDisplay.java b/core/conn/trafci/src/org/trafodion/ci/CSVDisplay.java
deleted file mode 100644
index 2db7575..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/CSVDisplay.java
+++ /dev/null
@@ -1,90 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-public class CSVDisplay implements IDisplay {
-
-	private Query qryObj;
-	private Writer writer=null;
-	private Session sessObj=null;
-	private int colCount=1;
-	
-	public CSVDisplay(Session sessObj)
-	{
-		if (sessObj != null)
-		{
-			this.sessObj = sessObj;
-			this.writer=sessObj.getWriter();
-			this.qryObj=sessObj.getQuery();
-		}
-	}
-
-	public void output(OutputContents contents) throws IOException {
-		// TODO Auto-generated method stub
-		if(contents!=null)
-		{
-			this.writer=sessObj.getWriter();
-			this.qryObj=sessObj.getQuery();
-			//display contents
-			ArrayList<OutputColumnAttribute> columns = contents.getColumns();
-			ArrayList<ArrayList<String>> alRows = contents.getRows();
-			qryObj.setColCount(String.valueOf(columns.size()));
-			
-			if(alRows!=null && alRows.size()>0)
-			{
-				for(int i=0;i<alRows.size();i++)
-				{
-					ArrayList<String> alRow = alRows.get(i);
-					if(alRow!=null && alRow.size()>0)
-					{
-						for(int j=0;j<alRow.size();j++)
-						{
-							writer.write(alRow.get(j));
-				            if (qryObj.getColCount() != null)
-				            {
-				               if (colCount == Integer.parseInt(qryObj.getColCount()))
-				               {
-				                  writer.write(SessionDefaults.lineSeperator);
-				                  colCount=1;
-				                  break;
-				               }
-				            }
-				            colCount++;
-				            if (sessObj.getStrDisplayFormat().equalsIgnoreCase("COLSEP"))
-				               writer.write(sessObj.getSessionColSep());
-				            else
-				               writer.write(",");
-				            //wrong code
-//				            break;
-						}
-					}
-					
-				}
-
-			}
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/Column.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/Column.java b/core/conn/trafci/src/org/trafodion/ci/Column.java
deleted file mode 100644
index ac506a1..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/Column.java
+++ /dev/null
@@ -1,131 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class Column
-{
-
-   Column()
-   {
-   }
-
-   int maxColSize = 0;
-   int actualColValSize = 0;
-   int maxDisplayColSize = 0;
-   int currentIndexPos = 0;
-   String columnName = null;
-
-   boolean isColWrap = false;
-   boolean isLeftAligned = true;
-   boolean isDone = false;
-   boolean isTrim=false;
-   boolean isHeader = false;
-
-   String colVal = null;
-   String fillerStr = null;
-   char fillChar = ' ';
-
-   // This method set the length for each column
-   public void setLength (int maxColSize, int maxDisplayColSize)
-   {
-      this.maxColSize = maxColSize;
-      this.maxDisplayColSize = maxDisplayColSize;
-      //Set columns wrapped to true if metadata colsize is greater than display colsize
-      this.isColWrap = this.maxColSize >  this.maxDisplayColSize?true:false;
-      //If columns are wrapped then, set the maximum display size to be that set by the session object
-		if (!isColWrap)
-			this.maxDisplayColSize = this.maxColSize;
-
-      //this.maxDisplayColSize = this.isColWrap?this.maxDisplayColSize:this.maxColSize;
-   }
-
-   // This method sets the filler character of space for each column based on the data for each column
-   public void setFillChar(char fillChar)
-   {
-      StringBuffer fillBuf = new StringBuffer();
-
-      for (int i = 0; i < this.maxDisplayColSize; i++)
-      {
-         fillBuf.append(fillChar);
-      }
-
-      this.fillerStr = fillBuf.toString();
-      fillBuf = null;
-   }
-
-   // This method set the column value
-   public void setColValue(String colVal)
-   {
-      if (this.isTrim)
-      {
-         colVal= colVal.trim(); //Remove the extra blanks 
-      }
-      this.actualColValSize = colVal.length();
-      //if column data length is greater than meta data legth then substring it to metadata length
-      this.colVal = this.actualColValSize > this.maxColSize?colVal.substring(0, this.maxColSize):colVal;
-      this.currentIndexPos = 0;
-      this.isDone = false;
-      this.isHeader =false;
-   }
-
-   public String getColValue()
-   {
-
-      if (isDone)
-         return this.fillerStr;
-
-      if (!this.isColWrap)
-      {
-         isDone = true;
-
-         if (this.isLeftAligned || this.isHeader)
-            return this.colVal.substring(this.currentIndexPos)+this.fillerStr.substring(this.colVal.substring(this.currentIndexPos).length(),this.maxDisplayColSize);
-         else
-            return this.fillerStr.substring(this.colVal.substring(this.currentIndexPos).length(),this.maxDisplayColSize)+this.colVal.substring(this.currentIndexPos);
-      }
-
-      if (currentIndexPos + this.maxDisplayColSize <= this.actualColValSize)
-      {
-         this.currentIndexPos += this.maxDisplayColSize;
-         return this.colVal.substring(this.currentIndexPos - this.maxDisplayColSize,this.currentIndexPos);
-      }
-      isDone = true;
-      if (this.isLeftAligned || this.isHeader)
-         return this.colVal.substring(this.currentIndexPos)+this.fillerStr.substring(this.colVal.substring(this.currentIndexPos).length(),this.maxDisplayColSize);
-      else
-         return this.fillerStr.substring(this.colVal.substring(this.currentIndexPos).length(),this.maxDisplayColSize)+this.colVal.substring(this.currentIndexPos);
-   }
-
-   public void setLeftAligned(boolean isLeftAligned)
-   {
-      this.isLeftAligned = isLeftAligned;
-   }
-
-   public boolean isDone()
-   {
-      return this.isDone;
-   }
-
-   public void setTrim(boolean isTrim)
-   {
-      this.isTrim=isTrim;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ConditionalQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ConditionalQuery.java b/core/conn/trafci/src/org/trafodion/ci/ConditionalQuery.java
deleted file mode 100644
index fba85ba..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ConditionalQuery.java
+++ /dev/null
@@ -1,435 +0,0 @@
-// @@@ 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 @@@
-
-package org.trafodion.ci;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.regex.Pattern;
-
-public class ConditionalQuery extends QueryWrapper implements SessionDefaults{
-	
-	private HashMap<String, String> cqKeyMap = null;
-   	private String gotoLabel = "";				// the label we are waiting to see
-   	private int variableType = -1;
-	private int valueType = -1;
-	private String strPendingAction = null;
-   	
-   	/* types of values passed to conditional statements */
-   	private static final int VARIABLE = 0;
-   	private static final int STRING = 1;
-   	private static final int INTEGER = 2;
-   	/* enums not available in 1.4 :( */
-   	
-   	
-	/* Constructor */
-	public ConditionalQuery(){}
-	
-	public ConditionalQuery(Session sessObj){
-	    super(sessObj);
-	    cqKeyMap = new HashMap<String, String>();
-	    loadCqKeyWordMap();
-	}
-	
-	public void execute() throws ConditionalQueryException, UserInterruption, IOException
-	{
-		// reset error
-		cqe.setError(null);
-		
-		String label = null;
-		init();
-		isMultiLine = sessObj.getQuery().isMultiLine();
-		blankLiner = false;
-		readQuery();
-		blankLiner = true;
-		
-        // get the QueryId and directly process that command
-        switch (sessObj.getQuery().getQueryId())
-        {
-        	case IF_THEN:
-				if(!getGotoLabel().equals(""))
-					break;
-				
-				// reset types
-				valueType = -1;
-				variableType = -1;
-				
-				String variable = parser.getConditionalVariable(this.queryStr);
-				String operator = parser.getConditionalOperator(this.queryStr);
-				String value = parser.getConditionalValue(this.queryStr);
-				String action = parser.getConditionalAction(this.queryStr);
-				
-				if(variable == null || operator == null || value == null || action == null){
-					throw cqe;
-				}
-				
-				/* strip begin/end quotes and beginning % from variable */
-				variable = format(variable, true);
-				
-				if(variableType != STRING)
-				{
-					Object tmpObj = getValue(variable);
-					
-					if(tmpObj == null)
-					{
-						if(isInteger(variable))
-						{
-							variableType = INTEGER;
-						}
-						else
-						{
-							/* not a valid integer, must have been an unresolved variable */
-						    ErrorObject varNotFound = new ErrorObject(SessionError.VARIABLE_NOT_FOUND.errorCode(), 
-						                                              SessionError.VARIABLE_NOT_FOUND.errorMessage() + "'" + variable + "'.");
-							cqe.setError(varNotFound);
-							throw cqe;
-						}
-					}
-					else
-					{
-						variable = tmpObj.toString();
-						variableType = VARIABLE;
-					}
-					
-				}
-				
-				/* strip begin/end quotes and beginning % from value */
-				value = format(value, false);
-				
-				if(valueType != STRING)
-				{
-					Object tmpObj = getValue(value);
-					
-					if(tmpObj == null)
-					{
-						if(isInteger(value))
-							valueType = INTEGER;
-						else
-						{
-							/* not a valid integer, must have been an unresolved variable */
-						    ErrorObject varNotFound = new ErrorObject(SessionError.VARIABLE_NOT_FOUND.errorCode(), 
-						                                              SessionError.VARIABLE_NOT_FOUND.errorMessage() + "'" + value + "'.");
-							cqe.setError(varNotFound);
-							throw cqe;
-						}
-					}
-					else
-					{
-						value = tmpObj.toString();
-						valueType = VARIABLE;
-					}
-				}
-				
-				if(compare(variable, operator, value))
-				{
-					/* condition passed, set pending action */
-					strPendingAction = action + sessObj.getSessionSQLTerminator();
-				}
-				else
-				{
-					/* condition failed, do not set a pending action */
-					strPendingAction = null;
-				}
-				break;
-				
-			case GOTO:
-				if(!getGotoLabel().equals(""))
-					break;
-				
-				parser.getNextKeyToken(); // skip first token
-				label = parser.getNextValueToken();
-                
-				if(parser.hasMoreTokens())
-                    writeSyntaxError(this.queryStr,parser.getRemainderStr());
-                else
-                {
-    				if(label != null){
-    					setGotoLabel(label);
-                        writer.writeln();
-                        
-                        ErrorObject goto_msg = new ErrorObject(SessionError.GOTO_MESSAGE.errorCode(), 
-												SessionError.GOTO_MESSAGE.errorMessage() + label + "'command is encountered.",SessionError.GOTO_MESSAGE.errorType);
-                        writer.writeError(sessObj, goto_msg);
-                        
-    				}else
-    				    writeSyntaxError(this.queryStr,parser.getRemainderStr());
-                }
-                
-				break;
-				
-			case LABEL:
-				parser.getNextKeyToken(); // skip first token
-				label = parser.getNextValueToken();
-				
-				if(parser.hasMoreTokens())
-				    writeSyntaxError(this.queryStr,parser.getRemainderStr());
-				else
-				{
-    				if(label != null)
-    				{
-    				    if(label.equals(getGotoLabel())){
-    				        writer.writeln();
-                            writer.writeError(sessObj, SessionError.MATCHING_LABEL);
-    				        setGotoLabel("");
-    				    }
-    				}else if(getGotoLabel().equals(""))
-    				    writeSyntaxError(this.queryStr,parser.getRemainderStr());
-    				else
-    				{
-                        /* give a warning */
-                        ErrorObject labelWarning = new ErrorObject(SessionError.LABEL_WARNING.errorCode(), 
-                                                                  SessionError.LABEL_WARNING.errorMessage(),'W');
-                        cqe.setError(labelWarning);
-                        throw cqe;
-    				}
-				}
-				
-				break;
-		}
-	}
-
-	// change throws UserInterruption to custom error
-	public Object getValue(String variable) throws ConditionalQueryException
-	{
-		/* get the variable's value */
-		Object variableValue = null;
-		
-		if(variable.startsWith("?"))
-		{
-			variableValue = sessObj.getSessParams(variable.substring(1));
-			if(variableValue == null)
-			{
-			    ErrorObject paramNotFound = new ErrorObject(SessionError.PARAM_NOT_FOUND.errorCode(), 
-			                                                SessionError.PARAM_NOT_FOUND.errorMessage() + variable + " was not found");
-				cqe.setError(paramNotFound);
-				throw cqe;
-			}
-		}
-		else
-		{
-			variableValue = sessObj.getEnv(variable);
-		}
-		
-		return variableValue;
-	}
-	public boolean compare(String variable, String operator, String value) throws ConditionalQueryException
-	{
-		int compareType = -1;
-		
-		if(valueType != variableType)
-		{
-			if(valueType == VARIABLE)
-				compareType = variableType;
-			else if(variableType == VARIABLE)
-				compareType = valueType;
-			else if(variableType == INTEGER && valueType == STRING ||
-						variableType == STRING && valueType == INTEGER)
-			{
-				if(variableType == STRING)
-					cqe.setError(SessionError.STR_INT_COMPARISON);
-				else
-					cqe.setError(SessionError.INT_STR_COMPARISON);
-				
-				throw cqe;
-			}
-		}
-		else{
-			/* if both are variables, see if both are integers, 
-			 * otherwise treat them as strings
-			 */
-			if(valueType == VARIABLE)
-			{
-				if(isInteger(variable) && isInteger(value))
-					valueType = INTEGER;
-				else
-					valueType = STRING;
-			}
-			compareType = valueType;
-		}
-		
-		switch(compareType){
-			case STRING:
-					if(operator.equals("=") || operator.equals("=="))
-					{
-						return variable.equals(value);	
-					}
-					else if(operator.equals("<>") || operator.equals("!=") || 
-					        operator.equals("~=") || operator.equals("^="))
-					{
-						return !variable.equals(value);
-					}
-					else
-					{
-						
-					    if(operator.equals("<") || operator.equals(">") || operator.equals("<=") ||  operator.equals(">="))
-					    {
-				             ErrorObject invalidStrComp = new ErrorObject(SessionError.INVALID_STRING_COMPARE.errorCode(), 
-                                                                         SessionError.INVALID_STRING_COMPARE.errorMessage() + "'" + operator + "'.");
-      
-					        cqe.setError(invalidStrComp);
-					    }
-					    
-					    // invalid operator exception
-						throw cqe;
-					}
-					/* break not necessary, this is unreachable */
-			case INTEGER:
-					try
-					{
-						if(!(isInteger(variable) && isInteger(value)))
-						{
-							if(isInteger(value))
-								cqe.setError(SessionError.STR_INT_COMPARISON);
-							else
-								cqe.setError(SessionError.INT_STR_COMPARISON);
-							
-							throw cqe;
-						}
-						else
-						{
-							
-							int variableInt = Integer.parseInt(variable);
-							int valueInt = Integer.parseInt(value);
-							
-							if(operator.equals("=") || operator.equals("=="))
-							{
-								return variableInt == valueInt;	
-							}
-							else if(operator.equals("<>") || operator.equals("!=") || 
-							        operator.equals("~=") || operator.equals("^="))
-							{
-								return variableInt != valueInt;
-							}
-							else if(operator.equals("<"))
-							{
-								return variableInt < valueInt;
-							}
-							else if(operator.equals(">"))
-							{
-								return variableInt > valueInt;
-							}
-							else if(operator.equals("<="))
-							{
-								return variableInt <= valueInt;
-							}
-							else if(operator.equals(">="))
-							{
-								return variableInt >= valueInt;
-							}
-							else
-							{
-								// invalid operator exception
-								throw cqe;
-							}
-						}
-					}
-					catch(NumberFormatException nfe)
-					{
-						// TODO: FIX ERROR
-						nfe.printStackTrace();
-					}
-					/* break not necessary, this is unreachable */
-		}
-		
-		return false;
-	}
-	
-	/* strip out beginning % and quotes */
-	private String format(String var, boolean isVariable)
-	{
-		String temp = var;
-		
-		if(var.startsWith("%"))
-			temp = var.substring(1, var.length());
-		
-		
-		if(temp.startsWith("\"") && temp.endsWith("\""))
-		{
-			if(temp.length() > 2)
-				temp = temp.substring(1, temp.length()-1);
-			else
-				temp = "";
-			
-			if(isVariable)
-				variableType = STRING;
-			else
-				valueType = STRING;
-		}
-		
-		return temp;
-	}
-	
-	private void loadCqKeyWordMap()
-	{
-		cqKeyMap.put("IF", ""+IF_THEN);
-		cqKeyMap.put("LABEL", ""+LABEL);
-		cqKeyMap.put("GOTO", ""+GOTO);
-	}
-	
-	public boolean isInteger(String str)
-	{
-		return Pattern.matches("^-?\\d+$",str); 
-	}
-	
-	
-	/* 
-     * repeated code from interface query, perhaps move out of IQ and make public somewhere else?
-     */
-    private void writeSyntaxError(String queryStr, String remainderStr) throws IOException
-    {
-        sessObj.getQuery().setStatusCode(-1); // update the error code to -1
-        
-        if(sessObj.getDisplayFormat() != SessionDefaults.XML_FORMAT)
-            writer.writeln();
-        
-        writer.writeSyntaxError(sessObj, this.queryStr,remainderStr);
-    }
-    
-    /* Getter/Setter Methods ****/
-	
-	private void setGotoLabel(String label){
-		this.gotoLabel = label;
-	}
-	
-	public String getGotoLabel(){
-		return this.gotoLabel;
-	}
-
-	public String getPendingAction(){
-		String tmpAction = strPendingAction;
-		strPendingAction = null;
-		return tmpAction;
-	}
-	
-	public boolean isPendingAction()
-	{
-		return strPendingAction != null;
-	}
-	
-	public void setQueryString(String q){
-		this.queryStr = q;
-	}
-	
-	public String getQueryString(){
-		return this.queryStr;
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ConditionalQueryException.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ConditionalQueryException.java b/core/conn/trafci/src/org/trafodion/ci/ConditionalQueryException.java
deleted file mode 100644
index bbce043..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ConditionalQueryException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-public class ConditionalQueryException extends Exception{
-
-	/**
-	 * 
-	 */
-    ErrorObject errMsg = null;
-	private static final long serialVersionUID = 1L;
-
-	ConditionalQueryException()
-	{
-		super();
-	}
-	
-	public ErrorObject getErrorMsg(){
-		return this.errMsg;
-	}
-	
-	public void setError(ErrorObject err){
-	    this.errMsg = err;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/de7e7d4e/core/conn/trafci/src/org/trafodion/ci/ConditionalSyntaxError.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/org/trafodion/ci/ConditionalSyntaxError.java b/core/conn/trafci/src/org/trafodion/ci/ConditionalSyntaxError.java
deleted file mode 100644
index b8d09e7..0000000
--- a/core/conn/trafci/src/org/trafodion/ci/ConditionalSyntaxError.java
+++ /dev/null
@@ -1,123 +0,0 @@
-// @@@ 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 @@@
-package org.trafodion.ci;
-
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-public class ConditionalSyntaxError  {
-
-	
-	private StringBuffer errMesg=null;
-	private String errPrefix= "";
-
-	Pattern patVariable = Pattern.compile("^((?i:IF)(\\s|\\n)+((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^(\\n|\\s|!=|<>|>=|<=|>|<|=|==)]+)?)(.+)?\\z", Pattern.DOTALL);
-	Pattern patOperator = Pattern.compile("^((?i:IF)(\\s|\\n)+((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^(\\n|\\s|!=|<>|>=|<=|>|<|=|==)]+)(\\s|\\n)*(!=|<>|>=|<=|>|<|==|=)?)(.*)\\z", Pattern.DOTALL);
-	Pattern patValue    = Pattern.compile("^((?i:IF)(\\s|\\n)+((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^(\\n|\\s|!=|<>|>=|<=|>|<|=|==)]+)(\\s|\\n)*(!=|<>|>=|<=|>|<|==|=)(\\s|\\n)*((\"(\"(?=\")|\\\\(?=\")|.)*?\")|[^(\\s|\\n|!=|<>|>=|<=|>|<|=|==)]+)?)(.+)\\z", Pattern.DOTALL);
-
-	ConditionalSyntaxError()
-	{
-		
-	}
-	
-	public String testVariable(String qryString){
-		Matcher m = patVariable.matcher(qryString);
-		if(m.find())
-			return m.group(m.groupCount());
-		
-		return null;
-	}
-	
-	public String testOperator(String qryString){
-		Matcher m = patOperator.matcher(qryString);
-		if(m.find())
-			return m.group(m.groupCount());
-		
-		return null;	
-	}
-	
-	public String testValue(String qryString){
-		Matcher m = patValue.matcher(qryString);
-		if(m.find())
-			return m.group(m.groupCount()).trim();		
-		
-		return null;
-	}
-	
-	public void setSyntaxError(String qryString, String errLoc)
-	{
-		if(errMesg == null)
-		{
-			errMesg=new StringBuffer();
-		}
-	
-		this.errMesg.delete(0,errMesg.length());
-		
-		this.errMesg.append(errPrefix);
-		this.errMesg.append("\n");
-		this.errMesg.append(qryString);
-		this.errMesg.append("\n");
-
-		for(int i=0; i < qryString.length()-errLoc.length();i++)
-			this.errMesg.append(" ");
-		
-		this.errMesg.append("^");		
-	}
-	
-	public ErrorObject getSyntaxError(String qryString)
-	{
-		
-		if(qryString != null)
-		{
-			qryString=qryString.replaceAll("\\n"," ").trim();
-		}
-
-		String testVar = testVariable(qryString);
-		String testOp = testOperator(qryString);
-		String testVal = testValue(qryString);
-
-		String errLoc = "";
-		
-		if(testVal != null)
-		{
-			errPrefix = "A conditional syntax error occurred at or before:";
-			errLoc = testVal;
-		}
-		else if(testOp != null)
-		{
-			errPrefix = "A conditional operator syntax error occurred at or before:";
-			errLoc = testOp;
-		}
-		else
-		{
-			errPrefix = "A conditional variable syntax error occurred at or before:";
-			if(testVar == null)
-				testVar = qryString.charAt(qryString.length()-1)+"";
-
-			errLoc = testVar;
-		}
-		
-		setSyntaxError(qryString, errLoc);
-		return new ErrorObject(SessionError.GENERIC_SYNTAX_ERROR_CODE, errMesg.toString());
-	}
-	
-
-}


[28/38] incubator-trafodion git commit: replace ant with make

Posted by li...@apache.org.
replace ant with make


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

Branch: refs/heads/master
Commit: dfe4b5649782770a84478a96ebf99c02cf4934ee
Parents: aba0352
Author: AlexPeng19 <al...@hotmail.com>
Authored: Tue Nov 22 14:40:51 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Tue Nov 22 14:40:51 2016 +0800

----------------------------------------------------------------------
 core/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/dfe4b564/core/Makefile
----------------------------------------------------------------------
diff --git a/core/Makefile b/core/Makefile
index 5cac37d..de7e249 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -79,7 +79,7 @@ ndcs: jdbc_jar foundation
 
 ci: trafci
 trafci: jdbc_jar
-	cd conn/trafci && $(ANT) dist 2>&1 | sed -e "s/$$/	##(TRAFCI)/" ; exit $${PIPESTATUS[0]}
+	cd conn/trafci && $(MAKE) 2>&1 | sed -e "s/$$/	##(TRAFCI)/" ; exit $${PIPESTATUS[0]}
 
 jdbc_type2_jar: verhdr foundation
 	cd conn/jdbc_type2 && $(ANT)  2>&1 | sed -e "s/$$/	##(JDBC_TYPE2)/" ; exit $${PIPESTATUS[0]}
@@ -105,7 +105,7 @@ clean: sqroot
 	cd dbsecurity &&		$(MAKE) clean
 	cd sqf &&			$(MAKE) clean
 	cd conn/odbc/src/odbc &&	$(MAKE) clean
-	cd conn/trafci        &&	$(ANT) clean
+	cd conn/trafci        &&	$(MAKE) clean
 	cd conn/jdbcT4        &&	$(MAKE) clean
 	cd conn &&			$(MAKE) clean
 	cd conn/jdbc_type2 &&		$(ANT) clean && $(MAKE) clean
@@ -121,7 +121,7 @@ cleanall: sqroot eclipseclean cleantests
 	cd dbsecurity &&		$(MAKE) cleanall
 	cd sqf &&			$(MAKE) cleanall
 	cd conn/odbc/src/odbc &&	$(MAKE) cleanall
-	cd conn/trafci        &&	$(ANT) clean
+	cd conn/trafci        &&	$(MAKE) clean
 	cd conn/jdbcT4        &&	$(MAKE) clean
 	cd conn &&			$(MAKE) clean
 	cd conn/jdbc_type2 &&	        $(ANT) clean && $(MAKE) clean


[37/38] incubator-trafodion git commit: store the jdbc connection info in the properties

Posted by li...@apache.org.
store the jdbc connection info in the properties


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

Branch: refs/heads/master
Commit: 9ee378b621de0bbb32bf2bc3987209a478d46b4d
Parents: 3cea666
Author: AlexPeng19 <al...@hotmail.com>
Authored: Mon Dec 5 16:15:42 2016 +0800
Committer: AlexPeng19 <al...@hotmail.com>
Committed: Mon Dec 5 16:15:42 2016 +0800

----------------------------------------------------------------------
 .../trafci/src/main/resources/trafci.properties |  5 ++
 .../org/trafodion/ci/UserInterfaceTest.java     | 90 +++++++++++++++++---
 2 files changed, 84 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9ee378b6/core/conn/trafci/src/main/resources/trafci.properties
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/resources/trafci.properties b/core/conn/trafci/src/main/resources/trafci.properties
new file mode 100644
index 0000000..870a149
--- /dev/null
+++ b/core/conn/trafci/src/main/resources/trafci.properties
@@ -0,0 +1,5 @@
+db.host=-h 10.10.10.8:23400 
+db.user= -u trafodion 
+db.pwd= -p traf123 
+db.query= -q values(1)
+output.file.name=output.txt
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9ee378b6/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java b/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
index 4020e12..9b63313 100644
--- a/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
+++ b/core/conn/trafci/test/main/java/org/trafodion/ci/UserInterfaceTest.java
@@ -20,29 +20,97 @@
 // @@@ END COPYRIGHT @@@
 package org.trafodion.ci;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
 
 import org.junit.Test;
 
 public class UserInterfaceTest {
 
 	@Test
-	public void test() {
-		MySecurityManager secManager = new MySecurityManager();
-		System.setSecurityManager(secManager);
+	public void testUserInterfaceMain() throws FileNotFoundException {
+		// MySecurityManager secManager = new MySecurityManager();
+		/*System.setSecurityManager(secManager);*/
 		try {
-			String[] params = "-h 10.10.12.99:23400 -u trafodion -p traf123 -q values(1);".split("\\s+");
-			UserInterface.main(params);
+			FileInputStream fs = new FileInputStream("src/main/resources/trafci.properties");
+			Properties prop = new Properties();
+			try {
+				prop.load(fs);
+				String host = prop.getProperty("db.host");
+				String user = prop.getProperty("db.user");
+				String pwd = prop.getProperty("db.pwd");
+				String query = prop.getProperty("db.query");
+				assertNotNull(prop);
+				assertNotNull(fs);
+				System.out.println(host + user + pwd);
+				String[] params = (host + user + pwd + query).split("\\s+");
+				System.out.println((host + user + pwd + query).split("\\s+"));
+				UserInterface.main(params);
+
+			} catch (IOException e1) {
+				// TODO Auto-generated catch block
+				e1.printStackTrace();
+			}
 		} catch (SecurityException e) {
 			assertTrue(true);
 		}
 	}
 
-}
+	@Test
+	public void testWithRuntime() {
+		try {
+			FileInputStream fs = new FileInputStream("src/main/resources/trafci.properties");
+			Properties prop = new Properties();
+			prop.load(fs);
+			String host = prop.getProperty("db.host");
+			String user = prop.getProperty("db.user");
+			String pwd = prop.getProperty("db.pwd");
+			String query = prop.getProperty("db.query");
+
+			Process p = Runtime.getRuntime().exec("trafci -h " + host + " -u " + user + " -p " + pwd + " -q " + query);
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
 
-class MySecurityManager extends SecurityManager {
-	@Override
-	public void checkExit(int status) {
-		throw new SecurityException();
 	}
+
+	@Test
+	public void testWithNewProcess() throws FileNotFoundException {
+		FileInputStream fs;
+		ProcessBuilder pb = null;
+		try {
+			fs = new FileInputStream("src/main/resources/trafci.properties");
+
+			Properties prop = new Properties();
+			prop.load(fs);
+			String host = prop.getProperty("db.host");
+			String user = prop.getProperty("db.user");
+			String pwd = prop.getProperty("db.pwd");
+			String query = prop.getProperty("db.query");
+			String output=prop.getProperty("output.file.name");
+
+			pb = new ProcessBuilder("trafci", "-h", host, "-u", user, "-p", pwd, "-q", query);
+			pb.redirectErrorStream(true);
+			File f = new File(output);
+			pb.redirectOutput(f);
+			Process p = pb.start();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
 }
+/*
+ * class MySecurityManager extends SecurityManager {
+ * 
+ * @Override public void checkExit(int status) { throw new SecurityException();
+ * } }
+ */
\ No newline at end of file