ConfigRPC Class Reference

#include <ConfigRPC.h>

Inheritance diagram for ConfigRPC:

UtlString UtlContainable

List of all members.


Detailed Description

XML-RPC interface to an OsConfigDb.

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 ConfigRPCfind (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
ConfigRPCoperator= (const ConfigRPC &noassignment)
 no assignment operator

Private Attributes

UtlString mVersion
 database version identifier
UtlString mPath
 path to persistent store for the database
ConfigRPC_CallbackmCallback

Static Private Attributes

static OsRWMutexspDatabaseLock = 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


Member Enumeration Documentation

XML-RPC Fault Codes generated by this module.

Enumerator:
loadFailed 
storeFailed 
invalidType 
nameNotFound 
emptyRequestList 
emptyDataset 


Constructor & Destructor Documentation

ConfigRPC ( const char *  dbName,
const char *  versionId,
const UtlString dbPath,
ConfigRPC_Callback callback 
)

Construct an instance to allow RPC access to a database.

Parameters:
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.

ConfigRPC ( const ConfigRPC nocopy  )  [private]

no copy constructor


Member Function Documentation

void registerMethods ( XmlRpcDispatch rpc  )  [static]

Must be called once to connect the configurationParameter methods.

Parameters:
rpc  xmlrpc dispatch service to use

static ConfigRPC* find ( const UtlString dbName  )  [inline, static, protected]

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.

ConfigRPC& operator= ( const ConfigRPC noassignment  )  [private]

no assignment operator


Friends And Related Function Documentation

friend class ConfigRPC_version [friend]

friend class ConfigRPC_set [friend]

friend class ConfigRPC_get [friend]

friend class ConfigRPC_delete [friend]


Member Data Documentation

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

UtlString mVersion [private]

database version identifier

UtlString mPath [private]

path to persistent store for the database


Online Library Docs

sipXecs home page

Version 4.2.1-018930 2010-07-31T01:13:23 build16 abuild