Execute works on getAddedCollection but not getChangedCollection
James Livingood
jlivingood at iaconline.com
Fri Feb 2 12:32:46 EST 2007
Hello Aaron,
You are correct in assuming this is an older version. The only difference
between the old and new version is that
HypothesisSub.getAddedCollection().iterator(); has been changed to
HypothesisSub.iterator(); to gather all objects; added or changed.
I am guessing the only way to resolve this now is to create a timer and
compare previous objects to new objects. (probably via their GUID)
If you have any potentially useful code or suggestions, please send them my
way. Otherwise I'll just proceed with the timer.
Thank you VERY VERY much for helping me with this plugin.
James
_____
From: Aaron Helsinger [mailto:ahelsing at bbn.com]
Sent: Friday, February 02, 2007 7:05 AM
To: James Livingood
Cc: 'Todd Wright'; 'cougaar-developers at cougaar.org'
Subject: Re: Execute works on getAddedCollection but not
getChangedCollection
James Livingood wrote:
Hello Aaron and Todd,
If the other plugin doesn't run publishChange(), is there still a way to
detect changes to the objects?
If no one calls publishChange, then no one knows that the object has
changed. The purpose of the publishChange call is to notify plugins that
something has changed -- which causes them to wake up, and their execute
method to be called. This is also what puts the object on the
ChangedCollection.
If you do not call publishChange, then the object will not be on the
ChangedCollection -- and if it is old, it also wont be on the
AddedCollection. So your plugin wouldnt see it. Additionally, Subscriptions
are how your plugin knows that it has work to do and should run. So if no
one calls publishChange on the object, then your plugin's subscriptions will
think there is nothing new for your plugin to do, so the plugin wont even
run!
Even if your plugin were periodically running anyway (a different
subscription, or an Alarm),
the only way in this case to tell that the object has changed would be to
compare it with some previous memory of what the object looked like.
Correct Cougaar behavior is to call publishChange on any object previously
publishAdded to the Blackboard when you change it.
The full Java file that you sent doesnt look at the ChangedCollection, so I
assume this is a previous version.
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cougaar.org/pipermail/cougaar-developers/attachments/20070202/6e4825fd/attachment-0001.html
More information about the Cougaar-developers
mailing list