This article explains how to run the Spectra ORB Name Service on a fixed port. This enables you to find and Name Service and easily look up other objects.
What is the Name Service?
When you have a lot of objects within a system it can be difficult to locate the one you want to use. The Naming Service allows you to associate meaningful names with an object. You can then lookup the name and find the object.
For example you may have a banking application and want to find the checking account object belonging to a user. The checking account object is registered in the Naming Service with the name of the account holder. You can then go to the Naming Service look up the name of the account holder and it will return a reference to the Checking Account object.
The Naming Service is similar to the telephone white pages. Objects register themselves by name and other objects can then easily locate them. This allows you to locate objects and bootstrap a distributed system. The Naming Service is can be found in a standard way by the ORB runtime system using the resolve_initial_references() operation.
How to run the Spectra ORB Naming Service on a fixed port
When the Naming Service is running there are two ways for applications to connect to it.
- You can provide the application with the IOR of the Naming Service using the command -ORBInitRef NameService=file:<path to NameService>/NameService.ior
- You can use corbaloc to point to the host where the Naming Service is running and the port it is running on. Your command line will be-ORBInitRef NameService=corbaloc:iiop:1.2@<hostid>:<port>/NameService
The second way is much simpler but you need to ensure that the Spectra ORB Naming Service is running on a fixed port. If you stop and start the Naming Service it will start on the same port and you will not need to change the corbaloc string.
There are a number of steps you need to take to ensure the Naming Service is running on a specific host and port. These are:
- Start the Naming Service explicitly with an -ORBListenEndpoints argument.
- Configure the DomainManager instance in your model with an ORBInitRef property value set to NamingService=corbaloc:iiop:1.2@<host>:<port>
- Start the DeviceManager via the boot loader with the same -ORBInitRef parameter.
This is an example that shows how to start the Naming Service on a fixed port. You can find the example in CFHOME/bin in your Spectra ORB installation and you can easily copy it to your target.
Start the Naming Service
namingc.vxe -ORBListenEndpoints iiop://172.16.199.128:38000
If the ORBInitRef parameter is added to the DomainManager instance in your CX model correctly, you will see it in the DomainManager.prf.xml file:
<simple id="ORBInitRef" type="string" name="ORBInitRef" mode="readwrite"> <value>NameService=corbaloc:iiop:email@example.com:38000/NameService</value> <kind kindtype="execparam"/> </simple>
Finally start the device manager using the -ORBInitRef corbaloc parameter
./BootLoader_g.vxe -DCD\_FILENAME DecryptorNode.dcd.xml \ -ORBInitRef NameService=corbaloc:iiop:firstname.lastname@example.org:38000/NameService