Skip to main content

Product: OpenFusion CORBA Services

Version: ALL

 

Description:

What is the difference between the process singleton and the service singleton?

 

Resolution:

If you are running the clients on a machine which does not have OpenFusion installed you will not be able to use resolve_initial_references.

The resolve_initial_references works on the local machine because the a local ORB instance has been intialised with these parameters. When you are on a remote machine you are using a different ORB instance and it will not have the same references stored in it.

There are a number of methods you can use to get round this. They are defined in section 4.5 of the CORBA specification.

1. The simplest method is to read in the ior from a file. You can do this as follows: You will need to read in notification.ior from the server side and use orb.string_to_object(servicename.ior) to resolve it to a CORBA object and then narrow it to the correct object type. You can either read the file from the server directly if this is possible, copy it over to the client side or export it to a web server and read it in from there.

        Example of reading in the service IOR (This is for the Notification Service change names and types as appropriate.) It assumes that 'notification.ior' is in the current directory.

       FileInputStream fis = new FileInputStream ("NotificationSingleton.ior");

       byte[] data = new byte[fis.available ()];

       fis.read (data);

       fis.close ();

       String ior = new String (data);

       org.omg.CORBA.Object object = orb.string_to_object (ior); // Notification specific (see other service example code for correct object types)

       EventChannelFactory factory = EventChannelFactoryHelper.narrow(object);

       channel = factory.get_event_channel(0); // channel 0 must exist or channel = factory.create_channel (qosProp, admProp, id);

          Alternatively you can use -ORBInitRef to allow the ORB to connect to the Notification Service remotely. Using a shared file system, you simply provide the ior of the NameService using command –ORBInitRef NameService=file:

2. Using the corbaloc system – which is a bit more complex, but simplified if you use the iorDecoder executable in the <install_dir>/bin directory, to work out the corbaloc string to use. To use this you simply run iorDecoder –corbaloc –file .

    The program will then output the correct corbaloc string to use to pass on the command line. Then on your command line you would simply have –ORBInitRef NameService=corbaloc……… (whatever the corbaloc string is).


#OpenFusion
#KnowledgeDocs