001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.hadoop.hbase.backup;
020
021import java.util.List;
022
023import org.apache.hadoop.hbase.TableName;
024import org.apache.yetus.audience.InterfaceAudience;
025
026/**
027 * POJO class for backup request
028 */
029@InterfaceAudience.Private
030public final class BackupRequest {
031
032  public static class Builder {
033
034    BackupRequest request;
035
036    public Builder() {
037      request = new BackupRequest();
038    }
039
040    public Builder withBackupType(BackupType type) {
041      request.setBackupType(type);
042      return this;
043    }
044
045    public Builder withTableList(List<TableName> tables) {
046      request.setTableList(tables);
047      return this;
048    }
049
050    public Builder withTargetRootDir(String backupDir) {
051      request.setTargetRootDir(backupDir);
052      return this;
053    }
054
055    public Builder withBackupSetName(String setName) {
056      request.setBackupSetName(setName);
057      return this;
058    }
059
060    public Builder withTotalTasks(int numTasks) {
061      request.setTotalTasks(numTasks);
062      return this;
063    }
064
065    public Builder withBandwidthPerTasks(int bandwidth) {
066      request.setBandwidth(bandwidth);
067      return this;
068    }
069
070    public Builder withYarnPoolName(String name) {
071      request.setYarnPoolName(name);
072      return this;
073    }
074
075    public BackupRequest build() {
076      return request;
077    }
078
079  }
080
081  private BackupType type;
082  private List<TableName> tableList;
083  private String targetRootDir;
084  private int totalTasks = -1;
085  private long bandwidth = -1L;
086  private String backupSetName;
087  private String yarnPoolName;
088
089  private BackupRequest() {
090  }
091
092  private BackupRequest setBackupType(BackupType type) {
093    this.type = type;
094    return this;
095  }
096
097  public BackupType getBackupType() {
098    return this.type;
099  }
100
101  private BackupRequest setTableList(List<TableName> tableList) {
102    this.tableList = tableList;
103    return this;
104  }
105
106  public List<TableName> getTableList() {
107    return this.tableList;
108  }
109
110  private BackupRequest setTargetRootDir(String targetRootDir) {
111    this.targetRootDir = targetRootDir;
112    return this;
113  }
114
115  public String getTargetRootDir() {
116    return this.targetRootDir;
117  }
118
119  private BackupRequest setTotalTasks(int totalTasks) {
120    this.totalTasks = totalTasks;
121    return this;
122  }
123
124  public int getTotalTasks() {
125    return this.totalTasks;
126  }
127
128  private BackupRequest setBandwidth(long bandwidth) {
129    this.bandwidth = bandwidth;
130    return this;
131  }
132
133  public long getBandwidth() {
134    return this.bandwidth;
135  }
136
137  public String getBackupSetName() {
138    return backupSetName;
139  }
140
141  private BackupRequest setBackupSetName(String backupSetName) {
142    this.backupSetName = backupSetName;
143    return this;
144  }
145
146  public String getYarnPoolName() {
147    return yarnPoolName;
148  }
149
150  public void setYarnPoolName(String yarnPoolName) {
151    this.yarnPoolName = yarnPoolName;
152  }
153}