Class ErrorSqlLogger

java.lang.Object
de.businesscode.bcdui.toolbox.AWorkerQueue<T>
de.businesscode.bcdui.logging.ErrorSqlLogger

public final class ErrorSqlLogger extends AWorkerQueue<T>
logs ErrorSqlLogger.LogRecord into database, binding set used is bcd_log_error, this class is not intended to be customized or extended in projects. The existence of the binding-set enables this logger automatically.
  • Constructor Details

    • ErrorSqlLogger

      protected ErrorSqlLogger()
  • Method Details

    • getInstance

      public static ErrorSqlLogger getInstance()
    • getSqlTemplate

      protected 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 Object[][] convertData(Collection<ErrorSqlLogger.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(Collection<ErrorSqlLogger.LogRecord> records)
      Description copied from class: AWorkerQueue
      implement the method to process the objects polled from queue (FIFO)
      Specified by:
      processObjects in class AWorkerQueue<T>
      Parameters:
      records - to process
    • executeStatement

      protected int[] executeStatement(Object[][] params) throws SQLException
      executes statement with raw parameters and returns number of updated rows
      Parameters:
      params -
      Returns:
      The number of rows updated per statement
      Throws:
      SQLException
    • getDataSource

      protected DataSource getDataSource()
      Returns:
      a datasource as referenced by the binding-set or the default datasource
      Throws:
      RuntimeException - in case datasource name discovery via Bindings takes place whilst Bindings has not initialized yet.