use of org.pentaho.di.core.database.DatabaseInterfaceExtended in project pentaho-kettle by pentaho.
the class DatabaseLogExceptionFactory method extractDatabase.
private static DatabaseInterfaceExtended extractDatabase(LogTableCoreInterface table) {
DatabaseInterfaceExtended result = null;
if (table != null && table.getDatabaseMeta() != null) {
DatabaseInterface databaseInterface = table.getDatabaseMeta().getDatabaseInterface();
result = databaseInterface instanceof DatabaseInterfaceExtended ? (DatabaseInterfaceExtended) databaseInterface : null;
}
return result;
}
use of org.pentaho.di.core.database.DatabaseInterfaceExtended in project pentaho-kettle by pentaho.
the class DatabaseLogExceptionFactory method getExceptionStrategy.
/**
* <p>
* Returns throw exception strategy depends on defined behavior. Default is suppress exception.
* </p>
* <p/>
* <p>
* This behavior can be overridden with 'kettle.properties' key-value using 'Edit Kettle.properties file' in Spoon or
* other.
* </p>
* <p/>
* <p>
* Following this strategy - <code>System.getProperty(String key)</code> call will be used to check if key-value pair
* is defined. If key-value pair is not defined or value is set to FALSE/N, exception will be checked and suppressable strategy
* with short message can be chosen, otherwise throwable behavior will be used
* </p>
*
* @param table
* logging table that participated in exception. Must be instance of {@link LogTableCoreInterface}, otherwise
* default suppress exception behavior will be used.
* @param e
* if key-value pair is not defined or value is set to FALSE/N, e will be checked and suppressable strategy
* with short message can be chosen.
* @return
* @see {@link org.pentaho.di.core.Const#KETTLE_VARIABLES_FILE}
*/
public static LogExceptionBehaviourInterface getExceptionStrategy(LogTableCoreInterface table, Exception e) {
DatabaseInterfaceExtended databaseInterface = extractDatabase(table);
LogExceptionBehaviourInterface suppressableResult = suppressable;
if (databaseInterface != null && !databaseInterface.fullExceptionLog(e)) {
suppressableResult = suppressableWithShortMessage;
}
String val = System.getProperty(KETTLE_GLOBAL_PROP_NAME);
// with a small penalty for backward compatibility
if (val == null) {
// same as before
return suppressableResult;
}
ValueString sVal = new ValueString(val);
return sVal.getBoolean() ? throwable : suppressableResult;
}
Aggregations