@Override public Session createSession(Properties ci) { String userName = ci.getProperty("user"); String password = ci.getProperty("password"); if (userName == null) { userName = Database.SYSTEM_USER_NAME; } User user = database.findUser(userName); if (user == null) { // users is the last thing we add, so if no user is around, // the database is new (or not initialized correctly) user = new User(database, userName); user.setAdmin(true); user.setPassword(password); database.addDatabaseObject(user); } User userObject = database.getUser(userName); Session session = database.createSession(userObject); return session; }
private synchronized void openDatabase() { User systemUser = new User(this, SYSTEM_USER_NAME); systemUser.setAdmin(true); systemUser.setPassword(SYSTEM_USER_NAME);