use of com.wplatform.ddal.dbobject.Role in project jdbc-shards by wplatform.
the class Database method openDatabase.
private synchronized void openDatabase() {
User systemUser = new User(this, allocateObjectId(), SYSTEM_USER_NAME);
systemUser.setAdmin(true);
systemUser.setUserPasswordHash(new byte[0]);
users.put(SYSTEM_USER_NAME, systemUser);
Schema schema = new Schema(this, allocateObjectId(), Constants.SCHEMA_MAIN, systemUser, true);
schemas.put(schema.getName(), schema);
Role publicRole = new Role(this, 0, Constants.PUBLIC_ROLE_NAME, true);
roles.put(Constants.PUBLIC_ROLE_NAME, publicRole);
Session sysSession = createSession(systemUser);
try {
SchemaConfig sc = configuration.getSchemaConfig();
List<TableConfig> ctList = sc.getTables();
for (TableConfig tableConfig : ctList) {
String identifier = tableConfig.getName();
identifier = identifier(identifier);
TableMate tableMate = new TableMate(schema, allocateObjectId(), identifier);
tableMate.setTableRouter(tableConfig.getTableRouter());
tableMate.setShards(tableConfig.getShards());
tableMate.setScanLevel(tableConfig.getScanLevel());
tableMate.loadMataData(sysSession);
if (tableConfig.isValidation()) {
tableMate.check();
}
this.addSchemaObject(tableMate);
}
} finally {
sysSession.close();
}
}
Aggregations