use of org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener in project carbon-identity-framework by wso2.
the class IdentityUserProfileServiceComponent method activate.
@Activate
protected void activate(ComponentContext ctxt) {
try {
if (log.isDebugEnabled()) {
log.debug("User Profile Mgt bundle is activated ");
}
ServiceRegistration userStoreConfigEventSR = ctxt.getBundleContext().registerService(UserStoreConfigListener.class.getName(), new UserStoreConfigListenerImpl(), null);
if (userStoreConfigEventSR != null) {
if (log.isDebugEnabled()) {
log.debug("User profile management - UserStoreConfigListener registered.");
}
} else {
log.error("User profile management - UserStoreConfigListener could not be registered.");
}
ServiceRegistration profileMgtEventSR = ctxt.getBundleContext().registerService(UserOperationEventListener.class.getName(), new ProfileMgtEventListener(), null);
// Check whether the IDN tables exist at the beginning.
ServiceHodler.setIsIDNTableExist(isIDNTablesExist());
if (log.isDebugEnabled()) {
log.debug("Is IDN_ASSOCIATED_ID table exist: " + ServiceHodler.isIDNTableExist());
}
if (profileMgtEventSR != null) {
if (log.isDebugEnabled()) {
log.debug("User profile management - ProfileMgtEventListener registered.");
}
} else {
log.error("User profile management - ProfileMgtEventListener could not be registered.");
}
FederatedAssociationManager federatedAssociationManager = new FederatedAssociationManagerImpl();
ServiceRegistration federatedAssociationManagerSR = ctxt.getBundleContext().registerService(FederatedAssociationManager.class.getName(), federatedAssociationManager, null);
if (federatedAssociationManagerSR != null) {
if (log.isDebugEnabled()) {
log.debug("User profile management - FederatedAssociationManager registered.");
}
IdentityUserProfileServiceDataHolder.getInstance().setFederatedAssociationManager(federatedAssociationManager);
} else {
log.error("User profile management - FederatedAssociationManager could not be registered.");
}
} catch (Throwable e) {
log.error("Failed to activate ProfileMgt bundle ", e);
}
}
use of org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener in project carbon-identity-framework by wso2.
the class SecondaryUserStoreConfigurationUtil method triggerListenersOnUserStorePreAdd.
/**
* Trigger the listeners before a userstore is added.
*
* @param userStoreDTO Userstore configuration to be added.
* @throws UserStoreException throws when an error occurred when triggering listeners.
*/
public static void triggerListenersOnUserStorePreAdd(UserStoreDTO userStoreDTO) throws UserStoreException {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
List<UserStoreConfigListener> userStoreConfigListeners = UserStoreConfigListenersHolder.getInstance().getUserStoreConfigListeners();
for (UserStoreConfigListener userStoreConfigListener : userStoreConfigListeners) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Triggering userstore pre add listener: %s for tenant: %s", userStoreConfigListener.getClass().getName(), CarbonContext.getThreadLocalCarbonContext().getTenantDomain()));
}
userStoreConfigListener.onUserStorePreAdd(tenantId, userStoreDTO);
}
}
use of org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener in project carbon-identity-framework by wso2.
the class SecondaryUserStoreConfigurationUtil method triggerListenersOnUserStorePostGet.
/**
* Trigger the listeners after a userstore is retrieved.
*
* @param userStoreDTO Retrieved userstore configuration.
* @throws UserStoreException throws when an error occurred when triggering listeners.
*/
public static void triggerListenersOnUserStorePostGet(UserStoreDTO userStoreDTO) throws UserStoreException {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
List<UserStoreConfigListener> userStoreConfigListeners = UserStoreConfigListenersHolder.getInstance().getUserStoreConfigListeners();
for (UserStoreConfigListener userStoreConfigListener : userStoreConfigListeners) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Triggering userstore post get listener: %s for tenant: %s", userStoreConfigListener.getClass().getName(), CarbonContext.getThreadLocalCarbonContext().getTenantDomain()));
}
userStoreConfigListener.onUserStorePostGet(tenantId, userStoreDTO);
}
}
use of org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener in project carbon-identity-framework by wso2.
the class SecondaryUserStoreConfigurationUtil method triggerListenersOnUserStorePreStateChange.
/**
* Trigger the listeners before a user store state is changed.
*
* @param domainName User store domain name.
* @param isDisable True if disabled, else false.
* @throws UserStoreException Thrown when an error occurred while triggering listeners.
*/
public static void triggerListenersOnUserStorePreStateChange(String domainName, boolean isDisable) throws UserStoreException {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
List<UserStoreConfigListener> userStoreConfigListeners = UserStoreConfigListenersHolder.getInstance().getUserStoreConfigListeners();
for (UserStoreConfigListener userStoreConfigListener : userStoreConfigListeners) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Triggering userstore pre state change listener: %s for tenant: %s", userStoreConfigListener.getClass().getName(), CarbonContext.getThreadLocalCarbonContext().getTenantDomain()));
}
userStoreConfigListener.onUserStorePreStateChange(isDisable ? UserStoreState.DISABLED : UserStoreState.ENABLED, tenantId, domainName);
}
}
use of org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener in project carbon-identity-framework by wso2.
the class IdentityClaimManagementServiceComponent method registerClaimConfigListener.
/**
* Register ClaimConfigListener as a UserStoreConfigListener service.
*
* @param bundleCtx BundleContext
*/
private void registerClaimConfigListener(BundleContext bundleCtx) {
UserStoreConfigListener claimConfigListener = new ClaimConfigListener();
ServiceRegistration mappedClaimConfigListenerSR = bundleCtx.registerService(UserStoreConfigListener.class.getName(), claimConfigListener, null);
if (mappedClaimConfigListenerSR != null) {
if (log.isDebugEnabled()) {
log.debug("ClaimConfigListener Service registered.");
}
} else {
log.error("Error registering ClaimConfigListener Service.");
}
}
Aggregations