You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Paul Hammant <Pa...@yahoo.com> on 2002/04/08 21:14:55 UTC

[altrmi] Casting on the client side

Consider a trio of interfaces ...

 interface Mammal {}
 interface Dog extends Mammal {}
 interface Cat extends Mammal {}

And another interface to be proxied by AltRMI ..

  Mammal getMammal(String mammalName);

If a particular server side impl were to return an instance of Dog to 
the client it would not currently be castable from Mammal to Dog upon 
receipt.  This needs fixing.

I think in PublicationDescriptor and the 'altrmiproxies' taskdef  we 
need to optionally indicate which that X may not be the most derived 
type for certain return types.  In this case X is Mammal and the more 
derived types are Dog and Cat.  Here are some thoughts, expressed as 
rewritten altrmiproxies classes:

    <altrmiproxies genname="Farm" srcgendir="${build.home}/genjava" 
classgendir="${build.home}/genclasses" verbose="true" interfaces="pkg.Farm">
        <additionalfacades>
          <facade interface="pkg.Mammal" subinterfaces="pkg.Dog, pkg.Cat"/>
        </additionalfacades>
    </altrmiproxies>

or...

    <altrmiproxies genname="Farm" srcgendir="${build.home}/genjava" 
classgendir="${build.home}/genclasses" verbose="true" interfaces="pkg.Farm">
        <additionalfacades>
          <facade interface="pkg.Mammal">
             <subinterface interface="pkg.Dog"/>
             <subinterface interface="pkg.Cat"/>
          </facade>
        </additionalfacades>
    </altrmiproxies>

It would be stretching my Ant capabilities to the limit to do the above 
nesting, but what the hell ;-)

Thoughts anyone ?

Regards,

- Paul H


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>