001/*
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020package org.apache.hadoop.hbase.client;
021
022import org.apache.commons.lang3.builder.EqualsBuilder;
023import org.apache.commons.lang3.builder.HashCodeBuilder;
024import org.apache.commons.lang3.builder.ToStringBuilder;
025import org.apache.yetus.audience.InterfaceAudience;
026import org.apache.yetus.audience.InterfaceStability;
027
028/**
029 * Slow/Large Log Query Filter with all filter and limit parameters
030 * Extends generic LogRequest used by Admin API getLogEntries
031 * @deprecated as of 2.4.0. Will be removed in 4.0.0.
032 */
033@InterfaceAudience.Public
034@InterfaceStability.Evolving
035@Deprecated
036public class LogQueryFilter {
037
038  private String regionName;
039  private String clientAddress;
040  private String tableName;
041  private String userName;
042  private int limit = 10;
043  private Type type = Type.SLOW_LOG;
044  private FilterByOperator filterByOperator = FilterByOperator.OR;
045
046  public enum Type {
047    SLOW_LOG,
048    LARGE_LOG
049  }
050
051  public enum FilterByOperator {
052    AND,
053    OR
054  }
055
056  public String getRegionName() {
057    return regionName;
058  }
059
060  public void setRegionName(String regionName) {
061    this.regionName = regionName;
062  }
063
064  public String getClientAddress() {
065    return clientAddress;
066  }
067
068  public void setClientAddress(String clientAddress) {
069    this.clientAddress = clientAddress;
070  }
071
072  public String getTableName() {
073    return tableName;
074  }
075
076  public void setTableName(String tableName) {
077    this.tableName = tableName;
078  }
079
080  public String getUserName() {
081    return userName;
082  }
083
084  public void setUserName(String userName) {
085    this.userName = userName;
086  }
087
088  public int getLimit() {
089    return limit;
090  }
091
092  public void setLimit(int limit) {
093    this.limit = limit;
094  }
095
096  public Type getType() {
097    return type;
098  }
099
100  public void setType(Type type) {
101    this.type = type;
102  }
103
104  public FilterByOperator getFilterByOperator() {
105    return filterByOperator;
106  }
107
108  public void setFilterByOperator(FilterByOperator filterByOperator) {
109    this.filterByOperator = filterByOperator;
110  }
111
112  @Override
113  public boolean equals(Object o) {
114    if (this == o) {
115      return true;
116    }
117
118    if (o == null || getClass() != o.getClass()) {
119      return false;
120    }
121
122    LogQueryFilter that = (LogQueryFilter) o;
123
124    return new EqualsBuilder()
125      .append(limit, that.limit)
126      .append(regionName, that.regionName)
127      .append(clientAddress, that.clientAddress)
128      .append(tableName, that.tableName)
129      .append(userName, that.userName)
130      .append(type, that.type)
131      .append(filterByOperator, that.filterByOperator)
132      .isEquals();
133  }
134
135  @Override
136  public int hashCode() {
137    return new HashCodeBuilder(17, 37)
138      .append(regionName)
139      .append(clientAddress)
140      .append(tableName)
141      .append(userName)
142      .append(limit)
143      .append(type)
144      .append(filterByOperator)
145      .toHashCode();
146  }
147
148  @Override
149  public String toString() {
150    return new ToStringBuilder(this)
151      .append("regionName", regionName)
152      .append("clientAddress", clientAddress)
153      .append("tableName", tableName)
154      .append("userName", userName)
155      .append("limit", limit)
156      .append("type", type)
157      .append("filterByOperator", filterByOperator)
158      .toString();
159  }
160
161}