import sys import MateCORBA sys.path.append(".libs") MateCORBA.load_typelib("./TestCall_module") import CORBA, PyMateCORBA, PyMateCORBA__POA import cTestCall class PyTestCall(PyMateCORBA__POA.TestCall): def op1(self, other): this = self._this() print " Python impl of TestCall.op1 invoked" other.op2(this) def op2(self, other): print " Python impl of TestCall.op2 invoked" other.op3() def op3(self): this = self._this() print " Python impl of TestCall.op3 invoked" orb = CORBA.ORB_init(sys.argv) poa = orb.resolve_initial_references("RootPOA") # create the C objref c_objref = cTestCall.create_TestCall(orb)
#! /usr/bin/env python import MateCORBA import CORBA import sys, os import CORBA try: if CORBA.ORB_ID == "omniORB4": # don't forget omniidl -bpython echo.idl pass #print "using omniORB" except AttributeError: # MateCORBA's CORBA has no ORB_ID import MateCORBA #print "using MateCORBA" #MateCORBA.load_file("./echo.idl") MateCORBA.load_typelib("echo") import Test__POA class EchoServant(Test__POA.Echo): def echo(self, message): print "Received message: '%s'" % message return message def quit(self): print "Quitting..." global orb orb.shutdown(0)
import sys import MateCORBA sys.path.append('.libs') MateCORBA.load_typelib('./TestCall_module') import CORBA, PyMateCORBA, PyMateCORBA__POA import cTestCall class PyTestCall(PyMateCORBA__POA.TestCall): def op1(self, other): this = self._this() print " Python impl of TestCall.op1 invoked" other.op2(this) def op2(self, other): print " Python impl of TestCall.op2 invoked" other.op3() def op3(self): this = self._this() print " Python impl of TestCall.op3 invoked" orb = CORBA.ORB_init(sys.argv) poa = orb.resolve_initial_references('RootPOA') # create the C objref c_objref = cTestCall.create_TestCall(orb)
#!/usr/bin/env python '''This is a client to the test/everything/server test program distributed with MateCORBA2.''' import sys, os import unittest import MateCORBA MateCORBA.load_typelib('Everything') import CORBA # this one is loaded from the typelib ... from matecorba import test import constants # from test/everything/constants.h class EverythingTestCase(unittest.TestCase): def test01_attribute(self): '''attributes''' objref = factory.getBasicServer() assert objref._is_a('IDL:matecorba/test/BasicServer:1.0') val = objref.foo assert val == constants.STRING_RETN objref.foo = constants.STRING_IN lval = objref.bah
# -*- Mode: Python; py-indent-offset: 4 -*- import gobject del gobject # load the matecomponent typelib import MateCORBA MateCORBA.load_typelib('MateComponent') del MateCORBA import activation from _matecomponent import * class UnknownBaseImpl(object): def __init__(self): self.__bobj = ForeignObject(self._this()) self.__bobj.connect("destroy", self.__destroy) def get_matecomponent_object(self): return self.__bobj def ref(self): self.__bobj.ref() def unref(self): self.__bobj.unref() def queryInterface(self, repoid): return self.__bobj.query_local_interface(repoid).corba_objref()
# -*- Mode: Python; py-indent-offset: 4 -*- import gobject del gobject # load the matecomponent typelib import MateCORBA MateCORBA.load_typelib('MateComponent') del MateCORBA import activation from _matecomponent import * class UnknownBaseImpl(object): def __init__(self): self.__bobj = ForeignObject(self._this()) self.__bobj.connect("destroy", self.__destroy) def get_matecomponent_object(self): return self.__bobj def ref(self): self.__bobj.ref() def unref(self): self.__bobj.unref() def queryInterface(self, repoid): return self.__bobj.query_local_interface(repoid).corba_objref() def __destroy(self, foreign): # print "Deactivating Object" poa = self._default_POA() id = poa.servant_to_id(self) poa.deactivate_object(id) # print "Removing reference to ForeignObject"