1 karl 1.17 //%2006////////////////////////////////////////////////////////////////////////
|
2 kumpf 1.1 //
|
3 karl 1.9 // 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 karl 1.2 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.9 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.10 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.17 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 kumpf 1.1 //
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 karl 1.17 //
|
21 kumpf 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // 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 // Author: Carol Ann Krug Graves, Hewlett-Packard Company
33 // (carolann_graves@hp.com)
34 //
|
35 se.gupta 1.5 // Modified By: Seema Gupta (gseema@in.ibm.com) for PEP135
|
36 a.arora 1.8 // Alagaraja Ramasubramanian (alags_raj@in.ibm.com) for Bug#1090
|
37 kumpf 1.13 // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
38 aruran.ms 1.14 // Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3601
|
39 david.dillard 1.15 // David Dillard, VERITAS Software Corp.
40 // (david.dillard@veritas.com)
|
41 kumpf 1.1 //
42 //%/////////////////////////////////////////////////////////////////////////////
43
44 #include <Pegasus/Common/Tracer.h>
|
45 david.dillard 1.15 #include <Pegasus/Common/OperationContextInternal.h>
|
46 kumpf 1.1 #include "IndicationOperationAggregate.h"
47
48 PEGASUS_USING_STD;
49
50 PEGASUS_NAMESPACE_BEGIN
51
|
52 kumpf 1.13 IndicationOperationAggregate::IndicationOperationAggregate(
53 CIMRequestMessage* origRequest,
54 const Array<CIMName>& indicationSubclasses)
55 : _origRequest(origRequest),
56 _indicationSubclasses(indicationSubclasses),
57 _numberIssued(0),
58 _magicNumber(_theMagicNumber)
|
59 kumpf 1.1 {}
60
|
61 kumpf 1.13 IndicationOperationAggregate::~IndicationOperationAggregate()
|
62 kumpf 1.1 {
63 _magicNumber = 0;
|
64 kumpf 1.18 delete _origRequest;
65
|
66 kumpf 1.13 Uint32 numberRequests = getNumberRequests();
|
67 kumpf 1.1 for (Uint32 i = 0; i < numberRequests; i++)
68 {
69 //
|
70 david.dillard 1.15 // Since deleteRequest also removes the element from the array,
|
71 kumpf 1.1 // delete first element of the array each time
72 //
|
73 carolann.graves 1.16 _deleteRequest (0);
|
74 kumpf 1.1 }
|
75 kumpf 1.13 Uint32 numberResponses = getNumberResponses();
|
76 kumpf 1.1 for (Uint32 j = 0; j < numberResponses; j++)
77 {
78 //
|
79 david.dillard 1.15 // Since deleteResponse also removes the element from the array,
|
80 kumpf 1.1 // delete first element of the array each time
81 //
|
82 carolann.graves 1.16 _deleteResponse (0);
|
83 kumpf 1.1 }
84 }
85
|
86 david.dillard 1.15 Boolean IndicationOperationAggregate::isValid() const
|
87 kumpf 1.1 {
|
88 david.dillard 1.15 return (_magicNumber == _theMagicNumber);
|
89 kumpf 1.1 }
90
|
91 aruran.ms 1.14 CIMRequestMessage* IndicationOperationAggregate::getOrigRequest() const
|
92 kumpf 1.1 {
93 return _origRequest;
94 }
95
|
96 aruran.ms 1.14 Uint32 IndicationOperationAggregate::getOrigType() const
|
97 kumpf 1.1 {
98 if (_origRequest == 0)
99 {
100 return 0;
101 }
102 else
103 {
|
104 kumpf 1.13 return _origRequest->getType();
|
105 kumpf 1.1 }
106 }
107
|
108 aruran.ms 1.14 String IndicationOperationAggregate::getOrigMessageId() const
|
109 kumpf 1.1 {
110 if (_origRequest == 0)
111 {
112 return String::EMPTY;
113 }
114 else
115 {
116 return _origRequest->messageId;
117 }
118 }
119
|
120 aruran.ms 1.14 Uint32 IndicationOperationAggregate::getOrigDest() const
|
121 kumpf 1.1 {
122 if (_origRequest == 0)
123 {
124 return 0;
125 }
126 else
127 {
|
128 kumpf 1.13 return _origRequest->queueIds.top();
|
129 kumpf 1.1 }
130 }
131
|
132 aruran.ms 1.14 Boolean IndicationOperationAggregate::requiresResponse() const
|
133 kumpf 1.1 {
|
134 kumpf 1.13 if ((getOrigType() == CIM_CREATE_INSTANCE_REQUEST_MESSAGE) ||
135 (getOrigType() == CIM_MODIFY_INSTANCE_REQUEST_MESSAGE) ||
136 (getOrigType() == CIM_DELETE_INSTANCE_REQUEST_MESSAGE))
|
137 kumpf 1.1 {
138 return true;
139 }
140 else
141 {
142 return false;
143 }
144 }
145
|
146 kumpf 1.13 Array<CIMName>& IndicationOperationAggregate::getIndicationSubclasses()
|
147 kumpf 1.1 {
148 return _indicationSubclasses;
149 }
150
|
151 kumpf 1.13 void IndicationOperationAggregate::setPath(const CIMObjectPath& path)
|
152 kumpf 1.7 {
153 _path = path;
154 }
155
|
156 kumpf 1.13 const CIMObjectPath& IndicationOperationAggregate::getPath()
|
157 kumpf 1.7 {
158 return _path;
159 }
160
|
161 aruran.ms 1.14 Uint32 IndicationOperationAggregate::getNumberIssued() const
|
162 kumpf 1.1 {
163 return _numberIssued;
164 }
165
|
166 kumpf 1.13 void IndicationOperationAggregate::setNumberIssued(Uint32 i)
|
167 kumpf 1.1 {
168 _numberIssued = i;
169 }
170
|
171 kumpf 1.13 Boolean IndicationOperationAggregate::appendResponse(
172 CIMResponseMessage* response)
|
173 kumpf 1.1 {
|
174 a.arora 1.8 AutoMutex autoMut(_appendResponseMutex);
|
175 kumpf 1.13 _responseList.append(response);
176 Boolean returnValue = (getNumberResponses() == getNumberIssued());
|
177 david.dillard 1.15
|
178 kumpf 1.1 return returnValue;
179 }
180
|
181 aruran.ms 1.14 Uint32 IndicationOperationAggregate::getNumberResponses() const
|
182 kumpf 1.1 {
|
183 kumpf 1.13 return _responseList.size();
|
184 kumpf 1.1 }
185
|
186 aruran.ms 1.14 CIMResponseMessage* IndicationOperationAggregate::getResponse(Uint32 pos) const
|
187 kumpf 1.1 {
|
188 kumpf 1.13 return _responseList[pos];
|
189 kumpf 1.1 }
190
|
191 kumpf 1.13 void IndicationOperationAggregate::appendRequest(
192 CIMRequestMessage* request)
|
193 kumpf 1.1 {
|
194 a.arora 1.8 AutoMutex autoMut(_appendRequestMutex);
|
195 kumpf 1.13 _requestList.append(request);
|
196 kumpf 1.1 }
197
|
198 aruran.ms 1.14 Uint32 IndicationOperationAggregate::getNumberRequests() const
|
199 kumpf 1.1 {
|
200 kumpf 1.13 return _requestList.size();
|
201 kumpf 1.1 }
202
|
203 aruran.ms 1.14 CIMRequestMessage* IndicationOperationAggregate::getRequest(Uint32 pos) const
|
204 kumpf 1.1 {
|
205 kumpf 1.13 return _requestList[pos];
|
206 kumpf 1.1 }
207
|
208 kumpf 1.13 ProviderClassList IndicationOperationAggregate::findProvider(
|
209 aruran.ms 1.14 const String& messageId) const
|
210 kumpf 1.1 {
211 //
|
212 david.dillard 1.15 // Look in the list of requests for the request with the message ID
|
213 kumpf 1.1 // corresponding to the message ID in the response
214 //
215 ProviderClassList provider;
|
216 kumpf 1.13 Uint32 numberRequests = getNumberRequests();
|
217 kumpf 1.1 for (Uint32 i = 0; i < numberRequests; i++)
218 {
|
219 kumpf 1.13 if (getRequest(i)->messageId == messageId )
|
220 kumpf 1.1 {
221 //
222 // Get the provider and provider module from the matching request
223 //
|
224 kumpf 1.13 switch (getRequest(i)->getType())
|
225 kumpf 1.1 {
226 case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
227 {
|
228 kumpf 1.13 CIMCreateSubscriptionRequestMessage* request =
229 (CIMCreateSubscriptionRequestMessage *) getRequest(i);
|
230 carolann.graves 1.12 ProviderIdContainer pidc = request->operationContext.get
|
231 david.dillard 1.15 (ProviderIdContainer::NAME);
|
232 se.gupta 1.5 provider.provider = pidc.getProvider();
233 provider.providerModule = pidc.getModule();
|
234 kumpf 1.4 provider.classList = request->classNames;
|
235 kumpf 1.1 break;
236 }
|
237 david.dillard 1.15
|
238 kumpf 1.1 case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
239 {
|
240 kumpf 1.13 CIMDeleteSubscriptionRequestMessage* request =
241 (CIMDeleteSubscriptionRequestMessage *) getRequest(i);
|
242 carolann.graves 1.12 ProviderIdContainer pidc = request->operationContext.get
|
243 david.dillard 1.15 (ProviderIdContainer::NAME);
|
244 se.gupta 1.5 provider.provider = pidc.getProvider();
245 provider.providerModule = pidc.getModule();
|
246 kumpf 1.4 provider.classList = request->classNames;
|
247 kumpf 1.1 break;
248 }
|
249 david.dillard 1.15
|
250 kumpf 1.1 default:
251 {
|
252 kumpf 1.13 PEG_TRACE_STRING(TRC_INDICATION_SERVICE, Tracer::LEVEL2,
|
253 david.dillard 1.15 "Unexpected request type " + String
|
254 kumpf 1.13 (MessageTypeToString(getRequest(i)->getType())) +
|
255 kumpf 1.1 " in findProvider");
|
256 kumpf 1.13 PEGASUS_ASSERT(false);
|
257 kumpf 1.1 break;
258 }
259 }
260
261 return provider;
262 }
263 }
264
265 //
266 // No request found with message ID matching message ID from response
267 //
|
268 kumpf 1.13 PEGASUS_ASSERT(false);
|
269 kumpf 1.6 return provider;
|
270 kumpf 1.1 }
271
|
272 carolann.graves 1.16 void IndicationOperationAggregate::_deleteRequest (Uint32 pos)
273 {
274 delete _requestList[pos];
275 _requestList.remove(pos);
276 }
277
278 void IndicationOperationAggregate::_deleteResponse (Uint32 pos)
279 {
280 delete _responseList[pos];
281 _responseList.remove(pos);
282 }
283
|
284 kumpf 1.1 const Uint32 IndicationOperationAggregate::_theMagicNumber = 98765;
285
286 PEGASUS_NAMESPACE_END
|