You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2023/06/07 14:04:24 UTC
[jackrabbit-oak] 01/01: OAK-10247: oak-core-spi: remove Guava from public API
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch OAK-10274
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 17ae5dcc550a76ba609529c855b4241ad99ef70c
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Wed Jun 7 15:03:57 2023 +0100
OAK-10247: oak-core-spi: remove Guava from public API
---
oak-core-spi/pom.xml | 7 --
.../oak/commons/jmx/ManagementOperation.java | 13 ---
.../jackrabbit/oak/commons/jmx/package-info.java | 40 ++++----
.../jackrabbit/oak/spi/GuavaDeprecation.java | 104 ---------------------
.../oak/spi/whiteboard/WhiteboardUtils.java | 24 -----
.../oak/spi/whiteboard/package-info.java | 40 ++++----
6 files changed, 40 insertions(+), 188 deletions(-)
diff --git a/oak-core-spi/pom.xml b/oak-core-spi/pom.xml
index a3ab8330dc..828261e5f5 100644
--- a/oak-core-spi/pom.xml
+++ b/oak-core-spi/pom.xml
@@ -133,13 +133,6 @@
<version>${project.version}</version>
</dependency>
- <!-- General utility libraries -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <scope>provided</scope>
- </dependency>
-
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/ManagementOperation.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/ManagementOperation.java
index bf4599a383..25eb85bbe1 100644
--- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/ManagementOperation.java
+++ b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/ManagementOperation.java
@@ -53,7 +53,6 @@ import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
import org.apache.jackrabbit.oak.commons.TimeDurationFormatter;
-import org.apache.jackrabbit.oak.spi.GuavaDeprecation;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -107,18 +106,6 @@ public class ManagementOperation<R> extends FutureTask<R> {
return new ManagementOperation<R>(name, statusMessage, task);
}
- /**
- * @deprecated use {@link #newManagementOperation(String, Supplier, Callable)} instead
- */
- @Deprecated(since = "1.20.0", forRemoval = true)
- public static <R> ManagementOperation<R> newManagementOperation(
- @NotNull String name,
- @NotNull com.google.common.base.Supplier<String> statusMessage,
- @NotNull Callable<R> task) {
- GuavaDeprecation.handleCall("OAK-8687");
- return new ManagementOperation<R>(name, () -> statusMessage.get(), task);
- }
-
/**
* An operation that is already done with the given {@code value}.
*
diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/package-info.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/package-info.java
old mode 100644
new mode 100755
index 4ff733d499..9970e2f54e
--- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/package-info.java
+++ b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/package-info.java
@@ -1,20 +1,20 @@
-/*
- * 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.
- */
-@Version("1.2.0")
-package org.apache.jackrabbit.oak.commons.jmx;
-
-import org.osgi.annotation.versioning.Version;
+/*
+ * 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.
+ */
+@Version("2.0.0")
+package org.apache.jackrabbit.oak.commons.jmx;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/GuavaDeprecation.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/GuavaDeprecation.java
deleted file mode 100644
index b287d5467a..0000000000
--- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/GuavaDeprecation.java
+++ /dev/null
@@ -1,104 +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.jackrabbit.oak.spi;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GuavaDeprecation {
-
- private static final Logger LOG = LoggerFactory.getLogger(GuavaDeprecation.class);
-
- private static String LOGLEVEL = "error";
-
- private GuavaDeprecation() {
- }
-
- public static void handleCall(String ticket) throws UnsupportedOperationException {
- handleCall(ticket, null, Collections.emptyList());
- }
-
- public static void handleCall(String ticket, String className, List<String> allowed) throws UnsupportedOperationException {
- String message = "use of deprecated Guava-related API - this method is going to be removed in future Oak releases - see %s for details";
-
- switch (LOGLEVEL) {
- case "error":
- if (LOG.isErrorEnabled()) {
- Exception ex = new Exception("call stack");
- if (deprecatedCaller(ex, className, allowed)) {
- LOG.error(String.format(message, ticket), ex);
- }
- }
- break;
- case "warn":
- if (LOG.isWarnEnabled()) {
- Exception ex = new Exception("call stack");
- if (deprecatedCaller(ex, className, allowed)) {
- LOG.warn(String.format(message, ticket), ex);
- }
- }
- break;
- case "info":
- if (LOG.isInfoEnabled()) {
- Exception ex = new Exception("call stack");
- if (deprecatedCaller(ex, className, allowed)) {
- LOG.info(String.format(message, ticket), ex);
- }
- }
- break;
- case "debug":
- if (LOG.isDebugEnabled()) {
- Exception ex = new Exception("call stack");
- if (deprecatedCaller(ex, className, allowed)) {
- LOG.debug(String.format(message, ticket), ex);
- }
- }
- break;
- }
- }
-
- public static boolean deprecatedCaller(Exception ex, String className, List<String> allowed) {
- if (allowed == null) {
- return true;
- } else {
- boolean classFound = false;
- for (StackTraceElement el : ex.getStackTrace()) {
- String cn = el.getClassName();
- if (!classFound) {
- // still looking for the entry
- classFound = cn.equals(className);
- } else {
- // still in class checked for?
- if (cn.equals(className)) {
- // go one
- } else {
- // check caller
- for (String a : allowed) {
- if (cn.startsWith(a)) {
- return false;
- }
- }
- }
- }
- }
- return true;
- }
- }
-}
diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/WhiteboardUtils.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/WhiteboardUtils.java
index a9072d1cdb..1e8b8bb3c4 100644
--- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/WhiteboardUtils.java
+++ b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/WhiteboardUtils.java
@@ -26,7 +26,6 @@ import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.jackrabbit.oak.commons.jmx.JmxUtil;
-import org.apache.jackrabbit.oak.spi.GuavaDeprecation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -170,18 +169,6 @@ public class WhiteboardUtils {
}
}
-
- /**
- * @deprecated use {@link #getServices(Whiteboard, Class, java.util.function.Predicate)} instead
- */
- @NotNull
- @Deprecated(since = "1.20.0", forRemoval = true)
- public static <T> List<T> getServices(@NotNull Whiteboard wb, @NotNull Class<T> type,
- @Nullable com.google.common.base.Predicate<T> predicate) {
- GuavaDeprecation.handleCall("OAK-8685");
- return getServices(wb, type, (java.util.function.Predicate<T>) (input) -> predicate.apply(input));
- }
-
/**
* Returns the one of the currently available services from the whiteboard of the tracked type. If {@code predicate} is
* not {@code null} only a service that match the predicate is returned.
@@ -208,15 +195,4 @@ public class WhiteboardUtils {
}
}
-
- /**
- * @deprecated use {@link #getService(Whiteboard, Class, Predicate)} instead
- */
- @Nullable
- @Deprecated(since = "1.20.0", forRemoval = true)
- public static <T> T getService(@NotNull Whiteboard wb, @NotNull Class<T> type,
- @Nullable com.google.common.base.Predicate<T> predicate) {
- GuavaDeprecation.handleCall("OAK-8685");
- return getService(wb, type, (Predicate<T>) (input) -> predicate.apply(input));
- }
}
diff --git a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/package-info.java b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/package-info.java
old mode 100644
new mode 100755
index 09019dc0c5..384bc3792b
--- a/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/package-info.java
+++ b/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/whiteboard/package-info.java
@@ -1,20 +1,20 @@
-/*
- * 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.
- */
-@Version("1.2.0")
-package org.apache.jackrabbit.oak.spi.whiteboard;
-
-import org.osgi.annotation.versioning.Version;
+/*
+ * 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.
+ */
+@Version("2.0.0")
+package org.apache.jackrabbit.oak.spi.whiteboard;
+
+import org.osgi.annotation.versioning.Version;