com.massimo.tools.scriptrunner.unused
Class OracleFileCheckTask

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.SQLFunctionTask
              extended by com.massimo.tools.scriptrunner.unused.OracleFileCheckTask
All Implemented Interfaces:
Task

public class OracleFileCheckTask
extends SQLFunctionTask

Oracle specific task to check for the presence of a file. Uses Oracle's DIRECTORY objects and a database function, f_file_exists(:directory, :file)


Field Summary
static String ATTRIBUTE_DIRECTORY
           
static String ATTRIBUTE_FILE
           
protected static String SQL_FILE_EXISTS
           
 
Fields inherited from class com.massimo.tools.scriptrunner.work.SQLFunctionTask
SQL_FN_PREFIX_ORACLE, SQL_FN_PREFIX_POSTGRES, SQL_FN_SUFFIX_ORACLE, SQL_FN_SUFFIX_POSTGRES
 
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
OracleFileCheckTask(Task parent, String type, Element definition, Map<String,String> connectionProperties)
           
 
Method Summary
protected  int doValidate(ValidationContext context)
          Implement Task Check whether this task should be able to run.
protected  Object[] getBindValues(List<String> ignoreBindNames)
          The bind variables are the database directory and the name of the file to check for.
protected  org.apache.log4j.Logger getLogger()
          
protected  String getSQLText()
          Hard-coded SQL statement.
protected  int validateBinds(ValidationContext context)
          Checks that bind variables in bindNames have values.
 
Methods inherited from class com.massimo.tools.scriptrunner.work.SQLFunctionTask
executeSQL, parseTextIntoStatements, validateSQL
 
Methods inherited from class com.massimo.tools.scriptrunner.work.SQLTask
doProcess, finalize, getBindNames, getSQLSplitPattern, getSQLWarning, postCheck, preCheck, setBinds, substitiuteBinds
 
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
 

Field Detail

ATTRIBUTE_DIRECTORY

public static final String ATTRIBUTE_DIRECTORY
See Also:
Constant Field Values

ATTRIBUTE_FILE

public static final String ATTRIBUTE_FILE
See Also:
Constant Field Values

SQL_FILE_EXISTS

protected static String SQL_FILE_EXISTS
Constructor Detail

OracleFileCheckTask

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

doValidate

protected int doValidate(ValidationContext context)
Implement Task Check whether this task should be able to run. Implementations should check for the prescence of files,...

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

getBindValues

protected Object[] getBindValues(List<String> ignoreBindNames)
The bind variables are the database directory and the name of the file to check for.

Overrides:
getBindValues in class SQLFunctionTask
Parameters:
ignoreBindNames - List
Returns:
Array of bind variable values
Throws:
IllegalArgumentException - if directory or filename are empty

getLogger

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

Overrides:
getLogger in class SQLFunctionTask
Returns:
Logger
See Also:
AbstractTask.getLogger()

getSQLText

protected String getSQLText()
Hard-coded SQL statement.

Overrides:
getSQLText in class SQLFunctionTask
Returns:
SQL function call, as a String
See Also:
SQLTask.getSQLText()

validateBinds

protected final int validateBinds(ValidationContext context)
Checks that bind variables in bindNames have values. This validates that SQLTask.setBinds(PreparedStatement, List) will run.

Overrides:
validateBinds in class SQLTask
Parameters:
context -
Returns:
Task SUCCESS or ERROR