Java Code Examples for org.wso2.carbon.identity.core.util.IdentityUtil#readEventListenerProperty()

The following examples show how to use org.wso2.carbon.identity.core.util.IdentityUtil#readEventListenerProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApplicationResourceManagementListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * Get the execution order identifier for this listener.
 *
 * @return The execution order identifier integer value.
 */
default int getExecutionOrderId() {

    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
            (ApplicationResourceManagementListener.class.getName(), this.getClass().getName());
    int orderId;
    if (identityEventListenerConfig == null) {
        orderId = IdentityCoreConstants.EVENT_LISTENER_ORDER_ID;
    } else {
        orderId = identityEventListenerConfig.getOrder();
    }

    if (orderId != IdentityCoreConstants.EVENT_LISTENER_ORDER_ID) {
        return orderId;
    }

    return getDefaultOrderId();
}
 
Example 2
Source File: AbstractIdentityMessageHandler.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
public void init(InitConfig initConfig) {

        this.initConfig = initConfig;

        IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
                (AbstractIdentityMessageHandler.class.getName(), this.getClass().getName());

        if (identityEventListenerConfig == null) {
            return;
        }

        if(identityEventListenerConfig.getProperties() != null) {
            for(Map.Entry<Object,Object> property:identityEventListenerConfig.getProperties().entrySet()) {
                String key = (String)property.getKey();
                String value = (String)property.getValue();
                if(!properties.containsKey(key)) {
                    properties.setProperty(key, value);
                } else {
                    log.warn("Property key " + key + " already exists. Cannot add property!!");
                }
            }
        }
    }
 
Example 3
Source File: AbstractIdentityUserMgtFailureEventListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * To get the execution order id from the configuration file.
 *
 * @return relevant order id of the event listener.
 */
public int getOrderId() {

    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
            (UserManagementErrorEventListener.class.getName(), this.getClass().getName());
    if (identityEventListenerConfig == null) {
        return IdentityCoreConstants.EVENT_LISTENER_ORDER_ID;
    }
    return identityEventListenerConfig.getOrder();
}
 
Example 4
Source File: AbstractWorkflowListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Check if listener is enabled or not.
 *
 * @return
 */
public boolean isEnable() {
    IdentityEventListenerConfig workflowListener = IdentityUtil.readEventListenerProperty
            (WorkflowListener.class.getName(), this.getClass().getName());

    if (workflowListener == null) {
        return true;
    }

    if (StringUtils.isNotBlank(workflowListener.getEnable())) {
        return Boolean.parseBoolean(workflowListener.getEnable());
    } else {
        return true;
    }
}
 
Example 5
Source File: AbstractCacheListener.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Return is listener enable
 *
 * @return enable/disable
 */
public boolean isEnable() {
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
            (AbstractCacheListener.class.getName(), this.getClass().getName());

    if (identityEventListenerConfig == null) {
        return true;
    }

    if (StringUtils.isNotBlank(identityEventListenerConfig.getEnable())) {
        return Boolean.parseBoolean(identityEventListenerConfig.getEnable());
    } else {
        return true;
    }
}
 
Example 6
Source File: AbstractApplicationMgtListener.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public boolean isEnable() {
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
            (ApplicationMgtListener.class.getName(), this.getClass().getName());
    if (identityEventListenerConfig == null) {
        return true;
    }
    if (StringUtils.isNotBlank(identityEventListenerConfig.getEnable())) {
        return Boolean.parseBoolean(identityEventListenerConfig.getEnable());
    } else {
        return true;
    }
}
 
Example 7
Source File: AbstractIdentityMessageHandler.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
public boolean isEnabled(MessageContext messageContext) {

        IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
                (AbstractIdentityMessageHandler.class.getName(), this.getClass().getName());

        if (identityEventListenerConfig == null) {
            return true;
        }

        return Boolean.parseBoolean(identityEventListenerConfig.getEnable());
    }
 
Example 8
Source File: AbstractIdentityHandler.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Override
public int getPriority() {

    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
            (AbstractIdentityHandler.class.getName(), this.getClass().getName());
    if (identityEventListenerConfig == null) {
        return IdentityCoreConstants.EVENT_LISTENER_ORDER_ID;
    }
    return identityEventListenerConfig.getOrder();
}
 
Example 9
Source File: AbstractIdentityHandler.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isEnabled() {

    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
            (AbstractIdentityHandler.class.getName(), this.getClass().getName());

    if (identityEventListenerConfig == null) {
        return true;
    }

    return Boolean.parseBoolean(identityEventListenerConfig.getEnable());
}
 
Example 10
Source File: AbstractWorkflowExecutorManagerListener.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Check if listener is enabled or not.
 *
 * @return
 */
public boolean isEnable() {
    IdentityEventListenerConfig listenerConfig = IdentityUtil.readEventListenerProperty
            (WorkflowExecutorManagerListener.class.getName(), this.getClass().getName());

    if (listenerConfig == null) {
        return true;
    }

    if (StringUtils.isNotBlank(listenerConfig.getEnable())) {
        return Boolean.parseBoolean(listenerConfig.getEnable());
    } else {
        return true;
    }
}
 
Example 11
Source File: AbstractIdentityUserMgtFailureEventListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isEnable() {

    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil
            .readEventListenerProperty(UserManagementErrorEventListener.class.getName(), this.getClass().getName());

    return identityEventListenerConfig == null || StringUtils.isEmpty(identityEventListenerConfig.getEnable())
            || Boolean.parseBoolean(identityEventListenerConfig.getEnable());
}
 
Example 12
Source File: AbstractWorkflowListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * get order ID (priority of current listener)
 *
 * @return
 */
public int getOrderId() {
    IdentityEventListenerConfig workflowListener = IdentityUtil.readEventListenerProperty
            (WorkflowListener.class.getName(), this.getClass().getName());
    if (workflowListener == null) {
        return IdentityCoreConstants.EVENT_LISTENER_ORDER_ID;
    }
    return workflowListener.getOrder();
}
 
Example 13
Source File: AbstractIdentityTenantMgtListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
public int getOrderId() {
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
            (TenantMgtListener.class.getName(), this.getClass().getName());
    if (identityEventListenerConfig == null) {
        return IdentityCoreConstants.EVENT_LISTENER_ORDER_ID;
    }
    return identityEventListenerConfig.getOrder();
}
 
Example 14
Source File: AbstractWorkflowExecutorManagerListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Check if listener is enabled or not.
 *
 * @return
 */
public boolean isEnable() {
    IdentityEventListenerConfig listenerConfig = IdentityUtil.readEventListenerProperty
            (WorkflowExecutorManagerListener.class.getName(), this.getClass().getName());

    if (listenerConfig == null) {
        return true;
    }

    if (StringUtils.isNotBlank(listenerConfig.getEnable())) {
        return Boolean.parseBoolean(listenerConfig.getEnable());
    } else {
        return true;
    }
}
 
Example 15
Source File: AbstractIdentityProviderMgtListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
public int getExecutionOrderId() {
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
            (IdentityProviderMgtListener.class.getName(), this.getClass().getName());
    int orderId;
    if (identityEventListenerConfig == null) {
        orderId = IdentityCoreConstants.EVENT_LISTENER_ORDER_ID;
    } else {
        orderId = identityEventListenerConfig.getOrder();
    }
    if (orderId != IdentityCoreConstants.EVENT_LISTENER_ORDER_ID) {
        return orderId;
    }
    return getDefaultOrderId();
}
 
Example 16
Source File: AbstractApplicationMgtListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
public int getExecutionOrderId() {

        IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
                (ApplicationMgtListener.class.getName(), this.getClass().getName());
        int orderId;
        if (identityEventListenerConfig == null) {
            orderId = IdentityCoreConstants.EVENT_LISTENER_ORDER_ID;
        } else {
            orderId = identityEventListenerConfig.getOrder();
        }
        if (orderId != IdentityCoreConstants.EVENT_LISTENER_ORDER_ID) {
            return orderId;
        }
        return getDefaultOrderId();
    }
 
Example 17
Source File: AbstractApplicationMgtListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
public boolean isEnable() {

        IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
                (ApplicationMgtListener.class.getName(), this.getClass().getName());
        if (identityEventListenerConfig == null) {
            return true;
        }
        if (StringUtils.isNotBlank(identityEventListenerConfig.getEnable())) {
            return Boolean.parseBoolean(identityEventListenerConfig.getEnable());
        } else {
            return true;
        }
    }
 
Example 18
Source File: AbstractWorkflowImplServiceListener.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Check if listener is enabled or not.
 *
 * @return
 */
public boolean isEnable() {
    IdentityEventListenerConfig workflowImplListener = IdentityUtil.readEventListenerProperty
            (WorkflowImplServiceListener.class.getName(), this.getClass().getName());

    if (workflowImplListener == null) {
        return true;
    }

    if (StringUtils.isNotBlank(workflowImplListener.getEnable())) {
        return Boolean.parseBoolean(workflowImplListener.getEnable());
    } else {
        return true;
    }
}
 
Example 19
Source File: AbstractIdentityUserOperationEventListener.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public int getOrderId() {
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
            (UserOperationEventListener.class.getName(), this.getClass().getName());
    if (identityEventListenerConfig == null) {
        return IdentityCoreConstants.EVENT_LISTENER_ORDER_ID;
    }
    return identityEventListenerConfig.getOrder();
}
 
Example 20
Source File: AbstractIdentityProviderMgtListener.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
public boolean isEnable() {
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty
            (IdentityProviderMgtListener.class.getName(), this.getClass().getName());
    if (identityEventListenerConfig == null) {
        return true;
    }
    if (StringUtils.isNotBlank(identityEventListenerConfig.getEnable())) {
        return Boolean.parseBoolean(identityEventListenerConfig.getEnable());
    } else {
        return true;
    }
}