planetj.database.connection
Class ConnectionPoolReportDescriptor

java.lang.Object
  |
  +--java.util.TimerTask
        |
        +--planetj.database.connection.ConnectionPoolReportDescriptor
All Implemented Interfaces:
Runnable

public class ConnectionPoolReportDescriptor
extends TimerTask

Describes how connection pool reports should be generated. To begin generating reports, first set the alias of the connection pool to generate reports on, and then pass the ConnectionPoolReportDescriptor to the DatabaseManager.beginReportMonitoring() method. This will cause a report about the connection pool to be generated at fixed intervals, and written out to a text file. An additional report is generated when the connection pool is closed.

A given connection pool can only have one associated ConnectionPoolReportDescriptor generating reports for it at one time.


Field Summary
static byte FILE_APPEND
          Indicates reports should be written to the same file, appended on to that file if it already exists
static byte FILE_OVERWRITE
          Indicates reports should be written to the same file, overwritting that file each time
static byte FILE_SEPARATE
          Indicates reports should be written to separate files
static String STATEMENTS_ALL
          Indicates that details of SQL statements should not be included in the report
static String STATEMENTS_NONE
          Indicates that details of all SQL statements should be included in the report
 
Constructor Summary
ConnectionPoolReportDescriptor()
          ConnectionPoolReportDescriptor constructor
ConnectionPoolReportDescriptor(ConnectionReportPropertyGroup properties)
          ConnectionPoolReportDescriptor constructor
 
Method Summary
 boolean cancel()
          Disconnects this report descriptor from its connection pool - no further reports will be generated by this report descriptor.
 String getAlias()
          Gets the alias of the connection pool for which reports should be generated.
 String getFileName()
          Gets the file name to save reports under.
 byte getFileWriteType()
          Tests what type of file writing should be used.
 ConnectionPoolReport getLastReport()
          Gets the last report generated by this report descriptor
 int getReportInterval()
          Gets the approximate number of seconds to wait between reports.
 List getSQLStatements()
          Gets the list of SQL statements to include in the report.
 boolean isActive()
          Tests if this report descriptor is currently attached to a connection pool, and will periodically generate reports about that connection pool.
 boolean isCumulative()
          Tests if each report should begin where the last report left off (the default), or if each report should be cumulative, containing all information generated since the connection pool was created.
 boolean isImmediateReportRequired()
          Tests if the first report should be generated immediately after this object is passed to the DatabaseManager.beginReportMonitoring() method.
 boolean isLocked()
          Tests if this object is locked.
 void run()
          This is an internal method, and should only be invoked by the DataEngine.
 void setAlias(String newAlias)
          Sets the alias of the connection pool for which reports should be generated.
 void setCumulative(boolean newCumulative)
          Sets if each report should begin where the last report left off (the default), or if each report should be cumulative, containing all information generated since the connection pool was created.
 void setFileName(String newFileName)
          Sets the file name to save reports under.
 void setFileWriteType(byte newFileType)
          Sets what type of file writing should be used.
 void setImmediateReportRequired(boolean newImmediateReportRequired)
          Sets if the first report should be generated immediately after this object is passed to the DatabaseManager.beginReportMonitoring() method.
 void setProperties(ConnectionReportPropertyGroup properties)
          Sets the values of this report descriptor
 void setReportInterval(int newReportInterval)
          Sets the approximate number of seconds to wait between reports.
 void setSQLStatements(List newSQLStatements)
          Sets the list of SQL statements to include in the report.
 void writeReport(ConnectionPoolReport report)
          Writes the report out to the file.
 
Methods inherited from class java.util.TimerTask
scheduledExecutionTime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_SEPARATE

public static final byte FILE_SEPARATE
Indicates reports should be written to separate files

See Also:
Constant Field Values

FILE_OVERWRITE

public static final byte FILE_OVERWRITE
Indicates reports should be written to the same file, overwritting that file each time

See Also:
Constant Field Values

FILE_APPEND

public static final byte FILE_APPEND
Indicates reports should be written to the same file, appended on to that file if it already exists

See Also:
Constant Field Values

STATEMENTS_ALL

public static final String STATEMENTS_ALL
Indicates that details of SQL statements should not be included in the report

See Also:
Constant Field Values

STATEMENTS_NONE

public static final String STATEMENTS_NONE
Indicates that details of all SQL statements should be included in the report

See Also:
Constant Field Values
Constructor Detail

ConnectionPoolReportDescriptor

public ConnectionPoolReportDescriptor()
ConnectionPoolReportDescriptor constructor


ConnectionPoolReportDescriptor

public ConnectionPoolReportDescriptor(ConnectionReportPropertyGroup properties)
ConnectionPoolReportDescriptor constructor

Method Detail

cancel

public boolean cancel()
Disconnects this report descriptor from its connection pool - no further reports will be generated by this report descriptor. (If a report is currently being generated, it will not be affected by the invocation of this method.)

Overrides:
cancel in class TimerTask
Returns:
true if invoking this method actually prevents future reports from being generated, false if this report descriptor was not attached to a connection pool in the first place.

getAlias

public String getAlias()
Gets the alias of the connection pool for which reports should be generated. Only one report descriptor can be attached to a connection pool at one time.


getFileName

public String getFileName()
Gets the file name to save reports under. If the overwriteFile property is false, then a date-timestamp will be appended onto this value each time a report file is saved.


getFileWriteType

public byte getFileWriteType()
Tests what type of file writing should be used. Constants are defined in this class


getLastReport

public ConnectionPoolReport getLastReport()
Gets the last report generated by this report descriptor


getReportInterval

public int getReportInterval()
Gets the approximate number of seconds to wait between reports. This must be at least 300 (5 minutes). The default value is 3600 (one hour).


getSQLStatements

public List getSQLStatements()
Gets the list of SQL statements to include in the report. By default, this List is empty (no SQL details will be included). If this is null the details of all SQL statements will be included in the report.


isActive

public boolean isActive()
Tests if this report descriptor is currently attached to a connection pool, and will periodically generate reports about that connection pool.


isCumulative

public boolean isCumulative()
Tests if each report should begin where the last report left off (the default), or if each report should be cumulative, containing all information generated since the connection pool was created.


isImmediateReportRequired

public boolean isImmediateReportRequired()
Tests if the first report should be generated immediately after this object is passed to the DatabaseManager.beginReportMonitoring() method. By default, the first report is only generated after the reportInterval number of seconds has passed


isLocked

public boolean isLocked()
Tests if this object is locked. Once the DatabaseManager.beginReportMonitoring() method is invoked with this object, it becomes locked, and cannot be altered.


run

public void run()
This is an internal method, and should only be invoked by the DataEngine. Runs the report functionality, creating and writing a report about the current state of the connection pool

Specified by:
run in interface Runnable
Specified by:
run in class TimerTask

setAlias

public void setAlias(String newAlias)
Sets the alias of the connection pool for which reports should be generated. Only one report descriptor can be attached to a connection pool at one time.


setCumulative

public void setCumulative(boolean newCumulative)
Sets if each report should begin where the last report left off (the default), or if each report should be cumulative, containing all information generated since the connection pool was created.


setFileName

public void setFileName(String newFileName)
Sets the file name to save reports under. If the overwriteFile property is false, then a date-timestamp will be appended onto this value each time a report file is saved.


setFileWriteType

public void setFileWriteType(byte newFileType)
Sets what type of file writing should be used. Constants are defined in this class


setImmediateReportRequired

public void setImmediateReportRequired(boolean newImmediateReportRequired)
Sets if the first report should be generated immediately after this object is passed to the DatabaseManager.beginReportMonitoring() method. By default, the first report is only generated after the reportInterval number of seconds has passed


setProperties

public void setProperties(ConnectionReportPropertyGroup properties)
Sets the values of this report descriptor


setReportInterval

public void setReportInterval(int newReportInterval)
Sets the approximate number of seconds to wait between reports. This must be at least 300 (5 minutes). The default value is 3600 (one hour).


setSQLStatements

public void setSQLStatements(List newSQLStatements)
Sets the list of SQL statements to include in the report. By default, this List is empty (no SQL details will be included). If this is null the details of all SQL statements will be included in the report.


writeReport

public void writeReport(ConnectionPoolReport report)
                 throws CMException
Writes the report out to the file. Normally this method only needs to be invoked by the DataEngine

CMException