From jlivingood at iaconline.com Mon Jan 15 13:21:17 2007 From: jlivingood at iaconline.com (James Livingood) Date: Mon, 15 Jan 2007 11:21:17 -0700 Subject: Simple Question about execute() Message-ID: <5E39C4594D28CB4B854E6C61FC43690A280B1F@ED.TFMT.IAC> Hello all, I am new to Cougaar development and am having trouble with a plugin I created. My plugin simply monitors objects on the blackboard and puts them into a Microsoft SQL database. I've subscribed to the object I want: HypothesisSub = (IncrementalSubscription) getBlackboardService().subscribe(HYPOTHESIS_PRED); And in my execute() I have: for (Iterator i = HypothesisSub.getAddedCollection().iterator(); i.hasNext();) { which grabs all the information and puts it into MS SQL. I get information in my MS SQL when I first subscribe, but not when objects on the blackboard change. Doesn't execute() run every time an object (that I have a subscription to) change? If not, what do I have to do? Thanks for any information! James -------------- next part -------------- An HTML attachment was scrubbed... URL: http://cougaar.org/pipermail/cougaar-developers/attachments/20070115/1734009e/attachment.html From abramsm at gmail.com Mon Jan 15 13:26:58 2007 From: abramsm at gmail.com (Matt Abrams) Date: Mon, 15 Jan 2007 13:26:58 -0500 Subject: Simple Question about execute() In-Reply-To: <5E39C4594D28CB4B854E6C61FC43690A280B1F@ED.TFMT.IAC> References: <5E39C4594D28CB4B854E6C61FC43690A280B1F@ED.TFMT.IAC> Message-ID: James - Your iterator is on the "added" collection. An subscription will invoke the execute method of your plugin when the objects that match your predicate are added, changed, or removed. If you'd like to process changed objects as well as added objects then you should have another snippet of code like: > for (Iterator i = HypothesisSub.getChangedCollection().iterator(); > i.hasNext();) { Matt On Jan 15, 2007, at 1:21 PM, James Livingood wrote: > Hello all, > > > > I am new to Cougaar development and am having trouble with a plugin > I created. My plugin simply monitors objects on the blackboard and > puts them into a Microsoft SQL database. > > > > I?ve subscribed to the object I want: > > HypothesisSub = (IncrementalSubscription) getBlackboardService > ().subscribe(HYPOTHESIS_PRED); > > > > And in my execute() I have: > > for (Iterator i = HypothesisSub.getAddedCollection().iterator(); > i.hasNext();) { > > > > which grabs all the information and puts it into MS SQL. > > > > I get information in my MS SQL when I first subscribe, but not when > objects on the blackboard change. Doesn?t execute() run every time > an object (that I have a subscription to) change? If not, what do I > have to do? > > > > > > Thanks for any information! > > > > > > James > > _______________________________________________ > Cougaar-developers mailing list > Cougaar-developers at cougaar.org > http://cougaar.org/mailman/listinfo/cougaar-developers -------------- next part -------------- An HTML attachment was scrubbed... URL: http://cougaar.org/pipermail/cougaar-developers/attachments/20070115/f499f624/attachment.html From jlivingood at iaconline.com Mon Jan 29 19:23:36 2007 From: jlivingood at iaconline.com (James Livingood) Date: Mon, 29 Jan 2007 17:23:36 -0700 Subject: Execute works on getAddedCollection but not getChangedCollection Message-ID: <5E39C4594D28CB4B854E6C61FC43690A1561FF@ED.TFMT.IAC> Hello all, I've subscribed to the object I want: HypothesisSub = (IncrementalSubscription) getBlackboardService().subscribe(HYPOTHESIS_PRED); And in my execute() I have: for (Iterator i = HypothesisSub.getAddedCollection().iterator(); i.hasNext();) { // grabs all the information and puts it into MS SQL. } for (Iterator i = HypothesisSub.getChangedCollection().iterator(); i.hasNext();) { // grab all the data AGAIN and put it into MS SQL } Why does the getAddedCollection run when the plugin is first started up, but the getChangedCollection does not run when objects that I've subscribed to change/new ones are added/etc? Thanks for any hints, information, things to check, etc. James -------------- next part -------------- An HTML attachment was scrubbed... URL: http://cougaar.org/pipermail/cougaar-developers/attachments/20070129/a659e93b/attachment-0001.html