private static synchronized Database getDatabaseObject(String type,
String path, HsqlProperties props) {
Database db;
String key = path;
HashMap databaseMap;
if (type == DatabaseURL.S_FILE) {
databaseMap = fileDatabaseMap;
key = filePathToKey(path);
} else if (type == DatabaseURL.S_RES) {
databaseMap = resDatabaseMap;
} else if (type == DatabaseURL.S_MEM) {
databaseMap = memDatabaseMap;
} else {
throw Error.runtimeError(ErrorCode.U_S0500,
"DatabaseManager.getDatabaseObject");
}
db = (Database) databaseMap.get(key);
if (db == null) {
db = new Database(type, path, type + key, props);
db.databaseID = dbIDCounter;
databaseIDMap.put(dbIDCounter, db);
dbIDCounter++;
databaseMap.put(key, db);
}
return db;
}