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

Diff for /pegasus/src/Pegasus/Common/CIMResponseData.h between version 1.6.2.2 and 1.6.2.18

version 1.6.2.2, 2011/10/11 18:18:08 version 1.6.2.18, 2014/05/02 19:36:25
Line 27 
Line 27 
 // //
 ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
 // //
   // Class CIMResponseData encapsulates the possible types of response data
   // representations and supplies conversion methods between these types.
   // PEP#348 - The CMPI infrastructure using SCMO (Single Chunk Memory Objects)
   // describes its usage in the server flow.
   // The design document can be found on the OpenPegasus website openpegasus.org
   // at https://collaboration.opengroup.org/pegasus/pp/documents/21210/PEP_348.pdf
   //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #ifndef Pegasus_CIMResponseData_h #ifndef Pegasus_CIMResponseData_h
Line 39 
Line 46 
 #include <Pegasus/Common/SCMOClass.h> #include <Pegasus/Common/SCMOClass.h>
 #include <Pegasus/Common/SCMOInstance.h> #include <Pegasus/Common/SCMOInstance.h>
 #include <Pegasus/Common/SCMODump.h> #include <Pegasus/Common/SCMODump.h>
   #include <Pegasus/Common/Mutex.h>           // KS_TODO  Remove
 #include <Pegasus/Common/Magic.h> #include <Pegasus/Common/Magic.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
 PEGASUS_USING_STD; PEGASUS_USING_STD;
   
 typedef Array<Sint8> ArraySint8; typedef Array<Sint8> ArraySint8;
 #define PEGASUS_ARRAY_T ArraySint8 #define PEGASUS_ARRAY_T ArraySint8
 # include <Pegasus/Common/ArrayInter.h> # include <Pegasus/Common/ArrayInter.h>
Line 66 
Line 75 
         RESP_OBJECTS = 4,         RESP_OBJECTS = 4,
         RESP_OBJECTPATHS = 5         RESP_OBJECTPATHS = 5
     };     };
     //includeClassOrigin & _includeQualifiers are set to true by default.      /** Constructor that sets the ResponseDataContent attributes.
     //_propertyList is initialized to an empty propertylist to enable          includeClassOrigin & _includeQualifiers are set to true by
     // sending all properties by default.          default. //_propertyList is initialized to an empty
           propertylist to enable // sending all properties by default.
           _isClassOperation set false and // only reset by selected
           operations (ex. associator response builder)
       */
     CIMResponseData(ResponseDataContent content):     CIMResponseData(ResponseDataContent content):
         _encoding(0),_mapObjectsToIntances(false),_dataType(content), _size(0),          _encoding(0),_dataType(content),_size(0),
          _includeQualifiers(true),_includeClassOrigin(true),          _includeQualifiers(true),
           _includeClassOrigin(true),
           _isClassOperation(false),
         _propertyList(CIMPropertyList())         _propertyList(CIMPropertyList())
     {      {}
         PEGASUS_ASSERT(valid()); // KS_TEMP  
     }  
  
     CIMResponseData(const CIMResponseData & x):     CIMResponseData(const CIMResponseData & x):
         _encoding(x._encoding),         _encoding(x._encoding),
Line 95 
Line 108 
         _scmoInstances(x._scmoInstances),         _scmoInstances(x._scmoInstances),
         _includeQualifiers(x._includeQualifiers),         _includeQualifiers(x._includeQualifiers),
         _includeClassOrigin(x._includeClassOrigin),         _includeClassOrigin(x._includeClassOrigin),
           _isClassOperation(x._isClassOperation),
         _propertyList(x._propertyList),         _propertyList(x._propertyList),
         _magic(x._magic)         _magic(x._magic)
     {     {
         /////PEGASUS_ASSERT(x.valid());     // KS_TEMP          PEGASUS_DEBUG_ASSERT(valid());
         PEGASUS_ASSERT(valid());            // KS_TEMP  
     }     }
  
     // Construct an empty object.  Issue here in that we would like to      /**Construct an empty object.  Issue here in that we would like
     // assure that this is invalid but if we add the _dataType parameter         to assure that this is invalid but if we add the _dataType
     // it must be a valid one.  The alternative would be to define an         parameter it must be a valid one.  The alternative would be
     // invalid enum but that would cost us in all case/if statements.         to define an invalid enum but that would cost us in all
     // Therefore up to the user to create and then use correctly.         case/if statements. Therefore up to the user to create and
     // KS_TODO fix this so that the empty state is somehow protected.         then use correctly. KS_TODO fix this so that the empty state
          is somehow protected.
       */
     CIMResponseData():     CIMResponseData():
         _encoding(0),_mapObjectsToIntances(false), _size(0),         _encoding(0),_mapObjectsToIntances(false), _size(0),
         _includeQualifiers(true), _includeClassOrigin(true),         _includeQualifiers(true), _includeClassOrigin(true),
         _propertyList(CIMPropertyList())         _propertyList(CIMPropertyList())
     {}      {
           PEGASUS_DEBUG_ASSERT(valid());
       }
  
     /**     /**
      * Move CIM objects from another CIMResponse data object to this      * Move CIM objects from another CIMResponse data object to this
Line 134 
Line 151 
      */      */
     Uint32 size();     Uint32 size();
  
       /** Set the internal size variable based on the current count
          of what is in the CIMResponseData.  This operation
          required after users have played with the arrays. See
          CQLOperationRequestDispatcher for example
        */
   
       void setSize();
   
       /** Determine if there is any binary content in the CIM
           ResponseData object
           @return Boolean true if binary data exists in content.
        */
       Boolean hasBinaryData() const;
   
     ~CIMResponseData()     ~CIMResponseData()
       { }
   
       /** Issue with pull and other operations
          in that the other assoc operations return objects and objectPaths
          and the pulls return instances and instancePaths. The pull operation
          must be able to handle either so we use this to reset the datatype
       */
       void setDataType(ResponseDataContent content)
     {     {
           PEGASUS_DEBUG_ASSERT(valid());
           // This assert is temp test since the object should be zero
           // size when data type set.
           PEGASUS_ASSERT(_size == 0);
           _dataType = content;
     }     }
  
     // This one may be a hack but we have issue with pull and other operations      /** Move key attributes from one CIMResponseData object to
     // in that the other assoc operations return objects and objectPaths         another. The attributes include the _dataType,
     // and the pulls return instances and instancePaths). The pull operation         includeQualifiers and includeClassOrigin and properties
     // must be able to handle either so we use this to reset the datatype         parameters. This used with pull operations to set up
     // KS_TODO -- This should check size and only allow if nothing in the         output CIMResponseData from cache.
     // object.         @param from CIMResponseData object that is source for attributes
     Boolean setDataType(ResponseDataContent content)       */
       void setResponseAttributes(CIMResponseData& from)
     {     {
         PEGASUS_ASSERT(valid());          PEGASUS_DEBUG_ASSERT(valid());
         PEGASUS_ASSERT(_size == 0);      // KS_TODO_TEMP or debug mode.         PEGASUS_ASSERT(_size == 0);      // KS_TODO_TEMP or debug mode.
         _dataType = content;          _dataType = from._dataType;
         return true;          _includeQualifiers = from._includeQualifiers;
           _includeClassOrigin = from._includeClassOrigin;
           _propertyList = from._propertyList;
     }     }
  
     // get the datatype property      /** get the datatype property
          @return ResponseDataContent enum value
       */
     ResponseDataContent getResponseDataContent()     ResponseDataContent getResponseDataContent()
     {     {
         PEGASUS_ASSERT(valid());            // KS_TEMP KS_TODO          PEGASUS_DEBUG_ASSERT(valid());
         return _dataType;         return _dataType;
     }     }
     // C++ objects interface handling      /*******************************************************************
       **
       **     C++ objects interface handling
       **
       *******************************************************************/
  
     // Instance Names handling     // Instance Names handling
     Array<CIMObjectPath>& getInstanceNames();     Array<CIMObjectPath>& getInstanceNames();
Line 169 
Line 222 
         _encoding |= RESP_ENC_CIM;         _encoding |= RESP_ENC_CIM;
         _size += x.size();         _size += x.size();
     }     }
       // See also setArrayData with CIMObjects below.
       void setArrayData(const Array<CIMObjectPath>& x)
       {
           setInstanceNames(x);
       }
  
     // Instance handling     // Instance handling
     CIMInstance& getInstance();     CIMInstance& getInstance();
  
     void setInstance(const CIMInstance& x)     void setInstance(const CIMInstance& x)
     {     {
         SVALID();  
         _instances.clear();         _instances.clear();
         _instances.append(x);         _instances.append(x);
         _size++;         _size++;
         _encoding |= RESP_ENC_CIM;         _encoding |= RESP_ENC_CIM;
   
         SVALID();  
     }     }
  
     // Instances handling     // Instances handling
Line 200 
Line 255 
  
     void setInstances(const Array<CIMInstance>& x)     void setInstances(const Array<CIMInstance>& x)
     {     {
         SVALID();  
         _instances=x;         _instances=x;
         _encoding |= RESP_ENC_CIM;         _encoding |= RESP_ENC_CIM;
         _size += x.size();         _size += x.size();
         SVALID();  
     }     }
  
     void appendInstance(const CIMInstance& x)     void appendInstance(const CIMInstance& x)
     {     {
         PEGASUS_ASSERT(valid());          PEGASUS_DEBUG_ASSERT(valid());
         _instances.append(x);         _instances.append(x);
         _encoding |= RESP_ENC_CIM;         _encoding |= RESP_ENC_CIM;
         _size += 1;         _size += 1;
Line 217 
Line 270 
  
     void appendInstances(const Array<CIMInstance>& x)     void appendInstances(const Array<CIMInstance>& x)
     {     {
         PEGASUS_ASSERT(valid());          PEGASUS_DEBUG_ASSERT(valid());
         _instances.appendArray(x);         _instances.appendArray(x);
         _encoding |= RESP_ENC_CIM;         _encoding |= RESP_ENC_CIM;
         _size += x.size();         _size += x.size();
Line 225 
Line 278 
  
     // Objects handling     // Objects handling
     Array<CIMObject>& getObjects();     Array<CIMObject>& getObjects();
   
     void setObjects(const Array<CIMObject>& x)     void setObjects(const Array<CIMObject>& x)
     {     {
         PEGASUS_ASSERT(valid());          PEGASUS_DEBUG_ASSERT(valid());
         _objects=x;         _objects=x;
         _encoding |= RESP_ENC_CIM;         _encoding |= RESP_ENC_CIM;
         _size += x.size();         _size += x.size();
     }     }
   
       // Sets array of CIMObjects into the CIMResponseData
       //// TODO. We could make this name the common function for
       //// setObjects.
       //   NOTE: This was added to provider overloaded
       //     function for setting arrays of both CIMObject and
       //   CIMObjectPaths from CIMOperationRequestDispatcher
       void setArrayData(const Array<CIMObject>& x)
       {
           setObjects(x);
       }
     void appendObject(const CIMObject& x)     void appendObject(const CIMObject& x)
     {     {
         PEGASUS_ASSERT(valid());          //// AutoMutex autoMut(testLock);
           PEGASUS_DEBUG_ASSERT(valid());
         _objects.append(x);         _objects.append(x);
         _encoding |= RESP_ENC_CIM;         _encoding |= RESP_ENC_CIM;
         _size += 1;         _size += 1;
     }     }
  
       /*******************************************************************
       **
       **     SCMO objects interface handling
       **
       *******************************************************************/
     // SCMO representation, single instance stored as one element array     // SCMO representation, single instance stored as one element array
     // object paths are represented as SCMOInstance     // object paths are represented as SCMOInstance
     Array<SCMOInstance>& getSCMO();     Array<SCMOInstance>& getSCMO();
Line 248 
Line 319 
  
     void appendSCMO(const Array<SCMOInstance>& x)     void appendSCMO(const Array<SCMOInstance>& x)
     {     {
         PEGASUS_ASSERT(valid());          PEGASUS_DEBUG_ASSERT(valid());
         _scmoInstances.appendArray(x);         _scmoInstances.appendArray(x);
         _encoding |= RESP_ENC_SCMO;         _encoding |= RESP_ENC_SCMO;
         _size += x.size();         _size += x.size();
Line 277 
Line 348 
  
     // Function primarily used by CIMOperationRequestDispatcher to complete     // Function primarily used by CIMOperationRequestDispatcher to complete
     // namespace and hostname on a,an,r and rn operations in the     // namespace and hostname on a,an,r and rn operations in the
     // OperationAggregator      // OperationAggregator. Note that behavior is different for pull operations
     void completeHostNameAndNamespace(     void completeHostNameAndNamespace(
         const String & hn,         const String & hn,
         const CIMNamespaceName & ns);          const CIMNamespaceName & ns,
           Boolean isPullOperation = false);
  
     // Encoding responses     // Encoding responses
  
Line 290 
Line 362 
  
     // Encode the CIMResponse data into Xml format used with Provider Agents     // Encode the CIMResponse data into Xml format used with Provider Agents
     //  only in the provided CIMBuffer     //  only in the provided CIMBuffer
     void encodeInternalXmlResponse(CIMBuffer& out);      void encodeInternalXmlResponse(CIMBuffer& out,
           Boolean isPullResponse = false);
  
     // Encode the CIMResponse data into official Xml format(CIM over Http)     // Encode the CIMResponse data into official Xml format(CIM over Http)
     // used to communicate to clients in the provided CIMBuffer.     // used to communicate to clients in the provided CIMBuffer.
     //Note that the pull responses requires a flag.      // The pull responses requires a flag (isPull) and the special
     void encodeXmlResponse(Buffer& out, Boolean isPull);      // case  of encoding OpenQueryInstances and PullInstances a second flag
       // (encodeInstanceOnly which only encodes the instance itself)
       void encodeXmlResponse(Buffer& out,
           Boolean isPull,
           Boolean encodeInstanceOnly = false);
  
     // diagnostic tests magic number in context to see if valid object     // diagnostic tests magic number in context to see if valid object
     Boolean valid();      Boolean valid() const;
  
     // official Xml format(CIM over Http) used to communicate to clients     // official Xml format(CIM over Http) used to communicate to clients
     void encodeXmlResponse(Buffer& out);     void encodeXmlResponse(Buffer& out);
Line 311 
Line 388 
         const Boolean includeClassOrigin,         const Boolean includeClassOrigin,
         const CIMPropertyList& propertyList);         const CIMPropertyList& propertyList);
  
       // Used with association and reference operations (i.e. operations that
       // return CIMObject or CIMObjectPath to set a parameter to define whether
       // responseData is for operation on a class or instance.
       // Allows building the correct path (classPath or instancePath) and
       // object type (Class or Instance) on response.
       void setIsClassOperation(Boolean b);
   
     void setPropertyList(const CIMPropertyList& propertyList)     void setPropertyList(const CIMPropertyList& propertyList)
     {     {
         _propertyList = propertyList;         _propertyList = propertyList;
Line 320 
Line 404 
         return _propertyList;         return _propertyList;
     }     }
  
     void SVALID();                   //KS_TEMP      void traceResponseData();           // KS_TODO Diagnostic. remove
       String toStringTraceResponseData();  // KS_TODO Diagnostic remove
   
       void resolveBinaryToSCMO();
  
 private: private:
  
Line 331 
Line 418 
     void _resolveToCIM();     void _resolveToCIM();
     void _resolveToSCMO();     void _resolveToSCMO();
  
     void _resolveBinary();      void _resolveBinaryToSCMO();
  
     void _resolveXmlToSCMO();     void _resolveXmlToSCMO();
     void _resolveXmlToCIM();     void _resolveXmlToCIM();
Line 344 
Line 431 
     SCMOInstance _getSCMOFromCIMObject(const CIMObject& cimObj);     SCMOInstance _getSCMOFromCIMObject(const CIMObject& cimObj);
     SCMOInstance _getSCMOFromCIMObjectPath(const CIMObjectPath& cimPath);     SCMOInstance _getSCMOFromCIMObjectPath(const CIMObjectPath& cimPath);
     SCMOClass* _getSCMOClass(const char* ns,const char* cls);     SCMOClass* _getSCMOClass(const char* ns,const char* cls);
       void _deserializeInstance(Uint32 idx,CIMInstance& cimInstance);
       void _deserializeObject(Uint32 idx,CIMObject& cimObject);
       Boolean _deserializeReference(Uint32 idx,CIMObjectPath& cimObjectPath);
       Boolean _deserializeInstanceName(Uint32 idx,CIMObjectPath& cimObjectPath);
       void _appendInstanceElement(Buffer& out, SCMOInstance _scmoInstance);
  
     // Bitflags in this integer will reflect what data representation types      // Bitflags in this integer reflect what data representation types
     // are currently stored in this CIMResponseData object     // are currently stored in this CIMResponseData object
     Uint32 _encoding;     Uint32 _encoding;
  
Line 359 
Line 451 
  
     // Count of objects stored in this CIMResponseData object.  This is the     // Count of objects stored in this CIMResponseData object.  This is the
     // accumulated count of objects stored in all of the data     // accumulated count of objects stored in all of the data
     // representations      // representations. Note that there are a couple of cases where the
       // CIMResponseData can be used in a way that makes this not 100% accurate.
     Uint32 _size;     Uint32 _size;
  
     // unused arrays are represented by ArrayRepBase _empty_rep     // unused arrays are represented by ArrayRepBase _empty_rep
Line 385 
Line 478 
  
     // SCMO encoding     // SCMO encoding
     Array<SCMOInstance> _scmoInstances;     Array<SCMOInstance> _scmoInstances;
   
       // Request characteristics that are carried through operation for
       // modification of response generation.
     Boolean _includeQualifiers;     Boolean _includeQualifiers;
     Boolean _includeClassOrigin;     Boolean _includeClassOrigin;
       // Defines whether response CIMObjects or ObjectPaths are class or instance.
       // because associators, etc. operations provide both class and instance
       // responses. Default is false and should only be set to true by
       // operation requests such as associators (which could return either
       // instances or classes) when the operation is to return class information.
       Boolean _isClassOperation;
     CIMPropertyList _propertyList;     CIMPropertyList _propertyList;
  
       // Function lock used for debugging cases where there might have been an
       //  issue  with multithreading and CIMResponseData.
       //// KS_TODO remove before pull checkin
       Mutex testLock;
   
     // magic number to use with valid function to confirm validity     // magic number to use with valid function to confirm validity
     // of response data.     // of response data.
     Magic<0x57D11323> _magic;     Magic<0x57D11323> _magic;
   
 }; };
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.6.2.2  
changed lines
  Added in v.1.6.2.18

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2