我是观察新手,尽管存储库支持观察,
onEvent() 永远不会被调用。详细信息如下:
我创建了一个 Param 类,它只是一个带有 setter 和 getter 的 POJO
具有每个代表一个参数的属性:
ObservationManager.addEventListener()
我关注了一个扩展 EventListener 的接口 XListener,并定义了一个
方法:Params getParameters()。
创建的 MyEventListener 实现 XListener 并实现
getParameters() 和 onEvent()
getParameters() 只是填充一个 Param 对象(使用 NODE_ADDED)并返回
稍后将使用它来添加 this 侦听器,
而 onEvent() 目前只打印一条消息 NEW NODE ADDED。
然后创建一个新类ListenerRigistrar并将其添加到
Spring 的 applicationContext.xml ,其中 a 是一个集合
XListeners 的数量。
为 MyEventListener 添加了一个新 bean。
回到 ListenerRegistrar,我迭代侦听器集并使用
嵌入要调用的侦听器的 Params 对象
ObservationManager.addEventListener()
问题是消息 NEW NODE ADDED 永远不会打印意味着
onEvent() 方法永远不会被调用!
有人可以帮我吗?
先感谢您。
I am new to observation, although the repository supports observation,
onEvent() is never invocked. Here're the details:
I created a Param class, and it's just a POJO with setters and getters
hasing properties that each represents a parameter for:
ObservationManager.addEventListener()
I careted an interface XListener that extends EventListener, and defined a
method: Params getParameters().
Crated MyEventListener implements XListener and implements the
getParameters() and onEvent()
getParameters() just populate a Param object (with NODE_ADDED) and return
it to be used later to add this listener,
and onEvent() currently it only prints out a message NEW NODE ADDED.
Then created a new class ListenerRigistrar and added it in the
applicationContext.xml for Spring with a which is a set
of XListeners.
Added a new bean for MyEventListener.
back to ListenerRegistrar, I iterate over the set of listeners and use the
Params object embeded with the listener to call
ObservationManager.addEventListener()
The problem is that the message NEW NODE ADDED is never printed means
onEvent() method is never invocked!!
Can anyone help me please?
Thank you in advance.
发布评论
评论(1)
我想说你遇到的问题是你的 ListenerRegister 永远不会被调用(看起来它只是在应用程序上下文中声明它)。
当您使用 Spring 和 JCR 时,我建议您使用 Spring 模块,并遵循 这些说明。
祝你好运,
--dj
I would say the problem you have is that your ListenerRegister is never being invoked (looks like it's simply declared it in the application context).
As you're using Spring and JCR, I suggest you use Spring Modules, and follow these instructions.
Good luck,
--dj