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 RestoreRequest build() {
071      return request;
072    }
073  }
074
075  private String backupRootDir;
076  private String restoreRootDir;
077  private String backupId;
078  private boolean check = false;
079  private TableName[] fromTables;
080  private TableName[] toTables;
081  private boolean overwrite = false;
082
083  private RestoreRequest() {
084  }
085
086  public String getBackupRootDir() {
087    return backupRootDir;
088  }
089
090  private RestoreRequest setBackupRootDir(String backupRootDir) {
091    this.backupRootDir = backupRootDir;
092    return this;
093  }
094
095  public String getRestoreRootDir() {
096    return restoreRootDir;
097  }
098
099  private RestoreRequest setRestoreRootDir(String restoreRootDir) {
100    this.restoreRootDir = restoreRootDir;
101    return this;
102  }
103
104  public String getBackupId() {
105    return backupId;
106  }
107
108  private RestoreRequest setBackupId(String backupId) {
109    this.backupId = backupId;
110    return this;
111  }
112
113  public boolean isCheck() {
114    return check;
115  }
116
117  private RestoreRequest setCheck(boolean check) {
118    this.check = check;
119    return this;
120  }
121
122  public TableName[] getFromTables() {
123    return fromTables;
124  }
125
126  private RestoreRequest setFromTables(TableName[] fromTables) {
127    this.fromTables = fromTables;
128    return this;
129  }
130
131  public TableName[] getToTables() {
132    return toTables;
133  }
134
135  private RestoreRequest setToTables(TableName[] toTables) {
136    this.toTables = toTables;
137    return this;
138  }
139
140  public boolean isOverwrite() {
141    return overwrite;
142  }
143
144  private RestoreRequest setOverwrite(boolean overwrite) {
145    this.overwrite = overwrite;
146    return this;
147  }
148}