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

Diff for /pegasus/src/Pegasus/Common/XmlWriter.h between version 1.21.2.1 and 1.89

version 1.21.2.1, 2001/07/18 22:23:46 version 1.89, 2008/12/01 17:49:57
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM,  // Licensed to The Open Group (TOG) under one or more contributor license
 // The Open Group, Tivoli Systems  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
   // this work for additional information regarding copyright ownership.
   // Each contributor licenses this file to you under the OpenPegasus Open
   // Source License; you may not use this file except in compliance with the
   // License.
 // //
 // 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
 // of this software and associated documentation files (the "Software"), to  // copy of this software and associated documentation files (the "Software"),
 // deal in the Software without restriction, including without limitation the  // to deal in the Software without restriction, including without limitation
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // sell copies of the Software, and to permit persons to whom the Software is  // and/or sell copies of the Software, and to permit persons to whom the
 // furnished to do so, subject to the following conditions:  // Software is furnished to do so, subject to the following conditions:
 //  
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
 // //
 //==============================================================================  // The above copyright notice and this permission notice shall be included
   // in all copies or substantial portions of the Software.
 // //
 // Author: Mike Brasher (mbrasher@bmc.com)  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // //
 // Modified By:  //////////////////////////////////////////////////////////////////////////
 //         Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)  
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 33 
Line 34 
  
 #include <iostream> #include <iostream>
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/Exception.h>  #include <Pegasus/Common/InternalException.h>
 #include <Pegasus/Common/Array.h>  #include <Pegasus/Common/ArrayInternal.h>
 #include <Pegasus/Common/String.h> #include <Pegasus/Common/String.h>
 #include <Pegasus/Common/Indentor.h>  #include <Pegasus/Common/CIMObject.h>
 #include <Pegasus/Common/CIMReference.h>  #include <Pegasus/Common/CIMClass.h>
   #include <Pegasus/Common/CIMInstance.h>
   #include <Pegasus/Common/CIMProperty.h>
   #include <Pegasus/Common/CIMMethod.h>
   #include <Pegasus/Common/CIMParameter.h>
   #include <Pegasus/Common/CIMQualifier.h>
   #include <Pegasus/Common/CIMQualifierDecl.h>
   #include <Pegasus/Common/CIMValue.h>
   #include <Pegasus/Common/CIMObjectPath.h>
   #include <Pegasus/Common/CIMPropertyList.h>
   #include <Pegasus/Common/CIMParamValue.h>
   #include <Pegasus/Common/Message.h>
   #include <Pegasus/Common/Linkage.h>
   #include <Pegasus/Common/ContentLanguageList.h>
   #include <Pegasus/Common/AcceptLanguageList.h>
   #include <Pegasus/Common/Buffer.h>
   #include <Pegasus/Common/StrLit.h>
   #include <Pegasus/Common/XmlGenerator.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 class CIMConstQualifierDecl;  class PEGASUS_COMMON_LINKAGE XmlWriter : public XmlGenerator
 class CIMConstClass;  
 class CIMConstInstance;  
   
 class PEGASUS_COMMON_LINKAGE XmlWriter  
 { {
 public: public:
  
     static void append(Array<Sint8>& out, Char16 x);      static void appendLocalNameSpacePathElement(
           Buffer& out,
     static void append(Array<Sint8>& out, char x)          const CIMNamespaceName& nameSpace);
     {  
         append(out, Char16(x));      static void appendNameSpacePathElement(
     }          Buffer& out,
           const String& host,
     static void append(Array<Sint8>& out, const char* x);          const CIMNamespaceName& nameSpace);
   
     static void append(Array<Sint8>& out, const String& x);      static void appendClassNameElement(
           Buffer& out,
     static void append(Array<Sint8>& out, Uint32 x);          const CIMName& className);
   
       static void appendInstanceNameElement(
           Buffer& out,
           const CIMObjectPath& instanceName);
   
       static void appendClassPathElement(
           Buffer& out,
           const CIMObjectPath& classPath);
   
       static void appendInstancePathElement(
           Buffer& out,
           const CIMObjectPath& instancePath);
   
       static void appendLocalClassPathElement(
           Buffer& out,
           const CIMObjectPath& classPath);
   
       static void appendLocalInstancePathElement(
           Buffer& out,
           const CIMObjectPath& instancePath);
   
       static void appendLocalObjectPathElement(
           Buffer& out,
           const CIMObjectPath& objectPath);
   
       static void appendValueElement(
           Buffer& out,
           const CIMValue& value);
   
       static void printValueElement(
           const CIMValue& value,
           PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
   
       static void appendValueObjectWithPathElement(
           Buffer& out,
           const CIMObject& objectWithPath);
   
       static void appendValueReferenceElement(
           Buffer& out,
           const CIMObjectPath& reference,
           Boolean putValueWrapper);
   
       static void printValueReferenceElement(
           const CIMObjectPath& reference,
           PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
   
       static void appendValueNamedInstanceElement(
           Buffer& out,
           const CIMInstance& namedInstance);
   
       static void appendClassElement(
           Buffer& out,
           const CIMConstClass& cimclass);
   
       static void printClassElement(
           const CIMConstClass& cimclass,
           PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
  
     static void appendSpecial(Array<Sint8>& out, Char16 x);      static void appendInstanceElement(
           Buffer& out,
     static void appendSpecial(Array<Sint8>& out, char x);          const CIMConstInstance& instance);
   
     static void appendSpecial(Array<Sint8>& out, const char* x);  
   
     static void appendSpecial(Array<Sint8>& out, const String& x);  
   
     static void append(Array<Sint8>& out, const Indentor& x);  
  
     static void appendLocalNameSpaceElement(      static void printInstanceElement(
         Array<Sint8>& out,          const CIMConstInstance& instance,
         const String& nameSpace);          PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
   
       static void appendObjectElement(
           Buffer& out,
           const CIMConstObject& object);
   
       static void appendPropertyElement(
           Buffer& out,
           const CIMConstProperty& property);
   
       static void printPropertyElement(
           const CIMConstProperty& property,
           PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
   
       static void appendMethodElement(
           Buffer& out,
           const CIMConstMethod& method);
   
       static void printMethodElement(
           const CIMConstMethod& method,
           PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
   
       static void appendParameterElement(
           Buffer& out,
           const CIMConstParameter& parameter);
   
       static void printParameterElement(
           const CIMConstParameter& parameter,
           PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
   
       static void appendParamValueElement(
           Buffer& out,
           const CIMParamValue& paramValue);
   
       static void printParamValueElement(
           const CIMParamValue& paramValue,
           PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
   
       static void appendQualifierElement(
           Buffer& out,
           const CIMConstQualifier& qualifier);
   
       static void printQualifierElement(
           const CIMConstQualifier& qualifier,
           PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
  
     static void appendNameSpaceElement(      static void appendQualifierDeclElement(
         Array<Sint8>& out,          Buffer& out,
         const String& nameSpace);          const CIMConstQualifierDecl& qualifierDecl);
  
     static Array<Sint8> formatGetHeader(      static void printQualifierDeclElement(
         const char* documentPath);          const CIMConstQualifierDecl& qualifierDecl,
           PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
   
       static void appendQualifierFlavorEntity(
           Buffer& out,
           const CIMFlavor & flavor);
   
       static void appendScopeElement(
           Buffer& out,
           const CIMScope & scope);
  
     static Array<Sint8> formatMPostHeader(      static void appendMethodCallHeader(
           Buffer& out,
         const char* host,         const char* host,
         const char* cimOperation,          const CIMName& cimMethod,
         const char* cimMethod,  
         const String& cimObject,         const String& cimObject,
         const Array<Sint8>& content);          const String& authenticationHeader,
           HttpMethod httpMethod,
           const AcceptLanguageList& acceptLanguages,
           const ContentLanguageList& contentLanguages,
           Uint32 contentLength,
           bool binaryRequest = false,
           bool binaryResponse = false);
   
       static void appendMethodResponseHeader(
           Buffer& out,
           HttpMethod httpMethod,
           const ContentLanguageList& contentLanguages,
           Uint32 contentLength,
           Uint64 serverResponseTime = 0,
           bool binaryResponse = false);
   
       static void appendHttpErrorResponseHeader(
           Buffer& out,
           const String& status,
           const String& cimError = String::EMPTY,
           const String& errorDetail = String::EMPTY);
   
       static void appendUnauthorizedResponseHeader(
           Buffer& out,
           const String& content);
   
   #ifdef PEGASUS_KERBEROS_AUTHENTICATION
       static void appendOKResponseHeader(
           Buffer& out,
           const String& content);
   #endif
   
       static void appendParamTypeAndEmbeddedObjAttrib(
           Buffer& out,
           const CIMType& type);
   
       static void appendReturnValueElement(
           Buffer& out,
           const CIMValue& value);
  
     static Array<Sint8> formatMethodResponseHeader(      static void appendBooleanIParameter(
         const Array<Sint8>& content);          Buffer& out,
   
     static Array<Sint8> formatMessageElement(  
         const String& messageId,  
         const Array<Sint8>& body);  
   
     static Array<Sint8> formatSimpleReqElement(  
         const Array<Sint8>& body);  
   
     static Array<Sint8> formatSimpleRspElement(  
         const Array<Sint8>& body);  
   
     static Array<Sint8> formatIMethodCallElement(  
         const char* name,         const char* name,
         const String& nameSpace,          Boolean flag);
         const Array<Sint8>& iParamValues);  
   
     static Array<Sint8> formatIReturnValueElement(  
         const Array<Sint8>& body);  
  
     static Array<Sint8> formatIMethodResponseElement(      static void appendStringIParameter(
           Buffer& out,
         const char* name,         const char* name,
         const Array<Sint8>& iParamValues);          const String& str);
  
     static Array<Sint8>& formatIParamValueElement(      static void appendClassNameIParameter(
         Array<Sint8>& out,          Buffer& out,
         const char* name,         const char* name,
         const Array<Sint8>& body);          const CIMName& className);
   
     static Array<Sint8> formatErrorElement(  
         CIMStatusCode code,  
         const char* description);  
  
     static Array<Sint8>& appendBooleanParameter(      static void appendInstanceNameIParameter(
         Array<Sint8>& out,          Buffer& out,
         const char* parameterName,          const char* name,
         Boolean flag);          const CIMObjectPath& instanceName);
  
     static Array<Sint8>& appendStringParameter(      static void appendObjectNameIParameter(
         Array<Sint8>& out,          Buffer& out,
         const char* parameterName,          const char* name,
         const String& str);          const CIMObjectPath& objectName);
  
     static Array<Sint8>& appendClassNameParameter(      static void appendClassIParameter(
         Array<Sint8>& out,          Buffer& out,
         const char* parameterName,          const char* name,
         const String& className);  
   
     static Array<Sint8>& appendQualifierNameParameter(  
         Array<Sint8>& out,  
         const char* parameterName,  
         const String& qualifierName);  
   
     static Array<Sint8>& appendClassParameter(  
         Array<Sint8>& out,  
         const char* parameterName,  
         const CIMConstClass& cimClass);         const CIMConstClass& cimClass);
  
     static Array<Sint8>& appendInstanceNameParameter(      static void appendInstanceIParameter(
         Array<Sint8>& out,          Buffer& out,
         const char* parameterName,          const char* name,
         const CIMReference& instanceName);  
   
     static Array<Sint8>& appendInstanceParameter(  
         Array<Sint8>& out,  
         const char* parameterName,  
         const CIMConstInstance& instance);         const CIMConstInstance& instance);
  
     static Array<Sint8>& appendQualifierDeclarationParameter(      static void appendNamedInstanceIParameter(
         Array<Sint8>& out,          Buffer& out,
         const char* parameterName,          const char* name,
         const CIMConstQualifierDecl& qualifierDecl);          const CIMInstance& namedInstance) ;
  
     static Array<Sint8>& appendClassNameElement(      static void appendPropertyNameIParameter(
         Array<Sint8>& out,          Buffer& out,
         const String& className);          const CIMName& propertyName);
  
     static Array<Sint8>& appendInstanceNameElement(      static void appendPropertyValueIParameter(
         Array<Sint8>& out,          Buffer& out,
         const CIMReference& instanceName);          const char* name,
           const CIMValue& value);
  
     static Array<Sint8>& appendPropertyNameParameter(      static void appendPropertyListIParameter(
         Array<Sint8>& out,          Buffer& out,
         const String& propertyName);          const CIMPropertyList& propertyList);
  
     static Array<Sint8>& appendObjectNameParameter(      static void appendQualifierDeclarationIParameter(
         Array<Sint8>& out,          Buffer& out,
         const char* name,         const char* name,
         const CIMReference& objectName);          const CIMConstQualifierDecl& qualifierDecl);
  
     static void indentedPrint(      static Buffer formatHttpErrorRspMessage(
         PEGASUS_STD(ostream)& os,          const String& status,
         const char* text,          const String& cimError = String::EMPTY,
         Uint32 indentChars = 2);          const String& errorDetail = String::EMPTY);
  
     static Array<Sint8> formatSimpleReqMessage(      static Buffer formatSimpleMethodReqMessage(
         const char* host,         const char* host,
         const String& nameSpace,          const CIMNamespaceName& nameSpace,
         const char* iMethodName,          const CIMObjectPath& path,
         const Array<Sint8>& body);          const CIMName& methodName,
           const Array<CIMParamValue>& parameters,
           const String& messageId,
           HttpMethod httpMethod,
           const String& authenticationHeader,
           const AcceptLanguageList& httpAcceptLanguages,
           const ContentLanguageList& httpContentLanguages,
           bool binaryResponse);
  
     static Array<Sint8> formatSimpleRspMessage(      static Buffer formatSimpleMethodRspMessage(
         const char* iMethodName,          const CIMName& methodName,
         const String& messageId,         const String& messageId,
         const Array<Sint8>& body);          HttpMethod httpMethod,
           const ContentLanguageList& httpContentLanguages,
           const Buffer& body,
           Uint64 serverResponseTime,
           Boolean isFirst = true,
           Boolean isLast = true);
  
     static String getNextMessageId();      static Buffer formatSimpleMethodErrorRspMessage(
           const CIMName& methodName,
           const String& messageId,
           HttpMethod httpMethod,
           const CIMException& cimException);
  
     static Array<Sint8> formatSimpleIndicationReqMessage(      static Buffer formatSimpleIMethodReqMessage(
         const char* host,         const char* host,
         const String& nameSpace,          const CIMNamespaceName& nameSpace,
         const char* iMethodName,          const CIMName& iMethodName,
         const Array<Sint8>& body);          const String& messageId,
           HttpMethod httpMethod,
           const String& authenticationHeader,
           const AcceptLanguageList& httpAcceptLanguages,
           const ContentLanguageList& httpContentLanguages,
           const Buffer& body,
           bool binaryResponse);
   
       static Buffer formatSimpleIMethodRspMessage(
           const CIMName& iMethodName,
           const String& messageId,
           HttpMethod httpMethod,
           const ContentLanguageList& httpContentLanguages,
           const Buffer& body,
           Uint64 serverResponseTime,
           Boolean isFirst = true,
           Boolean isLast = true);
   
  
     static Array<Sint8> formatEMethodCallElement(      static Buffer formatSimpleIMethodErrorRspMessage(
           const CIMName& iMethodName,
           const String& messageId,
           HttpMethod httpMethod,
           const CIMException& cimException);
   
       static void appendInstanceEParameter(
           Buffer& out,
         const char* name,         const char* name,
         const String& nameSpace,          const CIMInstance& instance);
         const Array<Sint8>& iParamValues);  
  
     static Array<Sint8> formatMPostIndicationHeader(      static void appendEMethodRequestHeader(
           Buffer& out,
           const char* requestUri,
         const char* host,         const char* host,
         const char* cimOperation,          const CIMName& cimMethod,
         const char* cimMethod,          HttpMethod httpMethod,
         const String& cimObject,          const String& authenticationHeader,
         const Array<Sint8>& content);          const AcceptLanguageList& acceptLanguages,
           const ContentLanguageList& contentLanguages,
           Uint32 contentLength);
   
       static void appendEMethodResponseHeader(
           Buffer& out,
           HttpMethod httpMethod,
           const ContentLanguageList& contentLanguages,
           Uint32 contentLength);
  
     static Array<Sint8> formatSimpleExportReqElement(      static Buffer formatSimpleEMethodReqMessage(
         const Array<Sint8>& body);          const char* requestUri,
           const char* host,
           const CIMName& eMethodName,
           const String& messageId,
           HttpMethod httpMethod,
           const String& authenticationHeader,
           const AcceptLanguageList& httpAcceptLanguages,
           const ContentLanguageList& httpContentLanguages,
           const Buffer& body);
  
 private:      static Buffer formatSimpleEMethodRspMessage(
           const CIMName& eMethodName,
           const String& messageId,
           HttpMethod httpMethod,
           const ContentLanguageList& httpContentLanguages,
           const Buffer& body);
  
     XmlWriter() { }      static Buffer formatSimpleEMethodErrorRspMessage(
 };          const CIMName& eMethodName,
           const String& messageId,
           HttpMethod httpMethod,
           const CIMException& cimException);
  
 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(      static String getNextMessageId();
     Array<Sint8>& out,  
     const char* x);  
  
 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(Array<Sint8>& out, char x);      /** Converts the given CIMKeyBinding type to one of the following:
           "boolean", "string", or "numeric"
       */
       static const StrLit keyBindingTypeToString (CIMKeyBinding::Type type);
  
 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(Array<Sint8>& out, Char16 x);  private:
  
 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(      static void _appendMessageElementBegin(
     Array<Sint8>& out,          Buffer& out,
     const String& x);          const String& messageId);
           static void _appendMessageElementEnd(
           Buffer& out);
   
       static void _appendSimpleReqElementBegin(Buffer& out);
       static void _appendSimpleReqElementEnd(Buffer& out);
   
       static void _appendMethodCallElementBegin(
           Buffer& out,
           const CIMName& name);
   
       static void _appendMethodCallElementEnd(
           Buffer& out);
   
       static void _appendIMethodCallElementBegin(
           Buffer& out,
           const CIMName& name);
           static void _appendIMethodCallElementEnd(
           Buffer& out);
   
       static void _appendIParamValueElementBegin(
           Buffer& out,
           const char* name);
           static void _appendIParamValueElementEnd(
           Buffer& out);
   
       static void _appendSimpleRspElementBegin(Buffer& out);
       static void _appendSimpleRspElementEnd(Buffer& out);
   
       static void _appendMethodResponseElementBegin(
           Buffer& out,
           const CIMName& name);
           static void _appendMethodResponseElementEnd(
           Buffer& out);
   
       static void _appendIMethodResponseElementBegin(
           Buffer& out,
           const CIMName& name);
           static void _appendIMethodResponseElementEnd(
           Buffer& out);
   
       static void _appendErrorElement(
           Buffer& out,
           const CIMException& cimException);
   
       static void _appendIReturnValueElementBegin(Buffer& out);
       static void _appendIReturnValueElementEnd(Buffer& out);
   
       static void _appendSimpleExportReqElementBegin(Buffer& out);
       static void _appendSimpleExportReqElementEnd(Buffer& out);
   
       static void _appendEMethodCallElementBegin(
           Buffer& out,
           const CIMName& name);
   
       static void _appendEMethodCallElementEnd(
           Buffer& out);
   
       static void _appendEParamValueElementBegin(
           Buffer& out,
           const char* name);
           static void _appendEParamValueElementEnd(
           Buffer& out);
   
       static void _appendSimpleExportRspElementBegin(Buffer& out);
       static void _appendSimpleExportRspElementEnd(Buffer& out);
   
       static void _appendEMethodResponseElementBegin(
           Buffer& out,
           const CIMName& name);
  
 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(      static void _appendEMethodResponseElementEnd(
     Array<Sint8>& out,          Buffer& out);
     const Indentor& x);  
  
 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(      XmlWriter();
     Array<Sint8>& out,  };
     const Array<Sint8>& x);  
  
 PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(  
     Array<Sint8>& out,  
     Uint32 x);  
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  


Legend:
Removed from v.1.21.2.1  
changed lines
  Added in v.1.89

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2