(file) Return to ProviderIndicationCountTable.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / IndicationService

  1 martin 1.4 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.5 //
  3 martin 1.4 // 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.5 //
 10 martin 1.4 // 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.5 //
 17 martin 1.4 // The above copyright notice and this permission notice shall be included
 18            // in all copies or substantial portions of the Software.
 19 martin 1.5 //
 20 martin 1.4 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.5 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.4 // 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.5 //
 28 martin 1.4 //////////////////////////////////////////////////////////////////////////
 29 yi.zhou 1.2 //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #ifndef Pegasus_ProviderIndicationCountTable_h
 33             #define Pegasus_ProviderIndicationCountTable_h
 34             
 35             #include <Pegasus/Common/Config.h>
 36             #include <Pegasus/Server/Linkage.h>
 37             #include <Pegasus/Common/String.h>
 38             #include <Pegasus/Common/Array.h>
 39             #include <Pegasus/Common/CIMInstance.h>
 40             #include <Pegasus/Common/CIMObjectPath.h>
 41             #include <Pegasus/Common/HashTable.h>
 42             #include <Pegasus/Common/ReadWriteSem.h>
 43             
 44             PEGASUS_NAMESPACE_BEGIN
 45             
 46             /**
 47                 The ProviderIndicationCountTable is used to track the number of indications
 48                 generated by each active indication provider.  Each entry consists of a
 49                 provider module name, provider name, the number of indications generated by
 50 yi.zhou 1.2     the provider, and the number of "orphan" indications (which do not match
 51                 any subscriptions) generated by the provider.
 52             */
 53             class PEGASUS_SERVER_LINKAGE ProviderIndicationCountTable
 54             {
 55             public:
 56             
 57                 /**
 58                     Constructs a ProviderIndicationCountTable instance.
 59                 */
 60                 ProviderIndicationCountTable();
 61             
 62                 /**
 63                     Destructs a ProviderIndicationCountTable instance.
 64                 */
 65                 ~ProviderIndicationCountTable();
 66             
 67                 /**
 68 kumpf   1.6         Inserts an entry for the specified provider. If the entry
 69 yi.zhou 1.2         already exists, this method has no effect.
 70             
 71                     @param providerInstance A PG_Provider instance representing the
 72                         provider for which to insert
 73                 */
 74                 void insertEntry(const CIMInstance& providerInstance);
 75             
 76                 /**
 77                     Updates the indication count for a specified provider if the provider
 78                     entry exists.  Updates the orphan indication count also, if applicable.
 79             
 80                     @param providerInstance A PG_Provider instance representing the
 81                         provider for which to update the counts.
 82                     @param isOrphan A Boolean indicating whether the indication did not
 83                         match any active subscriptions
 84                 */
 85                 void incrementEntry(
 86                     const CIMInstance& providerInstance,
 87                     Boolean isOrphan);
 88             
 89                 /**
 90 yi.zhou 1.2         Removes the entry for the specified provider from the table.
 91             
 92                     @param providerInstance A PG_Provider instance specifying the provider
 93                         for which to remove the entry.
 94                 */
 95                 void removeEntry(const CIMInstance& providerInstance);
 96             
 97                 /**
 98                     Removes all provider entries for the specified provider module from
 99                     the table.
100             
101                     @param providerModuleName The name of the provider module for which to
102                         remove the provider entries.
103                 */
104                 void removeModuleEntries(const String& providerModuleName);
105             
106                 /**
107                     Gets the provider module name and provider name from a PG_Provider
108                     instance.
109             
110 kumpf   1.6         @param providerInstance A PG_Provider instance for which to retrieve
111 yi.zhou 1.3             the provider module name and the provider name.
112 yi.zhou 1.2         @param providerModuleName Output String containing the provider module
113                         name.
114                     @param providerName Output String containing the provider name.
115                 */
116                 static void getProviderKeys(
117                     const CIMInstance& providerInstance,
118                     String& providerModuleName,
119                     String& providerName);
120             
121                 Array<CIMInstance> enumerateProviderIndicationDataInstances();
122             
123 kumpf   1.6     /**
124 yi.zhou 1.3         Enumerates PG_ProviderIndicationData instance names using the data
125 kumpf   1.6         stored in the Provider Indication Count table.
126 yi.zhou 1.3 
127                     @return All the PG_ProviderIndicationData instanceName.
128                 */
129                 Array<CIMObjectPath> enumerateProviderIndicationDataInstanceNames();
130             
131                 /**
132 kumpf   1.6         Gets the Provider Indication Data instance for the specified CIM
133 yi.zhou 1.3         object path.
134             
135 kumpf   1.6         @param instanceName CIMObjectPath specifies a CIM instance to be
136                         returned
137 yi.zhou 1.3         @return The specified PG_ProviderIndicationData instance.
138 kumpf   1.6         @exception CIMObjectNotFoundException If the specified instance does
139 yi.zhou 1.3             not exist
140                 */
141                 CIMInstance getProviderIndicationDataInstance(
142                     const CIMObjectPath& instanceName);
143             
144 venkat.puvvada 1.7     /**
145                            Removes all entries from the ProviderIndicationCountTable.
146                         */
147                        void clear ();
148                    
149 yi.zhou        1.2 private:
150                    
151                        ProviderIndicationCountTable(const ProviderIndicationCountTable&);
152                        ProviderIndicationCountTable& operator=(
153                            const ProviderIndicationCountTable&);
154                    
155                        /**
156                            Generates a unique String key for a ProviderIndicationCountTableEntry.
157                            The key is generated by concatenating the provider name, the provider
158                            module name, colon, and the length of the provider name.
159                    
160                            @param providerModuleName The provider module name used to generate
161                                the key.
162                            @param providerName The provider name used to generate the key.
163                            @return A String containing the generated key.
164                        */
165                        static String _generateKey(
166                            const String& providerModuleName,
167                            const String& providerName);
168                    
169                        struct _ProviderIndicationCountTableEntry
170 yi.zhou        1.2     {
171                            String providerModuleName;
172                            String providerName;
173                            Uint32 indicationCount;
174                            Uint32 orphanIndicationCount;
175                        };
176                    
177                        /**
178                            Returns all the table entries.
179                            @return A complete list of ProviderIndicationCountTableEntry objects.
180                        */
181                        Array<_ProviderIndicationCountTableEntry> _getAllEntries();
182                    
183                        /**
184 kumpf          1.6         Builds the provider indication data instance object path by using the
185 yi.zhou        1.3             specified provider indication count table entry.
186                    
187                            @param providerIndCountTableEntry The provider indication count table
188                                entry used to build the provider indication data instance name.
189                            @return The created provider indication data instance object path.
190                        */
191                        CIMObjectPath _buildProviderIndDataInstanceName(
192                            const _ProviderIndicationCountTableEntry& providerIndCountTableEntry);
193                    
194                        /**
195 kumpf          1.6         Builds the provider indication data instance by using the
196 yi.zhou        1.3             specified provider indication count table entry.
197                    
198                            @param providerIndCountTableEntry The provider indication count table
199                                entry used to build the provider indication data instance.
200                            @return The created provider indication data instance
201                        */
202                        CIMInstance _buildProviderIndDataInstance(
203                            const _ProviderIndicationCountTableEntry& providerIndCountTableEntry);
204                    
205                        /**
206 yi.zhou        1.2         Hash function used in _ProviderIndicationCountTable.  The algorithm is
207                            optimized for the key format and the hash table size (32 by default).
208                        */
209                        struct _ProviderIndicationCountHashFunc
210                        {
211                            static Uint32 hash(const String& key);
212                        };
213                    
214                        /**
215                            Table of generated indications counts.  Access to this table
216                            is controlled by the _tableLock.
217                        */
218                        typedef HashTable<
219                            String,
220                            _ProviderIndicationCountTableEntry,
221                            EqualNoCaseFunc,
222                            _ProviderIndicationCountHashFunc> _ProviderIndicationCountTable;
223                        _ProviderIndicationCountTable _table;
224                    
225                        /**
226                            A lock to control access to the _table.  Before accessing the _table,
227 yi.zhou        1.2         one must first lock this for read access.  Before updating the _table,
228                            one must first lock this for write access.
229                        */
230                        mutable ReadWriteSem _tableLock;
231                    };
232                    
233                    PEGASUS_NAMESPACE_END
234                    
235                    #endif  /* Pegasus_ProviderIndicationCountTable_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2