(file) Return to ProviderStatus.cpp 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           #include "ProviderStatus.h"
 35           
 36           PEGASUS_NAMESPACE_BEGIN
 37           
 38           ProviderStatus::ProviderStatus()
 39               : _cimom_handle(0),
 40                 _module(0),
 41                 _isInitialized(false),
 42 kumpf 1.2       _noUnload(0),
 43                 _currentOperations(0),
 44                 _indicationsEnabled(false),
 45 kumpf 1.1       _currentSubscriptions(0)
 46           {
 47           }
 48           
 49           ProviderStatus::~ProviderStatus()
 50           {
 51           }
 52           
 53           Boolean ProviderStatus::isInitialized()
 54           {
 55               AutoMutex lock(_statusMutex);
 56               return _isInitialized;
 57           }
 58           
 59           void ProviderStatus::setInitialized(Boolean initialized)
 60           {
 61               AutoMutex lock(_statusMutex);
 62               _isInitialized = initialized;
 63           }
 64           
 65           ProviderModule* ProviderStatus::getModule() const
 66 kumpf 1.1 {
 67               return _module;
 68           }
 69           
 70           void ProviderStatus::setModule(ProviderModule* module)
 71           {
 72               _module = module;
 73           }
 74           
 75           void ProviderStatus::setCIMOMHandle(CIMOMHandle* cimomHandle)
 76           {
 77               _cimom_handle = cimomHandle;
 78           }
 79           
 80           void ProviderStatus::reset()
 81           {
 82               _cimom_handle = 0;
 83               _module = 0;
 84 kumpf 1.2     _noUnload = 0;
 85 kumpf 1.1     _isInitialized = false;
 86           }
 87           
 88           void ProviderStatus::get_idle_timer(struct timeval* t)
 89           {
 90               if (t && _cimom_handle)
 91               {
 92                   _cimom_handle->get_idle_timer(t);
 93               }
 94           }
 95           
 96           void ProviderStatus::update_idle_timer()
 97           {
 98               if (_cimom_handle)
 99               {
100                   _cimom_handle->update_idle_timer();
101               }
102           }
103           
104           Boolean ProviderStatus::pending_operation()
105           {
106 kumpf 1.1     if (_cimom_handle)
107               {
108                   return _cimom_handle->pending_operation();
109               }
110           
111               return false;
112           }
113           
114           
115           Boolean ProviderStatus::unload_ok()
116           {
117 kumpf 1.2     if (!_isInitialized || _noUnload.get())
118 kumpf 1.1     {
119                   return false;
120               }
121           
122               if (_cimom_handle)
123               {
124                   return _cimom_handle->unload_ok();
125               }
126           
127               return true;
128           }
129           
130           void ProviderStatus::protect()
131           {
132 kumpf 1.2     _noUnload++;
133 kumpf 1.1 }
134           
135           void ProviderStatus::unprotect()
136           {
137 kumpf 1.2     _noUnload--;
138 kumpf 1.1 }
139           
140           Boolean ProviderStatus::testIfZeroAndIncrementSubscriptions()
141           {
142               AutoMutex lock(_currentSubscriptionsMutex);
143               return (_currentSubscriptions++ == 0);
144           }
145           
146           Boolean ProviderStatus::decrementSubscriptionsAndTestIfZero()
147           {
148               AutoMutex lock(_currentSubscriptionsMutex);
149               return (--_currentSubscriptions == 0);
150           }
151           
152           Boolean ProviderStatus::testSubscriptions()
153           {
154               AutoMutex lock(_currentSubscriptionsMutex);
155               return (_currentSubscriptions > 0);
156           }
157           
158           void ProviderStatus::resetSubscriptions()
159 kumpf 1.1 {
160               AutoMutex lock(_currentSubscriptionsMutex);
161               _currentSubscriptions = 0;
162           }
163           
164           void ProviderStatus::setProviderInstance(const CIMInstance& instance)
165           {
166               _providerInstance = instance;
167           }
168           
169           CIMInstance ProviderStatus::getProviderInstance()
170           {
171               return _providerInstance;
172           }
173           
174           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2