1
2
3
4
5
6
7
8
9
10
11 package org.apache.hadoop.hbase.quotas;
12
13 import java.util.HashSet;
14 import java.util.Set;
15
16 import org.apache.hadoop.hbase.classification.InterfaceAudience;
17 import org.apache.hadoop.hbase.classification.InterfaceStability;
18 import org.apache.hadoop.hbase.util.Strings;
19
20
21
22
23 @InterfaceAudience.Public
24 @InterfaceStability.Evolving
25 public class QuotaFilter {
26 private Set<QuotaType> types = new HashSet<QuotaType>();
27 private boolean hasFilters = false;
28 private String namespaceRegex;
29 private String tableRegex;
30 private String userRegex;
31
32 public QuotaFilter() {
33 }
34
35
36
37
38
39
40 public QuotaFilter setUserFilter(final String regex) {
41 this.userRegex = regex;
42 hasFilters |= !Strings.isEmpty(regex);
43 return this;
44 }
45
46
47
48
49
50
51 public QuotaFilter setTableFilter(final String regex) {
52 this.tableRegex = regex;
53 hasFilters |= !Strings.isEmpty(regex);
54 return this;
55 }
56
57
58
59
60
61
62 public QuotaFilter setNamespaceFilter(final String regex) {
63 this.namespaceRegex = regex;
64 hasFilters |= !Strings.isEmpty(regex);
65 return this;
66 }
67
68
69
70
71
72
73 public QuotaFilter addTypeFilter(final QuotaType type) {
74 this.types.add(type);
75 hasFilters |= true;
76 return this;
77 }
78
79
80 public boolean isNull() {
81 return !hasFilters;
82 }
83
84
85 public Set<QuotaType> getTypeFilters() {
86 return types;
87 }
88
89
90 public String getNamespaceFilter() {
91 return namespaceRegex;
92 }
93
94
95 public String getTableFilter() {
96 return tableRegex;
97 }
98
99
100 public String getUserFilter() {
101 return userRegex;
102 }
103 }