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

  1 martin 1.5 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.6 //
  3 martin 1.5 // 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.6 //
 10 martin 1.5 // 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.6 //
 17 martin 1.5 // The above copyright notice and this permission notice shall be included
 18            // in all copies or substantial portions of the Software.
 19 martin 1.6 //
 20 martin 1.5 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.6 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.5 // 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.6 //
 28 martin 1.5 //////////////////////////////////////////////////////////////////////////
 29 kumpf  1.1 //
 30            //%/////////////////////////////////////////////////////////////////////////////
 31            
 32            #ifndef Pegasus_ProviderStatus_h
 33            #define Pegasus_ProviderStatus_h
 34            
 35            #include <Pegasus/Common/Config.h>
 36            #include <Pegasus/Common/Mutex.h>
 37            #include <Pegasus/Provider/CIMOMHandle.h>
 38            #include <Pegasus/ProviderManager2/Default/ProviderModule.h>
 39            #include <Pegasus/ProviderManager2/Default/Linkage.h>
 40            
 41            PEGASUS_NAMESPACE_BEGIN
 42            
 43            // The Provider class represents the logical provider extracted from a
 44            // provider module. It is wrapped in a facade to stabalize the interface
 45            // and is directly tied to a module.
 46            
 47            class PEGASUS_DEFPM_LINKAGE ProviderStatus
 48            {
 49            public:
 50 kumpf  1.1     ProviderStatus();
 51            
 52 kumpf  1.3     ~ProviderStatus();
 53 kumpf  1.1 
 54                Boolean isInitialized();
 55 kumpf  1.3 
 56                /**
 57                    Set the initialization state of the provider.  If the initialized
 58                    parameter is false, the ProviderStatus values are reset.
 59                 */
 60 kumpf  1.1     void setInitialized(Boolean initialized);
 61            
 62                ProviderModule* getModule() const;
 63                void setModule(ProviderModule* module);
 64 kumpf  1.3 
 65                CIMOMHandle* getCIMOMHandle();
 66 kumpf  1.1     void setCIMOMHandle(CIMOMHandle* cimomHandle);
 67            
 68 kumpf  1.3     /**
 69                    Indicates that the provider is busy processing an operation.
 70                 */
 71                void operationBegin();
 72            
 73                /**
 74                    Indicates that the provider is finished processing an operation.
 75                 */
 76                void operationEnd();
 77            
 78                /**
 79                    Returns the time at which the operationEnd() method was last called.
 80                 */
 81                void getLastOperationEndTime(struct timeval*);
 82            
 83                /**
 84                    Returns true if the provider is initialized, is not processing any
 85                    operations, is not enabled as an indication provider, and has not
 86                    been protected against unloads via the CIMOMHandle.
 87                 */
 88                Boolean isIdle();
 89 kumpf  1.3 
 90                /**
 91                    Gets the number of provider operations currently in progress.
 92                 */
 93                Uint32 numCurrentOperations() const;
 94            
 95                /**
 96                    Returns a Boolean indicating whether indications have been enabled
 97                    for this provider.
 98                 */
 99                Boolean getIndicationsEnabled() const;
100            
101                /**
102                    Sets a flag indicating whether indications have been enabled
103                    for this provider.
104                 */
105                void setIndicationsEnabled(Boolean indicationsEnabled);
106 kumpf  1.1 
107                /**
108                    Increments the count of current subscriptions for this provider, and
109                    determines if there were no current subscriptions before the increment.
110                    If there were no current subscriptions before the increment, the first
111                    subscription has been created, and the provider's enableIndications
112                    method should be called.
113            
114                    @return  True, if before the increment there were no current
115                                   subscriptions for this provider;
116                             False, otherwise
117                 */
118                Boolean testIfZeroAndIncrementSubscriptions();
119            
120                /**
121                    Decrements the count of current subscriptions for this provider, and
122                    determines if there are no current subscriptions after the decrement.
123                    If there are no current subscriptions after the decrement, the last
124                    subscription has been deleted, and the provider's disableIndications
125                    method should be called.
126            
127 kumpf  1.1         @return  True, if after the decrement there are no current subscriptions
128                                   for this provider;
129                             False, otherwise
130                 */
131                Boolean decrementSubscriptionsAndTestIfZero();
132            
133                /**
134                    Determines if there are current subscriptions for this provider.
135            
136                    @return  True, if there is at least one current subscription
137                                   for this provider;
138                             False, otherwise
139                 */
140                Boolean testSubscriptions();
141            
142                /**
143                    Resets the count of current subscriptions for the indication provider.
144                 */
145                void resetSubscriptions();
146            
147                /**
148 kumpf  1.1         Sets the provider instance for the provider.
149            
150                    Note: the provider instance is set only for an indication provider, and
151                    is set when a Create Subscription request is processed for the provider.
152            
153                    @param  instance  the Provider CIMInstance for the provider
154                 */
155 kumpf  1.4     void setProviderInstance(const CIMInstance& instance);
156 kumpf  1.1 
157                /**
158                    Gets the provider instance for the provider.
159            
160                    Note: the provider instance is set only for an indication provider, and
161 kumpf  1.4         only if a Create Subscription request has been processed for the
162 kumpf  1.1         provider.
163            
164                    @return  the Provider CIMInstance for the provider
165                 */
166                CIMInstance getProviderInstance();
167            
168 kumpf  1.3     /**
169                    The status mutex must be locked while changes to the initialization
170                    status of the provider are in progress.  This mutex may be locked
171                    recursively.
172                 */
173                Mutex& getStatusMutex();
174            
175 kumpf  1.1 private:
176                ProviderStatus(const ProviderStatus&);
177                ProviderStatus& operator=(const ProviderStatus&);
178            
179 kumpf  1.3     Boolean _isInitialized;
180                Mutex _statusMutex;    // Must be a recursive mutex
181 kumpf  1.1 
182 kumpf  1.4     ProviderModule* _module;
183                CIMOMHandle* _cimomHandle;
184 kumpf  1.1 
185 kumpf  1.2     AtomicInt _currentOperations;
186                Boolean _indicationsEnabled;
187            
188 kumpf  1.3     struct timeval _lastOperationEndTime;
189                Mutex _lastOperationEndTimeMutex;
190            
191 kumpf  1.1     /**
192                    Count of current subscriptions for this provider.  Access to this
193                    data member is controlled by the _currentSubscriptionsLock.
194                 */
195                Uint32 _currentSubscriptions;
196            
197                /**
198                    A mutex to control access to the _currentSubscriptions member variable.
199 kumpf  1.4         Before any access (test, increment, decrement or reset) of the
200                    _currentSubscriptions member variable, the _currentSubscriptionsMutex
201                    is first locked.
202 kumpf  1.1      */
203                Mutex _currentSubscriptionsMutex;
204            
205                /**
206                    The Provider CIMInstance for the provider.
207                    The Provider CIMInstance is set only for indication providers, and only
208                    if a Create Subscription request has been processed for the provider.
209 kumpf  1.4         The Provider CIMInstance is needed in order to construct the
210 kumpf  1.1         EnableIndicationsResponseHandler to send to the indication provider
211                    when the provider's enableIndications() method is called.
212 kumpf  1.4         The Provider CIMInstance is needed in the
213 kumpf  1.1         EnableIndicationsResponseHandler in order to construct the Process
214                    Indication request when an indication is delivered by the provider.
215                    The Provider CIMInstance is needed in the Process Indication request
216 kumpf  1.4         to enable the Indication Service to determine if the provider that
217 kumpf  1.1         generated the indication accepted a matching subscription.
218                 */
219                CIMInstance _providerInstance;
220            };
221            
222            PEGASUS_NAMESPACE_END
223            
224            #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2