#include <ConfigRPC.h>

The ConfigRPC object holds the state of the connection between XMLRPC and a particular OsConfigDb store. The name of the OsConfigDb is stored in the parent UtlString, and is used by the XMLRPC objects to locate the appropriate database.
The connection to the controlling application is through a ConfigRPC_Callback object passed to the constructor. This object provides methods that are called by ConfigRPC to control access to the database, to indicate that the database has been modified, and to indicate that the database has been deleted.
To allow use of an OsConfigDb via this module, create a ConfigRPC object:
// start the rpc dispatcher XmlRpcDispatch rpc( httpPort, true ); // connect the dataset to XmlRpc UtlString databasePath("/path/to/facility-config"); ConfigRPC_Callback defaultCallbacks; ConfigRPC ConfigDbAccess("facility-config", databasePath, facilityVersion, defaultCallbacks); // enter the connector RPC methods in the XmlRpcDispatch table ConfigRPC::registerMethods(rpc);
The object passed in to provide callbacks may be a subclass of ConfigRPC_Callback that implements more intelligent actions.
Public Types | |
| enum | FailureCode { loadFailed = 100, storeFailed = 101, invalidType = 102, nameNotFound = 103, emptyRequestList = 104, emptyDataset = 105 } |
| XML-RPC Fault Codes generated by this module. More... | |
Public Member Functions | |
| ConfigRPC (const char *dbName, const char *versionId, const UtlString &dbPath, ConfigRPC_Callback *callback) | |
| Construct an instance to allow RPC access to a database. | |
| ~ConfigRPC () | |
| Destroy the instance to disconnect access to the database. | |
Static Public Member Functions | |
| static void | registerMethods (XmlRpcDispatch &rpc) |
| Must be called once to connect the configurationParameter methods. | |
Protected Member Functions | |
| OsStatus | load (OsConfigDb &dataset) |
| Open and load the associated OsConfigDb dataset. | |
| OsStatus | store (OsConfigDb &dataset) |
| Write the contents of the associated OsConfigDb dataset to its file. | |
Static Protected Member Functions | |
| static ConfigRPC * | find (const UtlString &dbName) |
| Locate a ConfigRPC by its dbName - caller must hold at least a read lock on spDatabaseLock. | |
Private Member Functions | |
| ConfigRPC (const ConfigRPC &nocopy) | |
| no copy constructor | |
| ConfigRPC & | operator= (const ConfigRPC &noassignment) |
| no assignment operator | |
Private Attributes | |
| UtlString | mVersion |
| database version identifier | |
| UtlString | mPath |
| path to persistent store for the database | |
| ConfigRPC_Callback * | mCallback |
Static Private Attributes | |
| static OsRWMutex * | spDatabaseLock = new OsRWMutex(OsBSem::Q_PRIORITY) |
| protects access to sDatabases and sRegistered | |
| static UtlHashBag | sDatabases |
| locates the ConfigRPC object for a db name | |
| static bool | sRegistered = false |
| whether or not the ConfigRPC methods have been registered with XmlRpcDispatch | |
Friends | |
| class | ConfigRPC_version |
| class | ConfigRPC_set |
| class | ConfigRPC_get |
| class | ConfigRPC_delete |
| enum FailureCode |
| ConfigRPC | ( | const char * | dbName, | |
| const char * | versionId, | |||
| const UtlString & | dbPath, | |||
| ConfigRPC_Callback * | callback | |||
| ) |
Construct an instance to allow RPC access to a database.
| dbName | dbName known to XMLRPC methods |
| versionId | version of this database |
| dbPath | path to persistent store for this db |
| callback | connection to controlling application |
| ~ConfigRPC | ( | ) |
Destroy the instance to disconnect access to the database.
| void registerMethods | ( | XmlRpcDispatch & | rpc | ) | [static] |
Must be called once to connect the configurationParameter methods.
| rpc | xmlrpc dispatch service to use |
Locate a ConfigRPC by its dbName - caller must hold at least a read lock on spDatabaseLock.
| OsStatus load | ( | OsConfigDb & | dataset | ) | [protected] |
Open and load the associated OsConfigDb dataset.
| OsStatus store | ( | OsConfigDb & | dataset | ) | [protected] |
Write the contents of the associated OsConfigDb dataset to its file.
friend class ConfigRPC_version [friend] |
friend class ConfigRPC_set [friend] |
friend class ConfigRPC_get [friend] |
friend class ConfigRPC_delete [friend] |
OsRWMutex * spDatabaseLock = new OsRWMutex(OsBSem::Q_PRIORITY) [static, private] |
protects access to sDatabases and sRegistered
UtlHashBag sDatabases [static, private] |
locates the ConfigRPC object for a db name
bool sRegistered = false [static, private] |
whether or not the ConfigRPC methods have been registered with XmlRpcDispatch
ConfigRPC_Callback* mCallback [private] |