19972013 Ericsson AB. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. CosNaming_NamingContext 1997-06-10 A
CosNaming_NamingContext This interface supports different bind and access functions for names in a context.

This is the object that defines name scopes, names must be unique within a naming context. Objects may have multiple names and may exist in multiple naming contexts. Name context may be named in other contexts and cycles are permitted.

The type NameComponent used below is defined as:

-record('CosNaming_NameComponent', {id, kind=""}).

where id and kind are strings.

The type Binding used below is defined as:

-record('CosNaming_Binding', {binding_name, binding_type}).

where binding_name is a Name and binding_type is an enum which has the values nobject and ncontext.

Both these records are defined in the file CosNaming.hrl and it is included with:

-include_lib("orber/COSS/CosNaming/CosNaming.hrl").

There are a number of exceptions that can be returned from functions in this interface.

NotFound is defined as

-record('CosNaming_NamingContext_NotFound', {rest_of_name, why}).

CannotProceed is defined as

-record('CosNaming_NamingContext_CannotProceed', {rest_of_name, cxt}).

InvalidName is defined as

-record('CosNaming_NamingContext_InvalidName', {}).

NotFound is defined as

-record('CosNaming_NamingContext_NotFound', {}).

AlreadyBound is defined as

-record('CosNaming_NamingContext_AlreadyBound', {}).

NotEmpty is defined as

-record('CosNaming_NamingContext_NotEmpty', {).

These exceptions are defined in the file CosNaming_NamingContext.hrl and it is included with:

-include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl").
bind(NamingContext, Name, Object) -> Return Bind a Name to an Object NameContext = #objref Name = [NameComponent] Object = #objref Return = ok

Creates a binding of a name and an object in the naming context. Naming contexts that are bound using bind() do not participate in name resolution.

rebind(NamingContext, Name, Object) -> Return Bind an Object to the Name even if the Name already is bound NamingContext = #objref Name = [NameComponent] Object = #objref Return = ok

Creates a binding of a name and an object in the naming context even if the name is already bound. Naming contexts that are bound using rebind() do not participate in name resolution.

bind_context(NamingContext1, Name, NamingContex2) -> Return Bind a Name to an NamingContext NamingContext1 = NamingContext2 =#objref Name = [NameComponent] Return = ok

The bind_context function creates a binding of a name and a naming context in the current context. Naming contexts that are bound using bind_context() participate in name resolution.

rebind_context(NamingContext1, Name, NamingContex2) -> Return Bind an NamingContext to the Name even if the Name already is bound NamingContext1 = NamingContext2 =#objref Name = [NameComponent] Return = ok

The rebind_context function creates a binding of a name and a naming context in the current context even if the name already is bound. Naming contexts that are bound using rebind_context() participate in name resolution.

resolve(NamingContext, Name) -> Return Retrieve an Object bound to Name NamingContext = #objref Name = [NameComponent] Return = Object Object = #objref

The resolve function is the way to retrieve an object bound to a name in the naming context. The given name must match exactly the bound name. The type of the object is not returned, clients are responsible for narrowing the object to the correct type.

unbind(NamingContext, Name) -> Return Remove the binding for a Name NamingContext = #objref Name = [NameComponent] Return = ok

The unbind operation removes a name binding from the naming context.

new_context(NamingContext) -> Return Create a new NamingContext NamingContext = #objref Return = #objref

The new_context operation creates a new naming context.

bind_new_context(NamingContext, Name) -> Return Create a new NamingContext and bind it to a Name NamingContext = #objref Name = [NameComponent] Return = #objref

The new_context operation creates a new naming context and binds it to Name in the current context.

destroy(NamingContext) -> Return Destroy a NamingContext NamingContext = #objref Return = ok

The destroy operation disposes the NamingContext object and removes it from the name server. The context must be empty e.g. not contain any bindings to be removed.

list(NamingContext, HowMany) -> Return List returns a all bindings in the context NamingContext = #objref HowMany = int() Return = {ok, BindingList, BindingIterator} BindingList = [Binding] BindingIterator = #objref

The list operation returns a BindingList with a number of bindings up-to HowMany from the context. It also returns a BindinIterator which can be used to step through the list. If the total number of existing bindings are less than, or equal to, the HowMany parameter a NIL object reference is returned.

One must destroy the BindingIterator, unless it is a NIL object reference, by using 'BindingIterator':destroy(). Otherwise one can get dangling objects.