#! /usr/bin/env python

import MateCORBA
import CORBA
import sys

if len(sys.argv) != 2:
    print "usage: %s <message>" % sys.argv[0]
    sys.exit(1)

## this should no longer be needed, but is here as workaround to
## http://bugzilla.mate.org/show_bug.cgi?id=323201
## you also need to use this if the server is not MateCORBA2 based
MateCORBA.load_file("./echo.idl")
#import Test  # use this if the server is not MateCORBA2 based

orb = CORBA.ORB_init(sys.argv)

ior = file('iorfile').read()
echo = orb.string_to_object(
    ior)  #._narrow(Test.Echo) # _narrow not needed with MateCORBA2 servers

if sys.argv[1] == 'quit':
    echo.quit()
else:

    def callback(retval, exc_type, exc_value, user_data):
        assert user_data == "hello"
        print "async callback", retval
        orb.shutdown(0)
import sys
import threading
import time
import MateCORBA
import CORBA

## this should no longer be needed, but is here as workaround to
## http://bugzilla.mate.org/show_bug.cgi?id=323201
MateCORBA.load_file('./pyt.idl')

orb = CORBA.ORB_init(orb_id="matecorba-io-thread")

for num in [int(x) for x in sys.argv[1:]]:
    pyt = orb.string_to_object(open('ior%i' % num).read())
    t1 = threading.Thread(target=pyt.op)
    t1.start()

Example #3
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)
Example #4
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
Example #6
0
#! /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)

Example #7
0
#! /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)

# -*- 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()
#!/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
#! /usr/bin/env python

import MateCORBA
import CORBA
import sys

if len(sys.argv) != 2:
    print "usage: %s <message>" % sys.argv[0]
    sys.exit(1)

## this should no longer be needed, but is here as workaround to
## http://bugzilla.mate.org/show_bug.cgi?id=323201
## you also need to use this if the server is not MateCORBA2 based
MateCORBA.load_file("./echo.idl")
#import Test  # use this if the server is not MateCORBA2 based

orb = CORBA.ORB_init(sys.argv)

ior = file('iorfile').read()
echo = orb.string_to_object(ior)#._narrow(Test.Echo) # _narrow not needed with MateCORBA2 servers

if sys.argv[1] == 'quit':
    echo.quit()
else:
    def callback(retval, exc_type, exc_value, user_data):
        assert user_data == "hello"
        print "async callback", retval
        orb.shutdown(0)
    echo.echo.async([sys.argv[1]], callback, "hello")
    orb.run()
Example #11
0
# -*- 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"