All Packages    This Package  Previous  Next  

Class sqlj.runtime.profile.util.PrintWriterAuditor

java.lang.Object
   |
   +----sqlj.runtime.profile.util.PrintWriterAuditor

public class PrintWriterAuditor
extends Object
implements Auditor
A print writer auditor implements the auditor interface by logging all registered method calls, returns and exceptions to a particular print writer.


Constructor Index

 o PrintWriterAuditor(PrintWriter)
Creates a new auditor which will log to the passed print writer.
 o PrintWriterAuditor(PrintWriter, String)
Creates a new auditor which will log to the passed print writer.

Method Index

 o registerCall(Object, String, Object[])
Registers the call by logging it to the underlying print writer.
 o registerException(Object, String, Exception)
Registers the exception by logging it to the underlying print writer.
 o registerReturn(Object, String, Object)
Registers the return by logging it to the underlying print writer.

Constructors

 o PrintWriterAuditor
 public PrintWriterAuditor(PrintWriter ps)
Creates a new auditor which will log to the passed print writer. All logs will be written with no prefix.

Parameters:
ps - the print writer into which registers calls will be logged.
 o PrintWriterAuditor
 public PrintWriterAuditor(PrintWriter ps,
                           String prefix)
Creates a new auditor which will log to the passed print writer. All logs will be prefixed with the given prefix string.

Parameters:
ps - the print writer into which registers calls will be logged.
prefix - the prefix of each log entry for this auditor.

Methods

 o registerCall
 public void registerCall(Object obj,
                          String methodName,
                          Object args[])
Registers the call by logging it to the underlying print writer. The object is printed followed by a dot followed by the method name followed by a comma-seperated list of arguments enclosed in parenthisis: obj.method(arg1,...).

The value of an object is printed using the toString() method of that object. If the object uses the default toString() method, then the hexadecimal hashCode part of the string returned is replaced by a monotonically increasing integer uniquely identifying the object (amongst those objects using the default toString method). This stategy is used rather than printing the hashCode so that audit logs are more likely to be the same between program runs.

 o registerReturn
 public void registerReturn(Object obj,
                            String methodName,
                            Object returnVal)
Registers the return by logging it to the underlying print writer. The object is printed followed by a dot followed by the method name followed by the text "returned" followed by the return value: obj.method returned result.

The value of an object is printed using the toString() method of that object. If the object uses the default toString() method, then the hexadecimal hashCode part of the string returned is replaced by a monotonically increasing integer uniquely identifying the object (amongst those objects using the default toString method). This stategy is used rather than printing the hashCode so that audit logs are more likely to be the same between program runs.

 o registerException
 public void registerException(Object obj,
                               String methodName,
                               Exception e)
Registers the exception by logging it to the underlying print writer. The object is printed followed by a dot followed by the method name followed by the text "threw exception" followed by the exception itself: obj.method threw exception e.

The value of an object is printed using the toString() method of that object. If the object uses the default toString() method, then the hexadecimal hashCode part of the string returned is replaced by a monotonically increasing integer uniquely identifying the object (amongst those objects using the default toString method). This stategy is used rather than printing the hashCode so that audit logs are more likely to be the same between program runs.


All Packages    This Package  Previous  Next