class ReplicaTableFactory {

  TableAndStatistics newReplicaTable(
      String eventId,
      TableAndStatistics sourceTableAndStatistics,
      String replicaDatabaseName,
      String replicaTableName,
      Path replicaDataDestination,
      ReplicationMode replicationMode) {
    Table sourceTable = sourceTableAndStatistics.getTable();
    Table replica = tableTransformation.transform(new Table(sourceTable));
    replica.setDbName(replicaDatabaseName);
    replica.setTableName(replicaTableName);
    replica.getSd().setLocation(toStringOrNull(replicaDataDestination));

    setReplicaTableType(sourceTable, replica);

    // Statistic specific parameters
    replica.putToParameters(STATS_GENERATED_VIA_STATS_TASK, Boolean.TRUE.toString());
    replica.putToParameters(STATS_GENERATED, Boolean.TRUE.toString());
    replica.putToParameters(DO_NOT_UPDATE_STATS, Boolean.TRUE.toString());

    // Replication specific parameters
    replica.putToParameters(LAST_REPLICATED.parameterName(), DateTime.now(DateTimeZone.UTC).toString());
    replica.putToParameters(REPLICATION_EVENT.parameterName(), eventId);
    replica.putToParameters(SOURCE_LOCATION.parameterName(), toStringOrEmpty(sourceTable.getSd().getLocation()));
    replica.putToParameters(SOURCE_TABLE.parameterName(), Warehouse.getQualifiedName(sourceTable));
    replica.putToParameters(SOURCE_METASTORE.parameterName(), sourceMetaStoreUris);
    replica.putToParameters(REPLICATION_MODE.parameterName(), replicationMode.name());

    // Create some replica stats
    ColumnStatistics replicaColumnStats = null;
    if (sourceTableAndStatistics.getStatistics() != null) {
      replicaColumnStats = new ColumnStatistics(
          new ColumnStatisticsDesc(true, replica.getDbName(), replica.getTableName()),
          sourceTableAndStatistics.getStatistics().getStatsObj());
      replicaColumnStats = columnStatisticsTransformation.transform(replicaColumnStats);
    }

    return new TableAndStatistics(replica, replicaColumnStats);
  }

    ReplicaTableFactory(
      HiveConf sourceHiveConf,
      TableTransformation tableTransformation,
      PartitionTransformation partitionTransformation,
      ColumnStatisticsTransformation columnStatisticsTransformation);
    ReplicaTableFactory(
      String sourceMetaStoreUris,
      TableTransformation tableTransformation,
      PartitionTransformation partitionTransformation,
      ColumnStatisticsTransformation columnStatisticsTransformation);

}