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
Unbinding an Object from a Naming Context
This procedure demonstrates how you can unbind an object from the system
name space. You can use this to remove a binding, perhaps as a part of destroying the object itself. You can only unbind an existing object binding. If you use a compound name, all of the naming contexts identified in the name-path must already exist before the object can be unbound.
1.Resolve to the target naming context: The target naming context is the naming context in which you want to unbind an object. You can resolve to the target name context with the resolve() operation using one of the choices that follow:
If you already have a reference to the target naming context,you can skip to step 2.
If you already have a reference to a naming context that is superior to the target naming context, 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 don't 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.
2.Unbind the object: Once you are positioned at the target naming context, you can unbind the object using the unbind() or unbind_with_string() operation on the target naming context.
You can combine steps 1 and 2 by supplying a compound name that includes the path to the target name context and the name of the object being unbound in the name argument on the unbind() or unbind_with_string() operation. In this case, step 1 is performed implicitly.
Two caveats apply when unbinding an object from a naming context:
The name that you unbind must already exist. If the name you specify does not exist then a CosNaming::NotFound exception is raised.
Naming contexts can be unbound from a superior naming context only if the target naming context had been previously bound using the bind() or bind_with_string() operations. In other words, for two naming contexts A and B, if you create a new naming context, called C, in A (using A-> create_new_context_with_string("C"), for instance) and later bind C in B, then you can unbind C from B. However, you cannot unbind C from A. You can only remove C from A by destroying C, and only after C has been emptied of any bindings it may have contained.
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