1 martin 1.14 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.15 //
|
3 martin 1.14 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.15 //
|
10 martin 1.14 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.15 //
|
17 martin 1.14 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.15 //
|
20 martin 1.14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.15 //
|
28 martin 1.14 //////////////////////////////////////////////////////////////////////////
|
29 karl 1.10
|
30 mday 1.2 //%////////////////////////////////////////////////////////////////////////////
31
|
32 karl 1.17 /*
33 Definitions for the DynamicRoutingTable that controls fixed registration
34 of OpenPegasus control providers and services.
35 NOTE: The actual Control Provider and Service registration definitions
36 are contained in the DynamicRoutingTable .cpp file.
37
38 DynamicRoutingTable is a singleton which includes the following
39 public functions:
40 - getRouting - Gets the provider routing for a particular class,namespace
41 Asserts if called before the table is built. This is the function
42 used to get routing information about Control Providers and
43 OpenPegasus services
44 - getRoutingTable - gets the pointer to the DynamicRoutingTable but
45 does not actually create the table. Used to allow the
46 CIMOperationRequestDispatcher to set an address for the table as part
47 of initialization before it the table is created.
48 - buildRoutingTable - Builds the DynamicRouting table hash table
49 from the definitions defined in the cpp file. This must be done
50 late in initialization since this table includes queueId information
51 which is not defined until almost the end of the OpenPegasus
52 initialization sequence.
53 karl 1.17 */
54
|
55 mday 1.2 #ifndef Pegasus_reg_table_h
56 #define Pegasus_reg_table_h
57
58 #include <Pegasus/Common/Config.h>
59 #include <Pegasus/Common/String.h>
60 #include <Pegasus/Common/ArrayInter.h>
61 #include <Pegasus/Common/HashTable.h>
62 #include <Pegasus/Common/System.h>
63 #include <Pegasus/Common/CIMName.h>
64 #include <Pegasus/Common/MessageQueueService.h>
65 #include <Pegasus/Server/Linkage.h>
|
66 venkat.puvvada 1.12 #include <Pegasus/Common/AutoPtr.h>
|
67 mday 1.2
68 PEGASUS_NAMESPACE_BEGIN
69
|
70 karl 1.17 /*
71 Class defining a single DynamicRoutingTable Record.
72 */
|
73 venkat.puvvada 1.12 class RegTableRecord
74 {
75 public:
76 RegTableRecord(
77 const CIMName& className,
78 const CIMNamespaceName& namespaceName,
79 const String& providerName,
80 Uint32 serviceId);
81 ~RegTableRecord();
82
83 CIMName className;
84 CIMNamespaceName namespaceName;
85 String providerName;
86 Uint32 serviceId;
87 private:
88 RegTableRecord(const RegTableRecord&);
89 RegTableRecord& operator=(const RegTableRecord&);
90 };
|
91 mday 1.2
|
92 kumpf 1.11 class PEGASUS_SERVER_LINKAGE DynamicRoutingTable
|
93 mday 1.2 {
|
94 kumpf 1.11 public:
|
95 karl 1.17 // Removes the hash table and pointer
|
96 kumpf 1.11 ~DynamicRoutingTable();
97
|
98 karl 1.17 // Get pointer to the singleton instance of DynamicRoutingTable.
99 // Note that this does NOT build the table. It simply allocates a pointer
100 // for the table if necessary and returns the pointer. This allows
101 // initialization of the table pointer in the OpenPegasus initialization
102 // sequence before the table is actually built.
|
103 venkat.puvvada 1.12 static DynamicRoutingTable* getRoutingTable();
|
104 kumpf 1.11
|
105 karl 1.17 /* Get a single provider or service that can handle the className and
106 namespace provided as parameters.
107 If successful, returns provider in providerName and and queueId of
108 the correct service for routing..
109 @param CIMName className for which provider info wanted
110 @param CIMNamespaceName namespace of request
111 @param provider String defining provider name on return if the
112 routing is to a ControlProvider. Empty String if service routing
113 found.
114 @param serviceId Uint32 queueId for routing to provider of service
115 defined by CIMName and className if an entry is found.
116 @return true if routing found. False if routing not found.
117 */
|
118 venkat.puvvada 1.12 Boolean getRouting(
119 const CIMName& className,
120 const CIMNamespaceName& namespaceName,
|
121 kumpf 1.11 String& provider,
|
122 venkat.puvvada 1.12 Uint32 &serviceId) const;
|
123 kumpf 1.11
|
124 karl 1.17 // Build the complete routing table. Builds the DynamicRoutingTable from
125 // definition of Control Providers and Services in reg_table.cpp
126 static void buildRoutingTable();
127
|
128 venkat.puvvada 1.12 #ifdef PEGASUS_DEBUG
129 void dumpRegTable();
130 #endif
131 private:
|
132 karl 1.17 // Private since the only way to construct the table is getRoutingTable
133 // and buildRoutingTable.
134 // Not a general singleton pattern because table is built during
135 // initialization by buildRoutingTable() and only accessed subsequently.
|
136 venkat.puvvada 1.12 DynamicRoutingTable();
137 DynamicRoutingTable(const DynamicRoutingTable& table);
138 DynamicRoutingTable& operator=(const DynamicRoutingTable& table);
|
139 kumpf 1.11
|
140 karl 1.17 void _insertRecord(
141 const CIMName& className,
142 const CIMNamespaceName& namespaceName,
143 const String& provider,
144 Uint32 serviceId);
145
|
146 marek 1.13 String _getRoutingKey(
|
147 venkat.puvvada 1.12 const CIMName& className,
148 const CIMNamespaceName& namespaceName) const;
149
|
150 marek 1.13 String _getWildRoutingKey(
|
151 venkat.puvvada 1.12 const CIMName& className) const;
152
|
153 kumpf 1.16 typedef HashTable<String, RegTableRecord*,
|
154 venkat.puvvada 1.12 EqualNoCaseFunc, HashFunc<String> > RoutingTable;
|
155 karl 1.17
|
156 venkat.puvvada 1.12 RoutingTable _routingTable;
|
157 kumpf 1.11
|
158 karl 1.17 // pointer to the singleton instance of the DynamicRoutingTable.
|
159 venkat.puvvada 1.12 static AutoPtr<DynamicRoutingTable> _this;
|
160 karl 1.17 #ifdef PEGASUS_DEBUG
161 // flag to indication table actually built. DEBUG only since the
162 // order should be fixed between getRouting and buildRoutingTable
163 // functions
164 static Boolean _tableInitialized;
165 #endif
|
166 mday 1.2 };
167
168 PEGASUS_NAMESPACE_END
|
169 kumpf 1.11
|
170 mday 1.2 #endif // Pegasus_reg_table_h
|