Package org.nuxeo.ecm.core.storage
Class DBCheck
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.DBCheck
-
- All Implemented Interfaces:
BackingChecker
public class DBCheck extends Object implements BackingChecker
- Since:
- 9.2
- API Note:
- reworked in 11.5
-
-
Field Summary
Fields Modifier and Type Field Description protected static List<String>
DB_EXCLUDE_CHECK_LIST
protected static String
PARAM_DB_DRIVER
protected static String
PARAM_DB_HOST
protected static String
PARAM_DB_JDBC_URL
protected static String
PARAM_DB_NAME
protected static String
PARAM_DB_PORT
protected static String
PARAM_DB_PWD
protected static String
PARAM_DB_USER
-
Constructor Summary
Constructors Constructor Description DBCheck()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accepts(ConfigurationHolder configHolder)
Test if the check has to be done for the given configuration.void
check(ConfigurationHolder configHolder)
Test the availability of the backing service.void
checkDatabaseConnection(ConfigurationHolder configHolder)
Check driver availability and database connectionprotected Driver
lookupDriver(ConfigurationHolder configHolder, Path databaseTemplateDir, String classname)
Builds anURLClassLoader
for the given databaseTemplate looking in the templates directory and in the server lib directory, then looks for a driver-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.launcher.config.backingservices.BackingChecker
getDescriptor, getDescriptor, getDescriptor, getDescriptor
-
-
-
-
Field Detail
-
PARAM_DB_DRIVER
protected static final String PARAM_DB_DRIVER
- See Also:
- Constant Field Values
-
PARAM_DB_JDBC_URL
protected static final String PARAM_DB_JDBC_URL
- See Also:
- Constant Field Values
-
PARAM_DB_HOST
protected static final String PARAM_DB_HOST
- See Also:
- Constant Field Values
-
PARAM_DB_PORT
protected static final String PARAM_DB_PORT
- See Also:
- Constant Field Values
-
PARAM_DB_NAME
protected static final String PARAM_DB_NAME
- See Also:
- Constant Field Values
-
PARAM_DB_USER
protected static final String PARAM_DB_USER
- See Also:
- Constant Field Values
-
PARAM_DB_PWD
protected static final String PARAM_DB_PWD
- See Also:
- Constant Field Values
-
-
Method Detail
-
accepts
public boolean accepts(ConfigurationHolder configHolder)
Description copied from interface:BackingChecker
Test if the check has to be done for the given configuration.- Specified by:
accepts
in interfaceBackingChecker
- Parameters:
configHolder
- The current configuration- Returns:
- true if
BackingChecker.check(ConfigurationHolder)
has to be called.
-
check
public void check(ConfigurationHolder configHolder) throws ConfigurationException
Description copied from interface:BackingChecker
Test the availability of the backing service.- Specified by:
check
in interfaceBackingChecker
- Parameters:
configHolder
- The current configuration- Throws:
ConfigurationException
- if backing service is not available.
-
checkDatabaseConnection
public void checkDatabaseConnection(ConfigurationHolder configHolder) throws ConfigurationException, DatabaseDriverException, SQLException
Check driver availability and database connection
-
lookupDriver
protected Driver lookupDriver(ConfigurationHolder configHolder, Path databaseTemplateDir, String classname) throws DatabaseDriverException
Builds anURLClassLoader
for the given databaseTemplate looking in the templates directory and in the server lib directory, then looks for a driver- Parameters:
classname
- Driver class name, defined byPARAM_DB_DRIVER
- Returns:
- Driver driver if found, else an Exception must have been raised.
- Throws:
DatabaseDriverException
- If there was an error when trying to instantiate the driver.- Since:
- 5.6
-
-