Yes its a listener for changes to Business objects.
A sample use cases can be :-
1)Let say you have a online catalog of multiple Vendors. For performance
reasons
a)You have cached the results of searches made by buyers.
b)Your tag library for displaying product info might have a LRU cache of
html generated after doing xslt transformation.
c)and similarly you might have cached some information.

Now to stay competitive in market you poll some competitor site and as soon
as prices changes there you change your prices automatically(within a
certain limit).
2)Similarly the Vendors can use a Desktop tool to edit their product catalog
and upload it. They can remove/add/edit existing products.
3)Vendors can change visibility of products to certain types of buyers.
3)Similarly you have certain other caches of business objects.

Now the problem was that we have to clear these intermediate caches if the
business object was changed due to any reason. One solution was to make it
explicit in the DAO classes i.e. explicitly fireListeners in the
createProduct,updateProduct,removeProduct,updatePrices method. But the
problem was that if one of the developer forgets to call fireListeners then
its a problem. So to make it implicit we decided to push it to castor and
now developers are free to fireListener.They just need to register their
cache as a listener to object update events.

Also now the listener and all this code for firing events is generic to all
business objects.

-Kalpesh

-----Original Message-----
From: Bruce Snyder [mailto:[EMAIL PROTECTED]
Sent: Friday, September 10, 2004 10:09 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] CastorObjectChangeListener



Kalpesh Patel wrote:

> We also implemented a CastorObjectChangeListener.The basic purpose of this
> is that if your application wants to listen to changes in particular type
of
> objects then it can register more then one listener with the JDO like
>
> CastorObjectChangeListener listener =
InventoryChangeListener.getInstance();
> Class clazz = Inventory.class;
> jdo.registerCastorObjectChangeListener(clazz,listener);
>
> Now throughout the application if anyone changes any object of type
> Inventory an objectUpdate() method will be called on the listener and it
can
> do whatever it wants.
>
> We had several Business Delegates caching intermediate results (sort of
> value list handlers). Now we register them with castor and simultaneously
if
> someone changes the data, we can clear the model and run a fresh search.
>
>
> If you are interested we can commit this code also?

This sounds interesting. So it's a listener for changes to your business
objects, correct? Can you outline some additional use cases for it?

Bruce
--
perl -e 'print
unpack("u30","<0G)[EMAIL PROTECTED]&5R\\"F9E<G)E=\\$\\!F<FEI+F-O;0\\`\\`");'

The Castor Project
http://www.castor.org/

Apache Geronimo
http://incubator.apache.org/projects/geronimo.html



-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to