예제 #1
0
 public static List<EncoderPlugin> newEncoderPlugins(
     ExecSession exec, List<ConfigSource> configs) {
   ImmutableList.Builder<EncoderPlugin> builder = ImmutableList.builder();
   for (ConfigSource config : configs) {
     builder.add(exec.newPlugin(EncoderPlugin.class, config.get(PluginType.class, "type")));
   }
   return builder.build();
 }
  @Override
  public void transaction(ConfigSource config, Schema inputSchema, FilterPlugin.Control control) {
    PluginTask task = config.loadConfig(PluginTask.class);

    try {
      task.setJsonTable(buildJsonTable(task, loadJsonFile(task.getJsonFilePath())));
    } catch (IOException e) {
      logger.error(e.getMessage());
      throw new RuntimeException(e);
    }

    Schema outputSchema = buildOutputSchema(task, inputSchema, task.getJsonColumns());

    control.run(task.dump(), outputSchema);
  }
  @Override
  public ConfigDiff transaction(ConfigSource config, InputPlugin.Control control) {
    PluginTask task = config.loadConfig(getTaskClass());

    // if (task.getLastValue().isPresent() && !task.getOrderBy().isPresent()) {
    //    throw new ConfigException("order_by parameter must be set if last_value parameter is
    // set");
    // }

    Schema schema;
    try (JdbcInputConnection con = newConnection(task)) {
      schema = setupTask(con, task);
    } catch (SQLException ex) {
      throw Throwables.propagate(ex);
    }

    return buildNextConfigDiff(task, control.run(task.dump(), schema, 1));
  }
예제 #4
0
 @Override
 public void transaction(ConfigSource config, Control control) {
   PluginTask task = config.loadConfig(PluginTask.class);
   control.run(task.dump(), task.getSchemaConfig().toSchema());
 }
예제 #5
0
 public void transaction(ConfigSource config, EncoderPlugin.Control control) {
   PluginTask task = config.loadConfig(PluginTask.class);
   control.run(task.dump());
 }
 @Test
 public void createS3ClientSuccessfully() {
   ConfigSource config = TestS3FileInputPlugin.config().set("endpoint", "my.endpoint.com");
   PluginTask task = config.loadConfig(plugin.getTaskClass());
   plugin.newS3Client(task);
 }