com.continuent.tungsten.replicator.applier.batch
Class JavascriptExecutor

java.lang.Object
  extended by com.continuent.tungsten.replicator.applier.batch.JavascriptExecutor
All Implemented Interfaces:
ScriptExecutor, ReplicatorPlugin

public class JavascriptExecutor
extends java.lang.Object
implements ScriptExecutor

Represents a class to execute a Javascript batch load script. This class is a partial copy/paste from logic in class JavaScriptFilter, which integrates Rhino Javascript for filters.

See Also:
JavaScriptFilter

Constructor Summary
JavascriptExecutor()
           
 
Method Summary
 void configure(PluginContext context)
          Complete plug-in configuration.
 void execute(CsvInfo info)
          Executes the script for a specific table.
 void prepare(PluginContext context)
          Prepare plug-in for use.
 void release(PluginContext context)
          Release all resources used by plug-in.
 void setConnection(Database connection)
          Sets the DBMS connection.
 void setScript(java.lang.String script)
          Sets the script name.
 void setShowCommands(boolean showCommands)
          If set to true, show commands as they execute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavascriptExecutor

public JavascriptExecutor()
Method Detail

setConnection

public void setConnection(Database connection)
Sets the DBMS connection.

Specified by:
setConnection in interface ScriptExecutor
See Also:
ScriptExecutor.setConnection(com.continuent.tungsten.replicator.database.Database)

setScript

public void setScript(java.lang.String script)
Sets the script name.

Specified by:
setScript in interface ScriptExecutor
See Also:
ScriptExecutor.setScript(java.lang.String)

setShowCommands

public void setShowCommands(boolean showCommands)
If set to true, show commands as they execute.

Specified by:
setShowCommands in interface ScriptExecutor
See Also:
ScriptExecutor.setShowCommands(boolean)

configure

public void configure(PluginContext context)
               throws ReplicatorException,
                      java.lang.InterruptedException
Complete plug-in configuration. This is called after setters are invoked at the time that the replicator goes through configuration.

Specified by:
configure in interface ReplicatorPlugin
Throws:
ReplicatorException - Thrown if configuration is incomplete or fails
java.lang.InterruptedException
See Also:
ReplicatorPlugin.configure(com.continuent.tungsten.replicator.plugin.PluginContext)

prepare

public void prepare(PluginContext context)
             throws ReplicatorException
Prepare plug-in for use. This method is assumed to allocate all required resources. It is called before the plug-in performs any operations.

Specified by:
prepare in interface ReplicatorPlugin
Throws:
ReplicatorException - Thrown if resource allocation fails
See Also:
ReplicatorPlugin.prepare(com.continuent.tungsten.replicator.plugin.PluginContext)

release

public void release(PluginContext context)
Release all resources used by plug-in. This is called before the plug-in is deallocated.

Specified by:
release in interface ReplicatorPlugin
See Also:
ReplicatorPlugin.release(com.continuent.tungsten.replicator.plugin.PluginContext)

execute

public void execute(CsvInfo info)
             throws ReplicatorException
Executes the script for a specific table.

Specified by:
execute in interface ScriptExecutor
Parameters:
info - Information about the table to be loaded and source CSV file
Throws:
ReplicatorException - Thrown if load operation fails
See Also:
ScriptExecutor.execute(com.continuent.tungsten.replicator.applier.batch.CsvInfo)