[omniORB] problem with insPOA and Factory object

Juan Carlos Coruņa jcoruna@umd.es
Tue, 23 Jan 2001 09:45:00 +0100


Hello all!

I'm new to this mailing list and new to CORBA in general.

I try to implement a Factory object to create instances of another object, but without success.

This is the server code:

#!/usr/bin/python

import sys
from omniORB import CORBA, PortableServer
import MQ_module, MQ_module__POA
import corba_MQ

orb = CORBA.ORB_init(['./corba_server.py', '-ORBpoa_iiop_port', '2809'], CORBA.ORB_ID)

inspoa = orb.resolve_initial_references('omniINSPOA')

class MQ_class_i(corba_MQ.MQ_class, MQ_module__POA.MQ):
    pass

class MQ_Factory_i(MQ_module__POA.MQ_Factory):
    def create_MQ(self):
        print 'creating MQ'
        mq = MQ_class_i()
        return mq._this()

mq_Factory = MQ_Factory_i()
inspoa.activate_object_with_id("MQ_Factory", mq_Factory)

poaManager = inspoa._get_the_POAManager()
poaManager.activate()

orb.run()

This is the idl:
// echo.idl
module MQ_module {
interface MQ {
  typedef sequence<string> pairs;
  typedef sequence<pairs> list;
  string Version();
  string Login(in string user);
  short Logout();
  short SetDictionary(in string attr, in string val);
  short Send(in string recipient);
  short GetPriority();
  void SetPriority(in short prio);
  short Count();
  short GetMessage();
  short WaitMessage(in float sec);
  string GetFrom();
  short NextMsq();
  string Attrib();
  string Value();
  string Attributes(in short index);
  string Values(in short index);
  list GetPairs();
  short SetPairs(in pairs list);
  short Clear();
};
interface MQ_Factory {
  MQ create_MQ();
};
};

And this is the client:

#!/usr/bin/env python

import sys, time
from omniORB import CORBA
import MQ_module
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
ior = 'corbaloc::localhost:2809/MQ_Factory'
obj = orb.string_to_object(ior)
mq_factory  = obj._narrow(MQ_module.MQ_Factory)
if mq_factory is None:
    print "Object reference is not an MQ_interface"
    sys.exit(1)
mq_jcoruna = mq_factory.create_MQ()
mq_dsilva = mq_factory.create_MQ()

session = mq_jcoruna.Login('jcoruna')

The problem appears here in the last line ("session = mq_jcoruna.Login('jcoruna')"). The system doesn't return any value and waits until timeout. The system works correctly without the Factory.

What's wrong?