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

Re: OzoneProxy doesn't implement OzoneRemote?



On Mon, 11 Sep 2000, Martin Harper wrote:
> Is there any particular reason why OzoneProxy doesn't implement
> OzoneRemote? As I understand it, every (eg) CarImpl_Proxy class will
> implement Car, which will implement OzoneRemote, so all the subclasses
> do. Having the base class do so too would be nice in code such as :-
> 
>             OzoneRemote o;
>             o = db.objectForName( "xxx" );
>             db.deleteObject(o);
> 
> currently, the OzoneProxy returned by objectForName has to be cast to an
> OzoneRemote by hand for use in deleteObject. Is there any reason for
> this?

OzoneRemote and OzoneProxy should normally not be used in the application code.
The above code will work, if you use an actual (generated) proxy like Car:

	Car car;	
	car = (Car)db.objectForName( "" );
        db.deleteObject( car );

you have to explicitely cast return value of objectForName but this is the way
it is intented to be used. 

All Java interfaces, which define the remote methods of a database object
have to extend OzoneRemote. This allows the OPP to determine the methods to
export.

Because all generated proxies implement such interfaces generated proxies they
also implement OzoneRemote. Therefore OzoneRemote can be used as the general
type of database classes _and_ proxies. The OzoneInterface methods take
OzoneRemote objects as param because this interface is used from the client
via ExternalDatabase _and_ from within the database object via database()
(Database). The client calls deleteObject (for example) with OzoneProxies as
param, where a database object inside the database may call deleteObject with
`this` as param, which is of type OzoneCompatible. But both, generated proxies
and database object implement OzoneRemote.

Making OzoneProxy implement OzoenRemote would change the meaning of OzoneRemote.
But wouldon the other hand allow to write code like your example. Do you
think that avoiding the explicite cast is a good reason to change meaning of
OzoneRemote?


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