Search in sources :

Example 1 with ConfigurationDAOImpl

use of org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl in project carbon-identity-framework by wso2.

the class ConfigurationManagerComponent method activate.

/**
 * Register ConfigurationManager as an OSGI service.
 *
 * @param componentContext OSGI service component context.
 */
@Activate
protected void activate(ComponentContext componentContext) {
    try {
        BundleContext bundleContext = componentContext.getBundleContext();
        ConfigurationDAO configurationDAO = new ConfigurationDAOImpl();
        bundleContext.registerService(ConfigurationDAO.class.getName(), configurationDAO, null);
        bundleContext.registerService(ConfigurationDAO.class.getName(), new CachedBackedConfigurationDAO(configurationDAO), null);
        ConfigurationManagerConfigurationHolder configurationManagerConfigurationHolder = new ConfigurationManagerConfigurationHolder();
        configurationManagerConfigurationHolder.setConfigurationDAOS(configurationDAOs);
        bundleContext.registerService(ConfigurationManager.class.getName(), new ConfigurationManagerImpl(configurationManagerConfigurationHolder), null);
        ConfigurationManagerComponentDataHolder.getInstance().setConfigurationManagementEnabled(isConfigurationManagementEnabled());
        setUseCreatedTime();
    } catch (Throwable e) {
        log.error("Error while activating ConfigurationManagerComponent.", e);
    }
}
Also used : CachedBackedConfigurationDAO(org.wso2.carbon.identity.configuration.mgt.core.dao.impl.CachedBackedConfigurationDAO) ConfigurationDAO(org.wso2.carbon.identity.configuration.mgt.core.dao.ConfigurationDAO) CachedBackedConfigurationDAO(org.wso2.carbon.identity.configuration.mgt.core.dao.impl.CachedBackedConfigurationDAO) ConfigurationDAOImpl(org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl) ConfigurationManagerImpl(org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManagerImpl) ConfigurationManager(org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManager) BundleContext(org.osgi.framework.BundleContext) ConfigurationManagerConfigurationHolder(org.wso2.carbon.identity.configuration.mgt.core.model.ConfigurationManagerConfigurationHolder) Activate(org.osgi.service.component.annotations.Activate)

Example 2 with ConfigurationDAOImpl

use of org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl in project carbon-identity-framework by wso2.

the class ConfigurationManagementUtils method getConfigurationManager.

public static ConfigurationManager getConfigurationManager() {
    ConfigurationManagerComponentDataHolder.setUseCreatedTime(true);
    ConfigurationManagerConfigurationHolder configurationHolder = new ConfigurationManagerConfigurationHolder();
    ConfigurationDAO configurationDAO = new ConfigurationDAOImpl();
    configurationHolder.setConfigurationDAOS(Collections.singletonList(configurationDAO));
    ConfigurationManager configurationManager = new ConfigurationManagerImpl(configurationHolder);
    ConfigurationManagerComponentDataHolder.getInstance().setConfigurationManagementEnabled(true);
    return configurationManager;
}
Also used : ConfigurationDAO(org.wso2.carbon.identity.configuration.mgt.core.dao.ConfigurationDAO) ConfigurationDAOImpl(org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl) ConfigurationManagerImpl(org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManagerImpl) ConfigurationManager(org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManager) ConfigurationManagerConfigurationHolder(org.wso2.carbon.identity.configuration.mgt.core.model.ConfigurationManagerConfigurationHolder)

Example 3 with ConfigurationDAOImpl

use of org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl in project carbon-identity-framework by wso2.

the class ConfigurationManagerTest method prepareConfigs.

private void prepareConfigs() throws Exception {
    // Mock get maximum query length call.
    mockStatic(IdentityUtil.class);
    when(IdentityUtil.getProperty(any(String.class))).thenReturn("4194304");
    when(IdentityUtil.getEndpointURIPath(any(String.class), anyBoolean(), anyBoolean())).thenReturn("/t/bob.com/api/identity/config-mgt/v1.0/resource/file/publisher/SMSPublisher/9e038218-8e99-4dae-bf83-a78f5dcd73a8");
    ConfigurationManagerComponentDataHolder.setUseCreatedTime(true);
    ConfigurationManagerConfigurationHolder configurationHolder = new ConfigurationManagerConfigurationHolder();
    ConfigurationDAO configurationDAO = new ConfigurationDAOImpl();
    configurationHolder.setConfigurationDAOS(Collections.singletonList(configurationDAO));
    mockCarbonContextForTenant(SUPER_TENANT_ID, SUPER_TENANT_DOMAIN_NAME);
    mockIdentityTenantUtility();
    configurationManager = new ConfigurationManagerImpl(configurationHolder);
}
Also used : ConfigurationDAO(org.wso2.carbon.identity.configuration.mgt.core.dao.ConfigurationDAO) ConfigurationDAOImpl(org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl) ConfigurationManagerConfigurationHolder(org.wso2.carbon.identity.configuration.mgt.core.model.ConfigurationManagerConfigurationHolder)

Aggregations

ConfigurationDAO (org.wso2.carbon.identity.configuration.mgt.core.dao.ConfigurationDAO)3 ConfigurationDAOImpl (org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl)3 ConfigurationManagerConfigurationHolder (org.wso2.carbon.identity.configuration.mgt.core.model.ConfigurationManagerConfigurationHolder)3 ConfigurationManager (org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManager)2 ConfigurationManagerImpl (org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManagerImpl)2 BundleContext (org.osgi.framework.BundleContext)1 Activate (org.osgi.service.component.annotations.Activate)1 CachedBackedConfigurationDAO (org.wso2.carbon.identity.configuration.mgt.core.dao.impl.CachedBackedConfigurationDAO)1