org.opengts
Class StartupInit

java.lang.Object
  extended by org.opengts.StartupInit
All Implemented Interfaces:
DBConfig.DBInitialization, DBFactory.CustomFactoryHandler

public class StartupInit
extends java.lang.Object
implements DBConfig.DBInitialization, DBFactory.CustomFactoryHandler

Provides startup initialization.
This class is loaded by DBConfig.java at startup initialization time, and various methods are called within this class to allow custom DB initialization.
The actual class loaded and executed by DBConfig can be overridden by placing the following line in the system 'default.conf' and 'webapp.conf' files:

   startup.initClass=org.opengts.StartupInit
 
Where 'org.opengts.opt.StartupInit' is the name of the class you wish to have loaded in place of this class file.


Constructor Summary
StartupInit()
          Constructor.
(Created with the DBConfig db startup initialization)
 
Method Summary
protected  void addDBFields(java.lang.String tblName, java.util.List<DBField> tblFields, java.lang.String key, boolean defaultAdd, DBField[] customFields)
          Add the specified fields to the table
protected  void addDBFields(java.lang.String tblName, java.util.List<DBField> tblFields, java.lang.String key, boolean defaultAdd, DBField[] customFields, int maxCount)
          Add the specified fields to the table
 void addTableFactories()
          Opportunity to add custom DBFactory classes.
This method is called just after all standard database factory classes have been intialized/added.
<T extends DBRecord<T>>
DBFactory<T>
createDBFactory(java.lang.String tableName, DBField[] field, DBFactory.KeyType keyType, java.lang.Class<T> rcdClass, java.lang.Class<? extends DBRecordKey<T>> keyClass, boolean editable, boolean viewable)
          Create a DBFactory instance.
protected  EventUtil.OptionalEventFields createOptionalEventFieldsHandler()
          Creates a generic custom EventUtil.OptionalEventFields instance
protected  void initPasswordHandler()
           
protected  org.opengts.StartupInit.EVField[] parseFields(DBFactory factory, java.lang.String[] flda)
           
 void postInitialization()
          Post-DBInitialization.
This method is called after all startup initialization has completed.
 void preInitialization()
          Pre-DBInitialization.
This method is called just before the standard database factory classes are initialized/added.
 java.util.List<DBField> selectFields(DBFactory factory, java.util.List<DBField> fields)
          Augment DBFactory fields.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StartupInit

public StartupInit()
Constructor.
(Created with the DBConfig db startup initialization)

Method Detail

preInitialization

public void preInitialization()
Pre-DBInitialization.
This method is called just before the standard database factory classes are initialized/added.

Specified by:
preInitialization in interface DBConfig.DBInitialization

addTableFactories

public void addTableFactories()
Opportunity to add custom DBFactory classes.
This method is called just after all standard database factory classes have been intialized/added. Additional database factories that are needed for the custom installation may be added here.

Specified by:
addTableFactories in interface DBConfig.DBInitialization

parseFields

protected org.opengts.StartupInit.EVField[] parseFields(DBFactory factory,
                                                        java.lang.String[] flda)

createOptionalEventFieldsHandler

protected EventUtil.OptionalEventFields createOptionalEventFieldsHandler()
Creates a generic custom EventUtil.OptionalEventFields instance

Returns:
An EventUtil.OptionalEventFields instance

postInitialization

public void postInitialization()
Post-DBInitialization.
This method is called after all startup initialization has completed.

Specified by:
postInitialization in interface DBConfig.DBInitialization

initPasswordHandler

protected void initPasswordHandler()

createDBFactory

public <T extends DBRecord<T>> DBFactory<T> createDBFactory(java.lang.String tableName,
                                                            DBField[] field,
                                                            DBFactory.KeyType keyType,
                                                            java.lang.Class<T> rcdClass,
                                                            java.lang.Class<? extends DBRecordKey<T>> keyClass,
                                                            boolean editable,
                                                            boolean viewable)
Create a DBFactory instance. The DBFactory initialization process will call this method when creating a DBFactory for a given table, allowing this class to override/customize any specific table attributes. If this method returns null, the default table DBFactory will be created.

Specified by:
createDBFactory in interface DBFactory.CustomFactoryHandler
Parameters:
tableName - The name of the table
field - The DBFields in the table
keyType - The table key type
rcdClass - The DBRecord subclass representing the table
keyClass - The DBRecordKey subclass representing the table key
editable - True if this table should be editable, false otherwise. This value is used by the GTSAdmin application.
viewable - True if this table should be viewable, false otherwise. An 'editable' table is automatically considered viewable. This value is used by the GTSAdmin application.
Returns:
The DBFactory instance (or null to indicate that the default DBFactory should be created).

selectFields

public java.util.List<DBField> selectFields(DBFactory factory,
                                            java.util.List<DBField> fields)
Augment DBFactory fields. This method is called before fields have been added to any given DBFactory. This method may alter the list of DBFields by adding new fields, or altering/deleting existing fields. However, deleting/altering fields that have other significant systems dependencies may cause unpredictable behavior.

Specified by:
selectFields in interface DBFactory.CustomFactoryHandler
Parameters:
factory - The DBFactory
fields - The list of fields scheduled to be added to the DBFactory
Returns:
The list of fields which will be added to the DBFactory

addDBFields

protected void addDBFields(java.lang.String tblName,
                           java.util.List<DBField> tblFields,
                           java.lang.String key,
                           boolean defaultAdd,
                           DBField[] customFields)
Add the specified fields to the table

Parameters:
tblName - The table name
tblFields - The list of table fields
key - The boolean key used to check for permission to add these fields
defaultAdd - The default if the property is not explicitly specfified
customFields - The fields to add, assuming the boolean key returns true.

addDBFields

protected void addDBFields(java.lang.String tblName,
                           java.util.List<DBField> tblFields,
                           java.lang.String key,
                           boolean defaultAdd,
                           DBField[] customFields,
                           int maxCount)
Add the specified fields to the table

Parameters:
tblName - The table name
tblFields - The list of table fields
key - The boolean key used to check for permission to add these fields
defaultAdd - The default if the property is not explicitly specfified
customFields - The fields to add, assuming the boolean key returns true.
maxCount - The maximum number of fields to add from the customFields array