All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hotels.bdp.circustrain.api.copier.CopierContext Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (C) ${license.git.copyrightYears} Expedia, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hotels.bdp.circustrain.api.copier;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.metastore.api.Partition;
import org.apache.hadoop.hive.metastore.api.Table;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

import com.hotels.bdp.circustrain.api.conf.TableReplication;

public final class CopierContext {

  private String eventId;
  private Path sourceBaseLocation;
  private List sourceSubLocations = ImmutableList.copyOf(Collections.emptyList());
  private Path replicaLocation;
  private Map copierOptions;
  private TableReplication tableReplication;
  private Table sourceTable;
  private List sourcePartitions;

  public CopierContext(
      TableReplication tableReplication,
      String eventId,
      Path sourceBaseLocation,
      List sourceSubLocations,
      Path replicaLocation,
      Map copierOptions,
      Table sourceTable,
      List sourcePartitions) {
    this.tableReplication = tableReplication;
    this.eventId = eventId;
    this.sourceBaseLocation = sourceBaseLocation;
    if (sourceSubLocations != null) {
      this.sourceSubLocations = ImmutableList.copyOf(sourceSubLocations);
    }
    this.replicaLocation = replicaLocation;
    this.copierOptions = ImmutableMap.copyOf(copierOptions);
    this.sourceTable = sourceTable;
    this.sourcePartitions = sourcePartitions;
  }

  public CopierContext(
      TableReplication tableReplication,
      String eventId,
      Path sourceBaseLocation,
      List sourceSubLocations,
      Path replicaLocation,
      Map copierOptions) {
    this(tableReplication, eventId, sourceBaseLocation, sourceSubLocations, replicaLocation, copierOptions, null, null);
  }

  public CopierContext(
      TableReplication tableReplication,
      String eventId,
      Path sourceLocation,
      Path replicaLocation,
      Map copierOptions) {
    this(tableReplication, eventId, sourceLocation, null, replicaLocation, copierOptions);
  }

  public CopierContext(
      String eventId,
      Path sourceBaseLocation,
      List sourceSubLocations,
      Path replicaLocation,
      Map copierOptions) {
    this(null, eventId, sourceBaseLocation, sourceSubLocations, replicaLocation, copierOptions);
  }

  public CopierContext(
      String eventId,
      Path sourceBaseLocation,
      Path replicaLocation,
      Map copierOptions) {
    this(null, eventId, sourceBaseLocation, null, replicaLocation, copierOptions);
  }

  public String getEventId() {
    return eventId;
  }

  public Path getSourceBaseLocation() {
    return sourceBaseLocation;
  }

  public List getSourceSubLocations() {
    return sourceSubLocations;
  }

  public Path getReplicaLocation() {
    return replicaLocation;
  }

  public Map getCopierOptions() {
    return copierOptions;
  }

  public TableReplication getTableReplication() {
    return tableReplication;
  }

  public Table getSourceTable() {
    return sourceTable;
  }

  public List getSourcePartitions() {
    return sourcePartitions;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy