ege-st commented on code in PR #14197:
URL: https://github.com/apache/pinot/pull/14197#discussion_r1794403726


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/function/GroovySecurityConfigManager.java:
##########
@@ -0,0 +1,76 @@
+/**
+ * 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.pinot.segment.local.function;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Nonnull;
+import org.apache.helix.AccessOption;
+import org.apache.helix.HelixManager;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+import org.apache.zookeeper.data.Stat;
+
+
+public class GroovySecurityConfigManager {
+  public static final String PROPERTYSTORE_PATH = 
"/CONFIGS/GROOVY_EXECUTION/StaticAnalyzer";
+  private static LoadingCache<Integer, GroovyStaticAnalyzerConfig> 
_configCache;
+  private static HelixManager _helixManager;
+
+  public GroovySecurityConfigManager(HelixManager helixManager) {
+    _helixManager = helixManager;
+    _configCache = CacheBuilder.newBuilder()
+        .maximumSize(1)
+        .expireAfterWrite(5, TimeUnit.MINUTES)
+        .build(new CacheLoader<>() {
+          @Override
+          @Nonnull

Review Comment:
   This was added to match the CacheLoader interface, but will remove.



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/function/GroovyStaticAnalyzerConfig.java:
##########
@@ -0,0 +1,138 @@
+/**
+ * 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.pinot.segment.local.function;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.google.common.base.Preconditions;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.List;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+import org.apache.pinot.spi.utils.JsonUtils;
+
+
+public class GroovyStaticAnalyzerConfig {
+  final boolean _enabled;
+  final private List<String> _allowedReceivers;
+  final private List<String> _allowedImports;
+  final private List<String> _allowedStaticImports;
+  final private List<String> _disallowedMethodNames;
+
+  public GroovyStaticAnalyzerConfig(
+      @JsonProperty("enabled")
+      boolean enabled,
+      @JsonProperty("allowedReceivers")
+      List<String> allowedReceivers,
+      @JsonProperty("allowedImports")
+      List<String> allowedImports,
+      @JsonProperty("allowedStaticImports")
+      List<String> allowedStaticImports,
+      @JsonProperty("disallowedMethodNames")
+      List<String> disallowedMethodNames) {
+    _enabled = enabled;
+    _allowedImports = allowedImports;
+    _allowedReceivers = allowedReceivers;
+    _allowedStaticImports = allowedStaticImports;
+    _disallowedMethodNames = disallowedMethodNames;
+  }
+
+  @JsonProperty("enabled")
+  public boolean isEnabled() {
+    return _enabled;
+  }
+
+  @JsonProperty("allowedReceivers")
+  public List<String> getAllowedReceivers() {
+    return _allowedReceivers;
+  }
+
+  @JsonProperty("allowedImports")
+  public List<String> getAllowedImports() {
+    return _allowedImports;
+  }
+
+  @JsonProperty("allowedStaticImports")
+  public List<String> getAllowedStaticImports() {
+    return _allowedStaticImports;
+  }
+
+  @JsonProperty("disallowedMethodNames")
+  public List<String> getDisallowedMethodNames() {
+    return _disallowedMethodNames;
+  }
+
+  public ZNRecord toZNRecord() throws JsonProcessingException {
+    ZNRecord record = new ZNRecord("groovySecurityConfiguration");

Review Comment:
   Sure thing



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to