From bda6aeaa60607ab4fe5af508156019d7bd5c0ce4 Mon Sep 17 00:00:00 2001 From: efiacor Date: Wed, 7 Dec 2022 10:56:27 +0000 Subject: [DMAAP-DR] Remove AAF/TLS phase 1 Signed-off-by: efiacor Change-Id: Ifeae01dd8e7f0a737d8b74594a8061ae3d4ea647 Issue-ID: DMAAP-1642 --- .../subscriber/SampleSubscriberServlet.java | 27 +++++++++++----------- .../datarouter/subscriber/SubscriberMain.java | 14 +++++------ .../datarouter/subscriber/SubscriberProps.java | 9 ++++---- .../src/main/resources/docker/Dockerfile | 4 +--- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'datarouter-subscriber/src/main') diff --git a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java index 34a844c6..b820f3df 100644 --- a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java +++ b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java @@ -23,8 +23,9 @@ package org.onap.dmaap.datarouter.subscriber; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -32,18 +33,18 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.apache.commons.codec.binary.Base64; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SampleSubscriberServlet extends HttpServlet { - private static EELFLogger logger = EELFManager.getInstance().getLogger(SampleSubscriberServlet.class); + private final Logger logger = LoggerFactory.getLogger(SampleSubscriberServlet.class); + private static String outputDirectory; private static String basicAuth; @@ -67,7 +68,7 @@ public class SampleSubscriberServlet extends HttpServlet { try { Files.createDirectory(Paths.get(outputDirectory)); } catch (IOException e) { - logger.info("SubServlet: Failed to create delivery dir: " + e.getMessage(), e); + logger.error("SubServlet: Failed to create delivery dir: " + e.getMessage(), e); } basicAuth = "Basic " + Base64.encodeBase64String((login + ":" + password).getBytes()); } @@ -77,7 +78,7 @@ public class SampleSubscriberServlet extends HttpServlet { try { common(req, resp, false); } catch (IOException e) { - logger.info("SampleSubServlet: Failed to doPut: " + req.getRemoteAddr() + " : " + req.getPathInfo(), e); + logger.error("SampleSubServlet: Failed to doPut: " + req.getRemoteAddr() + " : " + req.getPathInfo(), e); } } @@ -86,7 +87,7 @@ public class SampleSubscriberServlet extends HttpServlet { try { common(req, resp, true); } catch (IOException e) { - logger.info("SampleSubServlet: Failed to doDelete: " + req.getRemoteAddr() + " : " + req.getPathInfo(), e); + logger.error("SampleSubServlet: Failed to doDelete: " + req.getRemoteAddr() + " : " + req.getPathInfo(), e); } } @@ -115,7 +116,7 @@ public class SampleSubscriberServlet extends HttpServlet { return; } if (!basicAuth.equals(authHeader)) { - logger.info("SampleSubServlet: Rejecting request with incorrect Authorization header from " + logger.error("SampleSubServlet: Rejecting request with incorrect Authorization header from " + req.getRemoteAddr() + ": " + req.getPathInfo()); resp.sendError(HttpServletResponse.SC_FORBIDDEN); return; @@ -127,7 +128,7 @@ public class SampleSubscriberServlet extends HttpServlet { fileid = fileid + "?" + queryString; } String publishid = req.getHeader("X-DMAAP-DR-PUBLISH-ID"); - String filename = URLEncoder.encode(fileid, "UTF-8").replaceAll("^\\.", "%2E").replaceAll("\\*", "%2A"); + String filename = URLEncoder.encode(fileid, StandardCharsets.UTF_8).replaceAll("^\\.", "%2E").replaceAll("\\*", "%2A"); String fullPath = outputDirectory + "/" + filename; String tmpPath = outputDirectory + "/." + filename; String fullMetaDataPath = outputDirectory + "/" + filename + ".M"; @@ -164,7 +165,7 @@ public class SampleSubscriberServlet extends HttpServlet { } catch (IOException ioe) { Files.deleteIfExists(Paths.get(tmpPath)); Files.deleteIfExists(Paths.get(tmpMetaDataPath)); - logger.info("SampleSubServlet: Failed to process file " + fullPath + " from " + req.getRemoteAddr() + ": " + logger.error("SampleSubServlet: Failed to process file " + fullPath + " from " + req.getRemoteAddr() + ": " + req.getPathInfo()); throw ioe; } diff --git a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberMain.java b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberMain.java index 9184dce4..0e8d92fc 100644 --- a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberMain.java +++ b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberMain.java @@ -23,8 +23,6 @@ package org.onap.dmaap.datarouter.subscriber; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.util.Arrays; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.server.Connector; @@ -37,11 +35,13 @@ import org.eclipse.jetty.server.SslConnectionFactory; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SubscriberMain { - private static EELFLogger logger = EELFManager.getInstance().getLogger(SubscriberMain.class); + private static final Logger logger = LoggerFactory.getLogger(SubscriberMain.class); /** * Main class for Subscriber. @@ -66,7 +66,7 @@ public class SubscriberMain { httpServerConnector.setIdleTimeout(30000); // SSL Context Factory - SslContextFactory sslContextFactory = new SslContextFactory.Server(); + SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); // SSL HTTP Configuration HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); @@ -81,7 +81,7 @@ public class SubscriberMain { /*Skip SSLv3 Fixes*/ sslContextFactory.addExcludeProtocols("SSLv3"); - logger.info("Excluded protocols for SubscriberMain:" + logger.debug("Excluded protocols for SubscriberMain:" + Arrays.toString(sslContextFactory.getExcludeProtocols())); /*End of SSLv3 Fixes*/ @@ -102,10 +102,10 @@ public class SubscriberMain { try { server.start(); } catch ( Exception e ) { - logger.info("Jetty failed to start. Reporting will be unavailable-" + e); + logger.error("Jetty failed to start. Reporting will be unavailable-" + e); } server.join(); - logger.info("org.onap.dmaap.datarouter.subscriber.SubscriberMain started-" + server.getState()); + logger.debug("org.onap.dmaap.datarouter.subscriber.SubscriberMain started-" + server.getState()); } } \ No newline at end of file diff --git a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberProps.java b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberProps.java index 49cad503..c060a9b0 100644 --- a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberProps.java +++ b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberProps.java @@ -23,17 +23,18 @@ package org.onap.dmaap.datarouter.subscriber; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.IOException; import java.util.Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SubscriberProps { + private static final Logger logger = LoggerFactory.getLogger(SubscriberProps.class); + private static SubscriberProps instance = null; - private static EELFLogger logger = EELFManager.getInstance().getLogger(SubscriberProps.class); - private Properties properties; + private final Properties properties; private SubscriberProps(String propsPath) throws IOException { properties = new Properties(); diff --git a/datarouter-subscriber/src/main/resources/docker/Dockerfile b/datarouter-subscriber/src/main/resources/docker/Dockerfile index 7bc92c83..f3ad036e 100644 --- a/datarouter-subscriber/src/main/resources/docker/Dockerfile +++ b/datarouter-subscriber/src/main/resources/docker/Dockerfile @@ -19,7 +19,7 @@ # limitations under the License. # ============LICENSE_END==================================================== # -FROM nexus3.onap.org:10001/onap/integration-java11:8.0.0 +FROM nexus3.onap.org:10001/onap/integration-java11:10.0.0 COPY /opt /opt @@ -29,8 +29,6 @@ ARG group=onap USER root RUN apk add --no-cache curl -EXPOSE 8080 8443 - WORKDIR /opt RUN chmod 0700 startup.sh -- cgit 1.2.3-korg