Class Pr_log

java.lang.Object
  |
  +--Pr_log

public class Pr_log
extends java.lang.Object


Field Summary
protected  java.lang.String hcg_logfile
           
protected static java.io.BufferedWriter hcg_logfileptr
           
protected  Database theSchema
           
 
Constructor Summary
Pr_log(Database newSchema)
          Constructor
 
Method Summary
 boolean log_do_add(java.lang.String line)
          This method adds a record into a table in the database.
 boolean log_do_delete(java.lang.String pkey)
          This method deletes a row in the table.
 void log_do_set_float(java.lang.String pkey, java.lang.String fieldname, float newVal)
          This method sets a float field in any row of a table
 void log_do_set_int(java.lang.String pkey, java.lang.String fieldname, int newVal)
          This method sets an integer field in any row of a table
 void log_do_set_str(java.lang.String pkey, java.lang.String fieldname, java.lang.String newVal)
          This method sets a String field in any row of a table
 void log_sleep(long msecs)
          This method pauses the execution of the program for the specified amount of time
static void logstr(java.lang.String text)
          This method writes the given string into the log file
static void logwait()
          This method computes the wait time between the log events, updates the wait time and posts the wait log entry to the log file
 boolean pr_replay(java.lang.String logfile, int near_realtime, int take_endsnapshot)
          Function: pr_replay This method is used to replay a logsession based on a log file.
 boolean pr_startlog(java.lang.String file_name)
          This method is used to start a logging session.
 boolean pr_stoplog(boolean dump_flag)
          This method is used to stop a logging session.
 boolean replay_log(java.lang.String logfile, int near_realtime)
          This method is used to parse the logfile and execute the action of the log entry.
static void time_initialize()
          Sets the timestamp global with the current time and clear the time_flag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hcg_logfileptr

protected static java.io.BufferedWriter hcg_logfileptr

hcg_logfile

protected java.lang.String hcg_logfile

theSchema

protected Database theSchema
Constructor Detail

Pr_log

public Pr_log(Database newSchema)
Constructor

Method Detail

logstr

public static void logstr(java.lang.String text)
This method writes the given string into the log file

Parameters:
text - - contains the string to be printed to the log file. This function writes the text string to the logfile if logging is active

time_initialize

public static void time_initialize()
Sets the timestamp global with the current time and clear the time_flag


logwait

public static void logwait()
This method computes the wait time between the log events, updates the wait time and posts the wait log entry to the log file


log_sleep

public void log_sleep(long msecs)
This method pauses the execution of the program for the specified amount of time

Parameters:
msecs - - the time to sleep in milliseconds

pr_startlog

public boolean pr_startlog(java.lang.String file_name)
This method is used to start a logging session. It opens a logfile and dumps a current copy of the database Returns true if successful else false


pr_stoplog

public boolean pr_stoplog(boolean dump_flag)
This method is used to stop a logging session. It optionally dumps a current copy of the database and closes the logfile Returns true if successful, false if any error


log_do_add

public boolean log_do_add(java.lang.String line)
This method adds a record into a table in the database.

Parameters:
line - - A String which contains the data to be added to the table. - It should be a space seperated string of field values. Returns boolean - true if successful false if unsuccessful

log_do_delete

public boolean log_do_delete(java.lang.String pkey)
This method deletes a row in the table.

Parameters:
pkey - - the primary key of the row to be deleted Returns boolean - true if successful - False if unsuccessful

log_do_set_int

public void log_do_set_int(java.lang.String pkey,
                           java.lang.String fieldname,
                           int newVal)
This method sets an integer field in any row of a table

Parameters:
pkey - - the Primary key of the row in which the field value is to be changed
fieldname - - The name of the field whose value is to be changed
newVal - - The new value to be changed to

log_do_set_float

public void log_do_set_float(java.lang.String pkey,
                             java.lang.String fieldname,
                             float newVal)
This method sets a float field in any row of a table

Parameters:
pkey - - the Primary key of the row in which the field value is to be changed
fieldname - - The name of the field whose value is to be changed
newVal - - The new value to be changed to

log_do_set_str

public void log_do_set_str(java.lang.String pkey,
                           java.lang.String fieldname,
                           java.lang.String newVal)
This method sets a String field in any row of a table

Parameters:
pkey - - the Primary key of the row in which the field value is to be changed
fieldname - - The name of the field whose value is to be changed
newVal - - The new value to be changed to

replay_log

public boolean replay_log(java.lang.String logfile,
                          int near_realtime)
This method is used to parse the logfile and execute the action of the log entry.

Parameters:
logfile - - logfile to replay
near_realtime - - flag indicates to replay in near realtime 0 = not real time 1 = real time Returns True if successful, false if any error

pr_replay

public boolean pr_replay(java.lang.String logfile,
                         int near_realtime,
                         int take_endsnapshot)
Function: pr_replay This method is used to replay a logsession based on a log file. It will destroy the current database, replace the DB from the start of the log session, reproduce the DB modifications based on the logfile.

Parameters:
logfile - - the name of the logfile to replay
near_realtime - - a boolean flag indicating if the replay should approx realtime 0 - no near_realtime playback 1 - playback in near-realtime
take_endsnapshot - - a boolean flag indicating if the database should be dumped at the end of the replay. 0 - do not take the end DB snapshot 1 - take the end DB snapshot Return true if successful, false otherwise