Make your own free website on Tripod.com

suncertify.db.tool
Class DataConvToolSwing

java.lang.Object
  |
  +--suncertify.db.tool.DataConvToolSwing

public class DataConvToolSwing
extends java.lang.Object
implements java.awt.event.ActionListener

The class is the Data Conversion tool with a Swing GUI,and it converts the ascii file containing data about a DataBase to a binary file to be used by the Data class object.

Version:
1.0 08/09/1999

Constructor Summary
DataConvToolSwing(javax.swing.JFrame frameArg)
          The class constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          The actionPerformed method to be called when the "Conversion" button is pressed.
protected  void createHeader()
          The method creates the "header" of the DataBaseFile.
protected  void getFieldsInfo()
          The method get the names of the fields and its corresponding Length and stores into two Vectors.
protected  void insertRecords()
          The method inserts into the "outputDataBaseFile" the dataRecords fetched from the "DataFile".
static void main(java.lang.String[] args)
          The main method to create an instance of "DataConvTool" and initiate conversion.
protected  void nameFiles(java.io.File fieldsFile, java.io.File dataFile, java.io.File dbFile)
          The Method to initialize the Variables for the file names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataConvToolSwing

public DataConvToolSwing(javax.swing.JFrame frameArg)
The class constructor. It constructs a Swing GUI for accepting Name of Schema files and the DataFile.
Parameters:
frameArg - : A JFrame that contains the main GUI of teh application.
Method Detail

nameFiles

protected void nameFiles(java.io.File fieldsFile,
                         java.io.File dataFile,
                         java.io.File dbFile)
                  throws DataConversionException
The Method to initialize the Variables for the file names. This method is called when the ActionEvent of "Conversion" button id fired.
Parameters:
fieldsFile - : The File Object that represents the "fieldsFile"/ "SchemaFile"
dataFile - : The File Object that represents dataRecords
dbFile - :The File Object that represents the "outputDataBaseFile"

getFieldsInfo

protected void getFieldsInfo()
                      throws DataConversionException
The method get the names of the fields and its corresponding Length and stores into two Vectors.
Throws:
DataConversionException: - if the "fieldsFile" does contain values in the form "fieldName=fieldLength"

createHeader

protected void createHeader()
                     throws DataConversionException
The method creates the "header" of the DataBaseFile. It contains the following information, in order:
Throws:
DataConversionException - : whenever an IOException occurs.

insertRecords

protected void insertRecords()
                      throws DataConversionException
The method inserts into the "outputDataBaseFile" the dataRecords fetched from the "DataFile".
Throws:
DataConversionException - : whenever an IOEXception occurs.

main

public static void main(java.lang.String[] args)
The main method to create an instance of "DataConvTool" and initiate conversion.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
The actionPerformed method to be called when the "Conversion" button is pressed. It gets the name of the files from the corresponding JTextFields and create File objects, which are passed to "nameFiles" method. It does the conversion by calling the "getFieldsInfo", "createHeader" and "insertRecords" methods.
Specified by:
actionPerformed in interface java.awt.event.ActionListener