Search in sources :

Example 1 with DatabaseBasedUserStoreDAOFactory

use of org.wso2.carbon.identity.user.store.configuration.dao.impl.DatabaseBasedUserStoreDAOFactory in project carbon-identity-framework by wso2.

the class UserStoreConfigComponent method activate.

/**
 * @param ctxt
 */
@Activate
protected void activate(ComponentContext ctxt) {
    if (log.isDebugEnabled()) {
        log.debug("Identity User Store bundle is activated.");
    }
    try {
        BundleContext bundleContext = ctxt.getBundleContext();
        AbstractUserStoreDAOFactory fileBasedUserStoreDAOFactory = new FileBasedUserStoreDAOFactory();
        AbstractUserStoreDAOFactory databaseBasedUserStoreDAOFactory = new DatabaseBasedUserStoreDAOFactory();
        ServiceRegistration serviceRegistration = bundleContext.registerService(AbstractUserStoreDAOFactory.class.getName(), fileBasedUserStoreDAOFactory, null);
        bundleContext.registerService(AbstractUserStoreDAOFactory.class.getName(), databaseBasedUserStoreDAOFactory, null);
        UserStoreConfigService userStoreConfigService = new UserStoreConfigServiceImpl();
        ctxt.getBundleContext().registerService(UserStoreConfigService.class.getName(), userStoreConfigService, null);
        UserStoreConfigListenersHolder.getInstance().setUserStoreConfigService(userStoreConfigService);
        UserStoreHashProviderConfigListenerImpl userStoreHashProviderListener = new UserStoreHashProviderConfigListenerImpl();
        ctxt.getBundleContext().registerService(UserStoreConfigListener.class.getName(), userStoreHashProviderListener, null);
        UserStoreConfigListenersHolder.getInstance().setUserStoreConfigListenerService(userStoreHashProviderListener);
        if (serviceRegistration != null) {
            if (log.isDebugEnabled()) {
                log.debug("FileBasedUserStoreDAOFactory is successfully registered.");
            }
        } else {
            log.error("FileBasedUserStoreDAOFactory could not be registered.");
        }
        readAllowedUserstoreConfiguration();
        readUserStoreAttributeMappingConfigs();
    } catch (Throwable e) {
        log.error("Failed to load user store org.wso2.carbon.identity.user.store.configuration details.", e);
    }
    if (log.isDebugEnabled()) {
        log.debug("Identity User Store-Config bundle is activated.");
    }
}
Also used : AbstractUserStoreDAOFactory(org.wso2.carbon.identity.user.store.configuration.dao.AbstractUserStoreDAOFactory) UserStoreHashProviderConfigListenerImpl(org.wso2.carbon.identity.user.store.configuration.listener.UserStoreHashProviderConfigListenerImpl) UserStoreConfigServiceImpl(org.wso2.carbon.identity.user.store.configuration.UserStoreConfigServiceImpl) UserStoreConfigListener(org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener) FileBasedUserStoreDAOFactory(org.wso2.carbon.identity.user.store.configuration.dao.impl.FileBasedUserStoreDAOFactory) UserStoreConfigService(org.wso2.carbon.identity.user.store.configuration.UserStoreConfigService) DatabaseBasedUserStoreDAOFactory(org.wso2.carbon.identity.user.store.configuration.dao.impl.DatabaseBasedUserStoreDAOFactory) BundleContext(org.osgi.framework.BundleContext) ServiceRegistration(org.osgi.framework.ServiceRegistration) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

BundleContext (org.osgi.framework.BundleContext)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1 Activate (org.osgi.service.component.annotations.Activate)1 UserStoreConfigService (org.wso2.carbon.identity.user.store.configuration.UserStoreConfigService)1 UserStoreConfigServiceImpl (org.wso2.carbon.identity.user.store.configuration.UserStoreConfigServiceImpl)1 AbstractUserStoreDAOFactory (org.wso2.carbon.identity.user.store.configuration.dao.AbstractUserStoreDAOFactory)1 DatabaseBasedUserStoreDAOFactory (org.wso2.carbon.identity.user.store.configuration.dao.impl.DatabaseBasedUserStoreDAOFactory)1 FileBasedUserStoreDAOFactory (org.wso2.carbon.identity.user.store.configuration.dao.impl.FileBasedUserStoreDAOFactory)1 UserStoreConfigListener (org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener)1 UserStoreHashProviderConfigListenerImpl (org.wso2.carbon.identity.user.store.configuration.listener.UserStoreHashProviderConfigListenerImpl)1