[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ExternalDatabase.objectForName()



On Thu, 14 Sep 2000, Martin Harper wrote:
> Falko Braeutigam wrote:
> 
> > I see. Try the following: get the long value of the ObjectID of the proxy:
> >
> >         long id = proxy.remoteID().value();
> >
> > and send this long id down the cable. On the other computer you build a new
> > proxy from the ObjectID value via:
> >
> >         ExternalDatabase db = ... ;
> >         long id = ... ;
> >         <your_type> proxy = (...)new OzoneProxy( new ObjectID( id ), database );
> >
> > This newly created proxy can be used just like any other proxy. No explicite
> > mapping is needed.
> >
> > This of course is totally unportable but should do exactly what you need ;)
> >
> > Falko
> 
> Yep - that seems to work.
> 
> One question, though - obviously I can't garantee to the recipient of the id that the
> referenced object will still be there when they receive the event (if they were
> particularly unlucky, it might be referring to an entirely new object, 
This isn't possible. If an database object is deleted it's ID is never used
again. So an ID/proxy is valid or not but it will never point to a wrong
database object.

> but I don't think
> this will ever occur in practice, and in any case, I have a few counter-measures up my
> sleeve...)
> 
> How would I test that the newly constructed proxy is valid? Or, put another way, what
> exception will get thrown if I try and use it and it is invalid?
ObjectNotFoundExc indicates that the ID/proxy is no longer valid.


Falko
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com