commit c11b61465a644940559b97c93a769fda84287970 Author: Karsten Loesing karsten.loesing@gmx.net Date: Sat Nov 23 17:55:17 2019 +0100
Remove dependency on metrics-lib's log package (3/4).
- Remove package-internal interfaces InternalLogDescriptor and InternalWebServerAccessLog. --- .../persist/WebServerAccessLogPersistence.java | 4 ++-- .../collector/webstats/InternalLogDescriptor.java | 28 ---------------------- .../webstats/InternalWebServerAccessLog.java | 17 ------------- .../collector/webstats/LogDescriptorImpl.java | 8 +++---- .../collector/webstats/SanitizeWeblogs.java | 4 ++-- .../collector/webstats/WebServerAccessLogImpl.java | 4 ++-- 6 files changed, 10 insertions(+), 55 deletions(-)
diff --git a/src/main/java/org/torproject/metrics/collector/persist/WebServerAccessLogPersistence.java b/src/main/java/org/torproject/metrics/collector/persist/WebServerAccessLogPersistence.java index 6afb97e..0001957 100644 --- a/src/main/java/org/torproject/metrics/collector/persist/WebServerAccessLogPersistence.java +++ b/src/main/java/org/torproject/metrics/collector/persist/WebServerAccessLogPersistence.java @@ -5,7 +5,7 @@ package org.torproject.metrics.collector.persist;
import org.torproject.descriptor.WebServerAccessLog; import org.torproject.metrics.collector.webstats.FileType; -import org.torproject.metrics.collector.webstats.InternalWebServerAccessLog; +import org.torproject.metrics.collector.webstats.WebServerAccessLogImpl;
import java.nio.file.Paths; import java.nio.file.StandardOpenOption; @@ -14,7 +14,7 @@ import java.time.format.DateTimeFormatter; public class WebServerAccessLogPersistence extends DescriptorPersistence<WebServerAccessLog> {
- public static final String SEP = InternalWebServerAccessLog.SEP; + public static final String SEP = WebServerAccessLogImpl.SEP; public static final FileType COMPRESSION = FileType.XZ;
private DateTimeFormatter yearPattern = DateTimeFormatter.ofPattern("yyyy"); diff --git a/src/main/java/org/torproject/metrics/collector/webstats/InternalLogDescriptor.java b/src/main/java/org/torproject/metrics/collector/webstats/InternalLogDescriptor.java deleted file mode 100644 index ac7d689..0000000 --- a/src/main/java/org/torproject/metrics/collector/webstats/InternalLogDescriptor.java +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2017--2018 The Tor Project - * See LICENSE for licensing information */ - -package org.torproject.metrics.collector.webstats; - -import org.torproject.descriptor.LogDescriptor; - -/** - * This interface provides methods for internal use only. - * - * @since 2.2.0 - */ -public interface InternalLogDescriptor extends LogDescriptor { - - /** Logfile name parts separator. */ - String SEP = "_"; - - /** - * Set the descriptor's bytes. - * - * @since 2.2.0 - */ - void setRawDescriptorBytes(byte[] bytes); - - /** Return the descriptor's preferred compression. */ - String getCompressionType(); -} - diff --git a/src/main/java/org/torproject/metrics/collector/webstats/InternalWebServerAccessLog.java b/src/main/java/org/torproject/metrics/collector/webstats/InternalWebServerAccessLog.java deleted file mode 100644 index 817b8d5..0000000 --- a/src/main/java/org/torproject/metrics/collector/webstats/InternalWebServerAccessLog.java +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright 2018 The Tor Project - * See LICENSE for licensing information */ - -package org.torproject.metrics.collector.webstats; - -/** - * This interface provides methods for internal use only. - * - * @since 2.2.0 - */ -public interface InternalWebServerAccessLog extends InternalLogDescriptor { - - /** The log's name should include this string. */ - String MARKER = "access.log"; - -} - diff --git a/src/main/java/org/torproject/metrics/collector/webstats/LogDescriptorImpl.java b/src/main/java/org/torproject/metrics/collector/webstats/LogDescriptorImpl.java index c0b0c69..e20be27 100644 --- a/src/main/java/org/torproject/metrics/collector/webstats/LogDescriptorImpl.java +++ b/src/main/java/org/torproject/metrics/collector/webstats/LogDescriptorImpl.java @@ -20,8 +20,10 @@ import java.util.regex.Pattern; * * @since 2.2.0 */ -public abstract class LogDescriptorImpl - implements LogDescriptor, InternalLogDescriptor { +public abstract class LogDescriptorImpl implements LogDescriptor { + + /** Logfile name parts separator. */ + public static final String SEP = "_";
/** The log's file name should contain this string. */ public static final String MARKER = ".log"; @@ -78,7 +80,6 @@ public abstract class LogDescriptorImpl } }
- @Override public String getCompressionType() { return this.fileType.name().toLowerCase(); } @@ -88,7 +89,6 @@ public abstract class LogDescriptorImpl return this.logBytes; }
- @Override public void setRawDescriptorBytes(byte[] bytes) { this.logBytes = bytes; } diff --git a/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java b/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java index b2b4c49..51318f8 100644 --- a/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java +++ b/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java @@ -135,9 +135,9 @@ public class SanitizeWeblogs extends CollecTorMain {
private void storeSortedAndForget(String virtualHost, String physicalHost, LocalDate date, Map<String, Long> lineCounts) { - String name = new StringJoiner(InternalLogDescriptor.SEP) + String name = new StringJoiner(LogDescriptorImpl.SEP) .add(virtualHost).add(physicalHost) - .add(InternalWebServerAccessLog.MARKER) + .add(WebServerAccessLogImpl.MARKER) .add(date.format(DateTimeFormatter.BASIC_ISO_DATE)) .toString() + "." + FileType.XZ.name().toLowerCase(); log.debug("Storing {}.", name); diff --git a/src/main/java/org/torproject/metrics/collector/webstats/WebServerAccessLogImpl.java b/src/main/java/org/torproject/metrics/collector/webstats/WebServerAccessLogImpl.java index 548fbf6..4ec9e39 100644 --- a/src/main/java/org/torproject/metrics/collector/webstats/WebServerAccessLogImpl.java +++ b/src/main/java/org/torproject/metrics/collector/webstats/WebServerAccessLogImpl.java @@ -27,10 +27,10 @@ import java.util.stream.Stream; * @since 2.2.0 */ public class WebServerAccessLogImpl extends LogDescriptorImpl - implements InternalWebServerAccessLog, WebServerAccessLog { + implements WebServerAccessLog {
/** The log's name should include this string. */ - public static final String MARKER = InternalWebServerAccessLog.MARKER; + public static final String MARKER = "access.log";
/** The mandatory web server log descriptor file name pattern. */ public static final Pattern filenamePattern