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 org.apache.hadoop.hbase.TableName;
021import org.apache.yetus.audience.InterfaceAudience;
022
023/**
024 * POJO class for restore request
025 */
026@InterfaceAudience.Private
027public final class RestoreRequest {
028  public static class Builder {
029    RestoreRequest request;
030
031    public Builder() {
032      request = new RestoreRequest();
033    }
034
035    public Builder withBackupRootDir(String backupRootDir) {
036      request.setBackupRootDir(backupRootDir);
037      return this;
038    }
039
040    public Builder withRestoreRootDir(String restoreRootDir) {
041      request.setRestoreRootDir(restoreRootDir);
042      return this;
043    }
044
045    public Builder withBackupId(String backupId) {
046      request.setBackupId(backupId);
047      return this;
048    }
049
050    public Builder withCheck(boolean check) {
051      request.setCheck(check);
052      return this;
053    }
054
055    public Builder withFromTables(TableName[] fromTables) {
056      request.setFromTables(fromTables);
057      return this;
058    }
059
060    public Builder withToTables(TableName[] toTables) {
061      request.setToTables(toTables);
062      return this;
063    }
064
065    public Builder withOvewrite(boolean overwrite) {
066      request.setOverwrite(overwrite);
067      return this;
068    }
069
070    public Builder withKeepOriginalSplits(boolean keepOriginalSplits) {
071      request.setKeepOriginalSplits(keepOriginalSplits);
072      return this;
073    }
074
075    public RestoreRequest build() {
076      return request;
077    }
078  }
079
080  private String backupRootDir;
081  private String restoreRootDir;
082  private String backupId;
083  private boolean check = false;
084  private TableName[] fromTables;
085  private TableName[] toTables;
086  private boolean overwrite = false;
087
088  private boolean keepOriginalSplits = false;
089
090  private RestoreRequest() {
091  }
092
093  public String getBackupRootDir() {
094    return backupRootDir;
095  }
096
097  private RestoreRequest setBackupRootDir(String backupRootDir) {
098    this.backupRootDir = backupRootDir;
099    return this;
100  }
101
102  public String getRestoreRootDir() {
103    return restoreRootDir;
104  }
105
106  private RestoreRequest setRestoreRootDir(String restoreRootDir) {
107    this.restoreRootDir = restoreRootDir;
108    return this;
109  }
110
111  public String getBackupId() {
112    return backupId;
113  }
114
115  private RestoreRequest setBackupId(String backupId) {
116    this.backupId = backupId;
117    return this;
118  }
119
120  public boolean isCheck() {
121    return check;
122  }
123
124  private RestoreRequest setCheck(boolean check) {
125    this.check = check;
126    return this;
127  }
128
129  public TableName[] getFromTables() {
130    return fromTables;
131  }
132
133  private RestoreRequest setFromTables(TableName[] fromTables) {
134    this.fromTables = fromTables;
135    return this;
136  }
137
138  public TableName[] getToTables() {
139    return toTables;
140  }
141
142  private RestoreRequest setToTables(TableName[] toTables) {
143    this.toTables = toTables;
144    return this;
145  }
146
147  public boolean isOverwrite() {
148    return overwrite;
149  }
150
151  private RestoreRequest setOverwrite(boolean overwrite) {
152    this.overwrite = overwrite;
153    return this;
154  }
155
156  public boolean isKeepOriginalSplits() {
157    return keepOriginalSplits;
158  }
159
160  private RestoreRequest setKeepOriginalSplits(boolean keepOriginalSplits) {
161    this.keepOriginalSplits = keepOriginalSplits;
162    return this;
163  }
164}