public class CustomSQLExceptionTranslatorRegistry
extends java.lang.Object
SQLExceptionTranslator
instances associated with
specific databases allowing for overriding translation based on values contained in the configuration file
named "sql-error-codes.xml".SQLErrorCodesFactory
Modifier and Type | Field and Description |
---|---|
private static CustomSQLExceptionTranslatorRegistry |
instance
Keep track of a single instance so we can return it to classes that request it.
|
private static Log |
logger |
private java.util.Map<java.lang.String,SQLExceptionTranslator> |
translatorMap
Map registry to hold custom translators specific databases.
|
Modifier | Constructor and Description |
---|---|
private |
CustomSQLExceptionTranslatorRegistry()
Create a new instance of the
CustomSQLExceptionTranslatorRegistry class. |
Modifier and Type | Method and Description |
---|---|
SQLExceptionTranslator |
findTranslatorForDatabase(java.lang.String dbName)
Find a custom translator for the specified database.
|
static CustomSQLExceptionTranslatorRegistry |
getInstance()
Return the singleton instance.
|
void |
registerTranslator(java.lang.String dbName,
SQLExceptionTranslator translator)
Register a new custom translator for the specified database name.
|
private static final Log logger
private static final CustomSQLExceptionTranslatorRegistry instance
private final java.util.Map<java.lang.String,SQLExceptionTranslator> translatorMap
SQLErrorCodesFactory
.private CustomSQLExceptionTranslatorRegistry()
CustomSQLExceptionTranslatorRegistry
class.
Not public to enforce Singleton design pattern.
public static CustomSQLExceptionTranslatorRegistry getInstance()
public void registerTranslator(java.lang.String dbName, SQLExceptionTranslator translator)
dbName
- the database nametranslator
- the custom translatorpublic SQLExceptionTranslator findTranslatorForDatabase(java.lang.String dbName)
dbName
- the database namenull
if none found