home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Sample.bin
/
LogRecord.java
< prev
next >
Wrap
Text File
|
1998-11-05
|
3KB
|
68 lines
// Copyright (c) 1997, 1998 Symantec, Inc. All Rights Reserved.
import java.io.Serializable;
/*
This class holds the results of one parsed log file line.
It implements the Sortable interface so that it may be sorted with
the quicksort utility method.
It was written manually.
It has no UI code.
*/
public class LogRecord implements Serializable, Sortable {
// Parse line results
public String remoteHost; // domain name/IP address of host requesting pages
public String remoteUserLogname; // name of remote user
public String authenticatedUserName;// the user authenticated namae
public long requestTimestamp; // time the request was made
public String clientRequest; // the request that was made
public int httpStatusCode; // the request HTTP result code
/* Unused in analysis so no need to have:
public int bytesTransferred;
public String referringURL;
public String userAgent; // browser/agent info
public boolean bExtraText; // There is extra text at the end of this line (ignored)
*/
// Constructs a log record, initializing its fields from the given log parse record.
public LogRecord(LogFile.Parser.LogParseRecord logParseRec) {
remoteHost = logParseRec.remoteHost.toString();
remoteUserLogname = logParseRec.remoteUserLogname.toString();
authenticatedUserName = logParseRec.authenticatedUserName.toString();
requestTimestamp = logParseRec.requestTimestamp;
clientRequest = logParseRec.clientRequest.toString();
httpStatusCode = logParseRec.httpStatusCode;
/* Unused in analysis so no need to have:
bytesTransferred = logParseRec.bytesTransferred;
referringURL = logParseRec.referringURL.toString();
userAgent = logParseRec.userAgent.toString();
bExtraText = logParseRec.bExtraText;
*/
//{{INIT_CONTROLS
//}}
}
// -- Implement the Sortable interface
// A Sortable interface method.
// Returns true if this "is before" the given obj
public boolean isLessThan(Object obj) {
if(obj instanceof LogRecord) {
LogRecord r = (LogRecord)obj;
return requestTimestamp > r.requestTimestamp;
}
return false;
}
// A Sortable interface method.
// Returns true if this "is before or equal to" the given obj
public boolean isLessThanOrEqual(Object obj) {
if(obj instanceof LogRecord) {
LogRecord r = (LogRecord)obj;
return requestTimestamp >= r.requestTimestamp;
}
return false;
}
//{{DECLARE_CONTROLS
//}}
}