
package gobblin.source.workunit;

import gobblin.configuration.SourceState;

/***
 * Shim layer for org.apache.gobblin.source.workunit.ImmutableExtract
 */
public class ImmutableExtract extends org.apache.gobblin.source.workunit.ImmutableExtract {

  public ImmutableExtract(SourceState state, gobblin.source.workunit.Extract.TableType type, String namespace, String table) {
    super(state, adaptTableType(type), namespace, table);
  }

  public ImmutableExtract(Extract extract) {
    super(extract);
  }

  private static org.apache.gobblin.source.workunit.Extract.TableType adaptTableType(Extract.TableType type) {
    switch (type) {
      case SNAPSHOT_ONLY: return org.apache.gobblin.source.workunit.Extract.TableType.SNAPSHOT_ONLY;
      case SNAPSHOT_APPEND: return org.apache.gobblin.source.workunit.Extract.TableType.SNAPSHOT_APPEND;
      default: return org.apache.gobblin.source.workunit.Extract.TableType.APPEND_ONLY;
    }
  }
}
