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

  1 h.sterling 1.1 //%2005////////////////////////////////////////////////////////////////////////
  2                //
  3                // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4                // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5                // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6                // IBM Corp.; EMC Corporation, The Open Group.
  7                // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8                // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9                // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10                // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11                //
 12                // Permission is hereby granted, free of charge, to any person obtaining a copy
 13                // of this software and associated documentation files (the "Software"), to
 14                // deal in the Software without restriction, including without limitation the
 15                // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 16                // sell copies of the Software, and to permit persons to whom the Software is
 17                // furnished to do so, subject to the following conditions:
 18                // 
 19                // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 20                // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 21                // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 22 h.sterling 1.1 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 23                // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 24                // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 25                // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 26                // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27                //
 28                //==============================================================================
 29                //
 30                // Author: Heather Sterling (hsterl@us.ibm.com)
 31                //
 32                // Modified By: 
 33                //
 34                //%/////////////////////////////////////////////////////////////////////////////
 35                
 36                #ifndef Pegasus_ConsumerManager_h
 37                #define Pegasus_ConsumerManager_h
 38                
 39                #include <Pegasus/Common/Config.h>
 40                #include <Pegasus/Common/HashTable.h>
 41                #include <Pegasus/Common/OptionManager.h>
 42                #include <Pegasus/Common/ArrayInternal.h>
 43 h.sterling 1.1 #include <Pegasus/Common/CIMInstance.h>
 44                #include <Pegasus/Consumer/CIMIndicationConsumer.h>
 45                #include <Pegasus/Common/System.h>
 46                #include <Pegasus/DynListener/Linkage.h>
 47                
 48                #include "ConsumerModule.h"
 49                #include "DynamicConsumer.h"
 50                
 51                PEGASUS_NAMESPACE_BEGIN
 52                
 53                /** The ConsumerManager class is responsible for managing all of the consumers.  It is also responsible for
 54                 *  synchronizing consumer operations.
 55                 */
 56                
 57                class PEGASUS_DYNLISTENER_LINKAGE ConsumerManager
 58                {
 59                public:
 60                
 61                    ConsumerManager(const String& consumerDir, const String& consumerConfigDir, Boolean enableConsumerUnload, Uint32 idleTimeout);
 62                
 63                    virtual ~ConsumerManager();
 64 h.sterling 1.1 
 65                    String getConsumerDir();
 66                
 67                    String getConsumerConfigDir();
 68                
 69                    Boolean getEnableConsumerUnload();
 70                
 71                    Uint32 getIdleTimeout();
 72                
 73                    Boolean hasLoadedConsumers();
 74                
 75                    Boolean hasActiveConsumers();
 76                
 77                    DynamicConsumer* getConsumer(const String& consumerName);
 78                
 79                    void unloadConsumer(const String& consumerName);
 80                
 81                    void unloadAllConsumers();
 82                
 83                    void unloadIdleConsumers();
 84                
 85 h.sterling 1.1 private:
 86                
 87                    typedef HashTable<String, DynamicConsumer *, EqualFunc<String>,  HashFunc<String> > ConsumerTable;
 88                
 89                    typedef HashTable<String, ConsumerModule *, EqualFunc<String>, HashFunc<String> > ModuleTable;
 90                
 91                    //consumer queue
 92                    ConsumerTable _consumers;
 93                    Mutex _consumerTableMutex;
 94                
 95                    //consumer module queue
 96                    ModuleTable _modules;
 97                    Mutex _moduleTableMutex;
 98                
 99                    //config properties
100                    String _consumerDir;
101                    String _consumerConfigDir;
102                    OptionManager _optionMgr;
103                    Boolean _enableConsumerUnload;
104                    Uint32 _idleTimeout; //ms
105                    Boolean _forceShutdown;
106 h.sterling 1.1 
107                    //global thread pool
108                    ThreadPool* _thread_pool;
109                
110                    //worker thread
111                    static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _worker_routine(void *param);
112                
113                
114                    //methods
115                
116                    ConsumerModule* _lookupModule(const String & moduleFileName);
117                 
118                    String _getConsumerLibraryName(const String & consumerName);
119                
120                    void _initConsumer(const String& consumerName, DynamicConsumer* consumer);
121                
122                    void _unloadConsumers(Array<DynamicConsumer*> consumersToUnload);
123                
124                    void _init();
125                
126                    Array<CIMInstance> _deserializeOutstandingIndications(const String& consumerName);
127 h.sterling 1.1 
128                    void _serializeOutstandingIndications(const String& consumerName, Array<CIMInstance> indications);
129                
130                };
131                
132                PEGASUS_NAMESPACE_END
133                
134                #endif /* Pegasus_ConsumerManager_h */
135                
136                
137                

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2