Package de.businesscode.bcdui.logging
Class PageSqlLogger
- java.lang.Object
-
- de.businesscode.bcdui.toolbox.AWorkerQueue<T>
-
- de.businesscode.bcdui.logging.PageSqlLogger
-
public final class PageSqlLogger extends AWorkerQueue<T>
logsPageSqlLogger.LogRecord
into database, binding set used is bcd_log_page, this class is not intended to be customized or extended in projects. The existence of the binding-set enables this logger automatically.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PageSqlLogger.LogRecord
the result to log into database
-
Field Summary
-
Fields inherited from class de.businesscode.bcdui.toolbox.AWorkerQueue
DEFAULT_MAX_QUEUE_SIZE, log
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PageSqlLogger()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object[][]
convertData(java.util.Collection<PageSqlLogger.LogRecord> records)
processes given collection of type to dimensional object array to be consumed by batch SQLprotected int[]
executeStatement(java.lang.Object[][] params)
executes statement with raw parameters and returns number of updated rowsprotected javax.sql.DataSource
getDataSource()
static PageSqlLogger
getInstance()
protected java.lang.String
getSqlTemplate()
boolean
isEnabled()
as SQL logger we are depended on Bindings, which in turn use classes using us, so we dont participate in Binding bootstrap processprotected void
processObjects(java.util.Collection<T> records)
implement the method to process the objects polled from queue (FIFO)-
Methods inherited from class de.businesscode.bcdui.toolbox.AWorkerQueue
enqueue, onIdle, process, process, shutdownQueues
-
-
-
-
Method Detail
-
getInstance
public static PageSqlLogger getInstance()
-
getSqlTemplate
protected java.lang.String getSqlTemplate()
- Returns:
- SQL template for inserts (prepared statement compatible to process batch updates) this sql template is not intended to change and is cached so this function is called only once
-
convertData
protected java.lang.Object[][] convertData(java.util.Collection<PageSqlLogger.LogRecord> records)
processes given collection of type to dimensional object array to be consumed by batch SQL- Parameters:
records
-- Returns:
-
isEnabled
public boolean isEnabled()
as SQL logger we are depended on Bindings, which in turn use classes using us, so we dont participate in Binding bootstrap process- Returns:
-
processObjects
protected void processObjects(java.util.Collection<T> records)
Description copied from class:AWorkerQueue
implement the method to process the objects polled from queue (FIFO)- Specified by:
processObjects
in classAWorkerQueue<T>
- Parameters:
records
- to process
-
executeStatement
protected int[] executeStatement(java.lang.Object[][] params) throws java.sql.SQLException
executes statement with raw parameters and returns number of updated rows- Parameters:
params
-- Returns:
- The number of rows updated per statement
- Throws:
java.sql.SQLException
-
getDataSource
protected javax.sql.DataSource getDataSource()
- Returns:
- a datasource as referenced by the binding-set or the default datasource
- Throws:
java.lang.RuntimeException
- in case datasource name discovery via Bindings takes place whilst Bindings has not initialized yet.
-
-