Holger's
Java API

com.antelmann.net
Class ServerLogFile

java.lang.Object
  extended by java.io.File
      extended by com.antelmann.io.MyFile
          extended by com.antelmann.net.ServerLogFile
All Implemented Interfaces:
Timed, Imageable, ServerLog, Serializable, Appendable, Comparable<File>

public class ServerLogFile
extends MyFile
implements ServerLog

ServerLogFile implements a web-server log based on a standard log file. If a given logfile format is different so that it cannot be parsed by this implementation, you can simply subclass this implementation and override the parseLine(String) method. This class also supports GZIP compressed files if they have the file extension "gz".

Author:
Holger Antelmann
See Also:
ServerLogEntry, Serialized Form

Nested Class Summary
protected  class ServerLogFile.ServerLogEntryEnumerator
           
 
Field Summary
protected  SimpleDateFormat dateFormat
           
 
Fields inherited from class com.antelmann.io.MyFile
DIRECTORIES_ONLY, FILES_ONLY
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Fields inherited from interface com.antelmann.calendar.Timed
COMPARATOR, DATE_EXTRACTOR
 
Constructor Summary
ServerLogFile(File file)
           
ServerLogFile(String fileName)
           
 
Method Summary
 Enumeration<ServerLogEntry> getServerLogEntryEnumerator(Filter<ServerLogEntry> filter)
          returns an Enumeration of all ServerLogEntry objects that are accepted by the given filter or all ServerLogEntries if the filter is null.
protected  ServerLogEntry parseLine(String line)
          parses a single line from the log file and constructs a ServerLogEntry (default parsing for Apache)
 
Methods inherited from class com.antelmann.io.MyFile
append, append, append, append, asFileFilter, asFilter, asLineIterable, clear, compareContent, compareContent, compress, compressTo, copyTo, copyTo, count, countLines, createTempDir, createTempDir, decrypt, digestMD5, digestSHA1, directoryCompare, directoryCompare, dirSize, encrypt, ensureExtension, fileCompareText, fileCompareText, getCharset, getContentAsBytes, getContentAsString, getContentAsString, getContentAsUTF8, getDisplayIcon, getDisplayImage, getFileExtension, getFileRelativeTo, getFileTypes, getIcon, getLineIterator, getLineIterator, getNameWithoutExtension, getRandomFile, getRandomFile, getTempDir, getTime, getTypeDescription, getUserHomeDir, getWorkingDir, hasParent, indexOf, indexOf, indexOf, isEmpty, isValidWindowsFilename, iterateFilesInTree, listFilesInTree, listFilesInTree, listFilesInTree, listFilesInTree, listSubDirs, loadObject, loadObject, loadProperties, objectEnumerator, objectEnumerator, objectEnumerator, removeTree, replace, replace, setCharset, storeProperties, stripToWindowsFilename, synchronizeDir, synchronizeDir, synchronizeDir, synchronizeDir, synchronizeDir, touch, uncompress, uncompressTo, unzipTo, unzipTo, unzipTo, unzipTo, writeBytes, writeln, writeObject, writeStackTrace, writeStackTrace, writeText, writeText, writeUTF8, zipTo, zipTo, zipTo
 
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

dateFormat

protected SimpleDateFormat dateFormat
Constructor Detail

ServerLogFile

public ServerLogFile(String fileName)

ServerLogFile

public ServerLogFile(File file)
Method Detail

getServerLogEntryEnumerator

public Enumeration<ServerLogEntry> getServerLogEntryEnumerator(Filter<ServerLogEntry> filter)
Description copied from interface: ServerLog
returns an Enumeration of all ServerLogEntry objects that are accepted by the given filter or all ServerLogEntries if the filter is null.

Specified by:
getServerLogEntryEnumerator in interface ServerLog
Returns:
an Enumeration of ServerLogEntry objects; note that there may be null values in the Enumeration, if the entry couldn't be properly parsed.
See Also:
ServerLogEntry

parseLine

protected ServerLogEntry parseLine(String line)
parses a single line from the log file and constructs a ServerLogEntry (default parsing for Apache)



(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads