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 //%/////////////////////////////////////////////////////////////////////////////
33
34 #include <Pegasus/Common/Tracer.h>
|
35 david.dillard 1.15 #include <Pegasus/Common/OperationContextInternal.h>
|
36 kumpf 1.1 #include "IndicationOperationAggregate.h"
37
38 PEGASUS_USING_STD;
39
40 PEGASUS_NAMESPACE_BEGIN
41
|
42 kumpf 1.13 IndicationOperationAggregate::IndicationOperationAggregate(
43 CIMRequestMessage* origRequest,
44 const Array<CIMName>& indicationSubclasses)
45 : _origRequest(origRequest),
46 _indicationSubclasses(indicationSubclasses),
|
47 kumpf 1.19 _numberIssued(0)
48 {
49 }
|
50 kumpf 1.1
|
51 kumpf 1.13 IndicationOperationAggregate::~IndicationOperationAggregate()
|
52 kumpf 1.1 {
|
53 kumpf 1.18 delete _origRequest;
54
|
55 kumpf 1.19 Uint32 numberRequests = _requestList.size();
|
56 kumpf 1.1 for (Uint32 i = 0; i < numberRequests; i++)
57 {
|
58 kumpf 1.19 delete _requestList[i];
|
59 kumpf 1.1 }
|
60 kumpf 1.19
61 Uint32 numberResponses = _responseList.size();
|
62 kumpf 1.1 for (Uint32 j = 0; j < numberResponses; j++)
63 {
|
64 kumpf 1.19 delete _responseList[j];
|
65 kumpf 1.1 }
66 }
67
|
68 aruran.ms 1.14 CIMRequestMessage* IndicationOperationAggregate::getOrigRequest() const
|
69 kumpf 1.1 {
70 return _origRequest;
71 }
72
|
73 aruran.ms 1.14 Uint32 IndicationOperationAggregate::getOrigType() const
|
74 kumpf 1.1 {
75 if (_origRequest == 0)
76 {
77 return 0;
78 }
79 else
80 {
|
81 kumpf 1.13 return _origRequest->getType();
|
82 kumpf 1.1 }
83 }
84
|
85 aruran.ms 1.14 Boolean IndicationOperationAggregate::requiresResponse() const
|
86 kumpf 1.1 {
|
87 kumpf 1.13 if ((getOrigType() == CIM_CREATE_INSTANCE_REQUEST_MESSAGE) ||
88 (getOrigType() == CIM_MODIFY_INSTANCE_REQUEST_MESSAGE) ||
89 (getOrigType() == CIM_DELETE_INSTANCE_REQUEST_MESSAGE))
|
90 kumpf 1.1 {
91 return true;
92 }
93 else
94 {
95 return false;
96 }
97 }
98
|
99 kumpf 1.13 Array<CIMName>& IndicationOperationAggregate::getIndicationSubclasses()
|
100 kumpf 1.1 {
101 return _indicationSubclasses;
102 }
103
|
104 aruran.ms 1.14 Uint32 IndicationOperationAggregate::getNumberIssued() const
|
105 kumpf 1.1 {
106 return _numberIssued;
107 }
108
|
109 kumpf 1.13 void IndicationOperationAggregate::setNumberIssued(Uint32 i)
|
110 kumpf 1.1 {
111 _numberIssued = i;
112 }
113
|
114 kumpf 1.13 Boolean IndicationOperationAggregate::appendResponse(
115 CIMResponseMessage* response)
|
116 kumpf 1.1 {
|
117 a.arora 1.8 AutoMutex autoMut(_appendResponseMutex);
|
118 kumpf 1.13 _responseList.append(response);
119 Boolean returnValue = (getNumberResponses() == getNumberIssued());
|
120 david.dillard 1.15
|
121 kumpf 1.1 return returnValue;
122 }
123
|
124 aruran.ms 1.14 Uint32 IndicationOperationAggregate::getNumberResponses() const
|
125 kumpf 1.1 {
|
126 kumpf 1.13 return _responseList.size();
|
127 kumpf 1.1 }
128
|
129 aruran.ms 1.14 CIMResponseMessage* IndicationOperationAggregate::getResponse(Uint32 pos) const
|
130 kumpf 1.1 {
|
131 kumpf 1.13 return _responseList[pos];
|
132 kumpf 1.1 }
133
|
134 kumpf 1.13 void IndicationOperationAggregate::appendRequest(
135 CIMRequestMessage* request)
|
136 kumpf 1.1 {
|
137 a.arora 1.8 AutoMutex autoMut(_appendRequestMutex);
|
138 kumpf 1.13 _requestList.append(request);
|
139 kumpf 1.1 }
140
|
141 aruran.ms 1.14 Uint32 IndicationOperationAggregate::getNumberRequests() const
|
142 kumpf 1.1 {
|
143 kumpf 1.13 return _requestList.size();
|
144 kumpf 1.1 }
145
|
146 aruran.ms 1.14 CIMRequestMessage* IndicationOperationAggregate::getRequest(Uint32 pos) const
|
147 kumpf 1.1 {
|
148 kumpf 1.13 return _requestList[pos];
|
149 kumpf 1.1 }
150
|
151 kumpf 1.13 ProviderClassList IndicationOperationAggregate::findProvider(
|
152 aruran.ms 1.14 const String& messageId) const
|
153 kumpf 1.1 {
154 //
|
155 david.dillard 1.15 // Look in the list of requests for the request with the message ID
|
156 kumpf 1.1 // corresponding to the message ID in the response
157 //
158 ProviderClassList provider;
|
159 kumpf 1.13 Uint32 numberRequests = getNumberRequests();
|
160 kumpf 1.1 for (Uint32 i = 0; i < numberRequests; i++)
161 {
|
162 kumpf 1.13 if (getRequest(i)->messageId == messageId )
|
163 kumpf 1.1 {
164 //
165 // Get the provider and provider module from the matching request
166 //
|
167 kumpf 1.13 switch (getRequest(i)->getType())
|
168 kumpf 1.1 {
169 case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
170 {
|
171 kumpf 1.13 CIMCreateSubscriptionRequestMessage* request =
172 (CIMCreateSubscriptionRequestMessage *) getRequest(i);
|
173 carolann.graves 1.12 ProviderIdContainer pidc = request->operationContext.get
|
174 david.dillard 1.15 (ProviderIdContainer::NAME);
|
175 se.gupta 1.5 provider.provider = pidc.getProvider();
176 provider.providerModule = pidc.getModule();
|
177 kumpf 1.4 provider.classList = request->classNames;
|
178 dave.sudlik 1.20 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
179 provider.isRemoteNameSpace = pidc.isRemoteNameSpace();
180 provider.remoteInfo = pidc.getRemoteInfo();
181 #endif
|
182 kumpf 1.1 break;
183 }
|
184 david.dillard 1.15
|
185 kumpf 1.1 case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
186 {
|
187 kumpf 1.13 CIMDeleteSubscriptionRequestMessage* request =
188 (CIMDeleteSubscriptionRequestMessage *) getRequest(i);
|
189 carolann.graves 1.12 ProviderIdContainer pidc = request->operationContext.get
|
190 david.dillard 1.15 (ProviderIdContainer::NAME);
|
191 se.gupta 1.5 provider.provider = pidc.getProvider();
192 provider.providerModule = pidc.getModule();
|
193 kumpf 1.4 provider.classList = request->classNames;
|
194 dave.sudlik 1.20 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
195 provider.isRemoteNameSpace = pidc.isRemoteNameSpace();
196 provider.remoteInfo = pidc.getRemoteInfo();
197 #endif
|
198 kumpf 1.1 break;
199 }
|
200 david.dillard 1.15
|
201 kumpf 1.1 default:
202 {
|
203 kumpf 1.13 PEG_TRACE_STRING(TRC_INDICATION_SERVICE, Tracer::LEVEL2,
|
204 david.dillard 1.15 "Unexpected request type " + String
|
205 kumpf 1.13 (MessageTypeToString(getRequest(i)->getType())) +
|
206 kumpf 1.1 " in findProvider");
|
207 kumpf 1.13 PEGASUS_ASSERT(false);
|
208 kumpf 1.1 break;
209 }
210 }
211
212 return provider;
213 }
214 }
215
216 //
217 // No request found with message ID matching message ID from response
218 //
|
219 kumpf 1.13 PEGASUS_ASSERT(false);
|
220 kumpf 1.6 return provider;
|
221 kumpf 1.1 }
222
223 PEGASUS_NAMESPACE_END
|