Erlang logo
User's Guide
Reference Manual
Release Notes
PDF
Top

orber
Reference Manual
Version 3.6.25


Expand All
Contract All

Table of Contents

CosNaming_NamingContext

MODULE

CosNaming_NamingContext

MODULE SUMMARY

This interface supports different bind and access functions for names in a context.

DESCRIPTION

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").
    

EXPORTS

bind(NamingContext, Name, Object) -> Return

Types:

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

Types:

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

Types:

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

Types:

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

Types:

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

Types:

NamingContext = #objref
Name = [NameComponent]
Return = ok

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

new_context(NamingContext) -> Return

Types:

NamingContext = #objref
Return = #objref

The new_context operation creates a new naming context.

bind_new_context(NamingContext, Name) -> Return

Types:

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

Types:

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

Types:

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.

Note

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