TAO_CosNaming  2.3.3
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TAO_Hash_Naming_Context Class Reference

This class factors out common code for two 'ConcreteImplementors' in the Bridge pattern architecture of the CosNaming::NamingContext implementation. More...

#include <Hash_Naming_Context.h>

Inheritance diagram for TAO_Hash_Naming_Context:
Inheritance graph
[legend]
Collaboration diagram for TAO_Hash_Naming_Context:
Collaboration graph
[legend]

Public Member Functions

 TAO_Hash_Naming_Context (PortableServer::POA_ptr poa, const char *poa_id)
 Constructor. More...
 
void interface (TAO_Naming_Context *i)
 Set our <interface_> pointer. More...
 
virtual ~TAO_Hash_Naming_Context (void)
 Destructor. More...
 
TAO_Naming_Contextinterface (void)
 Get the pointer to our <interface>. More...
 
int root (void)
 
int destroyed (void)
 
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 bind_new_context (const CosNaming::Name &n)
 
virtual void destroy (void)
 
virtual PortableServer::POA_ptr _default_POA (void)
 Returns the Default POA of this Servant object. More...
 
TAO_SYNCH_RW_MUTEXlock (void)
 
- Public Member Functions inherited from TAO_Naming_Context_Impl
virtual ~TAO_Naming_Context_Impl (void)
 Destructor. More...
 
virtual CosNaming::NamingContext_ptr new_context (void)=0
 
virtual void list (CORBA::ULong how_many, CosNaming::BindingList_out &bl, CosNaming::BindingIterator_out &bi)=0
 
virtual void stale (bool value)
 
virtual bool stale (void)
 

Protected Member Functions

CosNaming::NamingContext_ptr get_context (const CosNaming::Name &name)
 

Protected Attributes

TAO_Bindings_Mapcontext_
 
TAO_Naming_Contextinterface_
 
TAO_SYNCH_RW_MUTEX lock_
 Lock used to serialize access to the underlying data structure. More...
 
int destroyed_
 
PortableServer::POA_var poa_
 POA we are registered with. More...
 
ACE_CString poa_id_
 

Detailed Description

This class factors out common code for two 'ConcreteImplementors' in the Bridge pattern architecture of the CosNaming::NamingContext implementation.

This class contains 'algorithm' code that is common to two hash-table-based implementations of the NamingContext: TAO_Transient_Naming_Context and TAO_Persistent_Naming_Context. To help achieve this 'templatization', we use the abstract base class TAO_Bindings_Map, which provides a common interface to the data structures used in TAO_Persistent_Namng_Context and TAO_Transient_Naming_Context.

Constructor & Destructor Documentation

TAO_Hash_Naming_Context::TAO_Hash_Naming_Context ( PortableServer::POA_ptr  poa,
const char *  poa_id 
)

Constructor.

TAO_Hash_Naming_Context::~TAO_Hash_Naming_Context ( void  )
virtual

Destructor.

Member Function Documentation

PortableServer::POA_ptr TAO_Hash_Naming_Context::_default_POA ( void  )
virtual

Returns the Default POA of this Servant object.

Implements TAO_Naming_Context_Impl.

void TAO_Hash_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.

Implements TAO_Naming_Context_Impl.

Reimplemented in TAO_Storable_Naming_Context.

void TAO_Hash_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.

Implements TAO_Naming_Context_Impl.

Reimplemented in TAO_Storable_Naming_Context.

CosNaming::NamingContext_ptr TAO_Hash_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).

Implements TAO_Naming_Context_Impl.

Reimplemented in TAO_Storable_Naming_Context.

void TAO_Hash_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.

Implements TAO_Naming_Context_Impl.

Reimplemented in TAO_Storable_Naming_Context.

int TAO_Hash_Naming_Context::destroyed ( void  )

Returns true if this context had <destroy> operation invoked on it, and false otherwise.

CosNaming::NamingContext_ptr TAO_Hash_Naming_Context::get_context ( const CosNaming::Name name)
protected

<get_context> is used by methods that need to resolve a compound name before performing the actual operation (e.g., bind, unbind, etc.) <get_context> takes a full name (including the last component that doesn't need to be resolved), and returns a pointer to the target context.

void TAO_Hash_Naming_Context::interface ( TAO_Naming_Context i)

Set our <interface_> pointer.

TAO_Naming_Context * TAO_Hash_Naming_Context::interface ( void  )

Get the pointer to our <interface>.

TAO_SYNCH_RW_MUTEX & TAO_Hash_Naming_Context::lock ( void  )
void TAO_Hash_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.

Implements TAO_Naming_Context_Impl.

Reimplemented in TAO_Storable_Naming_Context.

void TAO_Hash_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.

Implements TAO_Naming_Context_Impl.

Reimplemented in TAO_Storable_Naming_Context.

CORBA::Object_ptr TAO_Hash_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.

Implements TAO_Naming_Context_Impl.

Reimplemented in TAO_Storable_Naming_Context.

int TAO_Hash_Naming_Context::root ( void  )

Returns true if this Naming Context is a root Naming Context for the server, and false otherwise.

void TAO_Hash_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>)

Implements TAO_Naming_Context_Impl.

Reimplemented in TAO_Storable_Naming_Context.

Member Data Documentation

TAO_Bindings_Map* TAO_Hash_Naming_Context::context_
protected

Pointer to the data structure used to store this Naming Context's bindings. <context_> is initialized with a concrete data structure by subclasses, which know which data structure to use.

int TAO_Hash_Naming_Context::destroyed_
protected

Flag indicating whether this Naming Context is no longer valid. This flag is necessary because immediate destruction might not be possible if there are pending requests on this servant in the POA.

TAO_Naming_Context* TAO_Hash_Naming_Context::interface_
protected

Pointer to the <interface> object for which we serve as a <concrete implementation>="">, i.e., the object that delegates to us all client CosNaming::NamingContext CORBA calls. We need this pointer for reference counting.

TAO_SYNCH_RW_MUTEX TAO_Hash_Naming_Context::lock_
protected

Lock used to serialize access to the underlying data structure.

PortableServer::POA_var TAO_Hash_Naming_Context::poa_
protected

POA we are registered with.

ACE_CString TAO_Hash_Naming_Context::poa_id_
protected

ID with which we are registered with <poa_>. Note, if <poa_id_> is equivalent to TAO_ROOT_NAMING_CONTEXT, then this Naming Context is the root Naming Context for the server, i.e., it is un<destroy>able.


The documentation for this class was generated from the following files: