TAO_CosNaming  2.2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
TAO_Storable_Naming_Context Class Reference

This class plays a role of a 'ConcreteImplementor' in the Bridge pattern architecture of the CosNaming::NamingContext implementation. More...

#include <Storable_Naming_Context.h>

Inheritance diagram for TAO_Storable_Naming_Context:
Inheritance graph
Collaboration diagram for TAO_Storable_Naming_Context:
Collaboration graph

Classes

class  File_Open_Lock_and_Check
 File guard specific for storable naming contexts. More...
 

Public Types

typedef
TAO_Storable_Bindings_Map::HASH_MAP 
HASH_MAP
 Underlying data structure - typedef for ease of use. More...
 

Public Member Functions

 TAO_Storable_Naming_Context (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, const char *poa_id, TAO_Storable_Naming_Context_Factory *cxt_factory, TAO::Storable_Factory *factory, size_t hash_table_size=ACE_DEFAULT_MAP_SIZE)
 Constructor. More...
 
virtual ~TAO_Storable_Naming_Context (void)
 Destructor. More...
 
virtual
CosNaming::NamingContext_ptr 
new_context (void)
 
virtual void list (CORBA::ULong how_many, CosNaming::BindingList_out &bl, CosNaming::BindingIterator_out &bi)
 
virtual void rebind (const CosNaming::Name &n, CORBA::Object_ptr obj)
 
virtual void bind (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)
 
- Public Member Functions inherited from TAO_Hash_Naming_Context
 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 PortableServer::POA_ptr _default_POA (void)
 Returns the Default POA of this Servant object. More...
 
- Public Member Functions inherited from TAO_Naming_Context_Impl
virtual ~TAO_Naming_Context_Impl (void)
 Destructor. More...
 
virtual void stale (bool value)
 
virtual bool stale (void)
 

Static Public Member Functions

static CosNaming::NamingContext_ptr make_new_context (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, const char *context_id, TAO_Storable_Naming_Context_Factory *cxt_factory, TAO::Storable_Factory *pers_factory, TAO_Storable_Naming_Context **new_context)
 
static CosNaming::NamingContext_ptr recreate_all (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, const char *context_id, size_t context_size, int reentering, TAO_Storable_Naming_Context_Factory *cxt_factory, TAO::Storable_Factory *pers_factory, int use_redundancy)
 

Protected Member Functions

virtual void context_written (void)
 
virtual bool is_obsolete (time_t stored_time)
 
int load_map (TAO::Storable_Base &storable)
 
void Write (TAO::Storable_Base &wrtr)
 
- Protected Member Functions inherited from TAO_Hash_Naming_Context
CosNaming::NamingContext_ptr get_context (const CosNaming::Name &name)
 

Protected Attributes

ACE_UINT32 counter_
 Counter used for generation of transients. More...
 
TAO_Storable_Bindings_Mapstorable_context_
 
CORBA::ORB_var orb_
 
ACE_CString context_name_
 
PortableServer::POA_var poa_
 The POA that this context was registered with. More...
 
TAO_Storable_Naming_Context_Factorycontext_factory_
 
TAO::Storable_Factoryfactory_
 
ACE_CString persistence_directory_
 The directory in which to store the files. More...
 
size_t hash_table_size_
 Save the hash table initial size. More...
 
time_t last_changed_
 Disk time that match current memory state. More...
 
int write_occurred_
 Is set by the Write operation. Used to determine. More...
 
- Protected Attributes inherited from TAO_Hash_Naming_Context
TAO_Bindings_Mapcontext_
 
TAO_Naming_Contextinterface_
 
TAO_SYNCH_RECURSIVE_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_
 

Static Protected Attributes

static ACE_UINT32 gcounter_
 
static int redundant_
 Flag to tell us whether we are redundant or not. More...
 
static const char * root_name_
 
static ACE_Auto_Ptr
< TAO::Storable_Base
gfl_
 The pointer to the global file used to allocate new contexts. More...
 

Friends

class File_Open_Lock_and_Check
 
class TAO_Storable_Naming_Context_ReaderWriter
 

Detailed Description

This class plays a role of a 'ConcreteImplementor' in the Bridge pattern architecture of the CosNaming::NamingContext implementation.

This class provides a implementation of the NamingContext functionality, i.e., the state can be preserved across process boundaries. Derives from TAO_Hash_Naming_Context and uses TAO_Storable_Bindings_Map to store name to object bindings.

Member Typedef Documentation

Underlying data structure - typedef for ease of use.

Constructor & Destructor Documentation

TAO_Storable_Naming_Context::TAO_Storable_Naming_Context ( CORBA::ORB_ptr  orb,
PortableServer::POA_ptr  poa,
const char *  poa_id,
TAO_Storable_Naming_Context_Factory cxt_factory,
TAO::Storable_Factory factory,
size_t  hash_table_size = ACE_DEFAULT_MAP_SIZE 
)

Constructor.

TAO_Storable_Naming_Context::~TAO_Storable_Naming_Context ( void  )
virtual

Destructor.

Member Function Documentation

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

Reimplemented from TAO_Hash_Naming_Context.

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

Reimplemented from TAO_Hash_Naming_Context.

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

Reimplemented from TAO_Hash_Naming_Context.

void TAO_Storable_Naming_Context::context_written ( void  )
protectedvirtual

An internal callback invoked by the File_Open_Lock_and_Check object to signal that this context was updated and written to disk. This will have been done after the file is closed. Check the last_changed_ attribute for the time of the write.

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

Reimplemented from TAO_Hash_Naming_Context.

bool TAO_Storable_Naming_Context::is_obsolete ( time_t  stored_time)
protectedvirtual

An internal callback invoked by the File_Open_Lock_and_Check object to determine if this context is obsolete with respect to the file object .

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

Implements TAO_Naming_Context_Impl.

int TAO_Storable_Naming_Context::load_map ( TAO::Storable_Base storable)
protected
CosNaming::NamingContext_ptr TAO_Storable_Naming_Context::make_new_context ( CORBA::ORB_ptr  orb,
PortableServer::POA_ptr  poa,
const char *  context_id,
TAO_Storable_Naming_Context_Factory cxt_factory,
TAO::Storable_Factory pers_factory,
TAO_Storable_Naming_Context **  new_context 
)
static

This utility method factors out the code needed to create a new Storable Naming Context servant and activate it under the specified POA with the specified id. This function is static so that the code can be used, both from inside the class (e.g., <new_context>), and from outside (e.g., Naming_Utils.cpp).

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

Implements TAO_Naming_Context_Impl.

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

Reimplemented from TAO_Hash_Naming_Context.

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

Reimplemented from TAO_Hash_Naming_Context.

CosNaming::NamingContext_ptr TAO_Storable_Naming_Context::recreate_all ( CORBA::ORB_ptr  orb,
PortableServer::POA_ptr  poa,
const char *  context_id,
size_t  context_size,
int  reentering,
TAO_Storable_Naming_Context_Factory cxt_factory,
TAO::Storable_Factory pers_factory,
int  use_redundancy 
)
static
CORBA::Object_ptr TAO_Storable_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.

Reimplemented from TAO_Hash_Naming_Context.

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

Reimplemented from TAO_Hash_Naming_Context.

void TAO_Storable_Naming_Context::Write ( TAO::Storable_Base wrtr)
protected

Friends And Related Function Documentation

friend class File_Open_Lock_and_Check
friend

Member Data Documentation

TAO_Storable_Naming_Context_Factory* TAO_Storable_Naming_Context::context_factory_
protected
ACE_CString TAO_Storable_Naming_Context::context_name_
protected

The name of the context used as its object id when registered with the POA.

ACE_UINT32 TAO_Storable_Naming_Context::counter_
protected

Counter used for generation of transients.

TAO::Storable_Factory* TAO_Storable_Naming_Context::factory_
protected
ACE_UINT32 TAO_Storable_Naming_Context::gcounter_
staticprotected

Global counter used for generation of POA ids for children Naming Contexts.

ACE_Auto_Ptr< TAO::Storable_Base > TAO_Storable_Naming_Context::gfl_
staticprotected

The pointer to the global file used to allocate new contexts.

size_t TAO_Storable_Naming_Context::hash_table_size_
protected

Save the hash table initial size.

time_t TAO_Storable_Naming_Context::last_changed_
protected

Disk time that match current memory state.

CORBA::ORB_var TAO_Storable_Naming_Context::orb_
protected
ACE_CString TAO_Storable_Naming_Context::persistence_directory_
protected

The directory in which to store the files.

PortableServer::POA_var TAO_Storable_Naming_Context::poa_
protected

The POA that this context was registered with.

int TAO_Storable_Naming_Context::redundant_
staticprotected

Flag to tell us whether we are redundant or not.

const char * TAO_Storable_Naming_Context::root_name_
staticprotected
TAO_Storable_Bindings_Map* TAO_Storable_Naming_Context::storable_context_
protected

A pointer to the underlying data structure used to store name bindings. While our superclass (TAO_Hash_Naming_Context) also maintains a pointer to the data structure, keeping this pointer around saves us from the need to downcast when invoking non-virtual methods.

int TAO_Storable_Naming_Context::write_occurred_
protected

Is set by the Write operation. Used to determine.


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