/*
 * Licensed to the Apache Software Foundation (ASF) under one
 *   or more contributor license agreements.  See the NOTICE file
 *   distributed with this work for additional information
 *   regarding copyright ownership.  The ASF licenses this file
 *   to you under the Apache License, Version 2.0 (the
 *   "License"); you may not use this file except in compliance
 *   with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

package org.apache.storm.kafka.monitor;

/**
 * Class representing information for querying kafka for log head offsets, consumer offsets and the difference for new kafka spout using new
 * consumer api
 */
public class NewKafkaSpoutOffsetQuery {
    private final String topics; // comma separated list of topics
    private final String consumerGroupId; // consumer group id for which the offset needs to be calculated
    private final String bootStrapBrokers; // bootstrap brokers
    private final String securityProtocol; // security protocol to connect to kafka
    private final String consumerPropertiesFileName; // properties file containing additional kafka consumer configs

    public NewKafkaSpoutOffsetQuery(String topics, String bootstrapBrokers, String consumerGroupId, String securityProtocol,
        String consumerPropertiesFileName) {
        this.topics = topics;
        this.bootStrapBrokers = bootstrapBrokers;
        this.consumerGroupId = consumerGroupId;
        this.securityProtocol = securityProtocol;
        this.consumerPropertiesFileName = consumerPropertiesFileName;
    }

    public String getTopics() {
        return topics;
    }

    public String getBootStrapBrokers() {
        return bootStrapBrokers;
    }

    public String getConsumerGroupId() {
        return this.consumerGroupId;
    }

    public String getSecurityProtocol() {
        return this.securityProtocol;
    }

    public String getConsumerPropertiesFileName() {
        return this.consumerPropertiesFileName;
    }

    @Override
    public String toString() {
        return "NewKafkaSpoutOffsetQuery{" +
               "topics='" + topics + '\'' +
               ", consumerGroupId='" + consumerGroupId + '\'' +
               ", bootStrapBrokers='" + bootStrapBrokers + '\'' +
               '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        NewKafkaSpoutOffsetQuery that = (NewKafkaSpoutOffsetQuery) o;

        if (topics != null ? !topics.equals(that.topics) : that.topics != null) return false;
        if (consumerGroupId != null ? !consumerGroupId.equals(that.consumerGroupId) : that.consumerGroupId != null) return false;
        return !(bootStrapBrokers != null ? !bootStrapBrokers.equals(that.bootStrapBrokers) : that.bootStrapBrokers != null);

    }

    @Override
    public int hashCode() {
        int result = topics != null ? topics.hashCode() : 0;
        result = 31 * result + (consumerGroupId != null ? consumerGroupId.hashCode() : 0);
        result = 31 * result + (bootStrapBrokers != null ? bootStrapBrokers.hashCode() : 0);
        return result;
    }
}

@@ -2610,32 +2610,184 @@
 rokers + '%5C'' +%0A
+               %22, securityProtocol='%22 + securityProtocol + '%5C'' +%0A               %22, consumerPropertiesFileName='%22 + consumerPropertiesFileName + '%5C'' +%0A
                '
@@ -2871,16 +2871,30 @@
 is == o)
+ %7B%0A           
  return 
@@ -2899,16 +2899,26 @@
 n true;%0A
+        %7D%0A
         
@@ -2961,16 +2961,30 @@
 Class())
+ %7B%0A           
  return 
@@ -2989,16 +2989,26 @@
 n false;
+%0A        %7D
 %0A%0A      
@@ -3143,32 +3143,46 @@
 .topics != null)
+ %7B%0A           
  return false;%0A 
@@ -3172,32 +3172,42 @@
   return false;%0A
+        %7D%0A
         if (cons
@@ -3273,16 +3273,52 @@
 GroupId)
+%0A                                   
  : that.
@@ -3341,16 +3341,30 @@
 != null)
+ %7B%0A           
  return 
@@ -3382,16 +3382,21 @@
     
-return !
+%7D%0A        if 
 (boo
@@ -3470,43 +3470,486 @@
 ers)
- : that.bootStrapBrokers != null);%0A
+%0A                                     : that.bootStrapBrokers != null) %7B%0A            return false;%0A        %7D%0A        if (securityProtocol != null ? !securityProtocol.equals(that.securityProtocol)%0A                                     : that.securityProtocol != null) %7B%0A            return false;%0A        %7D%0A        return consumerPropertiesFileName != null ? consumerPropertiesFileName%0A            .equals(that.consumerPropertiesFileName) : that.consumerPropertiesFileName == null;
 %0A   
@@ -4231,32 +4231,238 @@
 ashCode() : 0);%0A
+        result = 31 * result + (securityProtocol != null ? securityProtocol.hashCode() : 0);%0A        result = 31 * result + (consumerPropertiesFileName != null ? consumerPropertiesFileName.hashCode() : 0);%0A
         return r

Complete information in Class NewKafkaSpoutOffsetQuery