tppt.db
Class GlobalData

java.lang.Object
  |
  +--tppt.db.GlobalData

public class GlobalData
extends java.lang.Object

This class stores all the global variables, constants and methods that are needed for an experiment.

Author:
Helen Yi Ren, Last modified by jodie Change list -- The DB realted setting read from the server.xml and the file is located in the root of jar file.

Field Summary
static java.lang.String accntName
          The usre account.
static java.lang.String accntPasswd
          The user password.
static java.util.Vector allParaFields
          a Vector to store all the Parameter Names.
static java.lang.String argDir
          The path of argument files.
static java.lang.String argFileExt
          The extension of argument file.
static java.util.Vector argumentFileNames
          Deprecated. this variable is useless.
static java.lang.String chosenDBMS
          The chosen DBMS by user.
static java.lang.String dbDriver
          The jdbc driver string
static java.lang.String dbInitFile
          The path if user database initialization file.
static java.util.Vector DBMS
          For the multi-database support.
static java.lang.String dbName
          The name of DBMS
static java.lang.String dbSchemaFile
          The path of user database schema file.
static java.util.HashMap dbSettingMap
          Stored the DB setting reading from server.xml in the hastable.
static java.lang.String dbURL
          The jdbc url
static java.util.Vector Deadlocknumoftrans
          a array to store number of deadlocks for each transaction type
static double DeadLockTime
          the accumulated response time in of deadlock transactions.
static int defaultIsoLevel
          The defualt isolation level of all transactions, which is Connection.TRANSACTION_SERIALIZABLE.
static int EachDeadLock
          the counter of deadlocks for each transaction
static int executeTime
          The maximum time a experiemnt could last in seconds.
static int expLengthLimit
          the max execution time, which is 60 seconds.
static javax.swing.JFileChooser globalFC
          use a global filechooser to keep the current filepath need to find a better way to do this.
static boolean isFromHome
          Whether connected from home is checked.
static boolean isMultiUserMode
          This flag indeciate whether multi-user mode is provided.
static double LogicFailTime
          the accumulated response time in all logic fail transactions.
static int maxrows
          the number of max row per page
static java.lang.String[] modes
          The String array of the users modes.
static java.lang.String MULIT_USER_MODE
           
static int MyFavoriteLineLength
          default length limit for a line when displaying user query on the query result frame, see checkDBreportFrame.java
static int NumOfDeadLock
          The number of deadlock occurs in all transactions.
static int NumOfLogicFail
          The number of logic fails occurs in all transactions.
static int numOfTerminals
          The number of terminals user asks to run in a experiment.
static java.lang.String protoFile
          The path of prototype file.
static java.lang.String proxy
          Stored the proxy string
static double responseTime
          the total response time (in milliseconds ) of sucessful transactions in all the simulating terminals.
static java.lang.String scriptDir
          The path of script files.
static java.lang.String scriptFileExt
          The extension of script file.
private static java.lang.String serverFileURL
          Stored the url for the server.xml file.
static java.lang.String serverNamesFile
          The defination of name and jdbc url for multipal servers.
static java.util.Vector sessKeys
          a Vector to store the Session Keywords
static java.lang.String SINGLE_USER_MODE
           
static java.lang.String singleAccntName
          The user account for the single user mode.
static java.lang.String singleAccntPasswd
          The passward for the single user mode.
static java.lang.String sourceDir
          The path of source files.
static java.lang.String sourceFileExt
          The extension of the source files.
static java.lang.String SyncSPFileName
          The file coontains the stored procedure for synchronization
static java.util.Vector termKeys
          a Vectoe to store the Terminal Keywords
static int thinkTime
          The interval of each transaction in seconds.
static java.util.Vector transactions
          a Vector to store the Transactions.
static java.lang.String transClassSuffix
          The suffix of the transaction class -"Class" String.
static int transCounter
          the total number of sucessful transactions in all the simulating terminals.
static long transEndTime
          The most late transaction end time out of all transactions.
static long transStartTime
          The earliest transaction start time out of all transactions.
static int TSLimit
          Maximum execution Limit(in sec) an experiment could hold the lock of the Sync table in the sigle user mode.
 
Constructor Summary
GlobalData()
           
 
Method Summary
static boolean argFilesExist()
          Check whether the Argument Files Directory provided by user contains all the argument files needed.
static void cleanRT()
          Clean up performance measurement variables.
static void clearInput()
          The method will clear all the user input fields.
static void discardAllData()
          To discard all the user input data or system variables.
static boolean enoughArgs()
          Check if terminal keys' argument files have enough data for all terminals.
private static void getElementValueByName(org.w3c.dom.Node parent, int count)
          Get the elemnt value by the name of element.
static void main(java.lang.String[] arg)
           
private static void printGlobalData()
           
static boolean resourceFilesExist()
          Checks whether all files or directories provided by user exist or not.
static boolean scriptFilesExist()
          Checks whether the Script Files Directory provided by user contains all the script files needed.
static void serverFileParser()
          This method is used to parse the server.xml file using the XML parser.
static void setServerFilePath(java.lang.String uri)
          Set up the file path for the server.xml file
static void showError(java.lang.String msg)
          Displays error messages in dialog box
static void showInfo(java.lang.String msg)
          Displays info messages in dialog box
static boolean sourceFilesExist()
          Check whether the Transaction Source File Directory provided by user contains all the transaction source files needed.
static boolean transTableSetup()
          Set up the transaction table and keywords by parsing the GlobalData.protoFile file.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

dbURL

public static java.lang.String dbURL
The jdbc url

dbDriver

public static java.lang.String dbDriver
The jdbc driver string

dbName

public static java.lang.String dbName
The name of DBMS

singleAccntName

public static final java.lang.String singleAccntName
The user account for the single user mode.

singleAccntPasswd

public static final java.lang.String singleAccntPasswd
The passward for the single user mode.

SyncSPFileName

public static final java.lang.String SyncSPFileName
The file coontains the stored procedure for synchronization

serverNamesFile

public static final java.lang.String serverNamesFile
The defination of name and jdbc url for multipal servers.

MyFavoriteLineLength

public static final int MyFavoriteLineLength
default length limit for a line when displaying user query on the query result frame, see checkDBreportFrame.java

isMultiUserMode

public static boolean isMultiUserMode
This flag indeciate whether multi-user mode is provided.

accntName

public static java.lang.String accntName
The usre account.

accntPasswd

public static java.lang.String accntPasswd
The user password.

proxy

public static java.lang.String proxy
Stored the proxy string

isFromHome

public static boolean isFromHome
Whether connected from home is checked. It is only used for Sybase.

dbSchemaFile

public static java.lang.String dbSchemaFile
The path of user database schema file.

dbInitFile

public static java.lang.String dbInitFile
The path if user database initialization file.

numOfTerminals

public static int numOfTerminals
The number of terminals user asks to run in a experiment.

thinkTime

public static int thinkTime
The interval of each transaction in seconds.

executeTime

public static int executeTime
The maximum time a experiemnt could last in seconds.

maxrows

public static int maxrows
the number of max row per page

protoFile

public static java.lang.String protoFile
The path of prototype file.

sourceDir

public static java.lang.String sourceDir
The path of source files.

scriptDir

public static java.lang.String scriptDir
The path of script files.

argDir

public static java.lang.String argDir
The path of argument files.

sessKeys

public static java.util.Vector sessKeys
a Vector to store the Session Keywords

termKeys

public static java.util.Vector termKeys
a Vectoe to store the Terminal Keywords

transactions

public static java.util.Vector transactions
a Vector to store the Transactions.

allParaFields

public static java.util.Vector allParaFields
a Vector to store all the Parameter Names.

argumentFileNames

public static java.util.Vector argumentFileNames
Deprecated. this variable is useless.


Deadlocknumoftrans

public static java.util.Vector Deadlocknumoftrans
a array to store number of deadlocks for each transaction type

responseTime

public static double responseTime
the total response time (in milliseconds ) of sucessful transactions in all the simulating terminals.

transCounter

public static int transCounter
the total number of sucessful transactions in all the simulating terminals.

transStartTime

public static long transStartTime
The earliest transaction start time out of all transactions.

transEndTime

public static long transEndTime
The most late transaction end time out of all transactions.

EachDeadLock

public static int EachDeadLock
the counter of deadlocks for each transaction

DeadLockTime

public static double DeadLockTime
the accumulated response time in of deadlock transactions.

LogicFailTime

public static double LogicFailTime
the accumulated response time in all logic fail transactions.

NumOfDeadLock

public static int NumOfDeadLock
The number of deadlock occurs in all transactions.

NumOfLogicFail

public static int NumOfLogicFail
The number of logic fails occurs in all transactions.

globalFC

public static javax.swing.JFileChooser globalFC
use a global filechooser to keep the current filepath need to find a better way to do this. Used in the .

expLengthLimit

public static final int expLengthLimit
the max execution time, which is 60 seconds.

TSLimit

public static final int TSLimit
Maximum execution Limit(in sec) an experiment could hold the lock of the Sync table in the sigle user mode.

SINGLE_USER_MODE

public static final java.lang.String SINGLE_USER_MODE

MULIT_USER_MODE

public static final java.lang.String MULIT_USER_MODE

modes

public static final java.lang.String[] modes
The String array of the users modes. Now it contains SingleUser and MultiUser mode.

DBMS

public static final java.util.Vector DBMS
For the multi-database support. Right now, TPPT support Sybase and DB2

dbSettingMap

public static java.util.HashMap dbSettingMap
Stored the DB setting reading from server.xml in the hastable. Used dbname as key and DBSetting object as value.

chosenDBMS

public static java.lang.String chosenDBMS
The chosen DBMS by user. The default is Sybase.

transClassSuffix

public static final java.lang.String transClassSuffix
The suffix of the transaction class -"Class" String.

sourceFileExt

public static final java.lang.String sourceFileExt
The extension of the source files.

scriptFileExt

public static final java.lang.String scriptFileExt
The extension of script file.

argFileExt

public static final java.lang.String argFileExt
The extension of argument file.

defaultIsoLevel

public static final int defaultIsoLevel
The defualt isolation level of all transactions, which is Connection.TRANSACTION_SERIALIZABLE.

serverFileURL

private static java.lang.String serverFileURL
Stored the url for the server.xml file.
Constructor Detail

GlobalData

public GlobalData()
Method Detail

showError

public static void showError(java.lang.String msg)
Displays error messages in dialog box

showInfo

public static void showInfo(java.lang.String msg)
Displays info messages in dialog box

resourceFilesExist

public static boolean resourceFilesExist()
Checks whether all files or directories provided by user exist or not. Return true if all exist, false otherwise.

sourceFilesExist

public static boolean sourceFilesExist()
Check whether the Transaction Source File Directory provided by user contains all the transaction source files needed. Return true if so, false otherwise.
See Also:
sourceFileExt

scriptFilesExist

public static boolean scriptFilesExist()
Checks whether the Script Files Directory provided by user contains all the script files needed. The name of terminal script file should be :
 "Terminal" + TerminalNumber + ".scp"
 
For example, if user sets up 2 terminal are needed during the experiment, then Terminal1.scp , Terminal2.scp files must present in the Script Files Directory. Otherwise, the missing file error will be reported.
Returns:
boolean true if all the required terminal script files exist, false otherwise.
See Also:
numOfTerminals

argFilesExist

public static boolean argFilesExist()
Check whether the Argument Files Directory provided by user contains all the argument files needed. Each distinct parameter (exception connection parameter) defined in the transaction method of the prototype file should have a corresponding argument file in the directory. For example, if user sets up a transaction method signature as below in the prototype file:
 int StudentLogin (Connection con, String sid, String spasswd );
 
Then sid.scp and spasswd.scp should be present in the Argument Files Directory.
Bug: allParaFields is never been initialized. Hence, the size of allParaFields is always zero and it won't go into the for loop to check the present of the argument file. Solution: Add the code in PrototypesAnaluzer.createTransactionTable to initialize the allParaFields.
Returns:
boolean true if all the required parameter files exist, false otherwise.

transTableSetup

public static boolean transTableSetup()
Set up the transaction table and keywords by parsing the GlobalData.protoFile file.
See Also:
PrototypesAnalyzer

enoughArgs

public static boolean enoughArgs()
Check if terminal keys' argument files have enough data for all terminals.
See Also:
termKeys, numOfTerminals

cleanRT

public static void cleanRT()
Clean up performance measurement variables. Make sure statistical data flushed before each new expriment. Remind user to save results from last experiment (JY2001)

discardAllData

public static void discardAllData()
To discard all the user input data or system variables. It is called by DTFrame duing the time when a new experiment is created.

printGlobalData

private static void printGlobalData()

clearInput

public static void clearInput()
The method will clear all the user input fields. This is especially helpful if the user just ran some experiments and wants to start afresh, e.g., when the next exp button is pushed.

setServerFilePath

public static void setServerFilePath(java.lang.String uri)
Set up the file path for the server.xml file
Parameters:
uri - the url for server.xml file

serverFileParser

public static void serverFileParser()
This method is used to parse the server.xml file using the XML parser.
See Also:
getElementValueByName(org.w3c.dom.Node, int)

getElementValueByName

private static void getElementValueByName(org.w3c.dom.Node parent,
                                          int count)
Get the elemnt value by the name of element. And each DBMS setting will store in the the hash table using the dbname of they key and DBSetting object as the vaule.
Parameters:
parent - the parent node.
count - the counter to record the count of current DBMS.

main

public static void main(java.lang.String[] arg)