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