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:36 UTC
[09/38] incubator-trafodion git commit: convert trafci project into
maven project
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("<", "<").replaceAll(">", ">") + _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("<", "<").replaceAll(">", ">") + _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("<", "<").replaceAll(">", ">") + _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("<", "<").replaceAll(">", ">");
- 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("<", "<").replaceAll(">", ">");
- 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;
- }
-}