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

  1 karl  1.37 //%2006////////////////////////////////////////////////////////////////////////
  2 mike  1.2  //
  3 karl  1.30 // 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.28 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.30 // 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.31 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.37 // 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 chip  1.5  // 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 kumpf 1.21 // 
 21 chip  1.5  // 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 chip  1.5  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27 mike  1.2  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 32            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34            #include <Pegasus/Common/Config.h>
 35 kumpf 1.13 #include <Pegasus/Common/Constants.h>
 36 mike  1.2  #include <Pegasus/Common/HTTPMessage.h>
 37 kumpf 1.15 #include <Pegasus/Common/PegasusVersion.h>
 38 kumpf 1.19 #include <Pegasus/Common/Tracer.h>
 39 kumpf 1.26 #include <Pegasus/Common/MessageQueueService.h>
 40            #include <Pegasus/Server/CIMOperationRequestDispatcher.h>
 41 mike  1.2  
 42            #include "CIMExportRequestDispatcher.h"
 43            
 44            PEGASUS_USING_STD;
 45            
 46            PEGASUS_NAMESPACE_BEGIN
 47            
 48            CIMExportRequestDispatcher::CIMExportRequestDispatcher(
 49 mday  1.7     Boolean dynamicReg, Boolean staticConsumers, Boolean persistence)
 50 kumpf 1.13    : Base(PEGASUS_QUEUENAME_EXPORTREQDISPATCHER),
 51 chip  1.11      _dynamicReg(dynamicReg),
 52                 _staticConsumers(staticConsumers),
 53 mday  1.7       _persistence(persistence)
 54 mike  1.2  {
 55 kumpf 1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
 56                  "CIMExportRequestDispatcher::CIMExportRequestDispatcher");
 57               PEG_METHOD_EXIT();
 58 kumpf 1.6  }
 59 mike  1.2  
 60 kumpf 1.6  CIMExportRequestDispatcher::CIMExportRequestDispatcher()
 61 s.hills 1.27    : Base(PEGASUS_QUEUENAME_EXPORTREQDISPATCHER),
 62                   _dynamicReg( true ),
 63                   _staticConsumers( false ),
 64                   _persistence( false )
 65 kumpf   1.6  {
 66 kumpf   1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
 67                    "CIMExportRequestDispatcher::CIMExportRequestDispatcher");
 68 mday    1.7  
 69 kumpf   1.19    PEG_METHOD_EXIT();
 70 mike    1.2  }
 71              
 72              CIMExportRequestDispatcher::~CIMExportRequestDispatcher()
 73              {
 74 kumpf   1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
 75                    "CIMExportRequestDispatcher::~CIMExportRequestDispatcher");
 76 mike    1.2  
 77 kumpf   1.19    PEG_METHOD_EXIT();
 78 mike    1.2  }
 79              
 80 kumpf   1.8  void CIMExportRequestDispatcher::_handle_async_request(AsyncRequest *req)
 81 mike    1.2  {
 82 kumpf   1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
 83                    "CIMExportRequestDispatcher::_handle_async_request");
 84              
 85 kumpf   1.29     PEGASUS_ASSERT(req != 0 && req->op != 0 );
 86              
 87 kumpf   1.8      if ( req->getType() == async_messages::CIMSERVICE_STOP )
 88                  {
 89                      req->op->processing();
 90                      handle_CimServiceStop(static_cast<CimServiceStop *>(req));
 91                  }
 92                  else if ( req->getType() == async_messages::ASYNC_LEGACY_OP_START )
 93                  {
 94                      req->op->processing();
 95 kumpf   1.29         Message *legacy =
 96                          (static_cast<AsyncLegacyOperationStart *>(req)->get_action());
 97                      if (legacy->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE)
 98                      {
 99                          Message* legacy_response = _handleExportIndicationRequest(
100                              (CIMExportIndicationRequestMessage*) legacy);
101                          AsyncLegacyOperationResult *async_result =
102                              new AsyncLegacyOperationResult(
103                                  req->op,
104                                  legacy_response);
105              
106                          _complete_op_node(req->op, ASYNC_OPSTATE_COMPLETE, 0, 0);
107                          delete legacy;
108                      }
109                      else
110                      {
111                          Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2,
112                              "CIMExportRequestDispatcher::_handle_async_request got "
113                                  "unexpected legacy message type '%u'", legacy->getType());
114              	    _make_response(req, async_results::CIM_NAK);
115                          delete legacy;
116 kumpf   1.29         }
117 kumpf   1.8      }
118                  else
119 kumpf   1.19     {
120 kumpf   1.8          Base::_handle_async_request(req);
121 kumpf   1.19     }
122                  PEG_METHOD_EXIT();
123 kumpf   1.8  }
124 mike    1.2  
125 mday    1.9  void CIMExportRequestDispatcher::handleEnqueue(Message* message)
126 kumpf   1.8  {
127 kumpf   1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
128                    "CIMExportRequestDispatcher::handleEnqueue");
129 mike    1.2  
130 carolann.graves 1.42     PEGASUS_ASSERT(message != 0);
131 chip            1.11 
132 kumpf           1.8      switch (message->getType())
133 mike            1.2      {
134                      	case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
135 kumpf           1.29         {
136                                  CIMExportIndicationResponseMessage* response =
137                                      _handleExportIndicationRequest(
138                                          (CIMExportIndicationRequestMessage*) message);
139 j.alex          1.36 
140                                  Tracer::trace(
141                                      TRC_HTTP,
142                                      Tracer::LEVEL3,
143                                      "_CIMExportRequestDispatcher::handleEnqueue(message) - message->getCloseConnect() returned %d",
144                                      message->getCloseConnect());
145                      
146                                  response->setCloseConnect(message->getCloseConnect());
147                      
148 kumpf           1.29             SendForget(response);
149 mike            1.2  	    break;
150 kumpf           1.29         }
151 kumpf           1.8  
152                              default:
153 carolann.graves 1.41             PEGASUS_ASSERT(0);
154 kumpf           1.8              break;
155 mike            1.2      }
156 kumpf           1.8      delete message;
157 mike            1.2  
158 kumpf           1.19     PEG_METHOD_EXIT();
159 mike            1.2  }
160 mday            1.10 
161                      
162                      void CIMExportRequestDispatcher::handleEnqueue()
163                      {
164 kumpf           1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
165                            "CIMExportRequestDispatcher::handleEnqueue");
166                      
167 mday            1.10    Message *message = dequeue();
168                         if(message)
169                            handleEnqueue(message);
170 chip            1.11 
171 kumpf           1.19    PEG_METHOD_EXIT();
172 mday            1.10 }
173                      
174 mike            1.2  
175 kumpf           1.29 CIMExportIndicationResponseMessage*
176                      CIMExportRequestDispatcher::_handleExportIndicationRequest(
177 mike            1.2      CIMExportIndicationRequestMessage* request)
178                      {
179 kumpf           1.19     PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
180 vijay.eli       1.34       "CIMExportRequestDispatcher::_handleExportIndicationRequest");
181 kumpf           1.19 
182 mike            1.2      OperationContext context;
183                      
184 kumpf           1.12     CIMException cimException;
185 mike            1.2  
186 kumpf           1.26     Array<Uint32> serviceIds;
187                          find_services(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP, 0, 0, &serviceIds);
188                          PEGASUS_ASSERT(serviceIds.size() != 0);
189                      
190                          AsyncOpNode * op = this->get_op();
191                      
192                          AsyncLegacyOperationStart * asyncRequest =
193                              new AsyncLegacyOperationStart(
194                      	    op,
195                      	    serviceIds[0],
196 kumpf           1.29 	    new CIMExportIndicationRequestMessage(*request),
197 kumpf           1.26 	    this->getQueueId());
198                      
199                          asyncRequest->dest = serviceIds[0];
200                      
201 kumpf           1.29     //SendAsync(op,
202                          //          serviceIds[0],
203                          //          CIMExportRequestDispatcher::_forwardRequestCallback,
204                          //          this,
205                          //          (void *)request->queueIds.top());
206                          AsyncReply *asyncReply = SendWait(asyncRequest);
207                      
208                          CIMExportIndicationResponseMessage* response =
209                              reinterpret_cast<CIMExportIndicationResponseMessage *>(
210                                  (static_cast<AsyncLegacyOperationResult *>(
211                                      asyncReply))->get_result());
212                          response->dest = request->queueIds.top();
213                      
214                          delete asyncReply;    // Recipient deletes request
215                          op->release();
216                          this->return_op(op);
217                      
218 kumpf           1.19     PEG_METHOD_EXIT();
219 kumpf           1.29     return response;
220 mike            1.2  }
221                      
222                      PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2