You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2024/02/20 13:14:21 UTC

(pinot) branch master updated: Remove usages of lombok (#12447)

This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c395ff078 Remove usages of lombok (#12447)
8c395ff078 is described below

commit 8c395ff0788099cdb2e36b768e0694853262b942
Author: Gonzalo Ortiz Jaureguizar <go...@users.noreply.github.com>
AuthorDate: Tue Feb 20 14:14:16 2024 +0100

    Remove usages of lombok (#12447)
---
 lombok.config                                      |  21 -----
 .../org/apache/pinot/common/config/TlsConfig.java  | 101 +++++++++++++++++++--
 .../index/readers/forward/ChunkReaderContext.java  |  27 ++++--
 pinot-segment-spi/pom.xml                          |   4 -
 .../spi/index/reader/ForwardIndexReader.java       |  37 ++++++--
 pom.xml                                            |  12 ---
 6 files changed, 146 insertions(+), 56 deletions(-)

diff --git a/lombok.config b/lombok.config
deleted file mode 100644
index b6721cd223..0000000000
--- a/lombok.config
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# 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.
-#
-
-# remove prefix _ from member variables when generating getters and setters
-lombok.accessors.prefix += _
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/config/TlsConfig.java b/pinot-common/src/main/java/org/apache/pinot/common/config/TlsConfig.java
index a5353a8e0c..13c68a93e4 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/config/TlsConfig.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/config/TlsConfig.java
@@ -20,18 +20,13 @@ package org.apache.pinot.common.config;
 
 import io.netty.handler.ssl.SslProvider;
 import java.security.KeyStore;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.Setter;
+import java.util.Objects;
 import org.apache.commons.lang3.StringUtils;
 
 
 /**
  * Container object for TLS/SSL configuration of pinot clients and servers (netty, grizzly, etc.)
  */
-@Getter
-@Setter
-@EqualsAndHashCode
 public class TlsConfig {
   private boolean _clientAuthEnabled;
   private String _keyStoreType = KeyStore.getDefaultType();
@@ -59,7 +54,101 @@ public class TlsConfig {
     _sslProvider = tlsConfig._sslProvider;
   }
 
+  public boolean isClientAuthEnabled() {
+    return _clientAuthEnabled;
+  }
+
+  public void setClientAuthEnabled(boolean clientAuthEnabled) {
+    _clientAuthEnabled = clientAuthEnabled;
+  }
+
+  public String getKeyStoreType() {
+    return _keyStoreType;
+  }
+
+  public void setKeyStoreType(String keyStoreType) {
+    _keyStoreType = keyStoreType;
+  }
+
+  public String getKeyStorePath() {
+    return _keyStorePath;
+  }
+
+  public void setKeyStorePath(String keyStorePath) {
+    _keyStorePath = keyStorePath;
+  }
+
+  public String getKeyStorePassword() {
+    return _keyStorePassword;
+  }
+
+  public void setKeyStorePassword(String keyStorePassword) {
+    _keyStorePassword = keyStorePassword;
+  }
+
+  public String getTrustStoreType() {
+    return _trustStoreType;
+  }
+
+  public void setTrustStoreType(String trustStoreType) {
+    _trustStoreType = trustStoreType;
+  }
+
+  public String getTrustStorePath() {
+    return _trustStorePath;
+  }
+
+  public void setTrustStorePath(String trustStorePath) {
+    _trustStorePath = trustStorePath;
+  }
+
+  public String getTrustStorePassword() {
+    return _trustStorePassword;
+  }
+
+  public void setTrustStorePassword(String trustStorePassword) {
+    _trustStorePassword = trustStorePassword;
+  }
+
+  public String getSslProvider() {
+    return _sslProvider;
+  }
+
+  public void setSslProvider(String sslProvider) {
+    _sslProvider = sslProvider;
+  }
+
   public boolean isCustomized() {
     return StringUtils.isNoneBlank(_keyStorePath) || StringUtils.isNoneBlank(_trustStorePath);
   }
+
+  public boolean isInsecure() {
+    return _insecure;
+  }
+
+  public void setInsecure(boolean insecure) {
+    _insecure = insecure;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+    TlsConfig tlsConfig = (TlsConfig) o;
+    return _clientAuthEnabled == tlsConfig._clientAuthEnabled && _insecure == tlsConfig._insecure && Objects.equals(
+        _keyStoreType, tlsConfig._keyStoreType) && Objects.equals(_keyStorePath, tlsConfig._keyStorePath)
+        && Objects.equals(_keyStorePassword, tlsConfig._keyStorePassword) && Objects.equals(_trustStoreType,
+        tlsConfig._trustStoreType) && Objects.equals(_trustStorePath, tlsConfig._trustStorePath) && Objects.equals(
+        _trustStorePassword, tlsConfig._trustStorePassword) && Objects.equals(_sslProvider, tlsConfig._sslProvider);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(_clientAuthEnabled, _keyStoreType, _keyStorePath, _keyStorePassword, _trustStoreType,
+        _trustStorePath, _trustStorePassword, _sslProvider, _insecure);
+  }
 }
diff --git a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/forward/ChunkReaderContext.java b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/forward/ChunkReaderContext.java
index 86a3bee79c..4578b59a7b 100644
--- a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/forward/ChunkReaderContext.java
+++ b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/forward/ChunkReaderContext.java
@@ -22,8 +22,6 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
-import lombok.Getter;
-import lombok.Setter;
 import org.apache.pinot.segment.spi.index.reader.ForwardIndexReader;
 import org.apache.pinot.segment.spi.index.reader.ForwardIndexReaderContext;
 import org.apache.pinot.segment.spi.memory.CleanerUtil;
@@ -41,15 +39,10 @@ import org.apache.pinot.segment.spi.memory.CleanerUtil;
  * </ul>
  */
 public class ChunkReaderContext implements ForwardIndexReaderContext {
-  @Getter
   private final ByteBuffer _chunkBuffer;
 
-  @Getter
-  @Setter
   private int _chunkId;
 
-  @Getter
-  @Setter
   private List<ForwardIndexReader.ByteRange> _ranges;
 
   public ChunkReaderContext(int maxChunkSize) {
@@ -65,4 +58,24 @@ public class ChunkReaderContext implements ForwardIndexReaderContext {
       CleanerUtil.getCleaner().freeBuffer(_chunkBuffer);
     }
   }
+
+  public ByteBuffer getChunkBuffer() {
+    return _chunkBuffer;
+  }
+
+  public int getChunkId() {
+    return _chunkId;
+  }
+
+  public void setChunkId(int chunkId) {
+    _chunkId = chunkId;
+  }
+
+  public List<ForwardIndexReader.ByteRange> getRanges() {
+    return _ranges;
+  }
+
+  public void setRanges(List<ForwardIndexReader.ByteRange> ranges) {
+    _ranges = ranges;
+  }
 }
diff --git a/pinot-segment-spi/pom.xml b/pinot-segment-spi/pom.xml
index a43988ee4c..69d98b36d5 100644
--- a/pinot-segment-spi/pom.xml
+++ b/pinot-segment-spi/pom.xml
@@ -69,10 +69,6 @@
       <groupId>org.apache.calcite</groupId>
       <artifactId>calcite-core</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.projectlombok</groupId>
-      <artifactId>lombok</artifactId>
-    </dependency>
 
     <!-- test -->
     <dependency>
diff --git a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/reader/ForwardIndexReader.java b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/reader/ForwardIndexReader.java
index e067376472..c1b8cdeaff 100644
--- a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/reader/ForwardIndexReader.java
+++ b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/reader/ForwardIndexReader.java
@@ -20,10 +20,8 @@ package org.apache.pinot.segment.spi.index.reader;
 
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Objects;
 import javax.annotation.Nullable;
-import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
 import org.apache.pinot.segment.spi.compression.ChunkCompressionType;
 import org.apache.pinot.segment.spi.compression.DictIdCompressionType;
 import org.apache.pinot.segment.spi.index.IndexReader;
@@ -990,13 +988,40 @@ public interface ForwardIndexReader<T extends ForwardIndexReaderContext> extends
   /**
    * This class represents the buffer byte ranges accessed while reading a given docId.
    */
-  @AllArgsConstructor
-  @EqualsAndHashCode
-  @Getter
   class ByteRange {
     private final long _offset;
     private final int _sizeInBytes;
 
+    public ByteRange(long offset, int sizeInBytes) {
+      _offset = offset;
+      _sizeInBytes = sizeInBytes;
+    }
+
+    public long getOffset() {
+      return _offset;
+    }
+
+    public int getSizeInBytes() {
+      return _sizeInBytes;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) {
+        return true;
+      }
+      if (o == null || getClass() != o.getClass()) {
+        return false;
+      }
+      ByteRange byteRange = (ByteRange) o;
+      return _offset == byteRange._offset && _sizeInBytes == byteRange._sizeInBytes;
+    }
+
+    @Override
+    public int hashCode() {
+      return Objects.hash(_offset, _sizeInBytes);
+    }
+
     @Override
     public String toString() {
       return "Range{" + "_offset=" + _offset + ", _size=" + _sizeInBytes + '}';
diff --git a/pom.xml b/pom.xml
index 2187403939..871212822b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1313,18 +1313,6 @@
         <artifactId>test-clock</artifactId>
         <version>1.0.4</version>
         <scope>test</scope>
-        <exclusions>
-          <exclusion>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-          </exclusion>
-        </exclusions>
-      </dependency>
-      <dependency>
-        <!-- starting from 1.18.30, JDK21 is supported -->
-        <groupId>org.projectlombok</groupId>
-        <artifactId>lombok</artifactId>
-        <version>1.18.30</version>
       </dependency>
 
       <dependency>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org