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;
}
/**
* Gets the datetime.
*
* @return the datetime
*/
public OnOffOption getDatetime()
{
return this.datetime;
}
/**
* Gets the ip.
*
* @return the ip
*/
public OnOffOption getIp()
{
return this.ip;
}
/**
* Gets the user.
*
* @return the user
*/
public OnOffOption getUser()
{
return this.user;
}
/**
* Gets the user agent.
*
* @return the user agent
*/
public OnOffOption getUserAgent()
{
return this.userAgent;
}
/**
* Sets the datetime.
*
* @param datetime
* the new datetime
*/
public void setDatetime(final OnOffOption datetime)
{
this.datetime = datetime;
}
/**
* Sets the ip.
*
* @param ip
* the new ip
*/
public void setIp(final OnOffOption ip)
{
this.ip = ip;
}
/**
* Sets the user.
*
* @param user
* the new user
*/
public void setUser(final OnOffOption user)
{
this.user = user;
}
/**
* Sets the user agent.
*
* @param userAgent
* the new user agent
*/
public void setUserAgent(final OnOffOption userAgent)
{
this.userAgent = userAgent;

View file

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

View file

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

View file

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

View file

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

View file

@ -156,6 +156,15 @@ public final class Ipv4Generator
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)
{
int result;

View file

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

View file

@ -59,6 +59,7 @@ public final class LogFile
* the file
* @return the parser
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static LineParser getParser(final File file) throws IOException
{
@ -101,6 +102,7 @@ public final class LogFile
* the file
* @return the type
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static String getType(final File file) throws IOException
{
@ -187,6 +189,8 @@ public final class LogFile
* @param file
* the file
* @return the string
* @throws IOException
* Signals that an I/O exception has occurred.
*/
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
{
/**
* Gets the mime.
*
* @return the mime
*/
String getMime();
/**
* Gets the type.
*
* @return the type
*/
LogType getType();
/**
* Parses the.
*
* @param line
* the line
* @return the log
*/
Log parse(String line);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -78,21 +78,41 @@ public final class UserAgentStator
}
}
/**
* Gets the ips.
*
* @return the ips
*/
public Ips getIps()
{
return this.ips;
}
/**
* Gets the ip user agents.
*
* @return the ip user agents
*/
public IpUserAgents getIpUserAgents()
{
return this.ipUserAgents;
}
/**
* Gets the log count.
*
* @return the log count
*/
public long getLogCount()
{
return this.logCount;
}
/**
* Gets the user agents.
*
* @return the user agents
*/
public UserAgents getUserAgents()
{
return this.userAgents;
@ -114,6 +134,12 @@ public final class UserAgentStator
this.ipUserAgents.put(log.getIp(), userAgent);
}
/**
* Save ip list.
*
* @param target
* the target
*/
public void saveIpList(final File target)
{
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)
{
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)
{
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)
{
PrintWriter out = null;
@ -201,6 +245,9 @@ public final class UserAgentStator
}
}
/**
* Shrink.
*/
public void shrink()
{
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();
}
/**
* Put.
*
* @param userAgent
* the user agent
*/
public void put(final String userAgent)
{
UserAgent stat = get(userAgent);
@ -52,6 +58,12 @@ public final class UserAgents extends HashMap<String, UserAgent>
stat.inc();
}
/**
* Put.
*
* @param userAgent
* the user agent
*/
public void put(final UserAgent userAgent)
{
this.put(userAgent.getValue(), userAgent);

View file

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

View file

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

View file

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