From 0edb7bc7e8bf46476e7b38caa3530d5cb214f378 Mon Sep 17 00:00:00 2001 From: dseurotech Date: Fri, 12 Apr 2024 10:34:43 +0200 Subject: [PATCH] :heavy_minus_sign: removing unused guava dependency Signed-off-by: dseurotech --- assembly/api/pom.xml | 4 -- assembly/console/pom.xml | 4 -- commons/pom.xml | 4 -- consumer/lifecycle-app/pom.xml | 12 ---- consumer/lifecycle/pom.xml | 4 -- consumer/telemetry-app/pom.xml | 12 ---- consumer/telemetry/pom.xml | 4 -- locator/guice/pom.xml | 4 -- pom.xml | 12 ---- service/account/api/pom.xml | 4 -- .../xml/AccountParentPathXmlAdapter.java | 59 ++++++++++--------- service/authentication-app/pom.xml | 12 ---- service/authentication/pom.xml | 4 -- service/client/pom.xml | 4 -- simulator-kura/pom.xml | 8 +-- .../kapua/kura/simulator/topic/Topic.java | 25 ++++---- 16 files changed, 45 insertions(+), 131 deletions(-) diff --git a/assembly/api/pom.xml b/assembly/api/pom.xml index 9456d579902..494366fb3be 100644 --- a/assembly/api/pom.xml +++ b/assembly/api/pom.xml @@ -148,10 +148,6 @@ org.eclipse.persistence javax.persistence - - com.google.guava - guava - commons-configuration commons-configuration diff --git a/assembly/console/pom.xml b/assembly/console/pom.xml index dc884af515d..3bad0261f11 100644 --- a/assembly/console/pom.xml +++ b/assembly/console/pom.xml @@ -146,10 +146,6 @@ org.eclipse.persistence javax.persistence - - com.google.guava - guava - commons-configuration commons-configuration diff --git a/commons/pom.xml b/commons/pom.xml index a4fbe973a8e..7befc3247bc 100644 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -87,10 +87,6 @@ com.google.zxing javase - - com.google.guava - guava - com.google.inject guice diff --git a/consumer/lifecycle-app/pom.xml b/consumer/lifecycle-app/pom.xml index ba38c7ca1cc..e003fc1402f 100644 --- a/consumer/lifecycle-app/pom.xml +++ b/consumer/lifecycle-app/pom.xml @@ -178,18 +178,6 @@ org.eclipse.persistence org.eclipse.persistence.moxy - - com.google.guava - guava - - - com.google.guava - failureaccess - - - com.google.guava - listenablefuture - commons-configuration commons-configuration diff --git a/consumer/lifecycle/pom.xml b/consumer/lifecycle/pom.xml index 987c14b2018..d64672323d9 100644 --- a/consumer/lifecycle/pom.xml +++ b/consumer/lifecycle/pom.xml @@ -130,10 +130,6 @@ org.slf4j slf4j-api - - com.google.guava - guava - org.apache.commons commons-pool2 diff --git a/consumer/telemetry-app/pom.xml b/consumer/telemetry-app/pom.xml index f39f80ee779..13b43d5337a 100644 --- a/consumer/telemetry-app/pom.xml +++ b/consumer/telemetry-app/pom.xml @@ -198,18 +198,6 @@ - - com.google.guava - guava - - - com.google.guava - failureaccess - - - com.google.guava - listenablefuture - commons-configuration commons-configuration diff --git a/consumer/telemetry/pom.xml b/consumer/telemetry/pom.xml index 309f4d99974..48ff373f8b0 100644 --- a/consumer/telemetry/pom.xml +++ b/consumer/telemetry/pom.xml @@ -134,10 +134,6 @@ org.slf4j slf4j-api - - com.google.guava - guava - org.apache.commons commons-pool2 diff --git a/locator/guice/pom.xml b/locator/guice/pom.xml index a390a25007d..11339f9e8ce 100644 --- a/locator/guice/pom.xml +++ b/locator/guice/pom.xml @@ -40,10 +40,6 @@ com.google.inject.extensions guice-multibindings - - com.google.guava - guava - commons-configuration commons-configuration diff --git a/pom.xml b/pom.xml index 05ecc679e81..200fa39c624 100644 --- a/pom.xml +++ b/pom.xml @@ -76,8 +76,6 @@ 1.5.0 2.10 32.1.2-jre - 1.0.1 - 9999.0-empty-to-avoid-conflict-with-guava 5.1.0 4.2.3 2.2 @@ -1501,16 +1499,6 @@ - - com.google.guava - failureaccess - ${guava-failureaccess.version} - - - com.google.guava - listenablefuture - ${guava-listenablefuture.version} - com.google.inject guice diff --git a/service/account/api/pom.xml b/service/account/api/pom.xml index 3874824bb9c..adf82f4a9a4 100644 --- a/service/account/api/pom.xml +++ b/service/account/api/pom.xml @@ -29,10 +29,6 @@ org.eclipse.kapua kapua-service-api - - com.google.guava - guava - diff --git a/service/account/api/src/main/java/org/eclipse/kapua/service/account/xml/AccountParentPathXmlAdapter.java b/service/account/api/src/main/java/org/eclipse/kapua/service/account/xml/AccountParentPathXmlAdapter.java index 320c2950bc1..6eaa81cea6d 100644 --- a/service/account/api/src/main/java/org/eclipse/kapua/service/account/xml/AccountParentPathXmlAdapter.java +++ b/service/account/api/src/main/java/org/eclipse/kapua/service/account/xml/AccountParentPathXmlAdapter.java @@ -12,18 +12,19 @@ *******************************************************************************/ package org.eclipse.kapua.service.account.xml; -import com.google.common.base.Strings; -import org.eclipse.kapua.KapuaIllegalArgumentException; -import org.eclipse.kapua.locator.KapuaLocator; -import org.eclipse.kapua.model.id.KapuaIdFactory; -import org.eclipse.kapua.service.account.Account; - -import javax.xml.bind.annotation.adapters.XmlAdapter; import java.math.BigInteger; import java.util.Arrays; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; +import javax.xml.bind.annotation.adapters.XmlAdapter; + +import org.eclipse.kapua.KapuaIllegalArgumentException; +import org.eclipse.kapua.locator.KapuaLocator; +import org.eclipse.kapua.model.id.KapuaIdFactory; +import org.eclipse.kapua.service.account.Account; + /** * {@link Account#getParentAccountPath()} {@link XmlAdapter}. * @@ -35,37 +36,37 @@ public class AccountParentPathXmlAdapter extends XmlAdapter { @Override public String marshal(String parentAccountPathLong) { - if (Strings.isNullOrEmpty(parentAccountPathLong)) { - return null; - } else { - String[] parentAccountPathLongTokens = parentAccountPathLong.substring(1).split("/"); + return Optional.ofNullable(parentAccountPathLong) + .filter(s -> s.length() > 0) + .map(s -> { + String[] parentAccountPathLongTokens = s.substring(1).split("/"); - List parentAccountPathBase64List = - Arrays.stream(parentAccountPathLongTokens) - .map(p -> kapuaIdFactory.newKapuaId(new BigInteger(p)).toCompactId()) - .collect(Collectors.toList()); + List parentAccountPathBase64List = + Arrays.stream(parentAccountPathLongTokens) + .map(p -> kapuaIdFactory.newKapuaId(new BigInteger(p)).toCompactId()) + .collect(Collectors.toList()); - return "/" + String.join("/", parentAccountPathBase64List); - } + return "/" + String.join("/", parentAccountPathBase64List); + }) + .orElse(null); } @Override public String unmarshal(String parentAccountPathBase64) throws KapuaIllegalArgumentException { - if (Strings.isNullOrEmpty(parentAccountPathBase64)) { + if (parentAccountPathBase64 == null || parentAccountPathBase64.length() == 0) { return null; - } else { - String[] parentAccountPathBase64Tokens = parentAccountPathBase64.substring(1).split("/"); + } + String[] parentAccountPathBase64Tokens = parentAccountPathBase64.substring(1).split("/"); - try { - List parentAccountPathLongList = - Arrays.stream(parentAccountPathBase64Tokens) - .map(p -> kapuaIdFactory.newKapuaId(p).toStringId()) - .collect(Collectors.toList()); + try { + List parentAccountPathLongList = + Arrays.stream(parentAccountPathBase64Tokens) + .map(p -> kapuaIdFactory.newKapuaId(p).toStringId()) + .collect(Collectors.toList()); - return "/" + String.join("/", parentAccountPathLongList); - } catch (IllegalArgumentException e) { - throw new KapuaIllegalArgumentException("account.parentAccountPath", parentAccountPathBase64); - } + return "/" + String.join("/", parentAccountPathLongList); + } catch (IllegalArgumentException e) { + throw new KapuaIllegalArgumentException("account.parentAccountPath", parentAccountPathBase64); } } } diff --git a/service/authentication-app/pom.xml b/service/authentication-app/pom.xml index 04ede7e862d..369dc063770 100644 --- a/service/authentication-app/pom.xml +++ b/service/authentication-app/pom.xml @@ -93,18 +93,6 @@ org.eclipse.persistence org.eclipse.persistence.moxy - - com.google.guava - guava - - - com.google.guava - failureaccess - - - com.google.guava - listenablefuture - commons-configuration commons-configuration diff --git a/service/authentication/pom.xml b/service/authentication/pom.xml index 76e7868a0a5..6c9d62e08fd 100644 --- a/service/authentication/pom.xml +++ b/service/authentication/pom.xml @@ -103,10 +103,6 @@ org.slf4j slf4j-api - - com.google.guava - guava - org.apache.commons commons-pool2 diff --git a/service/client/pom.xml b/service/client/pom.xml index cc3b5e5ec36..c210daba023 100644 --- a/service/client/pom.xml +++ b/service/client/pom.xml @@ -28,10 +28,6 @@ slf4j-api provided - - com.google.guava - guava - org.apache.commons commons-pool2 diff --git a/simulator-kura/pom.xml b/simulator-kura/pom.xml index f22f8bc56ad..4d1995d916d 100644 --- a/simulator-kura/pom.xml +++ b/simulator-kura/pom.xml @@ -43,14 +43,14 @@ commons-cli - - com.google.protobuf - protobuf-java - com.google.guava guava + + com.google.protobuf + protobuf-java + com.google.code.gson gson diff --git a/simulator-kura/src/main/java/org/eclipse/kapua/kura/simulator/topic/Topic.java b/simulator-kura/src/main/java/org/eclipse/kapua/kura/simulator/topic/Topic.java index 6cac0197c3e..9e58152ab94 100644 --- a/simulator-kura/src/main/java/org/eclipse/kapua/kura/simulator/topic/Topic.java +++ b/simulator-kura/src/main/java/org/eclipse/kapua/kura/simulator/topic/Topic.java @@ -20,10 +20,9 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.function.Function; import java.util.stream.Collectors; -import com.google.common.base.Function; - public final class Topic { private static final String APPLICATION_ID = "application-id"; @@ -172,15 +171,14 @@ public String render(final Map context) { } /** - * Renders all tokens from {@code fromIndex} (inclusive) to {@code toIndex} - * (exclusive) + * Renders all tokens from {@code fromIndex} (inclusive) to {@code toIndex} (exclusive) * * @param fromIndex - * first item to render + * first item to render * @param toIndex - * first item not to render + * first item not to render * @param context - * the additional context to use + * the additional context to use * @return the rendered string */ public String render(final int fromIndex, final int toIndex, final Map context) { @@ -192,13 +190,12 @@ public String render() { } /** - * Renders all tokens from {@code fromIndex} (inclusive) to {@code toIndex} - * (exclusive) + * Renders all tokens from {@code fromIndex} (inclusive) to {@code toIndex} (exclusive) * * @param fromIndex - * first item to render + * first item to render * @param toIndex - * first item not to render + * first item not to render * @return the rendered string */ public String render(final int fromIndex, final int toIndex) { @@ -243,7 +240,7 @@ public static Topic notify(final String requesterClientId, final String... resou *

* * @param application - * the application ID + * the application ID * @return a new topic */ public static Topic application(final String application) { @@ -278,9 +275,9 @@ public Topic append(final Segment segment) { * Attach information to the local topic context * * @param key - * the key of the value + * the key of the value * @param value - * the value to attach + * the value to attach * @return the current instance */ public Topic attach(final String key, final String value) {