[omniORB] Interface repository
Duncan Grisby
dgrisby@uk.research.att.com
Thu, 17 May 2001 15:05:50 +0100
On Thursday 17 May, Timothy Docker wrote:
> I would like to use the interface repository from client side python
> code. Unfortunately, the _get_interface() method is not yet
> implemented. Looking at the C++ code, it looks like it is implemented,
> although
It's actually trivial to implement _get_interface(). I just hadn't
ever got around to it. I've checked it in to CVS now. The change is
tiny, so I've included the patch below.
Note that even without this patch, you can still contact the interface
repository by doing resolve_initial_references("InterfaceRepository")
and calling operations on the object you get.
Cheers,
Duncan.
diff -u -r1.27.2.2 CORBA.py
--- src/lib/omniORBpy/python/omniORB/CORBA.py 2000/08/17 08:46:06 1.27.2.2
+++ src/lib/omniORBpy/python/omniORB/CORBA.py 2001/05/17 13:59:03
@@ -592,8 +592,18 @@
o.__del__ = dummy
def _get_interface(self):
- # ***
- raise NO_IMPLEMENT()
+ import omniORB
+ if omniORB.orb is None:
+ raise BAD_INV_ORDER(0, COMPLETED_NO)
+
+ import omniORB.ir_idl # Make sure IR stubs are loaded
+
+ ir = omniORB.orb.resolve_initial_references("InterfaceRepository")
+ ir = ir._narrow(Repository)
+ if ir is None:
+ raise INTF_REPOS(0, COMPLETED_NO)
+ interf = ir.lookup_id(self._NP_RepositoryId)
+ return interf._narrow(InterfaceDef)
def _is_a(self, repoId):
return _omnipy.isA(self, repoId)
--
-- Duncan Grisby \ Research Engineer --
-- AT&T Laboratories Cambridge --
-- http://www.uk.research.att.com/~dpg1 --