com.lucidera.runtime
Class LucidDbRuntimeContext

java.lang.Object
  extended by org.eigenbase.util.CompoundClosableAllocation
      extended by net.sf.farrago.util.FarragoCompoundAllocation
          extended by net.sf.farrago.runtime.FarragoRuntimeContext
              extended by com.lucidera.runtime.LucidDbRuntimeContext
All Implemented Interfaces:
FennelJavaErrorTarget, FennelJavaStreamMap, FarragoSessionRuntimeContext, FarragoAllocation, FarragoAllocationOwner, RelOptConnection, ClosableAllocation, ClosableAllocationOwner

public class LucidDbRuntimeContext
extends FarragoRuntimeContext

LucidDbRuntimeContext applies LucidDb semantics for query execution.

Version:
$Id: //open/dev/farrago/src/com/lucidera/runtime/LucidDbRuntimeContext.java#20 $
Author:
John Pham

Nested Class Summary
private  class LucidDbRuntimeContext.DefaultErrorLogger
          The default error logger writes records to a file
private static interface LucidDbRuntimeContext.ErrorLogger
          ErrorLogger processes error records
private  class LucidDbRuntimeContext.ErrorLoggerBase
          Base class for error loggers
private  class LucidDbRuntimeContext.ErrorQuota
          An error quota for a statement
private  class LucidDbRuntimeContext.ErrorQuotaLogger
          Applies a quota to an error logger
private  class LucidDbRuntimeContext.SummaryLogEntry
          SummaryLogEntry represents an entry in the summary log file.
private  class LucidDbRuntimeContext.SummaryLogger
          SummaryLogger create a summary of all error logs
private  class LucidDbRuntimeContext.SummaryLoggerRef
           
 
Field Summary
private  String actionId
           
private static String CONDITION_FIELD_NAME
           
private static String ERRCODE_FIELD_NAME
           
private static String EXCEPTION_FIELD_NAME
           
private  Map<String,RelDataType> iterCalcTypeMap
           
private static String LEVEL_ERROR
           
private static String LEVEL_FIELD_NAME
           
private static String LEVEL_WARNING
           
private static String LOG_FILE_FIELD_DELIMITER
           
private static String LOG_FILE_LINE_DELIMITER
           
private static String LOG_FILENAME_EXTENSION
           
private  Map<String,LucidDbRuntimeContext.ErrorLogger> loggerMap
           
private static String POSITION_FIELD_NAME
           
private  String processId
           
private  LucidDbRuntimeContext.ErrorQuota quota
           
private static String SUMMARY_FILENAME
           
private static Map<String,LucidDbRuntimeContext.SummaryLoggerRef> summaryInstanceMap
           
private static String TIMESTAMP_FIELD_NAME
           
private static Logger tracer
           
private  FarragoSessionVariables vars
           
 
Fields inherited from class net.sf.farrago.runtime.FarragoRuntimeContext
codeCache, cursorMonitor, dataWrapperCache, dynamicParamValues, isClosed, resultSetTypeMap, stmtId, streamGraph, streamOwner
 
Fields inherited from class org.eigenbase.util.CompoundClosableAllocation
allocations
 
Constructor Summary
LucidDbRuntimeContext(FarragoSessionRuntimeParams params)
           
 
Method Summary
 void closeAllocation()
          Closes this object.
private  String getFilename(String tag)
          Builds a filename for a logger, based on system parameters.
private  LucidDbRuntimeContext.ErrorLogger getLogger(String tag)
          Gets the logger for a given tag.
private  File getSummaryFile()
          Builds a filename for the summary logger.
private  LucidDbRuntimeContext.SummaryLogger getSummaryInstance(String filename)
          Gets a singleton summary logger, creating it as required
 int getTotalErrorCount()
           
 int getTotalWarningCount()
           
 Object handleRowError(String[] names, Object[] values, RuntimeException ex, int columnIndex, String tag, boolean isWarning)
          Handles a runtime exception based on an array of column values rather than on a SyntheticObject
 Object handleRowError(String[] names, Object[] values, RuntimeException ex, int columnIndex, String tag, boolean isWarning, String errorCode, String columnName)
          Handles runtime exception; if errorCode is non-null, exceptions are deferred until all errors on a row are processed; not currently implemented
 Object handleRowError(SyntheticObject row, RuntimeException ex, int columnIndex, String tag, boolean isWarning)
          Handles a runtime exception, but allows warnings as well.
 void handleRowErrorCompletion(RuntimeException ex, String tag)
          Handles exception for row errors with deferred exceptions; not currently implemented
private  void releaseSummaryInstance(String filename)
          Releases a singleton summary logger, possibly releasing its resources
 
Methods inherited from class net.sf.farrago.runtime.FarragoRuntimeContext
addAllocation, cancel, checkCancel, checkNotNull, checkNotNull, contentsAsArray, detachMdrSession, dummyArray, dummyPair, findFarragoTransform, forgetAllocation, getContextVariable_CURRENT_CATALOG, getContextVariable_CURRENT_DATE, getContextVariable_CURRENT_PATH, getContextVariable_CURRENT_ROLE, getContextVariable_CURRENT_SCHEMA, getContextVariable_CURRENT_TIME, getContextVariable_CURRENT_TIMESTAMP, getContextVariable_CURRENT_USER, getContextVariable_LOCALTIME, getContextVariable_LOCALTIMESTAMP, getContextVariable_SESSION_USER, getContextVariable_SYSTEM_USER, getContextVariable_USER, getCurrentTime, getDataServerRuntimeSupport, getDynamicParamValue, getFennelDbHandle, getFennelStreamGraph, getFennelTxnContext, getIndexRoot, getJavaStreamHandle, getRefMofId, getRelOptSchema, getRepos, getRowTypeForResultSet, getSequenceAccessor, getSession, getStreamGraph, getStreamHandle, getWarningQueue, handleRoutineInvocationException, handleRowError, handleRowError, hasAllocations, inUdr, loadFennelPlan, makeRowError, newConnection, newFennelTransformTupleIter, newFennelTupleIter, openStreams, popRoutineInvocation, prepareStreamGraph, pushRoutineInvocation, reattachMdrSession, registerFarragoTransform, registerJavaStream, registerJavaStream, setCursorState, setExecutionHandle, setStatementClassLoader, statementClassForName, waitForCursor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUMMARY_FILENAME

private static final String SUMMARY_FILENAME
See Also:
Constant Field Values

LOG_FILENAME_EXTENSION

private static final String LOG_FILENAME_EXTENSION
See Also:
Constant Field Values

LOG_FILE_FIELD_DELIMITER

private static final String LOG_FILE_FIELD_DELIMITER
See Also:
Constant Field Values

LOG_FILE_LINE_DELIMITER

private static final String LOG_FILE_LINE_DELIMITER
See Also:
Constant Field Values

TIMESTAMP_FIELD_NAME

private static final String TIMESTAMP_FIELD_NAME
See Also:
Constant Field Values

EXCEPTION_FIELD_NAME

private static final String EXCEPTION_FIELD_NAME
See Also:
Constant Field Values

POSITION_FIELD_NAME

private static final String POSITION_FIELD_NAME
See Also:
Constant Field Values

LEVEL_FIELD_NAME

private static final String LEVEL_FIELD_NAME
See Also:
Constant Field Values

LEVEL_WARNING

private static final String LEVEL_WARNING
See Also:
Constant Field Values

LEVEL_ERROR

private static final String LEVEL_ERROR
See Also:
Constant Field Values

CONDITION_FIELD_NAME

private static final String CONDITION_FIELD_NAME
See Also:
Constant Field Values

ERRCODE_FIELD_NAME

private static final String ERRCODE_FIELD_NAME
See Also:
Constant Field Values

tracer

private static final Logger tracer

summaryInstanceMap

private static Map<String,LucidDbRuntimeContext.SummaryLoggerRef> summaryInstanceMap

iterCalcTypeMap

private final Map<String,RelDataType> iterCalcTypeMap

vars

private final FarragoSessionVariables vars

loggerMap

private final Map<String,LucidDbRuntimeContext.ErrorLogger> loggerMap

quota

private final LucidDbRuntimeContext.ErrorQuota quota

processId

private String processId

actionId

private String actionId
Constructor Detail

LucidDbRuntimeContext

public LucidDbRuntimeContext(FarragoSessionRuntimeParams params)
Method Detail

getTotalErrorCount

public int getTotalErrorCount()

getTotalWarningCount

public int getTotalWarningCount()

closeAllocation

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

Specified by:
closeAllocation in interface ClosableAllocation
Overrides:
closeAllocation in class FarragoRuntimeContext

getSummaryInstance

private LucidDbRuntimeContext.SummaryLogger getSummaryInstance(String filename)
Gets a singleton summary logger, creating it as required


releaseSummaryInstance

private void releaseSummaryInstance(String filename)
Releases a singleton summary logger, possibly releasing its resources


handleRowError

public Object handleRowError(SyntheticObject row,
                             RuntimeException ex,
                             int columnIndex,
                             String tag,
                             boolean isWarning)
Description copied from class: FarragoRuntimeContext
Handles a runtime exception, but allows warnings as well.

Overrides:
handleRowError in class FarragoRuntimeContext
See Also:
FarragoRuntimeContext.handleRowError(SyntheticObject, RuntimeException, int, String)

handleRowError

public Object handleRowError(String[] names,
                             Object[] values,
                             RuntimeException ex,
                             int columnIndex,
                             String tag,
                             boolean isWarning)
Description copied from class: FarragoRuntimeContext
Handles a runtime exception based on an array of column values rather than on a SyntheticObject

Overrides:
handleRowError in class FarragoRuntimeContext

handleRowError

public Object handleRowError(String[] names,
                             Object[] values,
                             RuntimeException ex,
                             int columnIndex,
                             String tag,
                             boolean isWarning,
                             String errorCode,
                             String columnName)
Description copied from class: FarragoRuntimeContext
Handles runtime exception; if errorCode is non-null, exceptions are deferred until all errors on a row are processed; not currently implemented

Overrides:
handleRowError in class FarragoRuntimeContext

handleRowErrorCompletion

public void handleRowErrorCompletion(RuntimeException ex,
                                     String tag)
Description copied from class: FarragoRuntimeContext
Handles exception for row errors with deferred exceptions; not currently implemented

Overrides:
handleRowErrorCompletion in class FarragoRuntimeContext

getLogger

private LucidDbRuntimeContext.ErrorLogger getLogger(String tag)
Gets the logger for a given tag. If a matching logger has not been initialized yet, create a new one. Otherwise return an existing logger.


getFilename

private String getFilename(String tag)
Builds a filename for a logger, based on system parameters. The filename will be [processId]_[actionId]_[tag][LOG_FILENAME_EXTENSION].

processId: defaults to identifier based on session id
actionId: defaults to identifier based on statement id
tag: often based on input/output filename, or a unique id
LOG_FILENAME_EXTENSION: such as ".log"

For example: "1201_LoadAccount_LOCALDB.ACME.ACCOUNT_STG.log"


getSummaryFile

private File getSummaryFile()
Builds a filename for the summary logger.