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 withBackupId(String backupId) {
041      request.setBackupId(backupId);
042      return this;
043    }
044
045    public Builder withCheck(boolean check) {
046      request.setCheck(check);
047      return this;
048    }
049
050    public Builder withFromTables(TableName[] fromTables) {
051      request.setFromTables(fromTables);
052      return this;
053    }
054
055    public Builder withToTables(TableName[] toTables) {
056      request.setToTables(toTables);
057      return this;
058    }
059
060    public Builder withOvewrite(boolean overwrite) {
061      request.setOverwrite(overwrite);
062      return this;
063    }
064
065    public RestoreRequest build() {
066      return request;
067    }
068  }
069
070  private String backupRootDir;
071  private String backupId;
072  private boolean check = false;
073  private TableName[] fromTables;
074  private TableName[] toTables;
075  private boolean overwrite = false;
076
077  private RestoreRequest() {
078  }
079
080  public String getBackupRootDir() {
081    return backupRootDir;
082  }
083
084  private RestoreRequest setBackupRootDir(String backupRootDir) {
085    this.backupRootDir = backupRootDir;
086    return this;
087  }
088
089  public String getBackupId() {
090    return backupId;
091  }
092
093  private RestoreRequest setBackupId(String backupId) {
094    this.backupId = backupId;
095    return this;
096  }
097
098  public boolean isCheck() {
099    return check;
100  }
101
102  private RestoreRequest setCheck(boolean check) {
103    this.check = check;
104    return this;
105  }
106
107  public TableName[] getFromTables() {
108    return fromTables;
109  }
110
111  private RestoreRequest setFromTables(TableName[] fromTables) {
112    this.fromTables = fromTables;
113    return this;
114  }
115
116  public TableName[] getToTables() {
117    return toTables;
118  }
119
120  private RestoreRequest setToTables(TableName[] toTables) {
121    this.toTables = toTables;
122    return this;
123  }
124
125  public boolean isOverwrite() {
126    return overwrite;
127  }
128
129  private RestoreRequest setOverwrite(boolean overwrite) {
130    this.overwrite = overwrite;
131    return this;
132  }
133}