@SuppressWarnings("unchecked")
public UserRealm initializeRealm(RealmConfiguration realmConfig, int tenantId)
throws UserStoreException {
ClaimBuilder.setBundleContext(bc);
ProfileConfigurationBuilder.setBundleContext(bc);
UserRealm userRealm = null;
try {
Class clazz = Class.forName(realmConfig.getRealmClassName());
userRealm = (UserRealm) clazz.newInstance();
userRealm.init(realmConfig, properties, tenantId);
} catch (Exception e) {
String msg = "Cannot initialize the realm.";
log.error(msg, e);
throw new UserStoreException(msg, e);
}