class StrategyBasedReplicationFactory implements ReplicationFactory {

  @Override
  public Replication newInstance(TableReplication tableReplication) {
    if (tableReplication.getReplicationStrategy() == ReplicationStrategy.PROPAGATE_DELETES) {
      String eventId = eventIdFactory.newEventId(EventIdPrefix.CIRCUS_TRAIN_DESTRUCTIVE.getPrefix());
      CleanupLocationManager cleanupLocationManager = CleanupLocationManagerFactory.newInstance(eventId,
        housekeepingListener, replicaCatalogListener, tableReplication);

      return new DestructiveReplication(upsertReplicationFactory, tableReplication, eventId,
          new DestructiveSource(sourceMetaStoreClientSupplier, tableReplication),
          new DestructiveReplica(replicaMetaStoreClientSupplier, cleanupLocationManager, tableReplication));
    }
    return upsertReplicationFactory.newInstance(tableReplication);
  }

  public  StrategyBasedReplicationFactory(
      ReplicationFactoryImpl upsertReplicationFactory,
      Supplier<CloseableMetaStoreClient> sourceMetaStoreClientSupplier,
      Supplier<CloseableMetaStoreClient> replicaMetaStoreClientSupplier,
      HousekeepingListener housekeepingListener,
      ReplicaCatalogListener replicaCatalogListener);

}