(file) Return to OperationResponseHandler.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2

Diff for /pegasus/src/Pegasus/ProviderManager2/OperationResponseHandler.h between version 1.1.2.1 and 1.24

version 1.1.2.1, 2004/03/10 14:19:29 version 1.24, 2005/03/13 00:08:47
Line 1 
Line 1 
 //%2003////////////////////////////////////////////////////////////////////////  //%2005////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.  // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
 // IBM Corp.; EMC Corporation, The Open Group. // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 25 
Line 29 
 // //
 // Author: Chip Vincent (cvincent@us.ibm.com) // Author: Chip Vincent (cvincent@us.ibm.com)
 // //
 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company  // Modified By:
 //                  (carolann_graves@hp.com)  //      Carol Ann Krug Graves, Hewlett-Packard Company (carolann_graves@hp.com)
 //              Dave Rosckes (rosckes@us.ibm.com) //              Dave Rosckes (rosckes@us.ibm.com)
 //              Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) //              Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
 //              Adrian Schuur (schuur@de.ibm.com) //              Adrian Schuur (schuur@de.ibm.com)
   //      Seema Gupta (gseema@in.ibm.com) for PEP135
   //      Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase2
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 37 
Line 43 
 #define Pegasus_OperationResponseHandler_h #define Pegasus_OperationResponseHandler_h
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Server/Linkage.h>  
 #include <Pegasus/Common/CIMMessage.h> #include <Pegasus/Common/CIMMessage.h>
 #include <Pegasus/Common/MessageQueueService.h> #include <Pegasus/Common/MessageQueueService.h>
 #include <Pegasus/Common/Constants.h> #include <Pegasus/Common/Constants.h>
Line 48 
Line 53 
 #include <Pegasus/Common/CIMIndication.h> #include <Pegasus/Common/CIMIndication.h>
 #include <Pegasus/Common/CIMValue.h> #include <Pegasus/Common/CIMValue.h>
  
   #include <Pegasus/Common/OperationContext.h>
   #include <Pegasus/Common/OperationContextInternal.h>
   
   #include <Pegasus/Common/ObjectNormalizer.h>
 #include <Pegasus/Common/ResponseHandler.h> #include <Pegasus/Common/ResponseHandler.h>
 #include <Pegasus/Common/Logger.h> #include <Pegasus/Common/Logger.h>
   #include <Pegasus/Common/XmlWriter.h>
  
 #include <Pegasus/ProviderManager2/SimpleResponseHandler.h> #include <Pegasus/ProviderManager2/SimpleResponseHandler.h>
   
 #include <Pegasus/ProviderManager2/Linkage.h> #include <Pegasus/ProviderManager2/Linkage.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 class PEGASUS_PPM_LINKAGE OperationResponseHandler class PEGASUS_PPM_LINKAGE OperationResponseHandler
 { {
       friend class SimpleResponseHandler;
   
 public: public:
     OperationResponseHandler(CIMRequestMessage * request, CIMResponseMessage * response)      OperationResponseHandler(
         : _request(request), _response(response)          CIMRequestMessage * request,
     {          CIMResponseMessage * response);
     }  
  
     virtual ~OperationResponseHandler(void)      virtual ~OperationResponseHandler(void);
     {  
     }  
  
     CIMRequestMessage * getRequest(void) const     CIMRequestMessage * getRequest(void) const
     {     {
Line 79 
Line 87 
         return(_response);         return(_response);
     }     }
  
     virtual void setStatus(const Uint32 code, const String & message = String::EMPTY)      virtual void setStatus(
           const Uint32 code,
           const String & message = String::EMPTY)
     {     {
         _response->cimException = PEGASUS_CIM_EXCEPTION(CIMStatusCode(code), message);         _response->cimException = PEGASUS_CIM_EXCEPTION(CIMStatusCode(code), message);
     }     }
  
     virtual void setStatus(const Uint32 code,      virtual void setStatus(
           const Uint32 code,
                                                 const ContentLanguages & langs,                                                 const ContentLanguages & langs,
                                                 const String & message = String::EMPTY)                                                 const String & message = String::EMPTY)
     {     {
         _response->cimException = PEGASUS_CIM_EXCEPTION_LANG(          _response->cimException =
               PEGASUS_CIM_EXCEPTION_LANG(
                                                         langs,                                                         langs,
                                                         CIMStatusCode(code),                                                         CIMStatusCode(code),
                                                          message);                                                          message);
     }     }
  
 protected: protected:
       // the default for all derived handlers. Some handlers may not apply
       // async behavior because their callers cannot handle partial responses.
       virtual Boolean isAsync(void) const
       {
           return(true);
       }
   
       // send (deliver) asynchronously
       virtual void send(Boolean isComplete);
   
       // transfer any objects from handler to response. this does not clear()
       virtual void transfer(void)
       {
       }
   
       // validate whatever is necessary before the transfer
       virtual void validate(void)
       {
       }
   
       virtual String getClass(void) const
       {
           return(String("OperationResponseHandler"));
       }
   
       Uint32 getResponseObjectTotal(void) const
       {
           return(_responseObjectTotal);
       }
   
       // there can be many objects per message (or none at all - i.e complete())
       Uint32 getResponseMessageTotal(void) const
       {
           return(_responseMessageTotal);
       }
   
       Uint32 getResponseObjectThreshold(void) const
       {
           return(_responseObjectThreshold);
       }
   
     CIMRequestMessage * _request;     CIMRequestMessage * _request;
     CIMResponseMessage * _response;     CIMResponseMessage * _response;
  
 };  private:
       Uint32 _responseObjectTotal;
       Uint32 _responseMessageTotal;
       Uint32 _responseObjectThreshold;
  
 /* ------------------------------------------------------------------------- */  };
 /* operation specific response handlers                                      */  
 /* ------------------------------------------------------------------------- */  
  
 class GetInstanceResponseHandler:  public OperationResponseHandler, public SimpleInstanceResponseHandler class GetInstanceResponseHandler:  public OperationResponseHandler, public SimpleInstanceResponseHandler
 { {
Line 113 
Line 166 
         CIMGetInstanceResponseMessage * response)         CIMGetInstanceResponseMessage * response)
     : OperationResponseHandler(request, response)     : OperationResponseHandler(request, response)
     {     {
           #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
           // Attempt to get the cached class definition used to validate results of this
           // operation. If it does not exist, then this feature is disabled for this
           // operation.
           CIMClass cimClass;
   
           try
           {
               CachedClassDefinitionContainer container =
                   request->operationContext.get(CachedClassDefinitionContainer::NAME);
   
               cimClass = container.getClass();
   
           }
           catch(Exception &)
           {
               // Do nothing. Container is missing, which implies normalization is disabled
               // for this operation.
     }     }
  
     virtual void complete()          _normalizer =
               ObjectNormalizer(
                   cimClass,
                   request->includeQualifiers,
                   request->includeClassOrigin);
           #endif
       }
   
       virtual void deliver(const CIMInstance & cimInstance)
       {
           if(cimInstance.isUninitialized())
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,              MessageLoaderParms message(
                     "OperationResponseHandler: complete()");                  "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
   
               throw CIMException(CIM_ERR_FAILED, message);
           }
  
         if(getObjects().size() == 0)          #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
           // The normalizer expects an object path embedded in instances even
           // though it is not required by this operation. Use the requested
           // object path is missing from the instance.
           CIMInstance localInstance(cimInstance);
   
           if(localInstance.getPath().getKeyBindings().size() == 0)
           {
               // ATTN: should clone before modification
               localInstance.setPath(static_cast<CIMGetInstanceRequestMessage *>(getRequest())->instanceName);
           }
   
           SimpleInstanceResponseHandler::deliver(_normalizer.processInstance(localInstance));
           #else
           SimpleInstanceResponseHandler::deliver(cimInstance);
           #endif
       }
   
   protected:
       virtual String getClass(void) const
       {
           return(String("GetInstanceResponseHandler"));
       }
   
       virtual void transfer(void)
       {
           if(size() > 0)
           {
               CIMGetInstanceResponseMessage & msg =
                   *static_cast<CIMGetInstanceResponseMessage *>(getResponse());
   
               msg.cimInstance = getObjects()[0];
           }
       }
   
       virtual void validate(void)
       {
           if(getResponseObjectTotal() == 0)
         {         {
             // error? provider claims success,             // error? provider claims success,
             // but did not deliver an instance.             // but did not deliver an instance.
             setStatus(CIM_ERR_NOT_FOUND);             setStatus(CIM_ERR_NOT_FOUND);
           }
             return;  
         }         }
  
         static_cast<CIMGetInstanceResponseMessage *>(  private:
             getResponse())->cimInstance = getObjects()[0];      ObjectNormalizer _normalizer;
  
                 // l10n  
                 getResponse()->contentLanguages = getLanguages();  
     }  
 }; };
  
 class EnumerateInstancesResponseHandler : public OperationResponseHandler, public SimpleInstanceResponseHandler class EnumerateInstancesResponseHandler : public OperationResponseHandler, public SimpleInstanceResponseHandler
Line 145 
Line 263 
         CIMEnumerateInstancesResponseMessage * response)         CIMEnumerateInstancesResponseMessage * response)
     : OperationResponseHandler(request, response)     : OperationResponseHandler(request, response)
     {     {
           #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
           // Attempt to get the cached class definition used to validate results of this
           // operation. If it does not exist, then this feature is disabled for this
           // operation.
           CIMClass cimClass;
   
           try
           {
               CachedClassDefinitionContainer container =
                   request->operationContext.get(CachedClassDefinitionContainer::NAME);
   
               cimClass = container.getClass();
           }
           catch(Exception &)
           {
               // Do nothing. Container is missing, which implies normalization is disabled
               // for this operation.
     }     }
  
     virtual void complete()          _normalizer =
               ObjectNormalizer(
                   cimClass,
                   request->includeQualifiers,
                   request->includeClassOrigin);
           #endif
       }
   
       virtual void deliver(const CIMInstance & cimInstance)
       {
           if(cimInstance.isUninitialized())
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,              MessageLoaderParms message(
                     "OperationResponseHandler: complete()");                  "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
  
         static_cast<CIMEnumerateInstancesResponseMessage *>(              throw CIMException(CIM_ERR_FAILED, message);
             getResponse())->cimNamedInstances = getObjects();          }
  
                 // l10n          #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
                 getResponse()->contentLanguages = getLanguages();          SimpleInstanceResponseHandler::deliver(_normalizer.processInstance(cimInstance));
           #else
           SimpleInstanceResponseHandler::deliver(cimInstance);
           #endif
       }
   
   protected:
       virtual String getClass(void) const
       {
           return(String("EnumerateInstancesResponseHandler"));
     }     }
  
       virtual void transfer(void)
       {
           CIMEnumerateInstancesResponseMessage & msg =
               *static_cast<CIMEnumerateInstancesResponseMessage *>(getResponse());
   
           msg.cimNamedInstances = getObjects();
       }
   
   private:
       ObjectNormalizer _normalizer;
   
 }; };
  
 class EnumerateInstanceNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler class EnumerateInstanceNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler
Line 169 
Line 335 
         CIMEnumerateInstanceNamesResponseMessage * response)         CIMEnumerateInstanceNamesResponseMessage * response)
     : OperationResponseHandler(request, response)     : OperationResponseHandler(request, response)
     {     {
           #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
           // Attempt to get the cached class definition used to validate results of this
           // operation. If it does not exist, then this feature is disabled for this
           // operation.
           CIMClass cimClass;
   
           try
           {
               CachedClassDefinitionContainer container =
                   request->operationContext.get(CachedClassDefinitionContainer::NAME);
   
               cimClass = container.getClass();
           }
           catch(Exception &)
           {
               // Do nothing. Container is missing, which implies normalization is disabled
               // for this operation.
     }     }
  
     virtual void complete()          _normalizer =
               ObjectNormalizer(
                   cimClass,
                   false,
                   false);
           #endif
       }
   
       virtual void deliver(const CIMObjectPath & cimObjectPath)
       {
           if(cimObjectPath.getClassName().isNull())
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,              MessageLoaderParms message(
                     "OperationResponseHandler: complete()");                  "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
  
         static_cast<CIMEnumerateInstanceNamesResponseMessage *>(              throw CIMException(CIM_ERR_FAILED, message);
             getResponse())->instanceNames = getObjects();          }
  
         // l10n          #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
         getResponse()->contentLanguages = getLanguages();          SimpleObjectPathResponseHandler::deliver(_normalizer.processInstanceObjectPath(cimObjectPath));
           #else
           SimpleObjectPathResponseHandler::deliver(cimObjectPath);
           #endif
       }
   
   protected:
       virtual String getClass(void) const
       {
           return(String("EnumerateInstanceNamesResponseHandler"));
     }     }
  
       virtual void transfer(void)
       {
           CIMEnumerateInstanceNamesResponseMessage & msg =
               *static_cast<CIMEnumerateInstanceNamesResponseMessage *>(getResponse());
   
           msg.instanceNames = getObjects();
       }
   
   private:
       ObjectNormalizer _normalizer;
   
 }; };
  
 class CreateInstanceResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler class CreateInstanceResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler
Line 195 
Line 409 
     {     {
     }     }
  
     virtual void complete()      virtual void deliver(const CIMObjectPath & cimObjectPath)
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,          if(cimObjectPath.getClassName().isNull())
                     "OperationResponseHandler: complete()");          {
               MessageLoaderParms message(
                   "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
  
         if(getObjects().size() == 0)              throw CIMException(CIM_ERR_FAILED, message);
           }
   
           SimpleObjectPathResponseHandler::deliver(cimObjectPath);
       }
   
   protected:
       virtual String getClass(void) const
         {         {
           return(String("CreateInstanceResponseHandler"));
       }
   
       #if 0
             // ATTN: is it an error to not return instance name?             // ATTN: is it an error to not return instance name?
             return;      virtual void validate(void)
       {
           if(getResponseObjectTotal() == 0)
           {
               setStatus(CIM_ERR_NOT_FOUND);
           }
         }         }
       #endif
  
         static_cast<CIMCreateInstanceResponseMessage *>(      virtual void transfer(void)
             getResponse())->instanceName = getObjects()[0];      {
           if(size() > 0)
           {
               CIMCreateInstanceResponseMessage & msg =
                   *static_cast<CIMCreateInstanceResponseMessage *>(getResponse());
  
                 // l10n              msg.instanceName = getObjects()[0];
                 getResponse()->contentLanguages = getLanguages();          }
     }     }
   
 }; };
  
 class ModifyInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler class ModifyInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler
Line 225 
Line 462 
     {     {
     }     }
  
   protected:
       virtual String getClass(void) const
       {
           return(String("ModifyInstanceResponseHandler"));
       }
 }; };
  
 class DeleteInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler class DeleteInstanceResponseHandler : public OperationResponseHandler, public SimpleResponseHandler
Line 237 
Line 479 
     {     {
     }     }
  
   protected:
       virtual String getClass(void) const
       {
           return(String("DeleteInstanceResponseHandler"));
       }
   
 }; };
  
 class GetPropertyResponseHandler : public OperationResponseHandler, public SimpleValueResponseHandler class GetPropertyResponseHandler : public OperationResponseHandler, public SimpleValueResponseHandler
Line 249 
Line 497 
     {     {
     }     }
  
     virtual void complete()      virtual void deliver(const CIMValue & cimValue)
       {
           if(cimValue.isNull())
           {
               MessageLoaderParms message(
                   "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
   
               throw CIMException(CIM_ERR_FAILED, message);
           }
   
           SimpleValueResponseHandler::deliver(cimValue);
       }
   
   protected:
       virtual String getClass(void) const
       {
           return(String("GetPropertyResponseHandler"));
       }
   
       virtual void transfer(void)
       {
           if(size() > 0)
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,              CIMGetPropertyResponseMessage & msg =
                     "OperationResponseHandler: complete()");                  *static_cast<CIMGetPropertyResponseMessage *>(getResponse());
   
               msg.value = getObjects()[0];
           }
       }
  
         if(getObjects().size() == 0)      virtual void validate(void)
         {         {
             // error? provider claims success,             // error? provider claims success,
             // but did not deliver an instance.             // but did not deliver an instance.
           if(getResponseObjectTotal() == 0)
           {
             setStatus(CIM_ERR_NOT_FOUND);             setStatus(CIM_ERR_NOT_FOUND);
   
             return;  
         }         }
   
         static_cast<CIMGetPropertyResponseMessage *>(  
             getResponse())->value = getObjects()[0];  
   
                 // l10n  
                 getResponse()->contentLanguages = getLanguages();  
     }     }
 }; };
  
Line 281 
Line 549 
     {     {
     }     }
  
   protected:
       virtual String getClass(void) const
       {
           return(String("SetPropertyResponseHandler"));
       }
   
 }; };
  
 class ExecQueryResponseHandler : public OperationResponseHandler, public SimpleInstance2ObjectResponseHandler class ExecQueryResponseHandler : public OperationResponseHandler, public SimpleInstance2ObjectResponseHandler
Line 293 
Line 567 
     {     {
     }     }
  
     virtual void complete()      virtual void deliver(const CIMInstance & cimInstance)
       {
           if(cimInstance.isUninitialized())
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,              MessageLoaderParms message(
                     "OperationResponseHandler: complete()");                  "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
  
         static_cast<CIMExecQueryResponseMessage *>(              throw CIMException(CIM_ERR_FAILED, message);
             getResponse())->cimObjects = getObjects();          }
  
         // l10n          SimpleInstance2ObjectResponseHandler::deliver(cimInstance);
         getResponse()->contentLanguages = getLanguages();  
     }     }
  
 };  protected:
       virtual String getClass(void) const
       {
           return(String("ExecQueryResponseHandler"));
       }
  
       virtual void transfer(void)
       {
           CIMExecQueryResponseMessage & msg =
               *static_cast<CIMExecQueryResponseMessage *>(getResponse());
   
           msg.cimObjects = getObjects();
       }
   
       virtual Boolean isAsync(void) const
       {
           return(false);
       }
   };
  
 class AssociatorsResponseHandler : public OperationResponseHandler, public SimpleObjectResponseHandler class AssociatorsResponseHandler : public OperationResponseHandler, public SimpleObjectResponseHandler
 { {
Line 318 
Line 611 
     {     {
     }     }
  
     virtual void complete()      virtual void deliver(const CIMObject & cimObject)
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,          if(cimObject.isUninitialized())
                 "OperationResponseHandler: complete()");          {
               MessageLoaderParms message(
                   "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
  
         static_cast<CIMAssociatorsResponseMessage *>(              throw CIMException(CIM_ERR_FAILED, message);
             getResponse())->cimObjects = getObjects();          }
  
                 // l10n          SimpleObjectResponseHandler::deliver(cimObject);
                 getResponse()->contentLanguages = getLanguages();  
     }     }
  
   protected:
       virtual String getClass(void) const
       {
           return(String("AssociatorsResponseHandler"));
       }
   
       virtual void transfer(void)
       {
           CIMAssociatorsResponseMessage & msg =
               *static_cast<CIMAssociatorsResponseMessage *>(getResponse());
   
           msg.cimObjects = getObjects();
       }
 }; };
  
 class AssociatorNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler class AssociatorNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler
Line 342 
Line 650 
     {     {
     }     }
  
     virtual void complete()      virtual void deliver(const CIMObjectPath & cimObjectPath)
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,          if(cimObjectPath.getClassName().isNull())
                     "OperationResponseHandler: complete()");          {
               MessageLoaderParms message(
                   "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
  
         static_cast<CIMAssociatorNamesResponseMessage *>(              throw CIMException(CIM_ERR_FAILED, message);
             getResponse())->objectNames.appendArray(getObjects());          }
  
                 // l10n          SimpleObjectPathResponseHandler::deliver(cimObjectPath);
                 getResponse()->contentLanguages = getLanguages();      }
   
   protected:
       virtual String getClass(void) const
       {
           return(String("AssociatorNamesResponseHandler"));
     }     }
  
       virtual void transfer(void)
       {
           CIMAssociatorNamesResponseMessage & msg =
               *static_cast<CIMAssociatorNamesResponseMessage *>(getResponse());
   
           msg.objectNames = getObjects();
       }
 }; };
  
 class ReferencesResponseHandler : public OperationResponseHandler, public SimpleObjectResponseHandler class ReferencesResponseHandler : public OperationResponseHandler, public SimpleObjectResponseHandler
Line 366 
Line 689 
     {     {
     }     }
  
     virtual void complete()      virtual void deliver(const CIMObject & cimObject)
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,          if(cimObject.isUninitialized())
                     "OperationResponseHandler: complete()");          {
               MessageLoaderParms message(
                   "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
  
         static_cast<CIMReferencesResponseMessage *>(              throw CIMException(CIM_ERR_FAILED, message);
             getResponse())->cimObjects = getObjects();          }
  
                 // l10n          SimpleObjectResponseHandler::deliver(cimObject);
                 getResponse()->contentLanguages = getLanguages();      }
   
   protected:
       virtual String getClass(void) const
       {
           return(String("ReferencesResponseHandler"));
     }     }
  
       virtual void transfer(void)
       {
           CIMReferencesResponseMessage & msg =
               *static_cast<CIMReferencesResponseMessage *>(getResponse());
   
           msg.cimObjects = getObjects();
       }
 }; };
  
 class ReferenceNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler class ReferenceNamesResponseHandler : public OperationResponseHandler, public SimpleObjectPathResponseHandler
Line 390 
Line 728 
     {     {
     }     }
  
     virtual void complete()      virtual void deliver(const CIMObjectPath & cimObjectPath)
       {
           if(cimObjectPath.getClassName().isNull())
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,              MessageLoaderParms message(
                     "OperationResponseHandler: complete()");                  "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
  
         static_cast<CIMReferenceNamesResponseMessage *>(              throw CIMException(CIM_ERR_FAILED, message);
             getResponse())->objectNames.appendArray(getObjects());          }
  
                 // l10n          SimpleObjectPathResponseHandler::deliver(cimObjectPath);
                 getResponse()->contentLanguages = getLanguages();      }
   
   protected:
       virtual String getClass(void) const
       {
           return(String("ReferenceNamesResponseHandler"));
     }     }
  
       virtual void transfer(void)
       {
           CIMReferenceNamesResponseMessage & msg =
               *static_cast<CIMReferenceNamesResponseMessage *>(getResponse());
   
           msg.objectNames = getObjects();
       }
 }; };
  
 class InvokeMethodResponseHandler : public OperationResponseHandler, public SimpleMethodResultResponseHandler class InvokeMethodResponseHandler : public OperationResponseHandler, public SimpleMethodResultResponseHandler
Line 414 
Line 767 
     {     {
     }     }
  
     virtual void complete()      virtual void deliverParamValue(const CIMParamValue & cimParamValue)
       {
           if(cimParamValue.isUninitialized())
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,              MessageLoaderParms message(
             "OperationResponseHandler: complete()");                  "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
  
         // ATTN-RK-20020903: Is it legal for the return value to be null?              throw CIMException(CIM_ERR_FAILED, message);
         //if(getReturnValue().isNull())          }
         //{  
             // ATTN: error? provider claims success, but did not deliver a CIMValue.  
         //    return;  
         //}  
  
         static_cast<CIMInvokeMethodResponseMessage *>(          SimpleMethodResultResponseHandler::deliverParamValue(cimParamValue);
             getResponse())->outParameters = getParamValues();      }
  
         static_cast<CIMInvokeMethodResponseMessage *>(      virtual void deliver(const CIMValue & cimValue)
             getResponse())->retValue = getReturnValue();      {
           if(cimValue.isNull())
           {
               MessageLoaderParms message(
                   "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
  
                 // l10n              throw CIMException(CIM_ERR_FAILED, message);
                 getResponse()->contentLanguages = getLanguages();  
     }     }
  
           SimpleMethodResultResponseHandler::deliver(cimValue);
       }
   
   protected:
       virtual String getClass(void) const
       {
           return(String("InvokeMethodResponseHandler"));
       }
   
       virtual void transfer(void)
       {
           CIMInvokeMethodResponseMessage & msg =
               *static_cast<CIMInvokeMethodResponseMessage *>(getResponse());
   
           msg.outParameters = getParamValues();
   
           // ATTN-RK-20020903: Is it legal for the return value to be null?
           // if not, then the check must be done here since deliver() works off the
           // virtual size, which refers to out parameters!
           msg.retValue = getReturnValue();
       }
 }; };
  
   typedef void (*PEGASUS_INDICATION_CALLBACK)(CIMProcessIndicationRequestMessage*);
  
 class EnableIndicationsResponseHandler : public OperationResponseHandler, public SimpleIndicationResponseHandler class EnableIndicationsResponseHandler : public OperationResponseHandler, public SimpleIndicationResponseHandler
 { {
 public: public:
     EnableIndicationsResponseHandler(     EnableIndicationsResponseHandler(
         CIMEnableIndicationsRequestMessage * request,          CIMRequestMessage * request,
         CIMEnableIndicationsResponseMessage * response,          CIMResponseMessage * response,
         CIMInstance & provider,         CIMInstance & provider,
         MessageQueueService * source,          PEGASUS_INDICATION_CALLBACK indicationCallback)
         MessageQueueService * target = 0)  
     : OperationResponseHandler(request, response),     : OperationResponseHandler(request, response),
         _source(source),          _indicationCallback(indicationCallback)
         _target(target),  
         _request_copy(*request),  
         _response_copy(*response)  
     {     {
         PEGASUS_ASSERT(_source != 0);  
   
         _provider = provider;         _provider = provider;
   
         // get indication service  
         if(_target == 0)  
         {  
             Array<Uint32> serviceIds;  
   
             _source->find_services(PEGASUS_QUEUENAME_INDICATIONSERVICE, 0, 0, &serviceIds);  
   
             PEGASUS_ASSERT(serviceIds.size() != 0);  
   
             _target = dynamic_cast<MessageQueueService *>(MessageQueue::lookup(serviceIds[0]));  
   
             PEGASUS_ASSERT(_target != 0);  
         }  
     }     }
  
     virtual void deliver(const CIMIndication & cimIndication)     virtual void deliver(const CIMIndication & cimIndication)
Line 479 
Line 837 
  
         Array<CIMObjectPath> subscriptionInstanceNames;         Array<CIMObjectPath> subscriptionInstanceNames;
  
         context.insert(SubscriptionInstanceNamesContainer          context.insert(SubscriptionInstanceNamesContainer(subscriptionInstanceNames));
             (subscriptionInstanceNames));  
  
         deliver(context, cimIndication);         deliver(context, cimIndication);
     }     }
  
     virtual void deliver(const OperationContext & context, const CIMIndication & cimIndication)     virtual void deliver(const OperationContext & context, const CIMIndication & cimIndication)
     {     {
         Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,          if(cimIndication.isUninitialized())
                     "OperationResponseHandler: deliver()");          {
               MessageLoaderParms message(
                   "Common.Exception.UNINITIALIZED_OBJECT_EXCEPTION",
                   "The object is not initialized.");
   
               throw CIMException(CIM_ERR_FAILED, message);
           }
   
         // ATTN: temporarily convert indication to instance         // ATTN: temporarily convert indication to instance
         CIMInstance cimInstance(cimIndication);         CIMInstance cimInstance(cimIndication);
  
         //  
         //  Get list of subscription instance names from context         //  Get list of subscription instance names from context
         //  
         Array<CIMObjectPath> subscriptionInstanceNames;         Array<CIMObjectPath> subscriptionInstanceNames;
   
         try         try
         {         {
             SubscriptionInstanceNamesContainer container = context.get              SubscriptionInstanceNamesContainer container =
                  (SubscriptionInstanceNamesContainer::NAME);                  context.get(SubscriptionInstanceNamesContainer::NAME);
  
             subscriptionInstanceNames =              subscriptionInstanceNames = container.getInstanceNames();
                 container.getInstanceNames();  
         }         }
         catch (Exception& e)          catch(Exception &)
         {         {
             subscriptionInstanceNames.clear();             subscriptionInstanceNames.clear();
         }         }
  
 // l10n // l10n
                 ContentLanguages contentLangs;                 ContentLanguages contentLangs;
   
                 try                 try
                 {                 {
                         // Get the Content-Language for this indication.  The provider                         // Get the Content-Language for this indication.  The provider
                         // does not have to add specify a language for the indication.                         // does not have to add specify a language for the indication.
                         ContentLanguageListContainer langContainer = context.get              ContentLanguageListContainer langContainer =
                                 (ContentLanguageListContainer::NAME);                  context.get(ContentLanguageListContainer::NAME);
  
                         contentLangs = langContainer.getLanguages();                         contentLangs = langContainer.getLanguages();
                 } catch (Exception & e)          }
           catch(Exception &)
                 {                 {
                         // The provider did not explicitly set a Content-Language for                         // The provider did not explicitly set a Content-Language for
                         // the indication.  Fall back to the lang set in this object.                         // the indication.  Fall back to the lang set in this object.
Line 531 
Line 895 
 // l10n // l10n
         CIMProcessIndicationRequestMessage * request =         CIMProcessIndicationRequestMessage * request =
             new CIMProcessIndicationRequestMessage(             new CIMProcessIndicationRequestMessage(
              _request_copy.messageId,              XmlWriter::getNextMessageId(),
             cimInstance.getPath().getNameSpace(),             cimInstance.getPath().getNameSpace(),
             cimInstance,             cimInstance,
             subscriptionInstanceNames,             subscriptionInstanceNames,
             _provider,             _provider,
             QueueIdStack(_target->getQueueId(), _source->getQueueId()),              QueueIdStack());  // Must be filled in by the callback function
             contentLangs);  
         request->operationContext = context;         request->operationContext = context;
  
         // send message          try
         // <<< Wed Apr 10 21:04:00 2002 mdd >>>          {
         // AsyncOpNode * op = _source->get_op();              request->operationContext.set(ContentLanguageListContainer(contentLangs));
           }
         AsyncLegacyOperationStart * asyncRequest =          catch(Exception &)
             new AsyncLegacyOperationStart(          {
             _source->get_next_xid(),              request->operationContext.insert(ContentLanguageListContainer(contentLangs));
             0,          }
             _target->getQueueId(),  
             request,          _indicationCallback(request);
             _target->getQueueId());  
   
         PEGASUS_ASSERT(asyncRequest != 0);  
   
         //AsyncReply * asyncReply = _source->SendWait(asyncRequest);  
         // <<< Wed Apr 10 21:04:50 2002 mdd >>>  
         _source->SendForget(asyncRequest);  
         //PEGASUS_ASSERT(asyncReply != 0);  
   
         //  Chip - receiver of the request should delete it  
         //delete asyncRequest;  
         // <<< Wed Apr 10 21:05:10 2002 mdd >>>  
     }     }
  
     virtual void deliver(const Array<CIMIndication> & cimIndications)     virtual void deliver(const Array<CIMIndication> & cimIndications)
Line 580 
Line 932 
     }     }
  
 protected: protected:
     MessageQueueService * _source;      virtual String getClass(void) const
     MessageQueueService * _target;      {
           return(String("EnableIndicationsResponseHandler"));
       }
   
       virtual Boolean isAsync(void) const
       {
           return(false);
       }
  
 private: private:
     CIMEnableIndicationsRequestMessage _request_copy;      PEGASUS_INDICATION_CALLBACK _indicationCallback;
     CIMEnableIndicationsResponseMessage _response_copy;  
 }; };
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.24

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2