cs1705.weblog
Interface LogAnalyzer


public interface LogAnalyzer

An interface for a web server log analyzer that processes web log data analyses hourly and weekly access patterns. This interface is based on the web log analyzer from Chapter 4 of Objects First with Java, by David J. Barnes and Michael Kolling.

Version:
2003.11.02
Author:
Stephen Edwards

Method Summary
 int accessCountsForDay(int day)
          Retrieve a count of web accesses for the specified day of the week.
 int accessCountsForDayHour(int day, int hour)
          Retrieve a count of web accesses for the specified time period.
 int accessCountsForHour(int hour)
          Retrieve a count of web accesses during the specified hour of the day.
 void accumulateLogData(BufferedReader inStream)
          Add all log entries from a given stream to the current access pattern data.
 void accumulateLogDataFromFile(String file)
          Add all log entries from a given file to the current access pattern data.
 void accumulateLogDataFromURL(String url)
          Add all log entries from a given URL to the current access pattern data.
 

Method Detail

accessCountsForDay

int accessCountsForDay(int day)
Retrieve a count of web accesses for the specified day of the week. The day of the week is specified by using a Calendar day constant (e.g., Calendar.SUNDAY ... Calendar.SATURDAY).

Parameters:
day - the weekday for which accesses are reported
Returns:
a count of all logged accesses occuring on the given day of the week

accessCountsForDayHour

int accessCountsForDayHour(int day,
                           int hour)
Retrieve a count of web accesses for the specified time period. The time period is specified by giving a day of the week using a Calendar day constant (e.g., Calendar.SUNDAY ... Calendar.SATURDAY), and an hour of the day (0-23).

Parameters:
day - the weekday for which accesses are reported
hour - the hour of the given day
Returns:
a count of all logged accesses occuring during the specified hour on the given day of the week

accessCountsForHour

int accessCountsForHour(int hour)
Retrieve a count of web accesses during the specified hour of the day.

Parameters:
hour - the hour to report on (0-23)
Returns:
a count of all logged accesses occuring during the specified hour, over all days that have been logged

accumulateLogData

void accumulateLogData(BufferedReader inStream)
Add all log entries from a given stream to the current access pattern data. Multiple logs can be combined by calling this method multiple times.

Parameters:
inStream - the stream to read log entries from

accumulateLogDataFromFile

void accumulateLogDataFromFile(String file)
Add all log entries from a given file to the current access pattern data. This is a convenience method that provides the same features as accumulateLogData(BufferedReader), but by taking a file name instead.

Parameters:
file - the file to read log entries from

accumulateLogDataFromURL

void accumulateLogDataFromURL(String url)
Add all log entries from a given URL to the current access pattern data. This is a convenience method that provides the same features as accumulateLogData(BufferedReader), but by taking a URL instead.

Parameters:
url - the URL to read log entries from