version 1.16, 2008/12/16 18:57:10
|
version 1.16.8.1, 2013/06/03 22:36:36
|
|
|
| |
//%//////////////////////////////////////////////////////////////////////////// | //%//////////////////////////////////////////////////////////////////////////// |
| |
|
/* |
|
Definitions for the DynamicRoutingTable that controls fixed registration |
|
of OpenPegasus control providers and services. |
|
NOTE: The actual Control Provider and Service registration definitions |
|
are contained in the DynamicRoutingTable .cpp file. |
|
|
|
DynamicRoutingTable is a singleton which includes the following |
|
public functions: |
|
- getRouting - Gets the provider routing for a particular class,namespace |
|
Asserts if called before the table is built. This is the function |
|
used to get routing information about Control Providers and |
|
OpenPegasus services |
|
- getRoutingTable - gets the pointer to the DynamicRoutingTable but |
|
does not actually create the table. Used to allow the |
|
CIMOperationRequestDispatcher to set an address for the table as part |
|
of initialization before it the table is created. |
|
- buildRoutingTable - Builds the DynamicRouting table hash table |
|
from the definitions defined in the cpp file. This must be done |
|
late in initialization since this table includes queueId information |
|
which is not defined until almost the end of the OpenPegasus |
|
initialization sequence. |
|
*/ |
|
|
#ifndef Pegasus_reg_table_h | #ifndef Pegasus_reg_table_h |
#define Pegasus_reg_table_h | #define Pegasus_reg_table_h |
| |
|
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
/* |
|
Class defining a single DynamicRoutingTable Record. |
|
*/ |
class RegTableRecord | class RegTableRecord |
{ | { |
public: | public: |
|
|
class PEGASUS_SERVER_LINKAGE DynamicRoutingTable | class PEGASUS_SERVER_LINKAGE DynamicRoutingTable |
{ | { |
public: | public: |
|
// Removes the hash table and pointer |
~DynamicRoutingTable(); | ~DynamicRoutingTable(); |
| |
|
// Get pointer to the singleton instance of DynamicRoutingTable. |
|
// Note that this does NOT build the table. It simply allocates a pointer |
|
// for the table if necessary and returns the pointer. This allows |
|
// initialization of the table pointer in the OpenPegasus initialization |
|
// sequence before the table is actually built. |
static DynamicRoutingTable* getRoutingTable(); | static DynamicRoutingTable* getRoutingTable(); |
| |
// get a single service that can route this spec. |
/* Get a single provider or service that can handle the className and |
|
namespace provided as parameters. |
|
If successful, returns provider in providerName and and queueId of |
|
the correct service for routing.. |
|
@param CIMName className for which provider info wanted |
|
@param CIMNamespaceName namespace of request |
|
@param provider String defining provider name on return if the |
|
routing is to a ControlProvider. Empty String if service routing |
|
found. |
|
@param serviceId Uint32 queueId for routing to provider of service |
|
defined by CIMName and className if an entry is found. |
|
@return true if routing found. False if routing not found. |
|
*/ |
Boolean getRouting( | Boolean getRouting( |
const CIMName& className, | const CIMName& className, |
const CIMNamespaceName& namespaceName, | const CIMNamespaceName& namespaceName, |
String& provider, | String& provider, |
Uint32 &serviceId) const; | Uint32 &serviceId) const; |
| |
void insertRecord( |
// Build the complete routing table. Builds the DynamicRoutingTable from |
const CIMName& className, |
// definition of Control Providers and Services in reg_table.cpp |
const CIMNamespaceName& namespaceName, |
static void buildRoutingTable(); |
const String& provider, |
|
Uint32 serviceId); |
|
#ifdef PEGASUS_DEBUG | #ifdef PEGASUS_DEBUG |
void dumpRegTable(); | void dumpRegTable(); |
#endif | #endif |
private: | private: |
|
// Private since the only way to construct the table is getRoutingTable |
|
// and buildRoutingTable. |
|
// Not a general singleton pattern because table is built during |
|
// initialization by buildRoutingTable() and only accessed subsequently. |
DynamicRoutingTable(); | DynamicRoutingTable(); |
DynamicRoutingTable(const DynamicRoutingTable& table); | DynamicRoutingTable(const DynamicRoutingTable& table); |
DynamicRoutingTable& operator=(const DynamicRoutingTable& table); | DynamicRoutingTable& operator=(const DynamicRoutingTable& table); |
| |
|
void _insertRecord( |
|
const CIMName& className, |
|
const CIMNamespaceName& namespaceName, |
|
const String& provider, |
|
Uint32 serviceId); |
|
|
String _getRoutingKey( | String _getRoutingKey( |
const CIMName& className, | const CIMName& className, |
const CIMNamespaceName& namespaceName) const; | const CIMNamespaceName& namespaceName) const; |
|
|
| |
typedef HashTable<String, RegTableRecord*, | typedef HashTable<String, RegTableRecord*, |
EqualNoCaseFunc, HashFunc<String> > RoutingTable; | EqualNoCaseFunc, HashFunc<String> > RoutingTable; |
|
|
RoutingTable _routingTable; | RoutingTable _routingTable; |
| |
|
// pointer to the singleton instance of the DynamicRoutingTable. |
static AutoPtr<DynamicRoutingTable> _this; | static AutoPtr<DynamicRoutingTable> _this; |
|
#ifdef PEGASUS_DEBUG |
|
// flag to indication table actually built. DEBUG only since the |
|
// order should be fixed between getRouting and buildRoutingTable |
|
// functions |
|
static Boolean _tableInitialized; |
|
#endif |
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |