From 21e5dd84c9bbe2444609d7e4bb0e85d5e9f9e413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Fri, 9 Apr 2021 13:31:34 +0200 Subject: [PATCH] cleanup common package --- .../common/io/ClasspathURLStreamHandler.java | 25 ------------------- .../io/ClasspathURLStreamHandlerFactory.java | 12 --------- .../org/xbib/elx/common/io/package-info.java | 4 --- .../xbib/elx/common/util/package-info.java | 4 --- .../services/java.net.URLStreamHandlerFactory | 1 - .../org/xbib/elx/transport}/NetworkUtils.java | 5 +--- .../elx/transport/TransportClientHelper.java | 1 - 7 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 elx-common/src/main/java/org/xbib/elx/common/io/ClasspathURLStreamHandler.java delete mode 100644 elx-common/src/main/java/org/xbib/elx/common/io/ClasspathURLStreamHandlerFactory.java delete mode 100644 elx-common/src/main/java/org/xbib/elx/common/io/package-info.java delete mode 100644 elx-common/src/main/java/org/xbib/elx/common/util/package-info.java delete mode 100644 elx-common/src/main/resources/META-INF/services/java.net.URLStreamHandlerFactory rename {elx-common/src/main/java/org/xbib/elx/common/util => elx-transport/src/main/java/org/xbib/elx/transport}/NetworkUtils.java (99%) diff --git a/elx-common/src/main/java/org/xbib/elx/common/io/ClasspathURLStreamHandler.java b/elx-common/src/main/java/org/xbib/elx/common/io/ClasspathURLStreamHandler.java deleted file mode 100644 index e7d8727..0000000 --- a/elx-common/src/main/java/org/xbib/elx/common/io/ClasspathURLStreamHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.xbib.elx.common.io; - -import java.io.IOException; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLStreamHandler; - -public class ClasspathURLStreamHandler extends URLStreamHandler { - - private final ClassLoader classLoader; - - public ClasspathURLStreamHandler() { - this.classLoader = getClass().getClassLoader(); - } - - public ClasspathURLStreamHandler(ClassLoader classLoader) { - this.classLoader = classLoader; - } - - @Override - protected URLConnection openConnection(URL u) throws IOException { - final URL resourceUrl = classLoader.getResource(u.getPath()); - return resourceUrl != null ? resourceUrl.openConnection() : null; - } -} diff --git a/elx-common/src/main/java/org/xbib/elx/common/io/ClasspathURLStreamHandlerFactory.java b/elx-common/src/main/java/org/xbib/elx/common/io/ClasspathURLStreamHandlerFactory.java deleted file mode 100644 index 00c7c83..0000000 --- a/elx-common/src/main/java/org/xbib/elx/common/io/ClasspathURLStreamHandlerFactory.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.xbib.elx.common.io; - -import java.net.URLStreamHandler; -import java.net.URLStreamHandlerFactory; - -public class ClasspathURLStreamHandlerFactory implements URLStreamHandlerFactory { - - @Override - public URLStreamHandler createURLStreamHandler(String protocol) { - return "classpath".equals(protocol) ? new ClasspathURLStreamHandler() : null; - } -} diff --git a/elx-common/src/main/java/org/xbib/elx/common/io/package-info.java b/elx-common/src/main/java/org/xbib/elx/common/io/package-info.java deleted file mode 100644 index 5e86ba1..0000000 --- a/elx-common/src/main/java/org/xbib/elx/common/io/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * I/O helpers for Elasticsearch client extensions. - */ -package org.xbib.elx.common.io; diff --git a/elx-common/src/main/java/org/xbib/elx/common/util/package-info.java b/elx-common/src/main/java/org/xbib/elx/common/util/package-info.java deleted file mode 100644 index cd393c9..0000000 --- a/elx-common/src/main/java/org/xbib/elx/common/util/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Utilities for Elasticsearch client extensions. - */ -package org.xbib.elx.common.util; diff --git a/elx-common/src/main/resources/META-INF/services/java.net.URLStreamHandlerFactory b/elx-common/src/main/resources/META-INF/services/java.net.URLStreamHandlerFactory deleted file mode 100644 index bb6d620..0000000 --- a/elx-common/src/main/resources/META-INF/services/java.net.URLStreamHandlerFactory +++ /dev/null @@ -1 +0,0 @@ -org.xbib.elx.common.io.ClasspathURLStreamHandlerFactory \ No newline at end of file diff --git a/elx-common/src/main/java/org/xbib/elx/common/util/NetworkUtils.java b/elx-transport/src/main/java/org/xbib/elx/transport/NetworkUtils.java similarity index 99% rename from elx-common/src/main/java/org/xbib/elx/common/util/NetworkUtils.java rename to elx-transport/src/main/java/org/xbib/elx/transport/NetworkUtils.java index 11dd014..0ec35f7 100644 --- a/elx-common/src/main/java/org/xbib/elx/common/util/NetworkUtils.java +++ b/elx-transport/src/main/java/org/xbib/elx/transport/NetworkUtils.java @@ -1,4 +1,4 @@ -package org.xbib.elx.common.util; +package org.xbib.elx.transport; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -16,9 +16,6 @@ import java.util.Enumeration; import java.util.List; import java.util.Locale; -/** - * - */ public class NetworkUtils { private static final Logger logger = LogManager.getLogger(NetworkUtils.class.getName()); diff --git a/elx-transport/src/main/java/org/xbib/elx/transport/TransportClientHelper.java b/elx-transport/src/main/java/org/xbib/elx/transport/TransportClientHelper.java index fde33e2..f7a0be2 100644 --- a/elx-transport/src/main/java/org/xbib/elx/transport/TransportClientHelper.java +++ b/elx-transport/src/main/java/org/xbib/elx/transport/TransportClientHelper.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.transport.Netty4Plugin; -import org.xbib.elx.common.util.NetworkUtils; import java.io.IOException; import java.net.InetAddress;