com.massimo.tools.scriptrunner.work
Class SQLGeneratorTask

java.lang.Object
  extended by com.massimo.tools.scriptrunner.AbstractTask
      extended by com.massimo.tools.scriptrunner.work.SQLTask
          extended by com.massimo.tools.scriptrunner.work.SQLGeneratorTask
All Implemented Interfaces:
Task

public class SQLGeneratorTask
extends SQLTask

TODO complete design and coding This task runs a SQL statement to generate new tasks. These are run in instances of the templated task.


Field Summary
 
Fields inherited from class com.massimo.tools.scriptrunner.work.SQLTask
BIND_END_DELIMITERS, bindNames, connection, dbType, run_id, SQL_CHECK_PREFIX_ORACLE, SQL_CHECK_PREFIX_POSTGRES, SQL_CHECK_SUFFIX_ORACLE, SQL_CHECK_SUFFIX_POSTGRES, SQL_NON_COMMENT_PATTERN, SQL_STMT_PATTERN_ORACLE, SQL_STMT_PATTERN_POSTGRES
 
Fields inherited from class com.massimo.tools.scriptrunner.AbstractTask
definition, name, parent, properties, type
 
Fields inherited from interface com.massimo.tools.scriptrunner.Task
DATA_ERROR, ERROR, FINISHED, INTERRUPTED, PROMPT, RUNNING, START, SUCCESS
 
Constructor Summary
SQLGeneratorTask(Task parent, String type, Element definition, Map<String,String> parentConnectionProperties)
           
 
Method Summary
protected  int doProcess(ExecutionContext context)
          Implementing classes only need to do their own work and log progress when appropriate.
protected  int doValidate(ValidationContext context)
          Implement Task Check that template is well-formed, and that input is valid SQL.
protected  String[] generateBodies(ExecutionContext context, String text)
           
protected  Element[] generateTasks(String[] taskBodies, Element templateEl)
           
protected  org.apache.log4j.Logger getLogger()
          
 
Methods inherited from class com.massimo.tools.scriptrunner.work.SQLTask
executeSQL, finalize, getBindNames, getSQLSplitPattern, getSQLText, getSQLWarning, parseTextIntoStatements, postCheck, preCheck, setBinds, substitiuteBinds, validateBinds, validateSQL
 
Methods inherited from class com.massimo.tools.scriptrunner.AbstractTask
getBooleanProperty, getCurrentWorkingDirectory, getDefinition, getIntProperty, getName, getParent, getProperties, getStartProcessingRow, getText, getType, interrupt, isIgnoreableError, isIgnoreableError, isInterrupted, isLogProgress, postProcess, preProcess, process, resultCodeToString, substituteParameters, toString, validate, validateConnections, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SQLGeneratorTask

public SQLGeneratorTask(Task parent,
                        String type,
                        Element definition,
                        Map<String,String> parentConnectionProperties)
                 throws Exception
Parameters:
parent -
type -
definition -
parentConnectionProperties -
Throws:
Exception
Method Detail

doProcess

protected int doProcess(ExecutionContext context)
                 throws Exception
Description copied from class: SQLTask
Implementing classes only need to do their own work and log progress when appropriate.

Overrides:
doProcess in class SQLTask
Returns:
O for success. Anything else is a failure.
Throws:
Exception
See Also:
SQLTask.doProcess(com.massimo.tools.scriptrunner.context.ExecutionContext)

doValidate

protected int doValidate(ValidationContext context)
Implement Task Check that template is well-formed, and that input is valid SQL.

Overrides:
doValidate in class SQLTask
Returns:
0 for success. Anything else is a failure.

generateBodies

protected String[] generateBodies(ExecutionContext context,
                                  String text)
                           throws SQLException,
                                  SRException
Parameters:
context -
text - Input text
Returns:
The generated child Task bodies
Throws:
SQLException
SRException

generateTasks

protected Element[] generateTasks(String[] taskBodies,
                                  Element templateEl)
Parameters:
taskBodies -
templateEl -
Returns:
Array of generated Tasks

getLogger

protected org.apache.log4j.Logger getLogger()
Description copied from class: SQLTask

Overrides:
getLogger in class SQLTask
Returns:
Class logger
See Also:
AbstractTask.getLogger()