TAO_Implementation_Repository  2.3.3
Classes | Public Types | 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
[legend]
Collaboration diagram for Shared_Backing_Store:
Collaboration graph
[legend]

Classes

class  LocatorListings_XMLHandler
 
struct  UniqueId
 
class  Update_Handler
 

Public Types

enum  ExtraParams { REPO_TYPE = 0, REPO_ID = 1 }
 
enum  SyncType { NO_SYNC, INC_SYNC, FULL_SYNC }
 
typedef ImplementationRepository::UpdatePushNotification_var Replica_var
 
typedef ImplementationRepository::UpdatePushNotification_ptr Replica_ptr
 
typedef ACE_Hash_Map_Manager_Ex< ACE_CString, UniqueId, ACE_Hash< ACE_CString >, ACE_Equal_To< ACE_CString >, ACE_Null_MutexUniqueIdMap
 
- Public Types inherited from XML_Backing_Store
typedef std::pair< ACE_CString, ACE_CStringNameValue
 
typedef std::vector< NameValueNameValues
 
- Public Types inherited from Locator_Repository
typedef ACE_Hash_Map_Manager_Ex< ACE_CString, Server_Info_Ptr, ACE_Hash< ACE_CString >, ACE_Equal_To< ACE_CString >, ACE_Null_MutexSIMap
 
typedef ACE_Hash_Map_Manager_Ex< ACE_CString, Activator_Info_Ptr, ACE_Hash< ACE_CString >, ACE_Equal_To< ACE_CString >, ACE_Null_MutexAIMap
 

Public Member Functions

 Shared_Backing_Store (const Options &opts, CORBA::ORB_ptr orb, ImR_Locator_i *loc_impl)
 
virtual ~Shared_Backing_Store ()
 
virtual void shutdown (void)
 
virtual const ACE_TCHARrepo_mode () const
 indicate the persistence mode for the repository More...
 
virtual void load_server (Server_Info *info, 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)
 
virtual void notify_remote_access (const char *id, ImplementationRepository::AAM_Status s)
 Update the peer's access state. More...
 
virtual int report_ior (PortableServer::POA_ptr imr_poa)
 
void gen_ior (char *&ft_imr_ior)
 
void updates_available (const ImplementationRepository::UpdateInfoSeq &info, bool missed)
 
void process_updates (void)
 
- 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 (void)
 
- 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 &fqname, const char *partial_ior, ImR_Locator_i *imr_locator)
 
int add_server (const ACE_CString &fqname, const ImplementationRepository::StartupOptions &options)
 Add a new server to the Repository. More...
 
int add_server (const ACE_CString &fqname, const ACE_CString &partial_ior, const ACE_CString &ior, ImplementationRepository::ServerObject_ptr svrobj)
 
int add_server_i (Server_Info *si)
 
int link_peers (Server_Info_Ptr base, const CORBA::StringSeq peers)
 
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_active_server (const ACE_CString &name, int pid=0)
 Returns information related to startup. More...
 
Server_Info_Ptr get_info (const ACE_CString &name)
 
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...
 

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 ()
 
char * locator_service_ior (const char *peer_ior) const
 
int connect_replicas (void)
 
- Protected Member Functions inherited from XML_Backing_Store
int load_file (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_MutexXMLHandler_Ptr
 

Private Member Functions

void bind_unique_id (const ACE_CString &key, UniqueIdMap &unique_ids, const UniqueId &id)
 map management helper functions More...
 
void find_unique_id (const ACE_CString &key, UniqueIdMap &unique_ids, UniqueId &uid)
 
void update_unique_id (const ACE_CString &key, UniqueIdMap &unique_ids, Options::ImrType &entry_repo_type, unsigned int &entry_repo_id, UniqueId &uid)
 
void verify_unique_id (const ACE_CString &key, const XML_Backing_Store::NameValues &extra_params, UniqueIdMap &unique_ids)
 
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 *list)
 
int connect_replicas (Replica_ptr this_replica)
 

Private Attributes

const ACE_TString listing_file_
 the path and filename for the listings file 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...
 
UniqueIdMap server_uids_
 map for server unique ids More...
 
UniqueIdMap 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...
 
ImR_Locator_iloc_impl_
 reference to the locator implmentation More...
 
Replicator replicator_
 
ImplementationRepository::UpdateInfoSeq updates_
 
bool notified_
 
Shared_Backing_Store::Update_Handler update_handler_
 

Additional Inherited Members

- Static Public Member Functions inherited from Locator_Repository
static ACE_CString lcase (const ACE_CString &s)
 convert to lower case More...
 
- Static Protected Member Functions inherited from XML_Backing_Store
static int load_file (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...
 
- Protected Attributes inherited from Locator_Repository
const Optionsopts_
 
TAO_IOR_Multicast ior_multicast_
 
const CORBA::ORB_var orb_
 
CORBA::String_var imr_ior_
 

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

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,
ImR_Locator_i loc_impl 
)
Shared_Backing_Store::~Shared_Backing_Store ( )
virtual

Member Function Documentation

void Shared_Backing_Store::bind_unique_id ( const ACE_CString key,
UniqueIdMap unique_ids,
const UniqueId id 
)
private

map management helper functions

int Shared_Backing_Store::connect_replicas ( void  )
protected
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
void Shared_Backing_Store::find_unique_id ( const ACE_CString key,
UniqueIdMap unique_ids,
UniqueId uid 
)
private
void Shared_Backing_Store::gen_ior ( char *&  ft_imr_ior)
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 ( Server_Info info,
bool  server_started,
const NameValues extra_params 
)
virtual

recover a persisted Server_Info object

Parameters
infopoints to a newly created Server_Info object
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_remote_access ( const char *  id,
ImplementationRepository::AAM_Status  state 
)
virtual

Update the peer's access state.

Reimplemented from Locator_Repository.

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::process_updates ( void  )
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 ( void  ) 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)
virtual

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.

void Shared_Backing_Store::shutdown ( void  )
virtual

Reimplemented from Locator_Repository.

int Shared_Backing_Store::sync_load ( void  )
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::update_unique_id ( const ACE_CString key,
UniqueIdMap unique_ids,
Options::ImrType entry_repo_type,
unsigned int &  entry_repo_id,
UniqueId uid 
)
private
void Shared_Backing_Store::updates_available ( const ImplementationRepository::UpdateInfoSeq &  info,
bool  missed 
)
void Shared_Backing_Store::verify_unique_id ( const ACE_CString key,
const XML_Backing_Store::NameValues extra_params,
UniqueIdMap unique_ids 
)
private
void Shared_Backing_Store::write_listing ( FILE *  list)
private

write content to the listings file and optionally its backup

Parameters
listFile pointer to write to. Can be primary or backup.

Member Data Documentation

UniqueIdMap 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

ImR_Locator_i* Shared_Backing_Store::loc_impl_
private

reference to the locator implmentation

CORBA::String_var Shared_Backing_Store::non_ft_imr_ior_
private

the ior for just this ImR Locator

bool Shared_Backing_Store::notified_
private
Replicator Shared_Backing_Store::replicator_
private
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

UniqueIdMap 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

Shared_Backing_Store::Update_Handler Shared_Backing_Store::update_handler_
private
ImplementationRepository::UpdateInfoSeq Shared_Backing_Store::updates_
private

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