What kind of object to store changing values?
Guillaume Liegard
guillaume.liegard at gmail.com
Thu Sep 13 07:29:45 EDT 2007
Thank you very much.
I think simple POJOs will answer our needs.
--
Guillaume
2007/9/12, Todd Wright <twright at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cougaar.org/pipermail/cougaar-developers/attachments/20070913/a17f37c7/attachment-0001.html
More information about the Cougaar-developers
mailing list