This is an automated email from the ASF dual-hosted git repository.
shanthoosh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/samza.git
The following commit(s) were added to refs/heads/master by this push:
new 2659bc0 SAMZA-2428: Clean up unused
org.apache.samza.sql.util.ConfigUtil (#1245)
2659bc0 is described below
commit 2659bc019a2c1989c48d81798a84af1eee4dce05
Author: Ke Wu <[email protected]>
AuthorDate: Mon Jan 13 19:40:06 2020 -0800
SAMZA-2428: Clean up unused org.apache.samza.sql.util.ConfigUtil (#1245)
Issues:
1. org.apache.samza.sql.util.ConfigUtil is not used
2. it is the same name as org.apache.samza.util.ConfigUtil
3. its usage should be deprecated in favor of Config#subset(String prefix,
boolean stripPrefix)
Changes: delete org.apache.samza.sql.util.ConfigUtil
Tests: build
---
.../java/org/apache/samza/sql/util/ConfigUtil.java | 62 ----------------------
1 file changed, 62 deletions(-)
diff --git a/samza-sql/src/main/java/org/apache/samza/sql/util/ConfigUtil.java
b/samza-sql/src/main/java/org/apache/samza/sql/util/ConfigUtil.java
deleted file mode 100644
index e87ea2f..0000000
--- a/samza-sql/src/main/java/org/apache/samza/sql/util/ConfigUtil.java
+++ /dev/null
@@ -1,62 +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.
-*/
-
-package org.apache.samza.sql.util;
-
-import java.util.Properties;
-
-import org.apache.commons.lang.StringUtils;
-
-
-/**
- * Utility methods to aid with config management.
- */
-public class ConfigUtil {
-
- private ConfigUtil() {
- }
-
- /**
- * Method is used to filter just the properties with the prefix.
- * @param props Full set of properties
- * @param prefix Prefix of the keys that in the config that needs to be
filtered out.
- * @param preserveFullKey If set to true, after filtering, preserves the
full key including the prefix.
- * If set to false, Strips out the prefix from the
key before returning.
- * @return Returns the filtered set of properties matching the prefix from
the input property bag.
- */
- public static Properties getDomainProperties(Properties props, String
prefix, boolean preserveFullKey) {
- String fullPrefix;
- if (StringUtils.isBlank(prefix)) {
- fullPrefix = ""; // this will effectively retrieve all properties
- } else {
- fullPrefix = prefix.endsWith(".") ? prefix : prefix + ".";
- }
- Properties ret = new Properties();
- props.keySet().stream().map(String.class::cast).forEach(keyStr -> {
- if (keyStr.startsWith(fullPrefix) && !keyStr.equals(fullPrefix)) {
- if (preserveFullKey) {
- ret.put(keyStr, props.get(keyStr));
- } else {
- ret.put(keyStr.substring(fullPrefix.length()), props.get(keyStr));
- }
- }
- });
- return ret;
- }
-}