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 */
018package org.apache.hadoop.hbase.backup;
019
020import java.util.List;
021import org.apache.hadoop.hbase.TableName;
022import org.apache.yetus.audience.InterfaceAudience;
023
024/**
025 * POJO class for backup request
026 */
027@InterfaceAudience.Private
028public final class BackupRequest {
029
030  public static class Builder {
031
032    BackupRequest request;
033
034    public Builder() {
035      request = new BackupRequest();
036    }
037
038    public Builder withBackupType(BackupType type) {
039      request.setBackupType(type);
040      return this;
041    }
042
043    public Builder withTableList(List<TableName> tables) {
044      request.setTableList(tables);
045      return this;
046    }
047
048    public Builder withTargetRootDir(String backupDir) {
049      request.setTargetRootDir(backupDir);
050      return this;
051    }
052
053    public Builder withBackupSetName(String setName) {
054      request.setBackupSetName(setName);
055      return this;
056    }
057
058    public Builder withTotalTasks(int numTasks) {
059      request.setTotalTasks(numTasks);
060      return this;
061    }
062
063    public Builder withBandwidthPerTasks(int bandwidth) {
064      request.setBandwidth(bandwidth);
065      return this;
066    }
067
068    public Builder withYarnPoolName(String name) {
069      request.setYarnPoolName(name);
070      return this;
071    }
072
073    public BackupRequest build() {
074      return request;
075    }
076
077  }
078
079  private BackupType type;
080  private List<TableName> tableList;
081  private String targetRootDir;
082  private int totalTasks = -1;
083  private long bandwidth = -1L;
084  private String backupSetName;
085  private String yarnPoolName;
086
087  private BackupRequest() {
088  }
089
090  private BackupRequest setBackupType(BackupType type) {
091    this.type = type;
092    return this;
093  }
094
095  public BackupType getBackupType() {
096    return this.type;
097  }
098
099  private BackupRequest setTableList(List<TableName> tableList) {
100    this.tableList = tableList;
101    return this;
102  }
103
104  public List<TableName> getTableList() {
105    return this.tableList;
106  }
107
108  private BackupRequest setTargetRootDir(String targetRootDir) {
109    this.targetRootDir = targetRootDir;
110    return this;
111  }
112
113  public String getTargetRootDir() {
114    return this.targetRootDir;
115  }
116
117  private BackupRequest setTotalTasks(int totalTasks) {
118    this.totalTasks = totalTasks;
119    return this;
120  }
121
122  public int getTotalTasks() {
123    return this.totalTasks;
124  }
125
126  private BackupRequest setBandwidth(long bandwidth) {
127    this.bandwidth = bandwidth;
128    return this;
129  }
130
131  public long getBandwidth() {
132    return this.bandwidth;
133  }
134
135  public String getBackupSetName() {
136    return backupSetName;
137  }
138
139  private BackupRequest setBackupSetName(String backupSetName) {
140    this.backupSetName = backupSetName;
141    return this;
142  }
143
144  public String getYarnPoolName() {
145    return yarnPoolName;
146  }
147
148  public void setYarnPoolName(String yarnPoolName) {
149    this.yarnPoolName = yarnPoolName;
150  }
151}