(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.15 #include <Pegasus/Common/PegasusVersion.h>
 36 kumpf 1.19 #include <Pegasus/Common/Tracer.h>
 37 kumpf 1.26 #include <Pegasus/Server/CIMOperationRequestDispatcher.h>
 38 mike  1.2  
 39            #include "CIMExportRequestDispatcher.h"
 40            
 41            PEGASUS_USING_STD;
 42            
 43            PEGASUS_NAMESPACE_BEGIN
 44            
 45 kumpf 1.6  CIMExportRequestDispatcher::CIMExportRequestDispatcher()
 46 carolann.graves 1.43    : Base(PEGASUS_QUEUENAME_EXPORTREQDISPATCHER)
 47 kumpf           1.6  {
 48 kumpf           1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
 49                            "CIMExportRequestDispatcher::CIMExportRequestDispatcher");
 50 mday            1.7  
 51 kumpf           1.19    PEG_METHOD_EXIT();
 52 mike            1.2  }
 53                      
 54                      CIMExportRequestDispatcher::~CIMExportRequestDispatcher()
 55                      {
 56 kumpf           1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
 57                            "CIMExportRequestDispatcher::~CIMExportRequestDispatcher");
 58 mike            1.2  
 59 kumpf           1.19    PEG_METHOD_EXIT();
 60 mike            1.2  }
 61                      
 62 kumpf           1.8  void CIMExportRequestDispatcher::_handle_async_request(AsyncRequest *req)
 63 mike            1.2  {
 64 kumpf           1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
 65                            "CIMExportRequestDispatcher::_handle_async_request");
 66                      
 67 kumpf           1.29     PEGASUS_ASSERT(req != 0 && req->op != 0 );
 68                      
 69 kumpf           1.8      if ( req->getType() == async_messages::CIMSERVICE_STOP )
 70                          {
 71                              req->op->processing();
 72                              handle_CimServiceStop(static_cast<CimServiceStop *>(req));
 73                          }
 74                          else if ( req->getType() == async_messages::ASYNC_LEGACY_OP_START )
 75                          {
 76                              req->op->processing();
 77 kumpf           1.29         Message *legacy =
 78                                  (static_cast<AsyncLegacyOperationStart *>(req)->get_action());
 79                              if (legacy->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE)
 80                              {
 81                                  Message* legacy_response = _handleExportIndicationRequest(
 82                                      (CIMExportIndicationRequestMessage*) legacy);
 83                                  AsyncLegacyOperationResult *async_result =
 84                                      new AsyncLegacyOperationResult(
 85                                          req->op,
 86                                          legacy_response);
 87                      
 88                                  _complete_op_node(req->op, ASYNC_OPSTATE_COMPLETE, 0, 0);
 89                                  delete legacy;
 90                              }
 91                              else
 92                              {
 93                                  Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2,
 94                                      "CIMExportRequestDispatcher::_handle_async_request got "
 95                                          "unexpected legacy message type '%u'", legacy->getType());
 96                      	    _make_response(req, async_results::CIM_NAK);
 97                                  delete legacy;
 98 kumpf           1.29         }
 99 kumpf           1.8      }
100                          else
101 kumpf           1.19     {
102 kumpf           1.8          Base::_handle_async_request(req);
103 kumpf           1.19     }
104                          PEG_METHOD_EXIT();
105 kumpf           1.8  }
106 mike            1.2  
107 mday            1.9  void CIMExportRequestDispatcher::handleEnqueue(Message* message)
108 kumpf           1.8  {
109 kumpf           1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
110                            "CIMExportRequestDispatcher::handleEnqueue");
111 mike            1.2  
112 carolann.graves 1.42     PEGASUS_ASSERT(message != 0);
113 chip            1.11 
114 kumpf           1.8      switch (message->getType())
115 mike            1.2      {
116                      	case CIM_EXPORT_INDICATION_REQUEST_MESSAGE:
117 kumpf           1.29         {
118                                  CIMExportIndicationResponseMessage* response =
119                                      _handleExportIndicationRequest(
120                                          (CIMExportIndicationRequestMessage*) message);
121 j.alex          1.36 
122                                  Tracer::trace(
123                                      TRC_HTTP,
124                                      Tracer::LEVEL3,
125                                      "_CIMExportRequestDispatcher::handleEnqueue(message) - message->getCloseConnect() returned %d",
126                                      message->getCloseConnect());
127                      
128                                  response->setCloseConnect(message->getCloseConnect());
129                      
130 kumpf           1.29             SendForget(response);
131 mike            1.2  	    break;
132 kumpf           1.29         }
133 kumpf           1.8  
134                              default:
135 carolann.graves 1.41             PEGASUS_ASSERT(0);
136 kumpf           1.8              break;
137 mike            1.2      }
138 kumpf           1.8      delete message;
139 mike            1.2  
140 kumpf           1.19     PEG_METHOD_EXIT();
141 mike            1.2  }
142 mday            1.10 
143                      
144                      void CIMExportRequestDispatcher::handleEnqueue()
145                      {
146 kumpf           1.19    PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
147                            "CIMExportRequestDispatcher::handleEnqueue");
148                      
149 mday            1.10    Message *message = dequeue();
150                         if(message)
151                            handleEnqueue(message);
152 chip            1.11 
153 kumpf           1.19    PEG_METHOD_EXIT();
154 mday            1.10 }
155                      
156 mike            1.2  
157 kumpf           1.29 CIMExportIndicationResponseMessage*
158                      CIMExportRequestDispatcher::_handleExportIndicationRequest(
159 mike            1.2      CIMExportIndicationRequestMessage* request)
160                      {
161 kumpf           1.19     PEG_METHOD_ENTER(TRC_EXP_REQUEST_DISP,
162 vijay.eli       1.34       "CIMExportRequestDispatcher::_handleExportIndicationRequest");
163 kumpf           1.19 
164 mike            1.2      OperationContext context;
165                      
166 kumpf           1.12     CIMException cimException;
167 mike            1.2  
168 kumpf           1.26     Array<Uint32> serviceIds;
169                          find_services(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP, 0, 0, &serviceIds);
170                          PEGASUS_ASSERT(serviceIds.size() != 0);
171                      
172                          AsyncOpNode * op = this->get_op();
173                      
174                          AsyncLegacyOperationStart * asyncRequest =
175                              new AsyncLegacyOperationStart(
176                      	    op,
177                      	    serviceIds[0],
178 kumpf           1.29 	    new CIMExportIndicationRequestMessage(*request),
179 kumpf           1.26 	    this->getQueueId());
180                      
181                          asyncRequest->dest = serviceIds[0];
182                      
183 kumpf           1.29     //SendAsync(op,
184                          //          serviceIds[0],
185                          //          CIMExportRequestDispatcher::_forwardRequestCallback,
186                          //          this,
187                          //          (void *)request->queueIds.top());
188                          AsyncReply *asyncReply = SendWait(asyncRequest);
189                      
190                          CIMExportIndicationResponseMessage* response =
191                              reinterpret_cast<CIMExportIndicationResponseMessage *>(
192                                  (static_cast<AsyncLegacyOperationResult *>(
193                                      asyncReply))->get_result());
194                          response->dest = request->queueIds.top();
195                      
196                          delete asyncReply;    // Recipient deletes request
197                          op->release();
198                          this->return_op(op);
199                      
200 kumpf           1.19     PEG_METHOD_EXIT();
201 kumpf           1.29     return response;
202 mike            1.2  }
203                      
204                      PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2