1 karl 1.29 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 karl 1.23 // 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.18 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.23 // 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.25 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.29 // 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 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
|
20 kumpf 1.10 //
|
21 mike 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 #include <Pegasus/Common/Config.h>
35 #include <iostream>
|
36 kumpf 1.7 #include <Pegasus/Common/Constants.h>
|
37 mike 1.2 #include <Pegasus/Common/XmlWriter.h>
38 #include <Pegasus/Common/HTTPMessage.h>
|
39 kumpf 1.28 #include <Pegasus/Common/AcceptLanguageList.h>
40 #include <Pegasus/Common/ContentLanguageList.h>
|
41 mike 1.2 #include "CIMExportRequestEncoder.h"
42
43 PEGASUS_USING_STD;
44
45 PEGASUS_NAMESPACE_BEGIN
46
47 CIMExportRequestEncoder::CIMExportRequestEncoder(
|
48 kumpf 1.22 MessageQueue* outputQueue,
49 const String& hostName,
50 ClientAuthenticator* authenticator)
|
51 mday 1.4 :
|
52 kumpf 1.15 MessageQueue(PEGASUS_QUEUENAME_EXPORTREQENCODER),
|
53 mday 1.4 _outputQueue(outputQueue),
|
54 kumpf 1.22 _hostName(hostName.getCString()),
|
55 mday 1.4 _authenticator(authenticator)
|
56 mike 1.2 {
|
57 kumpf 1.20 PEG_METHOD_ENTER (TRC_EXPORT_CLIENT, "CIMExportRequestEncoder::CIMExportRequestEncoder()");
58 PEG_METHOD_EXIT();
|
59 mike 1.2 }
60
61 CIMExportRequestEncoder::~CIMExportRequestEncoder()
62 {
|
63 kumpf 1.20 PEG_METHOD_ENTER (TRC_EXPORT_CLIENT, "CIMExportRequestEncoder::~CIMExportRequestEncoder()");
|
64 a.arora 1.21 _authenticator.release();
|
65 kumpf 1.20 PEG_METHOD_EXIT();
|
66 mike 1.2 }
67
|
68 kumpf 1.15 void CIMExportRequestEncoder::handleEnqueue()
|
69 mike 1.2 {
|
70 kumpf 1.20 PEG_METHOD_ENTER (TRC_EXPORT_CLIENT, "CIMExportRequestEncoder::handleEnqueue()");
|
71 kumpf 1.15 Message* message = dequeue();
72
|
73 carolann.graves 1.32 PEGASUS_ASSERT(message != 0);
|
74 mday 1.4
75 _authenticator->setRequestMessage(message);
|
76 mike 1.2
|
77 mday 1.4 switch (message->getType())
78 {
79 case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
80 _encodeExportIndicationRequest((CIMExportIndicationRequestMessage*)message);
81 break;
|
82 carolann.graves 1.31 default:
83 PEGASUS_ASSERT(0);
84 break;
|
85 mday 1.4 }
86
87 //ATTN: Do not delete the message here.
88 //
89 // ClientAuthenticator needs this message for resending the request on
90 // authentication challenge from the server. The message is deleted in
|
91 kumpf 1.15 // the decoder after receiving the valid response from the server.
|
92 mday 1.4 //
93 //delete message;
|
94 kumpf 1.20 PEG_METHOD_EXIT();
|
95 mike 1.2 }
96
97 void CIMExportRequestEncoder::_encodeExportIndicationRequest(
|
98 mday 1.4 CIMExportIndicationRequestMessage* message)
|
99 mike 1.2 {
|
100 kumpf 1.20 PEG_METHOD_ENTER (TRC_EXPORT_CLIENT, "CIMExportRequestEncoder::_encodeExportIndicationRequest()");
|
101 mike 1.26 Buffer params;
|
102 mike 1.2
|
103 kumpf 1.14 XmlWriter::appendInstanceEParameter(
|
104 mday 1.4 params, "NewIndication", message->indicationInstance);
|
105 mike 1.2
|
106 chuck 1.16 // l10n
107 // Note: Accept-Language will not be set in the request
108 // We will accept the default language of the export server.
|
109 mike 1.26 Buffer buffer = XmlWriter::formatSimpleEMethodReqMessage(
|
110 kumpf 1.17 message->destinationPath.getCString(),
|
111 kumpf 1.9 _hostName,
|
112 kumpf 1.12 CIMName ("ExportIndication"),
|
113 mday 1.4 message->messageId,
|
114 kumpf 1.13 message->getHttpMethod(),
|
115 chuck 1.16 _authenticator->buildRequestAuthHeader(),
|
116 kumpf 1.28 AcceptLanguageList(),
|
117 se.gupta 1.19 ((ContentLanguageListContainer)message->operationContext.get(ContentLanguageListContainer::NAME)).getLanguages(),
|
118 mday 1.4 params);
|
119 mike 1.2
|
120 karl 1.30 HTTPMessage* httpMessage = new HTTPMessage(buffer);
121 Tracer::traceBuffer(
122 TRC_XML_IO,
123 Tracer::LEVEL2,
124 httpMessage->message.getData(),
125 httpMessage->message.size());
126
127 _outputQueue->enqueue(httpMessage);
|
128 kumpf 1.20 PEG_METHOD_EXIT();
|
129 mike 1.2 }
130
131 PEGASUS_NAMESPACE_END
|