class CompositeCopierFactory implements CopierFactory {

  @Override
  public Copier newInstance(CopierContext copierContext) {
    List<Copier> copiers = new ArrayList<>(delegates.size());
    int i = 0;
    for (CopierFactory delegate : delegates) {
      CopierPathGeneratorParams copierPathGeneratorParams = CopierPathGeneratorParams
          .newParams(i++, copierContext.getEventId(), copierContext.getSourceBaseLocation(),
              copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(),
              copierContext.getCopierOptions());
      Path newSourceBaseLocation = pathGenerator.generateSourceBaseLocation(copierPathGeneratorParams);
      Path newReplicaLocation = pathGenerator.generateReplicaLocation(copierPathGeneratorParams);

      CopierContext delegateContext = new CopierContext(copierContext.getTableReplication(), copierContext.getEventId(),
          newSourceBaseLocation, copierContext.getSourceSubLocations(), newReplicaLocation,
          copierContext.getCopierOptions(), copierContext.getSourceTable(), copierContext.getSourcePartitions());
      Copier copier = delegate.newInstance(delegateContext);
      copiers.add(copier);
    }
    return new CompositeCopier(copiers, metricsMerger);
  }

  public  CompositeCopierFactory(List<CopierFactory> delegates);
  public  CompositeCopierFactory(
      List<CopierFactory> delegates,
      CopierPathGenerator pathGenerator,
      MetricsMerger metricsMerger);

}