1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.backup;
19
20 import org.apache.hadoop.conf.Configuration;
21 import org.apache.hadoop.hbase.backup.mapreduce.MapReduceBackupCopyService;
22 import org.apache.hadoop.hbase.backup.mapreduce.MapReduceRestoreService;
23 import org.apache.hadoop.hbase.classification.InterfaceAudience;
24 import org.apache.hadoop.hbase.classification.InterfaceStability;
25 import org.apache.hadoop.util.ReflectionUtils;
26
27 @InterfaceAudience.Private
28 @InterfaceStability.Evolving
29 public final class BackupRestoreServerFactory {
30
31 public final static String HBASE_INCR_RESTORE_IMPL_CLASS = "hbase.incremental.restore.class";
32 public final static String HBASE_BACKUP_COPY_IMPL_CLASS = "hbase.backup.copy.class";
33
34 private BackupRestoreServerFactory(){
35 throw new AssertionError("Instantiating utility class...");
36 }
37
38
39
40
41
42
43 public static IncrementalRestoreService getIncrementalRestoreService(Configuration conf) {
44 Class<? extends IncrementalRestoreService> cls =
45 conf.getClass(HBASE_INCR_RESTORE_IMPL_CLASS, MapReduceRestoreService.class,
46 IncrementalRestoreService.class);
47 IncrementalRestoreService service = ReflectionUtils.newInstance(cls, conf);
48 service.setConf(conf);
49 return service;
50 }
51
52
53
54
55
56
57 public static BackupCopyService getBackupCopyService(Configuration conf) {
58 Class<? extends BackupCopyService> cls =
59 conf.getClass(HBASE_BACKUP_COPY_IMPL_CLASS, MapReduceBackupCopyService.class,
60 BackupCopyService.class);
61 BackupCopyService service = ReflectionUtils.newInstance(cls, conf);;
62 service.setConf(conf);
63 return service;
64 }
65 }