예제 #1
0
 /**
  * Helper method to create a new ScriptExecutor for specified script URL.
  *
  * @param scriptFileUrl URL of script file.
  * @param externalProperties see {@link ConfigurationFactory#setExternalParameters(java.util.Map)}
  * @return configured instance of script executor.
  * @see ConfigurationFactory
  */
 @ThreadSafe
 public static EtlExecutor newExecutor(
     final URL scriptFileUrl, final Map<String, ?> externalProperties) {
   ConfigurationFactory cf = new ConfigurationFactory();
   cf.setResourceURL(scriptFileUrl);
   if (externalProperties != null) {
     cf.setExternalParameters(externalProperties);
   }
   return new EtlExecutor(cf.createConfiguration());
 }
예제 #2
0
 private EtlExecutor prepareExecutor(Map<String, String> props) {
   ConfigurationFactory cf = new ConfigurationFactory();
   cf.setResourceURL(getClass().getResource(getClass().getSimpleName() + ".xml"));
   cf.setExternalParameters(props);
   return new EtlExecutor(cf.createConfiguration()) {
     // overrides prepare method to get ctx and params for connection
     @Override
     protected EtlContext prepare(final ProgressIndicator indicator) {
       ctx = super.prepare(indicator);
       Map<String, ConnectionManager> connections = SqlTestHelper.getConnections(ctx.getSession());
       ConnectionManager con = connections.entrySet().iterator().next().getValue();
       params = SqlTestHelper.getConnectionParameters(con);
       return ctx;
     }
   };
 }