Naming Service
Summary by Uma Jaipradeep
Implementation by Prasad Joshi
The information presented was gathered from Internet.
Summary Contents
- Naming Service Overview
- Naming Objects in the Distributed Object System
- Naming Contexts
- Object Names
- Binding an Object with a Name
- Resolving a Named Object
- Creating a New naming Context
- Listing the Contents of a Naming Context
- Unbinding an Object from a Naming Context
- Client-Server Naming Scenario
- Implementation of Naming Service
- Links
Binding an Object with a Name
The following procedure demonstrates how you can bind an object in the system name space. This is useful for giving an object a human-readable name.
You can only bind an object in an existing naming context. If you use a compound name, all of the naming contexts identified in the name-path must already exist before the object can be bound. The name that you bind must be unique within the naming context. If the name you use is not unique within the target naming context then a CosNaming::AlreadyBound exception is raised.
1.Decide where you want to bind the object name: Where you decide to bind your object in the system name space can result in the requirement to create other naming contexts to build an appropriate name tree for the new object binding. The scope of visibility that you want the new binding to have determines whether the binding should be placed within the Host, Workgroup or Cell name-trees. If necessary, use the procedure described in Creating a New Naming Context to create a new naming context.
2.Resolve to the target naming context: The target naming context is the naming context in which you want the object to be bound. You can resolve to the target name context with the resolve() operation by means of one of the following choices:
If you already have a reference to the target naming context you can skip to step 3 without doing anything further.
If you already have a reference to a naming context that is superior to the target naming context then you can invoke the resolve() operation on the superior naming context, supplying the name of the target naming context. This principle can be applied recursively for any of the successively more superior naming contexts.
If you do not already have a naming context, you can get the root to the system name space using the ORB::resolve_initial_references("NamingService") operation (the CORBA standard approach) or by obtaining it from the CBSeriesGlobal::nameService static function (this static function is set by the CBSeriesGlobal::Initialize() method).
Having acquired the root naming context, you can resolve directly to the intended naming context by invoking the resolve() operation and passing the complete path of intermediate naming context names as a compound name.
3.Bind the object: Once you are positioned at the target naming context, you can bind the object with a new name using the bind() or bind_with_string() operation on the target naming context.
You can combine steps 2 and 3 by supplying a compound name that includes the path to the target name context and the name of the object being bound in the name argument on the bind() or bind_with_string() operations. In this case, step 2 is performed implicitly.
Summary Contents
- Naming Service Overview
- Naming Objects in the Distributed Object System
- Naming Contexts
- Object Names
- Binding an Object with a Name
- Resolving a Named Object
- Creating a New naming Context
- Listing the Contents of a Naming Context
- Unbinding an Object from a Naming Context
- Client-Server Naming Scenario
- Implementation of Naming Service
- Links