TAO_Implementation_Repository  2.2.0
 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 | Private Types | Private Member Functions | Private Attributes | List of all members
Shared_Backing_Store Class Reference

XML backing store containing all ImR persistent information in multiple files shared between multiple Locators. More...

#include <Shared_Backing_Store.h>

Inheritance diagram for Shared_Backing_Store:
Inheritance graph
Collaboration diagram for Shared_Backing_Store:
Collaboration graph

Classes

class  LocatorListings_XMLHandler
 
struct  UniqueId
 

Public Types

enum  ExtraParams { REPO_TYPE = 0, REPO_ID = 1 }
 
enum  SyncType { NO_SYNC, INC_SYNC, FULL_SYNC }
 
typedef
ImplementationRepository::UpdatePushNotification_ptr 
Replica_ptr
 
typedef
ACE_Hash_Map_Manager_Ex
< ServerKey, UniqueId,
ACE_Hash< ServerKey >
, ACE_Equal_To< ServerKey >
, ACE_Null_Mutex
ServerUIMap
 
typedef
ACE_Hash_Map_Manager_Ex
< ActivatorKey, UniqueId,
ACE_Hash< ActivatorKey >
, ACE_Equal_To< ActivatorKey >
, ACE_Null_Mutex
ActivatorUIMap
 
- Public Types inherited from XML_Backing_Store
typedef std::pair< ACE_CString,
ACE_CString
NameValue
 
typedef std::vector< NameValueNameValues
 
- Public Types inherited from Locator_Repository
typedef ACE_CString ServerKey
 
typedef
ACE_Hash_Map_Manager_Ex
< ServerKey, Server_Info_Ptr,
ACE_Hash< ServerKey >
, ACE_Equal_To< ServerKey >
, ACE_Null_Mutex
SIMap
 
typedef ACE_CString ActivatorKey
 
typedef
ACE_Hash_Map_Manager_Ex
< ActivatorKey,
Activator_Info_Ptr, ACE_Hash
< ActivatorKey >, ACE_Equal_To
< ActivatorKey >
, ACE_Null_Mutex
AIMap
 

Public Member Functions

 Shared_Backing_Store (const Options &opts, CORBA::ORB_ptr orb)
 
virtual ~Shared_Backing_Store ()
 
virtual const ACE_TCHARrepo_mode () const
 indicate the persistence mode for the repository More...
 
virtual void notify_updated_server (const ImplementationRepository::ServerUpdate &server)
 
virtual void notify_updated_activator (const ImplementationRepository::ActivatorUpdate &activator)
 
virtual void register_replica (ImplementationRepository::UpdatePushNotification_ptr replica, char *&ft_imr_ior, ImplementationRepository::SequenceNum_out seq_num)
 
virtual void load_server (const ACE_CString &server_id, const ACE_CString &server_name, bool jacorb_server, const ACE_CString &activator_name, const ACE_CString &cmdline, const ImplementationRepository::EnvironmentList &env_vars, const ACE_CString &working_dir, ImplementationRepository::ActivationMode actmode, int start_limit, const ACE_CString &partial_ior, const ACE_CString &ior, bool server_started, const NameValues &extra_params)
 
virtual void load_activator (const ACE_CString &activator_name, long token, const ACE_CString &ior, const NameValues &extra_params)
 
- Public Member Functions inherited from XML_Backing_Store
 XML_Backing_Store (const Options &opts, CORBA::ORB_ptr orb, bool suppress_erase=false)
 
virtual ~XML_Backing_Store ()
 
- Public Member Functions inherited from Locator_Repository
 Locator_Repository (const Options &opts, CORBA::ORB_ptr orb)
 
virtual ~Locator_Repository ()
 
int unregister_if_address_reused (const ACE_CString &server_id, const ACE_CString &name, const char *partial_ior, ImR_Locator_i *imr_locator)
 
int add_server (const ACE_CString &server_id, const ACE_CString &name, bool jacorbs, const ACE_CString &aname, const ACE_CString &startup_command, const ImplementationRepository::EnvironmentList &environment_vars, const ACE_CString &working_dir, ImplementationRepository::ActivationMode activation, int start_limit, const ACE_CString &partial_ior=ACE_CString(""), const ACE_CString &ior=ACE_CString(""), ImplementationRepository::ServerObject_ptr svrobj=ImplementationRepository::ServerObject::_nil())
 Add a new server to the Repository. More...
 
int add_activator (const ACE_CString &name, const CORBA::Long token, const ACE_CString &ior=ACE_CString(""), ImplementationRepository::Activator_ptr act=ImplementationRepository::Activator::_nil())
 Add a new activator to the Repository. More...
 
int update_server (const Server_Info_Ptr &info)
 Update the associated information. More...
 
int update_activator (const Activator_Info_Ptr &info)
 Update the associated information. More...
 
Server_Info_Ptr get_server (const ACE_CString &name)
 Returns information related to startup. More...
 
Activator_Info_Ptr get_activator (const ACE_CString &name)
 Returns information related to startup. More...
 
bool has_activator (const ACE_CString &name)
 
int remove_server (const ACE_CString &name)
 Removes the server from the Repository. More...
 
int remove_activator (const ACE_CString &name)
 Removes the activator from the Repository. More...
 
SIMapservers (void)
 Returns the internal hash map containing the server information. More...
 
const SIMapservers (void) const
 
AIMapactivators (void)
 Returns the internal hash map containing the activator information. More...
 
const AIMapactivators (void) const
 
int init (PortableServer::POA_ptr root_poa, PortableServer::POA_ptr imr_poa, const char *this_ior)
 Initialize the repo. More...
 
bool multicast () const
 Indicate if multicast should be used. More...
 

Static Public Member Functions

typedef
ImplementationRepository::UpdatePushNotification_var 
Replica_var
 

Protected Member Functions

virtual int init_repo (PortableServer::POA_ptr imr_poa)
 
virtual int persistent_update (const Server_Info_Ptr &info, bool add)
 perform server persistent update More...
 
virtual int persistent_update (const Activator_Info_Ptr &info, bool add)
 perform activator persistent update More...
 
virtual int persistent_remove (const ACE_CString &name, bool activator)
 perform persistent remove More...
 
virtual int sync_load ()
 
virtual int report_ior (PortableServer::POA_ptr imr_poa)
 
char * locator_service_ior (const char *peer_ior) const
 
- Protected Member Functions inherited from XML_Backing_Store
int load (const ACE_TString &filename, FILE *open_file=0)
 
void persist (FILE *fp, const Server_Info &info, const char *tag_prepend, const NameValues &name_values=NameValues())
 
void persist (FILE *fp, const Activator_Info &info, const char *tag_prepend, const NameValues &name_values=NameValues())
 
void create_server (bool server_started, const Server_Info_Ptr &si)
 
- Protected Member Functions inherited from Locator_Repository
virtual int recover_ior (void)
 recover the ImR Locator's IOR from the persisted file More...
 
int setup_multicast (ACE_Reactor *reactor, const char *imr_ior)
 
void teardown_multicast ()
 
bool registered () const
 

Private Types

typedef ACE_Strong_Bound_Ptr
< LocatorListings_XMLHandler,
ACE_Null_Mutex
XMLHandler_Ptr
 

Private Member Functions

ACE_CString replica_ior_filename (bool peer_ior_file) const
 
XMLHandler_Ptr get_listings (Lockable_File &listing_lf, bool only_changes) const
 
int persistent_load (bool only_changes)
 
int persist_listings (Lockable_File &listing_lf)
 
void write_listing (FILE *)
 
int connect_replicas (Replica_ptr this_replica)
 

Private Attributes

const ACE_TString listing_file_
 the path and filename for the listings file More...
 
Replica_var peer_replica_
 the path and filename for the listings file More...
 
ImplementationRepository::SequenceNum seq_num_
 
ImplementationRepository::SequenceNum replica_seq_num_
 the current sequence number last reported by the peer replica More...
 
const Options::ImrType imr_type_
 the imr type of this Shared_Backing_Store More...
 
SyncType sync_needed_
 the current type of sync needed by the repo More...
 
std::set< ACE_TStringsync_files_
 
CORBA::String_var non_ft_imr_ior_
 the ior for just this ImR Locator More...
 
const char * IMR_REPLICA [3]
 an array associating ImrType with the appropriate name More...
 
ServerUIMap server_uids_
 map for server unique ids More...
 
ActivatorUIMap activator_uids_
 map for activator unique ids More...
 
unsigned int repo_id_
 next unique repo id More...
 
XML_Backing_Store::NameValues repo_values_
 extra parameters for XML More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from XML_Backing_Store
static int load (const ACE_TString &filename, ACEXML_DefaultHandler &xml_handler, unsigned int debug, FILE *open_file=0)
 
- Protected Attributes inherited from XML_Backing_Store
const ACE_TString filename_
 the filename indicated in the Options for the backing store More...
 

Detailed Description

XML backing store containing all ImR persistent information in multiple files shared between multiple Locators.

Member Typedef Documentation

typedef ImplementationRepository::UpdatePushNotification_ptr Shared_Backing_Store::Replica_ptr
typedef ImplementationRepository::UpdatePushNotification_var Shared_Backing_Store::Replica_var
static

Member Enumeration Documentation

Enumerator
REPO_TYPE 
REPO_ID 

enum to indicate whether the repo is in-sync, individual server and/or activator files need to be sync-ed or if a full sync of servers and activators is needed

Enumerator
NO_SYNC 
INC_SYNC 
FULL_SYNC 

Constructor & Destructor Documentation

Shared_Backing_Store::Shared_Backing_Store ( const Options opts,
CORBA::ORB_ptr  orb 
)
Shared_Backing_Store::~Shared_Backing_Store ( )
virtual

Member Function Documentation

int Shared_Backing_Store::connect_replicas ( Replica_ptr  this_replica)
private

connect this replica to its peer replica

Parameters
this_replicaa pointer to this Replica object
Shared_Backing_Store::XMLHandler_Ptr Shared_Backing_Store::get_listings ( Lockable_File &  listing_lf,
bool  only_changes 
) const
private

get the listings file contents

Parameters
listing_lfa Lockable_File for the listings file that will be locked when the function returns
only_changesif only changes to the repo should be reported
Returns
a pointer to the LocatorListings_XMLHandler
int Shared_Backing_Store::init_repo ( PortableServer::POA_ptr  imr_poa)
protectedvirtual

perform shared backing store specific initialization (activates this Shared_Backing_Store as the "ImR_Replica", trys to connect to the peer replica, unless it is a STANDALONE_IMR, clears out the persisted store if needed, and loads the repo from the persisted store)

Reimplemented from XML_Backing_Store.

void Shared_Backing_Store::load_activator ( const ACE_CString activator_name,
long  token,
const ACE_CString ior,
const NameValues extra_params 
)
virtual

create the Activator_Info activator object

Parameters
activator_namethe Activator_Info name
tokenthe Activator_Info token
iorthe Activator_Info ior
extra_paramsextra name value pairs that were reported for the activator

Reimplemented from XML_Backing_Store.

void Shared_Backing_Store::load_server ( const ACE_CString server_id,
const ACE_CString server_name,
bool  jacorb_server,
const ACE_CString activator_name,
const ACE_CString cmdline,
const ImplementationRepository::EnvironmentList &  env_vars,
const ACE_CString working_dir,
ImplementationRepository::ActivationMode  actmode,
int  start_limit,
const ACE_CString partial_ior,
const ACE_CString ior,
bool  server_started,
const NameValues extra_params 
)
virtual

create the Server_Info server object

Parameters
server_idthe Server_Info server_id
server_namethe Server_Info server_name
activator_namethe Server_Info activator
cmdlinethe Server_Info cmdline
env_varsthe Server_Info env_vars
workin_dirthe Server_Info dir
actmodethe Server_Info activation_mode
start_limitthe Server_Info start_limit
partial_iorthe Server_Info partial_ior
iorthe Server_Info ior
server_startedindicates if the server object existed when data was persisted
extra_paramsextra name value pairs that were reported for the server

Reimplemented from XML_Backing_Store.

char * Shared_Backing_Store::locator_service_ior ( const char *  peer_ior) const
protected

create the Fault Tolerant ImR Locator IOR, using the peer_ior and this ImR Locator's IOR

void Shared_Backing_Store::notify_updated_activator ( const ImplementationRepository::ActivatorUpdate &  activator)
virtual

provide the implementation for being notified of a activator update

void Shared_Backing_Store::notify_updated_server ( const ImplementationRepository::ServerUpdate &  server)
virtual

provide the implementation for being notified of a server update

int Shared_Backing_Store::persist_listings ( Lockable_File &  listing_lf)
private

persistent the listings file

Parameters
listing_lfa Lockable_File for the listings file that will be locked when the function returns
int Shared_Backing_Store::persistent_load ( bool  only_changes)
private

perform a persistent load from the backing store

Parameters
only_changesif only changes to the repo should be loaded
int Shared_Backing_Store::persistent_remove ( const ACE_CString name,
bool  activator 
)
protectedvirtual

perform persistent remove

Reimplemented from XML_Backing_Store.

int Shared_Backing_Store::persistent_update ( const Server_Info_Ptr info,
bool  add 
)
protectedvirtual

perform server persistent update

Reimplemented from XML_Backing_Store.

int Shared_Backing_Store::persistent_update ( const Activator_Info_Ptr info,
bool  add 
)
protectedvirtual

perform activator persistent update

Reimplemented from XML_Backing_Store.

void Shared_Backing_Store::register_replica ( ImplementationRepository::UpdatePushNotification_ptr  replica,
char *&  ft_imr_ior,
ImplementationRepository::SequenceNum_out  seq_num 
)
virtual

provide the implementation for registering a peer replica

Parameters
replicathe peer replica
ft_imr_iorthe fault tolerant ImR IOR (passed in as the replica's ImR IOR, passed back as fault tolerant ImR IOR)
seq_numcurrent sequence number to return to replica
ACE_CString Shared_Backing_Store::replica_ior_filename ( bool  peer_ior_file) const
private

determine the filename where the replica ior is reported

Parameters
peer_ior_fileif this is the filename for the peer replica or this replica
const ACE_TCHAR * Shared_Backing_Store::repo_mode ( ) const
virtual

indicate the persistence mode for the repository

Reimplemented from XML_Backing_Store.

int Shared_Backing_Store::report_ior ( PortableServer::POA_ptr  imr_poa)
protectedvirtual

calls Locator_Repository::report_ior with the Fault Tolerant ImR Locator's IOR if available, otherwise reporting the ior is delayed until the peer replica registers with this replica

Reimplemented from Locator_Repository.

int Shared_Backing_Store::sync_load ( )
protectedvirtual

perform sync of repo with backing store uses sync_needed_ and sync_files_ to determine what to update

Reimplemented from Locator_Repository.

void Shared_Backing_Store::write_listing ( FILE *  list)
private

write content to the listings file and optionally its backup

Parameters
Filepointer to write to. Can be primary or backup.

Member Data Documentation

ActivatorUIMap Shared_Backing_Store::activator_uids_
private

map for activator unique ids

const char* Shared_Backing_Store::IMR_REPLICA[3]
private

an array associating ImrType with the appropriate name

const Options::ImrType Shared_Backing_Store::imr_type_
private

the imr type of this Shared_Backing_Store

const ACE_TString Shared_Backing_Store::listing_file_
private

the path and filename for the listings file

CORBA::String_var Shared_Backing_Store::non_ft_imr_ior_
private

the ior for just this ImR Locator

Replica_var Shared_Backing_Store::peer_replica_
private

the path and filename for the listings file

ImplementationRepository::SequenceNum Shared_Backing_Store::replica_seq_num_
private

the current sequence number last reported by the peer replica

unsigned int Shared_Backing_Store::repo_id_
private

next unique repo id

XML_Backing_Store::NameValues Shared_Backing_Store::repo_values_
private

extra parameters for XML

ImplementationRepository::SequenceNum Shared_Backing_Store::seq_num_
private

the current sequence number for reporting changes made directly to this repo

ServerUIMap Shared_Backing_Store::server_uids_
private

map for server unique ids

std::set<ACE_TString> Shared_Backing_Store::sync_files_
private

the server and activator files that need to be updated for sync_needed_ == INC_SYNC

SyncType Shared_Backing_Store::sync_needed_
private

the current type of sync needed by the repo


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