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
|