From guillaume.liegard at gmail.com Wed Sep 12 07:07:17 2007 From: guillaume.liegard at gmail.com (Guillaume Liegard) Date: Wed, 12 Sep 2007 13:07:17 +0200 Subject: What kind of object to store changing values? Message-ID: <1dd8f11e0709120407t66a79ea3se5ac4111a26fc76c@mail.gmail.com> Hello, I am making a tool to monitor process activities of a host. So I want to publish a representation of each process on the blackboard and update them on a regular basis. My problem is to choose the best kind of objet to represent each process on the blackboard. 1. Can I use assets as they don't seem to be modifiable and I don't want to create new objects everytime (garbage collector)? 2. What exactly are Change Reports? Can I use them in this case? I have seen the method blackboard.publishChange(Object, Collection); but I don't know how to get back the change reports (when other plugins have suscribed to this object). 3. Are FrameSets a good way to deal with simple problems like that? Following a previous mail, I had a look at FrameSets. The mechanism seems very complex for such a simple problem. 4. Aren't POJOs a good solution for this simple problem? What are the drawbacks? Thanks you very much for your advises. Best regards. -- Guillaume Li?gard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://cougaar.org/pipermail/cougaar-developers/attachments/20070912/547171fe/attachment.html From twright at bbn.com Wed Sep 12 11:17:12 2007 From: twright at bbn.com (Todd Wright) Date: Wed, 12 Sep 2007 11:17:12 -0400 Subject: What kind of object to store changing values? In-Reply-To: <1dd8f11e0709120407t66a79ea3se5ac4111a26fc76c@mail.gmail.com> References: <1dd8f11e0709120407t66a79ea3se5ac4111a26fc76c@mail.gmail.com> Message-ID: <46E802F8.2020801@bbn.com> Guillaume Liegard wrote: > Hello, > > I am making a tool to monitor process activities of a host. So I want to > publish a representation of each process on the blackboard and update > them on a regular basis. > > My problem is to choose the best kind of objet to represent each process > on the blackboard. > > 1. Can I use assets as they don't seem to be modifiable and I don't want > to create new objects everytime (garbage collector)? The PropertyGroups attached to an asset are modifiable; you don't have to create a new object every time you modify an asset. Assets are likely more complicated than what you require. > > 2. What exactly are Change Reports? Can I use them in this case? When a plugin calls "publishChange", it can optionally specify a set of ChangeReports to note what has changed (e.g. "changed field X"). Other plugins will see these ChangeReports in their subscription change lists. These ChangeReports are transient -- they are discarded once all plugin subscriptions have been notified. For details, see Cougaar Developers' Guide section 3.2.4.4. You can't use ChangeReports by themselves to implement your blackboard objects. However, you might want to use ChangeReports with your blackboard objects to indicate what has changed, assuming that a subscriber plugin is interested in these details. You can use ChangeReports with any type of blackboard object. > > I have seen the method blackboard.publishChange(Object, Collection); but > I don't know how to get back the change reports (when other plugins have > suscribed to this object). Use "subscription.getChangeReports(Object)", e.g.: for (Object o : sub.getChangedCollection()) { Set s = sub.getChangeReports(o); ... } > > 3. Are FrameSets a good way to deal with simple problems like that? > Following a previous mail, I had a look at FrameSets. The mechanism > seems very complex for such a simple problem. FrameSets are intended for this type of "system" data representation. However, I agree that they are difficult to use. We need a simple FrameSet tutorial. For your simple example, you don't need to use FrameSets. It might be nice someday. > > 4. Aren't POJOs a good solution for this simple problem? Yes. Make sure that the "equals" and "hashCode" methods are correctly defined and not based on modifiable fields. The Java default Object-based "equals" and "hashCode" methods are fine. Or, consider implementing UniqueObject by subclassing: http://cougaar.org/cgi-bin/viewcvs.cgi/core/src/org/cougaar/core/util/UniqueObjectBase.java?rev=1.2&cvsroot=core&content-type=text/vnd.viewcvs-markup Get the UID from the UIDService "nextUID()" method. The benefit of implementing UniqueObject is that this will make your objects visible in the "/tasks" servlet. > What are the > drawbacks? You'll miss out on some of the more complex features supported by Assets and FrameSets. Todd > > Thanks you very much for your advises. > > Best regards. > > -- > Guillaume Li?gard > > > ------------------------------------------------------------------------ > > _______________________________________________ > Cougaar-developers mailing list > Cougaar-developers at cougaar.org > http://cougaar.org/mailman/listinfo/cougaar-developers From guillaume.liegard at gmail.com Thu Sep 13 07:29:45 2007 From: guillaume.liegard at gmail.com (Guillaume Liegard) Date: Thu, 13 Sep 2007 13:29:45 +0200 Subject: What kind of object to store changing values? In-Reply-To: <46E802F8.2020801@bbn.com> References: <1dd8f11e0709120407t66a79ea3se5ac4111a26fc76c@mail.gmail.com> <46E802F8.2020801@bbn.com> Message-ID: <1dd8f11e0709130429h546317e1hc42b3039f4e22d53@mail.gmail.com> Thank you very much. I think simple POJOs will answer our needs. -- Guillaume 2007/9/12, Todd Wright : > > Guillaume Liegard wrote: > > Hello, > > > > I am making a tool to monitor process activities of a host. So I want to > > publish a representation of each process on the blackboard and update > > them on a regular basis. > > > > My problem is to choose the best kind of objet to represent each process > > on the blackboard. > > > > 1. Can I use assets as they don't seem to be modifiable and I don't want > > to create new objects everytime (garbage collector)? > > The PropertyGroups attached to an asset are modifiable; you don't have to > create a new object every time you modify an asset. > > Assets are likely more complicated than what you require. > > > > > 2. What exactly are Change Reports? Can I use them in this case? > > When a plugin calls "publishChange", it can optionally specify a set of > ChangeReports to note what has changed (e.g. "changed field X"). Other > plugins > will see these ChangeReports in their subscription change lists. These > ChangeReports are transient -- they are discarded once all plugin > subscriptions > have been notified. For details, see Cougaar Developers' Guide section > 3.2.4.4. > > You can't use ChangeReports by themselves to implement your blackboard > objects. > However, you might want to use ChangeReports with your blackboard > objects to > indicate what has changed, assuming that a subscriber plugin is interested > in > these details. You can use ChangeReports with any type of blackboard > object. > > > > > I have seen the method blackboard.publishChange(Object, Collection); but > > I don't know how to get back the change reports (when other plugins have > > > suscribed to this object). > > Use "subscription.getChangeReports(Object)", e.g.: > for (Object o : sub.getChangedCollection()) { > Set s = sub.getChangeReports(o); > ... > } > > > > > 3. Are FrameSets a good way to deal with simple problems like that? > > Following a previous mail, I had a look at FrameSets. The mechanism > > seems very complex for such a simple problem. > > FrameSets are intended for this type of "system" data > representation. However, > I agree that they are difficult to use. We need a simple FrameSet > tutorial. > > For your simple example, you don't need to use FrameSets. It might be > nice > someday. > > > > > 4. Aren't POJOs a good solution for this simple problem? > > Yes. > > Make sure that the "equals" and "hashCode" methods are correctly defined > and > not based on modifiable fields. The Java default Object-based "equals" > and > "hashCode" methods are fine. > > Or, consider implementing UniqueObject by subclassing: > > http://cougaar.org/cgi-bin/viewcvs.cgi/core/src/org/cougaar/core/util/UniqueObjectBase.java?rev=1.2&cvsroot=core&content-type=text/vnd.viewcvs-markup > Get the UID from the UIDService "nextUID()" method. The benefit of > implementing UniqueObject is that this will make your objects visible in > the > "/tasks" servlet. > > > What are the > > drawbacks? > > You'll miss out on some of the more complex features supported by Assets > and > FrameSets. > > Todd > > > > > Thanks you very much for your advises. > > > > Best regards. > > > > -- > > Guillaume Li?gard > > > > > > ------------------------------------------------------------------------ > > > > > _______________________________________________ > > 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/20070913/a17f37c7/attachment-0001.html From jzinky at bbn.com Thu Sep 13 09:43:19 2007 From: jzinky at bbn.com (John Zinky) Date: Thu, 13 Sep 2007 09:43:19 -0400 Subject: What kind of object to store changing values? In-Reply-To: <1dd8f11e0709130429h546317e1hc42b3039f4e22d53@mail.gmail.com> References: <1dd8f11e0709120407t66a79ea3se5ac4111a26fc76c@mail.gmail.com> <46E802F8.2020801@bbn.com> <1dd8f11e0709130429h546317e1hc42b3039f4e22d53@mail.gmail.com> Message-ID: <8F43B059-243B-4832-8DB6-78E4EA11A3FC@bbn.com> On Sep 13, 2007, at 7:29 AM, Guillaume Liegard wrote: > Thank you very much. > I think simple POJOs will answer our needs. > Actually you do not want a POJO, you want an UniqueObject. Generality aside, it is now recommended that ALL Blackboard object implement UniqueObject. The org.cougaar.core.util.UniqueObject interface allows your Blackboard objects to be viewed by the task servlet. Also, in order to move the object to another blackboard (via a relay), the object must be Serializable. A base implementation is in org.cougaar.core.util.UniqueObjectBase (in HEAD as of Sept 12th, 2007) import org.cougaar.core.util.UniqueObjectBase; public class UniqueObjectBase implements UniqueObject { private final UID uid; public UniqueObjectBase(UID uid) { if (uid == null) { throw new IllegalArgumentException("null uid"); } this.uid = uid; } public final UID getUID() { return uid; } public final void setUID(UID uid) { throw new IllegalStateException("UID cannot be changed"); } public final boolean equals(Object o) { return ((o == this) || ((o instanceof UniqueObject) && uid.equals(((UniqueObject) o).getUID()))); } public final int hashCode() { return uid.hashCode(); } public String toString() { return "("+getClass().getName()+" uid="+uid+")"; } } Also you may want to use the following trick to get the UID, which needs to be made in the context of the creating plugin. You save a little text if you pass in the UID service and not a UID itself. import org.cougaar.core.service.UIDService; import org.cougaar.core.util.UniqueObjectBase; public class PingQuery extends UniqueObjectBase { private int count; public PingQuery(UIDService uids, int count, ) { super(uids.nextUID()); this.count = count; } } In HEAD in org.cougaar.core.plugin.ParametrizedPlugin the UIDService is obtained automatically as field variable public UIDService uids; So to make a new PingQuery the call would be PingQuery query = new PingQuery(uids,0); Using alternate implementation where you pass in the UID instead of the UIDService would be: PingQuery query = new PingQuery(uids.nextID(),0); From twright at bbn.com Mon Sep 24 16:28:41 2007 From: twright at bbn.com (Todd Wright) Date: Mon, 24 Sep 2007 16:28:41 -0400 Subject: Cougaar 12.4 has been released Message-ID: <46F81DF9.8020504@bbn.com> Cougaar 12.4 has been posted to the website: http://cougaar.org/frs/?group_id=17&release_id=161 Some of the enhancements include: * Eclipse project files have been added (in CVS) to make it easy to compile core jars and launch the "ping" demos. * Servlet tunneling has been added: http://cougaar.cougaar.org/software/12.4/OnlineManual/ServletTunnel.html * The MTS has been refactored into "mtsstd" and "mtslinks" modules. * New demos included as separate "demo-.zip" files, e.g. the ping demo is now in "demo-ping.zip". * Java 1.5 language features have been added to some APIs, such as the ServiceBroker. For details, please see the release notes: http://cougaar.cougaar.org/software/12.4/doc/index.html Please send email if you run into any problems with this release. Thanks, Todd From duchene.morgan at wanadoo.fr Tue Sep 25 02:55:25 2007 From: duchene.morgan at wanadoo.fr (=?ISO-8859-1?Q?Morgan_Duch=E8ne?=) Date: Tue, 25 Sep 2007 08:55:25 +0200 Subject: Congratulations for the 12.4 Message-ID: <46F8B0DD.7010301@wanadoo.fr> Thanks to the Cougaar team for these great features! Morgan