com.sun.enterprise.server.logging.logviewer.backend
Class LogFile

java.lang.Object
  extended by com.sun.enterprise.server.logging.logviewer.backend.LogFile
All Implemented Interfaces:
java.io.Serializable

public class LogFile
extends java.lang.Object
implements java.io.Serializable

This class encapsulates the log file so that its details are not exposed. "getLongEntries" returns an unfiltered List of LogEntry objects from the requested record number. It will always search forward. getIndexSize() returns the number of records between each index. getLastIndexNumber returns the last index.

See Also:
Serialized Form

Nested Class Summary
 class LogFile.LogEntry
          Class to manage LogEntry information
 
Field Summary
static java.lang.String FIELD_SEPARATOR
           
static java.lang.String RECORD_BEGIN_MARKER
           
static java.lang.String RECORD_END_MARKER
           
 
Constructor Summary
LogFile(java.lang.String name)
          Constructor
 
Method Summary
protected  void buildLogFileIndex()
          This method builds the file index in the beginning.
protected  java.io.BufferedReader getFilePosition(long recordNumber)
          This method returns the file position given the record number.
 long getIndexSize()
           
 long getLastIndexNumber()
          The log records are indexed, this method returns the last index.
 java.util.List getLogEntries(long startingRecord)
          This method returns up to _indexSize records starting with the given record number.
 java.util.List getLogEntries(long startingRecord, long maxRecords)
          This method returns up to _indexSize records starting with the given record number.
 java.lang.String getLogFileName()
           
protected  java.io.BufferedReader getLogFileReader(long fromFilePosition)
          This method opens the server.log file and moves the stream to the specified filePosition.
 void setIndexSize(long indexSize)
          The number of records between indexes.
 void setLogFileName(java.lang.String filename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECORD_BEGIN_MARKER

public static final java.lang.String RECORD_BEGIN_MARKER
See Also:
Constant Field Values

RECORD_END_MARKER

public static final java.lang.String RECORD_END_MARKER
See Also:
Constant Field Values

FIELD_SEPARATOR

public static final java.lang.String FIELD_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

LogFile

public LogFile(java.lang.String name)
Constructor

Method Detail

getLogEntries

public java.util.List getLogEntries(long startingRecord)
This method returns up to _indexSize records starting with the given record number.

Parameters:
startingRecord - The starting point to search for LogEntries

getLogEntries

public java.util.List getLogEntries(long startingRecord,
                                    long maxRecords)
This method returns up to _indexSize records starting with the given record number. It will return up to "maxRecords" records.

Parameters:
startingRecord - The starting point to search for LogEntries
masRecords - The maximum number of records to return

buildLogFileIndex

protected void buildLogFileIndex()
This method builds the file index in the beginning. The index is for the beginning of every record after the size specified by '_indexSize' variable.


getFilePosition

protected java.io.BufferedReader getFilePosition(long recordNumber)
This method returns the file position given the record number.

Parameters:
recordNumber - The Record Number
Returns:
The file position.

getLogFileReader

protected java.io.BufferedReader getLogFileReader(long fromFilePosition)
This method opens the server.log file and moves the stream to the specified filePosition.


getLogFileName

public java.lang.String getLogFileName()

setLogFileName

public void setLogFileName(java.lang.String filename)

getLastIndexNumber

public long getLastIndexNumber()
The log records are indexed, this method returns the last index. It will ensure that the indexes are up-to-date.


getIndexSize

public long getIndexSize()

setIndexSize

public void setIndexSize(long indexSize)
The number of records between indexes. This is also used as the max number of records returned from getLogEntries(long).



Copyright © 2012 GlassFish Community. All Rights Reserved.