(file) Return to CIMExportRequestEncoder.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ExportClient

  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.36     MessageQueue* outputQueue,
 49                const String& hostName,
 50                ClientAuthenticator* authenticator)
 51                : MessageQueue(PEGASUS_QUEUENAME_EXPORTREQENCODER),
 52                  _outputQueue(outputQueue),
 53                  _hostName(hostName.getCString()),
 54                  _authenticator(authenticator)
 55 mike  1.2  {
 56 kumpf 1.36     PEG_METHOD_ENTER(TRC_EXPORT_CLIENT,
 57                    "CIMExportRequestEncoder::CIMExportRequestEncoder()");
 58 kumpf 1.20     PEG_METHOD_EXIT();
 59 mike  1.2  }
 60            
 61            CIMExportRequestEncoder::~CIMExportRequestEncoder()
 62            {
 63 kumpf 1.36     PEG_METHOD_ENTER(TRC_EXPORT_CLIENT,
 64                    "CIMExportRequestEncoder::~CIMExportRequestEncoder()");
 65                _authenticator.release();
 66 kumpf 1.20     PEG_METHOD_EXIT();
 67 mike  1.2  }
 68            
 69 kumpf 1.15 void CIMExportRequestEncoder::handleEnqueue()
 70 mike  1.2  {
 71 kumpf 1.36     PEG_METHOD_ENTER(TRC_EXPORT_CLIENT,
 72                    "CIMExportRequestEncoder::handleEnqueue()");
 73                Message* message = dequeue();
 74            
 75                PEGASUS_ASSERT(message != 0);
 76            
 77                _authenticator->setRequestMessage(message);
 78            
 79                switch (message->getType())
 80                {
 81                    case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
 82                        _encodeExportIndicationRequest(
 83                            (CIMExportIndicationRequestMessage*)message);
 84                        break;
 85 carolann.graves 1.31         default:
 86                                  PEGASUS_ASSERT(0);
 87                                  break;
 88 kumpf           1.36     }
 89 mday            1.4  
 90 kumpf           1.36     //ATTN: Do not delete the message here.
 91                          //
 92                          // ClientAuthenticator needs this message for resending the request on
 93                          // authentication challenge from the server. The message is deleted in
 94                          // the decoder after receiving the valid response from the server.
 95                          //
 96                          //delete message;
 97                          PEG_METHOD_EXIT();
 98 mike            1.2  }
 99                      
100                      void CIMExportRequestEncoder::_encodeExportIndicationRequest(
101 kumpf           1.36     CIMExportIndicationRequestMessage* message)
102 mike            1.2  {
103 kumpf           1.36     PEG_METHOD_ENTER(TRC_EXPORT_CLIENT,
104                              "CIMExportRequestEncoder::_encodeExportIndicationRequest()");
105                          Buffer params;
106                      
107                          XmlWriter::appendInstanceEParameter(
108                              params, "NewIndication", message->indicationInstance);
109                      
110                          // Note:  Accept-Language will not be set in the request
111                          // We will accept the default language of the export server.
112                          Buffer buffer = XmlWriter::formatSimpleEMethodReqMessage(
113                              message->destinationPath.getCString(),
114                              _hostName,
115                              CIMName("ExportIndication"),
116                              message->messageId,
117                              message->getHttpMethod(),
118                              _authenticator->buildRequestAuthHeader(),
119                              AcceptLanguageList(),
120                              ((ContentLanguageListContainer)message->operationContext.get(
121                                  ContentLanguageListContainer::NAME)).getLanguages(),
122                              params);
123                      
124 kumpf           1.36     HTTPMessage* httpMessage = new HTTPMessage(buffer);
125 marek           1.37     PEG_TRACE_CSTRING(TRC_XML_IO, Tracer::LEVEL4,
126 kumpf           1.36         httpMessage->message.getData());
127 mike            1.2  
128 kumpf           1.36     _outputQueue->enqueue(httpMessage);
129                          PEG_METHOD_EXIT();
130 mike            1.2  }
131                      
132                      PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2