Made Javadoc review.

This commit is contained in:
Christian P. MOMON 2024-07-18 14:34:18 +02:00
parent 23d9e13787
commit 16c239f1c6
19 changed files with 376 additions and 8 deletions

View file

@ -41,41 +41,85 @@ public class ExtractOptions
this.userAgent = OnOffOption.OFF; this.userAgent = OnOffOption.OFF;
} }
/**
* Gets the datetime.
*
* @return the datetime
*/
public OnOffOption getDatetime() public OnOffOption getDatetime()
{ {
return this.datetime; return this.datetime;
} }
/**
* Gets the ip.
*
* @return the ip
*/
public OnOffOption getIp() public OnOffOption getIp()
{ {
return this.ip; return this.ip;
} }
/**
* Gets the user.
*
* @return the user
*/
public OnOffOption getUser() public OnOffOption getUser()
{ {
return this.user; return this.user;
} }
/**
* Gets the user agent.
*
* @return the user agent
*/
public OnOffOption getUserAgent() public OnOffOption getUserAgent()
{ {
return this.userAgent; return this.userAgent;
} }
/**
* Sets the datetime.
*
* @param datetime
* the new datetime
*/
public void setDatetime(final OnOffOption datetime) public void setDatetime(final OnOffOption datetime)
{ {
this.datetime = datetime; this.datetime = datetime;
} }
/**
* Sets the ip.
*
* @param ip
* the new ip
*/
public void setIp(final OnOffOption ip) public void setIp(final OnOffOption ip)
{ {
this.ip = ip; this.ip = ip;
} }
/**
* Sets the user.
*
* @param user
* the new user
*/
public void setUser(final OnOffOption user) public void setUser(final OnOffOption user)
{ {
this.user = user; this.user = user;
} }
/**
* Sets the user agent.
*
* @param userAgent
* the new user agent
*/
public void setUserAgent(final OnOffOption userAgent) public void setUserAgent(final OnOffOption userAgent)
{ {
this.userAgent = userAgent; this.userAgent = userAgent;

View file

@ -67,6 +67,7 @@ public final class Logar
* @param source * @param source
* the source * the source
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void anonymize(final File source) throws IOException public static void anonymize(final File source) throws IOException
{ {
@ -81,6 +82,7 @@ public final class Logar
* @param mapFile * @param mapFile
* the map file * the map file
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void anonymize(final File source, final File mapFile) throws IOException public static void anonymize(final File source, final File mapFile) throws IOException
{ {
@ -122,7 +124,10 @@ public final class Logar
* the source * the source
* @param target * @param target
* the target * the target
* @param dry
* the dry
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void archive(final File source, final File target, final OnOffOption dry) throws IOException public static void archive(final File source, final File target, final OnOffOption dry) throws IOException
{ {
@ -131,11 +136,16 @@ public final class Logar
} }
/** /**
* Test archive access files. * Archive access files.
* *
* @param source * @param source
* the source * the source
* @param target
* the target
* @param dry
* the dry
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void archiveAccessFiles(final File source, final File target, final OnOffOption dry) throws IOException public static void archiveAccessFiles(final File source, final File target, final OnOffOption dry) throws IOException
{ {
@ -235,6 +245,8 @@ public final class Logar
* the source * the source
* @param target * @param target
* the target * the target
* @param dry
* the dry
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
@ -329,11 +341,12 @@ public final class Logar
} }
/** /**
* Check access files. * Check log file.
* *
* @param file * @param file
* the source * the file
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void checkLogFile(final File file) throws IOException public static void checkLogFile(final File file) throws IOException
{ {
@ -391,11 +404,12 @@ public final class Logar
} }
/** /**
* Check. * Check log files.
* *
* @param source * @param source
* the source * the source
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void checkLogFiles(final File source) throws IOException public static void checkLogFiles(final File source) throws IOException
{ {
@ -424,6 +438,7 @@ public final class Logar
* @param source * @param source
* the source * the source
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void checkSort(final File source) throws IOException public static void checkSort(final File source) throws IOException
{ {
@ -499,6 +514,8 @@ public final class Logar
* *
* @param source * @param source
* the source * the source
* @param options
* the options
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
@ -640,7 +657,7 @@ public final class Logar
} }
/** /**
* Stats user agents. * Stat user agents.
* *
* @param source * @param source
* the source * the source
@ -753,6 +770,7 @@ public final class Logar
* @param source * @param source
* the source * the source
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void testConcate(final File source) throws IOException public static void testConcate(final File source) throws IOException
{ {
@ -770,6 +788,7 @@ public final class Logar
* @param file * @param file
* the file * the file
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void testConcateFile(final File file) throws IOException public static void testConcateFile(final File file) throws IOException
{ {

View file

@ -53,6 +53,7 @@ public final class LogarUtils
* the file * the file
* @return the string * @return the string
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static String sha1sum(final File file) throws IOException public static String sha1sum(final File file) throws IOException
{ {

View file

@ -171,6 +171,9 @@ public final class Stats
this.lineCount += 1; this.lineCount += 1;
} }
/**
* Inc success file count.
*/
public void incSuccessFileCount() public void incSuccessFileCount()
{ {
this.successFileCount += 1; this.successFileCount += 1;

View file

@ -68,6 +68,7 @@ public final class Anonymizer
* @param source * @param source
* the source * the source
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public void anonymize(final File source) throws IOException public void anonymize(final File source) throws IOException
{ {

View file

@ -156,6 +156,15 @@ public final class Ipv4Generator
return result; return result;
} }
/**
* Gets the ipv 4 min value part.
*
* @param length
* the length
* @param column
* the column
* @return the ipv 4 min value part
*/
public static int getIpv4MinValuePart(final int length, final int column) public static int getIpv4MinValuePart(final int length, final int column)
{ {
int result; int result;

View file

@ -74,6 +74,11 @@ public final class Log
/** /**
* Instantiates a new log. * Instantiates a new log.
*
* @param line
* the line
* @param datetime
* the datetime
*/ */
public Log(final String line, final LocalDateTime datetime) public Log(final String line, final LocalDateTime datetime)
{ {
@ -109,61 +114,121 @@ public final class Log
this.datetimeValue, this.level, this.message); this.datetimeValue, this.level, this.message);
} }
/**
* Gets the body byte sent.
*
* @return the body byte sent
*/
public String getBodyByteSent() public String getBodyByteSent()
{ {
return this.bodyByteSent; return this.bodyByteSent;
} }
/**
* Gets the datetime.
*
* @return the datetime
*/
public LocalDateTime getDatetime() public LocalDateTime getDatetime()
{ {
return this.datetime; return this.datetime;
} }
/**
* Gets the datetime value.
*
* @return the datetime value
*/
public String getDatetimeValue() public String getDatetimeValue()
{ {
return this.datetimeValue; return this.datetimeValue;
} }
/**
* Gets the ip.
*
* @return the ip
*/
public String getIp() public String getIp()
{ {
return this.ip; return this.ip;
} }
/**
* Gets the level.
*
* @return the level
*/
public String getLevel() public String getLevel()
{ {
return this.level; return this.level;
} }
/**
* Gets the line.
*
* @return the line
*/
public String getLine() public String getLine()
{ {
return this.line; return this.line;
} }
/**
* Gets the message.
*
* @return the message
*/
public String getMessage() public String getMessage()
{ {
return this.message; return this.message;
} }
/**
* Gets the referer.
*
* @return the referer
*/
public String getReferer() public String getReferer()
{ {
return this.referer; return this.referer;
} }
/**
* Gets the request.
*
* @return the request
*/
public String getRequest() public String getRequest()
{ {
return this.request; return this.request;
} }
/**
* Gets the status.
*
* @return the status
*/
public String getStatus() public String getStatus()
{ {
return this.status; return this.status;
} }
/**
* Gets the user.
*
* @return the user
*/
public String getUser() public String getUser()
{ {
return this.user; return this.user;
} }
/**
* Gets the user agent.
*
* @return the user agent
*/
public String getUserAgent() public String getUserAgent()
{ {
return this.userAgent; return this.userAgent;
@ -185,46 +250,100 @@ public final class Log
this.message = null; this.message = null;
} }
/**
* Sets the body byte sent.
*
* @param bodyByteSent
* the new body byte sent
*/
public void setBodyByteSent(final String bodyByteSent) public void setBodyByteSent(final String bodyByteSent)
{ {
this.bodyByteSent = bodyByteSent; this.bodyByteSent = bodyByteSent;
} }
/**
* Sets the datetime value.
*
* @param datetimeValue
* the new datetime value
*/
public void setDatetimeValue(final String datetimeValue) public void setDatetimeValue(final String datetimeValue)
{ {
this.datetimeValue = datetimeValue; this.datetimeValue = datetimeValue;
} }
/**
* Sets the ip.
*
* @param ip
* the new ip
*/
public void setIp(final String ip) public void setIp(final String ip)
{ {
this.ip = ip; this.ip = ip;
} }
/**
* Sets the level.
*
* @param level
* the new level
*/
public void setLevel(final String level) public void setLevel(final String level)
{ {
this.level = level; this.level = level;
} }
/**
* Sets the message.
*
* @param message
* the new message
*/
public void setMessage(final String message) public void setMessage(final String message)
{ {
this.message = message; this.message = message;
} }
/**
* Sets the referer.
*
* @param referer
* the new referer
*/
public void setReferer(final String referer) public void setReferer(final String referer)
{ {
this.referer = referer; this.referer = referer;
} }
/**
* Sets the request.
*
* @param request
* the new request
*/
public void setRequest(final String request) public void setRequest(final String request)
{ {
this.request = request; this.request = request;
} }
/**
* Sets the status.
*
* @param status
* the new status
*/
public void setStatus(final String status) public void setStatus(final String status)
{ {
this.status = status; this.status = status;
} }
/**
* Sets the user.
*
* @param user
* the new user
*/
public void setUser(final String user) public void setUser(final String user)
{ {
this.user = user; this.user = user;

View file

@ -59,6 +59,7 @@ public final class LogFile
* the file * the file
* @return the parser * @return the parser
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static LineParser getParser(final File file) throws IOException public static LineParser getParser(final File file) throws IOException
{ {
@ -101,6 +102,7 @@ public final class LogFile
* the file * the file
* @return the type * @return the type
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static String getType(final File file) throws IOException public static String getType(final File file) throws IOException
{ {
@ -187,6 +189,8 @@ public final class LogFile
* @param file * @param file
* the file * the file
* @return the string * @return the string
* @throws IOException
* Signals that an I/O exception has occurred.
*/ */
private static String readFirstLine(final File file) throws IOException private static String readFirstLine(final File file) throws IOException
{ {

View file

@ -26,9 +26,26 @@ import fr.devinsy.logar.app.log.LogType;
*/ */
public interface LineParser public interface LineParser
{ {
/**
* Gets the mime.
*
* @return the mime
*/
String getMime(); String getMime();
/**
* Gets the type.
*
* @return the type
*/
LogType getType(); LogType getType();
/**
* Parses the.
*
* @param line
* the line
* @return the log
*/
Log parse(String line); Log parse(String line);
} }

View file

@ -43,16 +43,29 @@ public final class Ip
this.count = 0; this.count = 0;
} }
/**
* Gets the count.
*
* @return the count
*/
public long getCount() public long getCount()
{ {
return this.count; return this.count;
} }
/**
* Gets the value.
*
* @return the value
*/
public String getValue() public String getValue()
{ {
return this.value; return this.value;
} }
/**
* Inc.
*/
public void inc() public void inc()
{ {
this.count += 1; this.count += 1;

View file

@ -47,21 +47,39 @@ public final class IpUserAgent
this.count = 0; this.count = 0;
} }
/**
* Gets the count.
*
* @return the count
*/
public long getCount() public long getCount()
{ {
return this.count; return this.count;
} }
/**
* Gets the ip.
*
* @return the ip
*/
public String getIp() public String getIp()
{ {
return this.ip; return this.ip;
} }
/**
* Gets the user agent.
*
* @return the user agent
*/
public String getUserAgent() public String getUserAgent()
{ {
return this.userAgent; return this.userAgent;
} }
/**
* Inc.
*/
public void inc() public void inc()
{ {
this.count += 1; this.count += 1;

View file

@ -44,11 +44,21 @@ public final class IpUserAgents implements Iterable<IpUserAgent>
this.data = new HashMap<String, IpUserAgent>(); this.data = new HashMap<String, IpUserAgent>();
} }
/**
* Clear.
*/
public void clear() public void clear()
{ {
this.data.clear(); this.data.clear();
} }
/**
* Count by user agent.
*
* @param userAgent
* the user agent
* @return the int
*/
public int countByUserAgent(final String userAgent) public int countByUserAgent(final String userAgent)
{ {
int result; int result;
@ -106,6 +116,12 @@ public final class IpUserAgents implements Iterable<IpUserAgent>
return result; return result;
} }
/**
* Put.
*
* @param ipUserAgent
* the ip user agent
*/
public void put(final IpUserAgent ipUserAgent) public void put(final IpUserAgent ipUserAgent)
{ {
this.data.put(ipUserAgent.getIp() + ipUserAgent.getUserAgent(), ipUserAgent); this.data.put(ipUserAgent.getIp() + ipUserAgent.getUserAgent(), ipUserAgent);
@ -131,6 +147,11 @@ public final class IpUserAgents implements Iterable<IpUserAgent>
stat.inc(); stat.inc();
} }
/**
* Size.
*
* @return the int
*/
public int size() public int size()
{ {
int result; int result;

View file

@ -40,6 +40,12 @@ public final class Ips extends HashMap<String, Ip>
super(); super();
} }
/**
* Put.
*
* @param ip
* the ip
*/
public void put(final String ip) public void put(final String ip)
{ {
Ip stat = get(ip); Ip stat = get(ip);

View file

@ -45,26 +45,50 @@ public final class UserAgent
this.ipLinkCount = 0; this.ipLinkCount = 0;
} }
/**
* Gets the count.
*
* @return the count
*/
public long getCount() public long getCount()
{ {
return this.count; return this.count;
} }
/**
* Gets the ip link count.
*
* @return the ip link count
*/
public long getIpLinkCount() public long getIpLinkCount()
{ {
return this.ipLinkCount; return this.ipLinkCount;
} }
/**
* Gets the value.
*
* @return the value
*/
public String getValue() public String getValue()
{ {
return this.value; return this.value;
} }
/**
* Inc.
*/
public void inc() public void inc()
{ {
this.count += 1; this.count += 1;
} }
/**
* Sets the ip link count.
*
* @param ipLinkCount
* the new ip link count
*/
public void setIpLinkCount(final long ipLinkCount) public void setIpLinkCount(final long ipLinkCount)
{ {
this.ipLinkCount = ipLinkCount; this.ipLinkCount = ipLinkCount;

View file

@ -78,21 +78,41 @@ public final class UserAgentStator
} }
} }
/**
* Gets the ips.
*
* @return the ips
*/
public Ips getIps() public Ips getIps()
{ {
return this.ips; return this.ips;
} }
/**
* Gets the ip user agents.
*
* @return the ip user agents
*/
public IpUserAgents getIpUserAgents() public IpUserAgents getIpUserAgents()
{ {
return this.ipUserAgents; return this.ipUserAgents;
} }
/**
* Gets the log count.
*
* @return the log count
*/
public long getLogCount() public long getLogCount()
{ {
return this.logCount; return this.logCount;
} }
/**
* Gets the user agents.
*
* @return the user agents
*/
public UserAgents getUserAgents() public UserAgents getUserAgents()
{ {
return this.userAgents; return this.userAgents;
@ -114,6 +134,12 @@ public final class UserAgentStator
this.ipUserAgents.put(log.getIp(), userAgent); this.ipUserAgents.put(log.getIp(), userAgent);
} }
/**
* Save ip list.
*
* @param target
* the target
*/
public void saveIpList(final File target) public void saveIpList(final File target)
{ {
PrintWriter out = null; PrintWriter out = null;
@ -136,6 +162,12 @@ public final class UserAgentStator
} }
} }
/**
* Save ip user agent list.
*
* @param target
* the target
*/
public void saveIpUserAgentList(final File target) public void saveIpUserAgentList(final File target)
{ {
PrintWriter out = null; PrintWriter out = null;
@ -158,6 +190,12 @@ public final class UserAgentStator
} }
} }
/**
* Save user agent link count.
*
* @param target
* the target
*/
public void saveUserAgentLinkCount(final File target) public void saveUserAgentLinkCount(final File target)
{ {
PrintWriter out = null; PrintWriter out = null;
@ -179,6 +217,12 @@ public final class UserAgentStator
} }
} }
/**
* Save user agent list.
*
* @param target
* the target
*/
public void saveUserAgentList(final File target) public void saveUserAgentList(final File target)
{ {
PrintWriter out = null; PrintWriter out = null;
@ -201,6 +245,9 @@ public final class UserAgentStator
} }
} }
/**
* Shrink.
*/
public void shrink() public void shrink()
{ {
String[] tokens = { "android", "apple", "chrome", "iphone", "linux", "mac", "mozilla", "opera", "safari", "thunderbird" }; String[] tokens = { "android", "apple", "chrome", "iphone", "linux", "mac", "mozilla", "opera", "safari", "thunderbird" };

View file

@ -40,6 +40,12 @@ public final class UserAgents extends HashMap<String, UserAgent>
super(); super();
} }
/**
* Put.
*
* @param userAgent
* the user agent
*/
public void put(final String userAgent) public void put(final String userAgent)
{ {
UserAgent stat = get(userAgent); UserAgent stat = get(userAgent);
@ -52,6 +58,12 @@ public final class UserAgents extends HashMap<String, UserAgent>
stat.inc(); stat.inc();
} }
/**
* Put.
*
* @param userAgent
* the user agent
*/
public void put(final UserAgent userAgent) public void put(final UserAgent userAgent)
{ {
this.put(userAgent.getValue(), userAgent); this.put(userAgent.getValue(), userAgent);

View file

@ -87,6 +87,8 @@ public class Chrono
/** /**
* Start. * Start.
*
* @return the chrono
*/ */
public Chrono start() public Chrono start()
{ {

View file

@ -240,6 +240,11 @@ public class Files extends ArrayList<File>
return result; return result;
} }
/**
* Sort by pathname.
*
* @return the files
*/
public Files sortByPathname() public Files sortByPathname()
{ {
Files result; Files result;

View file

@ -78,6 +78,7 @@ public class LineIterator
* *
* @return true, if successful * @return true, if successful
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public boolean hasNext() throws IOException public boolean hasNext() throws IOException
{ {
@ -102,8 +103,9 @@ public class LineIterator
/** /**
* Next. * Next.
* *
* @return the http log * @return the string
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public String next() throws IOException public String next() throws IOException
{ {
@ -119,9 +121,10 @@ public class LineIterator
} }
/** /**
* Read next line. * Sets the ready.
* *
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
private void setReady() throws IOException private void setReady() throws IOException
{ {