1 karl 1.100 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 karl 1.88 // 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.72 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.88 // 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.91 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.100 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.2 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 kumpf 1.47 // 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 mike 1.2 // 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.100 //
|
21 kumpf 1.47 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.2 // 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 kumpf 1.47 // 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 mike 1.2 // 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/Config.h>
|
35 kumpf 1.28 #include <Pegasus/Common/Constants.h>
|
36 mike 1.2 #include <cctype>
37 #include <cstdio>
38 #include <Pegasus/Common/XmlParser.h>
39 #include <Pegasus/Common/XmlReader.h>
40 #include <Pegasus/Common/XmlWriter.h>
41 #include <Pegasus/Common/XmlConstants.h>
|
42 kumpf 1.51 #include <Pegasus/Common/System.h>
|
43 mike 1.2 #include <Pegasus/Common/Logger.h>
44 #include <Pegasus/Common/Tracer.h>
|
45 sage 1.41 #include <Pegasus/Common/StatisticalData.h>
|
46 mike 1.2 #include "CIMOperationRequestDecoder.h"
|
47 david 1.60 #include <Pegasus/Common/CommonUTF.h>
|
48 mike 1.2
|
49 humberto 1.59 // l10n
50 #include <Pegasus/Common/MessageLoader.h>
51
|
52 mike 1.2 PEGASUS_USING_STD;
53
54 PEGASUS_NAMESPACE_BEGIN
55
56 CIMOperationRequestDecoder::CIMOperationRequestDecoder(
|
57 mday 1.45 MessageQueueService* outputQueue,
|
58 mday 1.16 Uint32 returnQueueId)
|
59 kumpf 1.36 : Base(PEGASUS_QUEUENAME_OPREQDECODER),
|
60 mday 1.16 _outputQueue(outputQueue),
61 _returnQueueId(returnQueueId),
62 _serverTerminating(false)
|
63 mike 1.2 {
64 }
65
66 CIMOperationRequestDecoder::~CIMOperationRequestDecoder()
67 {
68
69 }
70
71 void CIMOperationRequestDecoder::sendResponse(
|
72 chip 1.92 Uint32 queueId,
|
73 mike 1.96 Buffer& message,
|
74 j.alex 1.95 Boolean closeConnect)
|
75 mike 1.2 {
|
76 mday 1.16 MessageQueue* queue = MessageQueue::lookup(queueId);
|
77 mike 1.2
|
78 mday 1.16 if (queue)
79 {
|
80 a.arora 1.82 AutoPtr<HTTPMessage> httpMessage(new HTTPMessage(message));
|
81 j.alex 1.95 httpMessage->setCloseConnect(closeConnect);
|
82 a.arora 1.82 queue->enqueue(httpMessage.release());
|
83 mday 1.16 }
|
84 mike 1.2 }
85
|
86 kumpf 1.18 void CIMOperationRequestDecoder::sendIMethodError(
|
87 chip 1.92 Uint32 queueId,
|
88 kumpf 1.53 HttpMethod httpMethod,
|
89 mday 1.16 const String& messageId,
|
90 kumpf 1.19 const String& iMethodName,
|
91 j.alex 1.95 const CIMException& cimException,
92 Boolean closeConnect)
|
93 mday 1.16 {
|
94 mike 1.96 Buffer message;
|
95 kumpf 1.19 message = XmlWriter::formatSimpleIMethodErrorRspMessage(
96 iMethodName,
97 messageId,
|
98 kumpf 1.53 httpMethod,
|
99 kumpf 1.35 cimException);
|
100 kumpf 1.18
|
101 j.alex 1.95 sendResponse(queueId, message,closeConnect);
|
102 kumpf 1.18 }
|
103 mday 1.16
|
104 kumpf 1.18 void CIMOperationRequestDecoder::sendMethodError(
|
105 chip 1.92 Uint32 queueId,
|
106 kumpf 1.53 HttpMethod httpMethod,
|
107 kumpf 1.18 const String& messageId,
|
108 kumpf 1.19 const String& methodName,
|
109 j.alex 1.95 const CIMException& cimException,
110 Boolean closeConnect)
|
111 kumpf 1.18 {
|
112 mike 1.96 Buffer message;
|
113 kumpf 1.19 message = XmlWriter::formatSimpleMethodErrorRspMessage(
114 methodName,
115 messageId,
|
116 kumpf 1.53 httpMethod,
|
117 kumpf 1.35 cimException);
|
118 chip 1.92
|
119 j.alex 1.95 sendResponse(queueId, message,closeConnect);
|
120 mike 1.2 }
121
|
122 kumpf 1.33 void CIMOperationRequestDecoder::sendHttpError(
|
123 chip 1.92 Uint32 queueId,
|
124 kumpf 1.33 const String& status,
125 const String& cimError,
|
126 j.alex 1.95 const String& pegasusError,
127 Boolean closeConnect)
|
128 kumpf 1.21 {
|
129 mike 1.96 Buffer message;
|
130 kumpf 1.33 message = XmlWriter::formatHttpErrorRspMessage(
131 status,
132 cimError,
|
133 kumpf 1.37 pegasusError);
|
134 chip 1.92
|
135 j.alex 1.95 sendResponse(queueId, message,closeConnect);
|
136 kumpf 1.26 }
137
|
138 mday 1.16 void CIMOperationRequestDecoder::handleEnqueue(Message *message)
|
139 mike 1.2 {
140
|
141 mday 1.16 if (!message)
142 return;
143
144 switch (message->getType())
145 {
146 case HTTP_MESSAGE:
147 handleHTTPMessage((HTTPMessage*)message);
148 break;
149 }
150
151 delete message;
152 }
|
153 mike 1.2
154
|
155 mday 1.16 void CIMOperationRequestDecoder::handleEnqueue()
156 {
157 Message* message = dequeue();
158 if(message)
159 handleEnqueue(message);
|
160 mike 1.2 }
161
162 //------------------------------------------------------------------------------
163 //
164 // From the HTTP/1.1 Specification (RFC 2626):
165 //
|
166 chip 1.92 // Both types of message consist of a start-line, zero or more header fields
167 // (also known as "headers"), an empty line (i.e., a line with nothing
168 // preceding the CRLF) indicating the end of the header fields, and possibly
|
169 mike 1.2 // a message-body.
170 //
171 // Example CIM request:
172 //
|
173 chip 1.92 // M-POST /cimom HTTP/1.1
174 // HOST: www.erewhon.com
175 // Content-Type: application/xml; charset="utf-8"
176 // Content-Length: xxxx
177 // Man: http://www.dmtf.org/cim/operation ; ns=73
178 // 73-CIMOperation: MethodCall
179 // 73-CIMMethod: EnumerateInstances
180 // 73-CIMObject: root/cimv2
181 //
|
182 mike 1.2 //------------------------------------------------------------------------------
183
184 void CIMOperationRequestDecoder::handleHTTPMessage(HTTPMessage* httpMessage)
185 {
|
186 kumpf 1.20 PEG_METHOD_ENTER(TRC_DISPATCHER,
187 "CIMOperationRequestDecoder::handleHTTPMessage()");
188
|
189 humberto 1.80 // l10n
190 // Set the Accept-Language into the thread for this service.
191 // This will allow all code in this thread to get
192 // the languages for the messages returned to the client.
|
193 kumpf 1.99 Thread::setLanguages(new AcceptLanguageList(httpMessage->acceptLanguages));
|
194 humberto 1.80
195
|
196 mday 1.16 // Save queueId:
|
197 mike 1.2
|
198 mday 1.16 Uint32 queueId = httpMessage->queueId;
|
199 mike 1.2
|
200 mday 1.16 // Save userName and authType:
|
201 mike 1.2
|
202 mday 1.16 String userName;
203 String authType = String::EMPTY;
|
204 j.alex 1.95 Boolean closeConnect = httpMessage->getCloseConnect();
|
205 mike 1.98
206 PEG_TRACE((
|
207 j.alex 1.95 TRC_HTTP,
208 Tracer::LEVEL3,
|
209 mike 1.98 "CIMOperationRequestDecoder::handleHTTPMessage()- "
210 "httpMessage->getCloseConnect() returned %d",
211 closeConnect));
|
212 mike 1.2
|
213 mday 1.16 if ( httpMessage->authInfo->isAuthenticated() )
214 {
215 userName = httpMessage->authInfo->getAuthenticatedUser();
216 authType = httpMessage->authInfo->getAuthType();
217 }
|
218 mike 1.2
|
219 mday 1.16 // Parse the HTTP message:
|
220 mike 1.2
|
221 mday 1.16 String startLine;
222 Array<HTTPHeader> headers;
|
223 david.dillard 1.90 char* content;
|
224 mday 1.16 Uint32 contentLength;
|
225 mike 1.2
|
226 mday 1.16 httpMessage->parse(startLine, headers, contentLength);
|
227 mike 1.2
|
228 mday 1.16 // Parse the request line:
|
229 mike 1.2
|
230 mday 1.16 String methodName;
231 String requestUri;
232 String httpVersion;
|
233 kumpf 1.53 HttpMethod httpMethod = HTTP_METHOD__POST;
|
234 mike 1.2
|
235 mday 1.16 Tracer::trace(TRC_XML_IO, Tracer::LEVEL2, "%s",
236 httpMessage->message.getData());
|
237 mike 1.2
|
238 mday 1.16 HTTPMessage::parseRequestLine(
239 startLine, methodName, requestUri, httpVersion);
|
240 mike 1.2
|
241 kumpf 1.53 //
242 // Set HTTP method for the request
243 //
244 if (methodName == "M-POST")
245 {
246 httpMethod = HTTP_METHOD_M_POST;
247 }
248
|
249 kumpf 1.30 // Unsupported methods are caught in the HTTPAuthenticatorDelegator
250 PEGASUS_ASSERT(methodName == "M-POST" || methodName == "POST");
251
|
252 kumpf 1.53 //
253 // Mismatch of method and version is caught in HTTPAuthenticatorDelegator
254 //
|
255 chip 1.92 PEGASUS_ASSERT (!((httpMethod == HTTP_METHOD_M_POST) &&
|
256 kumpf 1.53 (httpVersion == "HTTP/1.0")));
257
|
258 mday 1.16 // Process M-POST and POST messages:
|
259 mike 1.2
|
260 david 1.60 String cimContentType;
|
261 kumpf 1.30 String cimOperation;
262 String cimBatch;
263 Boolean cimBatchFlag;
264 String cimProtocolVersion;
265 String cimMethod;
266 String cimObject;
|
267 david 1.60
|
268 kumpf 1.94 if (httpVersion == "HTTP/1.1")
269 {
270 // Validate the presence of a "Host" header. The HTTP/1.1 specification
271 // says this in section 14.23 regarding the Host header field:
272 //
273 // All Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad
274 // Request) status code to any HTTP/1.1 request message which lacks
275 // a Host header field.
276 //
277 // Note: The Host header value is not validated.
278
279 String hostHeader;
280 Boolean hostHeaderFound = HTTPMessage::lookupHeader(
281 headers, "Host", hostHeader, false);
282
283 if (!hostHeaderFound)
284 {
285 MessageLoaderParms parms(
286 "Server.CIMOperationRequestDecoder.MISSING_HOST_HEADER",
287 "HTTP request message lacks a Host header field.");
|
288 j.alex 1.95 sendHttpError(
289 queueId,
290 HTTP_STATUS_BADREQUEST,
291 "",
292 MessageLoader::getMessage(parms),
293 closeConnect);
|
294 kumpf 1.94 PEG_METHOD_EXIT();
295 return;
296 }
297 }
298
|
299 kumpf 1.30 // Validate the "CIMOperation" header:
300
301 Boolean operationHeaderFound = HTTPMessage::lookupHeader(
|
302 kumpf 1.40 headers, "CIMOperation", cimOperation, true);
|
303 kumpf 1.30 // If the CIMOperation header was missing, the HTTPAuthenticatorDelegator
304 // would not have passed the message to us.
305 PEGASUS_ASSERT(operationHeaderFound);
|
306 mike 1.2
|
307 kumpf 1.30 if (!String::equalNoCase(cimOperation, "MethodCall"))
|
308 mday 1.16 {
|
309 kumpf 1.30 // The Specification for CIM Operations over HTTP reads:
310 // 3.3.4. CIMOperation
311 // If a CIM Server receives CIM Operation request with this
312 // [CIMOperation] header, but with a missing value or a value
313 // that is not "MethodCall", then it MUST fail the request with
314 // status "400 Bad Request". The CIM Server MUST include a
315 // CIMError header in the response with a value of
316 // unsupported-operation.
|
317 humberto 1.66 //l10n
318 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "unsupported-operation",
319 // String("CIMOperation value \"") + cimOperation +
320 //"\" is not supported.");
|
321 j.alex 1.95 MessageLoaderParms parms(
322 "Server.CIMOperationRequestDecoder.CIMOPERATION_VALUE_NOT_SUPPORTED",
323 "CIMOperation value \"$0\" is not supported.",cimOperation);
324 sendHttpError(
325 queueId,
326 HTTP_STATUS_BADREQUEST,
327 "unsupported-operation",
328 MessageLoader::getMessage(parms),
329 closeConnect);
|
330 kumpf 1.30 PEG_METHOD_EXIT();
331 return;
332 }
|
333 kumpf 1.26
|
334 kumpf 1.30 // Validate the "CIMBatch" header:
|
335 mike 1.2
|
336 kumpf 1.30 cimBatchFlag = HTTPMessage::lookupHeader(
|
337 kumpf 1.40 headers, "CIMBatch", cimBatch, true);
|
338 kumpf 1.30 if (cimBatchFlag)
339 {
340 // The Specification for CIM Operations over HTTP reads:
341 // 3.3.9. CIMBatch
342 // If a CIM Server receives CIM Operation Request for which the
343 // CIMBatch header is present, but the Server does not support
344 // Multiple Operations, then it MUST fail the request and
345 // return a status of "501 Not Implemented".
|
346 j.alex 1.95 sendHttpError(
347 queueId,
348 HTTP_STATUS_NOTIMPLEMENTED,
349 "multiple-requests-unsupported",
350 String::EMPTY,
351 closeConnect);
|
352 kumpf 1.30 PEG_METHOD_EXIT();
353 return;
354 }
|
355 kumpf 1.21
|
356 kumpf 1.30 // Save these headers for later checking
|
357 mike 1.2
|
358 kumpf 1.30 if (!HTTPMessage::lookupHeader(
|
359 kumpf 1.40 headers, "CIMProtocolVersion", cimProtocolVersion, true))
|
360 kumpf 1.30 {
361 // Mandated by the Specification for CIM Operations over HTTP
362 cimProtocolVersion.assign("1.0");
363 }
|
364 kumpf 1.26
|
365 kumpf 1.40 if (HTTPMessage::lookupHeader(headers, "CIMMethod", cimMethod, true))
|
366 kumpf 1.30 {
367 if (cimMethod == String::EMPTY)
|
368 kumpf 1.26 {
|
369 kumpf 1.30 // This is not a valid value, and we use EMPTY to mean "absent"
|
370 humberto 1.66 //l10n
371 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
372 //"Empty CIMMethod value.");
|
373 j.alex 1.95 MessageLoaderParms parms(
374 "Server.CIMOperationRequestDecoder.EMPTY_CIMMETHOD_VALUE",
375 "Empty CIMMethod value.");
376 sendHttpError(
377 queueId,
378 HTTP_STATUS_BADREQUEST,
379 "header-mismatch",
380 MessageLoader::getMessage(parms),
381 closeConnect);
|
382 kumpf 1.26 PEG_METHOD_EXIT();
383 return;
384 }
|
385 kumpf 1.56
386 try
387 {
388 cimMethod = XmlReader::decodeURICharacters(cimMethod);
389 }
|
390 david.dillard 1.86 catch (const ParseError&)
|
391 kumpf 1.56 {
392 // The CIMMethod header value could not be decoded
|
393 humberto 1.66 //l10n
394 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
395 //"CIMMethod value syntax error.");
|
396 j.alex 1.95 MessageLoaderParms parms(
397 "Server.CIMOperationRequestDecoder.CIMMETHOD_VALUE_SYNTAX_ERROR",
398 "CIMMethod value syntax error.");
399 sendHttpError(
400 queueId,
401 HTTP_STATUS_BADREQUEST,
402 "header-mismatch",
403 MessageLoader::getMessage(parms),
404 closeConnect);
|
405 kumpf 1.56 PEG_METHOD_EXIT();
406 return;
407 }
|
408 kumpf 1.30 }
|
409 kumpf 1.56
|
410 kumpf 1.40 if (HTTPMessage::lookupHeader(headers, "CIMObject", cimObject, true))
|
411 kumpf 1.30 {
412 if (cimObject == String::EMPTY)
|
413 kumpf 1.27 {
|
414 kumpf 1.30 // This is not a valid value, and we use EMPTY to mean "absent"
|
415 humberto 1.66 //l10n
416 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
|
417 j.alex 1.95 //"Empty CIMObject value.");
418 MessageLoaderParms parms(
419 "Server.CIMOperationRequestDecoder.EMPTY_CIMOBJECT_VALUE",
420 "Empty CIMObject value.");
421 sendHttpError(
422 queueId,
423 HTTP_STATUS_BADREQUEST,
424 "header-mismatch",
425 MessageLoader::getMessage(parms),
426 closeConnect);
|
427 kumpf 1.56 PEG_METHOD_EXIT();
428 return;
429 }
430
431 try
432 {
433 cimObject = XmlReader::decodeURICharacters(cimObject);
434 }
|
435 david.dillard 1.86 catch (const ParseError&)
|
436 kumpf 1.56 {
437 // The CIMObject header value could not be decoded
|
438 humberto 1.66 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
439 //"CIMObject value syntax error.");
|
440 j.alex 1.95 MessageLoaderParms parms(
441 "Server.CIMOperationRequestDecoder.CIMOBJECT_VALUE_SYNTAX_ERROR",
442 "CIMObject value syntax error.");
443 sendHttpError(
444 queueId,
445 HTTP_STATUS_BADREQUEST,
446 "header-mismatch",
447 MessageLoader::getMessage(parms),
448 closeConnect);
|
449 kumpf 1.30 PEG_METHOD_EXIT();
450 return;
|
451 kumpf 1.27 }
|
452 kumpf 1.30 }
|
453 chip 1.92
|
454 kumpf 1.30 // Zero-terminate the message:
|
455 mike 1.2
|
456 kumpf 1.30 httpMessage->message.append('\0');
|
457 mike 1.2
|
458 kumpf 1.30 // Calculate the beginning of the content from the message size and
459 // the content length. Subtract 1 to take into account the null
460 // character we just added to the end of the message.
|
461 mike 1.2
|
462 david.dillard 1.90 content = (char *) httpMessage->message.getData() +
|
463 kumpf 1.30 httpMessage->message.size() - contentLength - 1;
|
464 chuck 1.75
465 // Validate the "Content-Type" header:
466
467 Boolean contentTypeHeaderFound = HTTPMessage::lookupHeader(headers,
468 "Content-Type",
469 cimContentType,
470 true);
471
|
472 carolann.graves 1.102 if (!contentTypeHeaderFound ||
473 !(String::equalNoCase(
474 cimContentType, "application/xml; charset=\"utf-8\"") ||
475 String::equalNoCase(
476 cimContentType, "text/xml; charset=\"utf-8\"")))
|
477 chuck 1.75 {
478 //l10n
479 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
480 //"CIMContentType value syntax error.");
|
481 j.alex 1.95 MessageLoaderParms parms(
482 "Server.CIMOperationRequestDecoder.CIMCONTENTTYPE_SYNTAX_ERROR",
483 "CIMContentType value syntax error.");
484 sendHttpError(
485 queueId,
486 HTTP_STATUS_BADREQUEST,
487 "header-mismatch",
488 MessageLoader::getMessage(parms),
489 closeConnect);
|
490 chuck 1.75 PEG_METHOD_EXIT();
|
491 chip 1.92 return;
|
492 chuck 1.75 }
493 // Validating content falls within UTF8
494 // (required to be complaint with section C12 of Unicode 4.0 spec, chapter 3.)
495 else
496 {
497 Uint32 count = 0;
498 while(count<contentLength)
499 {
|
500 david 1.77 if (!(isUTF8((char *)&content[count])))
|
501 chuck 1.75 {
502 //l10n
503 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "request-not-valid",
504 //"Invalid UTF-8 character detected.");
|
505 j.alex 1.95 MessageLoaderParms parms(
506 "Server.CIMOperationRequestDecoder.INVALID_UTF8_CHARACTER",
507 "Invalid UTF-8 character detected.");
508 sendHttpError(
509 queueId,
510 HTTP_STATUS_BADREQUEST,
511 "request-not-valid",
512 MessageLoader::getMessage(parms),
513 closeConnect);
|
514 chip 1.92
|
515 chuck 1.75 PEG_METHOD_EXIT();
|
516 chip 1.92 return;
|
517 chuck 1.75 }
|
518 chuck 1.76 UTF8_NEXT(content,count);
|
519 chuck 1.75 }
520 }
|
521 mike 1.2
|
522 kumpf 1.30 // If it is a method call, then dispatch it to be handled:
|
523 mike 1.2
|
524 chuck 1.58 // l10n
|
525 j.alex 1.95 handleMethodCall(
526 queueId,
527 httpMethod,
528 content,
529 contentLength,
530 cimProtocolVersion,
531 cimMethod,
532 cimObject,
533 authType,
534 userName,
|
535 kumpf 1.103 httpMessage->ipAddress,
|
536 j.alex 1.95 httpMessage->acceptLanguages,
537 httpMessage->contentLanguages,
538 closeConnect);
|
539 chip 1.92
|
540 kumpf 1.20 PEG_METHOD_EXIT();
|
541 mike 1.2 }
542
543
544 void CIMOperationRequestDecoder::handleMethodCall(
|
545 mday 1.16 Uint32 queueId,
|
546 kumpf 1.53 HttpMethod httpMethod,
|
547 david.dillard 1.90 char* content,
|
548 sage 1.41 Uint32 contentLength, // used for statistics only
|
549 kumpf 1.27 const String& cimProtocolVersionInHeader,
|
550 kumpf 1.22 const String& cimMethodInHeader,
551 const String& cimObjectInHeader,
|
552 kumpf 1.103 const String& authType,
553 const String& userName,
554 const String& ipAddress,
|
555 kumpf 1.99 const AcceptLanguageList& httpAcceptLanguages,
556 const ContentLanguageList& httpContentLanguages,
|
557 j.alex 1.95 Boolean closeConnect)
|
558 mday 1.16 {
|
559 kumpf 1.20 PEG_METHOD_ENTER(TRC_DISPATCHER,
560 "CIMOperationRequestDecoder::handleMethodCall()");
|
561 chuck 1.58
|
562 kumpf 1.34 //
563 // If CIMOM is shutting down, return "Service Unavailable" response
564 //
565 if (_serverTerminating)
566 {
|
567 humberto 1.66 //l10n
568 //sendHttpError(queueId, HTTP_STATUS_SERVICEUNAVAILABLE,
569 //String::EMPTY,
570 //"CIM Server is shutting down.");
|
571 j.alex 1.95 MessageLoaderParms parms(
572 "Server.CIMOperationRequestDecoder.CIMSERVER_SHUTTING_DOWN",
573 "CIM Server is shutting down.");
574 sendHttpError(
575 queueId,
576 HTTP_STATUS_SERVICEUNAVAILABLE,
577 String::EMPTY,
578 MessageLoader::getMessage(parms),
579 closeConnect);
|
580 kumpf 1.34 PEG_METHOD_EXIT();
581 return;
582 }
583
|
584 mike 1.98 PEG_LOGGER_TRACE((Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
585 "CIMOperationRequestdecoder - XML content: $0", content));
586
|
587 mday 1.16 // Create a parser:
588
589 XmlParser parser(content);
590 XmlEntry entry;
591 String messageId;
592 const char* cimMethodName = "";
|
593 kumpf 1.101 AutoPtr<CIMOperationRequestMessage> request;
|
594 mday 1.16
595 try
596 {
|
597 kumpf 1.32 //
598 // Process <?xml ... >
599 //
|
600 mday 1.16
|
601 kumpf 1.34 // These values are currently unused
|
602 kumpf 1.32 const char* xmlVersion = 0;
603 const char* xmlEncoding = 0;
604
605 XmlReader::getXmlDeclaration(parser, xmlVersion, xmlEncoding);
|
606 mday 1.16
607 // Expect <CIM ...>
608
|
609 kumpf 1.27 const char* cimVersion = 0;
610 const char* dtdVersion = 0;
611
612 XmlReader::getCimStartTag(parser, cimVersion, dtdVersion);
613
614 if (strcmp(cimVersion, "2.0") != 0)
615 {
|
616 humberto 1.66 //l10n
617 //sendHttpError(queueId,
618 // HTTP_STATUS_NOTIMPLEMENTED,
619 // "unsupported-cim-version",
620 //String("CIM version \"") + cimVersion +
621 // "\" is not supported.");
|
622 j.alex 1.95 MessageLoaderParms parms(
623 "Server.CIMOperationRequestDecoder.CIM_VERSION_NOT_SUPPORTED",
624 "CIM version \"$0\" is not supported.",
625 cimVersion);
626 sendHttpError(
627 queueId,
628 HTTP_STATUS_NOTIMPLEMENTED,
629 "unsupported-cim-version",
630 MessageLoader::getMessage(parms),
631 closeConnect);
|
632 kumpf 1.27 PEG_METHOD_EXIT();
633 return;
634 }
635
|
636 kumpf 1.87 // We accept DTD version 2.x (see Bugzilla 1556)
637
638 Boolean dtdVersionAccepted = false;
639
640 if ((dtdVersion[0] == '2') &&
641 (dtdVersion[1] == '.') &&
642 (dtdVersion[2] != 0))
643 {
644 // Verify that all characters after the '.' are digits
645 Uint32 index = 2;
646 while (isdigit(dtdVersion[index]))
647 {
648 index++;
649 }
650
651 if (dtdVersion[index] == 0)
652 {
653 dtdVersionAccepted = true;
654 }
655 }
656
657 kumpf 1.87 if (!dtdVersionAccepted)
|
658 kumpf 1.27 {
|
659 humberto 1.66 //l10n
660 //sendHttpError(queueId,
661 //HTTP_STATUS_NOTIMPLEMENTED,
662 //"unsupported-dtd-version",
663 //String("DTD version \"") + dtdVersion +
664 //"\" is not supported.");
|
665 j.alex 1.95 MessageLoaderParms parms(
666 "Server.CIMOperationRequestDecoder.DTD_VERSION_NOT_SUPPORTED",
667 "DTD version \"$0\" is not supported.",
668 dtdVersion);
669 sendHttpError(
670 queueId,
671 HTTP_STATUS_NOTIMPLEMENTED,
672 "unsupported-dtd-version",
673 MessageLoader::getMessage(parms),
674 closeConnect);
|
675 kumpf 1.27 PEG_METHOD_EXIT();
676 return;
677 }
|
678 mday 1.16
679 // Expect <MESSAGE ...>
680
|
681 kumpf 1.27 String protocolVersion;
|
682 mday 1.16
683 if (!XmlReader::getMessageStartTag(
684 parser, messageId, protocolVersion))
685 {
|
686 humberto 1.59
687 // l10n
688
689 // throw XmlValidationError(
690 // parser.getLine(), "expected MESSAGE element");
691
|
692 humberto 1.67 MessageLoaderParms mlParms("Server.CIMOperationRequestDecoder.EXPECTED_MESSAGE_ELEMENT",
693 "expected MESSAGE element");
|
694 humberto 1.59
695 throw XmlValidationError(parser.getLine(), mlParms);
|
696 chip 1.92
697
|
698 mday 1.16 }
699
|
700 kumpf 1.27 // Validate that the protocol version in the header matches the XML
701
702 if (!String::equalNoCase(protocolVersion, cimProtocolVersionInHeader))
|
703 mday 1.16 {
|
704 humberto 1.66 //l10n
705 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
706 //String("CIMProtocolVersion value \"") +
707 //cimProtocolVersionInHeader + "\" does not " +
708 // "match CIM request protocol version \"" +
709 //protocolVersion + "\".");
|
710 j.alex 1.95 MessageLoaderParms parms(
711 "Server.CIMOperationRequestDecoder.CIMPROTOCOL_VERSION_MISMATCH",
712 "CIMProtocolVersion value \"$0\" does not match CIM request protocol version \"$1\".",
713 cimProtocolVersionInHeader,
714 protocolVersion);
715 sendHttpError(
716 queueId,
717 HTTP_STATUS_BADREQUEST,
718 "header-mismatch",
719 MessageLoader::getMessage(parms),
720 closeConnect);
|
721 kumpf 1.27 PEG_METHOD_EXIT();
722 return;
723 }
724
|
725 kumpf 1.87 // We accept protocol version 1.x (see Bugzilla 1556)
726
727 Boolean protocolVersionAccepted = false;
728
729 if ((protocolVersion.size() >= 3) &&
730 (protocolVersion[0] == '1') &&
731 (protocolVersion[1] == '.'))
732 {
733 // Verify that all characters after the '.' are digits
734 Uint32 index = 2;
735 while ((index < protocolVersion.size()) &&
736 (protocolVersion[index] >= '0') &&
737 (protocolVersion[index] <= '9'))
738 {
739 index++;
740 }
741
742 if (index == protocolVersion.size())
743 {
744 protocolVersionAccepted = true;
745 }
746 kumpf 1.87 }
|
747 kumpf 1.27
|
748 kumpf 1.87 if (!protocolVersionAccepted)
|
749 kumpf 1.27 {
750 // See Specification for CIM Operations over HTTP section 4.3
|
751 humberto 1.66 //l10n
752 //sendHttpError(queueId,
753 //HTTP_STATUS_NOTIMPLEMENTED,
754 //"unsupported-protocol-version",
755 //String("CIMProtocolVersion \"") + protocolVersion +
756 //"\" is not supported.");
|
757 j.alex 1.95 MessageLoaderParms parms(
758 "Server.CIMOperationRequestDecoder.CIMPROTOCOL_VERSION_NOT_SUPPORTED",
759 "CIMProtocolVersion \"$0\" is not supported.",
760 protocolVersion);
761 sendHttpError(
762 queueId,
763 HTTP_STATUS_NOTIMPLEMENTED,
764 "unsupported-protocol-version",
765 MessageLoader::getMessage(parms),
766 closeConnect);
|
767 kumpf 1.27 PEG_METHOD_EXIT();
768 return;
|
769 mday 1.16 }
770
|
771 kumpf 1.23 if (XmlReader::testStartTag(parser, entry, "MULTIREQ"))
772 {
|
773 kumpf 1.27 // We wouldn't have gotten here if CIMBatch header was specified,
774 // so this must be indicative of a header mismatch
|
775 humberto 1.66 //l10n
776 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
777 //"Multi-request is missing CIMBatch HTTP header");
|
778 j.alex 1.95 MessageLoaderParms parms(
779 "Server.CIMOperationRequestDecoder.MULTI_REQUEST_MISSING_CIMBATCH_HTTP_HEADER",
780 "Multi-request is missing CIMBatch HTTP header");
781 sendHttpError(
782 queueId,
783 HTTP_STATUS_BADREQUEST,
784 "header-mismatch",
785 MessageLoader::getMessage(parms),
786 closeConnect);
|
787 kumpf 1.27 PEG_METHOD_EXIT();
788 return;
|
789 kumpf 1.23 // Future: When MULTIREQ is supported, must ensure CIMMethod and
|
790 kumpf 1.26 // CIMObject headers are absent, and CIMBatch header is present.
|
791 kumpf 1.23 }
792
|
793 mday 1.16 // Expect <SIMPLEREQ ...>
794
795 XmlReader::expectStartTag(parser, entry, "SIMPLEREQ");
796
|
797 kumpf 1.34 // Check for <IMETHODCALL ...>
|
798 mday 1.16
799 if (XmlReader::getIMethodCallStartTag(parser, cimMethodName))
800 {
|
801 kumpf 1.26 // The Specification for CIM Operations over HTTP reads:
|
802 kumpf 1.23 // 3.3.6. CIMMethod
803 //
804 // This header MUST be present in any CIM Operation Request
|
805 chip 1.92 // message that contains a Simple Operation Request.
|
806 kumpf 1.23 //
807 // It MUST NOT be present in any CIM Operation Response message,
808 // nor in any CIM Operation Request message that is not a
809 // Simple Operation Request.
810 //
811 // The name of the CIM method within a Simple Operation Request
812 // is defined to be the value of the NAME attribute of the
813 // <METHODCALL> or <IMETHODCALL> element.
814 //
815 // If a CIM Server receives a CIM Operation Request for which
816 // either:
817 //
818 // - The CIMMethod header is present but has an invalid value, or;
819 // - The CIMMethod header is not present but the Operation
|
820 chip 1.92 // Request Message is a Simple Operation Request, or;
|
821 kumpf 1.23 // - The CIMMethod header is present but the Operation Request
|
822 chip 1.92 // Message is not a Simple Operation Request, or;
|
823 kumpf 1.23 // - The CIMMethod header is present, the Operation Request
824 // Message is a Simple Operation Request, but the CIMIdentifier
825 // value (when unencoded) does not match the unique method name
826 // within the Simple Operation Request,
827 //
828 // then it MUST fail the request and return a status of
829 // "400 Bad Request" (and MUST include a CIMError header in the
830 // response with a value of header-mismatch), subject to the
831 // considerations specified in Errors.
|
832 kumpf 1.27 if (!String::equalNoCase(cimMethodName, cimMethodInHeader))
|
833 kumpf 1.23 {
834 // ATTN-RK-P3-20020304: How to decode cimMethodInHeader?
|
835 kumpf 1.39 if (cimMethodInHeader == String::EMPTY)
836 {
|
837 humberto 1.66 //l10n
838 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
839 //"Missing CIMMethod HTTP header.");
|
840 j.alex 1.95 MessageLoaderParms parms(
841 "Server.CIMOperationRequestDecoder.MISSING_CIMMETHOD_HTTP_HEADER",
842 "Missing CIMMethod HTTP header.");
843 sendHttpError(
844 queueId,
845 HTTP_STATUS_BADREQUEST,
846 "header-mismatch",
847 MessageLoader::getMessage(parms),
848 closeConnect);
|
849 kumpf 1.39 }
850 else
851 {
|
852 humberto 1.66 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
853 //String("CIMMethod value \"") + cimMethodInHeader +
854 //"\" does not match CIM request method \"" +
855 //cimMethodName + "\".");
|
856 j.alex 1.95 MessageLoaderParms parms(
857 "Server.CIMOperationRequestDecoder.CIMMETHOD_VALUE_DOES_NOT_MATCH_REQUEST_METHOD",
858 "CIMMethod value \"$0\" does not match CIM request method \"$1\".",
859 cimMethodInHeader,
860 cimMethodName);
861 sendHttpError(
862 queueId,
863 HTTP_STATUS_BADREQUEST,
864 "header-mismatch",
865 MessageLoader::getMessage(parms),
866 closeConnect);
|
867 kumpf 1.39 }
|
868 kumpf 1.23 PEG_METHOD_EXIT();
869 return;
870 }
871
|
872 mday 1.16 // Expect <LOCALNAMESPACEPATH ...>
873
874 String nameSpace;
875
876 if (!XmlReader::getLocalNameSpacePathElement(parser, nameSpace))
877 {
|
878 humberto 1.59
879 // l10n
880
|
881 chip 1.92 // throw XmlValidationError(parser.getLine(),
|
882 humberto 1.59 // "expected LOCALNAMESPACEPATH element");
883
|
884 humberto 1.67 MessageLoaderParms mlParms("Server.CIMOperationRequestDecoder.EXPECTED_LOCALNAMESPACEPATH_ELEMENT",
885 "expected LOCALNAMESPACEPATH element");
|
886 humberto 1.59
887 throw XmlValidationError(parser.getLine(),mlParms);
|
888 chip 1.92
889
|
890 mday 1.16 }
891
|
892 kumpf 1.26 // The Specification for CIM Operations over HTTP reads:
|
893 kumpf 1.23 // 3.3.7. CIMObject
894 //
895 // This header MUST be present in any CIM Operation Request
|
896 chip 1.92 // message that contains a Simple Operation Request.
|
897 kumpf 1.23 //
898 // It MUST NOT be present in any CIM Operation Response message,
899 // nor in any CIM Operation Request message that is not a
900 // Simple Operation Request.
901 //
902 // The header identifies the CIM object (which MUST be a Class
903 // or Instance for an extrinsic method, or a Namespace for an
904 // intrinsic method) on which the method is to be invoked, using
905 // a CIM object path encoded in an HTTP-safe representation.
906 //
907 // If a CIM Server receives a CIM Operation Request for which
908 // either:
909 //
910 // - The CIMObject header is present but has an invalid value, or;
911 // - The CIMObject header is not present but the Operation
|
912 chip 1.92 // Request Message is a Simple Operation Request, or;
|
913 kumpf 1.23 // - The CIMObject header is present but the Operation Request
|
914 chip 1.92 // Message is not a Simple Operation Request, or;
|
915 kumpf 1.23 // - The CIMObject header is present, the Operation Request
916 // Message is a Simple Operation Request, but the ObjectPath
917 // value does not match (where match is defined in the section
918 // section on Encoding CIM Object Paths) the Operation Request
919 // Message,
920 //
921 // then it MUST fail the request and return a status of
922 // "400 Bad Request" (and MUST include a CIMError header in the
923 // response with a value of header-mismatch), subject to the
924 // considerations specified in Errors.
925 if (!String::equalNoCase(nameSpace, cimObjectInHeader))
926 {
|
927 kumpf 1.39 if (cimObjectInHeader == String::EMPTY)
928 {
|
929 humberto 1.66 //l10n
930 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
931 //"Missing CIMObject HTTP header.");
|
932 j.alex 1.95 MessageLoaderParms parms(
933 "Server.CIMOperationRequestDecoder.MISSING_CIMOBJECT_HTTP_HEADER",
934 "Missing CIMObject HTTP header.");
935 sendHttpError(
936 queueId,
937 HTTP_STATUS_BADREQUEST,
938 "header-mismatch",
939 MessageLoader::getMessage(parms),
940 closeConnect);
|
941 kumpf 1.39 }
942 else
943 {
|
944 humberto 1.66 //l10n
945 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
946 //String("CIMObject value \"") + cimObjectInHeader +
947 //"\" does not match CIM request object \"" +
948 //nameSpace + "\".");
|
949 j.alex 1.95 MessageLoaderParms parms(
950 "Server.CIMOperationRequestDecoder.CIMOBJECT_VALUE_DOES_NOT_MATCH_REQUEST_OBJECT:",
951 "CIMObject value \"$0\" does not match CIM request object \"$1\".",
952 cimObjectInHeader,
953 nameSpace);
954 sendHttpError(
955 queueId,
956 HTTP_STATUS_BADREQUEST,
957 "header-mismatch",
958 MessageLoader::getMessage(parms),
959 closeConnect);
|
960 kumpf 1.39 }
|
961 kumpf 1.23 PEG_METHOD_EXIT();
962 return;
963 }
964
|
965 kumpf 1.34 // This try block only catches CIMExceptions, because they must be
966 // responded to with a proper IMETHODRESPONSE. Other exceptions are
967 // caught in the outer try block.
968 try
969 {
970 // Delegate to appropriate method to handle:
|
971 mday 1.16
|
972 kumpf 1.51 if (System::strcasecmp(cimMethodName, "GetClass") == 0)
|
973 sushma.fernandes 1.89 request.reset(decodeGetClassRequest(
|
974 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
975 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "GetInstance") == 0)
|
976 sushma.fernandes 1.89 request.reset(decodeGetInstanceRequest(
|
977 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
978 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "EnumerateClassNames") == 0)
|
979 sushma.fernandes 1.89 request.reset(decodeEnumerateClassNamesRequest(
|
980 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
981 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "References") == 0)
|
982 sushma.fernandes 1.89 request.reset(decodeReferencesRequest(
|
983 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
984 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "ReferenceNames") == 0)
|
985 sushma.fernandes 1.89 request.reset(decodeReferenceNamesRequest(
|
986 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
987 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "AssociatorNames") == 0)
|
988 sushma.fernandes 1.89 request.reset(decodeAssociatorNamesRequest(
|
989 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
990 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "Associators") == 0)
|
991 sushma.fernandes 1.89 request.reset(decodeAssociatorsRequest(
|
992 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
993 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "CreateInstance") == 0)
|
994 sushma.fernandes 1.89 request.reset(decodeCreateInstanceRequest(
|
995 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
996 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "EnumerateInstanceNames")==0)
|
997 sushma.fernandes 1.89 request.reset(decodeEnumerateInstanceNamesRequest(
|
998 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
999 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "DeleteQualifier") == 0)
|
1000 sushma.fernandes 1.89 request.reset(decodeDeleteQualifierRequest(
|
1001 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1002 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "GetQualifier") == 0)
|
1003 sushma.fernandes 1.89 request.reset(decodeGetQualifierRequest(
|
1004 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1005 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "SetQualifier") == 0)
|
1006 sushma.fernandes 1.89 request.reset(decodeSetQualifierRequest(
|
1007 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1008 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "EnumerateQualifiers") == 0)
|
1009 sushma.fernandes 1.89 request.reset(decodeEnumerateQualifiersRequest(
|
1010 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1011 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "EnumerateClasses") == 0)
|
1012 sushma.fernandes 1.89 request.reset(decodeEnumerateClassesRequest(
|
1013 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1014 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "EnumerateInstances") == 0)
|
1015 sushma.fernandes 1.89 request.reset(decodeEnumerateInstancesRequest(
|
1016 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1017 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "CreateClass") == 0)
|
1018 sushma.fernandes 1.89 request.reset(decodeCreateClassRequest(
|
1019 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1020 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "ModifyClass") == 0)
|
1021 sushma.fernandes 1.89 request.reset(decodeModifyClassRequest(
|
1022 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1023 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "ModifyInstance") == 0)
|
1024 sushma.fernandes 1.89 request.reset(decodeModifyInstanceRequest(
|
1025 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1026 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "DeleteClass") == 0)
|
1027 sushma.fernandes 1.89 request.reset(decodeDeleteClassRequest(
|
1028 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1029 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "DeleteInstance") == 0)
|
1030 sushma.fernandes 1.89 request.reset(decodeDeleteInstanceRequest(
|
1031 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1032 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "GetProperty") == 0)
|
1033 sushma.fernandes 1.89 request.reset(decodeGetPropertyRequest(
|
1034 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1035 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "SetProperty") == 0)
|
1036 sushma.fernandes 1.89 request.reset(decodeSetPropertyRequest(
|
1037 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1038 kumpf 1.51 else if (System::strcasecmp(cimMethodName, "ExecQuery") == 0)
|
1039 sushma.fernandes 1.89 request.reset(decodeExecQueryRequest(
|
1040 kumpf 1.101 queueId, parser, messageId, nameSpace));
|
1041 kumpf 1.34 else
1042 {
|
1043 kumpf 1.101 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
1044 MessageLoaderParms(
1045 "Server.CIMOperationRequestDecoder."
1046 "UNRECOGNIZED_INTRINSIC_METHOD",
1047 "Unrecognized intrinsic method: $0", cimMethodName));
|
1048 humberto 1.59
|
1049 kumpf 1.34 }
1050 }
1051 catch (CIMException& e)
1052 {
1053 sendIMethodError(
|
1054 j.alex 1.95 queueId,
1055 httpMethod,
1056 messageId,
1057 cimMethodName,
1058 e,
1059 closeConnect);
|
1060 mday 1.16
|
1061 kumpf 1.20 PEG_METHOD_EXIT();
|
1062 kumpf 1.34 return;
1063 }
|
1064 kumpf 1.73 catch (XmlException&)
1065 {
1066 // XmlExceptions are handled below
1067 throw;
1068 }
1069 catch (Exception& e)
1070 {
1071 // Caught an unexpected exception from decoding. Since we must
1072 // have had a problem reconstructing a CIM object, we'll treat it
1073 // as an invalid parameter
1074 sendIMethodError(
|
1075 j.alex 1.95 queueId,
1076 httpMethod,
1077 messageId,
1078 cimMethodName,
1079 PEGASUS_CIM_EXCEPTION(
1080 CIM_ERR_INVALID_PARAMETER, e.getMessage()),
1081 closeConnect);
|
1082 kumpf 1.73
1083 PEG_METHOD_EXIT();
1084 return;
1085 }
|
1086 mday 1.16
1087 // Expect </IMETHODCALL>
1088
1089 XmlReader::expectEndTag(parser, "IMETHODCALL");
1090 }
1091 // Expect <METHODCALL ...>
1092 else if (XmlReader::getMethodCallStartTag(parser, cimMethodName))
1093 {
|
1094 kumpf 1.42 CIMObjectPath reference;
|
1095 mday 1.16
|
1096 kumpf 1.26 // The Specification for CIM Operations over HTTP reads:
|
1097 kumpf 1.23 // 3.3.6. CIMMethod
1098 //
1099 // This header MUST be present in any CIM Operation Request
|
1100 chip 1.92 // message that contains a Simple Operation Request.
|
1101 kumpf 1.23 //
1102 // It MUST NOT be present in any CIM Operation Response message,
1103 // nor in any CIM Operation Request message that is not a
1104 // Simple Operation Request.
1105 //
1106 // The name of the CIM method within a Simple Operation Request
1107 // is defined to be the value of the NAME attribute of the
1108 // <METHODCALL> or <IMETHODCALL> element.
1109 //
1110 // If a CIM Server receives a CIM Operation Request for which
1111 // either:
1112 //
1113 // - The CIMMethod header is present but has an invalid value, or;
1114 // - The CIMMethod header is not present but the Operation
|
1115 chip 1.92 // Request Message is a Simple Operation Request, or;
|
1116 kumpf 1.23 // - The CIMMethod header is present but the Operation Request
|
1117 chip 1.92 // Message is not a Simple Operation Request, or;
|
1118 kumpf 1.23 // - The CIMMethod header is present, the Operation Request
1119 // Message is a Simple Operation Request, but the CIMIdentifier
1120 // value (when unencoded) does not match the unique method name
1121 // within the Simple Operation Request,
1122 //
1123 // then it MUST fail the request and return a status of
1124 // "400 Bad Request" (and MUST include a CIMError header in the
1125 // response with a value of header-mismatch), subject to the
1126 // considerations specified in Errors.
|
1127 chuck 1.68
1128 // Extrinic methods can have UTF-8!
|
1129 chuck 1.79 String cimMethodNameUTF16(cimMethodName);
|
1130 chuck 1.68 if (cimMethodNameUTF16 != cimMethodInHeader)
|
1131 kumpf 1.23 {
1132 // ATTN-RK-P3-20020304: How to decode cimMethodInHeader?
|
1133 kumpf 1.39 if (cimMethodInHeader == String::EMPTY)
1134 {
|
1135 humberto 1.66 //l10n
1136 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
1137 //"Missing CIMMethod HTTP header.");
|
1138 j.alex 1.95 MessageLoaderParms parms(
1139 "Server.CIMOperationRequestDecoder.MISSING_CIMMETHOD_HTTP_HEADER",
1140 "Missing CIMMethod HTTP header.");
1141 sendHttpError(
1142 queueId,
1143 HTTP_STATUS_BADREQUEST,
1144 "header-mismatch",
1145 MessageLoader::getMessage(parms),
1146 closeConnect);
|
1147 kumpf 1.39 }
1148 else
1149 {
|
1150 humberto 1.66 //l10n
1151 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
1152 //String("CIMMethod value \"") + cimMethodInHeader +
1153 //"\" does not match CIM request method \"" +
1154 //cimMethodName + "\".");
|
1155 j.alex 1.95 MessageLoaderParms parms(
1156 "Server.CIMOperationRequestDecoder.CIMMETHOD_VALUE_DOES_NOT_MATCH_REQUEST_METHOD",
1157 "CIMMethod value \"$0\" does not match CIM request method \"$1\".",
1158 ( const char *)cimMethodInHeader.getCString(),
1159 cimMethodName);
1160 sendHttpError(
1161 queueId,
1162 HTTP_STATUS_BADREQUEST,
1163 "header-mismatch",
1164 MessageLoader::getMessage(parms),
1165 closeConnect);
|
1166 kumpf 1.39 }
|
1167 kumpf 1.23 PEG_METHOD_EXIT();
1168 return;
1169 }
1170
|
1171 mday 1.16 //
|
1172 kumpf 1.70 // Check for <LOCALINSTANCEPATHELEMENT> or <LOCALCLASSPATHELEMENT>
|
1173 mday 1.16 //
|
1174 kumpf 1.70 if (!(XmlReader::getLocalInstancePathElement(parser, reference) ||
1175 XmlReader::getLocalClassPathElement(parser, reference)))
|
1176 mday 1.16 {
|
1177 humberto 1.71 // l10n TODO Done
1178 MessageLoaderParms parms("Common.XmlConstants.MISSING_ELEMENT_LOCALPATH",
1179 MISSING_ELEMENT_LOCALPATH);
1180 throw XmlValidationError(parser.getLine(), parms);
1181 //throw XmlValidationError(parser.getLine(), MISSING_ELEMENT_LOCALPATH);
|
1182 chip 1.92
|
1183 humberto 1.59 // this throw is not updated with MLP because MISSING_ELEMENT_LOCALPATH
1184 // is a hardcoded variable, not a message
|
1185 mday 1.16 }
1186
|
1187 kumpf 1.26 // The Specification for CIM Operations over HTTP reads:
|
1188 kumpf 1.23 // 3.3.7. CIMObject
1189 //
1190 // This header MUST be present in any CIM Operation Request
|
1191 chip 1.92 // message that contains a Simple Operation Request.
|
1192 kumpf 1.23 //
1193 // It MUST NOT be present in any CIM Operation Response message,
1194 // nor in any CIM Operation Request message that is not a
1195 // Simple Operation Request.
1196 //
1197 // The header identifies the CIM object (which MUST be a Class
1198 // or Instance for an extrinsic method, or a Namespace for an
1199 // intrinsic method) on which the method is to be invoked, using
1200 // a CIM object path encoded in an HTTP-safe representation.
1201 //
1202 // If a CIM Server receives a CIM Operation Request for which
1203 // either:
1204 //
1205 // - The CIMObject header is present but has an invalid value, or;
1206 // - The CIMObject header is not present but the Operation
|
1207 chip 1.92 // Request Message is a Simple Operation Request, or;
|
1208 kumpf 1.23 // - The CIMObject header is present but the Operation Request
|
1209 chip 1.92 // Message is not a Simple Operation Request, or;
|
1210 kumpf 1.23 // - The CIMObject header is present, the Operation Request
1211 // Message is a Simple Operation Request, but the ObjectPath
1212 // value does not match (where match is defined in the section
1213 // section on Encoding CIM Object Paths) the Operation Request
1214 // Message,
1215 //
1216 // then it MUST fail the request and return a status of
1217 // "400 Bad Request" (and MUST include a CIMError header in the
1218 // response with a value of header-mismatch), subject to the
1219 // considerations specified in Errors.
|
1220 kumpf 1.39 if (cimObjectInHeader == String::EMPTY)
1221 {
|
1222 humberto 1.66 //l10n
1223 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
1224 //"Missing CIMObject HTTP header.");
|
1225 j.alex 1.95 MessageLoaderParms parms(
1226 "Server.CIMOperationRequestDecoder.MISSING_CIMOBJECT_HTTP_HEADER",
1227 "Missing CIMObject HTTP header.");
1228 sendHttpError(
1229 queueId,
1230 HTTP_STATUS_BADREQUEST,
1231 "header-mismatch",
1232 MessageLoader::getMessage(parms),
1233 closeConnect);
|
1234 kumpf 1.39 PEG_METHOD_EXIT();
1235 return;
1236 }
1237
|
1238 kumpf 1.42 CIMObjectPath headerObjectReference;
|
1239 kumpf 1.23 try
1240 {
1241 headerObjectReference.set(cimObjectInHeader);
1242 }
|
1243 kumpf 1.74 catch (Exception&)
|
1244 kumpf 1.23 {
|
1245 humberto 1.66 //l10n
1246 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
1247 //String("Could not parse CIMObject value \"") +
1248 //cimObjectInHeader + "\".");
|
1249 j.alex 1.95 MessageLoaderParms parms(
1250 "Server.CIMOperationRequestDecoder.COULD_NOT_PARSE_CIMOBJECT_VALUE",
1251 "Could not parse CIMObject value \"$0\".",
1252 cimObjectInHeader);
1253 sendHttpError(
1254 queueId,
1255 HTTP_STATUS_BADREQUEST,
1256 "header-mismatch",
1257 MessageLoader::getMessage(parms),
1258 closeConnect);
|
1259 kumpf 1.23 PEG_METHOD_EXIT();
1260 return;
1261 }
1262
1263 if (!reference.identical(headerObjectReference))
1264 {
|
1265 humberto 1.66 //l10n
1266 //sendHttpError(queueId, HTTP_STATUS_BADREQUEST, "header-mismatch",
1267 //String("CIMObject value \"") + cimObjectInHeader +
1268 //"\" does not match CIM request object \"" +
1269 //reference.toString() + "\".");
|
1270 j.alex 1.95 MessageLoaderParms parms(
1271 "Server.CIMOperationRequestDecoder.CIMOBJECT_VALUE_DOES_NOT_MATCH_REQUEST_OBJECT:",
1272 "CIMObject value \"$0\" does not match CIM request object \"$1\".",
1273 cimObjectInHeader,
1274 reference.toString());
1275 sendHttpError(
1276 queueId,
1277 HTTP_STATUS_BADREQUEST,
1278 "header-mismatch",
1279 MessageLoader::getMessage(parms),
1280 closeConnect);
|
1281 kumpf 1.23 PEG_METHOD_EXIT();
1282 return;
1283 }
1284
|
1285 kumpf 1.34 // This try block only catches CIMExceptions, because they must be
1286 // responded to with a proper METHODRESPONSE. Other exceptions are
1287 // caught in the outer try block.
1288 try
1289 {
1290 // Delegate to appropriate method to handle:
1291
|
1292 sushma.fernandes 1.89 request.reset(decodeInvokeMethodRequest(
|
1293 chip 1.92 queueId,
1294 parser,
1295 messageId,
1296 reference,
|
1297 kumpf 1.101 cimMethodNameUTF16)); // contains UTF-16 converted from UTF-8
|
1298 kumpf 1.34 }
1299 catch (CIMException& e)
1300 {
|
1301 j.alex 1.95 sendMethodError(
1302 queueId,
1303 httpMethod,
1304 messageId,
1305 cimMethodNameUTF16, // contains UTF-16 converted from UTF-8
1306 e,
1307 closeConnect);
|
1308 kumpf 1.73
1309 PEG_METHOD_EXIT();
1310 return;
1311 }
1312 catch (XmlException&)
1313 {
1314 // XmlExceptions are handled below
1315 throw;
1316 }
1317 catch (Exception& e)
1318 {
1319 // Caught an unexpected exception from decoding. Since we must
1320 // have had a problem reconstructing a CIM object, we'll treat it
1321 // as an invalid parameter
1322 sendMethodError(
|
1323 j.alex 1.95 queueId,
1324 httpMethod,
1325 messageId,
1326 cimMethodNameUTF16, // contains UTF-16 converted from UTF-8
1327 PEGASUS_CIM_EXCEPTION(
1328 CIM_ERR_INVALID_PARAMETER, e.getMessage()),
1329 closeConnect);
|
1330 mday 1.16
|
1331 kumpf 1.20 PEG_METHOD_EXIT();
|
1332 kumpf 1.34 return;
1333 }
|
1334 kumpf 1.24
|
1335 kumpf 1.34 // Expect </METHODCALL>
|
1336 mday 1.16
|
1337 kumpf 1.34 XmlReader::expectEndTag(parser, "METHODCALL");
|
1338 mday 1.16 }
1339 else
1340 {
|
1341 humberto 1.59 // l10n
1342
|
1343 chip 1.92 // throw XmlValidationError(parser.getLine(),
|
1344 humberto 1.59 // "expected IMETHODCALL or METHODCALL element");
1345
|
1346 humberto 1.67 MessageLoaderParms mlParms("Server.CIMOperationRequestDecoder.EXPECTED_IMETHODCALL_ELEMENT",
1347 "expected IMETHODCALL or METHODCALL element");
|
1348 humberto 1.59
1349 throw XmlValidationError(parser.getLine(),mlParms);
|
1350 chip 1.92
|
1351 mday 1.16 }
1352
1353 // Expect </SIMPLEREQ>
1354
1355 XmlReader::expectEndTag(parser, "SIMPLEREQ");
1356
1357 // Expect </MESSAGE>
1358
1359 XmlReader::expectEndTag(parser, "MESSAGE");
1360
1361 // Expect </CIM>
1362
1363 XmlReader::expectEndTag(parser, "CIM");
1364 }
|
1365 kumpf 1.34 catch (XmlValidationError& e)
|
1366 mday 1.16 {
|
1367 david 1.57 Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::TRACE,
1368 "CIMOperationRequestDecoder::handleMethodCall - XmlValidationError exception has occurred. Message: $0",e.getMessage());
1369
|
1370 j.alex 1.95 sendHttpError(
1371 queueId,
1372 HTTP_STATUS_BADREQUEST,
1373 "request-not-valid",
1374 e.getMessage(),
1375 closeConnect);
|
1376 kumpf 1.34 PEG_METHOD_EXIT();
1377 return;
1378 }
1379 catch (XmlSemanticError& e)
1380 {
|
1381 david 1.57 Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::TRACE,
1382 "CIMOperationRequestDecoder::handleMethodCall - XmlSemanticError exception has occurred. Message: $0",e.getMessage());
1383
|
1384 kumpf 1.34 // ATTN-RK-P2-20020404: Is this the correct response for these errors?
|
1385 j.alex 1.95 sendHttpError(
1386 queueId,
1387 HTTP_STATUS_BADREQUEST,
1388 "request-not-valid",
1389 e.getMessage(),
1390 closeConnect);
|
1391 kumpf 1.34 PEG_METHOD_EXIT();
1392 return;
1393 }
1394 catch (XmlException& e)
1395 {
|
1396 david 1.57 Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::TRACE,
1397 "CIMOperationRequestDecoder::handleMethodCall - XmlException has occurred. Message: $0",e.getMessage());
1398
|
1399 j.alex 1.95 sendHttpError(
1400 queueId,
1401 HTTP_STATUS_BADREQUEST,
1402 "request-not-well-formed",
1403 e.getMessage(),
1404 closeConnect);
|
1405 kumpf 1.20 PEG_METHOD_EXIT();
|
1406 mday 1.16 return;
1407 }
1408 catch (Exception& e)
1409 {
|
1410 kumpf 1.34 // Don't know why I got this exception. Seems like a bad thing.
1411 // Any exceptions we're expecting should be caught separately and
1412 // dealt with appropriately. This is a last resort.
|
1413 j.alex 1.95 sendHttpError(
1414 queueId,
1415 HTTP_STATUS_INTERNALSERVERERROR,
1416 String::EMPTY,
1417 e.getMessage(),
1418 closeConnect);
|
1419 kumpf 1.34 PEG_METHOD_EXIT();
1420 return;
1421 }
1422 catch (...)
1423 {
1424 // Don't know why I got whatever this is. Seems like a bad thing.
1425 // Any exceptions we're expecting should be caught separately and
1426 // dealt with appropriately. This is a last resort.
|
1427 j.alex 1.95 sendHttpError(
1428 queueId,
1429 HTTP_STATUS_INTERNALSERVERERROR,
1430 String::EMPTY,
1431 String::EMPTY,
1432 closeConnect);
|
1433 kumpf 1.20 PEG_METHOD_EXIT();
|
1434 mday 1.16 return;
1435 }
|
1436 mike 1.2
|
1437 sage 1.41 STAT_BYTESREAD
|
1438 kumpf 1.53
|
1439 kumpf 1.101 request->authType = authType;
1440 request->userName = userName;
|
1441 kumpf 1.103 request->ipAddress = ipAddress;
|
1442 kumpf 1.53 request->setHttpMethod (httpMethod);
|
1443 sage 1.41
|
1444 chuck 1.58 //l10n start
1445 // l10n TODO - might want to move A-L and C-L to Message
1446 // to make this more maintainable
1447 // Add the language headers to the request
|
1448 sushma.fernandes 1.89 CIMMessage * cimmsg = dynamic_cast<CIMMessage *>(request.get());
|
1449 chuck 1.58 if (cimmsg != NULL)
1450 {
|
1451 se.gupta 1.81 cimmsg->operationContext.insert(IdentityContainer(userName));
|
1452 se.gupta 1.83 cimmsg->operationContext.set(AcceptLanguageListContainer(httpAcceptLanguages));
1453 cimmsg->operationContext.set(ContentLanguageListContainer(httpContentLanguages));
|
1454 chuck 1.58 }
1455 else
1456 {
|
1457 chip 1.92 ; // l10n TODO - error back to client here
|
1458 chuck 1.58 }
|
1459 chip 1.92 // l10n end
|
1460 chuck 1.58
|
1461 j.alex 1.95 request->setCloseConnect(closeConnect);
|
1462 sushma.fernandes 1.89 _outputQueue->enqueue(request.release());
|
1463 chip 1.92
|
1464 kumpf 1.20 PEG_METHOD_EXIT();
|
1465 mike 1.2 }
1466
1467 CIMCreateClassRequestMessage* CIMOperationRequestDecoder::decodeCreateClassRequest(
|
1468 mday 1.16 Uint32 queueId,
|
1469 chip 1.92 XmlParser& parser,
|
1470 mday 1.16 const String& messageId,
|
1471 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
1472 mday 1.16 {
|
1473 kumpf 1.20 PEG_METHOD_ENTER(TRC_DISPATCHER,
1474 "CIMOperationRequestDecoder::decodeCreateClassRequest()");
1475
|
1476 sage 1.41 STAT_GETSTARTTIME
1477
|
1478 mday 1.16 CIMClass newClass;
1479 Boolean duplicateParameter = false;
1480 Boolean gotClass = false;
|
1481 kumpf 1.84 Boolean emptyTag;
|
1482 mday 1.16
|
1483 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
1484 mday 1.16 {
|
1485 kumpf 1.51 if (System::strcasecmp(name, "NewClass") == 0)
|
1486 mday 1.16 {
|
1487 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1488 mday 1.16 XmlReader::getClassElement(parser, newClass);
1489 duplicateParameter = gotClass;
1490 gotClass = true;
1491 }
1492 else
1493 {
|
1494 kumpf 1.20 PEG_METHOD_EXIT();
|
1495 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
1496 mday 1.16 }
1497
|
1498 kumpf 1.84 if (!emptyTag)
1499 {
1500 XmlReader::expectEndTag(parser, "IPARAMVALUE");
1501 }
|
1502 mday 1.16
1503 if (duplicateParameter)
1504 {
|
1505 kumpf 1.20 PEG_METHOD_EXIT();
|
1506 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1507 mday 1.16 }
1508 }
1509
1510 if (!gotClass)
1511 {
|
1512 kumpf 1.20 PEG_METHOD_EXIT();
|
1513 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1514 mday 1.16 }
|
1515 chip 1.92
|
1516 a.arora 1.82 AutoPtr<CIMCreateClassRequestMessage> request(new CIMCreateClassRequestMessage(
|
1517 mday 1.16 messageId,
1518 nameSpace,
1519 newClass,
|
1520 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
1521 mike 1.2
|
1522 sage 1.41 STAT_SERVERSTART
1523
|
1524 kumpf 1.20 PEG_METHOD_EXIT();
|
1525 a.arora 1.82 return(request.release());
|
1526 mike 1.2 }
1527
1528 CIMGetClassRequestMessage* CIMOperationRequestDecoder::decodeGetClassRequest(
|
1529 mday 1.16 Uint32 queueId,
|
1530 chip 1.92 XmlParser& parser,
|
1531 mday 1.16 const String& messageId,
|
1532 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
1533 mday 1.16 {
|
1534 kumpf 1.20 PEG_METHOD_ENTER(TRC_DISPATCHER,
1535 "CIMOperationRequestDecoder::decodeGetClassRequest()");
1536
|
1537 sage 1.41 STAT_GETSTARTTIME
1538
|
1539 kumpf 1.52 CIMName className;
|
1540 mday 1.16 Boolean localOnly = true;
1541 Boolean includeQualifiers = true;
1542 Boolean includeClassOrigin = false;
1543 CIMPropertyList propertyList;
1544 Boolean duplicateParameter = false;
1545 Boolean gotClassName = false;
1546 Boolean gotLocalOnly = false;
1547 Boolean gotIncludeQualifiers = false;
1548 Boolean gotIncludeClassOrigin = false;
1549 Boolean gotPropertyList = false;
|
1550 kumpf 1.84 Boolean emptyTag;
|
1551 mday 1.16
|
1552 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
1553 mday 1.16 {
|
1554 kumpf 1.51 if (System::strcasecmp(name, "ClassName") == 0)
|
1555 mday 1.16 {
|
1556 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1557 mday 1.16 XmlReader::getClassNameElement(parser, className, true);
1558 duplicateParameter = gotClassName;
1559 gotClassName = true;
1560 }
|
1561 kumpf 1.51 else if (System::strcasecmp(name, "LocalOnly") == 0)
|
1562 mday 1.16 {
|
1563 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1564 mday 1.16 XmlReader::getBooleanValueElement(parser, localOnly, true);
1565 duplicateParameter = gotLocalOnly;
1566 gotLocalOnly = true;
1567 }
|
1568 kumpf 1.51 else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
|
1569 mday 1.16 {
|
1570 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1571 mday 1.16 XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
1572 duplicateParameter = gotIncludeQualifiers;
1573 gotIncludeQualifiers = true;
1574 }
|
1575 kumpf 1.51 else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
|
1576 mday 1.16 {
|
1577 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1578 mday 1.16 XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
1579 duplicateParameter = gotIncludeClassOrigin;
1580 gotIncludeClassOrigin = true;
1581 }
|
1582 kumpf 1.51 else if (System::strcasecmp(name, "PropertyList") == 0)
|
1583 mday 1.16 {
|
1584 kumpf 1.84 if (!emptyTag)
1585 {
1586 CIMValue pl;
1587 if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
|
1588 kumpf 1.49 {
|
1589 kumpf 1.84 Array<String> propertyListArray;
1590 pl.get(propertyListArray);
1591 Array<CIMName> cimNameArray;
1592 for (Uint32 i = 0; i < propertyListArray.size(); i++)
1593 {
1594 cimNameArray.append(propertyListArray[i]);
1595 }
1596 propertyList.set(cimNameArray);
|
1597 kumpf 1.49 }
|
1598 kumpf 1.84 }
|
1599 mday 1.16 duplicateParameter = gotPropertyList;
1600 gotPropertyList = true;
1601 }
1602 else
1603 {
|
1604 kumpf 1.20 PEG_METHOD_EXIT();
|
1605 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
1606 mday 1.16 }
1607
|
1608 kumpf 1.84 if (!emptyTag)
1609 {
1610 XmlReader::expectEndTag(parser, "IPARAMVALUE");
1611 }
|
1612 mday 1.16
1613 if (duplicateParameter)
1614 {
|
1615 kumpf 1.20 PEG_METHOD_EXIT();
|
1616 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1617 mday 1.16 }
1618 }
1619
1620 if (!gotClassName)
1621 {
|
1622 kumpf 1.20 PEG_METHOD_EXIT();
|
1623 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1624 mday 1.16 }
1625
|
1626 a.arora 1.82 AutoPtr<CIMGetClassRequestMessage> request(new CIMGetClassRequestMessage(
|
1627 mday 1.16 messageId,
1628 nameSpace,
1629 className,
1630 localOnly,
1631 includeQualifiers,
1632 includeClassOrigin,
1633 propertyList,
|
1634 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
1635 mike 1.2
|
1636 sage 1.41 STAT_SERVERSTART
1637
|
1638 kumpf 1.20 PEG_METHOD_EXIT();
|
1639 a.arora 1.82 return(request.release());
|
1640 mike 1.2 }
1641
1642 CIMModifyClassRequestMessage* CIMOperationRequestDecoder::decodeModifyClassRequest(
|
1643 mday 1.16 Uint32 queueId,
|
1644 chip 1.92 XmlParser& parser,
|
1645 mday 1.16 const String& messageId,
|
1646 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
1647 mday 1.16 {
|
1648 sage 1.41 STAT_GETSTARTTIME
|
1649 chip 1.92
|
1650 mday 1.16 CIMClass modifiedClass;
1651 Boolean duplicateParameter = false;
1652 Boolean gotClass = false;
|
1653 kumpf 1.84 Boolean emptyTag;
|
1654 mday 1.16
|
1655 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
1656 mday 1.16 {
|
1657 kumpf 1.51 if (System::strcasecmp(name, "ModifiedClass") == 0)
|
1658 mday 1.16 {
|
1659 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1660 mday 1.16 XmlReader::getClassElement(parser, modifiedClass);
1661 duplicateParameter = gotClass;
1662 gotClass = true;
1663 }
1664 else
1665 {
|
1666 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
1667 mday 1.16 }
1668
|
1669 kumpf 1.84 if (!emptyTag)
1670 {
1671 XmlReader::expectEndTag(parser, "IPARAMVALUE");
1672 }
|
1673 mday 1.16
1674 if (duplicateParameter)
1675 {
|
1676 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1677 mday 1.16 }
1678 }
1679
1680 if (!gotClass)
1681 {
|
1682 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1683 mday 1.16 }
1684
|
1685 a.arora 1.82 AutoPtr<CIMModifyClassRequestMessage> request(
|
1686 mday 1.16 new CIMModifyClassRequestMessage(
1687 messageId,
1688 nameSpace,
1689 modifiedClass,
|
1690 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
1691 mike 1.2
|
1692 sage 1.41 STAT_SERVERSTART
1693
|
1694 a.arora 1.82 return(request.release());
|
1695 mike 1.2 }
1696
1697 CIMEnumerateClassNamesRequestMessage* CIMOperationRequestDecoder::decodeEnumerateClassNamesRequest(
|
1698 mday 1.16 Uint32 queueId,
|
1699 chip 1.92 XmlParser& parser,
|
1700 mday 1.16 const String& messageId,
|
1701 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
1702 mday 1.16 {
|
1703 sage 1.41 STAT_GETSTARTTIME
1704
|
1705 kumpf 1.52 CIMName className;
|
1706 mday 1.16 Boolean deepInheritance = false;
1707 Boolean duplicateParameter = false;
1708 Boolean gotClassName = false;
1709 Boolean gotDeepInheritance = false;
|
1710 kumpf 1.84 Boolean emptyTag;
|
1711 mday 1.16
|
1712 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
1713 mday 1.16 {
|
1714 kumpf 1.51 if (System::strcasecmp(name, "ClassName") == 0)
|
1715 mday 1.16 {
|
1716 kumpf 1.55 //
1717 // ClassName may be NULL
1718 //
|
1719 kumpf 1.84 if (!emptyTag)
1720 {
1721 XmlReader::getClassNameElement(parser, className, false);
1722 }
|
1723 mday 1.16 duplicateParameter = gotClassName;
1724 gotClassName = true;
1725 }
|
1726 kumpf 1.51 else if (System::strcasecmp(name, "DeepInheritance") == 0)
|
1727 mday 1.16 {
|
1728 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1729 mday 1.16 XmlReader::getBooleanValueElement(parser, deepInheritance, true);
1730 duplicateParameter = gotDeepInheritance;
1731 gotDeepInheritance = true;
1732 }
1733 else
1734 {
|
1735 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
1736 mday 1.16 }
1737
|
1738 kumpf 1.84 if (!emptyTag)
1739 {
1740 XmlReader::expectEndTag(parser, "IPARAMVALUE");
1741 }
|
1742 mday 1.16
1743 if (duplicateParameter)
1744 {
|
1745 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1746 mday 1.16 }
1747 }
1748
|
1749 a.arora 1.82 AutoPtr<CIMEnumerateClassNamesRequestMessage> request(
|
1750 mday 1.16 new CIMEnumerateClassNamesRequestMessage(
1751 messageId,
1752 nameSpace,
1753 className,
1754 deepInheritance,
|
1755 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
1756 mike 1.2
|
1757 sage 1.41 STAT_SERVERSTART
1758
|
1759 a.arora 1.82 return(request.release());
|
1760 mike 1.2 }
1761
1762 CIMEnumerateClassesRequestMessage* CIMOperationRequestDecoder::decodeEnumerateClassesRequest(
|
1763 mday 1.16 Uint32 queueId,
|
1764 chip 1.92 XmlParser& parser,
|
1765 mday 1.16 const String& messageId,
|
1766 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
1767 mday 1.16 {
|
1768 sage 1.41 STAT_GETSTARTTIME
1769
|
1770 kumpf 1.52 CIMName className;
|
1771 mday 1.16 Boolean deepInheritance = false;
1772 Boolean localOnly = true;
1773 Boolean includeQualifiers = true;
1774 Boolean includeClassOrigin = false;
1775 Boolean duplicateParameter = false;
1776 Boolean gotClassName = false;
1777 Boolean gotDeepInheritance = false;
1778 Boolean gotLocalOnly = false;
1779 Boolean gotIncludeQualifiers = false;
1780 Boolean gotIncludeClassOrigin = false;
|
1781 kumpf 1.84 Boolean emptyTag;
|
1782 mday 1.16
|
1783 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
1784 mday 1.16 {
|
1785 kumpf 1.51 if (System::strcasecmp(name, "ClassName") == 0)
|
1786 mday 1.16 {
|
1787 kumpf 1.55 //
1788 // ClassName may be NULL
1789 //
|
1790 kumpf 1.84 if (!emptyTag)
1791 {
1792 XmlReader::getClassNameElement(parser, className, false);
1793 }
|
1794 mday 1.16 duplicateParameter = gotClassName;
1795 gotClassName = true;
1796 }
|
1797 kumpf 1.51 else if (System::strcasecmp(name, "DeepInheritance") == 0)
|
1798 mday 1.16 {
|
1799 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1800 mday 1.16 XmlReader::getBooleanValueElement(parser, deepInheritance, true);
1801 duplicateParameter = gotDeepInheritance;
1802 gotDeepInheritance = true;
1803 }
|
1804 kumpf 1.51 else if (System::strcasecmp(name, "LocalOnly") == 0)
|
1805 mday 1.16 {
|
1806 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1807 mday 1.16 XmlReader::getBooleanValueElement(parser, localOnly, true);
1808 duplicateParameter = gotLocalOnly;
1809 gotLocalOnly = true;
1810 }
|
1811 kumpf 1.51 else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
|
1812 mday 1.16 {
|
1813 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1814 mday 1.16 XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
1815 duplicateParameter = gotIncludeQualifiers;
1816 gotIncludeQualifiers = true;
1817 }
|
1818 kumpf 1.51 else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
|
1819 mday 1.16 {
|
1820 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1821 mday 1.16 XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
1822 duplicateParameter = gotIncludeClassOrigin;
1823 gotIncludeClassOrigin = true;
1824 }
1825 else
1826 {
|
1827 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
1828 mday 1.16 }
1829
|
1830 kumpf 1.84 if (!emptyTag)
1831 {
1832 XmlReader::expectEndTag(parser, "IPARAMVALUE");
1833 }
|
1834 mday 1.16
1835 if (duplicateParameter)
1836 {
|
1837 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1838 mday 1.16 }
1839 }
1840
|
1841 a.arora 1.82 AutoPtr<CIMEnumerateClassesRequestMessage> request(
|
1842 mday 1.16 new CIMEnumerateClassesRequestMessage(
1843 messageId,
1844 nameSpace,
1845 className,
1846 deepInheritance,
1847 localOnly,
1848 includeQualifiers,
1849 includeClassOrigin,
|
1850 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
1851 mike 1.2
|
1852 sage 1.41 STAT_SERVERSTART
1853
|
1854 a.arora 1.82 return(request.release());
|
1855 mike 1.2 }
1856
1857 CIMDeleteClassRequestMessage* CIMOperationRequestDecoder::decodeDeleteClassRequest(
|
1858 mday 1.16 Uint32 queueId,
|
1859 chip 1.92 XmlParser& parser,
|
1860 mday 1.16 const String& messageId,
|
1861 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
1862 mday 1.16 {
|
1863 sage 1.41 STAT_GETSTARTTIME
1864
|
1865 kumpf 1.52 CIMName className;
|
1866 mday 1.16 Boolean duplicateParameter = false;
1867 Boolean gotClassName = false;
|
1868 kumpf 1.84 Boolean emptyTag;
|
1869 mday 1.16
|
1870 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
1871 mday 1.16 {
|
1872 kumpf 1.51 if (System::strcasecmp(name, "ClassName") == 0)
|
1873 mday 1.16 {
|
1874 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1875 mday 1.16 XmlReader::getClassNameElement(parser, className);
1876 duplicateParameter = gotClassName;
1877 gotClassName = true;
1878 }
1879 else
1880 {
|
1881 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
1882 mday 1.16 }
1883
|
1884 kumpf 1.84 if (!emptyTag)
1885 {
1886 XmlReader::expectEndTag(parser, "IPARAMVALUE");
1887 }
|
1888 mday 1.16
1889 if (duplicateParameter)
1890 {
|
1891 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1892 mday 1.16 }
1893 }
1894
1895 if (!gotClassName)
1896 {
|
1897 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1898 mday 1.16 }
1899
|
1900 a.arora 1.82 AutoPtr<CIMDeleteClassRequestMessage> request(new CIMDeleteClassRequestMessage(
|
1901 mday 1.16 messageId,
1902 nameSpace,
1903 className,
|
1904 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
1905 mike 1.2
|
1906 sage 1.41 STAT_SERVERSTART
1907
|
1908 a.arora 1.82 return(request.release());
|
1909 mike 1.2 }
1910
1911 CIMCreateInstanceRequestMessage* CIMOperationRequestDecoder::decodeCreateInstanceRequest(
|
1912 mday 1.16 Uint32 queueId,
|
1913 chip 1.92 XmlParser& parser,
|
1914 mday 1.16 const String& messageId,
|
1915 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
1916 mday 1.16 {
|
1917 sage 1.41 STAT_GETSTARTTIME
1918
|
1919 mday 1.16 CIMInstance newInstance;
1920 Boolean duplicateParameter = false;
1921 Boolean gotInstance = false;
|
1922 kumpf 1.84 Boolean emptyTag;
|
1923 mday 1.16
|
1924 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
1925 mday 1.16 {
|
1926 kumpf 1.51 if (System::strcasecmp(name, "NewInstance") == 0)
|
1927 mday 1.16 {
|
1928 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1929 mday 1.16 XmlReader::getInstanceElement(parser, newInstance);
1930 duplicateParameter = gotInstance;
1931 gotInstance = true;
1932 }
1933 else
1934 {
|
1935 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
1936 mday 1.16 }
1937
|
1938 kumpf 1.84 if (!emptyTag)
1939 {
1940 XmlReader::expectEndTag(parser, "IPARAMVALUE");
1941 }
|
1942 mday 1.16
1943 if (duplicateParameter)
1944 {
|
1945 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1946 mday 1.16 }
1947 }
1948
1949 if (!gotInstance)
1950 {
|
1951 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
1952 mday 1.16 }
1953
|
1954 a.arora 1.82 AutoPtr<CIMCreateInstanceRequestMessage> request(
|
1955 mday 1.16 new CIMCreateInstanceRequestMessage(
1956 messageId,
1957 nameSpace,
1958 newInstance,
|
1959 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
1960 mike 1.2
|
1961 sage 1.41 STAT_SERVERSTART
1962
|
1963 a.arora 1.82 return(request.release());
|
1964 mike 1.2 }
1965
1966 CIMGetInstanceRequestMessage* CIMOperationRequestDecoder::decodeGetInstanceRequest(
|
1967 mday 1.16 Uint32 queueId,
|
1968 chip 1.92 XmlParser& parser,
|
1969 mday 1.16 const String& messageId,
|
1970 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
1971 mday 1.16 {
|
1972 sage 1.41 STAT_GETSTARTTIME
1973
|
1974 kumpf 1.42 CIMObjectPath instanceName;
|
1975 mday 1.16 Boolean localOnly = true;
1976 Boolean includeQualifiers = false;
1977 Boolean includeClassOrigin = false;
1978 CIMPropertyList propertyList;
1979 Boolean duplicateParameter = false;
1980 Boolean gotInstanceName = false;
1981 Boolean gotLocalOnly = false;
1982 Boolean gotIncludeQualifiers = false;
1983 Boolean gotIncludeClassOrigin = false;
1984 Boolean gotPropertyList = false;
|
1985 kumpf 1.84 Boolean emptyTag;
|
1986 mday 1.16
|
1987 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
1988 mday 1.16 {
|
1989 kumpf 1.51 if (System::strcasecmp(name, "InstanceName") == 0)
|
1990 mday 1.16 {
|
1991 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1992 mday 1.16 XmlReader::getInstanceNameElement(parser, instanceName);
1993 duplicateParameter = gotInstanceName;
1994 gotInstanceName = true;
1995 }
|
1996 kumpf 1.51 else if (System::strcasecmp(name, "LocalOnly") == 0)
|
1997 mday 1.16 {
|
1998 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
1999 mday 1.16 XmlReader::getBooleanValueElement(parser, localOnly, true);
2000 duplicateParameter = gotLocalOnly;
2001 gotLocalOnly = true;
2002 }
|
2003 kumpf 1.51 else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
|
2004 mday 1.16 {
|
2005 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2006 mday 1.16 XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
2007 duplicateParameter = gotIncludeQualifiers;
2008 gotIncludeQualifiers = true;
2009 }
|
2010 kumpf 1.51 else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
|
2011 mday 1.16 {
|
2012 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2013 mday 1.16 XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
2014 duplicateParameter = gotIncludeClassOrigin;
2015 gotIncludeClassOrigin = true;
2016 }
|
2017 kumpf 1.51 else if (System::strcasecmp(name, "PropertyList") == 0)
|
2018 mday 1.16 {
|
2019 kumpf 1.84 if (!emptyTag)
2020 {
2021 CIMValue pl;
2022 if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
|
2023 kumpf 1.49 {
|
2024 kumpf 1.84 Array<String> propertyListArray;
2025 pl.get(propertyListArray);
2026 Array<CIMName> cimNameArray;
2027 for (Uint32 i = 0; i < propertyListArray.size(); i++)
2028 {
2029 cimNameArray.append(propertyListArray[i]);
2030 }
2031 propertyList.set(cimNameArray);
|
2032 kumpf 1.49 }
|
2033 kumpf 1.84 }
|
2034 mday 1.16 duplicateParameter = gotPropertyList;
2035 gotPropertyList = true;
2036 }
2037 else
2038 {
|
2039 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2040 mday 1.16 }
2041
|
2042 kumpf 1.84 if (!emptyTag)
2043 {
2044 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2045 }
|
2046 mday 1.16
2047 if (duplicateParameter)
2048 {
|
2049 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2050 mday 1.16 }
2051 }
2052
2053 if (!gotInstanceName)
2054 {
|
2055 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2056 mday 1.16 }
2057
|
2058 a.arora 1.82 AutoPtr<CIMGetInstanceRequestMessage> request(new CIMGetInstanceRequestMessage(
|
2059 mday 1.16 messageId,
2060 nameSpace,
2061 instanceName,
|
2062 chip 1.92 false, // Bug 1985 localOnly is deprecated
|
2063 h.sterling 1.97 #ifdef PEGASUS_DISABLE_INSTANCE_QUALIFIERS
2064 false,
2065 #else
|
2066 mday 1.16 includeQualifiers,
|
2067 h.sterling 1.97 #endif
|
2068 mday 1.16 includeClassOrigin,
2069 propertyList,
|
2070 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2071 mike 1.2
|
2072 sage 1.41 STAT_SERVERSTART
2073
|
2074 a.arora 1.82 return(request.release());
|
2075 mike 1.2 }
2076
2077 CIMModifyInstanceRequestMessage* CIMOperationRequestDecoder::decodeModifyInstanceRequest(
|
2078 mday 1.16 Uint32 queueId,
|
2079 chip 1.92 XmlParser& parser,
|
2080 mday 1.16 const String& messageId,
|
2081 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2082 mday 1.16 {
|
2083 sage 1.41 STAT_GETSTARTTIME
2084
|
2085 kumpf 1.46 CIMInstance modifiedInstance;
|
2086 mday 1.16 Boolean includeQualifiers = true;
2087 CIMPropertyList propertyList;
2088 Boolean duplicateParameter = false;
2089 Boolean gotInstance = false;
2090 Boolean gotIncludeQualifiers = false;
2091 Boolean gotPropertyList = false;
|
2092 kumpf 1.84 Boolean emptyTag;
|
2093 mday 1.16
|
2094 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2095 mday 1.16 {
|
2096 kumpf 1.51 if (System::strcasecmp(name, "ModifiedInstance") == 0)
|
2097 mday 1.16 {
|
2098 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2099 mday 1.16 XmlReader::getNamedInstanceElement(parser, modifiedInstance);
2100 duplicateParameter = gotInstance;
2101 gotInstance = true;
2102 }
|
2103 kumpf 1.51 else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
|
2104 mday 1.16 {
|
2105 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2106 mday 1.16 XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
2107 duplicateParameter = gotIncludeQualifiers;
2108 gotIncludeQualifiers = true;
2109 }
|
2110 kumpf 1.51 else if (System::strcasecmp(name, "PropertyList") == 0)
|
2111 mday 1.16 {
|
2112 kumpf 1.84 if (!emptyTag)
2113 {
2114 CIMValue pl;
2115 if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
|
2116 kumpf 1.49 {
|
2117 kumpf 1.84 Array<String> propertyListArray;
2118 pl.get(propertyListArray);
2119 Array<CIMName> cimNameArray;
2120 for (Uint32 i = 0; i < propertyListArray.size(); i++)
2121 {
2122 cimNameArray.append(propertyListArray[i]);
2123 }
2124 propertyList.set(cimNameArray);
|
2125 kumpf 1.49 }
|
2126 kumpf 1.84 }
|
2127 mday 1.16 duplicateParameter = gotPropertyList;
2128 gotPropertyList = true;
2129 }
2130 else
2131 {
|
2132 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2133 mday 1.16 }
2134
|
2135 kumpf 1.84 if (!emptyTag)
2136 {
2137 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2138 }
|
2139 mday 1.16
2140 if (duplicateParameter)
2141 {
|
2142 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2143 mday 1.16 }
2144 }
2145
2146 if (!gotInstance)
2147 {
|
2148 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2149 mday 1.16 }
2150
|
2151 a.arora 1.82 AutoPtr<CIMModifyInstanceRequestMessage> request(
|
2152 mday 1.16 new CIMModifyInstanceRequestMessage(
2153 messageId,
2154 nameSpace,
2155 modifiedInstance,
2156 includeQualifiers,
2157 propertyList,
|
2158 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2159 kumpf 1.9
|
2160 sage 1.41 STAT_SERVERSTART
|
2161 mike 1.2
|
2162 a.arora 1.82 return(request.release());
|
2163 mike 1.2 }
2164
2165 CIMEnumerateInstancesRequestMessage* CIMOperationRequestDecoder::decodeEnumerateInstancesRequest(
|
2166 mday 1.16 Uint32 queueId,
|
2167 chip 1.92 XmlParser& parser,
|
2168 mday 1.16 const String& messageId,
|
2169 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2170 mday 1.16 {
|
2171 sage 1.41 STAT_GETSTARTTIME
2172
|
2173 kumpf 1.52 CIMName className;
|
2174 kumpf 1.64 Boolean deepInheritance = true;
|
2175 mday 1.16 Boolean localOnly = true;
|
2176 kumpf 1.64 Boolean includeQualifiers = false;
|
2177 mday 1.16 Boolean includeClassOrigin = false;
2178 CIMPropertyList propertyList;
2179 Boolean duplicateParameter = false;
2180 Boolean gotClassName = false;
2181 Boolean gotDeepInheritance = false;
2182 Boolean gotLocalOnly = false;
2183 Boolean gotIncludeQualifiers = false;
2184 Boolean gotIncludeClassOrigin = false;
2185 Boolean gotPropertyList = false;
|
2186 kumpf 1.84 Boolean emptyTag;
|
2187 mday 1.16
|
2188 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2189 mday 1.16 {
|
2190 kumpf 1.51 if (System::strcasecmp(name, "ClassName") == 0)
|
2191 mday 1.16 {
|
2192 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2193 mday 1.16 XmlReader::getClassNameElement(parser, className, true);
2194 duplicateParameter = gotClassName;
2195 gotClassName = true;
2196 }
|
2197 kumpf 1.51 else if (System::strcasecmp(name, "DeepInheritance") == 0)
|
2198 mday 1.16 {
|
2199 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2200 mday 1.16 XmlReader::getBooleanValueElement(parser, deepInheritance, true);
2201 duplicateParameter = gotDeepInheritance;
2202 gotDeepInheritance = true;
2203 }
|
2204 kumpf 1.51 else if (System::strcasecmp(name, "LocalOnly") == 0)
|
2205 mday 1.16 {
|
2206 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2207 mday 1.16 XmlReader::getBooleanValueElement(parser, localOnly, true);
2208 duplicateParameter = gotLocalOnly;
2209 gotLocalOnly = true;
2210 }
|
2211 kumpf 1.51 else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
|
2212 mday 1.16 {
|
2213 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2214 mday 1.16 XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
2215 duplicateParameter = gotIncludeQualifiers;
2216 gotIncludeQualifiers = true;
2217 }
|
2218 kumpf 1.51 else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
|
2219 mday 1.16 {
|
2220 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2221 mday 1.16 XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
2222 duplicateParameter = gotIncludeClassOrigin;
2223 gotIncludeClassOrigin = true;
2224 }
|
2225 kumpf 1.51 else if (System::strcasecmp(name, "PropertyList") == 0)
|
2226 mday 1.16 {
|
2227 kumpf 1.84 if (!emptyTag)
2228 {
2229 CIMValue pl;
2230 if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
|
2231 kumpf 1.49 {
|
2232 kumpf 1.84 Array<String> propertyListArray;
2233 pl.get(propertyListArray);
2234 Array<CIMName> cimNameArray;
2235 for (Uint32 i = 0; i < propertyListArray.size(); i++)
2236 {
2237 cimNameArray.append(propertyListArray[i]);
2238 }
2239 propertyList.set(cimNameArray);
|
2240 kumpf 1.49 }
|
2241 kumpf 1.84 }
|
2242 mday 1.16 duplicateParameter = gotPropertyList;
2243 gotPropertyList = true;
2244 }
2245 else
2246 {
|
2247 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2248 mday 1.16 }
2249
|
2250 kumpf 1.84 if (!emptyTag)
2251 {
2252 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2253 }
|
2254 mday 1.16
2255 if (duplicateParameter)
2256 {
|
2257 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2258 mday 1.16 }
2259 }
2260
2261 if (!gotClassName)
2262 {
|
2263 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2264 mday 1.16 }
2265
|
2266 a.arora 1.82 AutoPtr<CIMEnumerateInstancesRequestMessage> request(
|
2267 mday 1.16 new CIMEnumerateInstancesRequestMessage(
2268 messageId,
2269 nameSpace,
2270 className,
2271 deepInheritance,
|
2272 chip 1.92 false, // Bug 1985 localOnly is deprecated
|
2273 h.sterling 1.97 #ifdef PEGASUS_DISABLE_INSTANCE_QUALIFIERS
2274 false,
2275 #else
2276 includeQualifiers,
2277 #endif
|
2278 mday 1.16 includeClassOrigin,
2279 propertyList,
|
2280 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2281 mike 1.2
|
2282 sage 1.41 STAT_SERVERSTART
2283
|
2284 a.arora 1.82 return(request.release());
|
2285 mike 1.2 }
2286
2287 CIMEnumerateInstanceNamesRequestMessage* CIMOperationRequestDecoder::decodeEnumerateInstanceNamesRequest(
|
2288 mday 1.16 Uint32 queueId,
|
2289 chip 1.92 XmlParser& parser,
|
2290 mday 1.16 const String& messageId,
|
2291 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2292 mday 1.16 {
|
2293 sage 1.41 STAT_GETSTARTTIME
2294
|
2295 kumpf 1.52 CIMName className;
|
2296 mday 1.16 Boolean duplicateParameter = false;
2297 Boolean gotClassName = false;
|
2298 kumpf 1.84 Boolean emptyTag;
|
2299 mday 1.16
|
2300 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2301 mday 1.16 {
|
2302 kumpf 1.51 if (System::strcasecmp(name, "ClassName") == 0)
|
2303 mday 1.16 {
|
2304 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2305 mday 1.16 XmlReader::getClassNameElement(parser, className, true);
2306 duplicateParameter = gotClassName;
2307 gotClassName = true;
2308 }
2309 else
2310 {
|
2311 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2312 mday 1.16 }
2313
|
2314 kumpf 1.84 if (!emptyTag)
2315 {
2316 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2317 }
|
2318 mday 1.16
2319 if (duplicateParameter)
2320 {
|
2321 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2322 mday 1.16 }
2323 }
2324
2325 if (!gotClassName)
2326 {
|
2327 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2328 mday 1.16 }
2329
|
2330 a.arora 1.82 AutoPtr<CIMEnumerateInstanceNamesRequestMessage> request(
|
2331 mday 1.16 new CIMEnumerateInstanceNamesRequestMessage(
2332 messageId,
2333 nameSpace,
2334 className,
|
2335 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2336 mike 1.2
|
2337 sage 1.41 STAT_SERVERSTART
2338
|
2339 a.arora 1.82 return(request.release());
|
2340 mike 1.2 }
2341
2342 CIMDeleteInstanceRequestMessage* CIMOperationRequestDecoder::decodeDeleteInstanceRequest(
|
2343 mday 1.16 Uint32 queueId,
|
2344 chip 1.92 XmlParser& parser,
|
2345 mday 1.16 const String& messageId,
|
2346 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2347 mday 1.16 {
|
2348 sage 1.41 STAT_GETSTARTTIME
2349
|
2350 kumpf 1.42 CIMObjectPath instanceName;
|
2351 mday 1.16 Boolean duplicateParameter = false;
2352 Boolean gotInstanceName = false;
|
2353 kumpf 1.84 Boolean emptyTag;
|
2354 mday 1.16
|
2355 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2356 mday 1.16 {
|
2357 kumpf 1.51 if (System::strcasecmp(name, "InstanceName") == 0)
|
2358 mday 1.16 {
|
2359 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2360 mday 1.16 XmlReader::getInstanceNameElement(parser, instanceName);
2361 duplicateParameter = gotInstanceName;
2362 gotInstanceName = true;
2363 }
2364 else
2365 {
|
2366 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2367 mday 1.16 }
2368
|
2369 kumpf 1.84 if (!emptyTag)
2370 {
2371 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2372 }
|
2373 mday 1.16
2374 if (duplicateParameter)
2375 {
|
2376 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2377 mday 1.16 }
2378 }
2379
2380 if (!gotInstanceName)
2381 {
|
2382 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2383 mday 1.16 }
2384
|
2385 a.arora 1.82 AutoPtr<CIMDeleteInstanceRequestMessage> request(new CIMDeleteInstanceRequestMessage(
|
2386 mday 1.16 messageId,
2387 nameSpace,
2388 instanceName,
|
2389 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2390 mike 1.2
|
2391 sage 1.41 STAT_SERVERSTART
2392
|
2393 a.arora 1.82 return(request.release());
|
2394 mike 1.2 }
2395
2396 CIMSetQualifierRequestMessage* CIMOperationRequestDecoder::decodeSetQualifierRequest(
|
2397 mday 1.16 Uint32 queueId,
|
2398 chip 1.92 XmlParser& parser,
|
2399 mday 1.16 const String& messageId,
|
2400 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2401 mday 1.16 {
|
2402 sage 1.41 STAT_GETSTARTTIME
2403
|
2404 mday 1.16 CIMQualifierDecl qualifierDeclaration;
2405 Boolean duplicateParameter = false;
2406 Boolean gotQualifierDeclaration = false;
|
2407 kumpf 1.84 Boolean emptyTag;
|
2408 mday 1.16
|
2409 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2410 mday 1.16 {
|
2411 kumpf 1.51 if (System::strcasecmp(name, "QualifierDeclaration") == 0)
|
2412 mday 1.16 {
|
2413 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2414 mday 1.16 XmlReader::getQualifierDeclElement(parser, qualifierDeclaration);
2415 duplicateParameter = gotQualifierDeclaration;
2416 gotQualifierDeclaration = true;
2417 }
2418 else
2419 {
|
2420 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2421 mday 1.16 }
2422
|
2423 kumpf 1.84 if (!emptyTag)
2424 {
2425 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2426 }
|
2427 mday 1.16
2428 if (duplicateParameter)
2429 {
|
2430 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2431 mday 1.16 }
2432 }
2433
2434 if (!gotQualifierDeclaration)
2435 {
|
2436 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2437 mday 1.16 }
2438
|
2439 a.arora 1.82 AutoPtr<CIMSetQualifierRequestMessage> request(
|
2440 mday 1.16 new CIMSetQualifierRequestMessage(
2441 messageId,
2442 nameSpace,
2443 qualifierDeclaration,
|
2444 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2445 mike 1.2
|
2446 sage 1.41 STAT_SERVERSTART
2447
|
2448 a.arora 1.82 return(request.release());
|
2449 mike 1.2 }
2450
2451 CIMGetQualifierRequestMessage* CIMOperationRequestDecoder::decodeGetQualifierRequest(
|
2452 mday 1.16 Uint32 queueId,
|
2453 chip 1.92 XmlParser& parser,
|
2454 mday 1.16 const String& messageId,
|
2455 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2456 mday 1.16 {
|
2457 sage 1.41 STAT_GETSTARTTIME
2458
|
2459 kumpf 1.54 String qualifierNameString;
|
2460 kumpf 1.52 CIMName qualifierName;
|
2461 mday 1.16 Boolean duplicateParameter = false;
2462 Boolean gotQualifierName = false;
|
2463 kumpf 1.84 Boolean emptyTag;
|
2464 mday 1.16
|
2465 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2466 mday 1.16 {
|
2467 kumpf 1.51 if (System::strcasecmp(name, "QualifierName") == 0)
|
2468 mday 1.16 {
|
2469 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2470 kumpf 1.54 XmlReader::getStringValueElement(parser, qualifierNameString, true);
2471 qualifierName = qualifierNameString;
|
2472 mday 1.16 duplicateParameter = gotQualifierName;
2473 gotQualifierName = true;
2474 }
2475 else
2476 {
|
2477 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2478 mday 1.16 }
2479
|
2480 kumpf 1.84 if (!emptyTag)
2481 {
2482 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2483 }
|
2484 mday 1.16
2485 if (duplicateParameter)
2486 {
|
2487 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2488 mday 1.16 }
2489 }
2490
2491 if (!gotQualifierName)
2492 {
|
2493 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2494 mday 1.16 }
2495
|
2496 a.arora 1.82 AutoPtr<CIMGetQualifierRequestMessage> request(
|
2497 mday 1.16 new CIMGetQualifierRequestMessage(
2498 messageId,
2499 nameSpace,
2500 qualifierName,
|
2501 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2502 mike 1.2
|
2503 sage 1.41 STAT_SERVERSTART
2504
|
2505 a.arora 1.82 return(request.release());
|
2506 mike 1.2 }
2507
2508 CIMEnumerateQualifiersRequestMessage* CIMOperationRequestDecoder::decodeEnumerateQualifiersRequest(
|
2509 mday 1.16 Uint32 queueId,
|
2510 chip 1.92 XmlParser& parser,
|
2511 mday 1.16 const String& messageId,
|
2512 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2513 mday 1.16 {
|
2514 sage 1.41 STAT_GETSTARTTIME
|
2515 kumpf 1.84 Boolean emptyTag;
|
2516 sage 1.41
|
2517 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2518 mday 1.16 {
2519 // No IPARAMVALUEs are defined for this operation
|
2520 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2521 mday 1.16 }
2522
|
2523 a.arora 1.82 AutoPtr<CIMEnumerateQualifiersRequestMessage> request(
|
2524 mday 1.16 new CIMEnumerateQualifiersRequestMessage(
2525 messageId,
2526 nameSpace,
|
2527 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2528 mike 1.2
|
2529 sage 1.41 STAT_SERVERSTART
2530
|
2531 a.arora 1.82 return(request.release());
|
2532 mike 1.2 }
2533
2534 CIMDeleteQualifierRequestMessage* CIMOperationRequestDecoder::decodeDeleteQualifierRequest(
|
2535 mday 1.16 Uint32 queueId,
|
2536 chip 1.92 XmlParser& parser,
|
2537 mday 1.16 const String& messageId,
|
2538 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2539 mday 1.16 {
|
2540 sage 1.41 STAT_GETSTARTTIME
2541
|
2542 kumpf 1.54 String qualifierNameString;
|
2543 kumpf 1.52 CIMName qualifierName;
|
2544 mday 1.16 Boolean duplicateParameter = false;
2545 Boolean gotQualifierName = false;
|
2546 kumpf 1.84 Boolean emptyTag;
|
2547 mday 1.16
|
2548 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2549 mday 1.16 {
|
2550 kumpf 1.51 if (System::strcasecmp(name, "QualifierName") == 0)
|
2551 mday 1.16 {
|
2552 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2553 kumpf 1.54 XmlReader::getStringValueElement(parser, qualifierNameString, true);
2554 qualifierName = qualifierNameString;
|
2555 mday 1.16 duplicateParameter = gotQualifierName;
2556 gotQualifierName = true;
2557 }
2558 else
2559 {
|
2560 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2561 mday 1.16 }
2562
|
2563 kumpf 1.84 if (!emptyTag)
2564 {
2565 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2566 }
|
2567 mday 1.16
2568 if (duplicateParameter)
2569 {
|
2570 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2571 mday 1.16 }
2572 }
2573
2574 if (!gotQualifierName)
2575 {
|
2576 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2577 mday 1.16 }
2578
|
2579 a.arora 1.82 AutoPtr<CIMDeleteQualifierRequestMessage> request(
|
2580 mday 1.16 new CIMDeleteQualifierRequestMessage(
2581 messageId,
2582 nameSpace,
2583 qualifierName,
|
2584 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2585 mike 1.2
|
2586 sage 1.41 STAT_SERVERSTART
2587
|
2588 a.arora 1.82 return(request.release());
|
2589 mike 1.2 }
2590
2591 CIMReferenceNamesRequestMessage* CIMOperationRequestDecoder::decodeReferenceNamesRequest(
|
2592 mday 1.16 Uint32 queueId,
|
2593 chip 1.92 XmlParser& parser,
|
2594 mday 1.16 const String& messageId,
|
2595 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2596 mday 1.16 {
|
2597 sage 1.41 STAT_GETSTARTTIME
2598
|
2599 kumpf 1.42 CIMObjectPath objectName;
|
2600 kumpf 1.52 CIMName resultClass;
|
2601 mday 1.16 String role;
2602 Boolean duplicateParameter = false;
2603 Boolean gotObjectName = false;
2604 Boolean gotResultClass = false;
2605 Boolean gotRole = false;
|
2606 kumpf 1.84 Boolean emptyTag;
|
2607 mday 1.16
|
2608 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2609 mday 1.16 {
|
2610 kumpf 1.51 if (System::strcasecmp(name, "ObjectName") == 0)
|
2611 mday 1.16 {
|
2612 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2613 mday 1.16 XmlReader::getObjectNameElement(parser, objectName);
2614 duplicateParameter = gotObjectName;
2615 gotObjectName = true;
2616 }
|
2617 kumpf 1.51 else if (System::strcasecmp(name, "ResultClass") == 0)
|
2618 mday 1.16 {
|
2619 kumpf 1.55 //
2620 // ResultClass may be NULL
2621 //
|
2622 kumpf 1.84 if (!emptyTag)
2623 {
2624 XmlReader::getClassNameElement(parser, resultClass, false);
2625 }
|
2626 mday 1.16 duplicateParameter = gotResultClass;
2627 gotResultClass = true;
2628 }
|
2629 kumpf 1.51 else if (System::strcasecmp(name, "Role") == 0)
|
2630 mday 1.16 {
|
2631 kumpf 1.55 //
2632 // Role may be NULL
2633 //
|
2634 kumpf 1.84 if (!emptyTag)
2635 {
2636 XmlReader::getStringValueElement(parser, role, false);
2637 }
|
2638 mday 1.16 duplicateParameter = gotRole;
2639 gotRole = true;
2640 }
2641 else
2642 {
|
2643 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2644 mday 1.16 }
2645
|
2646 kumpf 1.84 if (!emptyTag)
2647 {
2648 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2649 }
|
2650 mday 1.16
2651 if (duplicateParameter)
2652 {
|
2653 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2654 mday 1.16 }
2655 }
2656
2657 if (!gotObjectName)
2658 {
|
2659 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2660 mday 1.16 }
2661
|
2662 a.arora 1.82 AutoPtr<CIMReferenceNamesRequestMessage> request(
|
2663 mday 1.16 new CIMReferenceNamesRequestMessage(
2664 messageId,
2665 nameSpace,
2666 objectName,
2667 resultClass,
2668 role,
|
2669 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2670 mike 1.2
|
2671 sage 1.41 STAT_SERVERSTART
2672
|
2673 a.arora 1.82 return(request.release());
|
2674 mike 1.2 }
2675
2676 CIMReferencesRequestMessage* CIMOperationRequestDecoder::decodeReferencesRequest(
|
2677 mday 1.16 Uint32 queueId,
|
2678 chip 1.92 XmlParser& parser,
|
2679 mday 1.16 const String& messageId,
|
2680 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2681 mday 1.16 {
|
2682 sage 1.41 STAT_GETSTARTTIME
2683
|
2684 kumpf 1.42 CIMObjectPath objectName;
|
2685 kumpf 1.52 CIMName resultClass;
|
2686 mday 1.16 String role;
2687 Boolean includeQualifiers = false;
2688 Boolean includeClassOrigin = false;
2689 CIMPropertyList propertyList;
2690 Boolean duplicateParameter = false;
2691 Boolean gotObjectName = false;
2692 Boolean gotResultClass = false;
2693 Boolean gotRole = false;
2694 Boolean gotIncludeQualifiers = false;
2695 Boolean gotIncludeClassOrigin = false;
2696 Boolean gotPropertyList = false;
|
2697 kumpf 1.84 Boolean emptyTag;
|
2698 mday 1.16
|
2699 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2700 mday 1.16 {
|
2701 kumpf 1.51 if (System::strcasecmp(name, "ObjectName") == 0)
|
2702 mday 1.16 {
|
2703 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2704 mday 1.16 XmlReader::getObjectNameElement(parser, objectName);
2705 duplicateParameter = gotObjectName;
2706 gotObjectName = true;
2707 }
|
2708 kumpf 1.51 else if (System::strcasecmp(name, "ResultClass") == 0)
|
2709 mday 1.16 {
|
2710 kumpf 1.55 //
2711 // ResultClass may be NULL
2712 //
|
2713 kumpf 1.84 if (!emptyTag)
2714 {
2715 XmlReader::getClassNameElement(parser, resultClass, false);
2716 }
|
2717 mday 1.16 duplicateParameter = gotResultClass;
2718 gotResultClass = true;
2719 }
|
2720 kumpf 1.51 else if (System::strcasecmp(name, "Role") == 0)
|
2721 mday 1.16 {
|
2722 kumpf 1.55 //
2723 // Role may be NULL
2724 //
|
2725 kumpf 1.84 if (!emptyTag)
2726 {
2727 XmlReader::getStringValueElement(parser, role, false);
2728 }
|
2729 mday 1.16 duplicateParameter = gotRole;
2730 gotRole = true;
2731 }
|
2732 kumpf 1.51 else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
|
2733 mday 1.16 {
|
2734 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2735 mday 1.16 XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
2736 duplicateParameter = gotIncludeQualifiers;
2737 gotIncludeQualifiers = true;
2738 }
|
2739 kumpf 1.51 else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
|
2740 mday 1.16 {
|
2741 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2742 mday 1.16 XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
2743 duplicateParameter = gotIncludeClassOrigin;
2744 gotIncludeClassOrigin = true;
2745 }
|
2746 kumpf 1.51 else if (System::strcasecmp(name, "PropertyList") == 0)
|
2747 mday 1.16 {
|
2748 kumpf 1.84 if (!emptyTag)
2749 {
2750 CIMValue pl;
2751 if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
|
2752 kumpf 1.49 {
|
2753 kumpf 1.84 Array<String> propertyListArray;
2754 pl.get(propertyListArray);
2755 Array<CIMName> cimNameArray;
2756 for (Uint32 i = 0; i < propertyListArray.size(); i++)
2757 {
2758 cimNameArray.append(propertyListArray[i]);
2759 }
2760 propertyList.set(cimNameArray);
|
2761 kumpf 1.49 }
|
2762 kumpf 1.84 }
|
2763 mday 1.16 duplicateParameter = gotPropertyList;
2764 gotPropertyList = true;
2765 }
2766 else
2767 {
|
2768 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2769 mday 1.16 }
2770
|
2771 kumpf 1.84 if (!emptyTag)
2772 {
2773 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2774 }
|
2775 mday 1.16
2776 if (duplicateParameter)
2777 {
|
2778 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2779 mday 1.16 }
2780 }
2781
2782 if (!gotObjectName)
2783 {
|
2784 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2785 mday 1.16 }
2786
|
2787 a.arora 1.82 AutoPtr<CIMReferencesRequestMessage> request(
|
2788 mday 1.16 new CIMReferencesRequestMessage(
2789 messageId,
2790 nameSpace,
2791 objectName,
2792 resultClass,
2793 role,
2794 includeQualifiers,
2795 includeClassOrigin,
2796 propertyList,
|
2797 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2798 mike 1.2
|
2799 sage 1.41 STAT_SERVERSTART
2800
|
2801 a.arora 1.82 return(request.release());
|
2802 mike 1.2 }
2803
2804 CIMAssociatorNamesRequestMessage* CIMOperationRequestDecoder::decodeAssociatorNamesRequest(
|
2805 mday 1.16 Uint32 queueId,
|
2806 chip 1.92 XmlParser& parser,
|
2807 mday 1.16 const String& messageId,
|
2808 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2809 mday 1.16 {
|
2810 sage 1.41 STAT_GETSTARTTIME
2811
|
2812 kumpf 1.42 CIMObjectPath objectName;
|
2813 kumpf 1.52 CIMName assocClass;
2814 CIMName resultClass;
|
2815 mday 1.16 String role;
2816 String resultRole;
2817 Boolean duplicateParameter = false;
2818 Boolean gotObjectName = false;
2819 Boolean gotAssocClass = false;
2820 Boolean gotResultClass = false;
2821 Boolean gotRole = false;
2822 Boolean gotResultRole = false;
|
2823 kumpf 1.84 Boolean emptyTag;
|
2824 mday 1.16
|
2825 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2826 mday 1.16 {
|
2827 kumpf 1.51 if (System::strcasecmp(name, "ObjectName") == 0)
|
2828 mday 1.16 {
|
2829 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2830 mday 1.16 XmlReader::getObjectNameElement(parser, objectName);
2831 duplicateParameter = gotObjectName;
2832 gotObjectName = true;
2833 }
|
2834 kumpf 1.51 else if (System::strcasecmp(name, "AssocClass") == 0)
|
2835 mday 1.16 {
|
2836 kumpf 1.55 //
2837 // AssocClass may be NULL
2838 //
|
2839 kumpf 1.84 if (!emptyTag)
2840 {
2841 XmlReader::getClassNameElement(parser, assocClass, false);
2842 }
|
2843 mday 1.16 duplicateParameter = gotAssocClass;
2844 gotAssocClass = true;
2845 }
|
2846 kumpf 1.51 else if (System::strcasecmp(name, "ResultClass") == 0)
|
2847 mday 1.16 {
|
2848 kumpf 1.55 //
2849 // ResultClass may be NULL
2850 //
|
2851 kumpf 1.84 if (!emptyTag)
2852 {
2853 XmlReader::getClassNameElement(parser, resultClass, false);
2854 }
|
2855 mday 1.16 duplicateParameter = gotResultClass;
2856 gotResultClass = true;
2857 }
|
2858 kumpf 1.51 else if (System::strcasecmp(name, "Role") == 0)
|
2859 mday 1.16 {
|
2860 kumpf 1.55 //
2861 // Role may be NULL
2862 //
|
2863 kumpf 1.84 if (!emptyTag)
2864 {
2865 XmlReader::getStringValueElement(parser, role, false);
2866 }
|
2867 mday 1.16 duplicateParameter = gotRole;
2868 gotRole = true;
2869 }
|
2870 kumpf 1.51 else if (System::strcasecmp(name, "ResultRole") == 0)
|
2871 mday 1.16 {
|
2872 kumpf 1.55 //
2873 // ResultRole may be NULL
2874 //
|
2875 kumpf 1.84 if (!emptyTag)
2876 {
2877 XmlReader::getStringValueElement(parser, resultRole, false);
2878 }
|
2879 mday 1.16 duplicateParameter = gotResultRole;
2880 gotResultRole = true;
2881 }
2882 else
2883 {
|
2884 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2885 mday 1.16 }
2886
|
2887 kumpf 1.84 if (!emptyTag)
2888 {
2889 XmlReader::expectEndTag(parser, "IPARAMVALUE");
2890 }
|
2891 mday 1.16
2892 if (duplicateParameter)
2893 {
|
2894 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2895 mday 1.16 }
2896 }
2897
2898 if (!gotObjectName)
2899 {
|
2900 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
2901 mday 1.16 }
2902
|
2903 a.arora 1.82 AutoPtr<CIMAssociatorNamesRequestMessage> request(
|
2904 mday 1.16 new CIMAssociatorNamesRequestMessage(
2905 messageId,
2906 nameSpace,
2907 objectName,
2908 assocClass,
2909 resultClass,
2910 role,
2911 resultRole,
|
2912 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
2913 mike 1.2
|
2914 sage 1.41 STAT_SERVERSTART
2915
|
2916 a.arora 1.82 return(request.release());
|
2917 mike 1.2 }
2918
2919 CIMAssociatorsRequestMessage* CIMOperationRequestDecoder::decodeAssociatorsRequest(
|
2920 mday 1.16 Uint32 queueId,
|
2921 chip 1.92 XmlParser& parser,
|
2922 mday 1.16 const String& messageId,
|
2923 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
2924 mday 1.16 {
|
2925 sage 1.41 STAT_GETSTARTTIME
2926
|
2927 kumpf 1.42 CIMObjectPath objectName;
|
2928 kumpf 1.52 CIMName assocClass;
2929 CIMName resultClass;
|
2930 mday 1.16 String role;
2931 String resultRole;
2932 Boolean includeQualifiers = false;
2933 Boolean includeClassOrigin = false;
2934 CIMPropertyList propertyList;
2935 Boolean duplicateParameter = false;
2936 Boolean gotObjectName = false;
2937 Boolean gotAssocClass = false;
2938 Boolean gotResultClass = false;
2939 Boolean gotRole = false;
2940 Boolean gotResultRole = false;
2941 Boolean gotIncludeQualifiers = false;
2942 Boolean gotIncludeClassOrigin = false;
2943 Boolean gotPropertyList = false;
|
2944 kumpf 1.84 Boolean emptyTag;
|
2945 mday 1.16
|
2946 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
2947 mday 1.16 {
|
2948 kumpf 1.51 if (System::strcasecmp(name, "ObjectName") == 0)
|
2949 mday 1.16 {
|
2950 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
2951 mday 1.16 XmlReader::getObjectNameElement(parser, objectName);
2952 duplicateParameter = gotObjectName;
2953 gotObjectName = true;
2954 }
|
2955 kumpf 1.51 else if (System::strcasecmp(name, "AssocClass") == 0)
|
2956 mday 1.16 {
|
2957 kumpf 1.55 //
2958 // AssocClass may be NULL
2959 //
|
2960 kumpf 1.84 if (!emptyTag)
2961 {
2962 XmlReader::getClassNameElement(parser, assocClass, false);
2963 }
|
2964 mday 1.16 duplicateParameter = gotAssocClass;
2965 gotAssocClass = true;
2966 }
|
2967 kumpf 1.51 else if (System::strcasecmp(name, "ResultClass") == 0)
|
2968 mday 1.16 {
|
2969 kumpf 1.55 //
2970 // ResultClass may be NULL
2971 //
|
2972 kumpf 1.84 if (!emptyTag)
2973 {
2974 XmlReader::getClassNameElement(parser, resultClass, false);
2975 }
|
2976 mday 1.16 duplicateParameter = gotResultClass;
2977 gotResultClass = true;
2978 }
|
2979 kumpf 1.51 else if (System::strcasecmp(name, "Role") == 0)
|
2980 mday 1.16 {
|
2981 kumpf 1.55 //
2982 // Role may be NULL
2983 //
|
2984 kumpf 1.84 if (!emptyTag)
2985 {
2986 XmlReader::getStringValueElement(parser, role, false);
2987 }
|
2988 mday 1.16 duplicateParameter = gotRole;
2989 gotRole = true;
2990 }
|
2991 kumpf 1.51 else if (System::strcasecmp(name, "ResultRole") == 0)
|
2992 mday 1.16 {
|
2993 kumpf 1.55 //
2994 // ResultRole may be NULL
2995 //
|
2996 kumpf 1.84 if (!emptyTag)
2997 {
2998 XmlReader::getStringValueElement(parser, resultRole, false);
2999 }
|
3000 mday 1.16 duplicateParameter = gotResultRole;
3001 gotResultRole = true;
3002 }
|
3003 kumpf 1.51 else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
|
3004 mday 1.16 {
|
3005 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
3006 mday 1.16 XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
3007 duplicateParameter = gotIncludeQualifiers;
3008 gotIncludeQualifiers = true;
3009 }
|
3010 kumpf 1.51 else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
|
3011 mday 1.16 {
|
3012 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
3013 mday 1.16 XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
3014 duplicateParameter = gotIncludeClassOrigin;
3015 gotIncludeClassOrigin = true;
3016 }
|
3017 kumpf 1.51 else if (System::strcasecmp(name, "PropertyList") == 0)
|
3018 mday 1.16 {
|
3019 kumpf 1.84 if (!emptyTag)
3020 {
3021 CIMValue pl;
3022 if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
|
3023 kumpf 1.49 {
|
3024 kumpf 1.84 Array<String> propertyListArray;
3025 pl.get(propertyListArray);
3026 Array<CIMName> cimNameArray;
3027 for (Uint32 i = 0; i < propertyListArray.size(); i++)
3028 {
3029 cimNameArray.append(propertyListArray[i]);
3030 }
3031 propertyList.set(cimNameArray);
|
3032 kumpf 1.49 }
|
3033 kumpf 1.84 }
|
3034 mday 1.16 duplicateParameter = gotPropertyList;
3035 gotPropertyList = true;
3036 }
3037 else
3038 {
|
3039 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
3040 mday 1.16 }
3041
|
3042 kumpf 1.84 if (!emptyTag)
3043 {
3044 XmlReader::expectEndTag(parser, "IPARAMVALUE");
3045 }
|
3046 mday 1.16
3047 if (duplicateParameter)
3048 {
|
3049 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
3050 mday 1.16 }
3051 }
3052
3053 if (!gotObjectName)
3054 {
|
3055 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
3056 mday 1.16 }
3057
|
3058 a.arora 1.82 AutoPtr<CIMAssociatorsRequestMessage> request(
|
3059 mday 1.16 new CIMAssociatorsRequestMessage(
3060 messageId,
3061 nameSpace,
3062 objectName,
3063 assocClass,
3064 resultClass,
3065 role,
3066 resultRole,
3067 includeQualifiers,
3068 includeClassOrigin,
3069 propertyList,
|
3070 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
3071 mike 1.2
|
3072 sage 1.41 STAT_SERVERSTART
3073
|
3074 a.arora 1.82 return(request.release());
|
3075 mike 1.2 }
3076
3077 CIMGetPropertyRequestMessage* CIMOperationRequestDecoder::decodeGetPropertyRequest(
|
3078 mday 1.16 Uint32 queueId,
|
3079 chip 1.92 XmlParser& parser,
|
3080 mday 1.16 const String& messageId,
|
3081 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
3082 mday 1.16 {
|
3083 sage 1.41 STAT_GETSTARTTIME
3084
|
3085 kumpf 1.42 CIMObjectPath instanceName;
|
3086 mday 1.16 String propertyName;
3087 Boolean duplicateParameter = false;
3088 Boolean gotInstanceName = false;
3089 Boolean gotPropertyName = false;
|
3090 kumpf 1.84 Boolean emptyTag;
|
3091 mday 1.16
|
3092 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
3093 mday 1.16 {
|
3094 kumpf 1.51 if (System::strcasecmp(name, "InstanceName") == 0)
|
3095 mday 1.16 {
|
3096 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
3097 mday 1.16 XmlReader::getInstanceNameElement(parser, instanceName);
3098 duplicateParameter = gotInstanceName;
3099 gotInstanceName = true;
3100 }
|
3101 kumpf 1.51 else if (System::strcasecmp(name, "PropertyName") == 0)
|
3102 mday 1.16 {
|
3103 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
3104 mday 1.16 XmlReader::getStringValueElement(parser, propertyName, true);
3105 duplicateParameter = gotPropertyName;
3106 gotPropertyName = true;
3107 }
3108 else
3109 {
|
3110 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
3111 mday 1.16 }
3112
|
3113 kumpf 1.84 if (!emptyTag)
3114 {
3115 XmlReader::expectEndTag(parser, "IPARAMVALUE");
3116 }
|
3117 mday 1.16
3118 if (duplicateParameter)
3119 {
|
3120 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
3121 mday 1.16 }
3122 }
3123
3124 if (!gotInstanceName || !gotPropertyName)
3125 {
|
3126 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
3127 mday 1.16 }
3128
|
3129 a.arora 1.82 AutoPtr<CIMGetPropertyRequestMessage> request(new CIMGetPropertyRequestMessage(
|
3130 mday 1.16 messageId,
3131 nameSpace,
3132 instanceName,
3133 propertyName,
|
3134 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
3135 mike 1.2
|
3136 sage 1.41 STAT_SERVERSTART
3137
|
3138 a.arora 1.82 return(request.release());
|
3139 mike 1.2 }
3140
3141 CIMSetPropertyRequestMessage* CIMOperationRequestDecoder::decodeSetPropertyRequest(
|
3142 mday 1.16 Uint32 queueId,
|
3143 chip 1.92 XmlParser& parser,
|
3144 mday 1.16 const String& messageId,
|
3145 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
3146 mday 1.16 {
|
3147 sage 1.41 STAT_GETSTARTTIME
3148
|
3149 kumpf 1.42 CIMObjectPath instanceName;
|
3150 mday 1.16 String propertyName;
3151 CIMValue propertyValue;
3152 Boolean duplicateParameter = false;
3153 Boolean gotInstanceName = false;
3154 Boolean gotPropertyName = false;
3155 Boolean gotNewValue = false;
|
3156 kumpf 1.84 Boolean emptyTag;
|
3157 mday 1.16
|
3158 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
3159 mday 1.16 {
|
3160 kumpf 1.51 if (System::strcasecmp(name, "InstanceName") == 0)
|
3161 mday 1.16 {
|
3162 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
3163 mday 1.16 XmlReader::getInstanceNameElement(parser, instanceName);
3164 duplicateParameter = gotInstanceName;
3165 gotInstanceName = true;
3166 }
|
3167 kumpf 1.51 else if (System::strcasecmp(name, "PropertyName") == 0)
|
3168 mday 1.16 {
|
3169 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
3170 mday 1.16 XmlReader::getStringValueElement(parser, propertyName, true);
3171 duplicateParameter = gotPropertyName;
3172 gotPropertyName = true;
3173 }
|
3174 kumpf 1.51 else if (System::strcasecmp(name, "NewValue") == 0)
|
3175 mday 1.16 {
|
3176 kumpf 1.84 if (emptyTag || !XmlReader::getPropertyValue(parser, propertyValue))
3177 {
|
3178 kumpf 1.48 propertyValue.setNullValue(CIMTYPE_STRING, false);
|
3179 kumpf 1.84 }
|
3180 mday 1.16 duplicateParameter = gotNewValue;
3181 gotNewValue = true;
3182 }
3183 else
3184 {
|
3185 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
3186 mday 1.16 }
3187
|
3188 kumpf 1.84 if (!emptyTag)
3189 {
3190 XmlReader::expectEndTag(parser, "IPARAMVALUE");
3191 }
|
3192 mday 1.16
3193 if (duplicateParameter)
3194 {
|
3195 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
3196 mday 1.16 }
3197 }
3198
3199 if (!gotInstanceName || !gotPropertyName)
3200 {
|
3201 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
3202 mday 1.16 }
3203
|
3204 a.arora 1.82 AutoPtr<CIMSetPropertyRequestMessage> request(new CIMSetPropertyRequestMessage(
|
3205 mday 1.16 messageId,
3206 nameSpace,
3207 instanceName,
3208 propertyName,
3209 propertyValue,
|
3210 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
3211 kumpf 1.29
|
3212 sage 1.41 STAT_SERVERSTART
3213
|
3214 a.arora 1.82 return(request.release());
|
3215 kumpf 1.29 }
3216
3217 CIMExecQueryRequestMessage* CIMOperationRequestDecoder::decodeExecQueryRequest(
3218 Uint32 queueId,
|
3219 chip 1.92 XmlParser& parser,
|
3220 kumpf 1.29 const String& messageId,
|
3221 kumpf 1.101 const CIMNamespaceName& nameSpace)
|
3222 kumpf 1.29 {
|
3223 sage 1.41 STAT_GETSTARTTIME
3224
|
3225 kumpf 1.29 String queryLanguage;
3226 String query;
3227 Boolean duplicateParameter = false;
3228 Boolean gotQueryLanguage = false;
3229 Boolean gotQuery = false;
|
3230 kumpf 1.84 Boolean emptyTag;
|
3231 kumpf 1.29
|
3232 kumpf 1.84 for (const char* name; XmlReader::getIParamValueTag(parser, name, emptyTag);)
|
3233 kumpf 1.29 {
|
3234 kumpf 1.51 if (System::strcasecmp(name, "QueryLanguage") == 0)
|
3235 kumpf 1.29 {
|
3236 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
3237 kumpf 1.29 XmlReader::getStringValueElement(parser, queryLanguage, true);
3238 duplicateParameter = gotQueryLanguage;
3239 gotQueryLanguage = true;
3240 }
|
3241 kumpf 1.51 else if (System::strcasecmp(name, "Query") == 0)
|
3242 kumpf 1.29 {
|
3243 kumpf 1.84 XmlReader::rejectNullIParamValue(parser, emptyTag, name);
|
3244 kumpf 1.29 XmlReader::getStringValueElement(parser, query, true);
3245 duplicateParameter = gotQuery;
3246 gotQuery = true;
3247 }
3248 else
3249 {
|
3250 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
3251 kumpf 1.29 }
3252
|
3253 kumpf 1.84 if (!emptyTag)
3254 {
3255 XmlReader::expectEndTag(parser, "IPARAMVALUE");
3256 }
|
3257 kumpf 1.29
3258 if (duplicateParameter)
3259 {
|
3260 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
3261 kumpf 1.29 }
3262 }
3263
3264 if (!gotQueryLanguage || !gotQuery)
3265 {
|
3266 kumpf 1.50 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
|
3267 kumpf 1.29 }
3268
|
3269 a.arora 1.82 AutoPtr<CIMExecQueryRequestMessage> request(
|
3270 kumpf 1.29 new CIMExecQueryRequestMessage(
3271 messageId,
3272 nameSpace,
3273 queryLanguage,
3274 query,
|
3275 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
3276 mike 1.2
|
3277 sage 1.41 STAT_SERVERSTART
3278
|
3279 a.arora 1.82 return(request.release());
|
3280 mike 1.2 }
3281
3282 CIMInvokeMethodRequestMessage* CIMOperationRequestDecoder::decodeInvokeMethodRequest(
|
3283 mday 1.16 Uint32 queueId,
|
3284 chip 1.92 XmlParser& parser,
|
3285 mday 1.16 const String& messageId,
|
3286 kumpf 1.42 const CIMObjectPath& reference,
|
3287 kumpf 1.101 const String& cimMethodName)
|
3288 mike 1.2 {
|
3289 sage 1.41 STAT_GETSTARTTIME
3290
|
3291 mday 1.16 CIMParamValue paramValue;
3292 Array<CIMParamValue> inParameters;
|
3293 chip 1.92
|
3294 mday 1.16 while (XmlReader::getParamValueElement(parser, paramValue))
3295 {
3296 inParameters.append(paramValue);
3297 }
3298
|
3299 a.arora 1.82 AutoPtr<CIMInvokeMethodRequestMessage> request(
|
3300 mday 1.16 new CIMInvokeMethodRequestMessage(
|
3301 chip 1.92 messageId,
3302 reference.getNameSpace(),
3303 reference,
|
3304 kumpf 1.43 cimMethodName,
|
3305 mday 1.16 inParameters,
|
3306 kumpf 1.101 QueueIdStack(queueId, _returnQueueId)));
|
3307 kumpf 1.9
|
3308 sage 1.41 STAT_SERVERSTART
|
3309 mike 1.2
|
3310 a.arora 1.82 return(request.release());
|
3311 mike 1.2 }
3312
3313 void CIMOperationRequestDecoder::setServerTerminating(Boolean flag)
3314 {
|
3315 mday 1.16 _serverTerminating = flag;
|
3316 mike 1.2 }
3317
3318 PEGASUS_NAMESPACE_END
|