[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: beginner question: Ozone & java.util collections
On Thu, 15 Jun 2000, Don Berendsen wrote:
> Thank you for your reply, I apologize for not formulating my question more
> clearly.
>
> I was thinking of the case where the collection would be a database class.
> Our application has an entry point to the database which is a Repository
> class that returns Maps of business objects (e.g. Customers, Products) with
> keys of name or id. If my understanding is correct a similar implementation
> would require that the Maps be database classes since the Maps are
> manipulated directly. Otherwise Ozone would return a serialized version of
> the Map object to the client rather than a proxy and therefore adds &
> deletes to the Map on the client wouldn't be reflected in the Map object in
> the Ozone database.
Yes, this is true.
> One option would be to have a wrapper database class that passed the method
> calls through to the Map in an instance variable. Perhaps that is the best
> implementation.
You don't need to write an actual wrapper. An interface that extends say
java.util.Map for the functionality and org.ozoneDB.OzoneRemote for the
persistency and a corresponding impl should work.
For java.util.HashSet such an interface should look like:
public interface OSet extends Set, OzoneRemote {
}
and a simple implementation like:
public class OHashSet extend HashSet implements OSet {
ctor...
}
should work. opp should be able to generate proper proxies for this. I didn't
try it yet. Does it work?
I'm not sure if this a common use case. Should we provide a package of such
interfaces for Java2 collections? The big drawback is that it may confuse users
when and why to use which kind of collection.
Falko
--
______________________________________________________________________
Falko Braeutigam mailto:falko@softwarebuero.de
softwarebuero m&b (SMB) http://www.softwarebuero.de