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 Point In Time Restore request 025 */ 026@InterfaceAudience.Private 027public final class PointInTimeRestoreRequest { 028 029 private final String backupRootDir; 030 private final String restoreRootDir; 031 private final boolean check; 032 private final TableName[] fromTables; 033 private final TableName[] toTables; 034 private final boolean overwrite; 035 private final long toDateTime; 036 private final boolean isKeepOriginalSplits; 037 038 private PointInTimeRestoreRequest(Builder builder) { 039 this.backupRootDir = builder.backupRootDir; 040 this.restoreRootDir = builder.restoreRootDir; 041 this.check = builder.check; 042 this.fromTables = builder.fromTables; 043 this.toTables = builder.toTables; 044 this.overwrite = builder.overwrite; 045 this.toDateTime = builder.toDateTime; 046 this.isKeepOriginalSplits = builder.isKeepOriginalSplits; 047 } 048 049 public String getBackupRootDir() { 050 return backupRootDir; 051 } 052 053 public String getRestoreRootDir() { 054 return restoreRootDir; 055 } 056 057 public boolean isCheck() { 058 return check; 059 } 060 061 public TableName[] getFromTables() { 062 return fromTables; 063 } 064 065 public TableName[] getToTables() { 066 return toTables; 067 } 068 069 public boolean isOverwrite() { 070 return overwrite; 071 } 072 073 public long getToDateTime() { 074 return toDateTime; 075 } 076 077 public boolean isKeepOriginalSplits() { 078 return isKeepOriginalSplits; 079 } 080 081 public static class Builder { 082 private String backupRootDir; 083 private String restoreRootDir; 084 private boolean check = false; 085 private TableName[] fromTables; 086 private TableName[] toTables; 087 private boolean overwrite = false; 088 private long toDateTime; 089 private boolean isKeepOriginalSplits; 090 091 public Builder withBackupRootDir(String backupRootDir) { 092 this.backupRootDir = backupRootDir; 093 return this; 094 } 095 096 public Builder withRestoreRootDir(String restoreRootDir) { 097 this.restoreRootDir = restoreRootDir; 098 return this; 099 } 100 101 public Builder withCheck(boolean check) { 102 this.check = check; 103 return this; 104 } 105 106 public Builder withFromTables(TableName[] fromTables) { 107 this.fromTables = fromTables; 108 return this; 109 } 110 111 public Builder withToTables(TableName[] toTables) { 112 this.toTables = toTables; 113 return this; 114 } 115 116 public Builder withOverwrite(boolean overwrite) { 117 this.overwrite = overwrite; 118 return this; 119 } 120 121 public Builder withToDateTime(long dateTime) { 122 this.toDateTime = dateTime; 123 return this; 124 } 125 126 public Builder withKeepOriginalSplits(boolean isKeepOriginalSplits) { 127 this.isKeepOriginalSplits = isKeepOriginalSplits; 128 return this; 129 } 130 131 public PointInTimeRestoreRequest build() { 132 return new PointInTimeRestoreRequest(this); 133 } 134 } 135}