本文整理汇总了Java中org.wso2.carbon.user.core.util.DatabaseUtil.getRealmDataSource方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseUtil.getRealmDataSource方法的具体用法?Java DatabaseUtil.getRealmDataSource怎么用?Java DatabaseUtil.getRealmDataSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.user.core.util.DatabaseUtil
的用法示例。
在下文中一共展示了DatabaseUtil.getRealmDataSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initDatasource
import org.wso2.carbon.user.core.util.DatabaseUtil; //导入方法依赖的package包/类
private void initDatasource() {
try {
dataSource = DatabaseUtil.getRealmDataSource(CarbonContext.getThreadLocalCarbonContext().getUserRealm().
getRealmConfiguration());
} catch (UserStoreException e) {
log.error("Error while retrieving user management data source", e);
}
}
示例2: initUMDataSource
import org.wso2.carbon.user.core.util.DatabaseUtil; //导入方法依赖的package包/类
/**
* This method initializes and execute the um migration scripts.
* @throws Exception
*/
private void initUMDataSource() throws SQLException, IOException {
umDataSource = DatabaseUtil.getRealmDataSource(ServiceHolder.getRealmService().getBootstrapRealmConfiguration());
MigrationDatabaseCreator migrationDatabaseCreator = new MigrationDatabaseCreator(dataSource, umDataSource);
try {
migrationDatabaseCreator.executeUmMigrationScript();
} catch (IOException e) {
throw new IOException("Error while reading um migration script. ",e);
}
}
示例3: databaseMigration
import org.wso2.carbon.user.core.util.DatabaseUtil; //导入方法依赖的package包/类
@Override
public void databaseMigration() throws EsMigrationException {
try {
umDataSource = DatabaseUtil.getRealmDataSource(ServiceHolder.getRealmService().getBootstrapRealmConfiguration());
MigrationDatabaseCreator migrationDatabaseCreator = new MigrationDatabaseCreator(dataSource, umDataSource);
migrationDatabaseCreator.executeUserPermissionFixScript();
log.info("Database migration completed successfully.");
} catch (Exception e) {
String msg = "Error occurred while executing the database migration.";
log.error(msg, e);
throw new EsMigrationException(msg, e);
}
}
示例4: CassandraUserStoreManager
import org.wso2.carbon.user.core.util.DatabaseUtil; //导入方法依赖的package包/类
public CassandraUserStoreManager(RealmConfiguration realmConfig, Map<String, Object> properties,
ClaimManager claimManager, ProfileConfigurationManager profileManager, UserRealm realm, Integer tenantId)
throws UserStoreException {
this(realmConfig, tenantId);
if (log.isDebugEnabled()) {
log.debug("Started " + System.currentTimeMillis());
}
this.claimManager = claimManager;
this.userRealm = realm;
dataSource = (DataSource) properties.get(UserCoreConstants.DATA_SOURCE);
if (dataSource == null) {
dataSource = DatabaseUtil.getRealmDataSource(realmConfig);
}
if (dataSource == null) {
throw new UserStoreException("User Management Data Source is null");
}
doInitialSetup();
this.persistDomain();
if (realmConfig.isPrimary()) {
addInitialAdminData(Boolean.parseBoolean(realmConfig.getAddAdmin()), !isInitSetupDone());
}
properties.put(UserCoreConstants.DATA_SOURCE, dataSource);
if (log.isDebugEnabled()) {
log.debug("The jdbcDataSource being used by JDBCUserStoreManager :: " + dataSource.hashCode());
}
if (log.isDebugEnabled()) {
log.debug("Ended " + System.currentTimeMillis());
}
domain = realmConfig.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);
/*
* Initialize user roles cache as implemented in AbstractUserStoreManager
*/
initUserRolesCache();
}