我想在IS管理控制台中重新分发事件。例如,如果我添加/更改/删除一个用户或某个角色,我希望将这些更新重新发送给其他使用者。到目前为止,我发现的唯一方法是UMListenerServiceComponent。看起来我可以定义自己的UserStoreManagerListener并在UMListenerServiceComponent注册它。
在这种情况下,添加用户的操作是触发已注册的侦听器。
public void addUser(String userName, Object credential, String[] roleList,
Map<String, String> claims, String profileName, boolean requirePasswordChange)
throws UserStoreException {
for (UserStoreManagerListener listener : UMListenerServiceComponent
.getUserStoreManagerListeners()) {
if (!listener.addUser(userName, credential, roleList, claims, profileName, this)) {
return;
}
}
// persist the user info. in the database.
persistUser(userName, credential, roleList, claims, profileName, requirePasswordChange);
}我的问题是如何实现和注册这类听众?还是有更简单的方法?提前感谢!
发布于 2014-05-06 15:28:29
问题解决了!
下载了身份管理器版本,用于wso2IS 4.6.0:http://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/identity/org.wso2.carbon.identity.mgt/4.2.1,类IdentityMgtServiceComponent正在将IdentityMgtEventListener注册为Osgi上下文中的服务。
IdentityMgtServiceComponent:
protected void activate(ComponentContext context) {
listener = new IdentityMgtEventListener();
serviceRegistration = context.getBundleContext().registerService(
UserOperationEventListener.class.getName(), listener, null);最后,我复制了这个模式,并使用AbstractUserOperationEventListener扩展编写了自己的包,并通过包加载器类激活了它。
所有的前/后添加/删除操作都会被触发。
希望这能有所帮助
https://stackoverflow.com/questions/22564528
复制相似问题