Search in sources :

Example 1 with UserOperationsNotificationListener

use of org.wso2.carbon.identity.mgt.listener.UserOperationsNotificationListener in project carbon-identity-framework by wso2.

the class IdentityMgtServiceComponent method activate.

@Activate
protected void activate(ComponentContext context) {
    Dictionary<String, String> props = new Hashtable<String, String>();
    props.put(CarbonConstants.AXIS2_CONFIG_SERVICE, AxisObserver.class.getName());
    context.getBundleContext().registerService(AxisObserver.class.getName(), new IdentityMgtDeploymentInterceptor(), props);
    init();
    if (log.isDebugEnabled()) {
        log.debug("Identity Management Listener is enabled");
    }
    ServiceRegistration serviceRegistration = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new IdentityMgtEventListener(), null);
    if (serviceRegistration != null) {
        if (log.isDebugEnabled()) {
            log.debug("Identity Management - UserOperationEventListener registered.");
        }
    } else {
        log.error("Identity Management - UserOperationEventListener could not be registered.");
    }
    UserOperationsNotificationListener notificationListener = new UserOperationsNotificationListener();
    ServiceRegistration userOperationNotificationSR = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), notificationListener, null);
    context.getBundleContext().registerService(TenantMgtListener.class.getName(), new TenantManagementListener(), null);
    context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new UserSessionTerminationListener(), null);
    if (userOperationNotificationSR != null) {
        if (log.isDebugEnabled()) {
            log.debug("Identity Management - UserOperationNotificationListener registered.");
        }
    } else {
        log.error("Identity Management - UserOperationNotificationListener could not be registered.");
    }
    ServiceRegistration identityUserIdResolverListener = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new IdentityUserIdResolverListener(), null);
    if (identityUserIdResolverListener != null) {
        if (log.isDebugEnabled()) {
            log.debug("Identity Management - IdentityUserIdResolverListener registered.");
        }
    } else {
        log.error("Identity Management - IdentityUserIdResolverListener could not be registered.");
    }
    ServiceRegistration identityUserNameResolverListener = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new IdentityUserNameResolverListener(), null);
    if (identityUserNameResolverListener != null) {
        if (log.isDebugEnabled()) {
            log.debug("Identity Management - IdentityUserNameResolverListener registered.");
        }
    } else {
        log.error("Identity Management - IdentityUserNameResolverListener could not be registered.");
    }
    if (log.isDebugEnabled()) {
        log.debug("Identity Management bundle is activated");
    }
    RegistryCleanUpService registryCleanUpService = new RegistryCleanUpService(IdentityMgtConfig.getInstance().getRegistryCleanUpPeriod(), IdentityMgtConfig.getInstance().getRegistryCleanUpPeriod());
    registryCleanUpService.activateCleanUp();
    // Set user session mapping enabled.
    IdentityMgtServiceDataHolder.getInstance().setUserSessionMappingEnabled(FrameworkUtils.isUserSessionMappingEnabled());
}
Also used : TenantManagementListener(org.wso2.carbon.identity.mgt.listener.TenantManagementListener) UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) UserSessionTerminationListener(org.wso2.carbon.identity.mgt.listener.UserSessionTerminationListener) IdentityUserIdResolverListener(org.wso2.carbon.identity.mgt.listener.IdentityUserIdResolverListener) Hashtable(java.util.Hashtable) TenantMgtListener(org.wso2.carbon.stratos.common.listeners.TenantMgtListener) UserOperationsNotificationListener(org.wso2.carbon.identity.mgt.listener.UserOperationsNotificationListener) IdentityMgtEventListener(org.wso2.carbon.identity.mgt.IdentityMgtEventListener) IdentityUserNameResolverListener(org.wso2.carbon.identity.mgt.listener.IdentityUserNameResolverListener) AxisObserver(org.apache.axis2.engine.AxisObserver) ServiceRegistration(org.osgi.framework.ServiceRegistration) RegistryCleanUpService(org.wso2.carbon.identity.mgt.store.RegistryCleanUpService) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

Hashtable (java.util.Hashtable)1 AxisObserver (org.apache.axis2.engine.AxisObserver)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1 Activate (org.osgi.service.component.annotations.Activate)1 IdentityMgtEventListener (org.wso2.carbon.identity.mgt.IdentityMgtEventListener)1 IdentityUserIdResolverListener (org.wso2.carbon.identity.mgt.listener.IdentityUserIdResolverListener)1 IdentityUserNameResolverListener (org.wso2.carbon.identity.mgt.listener.IdentityUserNameResolverListener)1 TenantManagementListener (org.wso2.carbon.identity.mgt.listener.TenantManagementListener)1 UserOperationsNotificationListener (org.wso2.carbon.identity.mgt.listener.UserOperationsNotificationListener)1 UserSessionTerminationListener (org.wso2.carbon.identity.mgt.listener.UserSessionTerminationListener)1 RegistryCleanUpService (org.wso2.carbon.identity.mgt.store.RegistryCleanUpService)1 TenantMgtListener (org.wso2.carbon.stratos.common.listeners.TenantMgtListener)1 UserOperationEventListener (org.wso2.carbon.user.core.listener.UserOperationEventListener)1