wt.tools.generation.sql
Class ScriptGenerator

java.lang.Object
  extended bywt.tools.generation.sql.ScriptGenerator
Direct Known Subclasses:
OracleScriptGenerator, SQLServerScriptGenerator

public abstract class ScriptGenerator
extends Object

ScriptGenerator creates scripts suitable for executing using a database SQL utility.


Field Summary
static String ARRAY
           
protected static boolean BUILD_USAGE
           
private static Datastore DATASTORE
           
static String FK
           
static String INDEX
           
protected static WTProperties properties
           
private static char SEPARATOR
           
static String SEQUENCE
           
static String STRUCT
           
static String TABLE
           
static String TRIGGER
           
static String VIEW
           
 
Constructor Summary
ScriptGenerator()
           
 
Method Summary
protected abstract  void buildModuleScriptFiles(String a_assemblyName, String a_moduleName, boolean a_isMake, String a_schemaObjectType, String a_javaPackage)
           
protected  void buildModuleScriptFilesforStruct(String a_assemblyName, String a_moduleName, boolean a_isMake, String a_javaPackage, String a_structFileName, long a_scriptLevel)
           
static String buildModuleScriptName(String a_moduleName, boolean a_isMake, String a_schemaObjectType)
           
protected static String buildPathName(String a_path, char a_separator, String a_extension, boolean a_isMake, String a_schemaObjectType)
           
 void buildScript(String a_className, String a_moduleName, String a_assemblyName)
           
 void buildScriptforArray(String a_className, String a_moduleName, String a_assemblyName, String artifact)
           
 void buildScriptforFKConstraint(String a_className, String a_moduleName, String a_assemblyName, String artifact)
           
 void buildScriptforSequence(String a_className, String a_moduleName, String a_assemblyName, String artifact)
           
 void buildScriptforStruct(String a_className, String a_moduleName, String a_assemblyName, String artifact)
           
 void buildScriptforTable(String a_className, String a_moduleName, String a_assemblyName, String artifact)
           
 void buildScriptforTriggerConstraint(String a_className, String a_moduleName, String a_assemblyName, String artifact)
           
protected static String buildScriptName(String a_filename, boolean a_isMake, String a_schemaObjectType)
           
private static boolean checkLine(File input, String line)
           
private static boolean checkLine(String filename, String line)
           
protected  void createDirectories(InstalledModuleArtifact a_moduleArtifact)
           
protected abstract  void createMakeDropFiles(InstalledModuleArtifact dir, String a_schemaObjectType)
           
protected  void createMakeDropFiles(InstalledModuleArtifact dir, String a_schemaObjectType, String artifact)
          This is recursive method that creates the Make and Drop files in this directory and calls itself for its parent.
abstract  String getArtifactDir()
           
protected abstract  InstalledModuleArtifact getFile(String fullModuleName, String a_javaPackage, boolean a_isMake, String a_schemaObjectType)
           
protected  InstalledModuleArtifact getFile(String fullModuleName, String a_javaPackage, String a_extension, String artifact, boolean a_isMake, String a_schemaObjectType)
           
protected abstract  SQLGenerator getSQLGenerator()
           
static void putInFile(File file, String statement)
           
protected abstract  void putInParentMakeDropFile(InstalledModuleArtifact a_path, String a_schemaObjectType)
           
protected abstract  void putScriptCallInFile(String fullModuleName, String a_javaPackage, boolean a_isMake, String a_schemaObjectType, String a_scriptName, boolean containsUserName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR

private static final char SEPARATOR
See Also:
Constant Field Values

properties

protected static WTProperties properties

BUILD_USAGE

protected static final boolean BUILD_USAGE

TABLE

public static final String TABLE
See Also:
Constant Field Values

INDEX

public static final String INDEX
See Also:
Constant Field Values

VIEW

public static final String VIEW
See Also:
Constant Field Values

TRIGGER

public static final String TRIGGER
See Also:
Constant Field Values

STRUCT

public static final String STRUCT
See Also:
Constant Field Values

ARRAY

public static final String ARRAY
See Also:
Constant Field Values

SEQUENCE

public static final String SEQUENCE
See Also:
Constant Field Values

FK

public static final String FK
See Also:
Constant Field Values

DATASTORE

private static final Datastore DATASTORE
Constructor Detail

ScriptGenerator

public ScriptGenerator()
Method Detail

buildScript

public void buildScript(String a_className,
                        String a_moduleName,
                        String a_assemblyName)
                 throws WTException,
                        IOException
Throws:
WTException
IOException

buildScriptforStruct

public void buildScriptforStruct(String a_className,
                                 String a_moduleName,
                                 String a_assemblyName,
                                 String artifact)
                          throws WTException,
                                 IOException
Throws:
WTException
IOException

buildScriptforArray

public void buildScriptforArray(String a_className,
                                String a_moduleName,
                                String a_assemblyName,
                                String artifact)
                         throws WTException,
                                IOException
Throws:
WTException
IOException

buildScriptforSequence

public void buildScriptforSequence(String a_className,
                                   String a_moduleName,
                                   String a_assemblyName,
                                   String artifact)
                            throws WTException,
                                   IOException
Throws:
WTException
IOException

buildScriptforTable

public void buildScriptforTable(String a_className,
                                String a_moduleName,
                                String a_assemblyName,
                                String artifact)
                         throws WTException,
                                IOException
Throws:
WTException
IOException

buildScriptforFKConstraint

public void buildScriptforFKConstraint(String a_className,
                                       String a_moduleName,
                                       String a_assemblyName,
                                       String artifact)
                                throws WTException,
                                       IOException
Throws:
WTException
IOException

buildScriptforTriggerConstraint

public void buildScriptforTriggerConstraint(String a_className,
                                            String a_moduleName,
                                            String a_assemblyName,
                                            String artifact)
                                     throws WTException,
                                            IOException
Throws:
WTException
IOException

getSQLGenerator

protected abstract SQLGenerator getSQLGenerator()

createDirectories

protected void createDirectories(InstalledModuleArtifact a_moduleArtifact)

putInParentMakeDropFile

protected abstract void putInParentMakeDropFile(InstalledModuleArtifact a_path,
                                                String a_schemaObjectType)
                                         throws IOException
Throws:
IOException

putScriptCallInFile

protected abstract void putScriptCallInFile(String fullModuleName,
                                            String a_javaPackage,
                                            boolean a_isMake,
                                            String a_schemaObjectType,
                                            String a_scriptName,
                                            boolean containsUserName)
                                     throws IOException
Throws:
IOException

getFile

protected abstract InstalledModuleArtifact getFile(String fullModuleName,
                                                   String a_javaPackage,
                                                   boolean a_isMake,
                                                   String a_schemaObjectType)

buildPathName

protected static String buildPathName(String a_path,
                                      char a_separator,
                                      String a_extension,
                                      boolean a_isMake,
                                      String a_schemaObjectType)

buildScriptName

protected static String buildScriptName(String a_filename,
                                        boolean a_isMake,
                                        String a_schemaObjectType)

getFile

protected InstalledModuleArtifact getFile(String fullModuleName,
                                          String a_javaPackage,
                                          String a_extension,
                                          String artifact,
                                          boolean a_isMake,
                                          String a_schemaObjectType)

putInFile

public static void putInFile(File file,
                             String statement)

checkLine

private static boolean checkLine(String filename,
                                 String line)

checkLine

private static boolean checkLine(File input,
                                 String line)

createMakeDropFiles

protected abstract void createMakeDropFiles(InstalledModuleArtifact dir,
                                            String a_schemaObjectType)
                                     throws IOException
Throws:
IOException

createMakeDropFiles

protected void createMakeDropFiles(InstalledModuleArtifact dir,
                                   String a_schemaObjectType,
                                   String artifact)
                            throws IOException
This is recursive method that creates the Make and Drop files in this directory and calls itself for its parent.

Throws:
IOException

getArtifactDir

public abstract String getArtifactDir()

buildModuleScriptFiles

protected abstract void buildModuleScriptFiles(String a_assemblyName,
                                               String a_moduleName,
                                               boolean a_isMake,
                                               String a_schemaObjectType,
                                               String a_javaPackage)

buildModuleScriptFilesforStruct

protected void buildModuleScriptFilesforStruct(String a_assemblyName,
                                               String a_moduleName,
                                               boolean a_isMake,
                                               String a_javaPackage,
                                               String a_structFileName,
                                               long a_scriptLevel)

buildModuleScriptName

public static String buildModuleScriptName(String a_moduleName,
                                           boolean a_isMake,
                                           String a_schemaObjectType)