in java/ws-server/src/main/java/com/epam/deltix/tbwg/webapp/services/TimebaseServiceImpl.java [131:154]
public synchronized DXTickDB getOrCreate(String url, String userName, String password) {
if (!Objects.equals(url, dbUrl) || db == null || !db.isOpen()) {
Util.close(db);
dbUrl = url;
String decoded = !StringUtils.isEmpty(password) ? new String(Base64Utils.decodeFromString(password)) : null;
db = !StringUtils.isEmpty(userName) ? TickDBFactory.createFromUrl(url, userName, decoded) : TickDBFactory.createFromUrl(url);
TickDBFactory.setApplicationName(db, "TB Web Gateway");
LOGGER.info("Opening connection to TimeBase on %s.").with(url);
db.open(readonly);
if (db instanceof Disconnectable)
((Disconnectable) db).addDisconnectEventListener(new EventListener(db));
if (db instanceof DBStateNotifier) {
((DBStateNotifier) db).addStateListener(systemMessagesService.getStateListener());
} else {
LOGGER.error().append("Cannot add ")
.append(DBStateListener.class.getSimpleName())
.commit();
}
}
return db;
}