Skip to content

Commit

Permalink
0001218: bind a logger as the "log" variable to the beanshell router,…
Browse files Browse the repository at this point in the history
… column transform and load filter to make debugging easier
  • Loading branch information
chenson42 committed May 15, 2013
1 parent 91f14ee commit 028838d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
Expand Up @@ -56,6 +56,7 @@ public class BshDatabaseWriterFilter implements IDatabaseWriterFilter, IDatabase
private static final String DATA = "data";
private static final String ERROR = "error";
private static final String ENGINE = "engine";
private static final String LOG = "log";
private final String INTERPRETER_KEY = String.format("%d.BshInterpreter", hashCode());
private final String BATCH_COMPLETE_SCRIPTS_KEY = String.format("%d.BatchCompleteScripts",
hashCode());
Expand Down Expand Up @@ -125,6 +126,7 @@ protected Interpreter getInterpreter(Context context) {
protected void bind(Interpreter interpreter, DataContext context, Table table, CsvData data, Exception error)
throws EvalError {

interpreter.set(LOG, log);
interpreter.set(ENGINE, this.symmetricEngine);
interpreter.set(CONTEXT, context);
interpreter.set(TABLE, table);
Expand Down
Expand Up @@ -106,6 +106,7 @@ protected Set<String> eval(Object value, Set<Node> nodes, Set<String> targetNode

protected void bind(Interpreter interpreter, DataMetaData dataMetaData, Set<Node> nodes, Set<String> targetNodes)
throws EvalError {
interpreter.set("log", log);
interpreter.set("dataMetaData", dataMetaData);
interpreter.set("nodes", nodes);
interpreter.set("identityNodeId", engine.getNodeService().findIdentityNodeId());
Expand Down
Expand Up @@ -60,6 +60,7 @@ public String transform(IDatabasePlatform platform,
String newValue, String oldValue) throws IgnoreColumnException, IgnoreRowException {
try {
Interpreter interpreter = getInterpreter(context);
interpreter.set("log", log);
interpreter.set("sqlTemplate", platform.getSqlTemplate());
interpreter.set("currentValue", newValue);
interpreter.set("oldValue", oldValue);
Expand Down

0 comments on commit 028838d

Please sign in to comment.