tppt.util
Class PrototypesAnalyzer

java.lang.Object
  |
  +--tppt.util.PrototypesAnalyzer

public class PrototypesAnalyzer
extends java.lang.Object

PrototypesAnalyzer is the parsing tool to parse Transaction Prototypes File, create transaction table and collect all parameter names existing in Prototypes File. All the pasring result is saved to GlobalData class.

Version:
1.1 04/25/00
Author:
Helen Yi Ren
See Also:
java.io.StreamTokenizer

Field Summary
(package private)  java.io.RandomAccessFile protoFile
           
(package private)  java.util.Vector transFields
          an array of all distinct parameters in Transaction prototype file except Connection parameter
(package private)  java.util.Vector transTable
           
 
Constructor Summary
PrototypesAnalyzer(java.lang.String protoFilename)
          Constructs the PrototypesAnalyzer that initialized with the prototype file location string.
 
Method Summary
 void collectTransFields(int index, Transaction trans)
          Update the transFields vector every time when a new transaction is created.
 boolean createKeywordLists()
          Parse the "Session Keywords" and "Terminal Keywords" from the prototype file and store both keyowrds to GlobalData class.
 Transaction createOneTransaction(java.lang.String prototype)
          Create one Transaction by parsing one line from prototype file.
 boolean createTransactionTable()
          Parses entire prototype file and create all transaction objects needed for the system.
 java.util.Vector getAllTransFields()
          Returns the Vector containsing all the distinct parameters among all the existing transactions.
static void main(java.lang.String[] args)
           
static void showError(java.lang.String msg)
          Displays an error message dialog.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

protoFile

java.io.RandomAccessFile protoFile

transTable

java.util.Vector transTable

transFields

java.util.Vector transFields
an array of all distinct parameters in Transaction prototype file except Connection parameter
Constructor Detail

PrototypesAnalyzer

public PrototypesAnalyzer(java.lang.String protoFilename)
Constructs the PrototypesAnalyzer that initialized with the prototype file location string. Bug: There is a bug occuring when setting up the isolation level. If user close the isolation window and then open, the number of transaction will accumulate. Solution: Remove all the transactions from GlobalData.transactions before analyze the prototype file.
Method Detail

createOneTransaction

public Transaction createOneTransaction(java.lang.String prototype)
Create one Transaction by parsing one line from prototype file. Transaction defination should be :
   ReturnType TransactionName(ParameterType1 param1, ParameterType2 param2....);
 
Parameters:
String - the defination of transaction method in the prototype file.
See Also:
Transaction, Transaction.setParameterTypes(int,String), Transaction.setParameterNames(int,String)

createTransactionTable

public boolean createTransactionTable()
Parses entire prototype file and create all transaction objects needed for the system. Insert one Transaction object at a time to Transactions Vector in GlobalData class.
See Also:
createOneTransaction(String), collectTransFields(int,Transaction)

createKeywordLists

public boolean createKeywordLists()
Parse the "Session Keywords" and "Terminal Keywords" from the prototype file and store both keyowrds to GlobalData class.
See Also:
GlobalData.sessKeys, GlobalData.termKeys

collectTransFields

public void collectTransFields(int index,
                               Transaction trans)
Update the transFields vector every time when a new transaction is created. transField is a vector to store all the distict parameter name among all the transactions. Warning: the index parameter is useless.
Parameters:
index -  
trans - The new created transaction.

getAllTransFields

public java.util.Vector getAllTransFields()
Returns the Vector containsing all the distinct parameters among all the existing transactions.

showError

public static void showError(java.lang.String msg)
Displays an error message dialog.
Parameters:
msg - the error message to be displayed. Use '\n' to extend the message to next line

main

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