TAO_CosNaming  2.0.8
Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions
TAO_Naming_Context Class Reference

This class plays a role of the 'Abstraction' (aka 'Interface') in the Bridge pattern architecture of the CosNaming::NamingContext implementation. More...

#include <Naming_Context_Interface.h>

Collaboration diagram for TAO_Naming_Context:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TAO_Naming_Context (TAO_Naming_Context_Impl *impl)
 Constructor. Initializes <impl_> with a concrete implementation.
 ~TAO_Naming_Context (void)
 Destructor.
virtual void bind (const CosNaming::Name &n, CORBA::Object_ptr obj)
virtual void rebind (const CosNaming::Name &n, CORBA::Object_ptr obj)
virtual void bind_context (const CosNaming::Name &n, CosNaming::NamingContext_ptr nc)
virtual void rebind_context (const CosNaming::Name &n, CosNaming::NamingContext_ptr nc)
virtual CORBA::Object_ptr resolve (const CosNaming::Name &n)
virtual void unbind (const CosNaming::Name &n)
virtual
CosNaming::NamingContext_ptr 
new_context ()
virtual
CosNaming::NamingContext_ptr 
bind_new_context (const CosNaming::Name &n)
virtual void destroy (void)
virtual void list (CORBA::ULong how_many, CosNaming::BindingList_out bl, CosNaming::BindingIterator_out bi)
virtual char * to_string (const CosNaming::Name &n)
virtual CosNaming::Nameto_name (const char *sn)
virtual char * to_url (const char *addr, const char *sn)
virtual CORBA::Object_ptr resolve_str (const char *n)
virtual PortableServer::POA_ptr _default_POA (void)
 Returns the Default POA of this Servant object.

Protected Attributes

TAO_Naming_Context_Implimpl_
 A concrete implementor of the NamingContext functions.

Private Types

enum  Hint { HINT_ID, HINT_KIND }

Private Member Functions

void to_name_helper (char *dest, const char *&src, Hint hint)
void to_string_helper_assign (char *&k, const char *&src)
void to_string_helper_length (CORBA::ULong &len, const char *&src)

Static Private Member Functions

static int to_url_is_alnum_or_punctuation (char c)
static size_t to_url_validate_and_compute_size (const char *add, const char *sn)

Detailed Description

This class plays a role of the 'Abstraction' (aka 'Interface') in the Bridge pattern architecture of the CosNaming::NamingContext implementation.

This class simply forwards all client requests to a concrete NamingContext implementation through its <impl_> pointer. See README file for more info. Comments for the idl methods describe methods semantics - actual actions are carried out by concrete implementors.


Member Enumeration Documentation

enum TAO_Naming_Context::Hint [private]
Enumerator:
HINT_ID 
HINT_KIND 

Constructor & Destructor Documentation

TAO_Naming_Context::TAO_Naming_Context ( TAO_Naming_Context_Impl impl)

Constructor. Initializes <impl_> with a concrete implementation.

TAO_Naming_Context::~TAO_Naming_Context ( void  )

Destructor.


Member Function Documentation

PortableServer::POA_ptr TAO_Naming_Context::_default_POA ( void  ) [virtual]

Returns the Default POA of this Servant object.

void TAO_Naming_Context::bind ( const CosNaming::Name n,
CORBA::Object_ptr  obj 
) [virtual]

Create a binding for name <n> and object <obj> in the naming context. Compound names are treated as follows: ctx->bind (<c1; c2; c3; cn>, obj) = (ctx->resolve (<c1; c2; cn-1>))->bind (<cn>, obj) if the there already exists a binding for the specified name, <AlreadyBound> exception is thrown. Naming contexts should be bound using <bind_context> and <rebind_context> in order to participate in name resolution later.

void TAO_Naming_Context::bind_context ( const CosNaming::Name n,
CosNaming::NamingContext_ptr  nc 
) [virtual]

This is the version of <bind> specifically for binding naming contexts, so that they will participate in name resolution when compound names are passed to be resolved.

CosNaming::NamingContext_ptr TAO_Naming_Context::bind_new_context ( const CosNaming::Name n) [virtual]

This operation creates a new context and binds it to the name supplied as an argument. The newly-created context is implemented by the same server as the context in which it was bound (the name argument excluding the last component).

void TAO_Naming_Context::destroy ( void  ) [virtual]

Delete the naming context. The user should take care to <unbind> any bindings in which the given context is bound to some names, to avoid dangling references when invoking <destroy> operation. NOTE: <destory> is a no-op on the root context. NOTE: after <destroy> is invoked on a Naming Context, all BindingIterators associated with that Naming Context are also destroyed.

void TAO_Naming_Context::list ( CORBA::ULong  how_many,
CosNaming::BindingList_out  bl,
CosNaming::BindingIterator_out  bi 
) [virtual]

Returns at most the requested number of bindings <how_many> in <bl>. If the naming context contains additional bindings, they are returned with a BindingIterator. In the naming context does not contain any additional bindings <bi> returned as null.

CosNaming::NamingContext_ptr TAO_Naming_Context::new_context ( void  ) [virtual]

This operation returns a new naming context implemented by the same naming server in which the operation was invoked. The context is not bound.

void TAO_Naming_Context::rebind ( const CosNaming::Name n,
CORBA::Object_ptr  obj 
) [virtual]

This is similar to <bind> operation above, except for when the binding for the specified name already exists in the specified context. In that case, the existing binding is replaced with the new one.

void TAO_Naming_Context::rebind_context ( const CosNaming::Name n,
CosNaming::NamingContext_ptr  nc 
) [virtual]

This is a version of <rebind> specifically for naming contexts, so that they can participate in name resolution when compound names are passed.

CORBA::Object_ptr TAO_Naming_Context::resolve ( const CosNaming::Name n) [virtual]

Return object reference that is bound to the name. Compound name resolve is defined as follows: ctx->resolve (<c1; c2; cn>) = ctx->resolve (<c1; c2 cn-1>)->resolve (<cn>) The naming service does not return the type of the object. Clients are responsible for "narrowing" the object to the appropriate type.

CORBA::Object_ptr TAO_Naming_Context::resolve_str ( const char *  n) [virtual]

Similar to <resolve> as in the CosNaming::NamingContext interface. It accepts a strigified name as an argument instead of a Name.

CosNaming::Name * TAO_Naming_Context::to_name ( const char *  sn) [virtual]

The in parameter is an stringified name. This function removes the escape character '\' and destringifies the stringified name and returns it.

void TAO_Naming_Context::to_name_helper ( char *  dest,
const char *&  src,
Hint  hint 
) [private]

This private function is used as a helper to <to_name>. It reads character by character from 'src' and depending on the character, either assigns it to 'dest' or returns back to the calling function. If the character is a seperator between the 'id' and 'kind' fields or a seperator between two name components, the control is returned back to the calling function <to_name>.

char * TAO_Naming_Context::to_string ( const CosNaming::Name n) [virtual]

Stringify the name using '\' as the escape character. The characters '.' , '/' and '\' are to be escaped. If the input name is invalid i.e. if the number of characters in the name is zero, an InvalidName exception is to be raised.

void TAO_Naming_Context::to_string_helper_assign ( char *&  k,
const char *&  src 
) [private]

This method functions similar to <to_name_helper>. If the character read is '.' or '/' or '\', an escape character '\' is prepended before the character.

void TAO_Naming_Context::to_string_helper_length ( CORBA::ULong len,
const char *&  src 
) [private]

This method helps count the number of characters in 'src' so that memory can be allocated for the return parameter. For all '.' , '/' and '\', the count is incremented by 'one' to account for the escape character that needs to be added. Seperators between 'id' and 'kind' as well as seperators between the name components are also counted.

char * TAO_Naming_Context::to_url ( const char *  addr,
const char *  sn 
) [virtual]

The in parameter addr refers to the address of the naming context and sn refers to the strigified name of the object in that context. This function returns a fully formed URL string like iiopname://1.1@myhost.555xyz.com:9999/a/b/c

Compute how many characters will be required for the URL

move to end of dest string

Concatenate the seperator between the addr and Name

move to end of dest string

int TAO_Naming_Context::to_url_is_alnum_or_punctuation ( char  c) [static, private]

Return 1 if the character is alphanumeric or a non-scaped punctuation.

size_t TAO_Naming_Context::to_url_validate_and_compute_size ( const char *  add,
const char *  sn 
) [static, private]

Validate the to_url() method input, and compute the size of the returned URL address.

void TAO_Naming_Context::unbind ( const CosNaming::Name n) [virtual]

Remove the name binding from the context. When compound names are used, unbind is defined as follows: ctx->unbind (<c1; c2; cn>) = (ctx->resolve (<c1; c2; cn-1>))->unbind (<cn>)


Member Data Documentation

A concrete implementor of the NamingContext functions.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines