RE: Additional interfaces for proxy objects?
"Wieslaw Faruga" <[email protected]> Thu, 02 Dec 2004 14:57:34 +0100
| Newsgroups | gmane.comp.java.ozone.user |
|---|---|
| Message-ID | <41AF2D5E.13008.1AB22B5@localhost> |
Hi, On 1 Dec 2004 at 13:04, Aidan Slingsby wrote: > > Is it possible for proxy classes to implement more than one > > interface? I was hoping that OPP would would automatically > > give the proxy classes all the interfaces listed in the Impl > > class, but they are only given the one Ozone interface > > (inherited from OzoneRemote). > > I should perhaps give a few more details of what I want. I am slightly hazy > about exactly how all this works - sorry. > > I used to have an interface called Line (which extended OzoneRemote) and a > class called LineImpl (extended from OzoneObject). Proxy classes were > generated in the usual way. > > The problem is that there are cases when I wish to temporarily create a > LineImpl) i.e. outside the database to be used in the short term. I'd do > this by new NodeImpl(). As long as I wasn't passing between client and > server, this was fine. And I didn't, because it was only short-lived. This > was my workaround. > > There is now a situation where I wish to pass the temporary Line between > client and server, and of course I get a "not (yet) in database" error. > Transferring a regular java object (serializable) between client an server is possible in standard way: as a parameter of an ozone object method and returning as argument of a return statement. This object is serialized and transferred in both directions. > My solution was to have two interfaces. One called Line (standard Java) and > one called LineDB (which extends OzoneRemote), both with the same methods > defined. Then have a class LineGeometry (a standard Serialisable Java > object) and LineDBImpl (an object object). LineDBImpl is a wrapper object, > which has a protected LineGeometry variable and all the methods in the > interface passed through to LineGeometry. Since LineGeometry implements > Line and LineDBImpl implements Line and LineDB, they can both be treated as > Line. The idea is that a Line could be a LineGeometry, a LineDBImpl (which > wraps around LineGeometry) or a proxy. I was hoping that the proxy object > could also implement Line and LineDB, so it can be treated as Line. > You can only reach an ozone object by a proxy. It is impossible to work with a regular java object this way. Cheers, Wieslaw ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/