(file) Return to ProviderStatus.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2 / Default

  1 kumpf 1.1 //%2006////////////////////////////////////////////////////////////////////////
  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           // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12           // EMC Corporation; Symantec Corporation; The Open Group.
 13           //
 14           // Permission is hereby granted, free of charge, to any person obtaining a copy
 15           // of this software and associated documentation files (the "Software"), to
 16           // deal in the Software without restriction, including without limitation the
 17           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18           // sell copies of the Software, and to permit persons to whom the Software is
 19           // furnished to do so, subject to the following conditions:
 20           // 
 21           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 kumpf 1.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29           //
 30           //==============================================================================
 31           //
 32           //%/////////////////////////////////////////////////////////////////////////////
 33           
 34           #ifndef Pegasus_ProviderStatus_h
 35           #define Pegasus_ProviderStatus_h
 36           
 37           #include <Pegasus/Common/Config.h>
 38           #include <Pegasus/Common/Mutex.h>
 39           #include <Pegasus/Provider/CIMOMHandle.h>
 40           #include <Pegasus/ProviderManager2/Default/ProviderModule.h>
 41           #include <Pegasus/ProviderManager2/Default/Linkage.h>
 42           
 43 kumpf 1.1 PEGASUS_NAMESPACE_BEGIN
 44           
 45           // The Provider class represents the logical provider extracted from a
 46           // provider module. It is wrapped in a facade to stabalize the interface
 47           // and is directly tied to a module.
 48           
 49           class PEGASUS_DEFPM_LINKAGE ProviderStatus
 50           {
 51           public:
 52               ProviderStatus();
 53           
 54               virtual ~ProviderStatus();
 55           
 56               Boolean isInitialized();
 57               void setInitialized(Boolean initialized);
 58           
 59               ProviderModule* getModule() const;
 60               void setModule(ProviderModule* module);
 61               void setCIMOMHandle(CIMOMHandle* cimomHandle);
 62               void reset();
 63           
 64 kumpf 1.1     virtual void get_idle_timer(struct timeval *);
 65               virtual void update_idle_timer();
 66               virtual Boolean pending_operation();
 67               virtual Boolean unload_ok();
 68           
 69               // force provider manager to keep in memory
 70               virtual void protect();
 71               // allow provider manager to unload when idle
 72               virtual void unprotect();
 73           
 74               /**
 75                   Increments the count of current subscriptions for this provider, and
 76                   determines if there were no current subscriptions before the increment.
 77                   If there were no current subscriptions before the increment, the first
 78                   subscription has been created, and the provider's enableIndications
 79                   method should be called.
 80           
 81                   @return  True, if before the increment there were no current
 82                                  subscriptions for this provider;
 83                            False, otherwise
 84                */
 85 kumpf 1.1     Boolean testIfZeroAndIncrementSubscriptions();
 86           
 87               /**
 88                   Decrements the count of current subscriptions for this provider, and
 89                   determines if there are no current subscriptions after the decrement.
 90                   If there are no current subscriptions after the decrement, the last
 91                   subscription has been deleted, and the provider's disableIndications
 92                   method should be called.
 93           
 94                   @return  True, if after the decrement there are no current subscriptions
 95                                  for this provider;
 96                            False, otherwise
 97                */
 98               Boolean decrementSubscriptionsAndTestIfZero();
 99           
100               /**
101                   Determines if there are current subscriptions for this provider.
102           
103                   @return  True, if there is at least one current subscription
104                                  for this provider;
105                            False, otherwise
106 kumpf 1.1      */
107               Boolean testSubscriptions();
108           
109               /**
110                   Resets the count of current subscriptions for the indication provider.
111                */
112               void resetSubscriptions();
113           
114               /**
115                   Sets the provider instance for the provider.
116           
117                   Note: the provider instance is set only for an indication provider, and
118                   is set when a Create Subscription request is processed for the provider.
119           
120                   @param  instance  the Provider CIMInstance for the provider
121                */
122               void setProviderInstance(const CIMInstance & instance);
123           
124               /**
125                   Gets the provider instance for the provider.
126           
127 kumpf 1.1         Note: the provider instance is set only for an indication provider, and
128                   only if a Create Subscription request has been processed for the 
129                   provider.
130           
131                   @return  the Provider CIMInstance for the provider
132                */
133               CIMInstance getProviderInstance();
134           
135           private:
136               ProviderStatus(const ProviderStatus&);
137               ProviderStatus& operator=(const ProviderStatus&);
138           
139 kumpf 1.2     friend class DefaultProviderManager;
140               friend class ProviderMessageHandler;
141               friend class ProviderOperationCounter;
142 kumpf 1.1 
143               CIMOMHandle *_cimom_handle;
144               ProviderModule *_module;
145               Boolean _isInitialized;
146 kumpf 1.2     AtomicInt _noUnload;
147 kumpf 1.1     Uint32 _quantum;
148               Mutex _statusMutex;
149           
150 kumpf 1.2     AtomicInt _currentOperations;
151               Boolean _indicationsEnabled;
152           
153 kumpf 1.1     /**
154                   Count of current subscriptions for this provider.  Access to this
155                   data member is controlled by the _currentSubscriptionsLock.
156                */
157               Uint32 _currentSubscriptions;
158           
159               /**
160                   A mutex to control access to the _currentSubscriptions member variable.
161                   Before any access (test, increment, decrement or reset) of the 
162                   _currentSubscriptions member variable, the _currentSubscriptionsMutex is
163                   first locked.
164                */
165               Mutex _currentSubscriptionsMutex;
166           
167               /**
168                   The Provider CIMInstance for the provider.
169                   The Provider CIMInstance is set only for indication providers, and only
170                   if a Create Subscription request has been processed for the provider.
171                   The Provider CIMInstance is needed in order to construct the 
172                   EnableIndicationsResponseHandler to send to the indication provider
173                   when the provider's enableIndications() method is called.
174 kumpf 1.1         The Provider CIMInstance is needed in the 
175                   EnableIndicationsResponseHandler in order to construct the Process
176                   Indication request when an indication is delivered by the provider.
177                   The Provider CIMInstance is needed in the Process Indication request
178                   to enable the Indication Service to determine if the provider that 
179                   generated the indication accepted a matching subscription.
180                */
181               CIMInstance _providerInstance;
182           };
183           
184           PEGASUS_NAMESPACE_END
185           
186           #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2