com.jFormTK
Class JDerby_IO

java.lang.Object
  extended by com.jFormTK.JDerby_IO
All Implemented Interfaces:
JConstants

public abstract class JDerby_IO
extends java.lang.Object
implements JConstants

        This jFormTK Abstract Class is designed to hold the jFormTK Data Base [DB]
        input / output Methods. The current embedded Data Base is the Apache Derby DB...
 
        All 'jFormTK' Kernel read / write to DB operations are performed via methods of
        this class...

        Summary of SLPlus table names:
        1)      'JAddressBook' table [ab]...
        2)      'JFormForm.SubClass' Application Form [formID Name]...
                The 'formID Name' table have Relational pointers to their respective
                records in the following 'info' and 'state' tables...
        3)      'JFormInfo' table [info]...
        4)      'JFormState' table [state]...

        Kernel Usage:
        1)      The 'init' method is invoked by the JRegistration.verifyApplication' method
                during the 'jFormTK' Application initialization phase. The name of the
                Derby Data Base is derived from the 'jFormTK' Application registration
                file.

                The 'init' method establishes the Apache Derby JDBC connection and services
                the 'JAddressBook' Derby DB table [ab]...
        

Version:
1.00, 17 May 2009
Author:
Jim Crowell
Professional Computer Solutions [PCS]
URL: http://jFormTK.com/
E-Mail: JimCrowell@EMail.com

Copyright (c) 2009 by Professional Computer Solutions [PCS]
All Rights Reserved

Field Summary
 
Fields inherited from interface com.jFormTK.JConstants
__, _AB, _AB_, _AField, _B, _BField, _CField, _CIField, _DField, _EU_, _H, _HEIGHT, _HEIGHT_INV, _HField, _I, _IField, _LField, _MField, _NField, _NotRequired, _PField, _PIField, _QField, _Required, _RField, _TAField, _TField, _WIDTH, _WIDTH_INV, _XField, AB, APP_TRACE_FOCUS, APP_TRACE_GET, APP_TRACE_SET, B_, BAR, BAR_, BB, BH, BI, BREAKPOINT_FOCUS, BREAKPOINT_GET, BREAKPOINT_SET, BVB, C_QUOTE, CLOSE, CLOSE_BRACKET, COLORS_DELIMITER, COMMA, COMMA_, D_ELEMENT, D_ELEMENT_N, D_ELEMENT_N1, D_ELEMENT_N2, D_ELEMENT_N3, D_FIELDS, D_FIELDS_N, D_FIELDS_N1, D_FIELDS_N2, D_FIELDS_N3, D_ITEMS, DASH, DOT, EOL, EOP, EOS, FIELD_TRACE_FOCUS, FIELD_TRACE_GET, FIELD_TRACE_SET, FONT_DELIMITER, H_, HB, HH, HI, I_, IB, IH, II, JLAF_DELIMITER, LF, LISTBRACKET, NO, OPEN, OPEN_BRACKET, pCheckboxGroup, QUOTE, SPACE_, TAB, YES
 
Constructor Summary
JDerby_IO()
           
 
Method Summary
static java.lang.String displayDBInfo()
           Produce a Display String to specify the current Derby Data Base version and TBD Information...
static java.lang.String displayTableNames()
           
static java.lang.String getDBName()
           
static java.util.ArrayList<java.lang.String> getTableNames()
           Return an String ArrayList containing the table names in the connected [conn] Apache Derby Data Base...
static java.lang.String[] getTableNamesArray()
           Return an String ArrayList containing the table names in the connected [conn] Apache Derby Data Base...
static java.lang.String[] getTableNamesArray(java.lang.String pad)
           
static java.lang.String getValueAB(java.lang.String nameKey, java.lang.String fieldNameIn)
           Get the value String from the data base for the given 'key' where the 'key' is the Address Book field name...
static java.lang.String getValueAB(java.lang.String nameKey, java.lang.String segmentCodeIn, java.lang.String fieldNameIn)
           Get the value String from the data base for the given 'key' and segment code.
static boolean init(java.lang.String dbNameIn)
           Initialize the Application Derby Data Base given the file name [dbNameIn]...
static void insertAddressBookName(java.lang.String nameKey, java.lang.String[] segments)
           Insert a record into the Address Book Table = F[nameKey and the segments String Array].
static void insertAddressBookName(java.lang.String nameKey, java.lang.String[] segments, boolean debug)
           
static void insertAddressBookSegment(java.lang.String key, java.lang.String[] fields)
           Insert the given fields String Array [fields] into the jFormTK Derby Address Book database.
static void insertOrderedPair(java.lang.String tableName, java.lang.String key, java.lang.String value)
           
static void printSQLException(java.sql.SQLException e)
          Prints details of an SQLException chain to System.err.
static java.lang.String showTable(java.lang.String tableName, boolean fFormatIn)
           Show the given Derby Database table [tableName] in a Dialog Window...
static void showTableContent()
           Display a dialog window that enables the end user to select a table name from the Derby Table Names list and display the selected table in "Raw" OR "Formatted" mode...
static void showTableNames()
           Display a dialog window that list all the table names in the currently connected Derby Database...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDerby_IO

public JDerby_IO()
Method Detail

init

public static boolean init(java.lang.String dbNameIn)
        Initialize the Application Derby Data Base given the file name [dbNameIn]...

        Kernel Usage:
        1)      'JRegistration.verifyApplication' Method once the Application
                Registration is completed OR verified......
        

Parameters:
dbNameIn - Derby Data Base File Name [String] as derived from the 'jFormTK'JFormRegistration' instance...
Returns:
Flag [boolean] to indicate File Created status...

getDBName

public static java.lang.String getDBName()

displayTableNames

public static java.lang.String displayTableNames()

getTableNames

public static java.util.ArrayList<java.lang.String> getTableNames()
        Return an String ArrayList containing the table names in the
        connected [conn] Apache Derby Data Base...

        Kernel Usage:
        1)      TBD...
        

Returns:
ArrayList instance with table name Strings...

getTableNamesArray

public static java.lang.String[] getTableNamesArray()
        Return an String ArrayList containing the table names in the
        connected [conn] Apache Derby Data Base...

        Kernel Usage:
        1)      TBD...
        

Returns:
ArrayList instance with table name Strings...

getTableNamesArray

public static java.lang.String[] getTableNamesArray(java.lang.String pad)

getValueAB

public static java.lang.String getValueAB(java.lang.String nameKey,
                                          java.lang.String fieldNameIn)
        Get the value String from the data base for the given 'key' where
        the 'key' is the Address Book field name...

        Kernel Usage:
        1)      TBD
        

Parameters:
nameKey - The master key String for the name of the person to be evaluated...
fieldNameIn - String of the Address Book field name. Case insensitive...
Returns:
The value String associated with the given key...

getValueAB

public static java.lang.String getValueAB(java.lang.String nameKey,
                                          java.lang.String segmentCodeIn,
                                          java.lang.String fieldNameIn)
        Get the value String from the data base for the given 'key' and segment
        code. Were the 'key' is the Address Book field name and the Segment code
        is the Address Book codes as found in the 'abKeyCodes' final array. For
        example, a 'segments' code of "C" indicates the "Controls" Address
        book Segment...

        Kernel Usage:
        1)      TBD
        

Parameters:
nameKey - The master key String for the name of the person to be evaluated...
segmentCodeIn - Segment codes as indicated above...
fieldNameIn - String of the Address Book field name. Case insensitive...
Returns:
The value String associated with the given key...

insertAddressBookName

public static void insertAddressBookName(java.lang.String nameKey,
                                         java.lang.String[] segments)
        Insert a record into the Address Book Table =
        F[nameKey and the segments String Array].

        The 'nameKey' is the unique person's 'JAddressBook.TreeMap' Master key.
 
        The 'segemnts' String Array contains from 1 to 6 elements as follows:
                [0]     Controls delimmited String...
                [1]     Phone Info delimmited String...
                [2]     Web Info delimmited String...
                [3]     Residence Info delimmited String...
                [4]     Intermediator Info delimmited String...
                [5]     Personal Info delimmited String...

        Each delimited String uses the 'jFormTK.JConstants.D_ITEMS delimiter to
        delimit fields. See 'JAddressBookDialog' Class for a description of the
        fields for each segment...

        If the given segments array is less than 6,
        Then the associated segments key is inserted with a Null String...

        Kernel Usage:
        1)      To be used by the method [TBD] designed to reload the Apache Derby
                from a "raw" Data Dump produced by a Soft Abort of the 'jFormTK'
                Application...
        

Parameters:
nameKey - The Application unique Master Key [String] for a person...
segments - A String Array that contains the parameters for each segment of a person. The segments are as follows: Contact Segments: "Controls", "Phone", "Web", "Residence","Emissary"... Personal Segment"X" "Personal". NOTE: Uses "X" as the 'nameKey' appendix...

insertAddressBookName

public static void insertAddressBookName(java.lang.String nameKey,
                                         java.lang.String[] segments,
                                         boolean debug)

insertAddressBookSegment

public static void insertAddressBookSegment(java.lang.String key,
                                            java.lang.String[] fields)
        Insert the given fields String Array [fields] into the jFormTK Derby
        Address Book database. The segment key is provided. The 'key' is the
        Master key for the individual with a prefix that matches the 'abKeyCodes'
        String Array.

        Kernel Usage:
        1)      'JAddressBookDialog.Constructor' to initialize the "Controls"
                Segment...
        2)      'JContactInfo.setEmissary' Method...
        3)      'JContactInfo.setPhone' Method...
        4)      'JContactInfo.setResidence' Method...
        5)      'JContactInfo.setWeb' Method...
        6)      'JPersonalInfo.setPersonal' Method...
        

Parameters:
key - Address Book segment key...
fields - String array of segment fields...

insertOrderedPair

public static void insertOrderedPair(java.lang.String tableName,
                                     java.lang.String key,
                                     java.lang.String value)

displayDBInfo

public static java.lang.String displayDBInfo()
        Produce a Display String to specify the current Derby Data Base version
        and TBD Information...

        Kernel Usage:
        1)      'BasejFormTK.Menu.actionPerformed' method when the "About Database"
                item is selected from the "Debug" Menu...       
        


printSQLException

public static void printSQLException(java.sql.SQLException e)
Prints details of an SQLException chain to System.err. Details included are SQL State, Error code, Exception message.

Parameters:
e - the SQLException from which to print details.

showTable

public static java.lang.String showTable(java.lang.String tableName,
                                         boolean fFormatIn)
        Show the given Derby Database table [tableName] in a Dialog Window...

        Kernel Usage:
        1)      'JDerby_IO.DBTableNamesDialogActionListener.actionPerformed' when the
                DBTableNamesDialog.bDisplay button is selectd by the jFormTK Application
                End User...
        

Parameters:
tableName - Table Name String...
fFormatIn - Format the displayed message 'value' column flag [boolean]...
Returns:
Display String...

showTableContent

public static void showTableContent()
        Display a dialog window that enables the end user to select a table
        name from the Derby Table Names list and display the selected table in
        "Raw" OR "Formatted" mode...

        Kernel Usage:
        1)      'BasejFormTK.Menu.actionPerformed' method when the end user selects
                the "Show DB Table Content" item from the 'jFormTK' DEBUG menu...
        


showTableNames

public static void showTableNames()
        Display a dialog window that list all the table names in the currently
        connected Derby Database...

        Kernel Usage:
        1)      'BasejFormTK.Menu.actionPerformed' method when the end user selects
                the "Show DB Table Names" item from the 'jFormTK' DEBUG menu...