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

  1 karl  1.17 //%2006////////////////////////////////////////////////////////////////////////
  2 kumpf 1.1  //
  3 karl  1.9  // 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.2  // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.9  // 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.10 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.17 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 kumpf 1.1  //
 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 karl  1.17 // 
 21 kumpf 1.1  // 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            // Author: Carol Ann Krug Graves, Hewlett-Packard Company
 33            //             (carolann_graves@hp.com)
 34            //
 35 se.gupta 1.5  // Modified By: Seema Gupta (gseema@in.ibm.com) for PEP135
 36 a.arora  1.8  //              Alagaraja Ramasubramanian (alags_raj@in.ibm.com) for Bug#1090
 37 kumpf    1.13 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 38 aruran.ms 1.14 //              Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3601
 39 david.dillard 1.15 //              David Dillard, VERITAS Software Corp.
 40                    //                  (david.dillard@veritas.com)
 41 kumpf         1.1  //
 42                    //%/////////////////////////////////////////////////////////////////////////////
 43                    
 44                    #include <Pegasus/Common/Tracer.h>
 45 david.dillard 1.15 #include <Pegasus/Common/OperationContextInternal.h>
 46 kumpf         1.1  #include "IndicationOperationAggregate.h"
 47                    
 48                    PEGASUS_USING_STD;
 49                    
 50                    PEGASUS_NAMESPACE_BEGIN
 51                    
 52 kumpf         1.13 IndicationOperationAggregate::IndicationOperationAggregate(
 53                        CIMRequestMessage* origRequest,
 54                        const Array<CIMName>& indicationSubclasses)
 55                    :   _origRequest(origRequest),
 56                        _indicationSubclasses(indicationSubclasses),
 57 kumpf         1.19     _numberIssued(0)
 58                    {
 59                    }
 60 kumpf         1.1  
 61 kumpf         1.13 IndicationOperationAggregate::~IndicationOperationAggregate()
 62 kumpf         1.1  {
 63 kumpf         1.18     delete _origRequest;
 64                    
 65 kumpf         1.19     Uint32 numberRequests = _requestList.size();
 66 kumpf         1.1      for (Uint32 i = 0; i < numberRequests; i++)
 67                        {
 68 kumpf         1.19         delete _requestList[i];
 69 kumpf         1.1      }
 70 kumpf         1.19 
 71                        Uint32 numberResponses = _responseList.size();
 72 kumpf         1.1      for (Uint32 j = 0; j < numberResponses; j++)
 73                        {
 74 kumpf         1.19         delete _responseList[j];
 75 kumpf         1.1      }
 76                    }
 77                    
 78 aruran.ms     1.14 CIMRequestMessage* IndicationOperationAggregate::getOrigRequest() const
 79 kumpf         1.1  {
 80                        return _origRequest;
 81                    }
 82                    
 83 aruran.ms     1.14 Uint32 IndicationOperationAggregate::getOrigType() const
 84 kumpf         1.1  {
 85                        if (_origRequest == 0)
 86                        {
 87                            return 0;
 88                        }
 89                        else
 90                        {
 91 kumpf         1.13         return _origRequest->getType();
 92 kumpf         1.1      }
 93                    }
 94                    
 95 aruran.ms     1.14 Boolean IndicationOperationAggregate::requiresResponse() const
 96 kumpf         1.1  {
 97 kumpf         1.13     if ((getOrigType() == CIM_CREATE_INSTANCE_REQUEST_MESSAGE) ||
 98                            (getOrigType() == CIM_MODIFY_INSTANCE_REQUEST_MESSAGE) ||
 99                            (getOrigType() == CIM_DELETE_INSTANCE_REQUEST_MESSAGE))
100 kumpf         1.1      {
101                            return true;
102                        }
103                        else
104                        {
105                            return false;
106                        }
107                    }
108                    
109 kumpf         1.13 Array<CIMName>& IndicationOperationAggregate::getIndicationSubclasses()
110 kumpf         1.1  {
111                        return _indicationSubclasses;
112                    }
113                    
114 aruran.ms     1.14 Uint32 IndicationOperationAggregate::getNumberIssued() const
115 kumpf         1.1  {
116                        return _numberIssued;
117                    }
118                    
119 kumpf         1.13 void IndicationOperationAggregate::setNumberIssued(Uint32 i)
120 kumpf         1.1  {
121                        _numberIssued = i;
122                    }
123                    
124 kumpf         1.13 Boolean IndicationOperationAggregate::appendResponse(
125                        CIMResponseMessage* response)
126 kumpf         1.1  {
127 a.arora       1.8      AutoMutex autoMut(_appendResponseMutex);
128 kumpf         1.13     _responseList.append(response);
129                        Boolean returnValue = (getNumberResponses() == getNumberIssued());
130 david.dillard 1.15 
131 kumpf         1.1      return returnValue;
132                    }
133                    
134 aruran.ms     1.14 Uint32 IndicationOperationAggregate::getNumberResponses() const
135 kumpf         1.1  {
136 kumpf         1.13     return _responseList.size();
137 kumpf         1.1  }
138                    
139 aruran.ms     1.14 CIMResponseMessage* IndicationOperationAggregate::getResponse(Uint32 pos) const
140 kumpf         1.1  {
141 kumpf         1.13     return _responseList[pos];
142 kumpf         1.1  }
143                    
144 kumpf         1.13 void IndicationOperationAggregate::appendRequest(
145                        CIMRequestMessage* request)
146 kumpf         1.1  {
147 a.arora       1.8      AutoMutex autoMut(_appendRequestMutex);
148 kumpf         1.13     _requestList.append(request);
149 kumpf         1.1  }
150                    
151 aruran.ms     1.14 Uint32 IndicationOperationAggregate::getNumberRequests() const
152 kumpf         1.1  {
153 kumpf         1.13     return _requestList.size();
154 kumpf         1.1  }
155                    
156 aruran.ms     1.14 CIMRequestMessage* IndicationOperationAggregate::getRequest(Uint32 pos) const
157 kumpf         1.1  {
158 kumpf         1.13     return _requestList[pos];
159 kumpf         1.1  }
160                    
161 kumpf         1.13 ProviderClassList IndicationOperationAggregate::findProvider(
162 aruran.ms     1.14     const String& messageId) const
163 kumpf         1.1  {
164                        //
165 david.dillard 1.15     //  Look in the list of requests for the request with the message ID
166 kumpf         1.1      //  corresponding to the message ID in the response
167                        //
168                        ProviderClassList provider;
169 kumpf         1.13     Uint32 numberRequests = getNumberRequests();
170 kumpf         1.1      for (Uint32 i = 0; i < numberRequests; i++)
171                        {
172 kumpf         1.13         if (getRequest(i)->messageId == messageId )
173 kumpf         1.1          {
174                                //
175                                //  Get the provider and provider module from the matching request
176                                //
177 kumpf         1.13             switch (getRequest(i)->getType())
178 kumpf         1.1              {
179                                    case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
180                                    {
181 kumpf         1.13                     CIMCreateSubscriptionRequestMessage* request =
182                                            (CIMCreateSubscriptionRequestMessage *) getRequest(i);
183 carolann.graves 1.12                     ProviderIdContainer pidc = request->operationContext.get
184 david.dillard   1.15                         (ProviderIdContainer::NAME);
185 se.gupta        1.5                      provider.provider = pidc.getProvider();
186                                          provider.providerModule = pidc.getModule();
187 kumpf           1.4                      provider.classList = request->classNames;
188 kumpf           1.1                      break;
189                                      }
190 david.dillard   1.15 
191 kumpf           1.1                  case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
192                                      {
193 kumpf           1.13                     CIMDeleteSubscriptionRequestMessage* request =
194                                              (CIMDeleteSubscriptionRequestMessage *) getRequest(i);
195 carolann.graves 1.12                     ProviderIdContainer pidc = request->operationContext.get
196 david.dillard   1.15                         (ProviderIdContainer::NAME);
197 se.gupta        1.5                      provider.provider = pidc.getProvider();
198                                          provider.providerModule = pidc.getModule();
199 kumpf           1.4                      provider.classList = request->classNames;
200 kumpf           1.1                      break;
201                                      }
202 david.dillard   1.15 
203 kumpf           1.1                  default:
204                                      {
205 kumpf           1.13                     PEG_TRACE_STRING(TRC_INDICATION_SERVICE, Tracer::LEVEL2,
206 david.dillard   1.15                         "Unexpected request type " + String
207 kumpf           1.13                         (MessageTypeToString(getRequest(i)->getType())) +
208 kumpf           1.1                          " in findProvider");
209 kumpf           1.13                     PEGASUS_ASSERT(false);
210 kumpf           1.1                  break;
211                                      }
212                                  }
213                      
214                                  return provider;
215                              }
216                          }
217                      
218                          //
219                          //  No request found with message ID matching message ID from response
220                          //
221 kumpf           1.13     PEGASUS_ASSERT(false);
222 kumpf           1.6      return provider;
223 kumpf           1.1  }
224                      
225                      PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2