com.lucidera.runtime
Class LucidDbRuntimeContext.DefaultErrorLogger

java.lang.Object
  extended by com.lucidera.runtime.LucidDbRuntimeContext.ErrorLoggerBase
      extended by com.lucidera.runtime.LucidDbRuntimeContext.DefaultErrorLogger
All Implemented Interfaces:
LucidDbRuntimeContext.ErrorLogger, ClosableAllocation
Direct Known Subclasses:
LucidDbRuntimeContext.SummaryLogger
Enclosing class:
LucidDbRuntimeContext

private class LucidDbRuntimeContext.DefaultErrorLogger
extends LucidDbRuntimeContext.ErrorLoggerBase
implements ClosableAllocation

The default error logger writes records to a file

TODO: use existing schema export code and output BCP files as well.


Field Summary
private  Object[] args
           
private  SimpleDateFormat dateFormat
           
private  boolean failedInit
           
private static char FIELD_DELIM
           
protected  String filename
           
private  String format
           
private  boolean hasException
           
private static char LINE_DELIM
           
private  boolean needsHeader
           
private static String ONE_QUOTE
           
private  PrintStream ps
           
private static char QUOTE_CHAR
           
private static String timestampFormatStr
           
private static String TWO_QUOTES
           
 
Fields inherited from class com.lucidera.runtime.LucidDbRuntimeContext.ErrorLoggerBase
fieldCount, names, row, values
 
Constructor Summary
  LucidDbRuntimeContext.DefaultErrorLogger(String filename)
           
protected LucidDbRuntimeContext.DefaultErrorLogger(String filename, boolean hasException)
           
 
Method Summary
 void closeAllocation()
          Closes this object.
 String getFilename()
           
 void log(RuntimeException ex, int columnIndex, String tag, boolean isWarning)
           
 EigenbaseException log(RuntimeException ex, int columnIndex, String tag, boolean isWarning, String errorCode, String columnName)
          Writes the current log record
private  String quoteValue(Object o)
          Converts an object to a string then quotes it
private  String quoteValue(String s)
          Quotes a string, if required, for standard CSV format
private  String stripColumnQualifier(String fieldName)
          Fields of generated Java code look like: ID$0$[COLNAME] This methods strips everything up to the last '$'.
 
Methods inherited from class com.lucidera.runtime.LucidDbRuntimeContext.ErrorLoggerBase
completeDeferredException, getErrorCount, getFieldName, getName, getRecordString, getValue, getWarningCount, log, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timestampFormatStr

private static final String timestampFormatStr
See Also:
Constant Field Values

filename

protected String filename

dateFormat

private final SimpleDateFormat dateFormat

ps

private PrintStream ps

failedInit

private boolean failedInit

args

private Object[] args

format

private String format

needsHeader

private boolean needsHeader

hasException

private boolean hasException

LINE_DELIM

private static final char LINE_DELIM
See Also:
Constant Field Values

FIELD_DELIM

private static final char FIELD_DELIM
See Also:
Constant Field Values

QUOTE_CHAR

private static final char QUOTE_CHAR
See Also:
Constant Field Values

ONE_QUOTE

private static final String ONE_QUOTE
See Also:
Constant Field Values

TWO_QUOTES

private static final String TWO_QUOTES
See Also:
Constant Field Values
Constructor Detail

LucidDbRuntimeContext.DefaultErrorLogger

public LucidDbRuntimeContext.DefaultErrorLogger(String filename)

LucidDbRuntimeContext.DefaultErrorLogger

protected LucidDbRuntimeContext.DefaultErrorLogger(String filename,
                                                   boolean hasException)
Method Detail

closeAllocation

public void closeAllocation()
Description copied from interface: ClosableAllocation
Closes this object.

Specified by:
closeAllocation in interface ClosableAllocation

log

public void log(RuntimeException ex,
                int columnIndex,
                String tag,
                boolean isWarning)

log

public EigenbaseException log(RuntimeException ex,
                              int columnIndex,
                              String tag,
                              boolean isWarning,
                              String errorCode,
                              String columnName)
Description copied from class: LucidDbRuntimeContext.ErrorLoggerBase
Writes the current log record

Specified by:
log in class LucidDbRuntimeContext.ErrorLoggerBase

quoteValue

private String quoteValue(Object o)
Converts an object to a string then quotes it


quoteValue

private String quoteValue(String s)
Quotes a string, if required, for standard CSV format


stripColumnQualifier

private String stripColumnQualifier(String fieldName)
Fields of generated Java code look like: ID$0$[COLNAME] This methods strips everything up to the last '$'.

Parameters:
fieldName - name of field to be cleaned stripped

getFilename

public String getFilename()
Specified by:
getFilename in interface LucidDbRuntimeContext.ErrorLogger