[omniORB] Interface inheritance and mutliple interfaces to a single servan

Gary D. Duzan gdd0@gte.com
Fri, 09 Mar 2001 10:42:59 -0500


   The best you can do with this approach is to have two IDL files,
with the base interface in one and the derived interface in the
other, and only give out the first to clients. This might do for
most cases, but would still not be secure since the client could
always use the DII to access the derived bits.
   If you really want to keep the same implementation object but
have distinct CORBA objects, you might consider using delegation
instead of inheritance for your servants. It looks like the Python
mapping doesn't have ties built in, but one would be easy enough
to write. You would implement one skeleton-derived class for Foo1
and another for Foo2 which take an object in their constructors
and forward all the IDL-defined method calls to it. This way you
could create a class Foo_impl which doesn't inherit from any
skeleton, create an instance of it, and give the instance to both
the Foo1 and Foo2 implementation objects, giving you two distinct
CORBA objects with different interfaces and a single Foo_impl object
as the real servant.

					Gary Duzan
					Verizon Laboratories



In Message <3AA8C0AB.AF6E1D5F@floconsult.be> ,
   FloConsult SPRL <info@floconsult.be> wrote:

=3D>I have a problem regarding interfaces separation in CORBA using Python
=3D>(and OmniORB, but this shouldn't change anything). =

=3D>I would like to offer two interfaces on the same object, one limited a=
nd
=3D>one enhanced. But if I try to bind on the limited interface, I get the
=3D>complete one.
=3D>In the FAQ, I saw a similar problem, but I want to have only one
=3D>servant, which is accessed by different interfaces.
=3D>Could you help me ?
=3D>
=3D>I have the following IDL interface:
=3D>
=3D>module toto {
=3D>        interface Foo1{
=3D>                void method1();
=3D>        };
=3D>        interface Foo2 : Foo1{
=3D>                void method2();
=3D>        };
=3D>}
=3D>
=3D>The implementation file in Python is:
=3D>*************************************
=3D>import toto, toto_POA
=3D>class Foo2_i(RowingClub__POA.Foo2):
=3D>        def method1(self):
=3D>                #something
=3D>        def method2(self):
=3D>                #something
=3D>  =

=3D>
=3D>=3D> Foo1 and Foo2 are implemented in the same Foo2_i
=3D>On the server side, I use the POA:
=3D>**********************************
=3D>foo2Servant =3D  Foo2_i()
=3D>foo2Ref =3D foo2Servant._this()
=3D>
=3D>and for the moment I publish the ior from foo2Ref.
=3D>
=3D>
=3D>On the client side, I bind on the limited interface
=3D>(say the ior is stored in obj):
=3D>**********************************************************
=3D>foo1Itf =3D obj._narrow(toto.Foo1)
=3D>
=3D>
=3D>My problem is:
=3D>*************
=3D>dir(foo1Itf) gives 'method1' and 'method2', while I would like to
=3D>prevent users of this limited interface to use 'method2'.
=3D>
=3D>Thanks in advance,
=3D>
=3D>Isabelle.
=3D>mailto: isabelle.leclercq@floconsult.be
=3D>
=3D>-- =

=3D>     /\`.        /\`.        FloConsult SPRL
=3D>    /  \ `.     /  \ `.      http://www.floconsult.be
=3D>   /    \ .=B4   /    \ .=B4     mailto:info@floconsult.be
=3D>  =B4------=B4    =B4------=B4       Tel. +32 2 390.07.89
=3D>
=3D>