Search in sources :

Example 1 with MessageHandlerComparator

use of org.wso2.carbon.identity.core.handler.MessageHandlerComparator in project carbon-identity-framework by wso2.

the class IdentityEventServiceComponent method registerEventHandler.

@Reference(name = "event.handler", service = org.wso2.carbon.identity.event.handler.AbstractEventHandler.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unRegisterEventHandler")
protected void registerEventHandler(AbstractEventHandler eventHandler) {
    String handlerName = eventHandler.getName();
    try {
        eventHandler.init(IdentityEventConfigBuilder.getInstance().getModuleConfigurations(handlerName));
    } catch (IdentityEventException | IdentityRuntimeException e) {
        log.warn("Properties for " + handlerName + " is not configured. This event handler will not be activated");
    }
    eventHandlerList.add(eventHandler);
    MessageHandlerComparator messageHandlerComparator = new MessageHandlerComparator(null);
    Collections.sort(eventHandlerList, messageHandlerComparator);
}
Also used : IdentityEventException(org.wso2.carbon.identity.event.IdentityEventException) MessageHandlerComparator(org.wso2.carbon.identity.core.handler.MessageHandlerComparator) IdentityRuntimeException(org.wso2.carbon.identity.base.IdentityRuntimeException) Reference(org.osgi.service.component.annotations.Reference)

Example 2 with MessageHandlerComparator

use of org.wso2.carbon.identity.core.handler.MessageHandlerComparator in project identity-data-publisher-authentication by wso2-extensions.

the class AuthenticationDataPublisherServiceComponent method setAuthenticationDataPublisher.

@Reference(name = "AuthenticationDataPublisher", service = AuthenticationDataPublisher.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetAuthenticationDataPublisher")
protected void setAuthenticationDataPublisher(AuthenticationDataPublisher publisher) {
    if (publisher != null && !FrameworkConstants.AnalyticsAttributes.AUTHN_DATA_PUBLISHER_PROXY.equalsIgnoreCase(publisher.getName())) {
        AuthenticationDataPublisherDataHolder.getInstance().getDataPublishers().add(publisher);
        Collections.sort(AuthenticationDataPublisherDataHolder.getInstance().getDataPublishers(), new MessageHandlerComparator(null));
        Collections.reverse(AuthenticationDataPublisherDataHolder.getInstance().getDataPublishers());
    }
}
Also used : MessageHandlerComparator(org.wso2.carbon.identity.core.handler.MessageHandlerComparator) Reference(org.osgi.service.component.annotations.Reference)

Aggregations

Reference (org.osgi.service.component.annotations.Reference)2 MessageHandlerComparator (org.wso2.carbon.identity.core.handler.MessageHandlerComparator)2 IdentityRuntimeException (org.wso2.carbon.identity.base.IdentityRuntimeException)1 IdentityEventException (org.wso2.carbon.identity.event.IdentityEventException)1