class ReplicationFactoryImpl implements ReplicationFactory {

  @Override
  public Replication newInstance(TableReplication tableReplication) {
    Replica replica = replicaFactory.newInstance(tableReplication);
    SourceTable sourceTable = tableReplication.getSourceTable();
    String sourceDatabaseName = sourceTable.getDatabaseName();
    String sourceTableName = sourceTable.getTableName();

    Source source = sourceFactory.newInstance(tableReplication);
    validate(tableReplication, source, replica);
    TableAndStatistics tableAndStatistics = source.getTableAndStatistics(sourceDatabaseName, sourceTableName);
    List<FieldSchema> partitionKeys = tableAndStatistics.getTable().getPartitionKeys();

    Replication replication = null;
    if (partitionKeys == null || partitionKeys.isEmpty()) {
      replication = createUnpartitionedTableReplication(tableReplication, source, replica);
    } else {
      replication = createPartitionedTableReplication(tableReplication, source, replica);
    }
    return replication;
  }

  public  ReplicationFactoryImpl(
      SourceFactory sourceFactory,
      ReplicaFactory replicaFactory,
      CopierFactoryManager copierFactoryManager,
      CopierListener copierListener,
      PartitionPredicateFactory partitionPredicateFactory,
      CopierOptions copierOptions,
      DataManipulatorFactoryManager dataManipulatorFactoryManager);

}