Hi I'm new to cayenne and I am trying to create a Listener class that
listens to snapshots changes. So far I haven't been successful in
doing so. Could some one give some hints in how to do something like
that.
I used to do it in WebObjects with the following code:
NSNotificationCenter.defaultCenter().addObserver(this, new NSSelector
("publishChange", new Class[] { NSNotification.class }),
EOObjectStoreCoordinator.ObjectsChangedInStoreNotification,
EOObjectStoreCoordinator.defaultCoordinator());
In cayenne I am doing the following unsuccessfully:
public class IMWSEventListener implements SnapshotEventListener {
private static IMWSEventListener customListener = null;
private DataRowStore cache;
private IMWSEventListener() {
super();
DataContext dataContext = DataContext.createDataContext();
cache = dataContext.getObjectStore().getDataRowCache();
EventManager.getDefaultManager().addListener(this,
"snapshotsChanged", SnapshotEvent.class, cache.getSnapshotEventSubject
());
}
public static void init() {
if (customListener == null) {
customListener = new IMWSEventListener();
}
}
public void snapshotsChanged(SnapshotEvent event) {
System.out.println("\n\n ---- > > > > INSIDE THE LISTENER < < < < <
------- \n\n\n");
System.out.println("EVENT = " + event);
}
}
Any help would be appreciated.
This archive was generated by hypermail 2.0.0 : Wed Feb 15 2006 - 17:47:18 EST