@Override public void initialize(KeyValueStoreDescriptor descriptor) { super.initialize(descriptor); logger = new JDBCLogger(name); Map<String, String> properties = descriptor.properties; dataSourceName = properties.get(DATASOURCE_PROP); if (StringUtils.isAllBlank(dataSourceName)) { throw new NuxeoException("Missing " + DATASOURCE_PROP + " property in configuration"); } String tableProp = properties.get(TABLE_PROP); String namespace = descriptor.namespace; String tbl; if (isBlank(tableProp)) { tbl = defaultIfBlank(namespace, name).trim(); } else if (isBlank(namespace)) { tbl = tableProp.trim(); } else { tbl = tableProp.trim() + "_" + namespace.trim(); } // check connection, get dialect and create table if needed runWithConnection(connection -> { dialect = Dialect.createDialect(connection, null); getTable(connection, tbl); }); prepareSQL(); startTTLThread(); }
SQLDirectoryDescriptor descriptor = getDescriptor(); try (Connection sqlConnection = getConnection()) { dialect = Dialect.createDialect(sqlConnection, null);
dialect = Dialect.createDialect(connection, repositoryDescriptor); } catch (SQLException cause) { throw new NuxeoException("Cannot get connection from datasource: " + dataSourceName, cause);