if (databaseType == null) {
if (dataSourceName != null) {
try {
databaseType = connectionFactory.getDataBaseType(dataSourceName);
} catch (RepositoryException e) {
throw new DataStoreException(e);
}
} else {
if (!url.startsWith("jdbc:")) {
return;
}
int start = "jdbc:".length();
int end = url.indexOf(':', start);
databaseType = url.substring(start, end);
}
} else {
failIfNotFound = true;
}
InputStream in =
DbDataStore.class.getResourceAsStream(databaseType + ".properties");
if (in == null) {
if (failIfNotFound) {
String msg =
"Configuration error: The resource '" + databaseType
+ ".properties' could not be found;"
+ " Please verify the databaseType property";
log.debug(msg);
throw new DataStoreException(msg);
} else {
return;
}
}
Properties prop = new Properties();
try {
try {
prop.load(in);
} finally {
in.close();
}
} catch (IOException e) {
String msg = "Configuration error: Could not read properties '" + databaseType + ".properties'";
log.debug(msg);
throw new DataStoreException(msg, e);
}
if (driver == null) {
driver = getProperty(prop, "driver", driver);
}
tableSQL = getProperty(prop, "table", tableSQL);
createTableSQL = getProperty(prop, "createTable", createTableSQL);
insertTempSQL = getProperty(prop, "insertTemp", insertTempSQL);
updateDataSQL = getProperty(prop, "updateData", updateDataSQL);
updateLastModifiedSQL = getProperty(prop, "updateLastModified", updateLastModifiedSQL);
updateSQL = getProperty(prop, "update", updateSQL);
deleteSQL = getProperty(prop, "delete", deleteSQL);
deleteOlderSQL = getProperty(prop, "deleteOlder", deleteOlderSQL);
selectMetaSQL = getProperty(prop, "selectMeta", selectMetaSQL);
selectAllSQL = getProperty(prop, "selectAll", selectAllSQL);
selectDataSQL = getProperty(prop, "selectData", selectDataSQL);
storeStream = getProperty(prop, "storeStream", storeStream);
if (STORE_SIZE_MINUS_ONE.equals(storeStream)) {
} else if (STORE_TEMP_FILE.equals(storeStream)) {
} else if (STORE_SIZE_MAX.equals(storeStream)) {
} else {
String msg = "Unsupported Stream store mechanism: " + storeStream
+ " supported are: " + STORE_SIZE_MINUS_ONE + ", "
+ STORE_TEMP_FILE + ", " + STORE_SIZE_MAX;
log.debug(msg);
throw new DataStoreException(msg);
}
}