de.hawlitzek.logparser
Class LogEntry

java.lang.Object
  |
  +--de.hawlitzek.logparser.LogEntry

public class LogEntry
extends java.lang.Object

This class represents one line in the http log. It parses the line into the fields for date, ip address, referrer etc. It also provides functionality to filter log entries by type, occurring names and search engines.

Author:
Florian Hawlitzek, Hawlitzek IT-Consulting GmbH

Constructor Summary
LogEntry()
           
 
Method Summary
 java.lang.String getBrowser()
          Gets the browser
 java.lang.String getClientIP()
          Gets the clientIP
 java.util.Date getDate()
          Gets the date
 java.lang.String getHttpMethod()
          Gets the httpMethod
 java.lang.String getPage()
          Gets the page
 java.lang.String getReferrer()
          Gets the referrer
 java.lang.String getReturncode()
          Gets the returncode
 boolean isGet()
          checks, if a log entry belongs to a http GET request
 boolean isHtml()
          checks, if a log entry is referring to an html page
 boolean isImage()
          checks, if a log entry is referring to an image
 boolean isMainPage()
          special function for NetObjects fusion generated sites checks, if a log entry is main html page or a sub frame
 boolean isOk()
          checks, if the requested page could be delivered
 boolean matches(java.lang.String type, java.lang.String[] filter)
          checks, if a log entry matches to a given filter
 java.lang.String[] parseAltavistaKeywords()
          searches for altavista keywords
 java.lang.String[] parseFireballKeywords()
          searches for fireball keywords
 java.lang.String[] parseGoogleKeywords()
          searches for google keywords
static java.lang.String parseLine(java.lang.String line)
          parses a line in the (log entry) an return the used browser type (fast method without creating LogEntry instances, only for detecting the browser type)
static java.lang.String parseLine(java.lang.String line, LogEntry logEntry)
          parses a line in the (log entry) an return the used browser type If a LogEntry instance is provided, the instance is filled with the entries detail data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogEntry

public LogEntry()
Method Detail

isHtml

public boolean isHtml()
checks, if a log entry is referring to an html page


isImage

public boolean isImage()
checks, if a log entry is referring to an image


isMainPage

public boolean isMainPage()
special function for NetObjects fusion generated sites checks, if a log entry is main html page or a sub frame


matches

public boolean matches(java.lang.String type,
                       java.lang.String[] filter)
checks, if a log entry matches to a given filter

Parameters:
type - type of the search: HTML: only html pages, MAIN: only main html pages IMG: only images REF: look in referrer, not in requested ressource : in all ressource
filter - set of AND combined search items

isGet

public boolean isGet()
checks, if a log entry belongs to a http GET request


getBrowser

public java.lang.String getBrowser()
Gets the browser

Returns:
Returns a String

getClientIP

public java.lang.String getClientIP()
Gets the clientIP

Returns:
Returns a String

getDate

public java.util.Date getDate()
Gets the date

Returns:
Returns a java.util.Date

getHttpMethod

public java.lang.String getHttpMethod()
Gets the httpMethod

Returns:
Returns a String

getPage

public java.lang.String getPage()
Gets the page

Returns:
Returns a String

getReferrer

public java.lang.String getReferrer()
Gets the referrer

Returns:
Returns a String

getReturncode

public java.lang.String getReturncode()
Gets the returncode

Returns:
Returns a String

isOk

public boolean isOk()
checks, if the requested page could be delivered


parseLine

public static java.lang.String parseLine(java.lang.String line)
                                  throws InvalidLogEntryException
parses a line in the (log entry) an return the used browser type (fast method without creating LogEntry instances, only for detecting the browser type)

Parameters:
line - one line in an http log file
Returns:
String browser
InvalidLogEntryException

parseLine

public static java.lang.String parseLine(java.lang.String line,
                                         LogEntry logEntry)
                                  throws InvalidLogEntryException
parses a line in the (log entry) an return the used browser type If a LogEntry instance is provided, the instance is filled with the entries detail data

Parameters:
line - one line in an http log file
logEntry - object to be filled
Returns:
String browser
InvalidLogEntryException

parseGoogleKeywords

public java.lang.String[] parseGoogleKeywords()
searches for google keywords


parseFireballKeywords

public java.lang.String[] parseFireballKeywords()
searches for fireball keywords


parseAltavistaKeywords

public java.lang.String[] parseAltavistaKeywords()
searches for altavista keywords