(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 kumpf 1.3     ~ProviderStatus();
 55 kumpf 1.1 
 56               Boolean isInitialized();
 57 kumpf 1.3 
 58               /**
 59                   Set the initialization state of the provider.  If the initialized
 60                   parameter is false, the ProviderStatus values are reset.
 61                */
 62 kumpf 1.1     void setInitialized(Boolean initialized);
 63           
 64               ProviderModule* getModule() const;
 65               void setModule(ProviderModule* module);
 66 kumpf 1.3 
 67               CIMOMHandle* getCIMOMHandle();
 68 kumpf 1.1     void setCIMOMHandle(CIMOMHandle* cimomHandle);
 69           
 70 kumpf 1.3     /**
 71                   Indicates that the provider is busy processing an operation.
 72                */
 73               void operationBegin();
 74           
 75               /**
 76                   Indicates that the provider is finished processing an operation.
 77                */
 78               void operationEnd();
 79           
 80               /**
 81                   Returns the time at which the operationEnd() method was last called.
 82                */
 83               void getLastOperationEndTime(struct timeval*);
 84           
 85               /**
 86                   Returns true if the provider is initialized, is not processing any
 87                   operations, is not enabled as an indication provider, and has not
 88                   been protected against unloads via the CIMOMHandle.
 89                */
 90               Boolean isIdle();
 91 kumpf 1.3 
 92               /**
 93                   Gets the number of provider operations currently in progress.
 94                */
 95               Uint32 numCurrentOperations() const;
 96           
 97               /**
 98                   Returns a Boolean indicating whether indications have been enabled
 99                   for this provider.
100                */
101               Boolean getIndicationsEnabled() const;
102           
103               /**
104                   Sets a flag indicating whether indications have been enabled
105                   for this provider.
106                */
107               void setIndicationsEnabled(Boolean indicationsEnabled);
108 kumpf 1.1 
109               /**
110                   Increments the count of current subscriptions for this provider, and
111                   determines if there were no current subscriptions before the increment.
112                   If there were no current subscriptions before the increment, the first
113                   subscription has been created, and the provider's enableIndications
114                   method should be called.
115           
116                   @return  True, if before the increment there were no current
117                                  subscriptions for this provider;
118                            False, otherwise
119                */
120               Boolean testIfZeroAndIncrementSubscriptions();
121           
122               /**
123                   Decrements the count of current subscriptions for this provider, and
124                   determines if there are no current subscriptions after the decrement.
125                   If there are no current subscriptions after the decrement, the last
126                   subscription has been deleted, and the provider's disableIndications
127                   method should be called.
128           
129 kumpf 1.1         @return  True, if after the decrement there are no current subscriptions
130                                  for this provider;
131                            False, otherwise
132                */
133               Boolean decrementSubscriptionsAndTestIfZero();
134           
135               /**
136                   Determines if there are current subscriptions for this provider.
137           
138                   @return  True, if there is at least one current subscription
139                                  for this provider;
140                            False, otherwise
141                */
142               Boolean testSubscriptions();
143           
144               /**
145                   Resets the count of current subscriptions for the indication provider.
146                */
147               void resetSubscriptions();
148           
149               /**
150 kumpf 1.1         Sets the provider instance for the provider.
151           
152                   Note: the provider instance is set only for an indication provider, and
153                   is set when a Create Subscription request is processed for the provider.
154           
155                   @param  instance  the Provider CIMInstance for the provider
156                */
157               void setProviderInstance(const CIMInstance & instance);
158           
159               /**
160                   Gets the provider instance for the provider.
161           
162                   Note: the provider instance is set only for an indication provider, and
163                   only if a Create Subscription request has been processed for the 
164                   provider.
165           
166                   @return  the Provider CIMInstance for the provider
167                */
168               CIMInstance getProviderInstance();
169           
170 kumpf 1.3     /**
171                   The status mutex must be locked while changes to the initialization
172                   status of the provider are in progress.  This mutex may be locked
173                   recursively.
174                */
175               Mutex& getStatusMutex();
176           
177 kumpf 1.1 private:
178               ProviderStatus(const ProviderStatus&);
179               ProviderStatus& operator=(const ProviderStatus&);
180           
181 kumpf 1.3     Boolean _isInitialized;
182               Mutex _statusMutex;    // Must be a recursive mutex
183 kumpf 1.1 
184               ProviderModule *_module;
185 kumpf 1.3     CIMOMHandle *_cimomHandle;
186 kumpf 1.1 
187 kumpf 1.2     AtomicInt _currentOperations;
188               Boolean _indicationsEnabled;
189           
190 kumpf 1.3     struct timeval _lastOperationEndTime;
191               Mutex _lastOperationEndTimeMutex;
192           
193 kumpf 1.1     /**
194                   Count of current subscriptions for this provider.  Access to this
195                   data member is controlled by the _currentSubscriptionsLock.
196                */
197               Uint32 _currentSubscriptions;
198           
199               /**
200                   A mutex to control access to the _currentSubscriptions member variable.
201                   Before any access (test, increment, decrement or reset) of the 
202                   _currentSubscriptions member variable, the _currentSubscriptionsMutex is
203                   first locked.
204                */
205               Mutex _currentSubscriptionsMutex;
206           
207               /**
208                   The Provider CIMInstance for the provider.
209                   The Provider CIMInstance is set only for indication providers, and only
210                   if a Create Subscription request has been processed for the provider.
211                   The Provider CIMInstance is needed in order to construct the 
212                   EnableIndicationsResponseHandler to send to the indication provider
213                   when the provider's enableIndications() method is called.
214 kumpf 1.1         The Provider CIMInstance is needed in the 
215                   EnableIndicationsResponseHandler in order to construct the Process
216                   Indication request when an indication is delivered by the provider.
217                   The Provider CIMInstance is needed in the Process Indication request
218                   to enable the Indication Service to determine if the provider that 
219                   generated the indication accepted a matching subscription.
220                */
221               CIMInstance _providerInstance;
222           };
223           
224           PEGASUS_NAMESPACE_END
225           
226           #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2