View Javadoc

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.hadoop.hbase.namequeues.request;
21  
22  import org.apache.commons.lang.builder.ToStringBuilder;
23  import org.apache.hadoop.hbase.classification.InterfaceAudience;
24  import org.apache.hadoop.hbase.namequeues.NamedQueuePayload;
25  import org.apache.hadoop.hbase.protobuf.generated.AdminProtos;
26  import org.apache.hadoop.hbase.protobuf.generated.MasterProtos;
27  
28  /**
29   * Request object to be used by ring buffer use-cases. Clients get records by sending
30   * this request object.
31   * For each ring buffer use-case, add request payload to this class, client should set
32   * namedQueueEvent based on use-case.
33   * Protobuf does not support inheritance, hence we need to work with
34   */
35  @InterfaceAudience.Private
36  public class NamedQueueGetRequest {
37  
38    private AdminProtos.SlowLogResponseRequest slowLogResponseRequest;
39    private NamedQueuePayload.NamedQueueEvent namedQueueEvent;
40    private MasterProtos.BalancerDecisionsRequest balancerDecisionsRequest;
41  
42    public AdminProtos.SlowLogResponseRequest getSlowLogResponseRequest() {
43      return slowLogResponseRequest;
44    }
45  
46    public void setSlowLogResponseRequest(
47        AdminProtos.SlowLogResponseRequest slowLogResponseRequest) {
48      this.slowLogResponseRequest = slowLogResponseRequest;
49    }
50  
51    public MasterProtos.BalancerDecisionsRequest getBalancerDecisionsRequest() {
52      return balancerDecisionsRequest;
53    }
54  
55    public void setBalancerDecisionsRequest(
56      MasterProtos.BalancerDecisionsRequest balancerDecisionsRequest) {
57      this.balancerDecisionsRequest = balancerDecisionsRequest;
58    }
59  
60    public NamedQueuePayload.NamedQueueEvent getNamedQueueEvent() {
61      return namedQueueEvent;
62    }
63  
64    public void setNamedQueueEvent(int eventOrdinal) {
65      this.namedQueueEvent = NamedQueuePayload.NamedQueueEvent.getEventByOrdinal(eventOrdinal);
66    }
67  
68    @Override
69    public String toString() {
70      return new ToStringBuilder(this)
71        .append("slowLogResponseRequest", slowLogResponseRequest)
72        .append("namedQueueEvent", namedQueueEvent)
73        .append("balancerDecisionsRequest", balancerDecisionsRequest)
74        .toString();
75    }
76  
77  }