Class AbstractSQLExceptionHandler

java.lang.Object
net.solarnetwork.node.dao.jdbc.AbstractSQLExceptionHandler
All Implemented Interfaces:
net.solarnetwork.dao.jdbc.SQLExceptionHandler
Direct Known Subclasses:
ResetSQLExceptionHandler, RestoreFromBackupSQLExceptionHandler, ShutdownSQLExceptionHandler

public abstract class AbstractSQLExceptionHandler extends Object implements net.solarnetwork.dao.jdbc.SQLExceptionHandler
Base SQLExceptionHandler with SQL state filtering support.
Since:
2.5
Version:
1.0
Author:
matt
  • Field Details

    • log

      protected final org.slf4j.Logger log
      A class-level logger.
  • Constructor Details

    • AbstractSQLExceptionHandler

      public AbstractSQLExceptionHandler()
  • Method Details

    • exceptionMatchingSqlStatePattern

      protected SQLException exceptionMatchingSqlStatePattern(SQLException e)
      See if the root SQL exception's state value matches any configured SQL State pattern.

      This will search the getSqlStatePatterns() list and return the first one that matches the exception's SQLException.getSQLState() value of the root SQL exception.

      Parameters:
      e - the exception to compare
      Returns:
      the root exception that matched a pattern, or null if none match or no patterns are configured
    • getSqlStatePatterns

      public List<Pattern> getSqlStatePatterns()
      Get the list of regular expressions that should trigger an action by this handler.
      Returns:
      the list of regular expressions
    • setSqlStatePatterns

      public void setSqlStatePatterns(List<Pattern> sqlStatePatterns)
      Set a list of regular expressions that should trigger an action by this handler.
      Parameters:
      sqlStatePatterns - the regular expressions that should trigger an action
    • setSqlStateRegex

      public void setSqlStateRegex(String regexes)
      Set a comma-delimited list of regular expressions that should trigger an action by this handler.
      Parameters:
      regexes - a comma-delimited list of regular expressions that should trigger an action
      See Also: