version 1.10, 2001/04/18 11:51:33
|
version 1.37, 2002/04/17 18:17:47
|
|
|
//BEGIN_LICENSE |
//%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM, |
|
// The Open Group, Tivoli Systems |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// copy of this software and associated documentation files (the "Software"), |
// of this software and associated documentation files (the "Software"), to |
// to deal in the Software without restriction, including without limitation |
// deal in the Software without restriction, including without limitation the |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// and/or sell copies of the Software, and to permit persons to whom the |
// sell copies of the Software, and to permit persons to whom the Software is |
// Software is furnished to do so, subject to the following conditions: |
// 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. |
|
// |
|
//============================================================================== |
|
// |
|
// Author: Mike Brasher (mbrasher@bmc.com) |
|
// |
|
// Modified By: |
|
// Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) |
|
// Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com) |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.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. |
|
// |
|
//END_LICENSE |
|
//BEGIN_HISTORY |
|
// |
|
// Author: |
|
// |
|
// $Log$ |
|
// Revision 1.10 2001/04/18 11:51:33 karl |
|
// get and set property |
|
// |
|
// Revision 1.9 2001/04/08 01:13:22 mike |
|
// Changed "ConstCIM" to "CIMConst" |
|
// |
|
// Revision 1.7 2001/02/20 07:25:57 mike |
|
// Added basic create-instance in repository and in client. |
|
// |
|
// Revision 1.6 2001/02/19 01:47:17 mike |
|
// Renamed names of the form CIMConst to CIMConst. |
|
// |
|
// Revision 1.5 2001/02/18 03:56:01 mike |
|
// Changed more class names (e.g., ConstClassDecl -> CIMConstClass) |
|
// |
|
// Revision 1.4 2001/02/16 02:06:07 mike |
|
// Renamed many classes and headers. |
|
// |
|
// Revision 1.3 2001/01/31 08:20:51 mike |
|
// Added dispatcher framework. |
|
// Added enumerateInstanceNames. |
|
// |
|
// Revision 1.2 2001/01/29 02:23:44 mike |
|
// Added support for GetInstance operation |
|
// |
|
// Revision 1.1.1.1 2001/01/14 19:53:36 mike |
|
// Pegasus import |
|
// |
|
// |
|
//END_HISTORY |
|
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
// |
|
// XmlWriter.h |
|
// |
|
//////////////////////////////////////////////////////////////////////////////// |
|
| |
#ifndef Pegasus_XmlWriter_h | #ifndef Pegasus_XmlWriter_h |
#define Pegasus_XmlWriter_h | #define Pegasus_XmlWriter_h |
|
|
#include <Pegasus/Common/String.h> | #include <Pegasus/Common/String.h> |
#include <Pegasus/Common/Indentor.h> | #include <Pegasus/Common/Indentor.h> |
#include <Pegasus/Common/CIMReference.h> | #include <Pegasus/Common/CIMReference.h> |
|
#include <Pegasus/Common/CIMPropertyList.h> |
|
#include <Pegasus/Common/CIMNamedInstance.h> |
|
#include <Pegasus/Common/CIMParamValue.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
append(out, Char16(x)); | append(out, Char16(x)); |
} | } |
| |
static void append(Array<Sint8>& out, const char* x); |
static void append(Array<Sint8>& out, Uint32 x); |
| |
static void append(Array<Sint8>& out, const String& x); |
static void append(Array<Sint8>& out, const char* str); |
| |
static void append(Array<Sint8>& out, Uint32 x); |
static void append(Array<Sint8>& out, const String& str); |
|
|
|
static void append(Array<Sint8>& out, const Indentor& x); |
| |
static void appendSpecial(Array<Sint8>& out, Char16 x); | static void appendSpecial(Array<Sint8>& out, Char16 x); |
| |
static void appendSpecial(Array<Sint8>& out, char x); | static void appendSpecial(Array<Sint8>& out, char x); |
| |
static void appendSpecial(Array<Sint8>& out, const char* x); |
static void appendSpecial(Array<Sint8>& out, const char* str); |
| |
static void appendSpecial(Array<Sint8>& out, const String& x); |
static void appendSpecial(Array<Sint8>& out, const String& str); |
| |
static void append(Array<Sint8>& out, const Indentor& x); |
static void appendLocalNameSpacePathElement( |
|
|
static void appendLocalNameSpaceElement( |
|
Array<Sint8>& out, | Array<Sint8>& out, |
const String& nameSpace); | const String& nameSpace); |
| |
static void appendNameSpaceElement( |
static void appendNameSpacePathElement( |
Array<Sint8>& out, | Array<Sint8>& out, |
|
const String& host, |
const String& nameSpace); | const String& nameSpace); |
| |
static Array<Sint8> formatGetHeader( |
static void appendClassNameElement( |
const char* documentPath); |
Array<Sint8>& out, |
|
const String& className); |
|
|
|
static void appendInstanceNameElement( |
|
Array<Sint8>& out, |
|
const CIMReference& instanceName); |
|
|
|
static void appendClassPathElement( |
|
Array<Sint8>& out, |
|
const CIMReference& classPath); |
|
|
|
static void appendInstancePathElement( |
|
Array<Sint8>& out, |
|
const CIMReference& instancePath); |
|
|
|
static void appendLocalClassPathElement( |
|
Array<Sint8>& out, |
|
const CIMReference& classPath); |
|
|
|
static void appendLocalInstancePathElement( |
|
Array<Sint8>& out, |
|
const CIMReference& instancePath); |
|
|
|
static void appendLocalObjectPathElement( |
|
Array<Sint8>& out, |
|
const CIMReference& objectPath); |
| |
static Array<Sint8> formatMPostHeader( |
static void appendMethodCallHeader( |
|
Array<Sint8>& out, |
const char* host, | const char* host, |
const char* cimOperation, |
|
const char* cimMethod, | const char* cimMethod, |
const String& cimObject, | const String& cimObject, |
const Array<Sint8>& content); |
const String& authenticationHeader, |
|
Uint32 contentLength); |
| |
static Array<Sint8> formatMethodResponseHeader( |
static void appendMethodResponseHeader( |
const Array<Sint8>& content); |
Array<Sint8>& out, |
|
Uint32 contentLength); |
| |
static Array<Sint8> formatMessageElement( |
static void appendHttpErrorResponseHeader( |
Uint32 messageId, |
Array<Sint8>& out, |
const Array<Sint8>& body); |
const String& status, |
|
const String& cimError = String::EMPTY, |
|
const String& errorDetail = String::EMPTY); |
| |
static Array<Sint8> formatSimpleReqElement( |
static void appendUnauthorizedResponseHeader( |
const Array<Sint8>& body); |
Array<Sint8>& out, |
|
const String& content); |
| |
static Array<Sint8> formatSimpleRspElement( |
static void appendReturnValueElement( |
const Array<Sint8>& body); |
Array<Sint8>& out, |
|
const CIMValue& value); |
| |
static Array<Sint8> formatIMethodCallElement( |
static void appendBooleanIParameter( |
|
Array<Sint8>& out, |
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( |
|
Array<Sint8>& out, |
const char* name, | const char* name, |
const Array<Sint8>& iParamValues); |
const String& str); |
| |
static Array<Sint8>& formatIParamValueElement( |
static void appendQualifierNameIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const char* name, | const char* name, |
const Array<Sint8>& body); |
const String& qualifierName); |
|
|
static Array<Sint8> formatErrorElement( |
|
CIMException::Code code, |
|
const char* description); |
|
| |
static Array<Sint8>& appendBooleanParameter( |
static void appendClassNameIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const char* parameterName, |
const char* name, |
Boolean flag); |
const String& className); |
| |
static Array<Sint8>& appendClassNameParameter( |
static void appendInstanceNameIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const char* parameterName, |
const char* name, |
const String& className); |
const CIMReference& instanceName); |
| |
static Array<Sint8>& appendQualifierNameParameter( |
static void appendObjectNameIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const char* parameterName, |
const char* name, |
const String& qualifierName); |
const CIMReference& objectName); |
| |
static Array<Sint8>& appendClassParameter( |
static void appendClassIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const char* parameterName, |
const char* name, |
const CIMConstClass& cimClass); | const CIMConstClass& cimClass); |
| |
static Array<Sint8>& appendInstanceNameParameter( |
static void appendInstanceIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const char* parameterName, |
const char* name, |
const CIMReference& instanceName); |
const CIMConstInstance& instance); |
| |
static Array<Sint8>& appendInstanceParameter( |
static void appendNamedInstanceIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const char* parameterName, |
const char* name, |
const CIMConstInstance& instance); |
const CIMNamedInstance& namedInstance); |
| |
static Array<Sint8>& appendQualifierDeclarationParameter( |
static void appendPropertyNameIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const char* parameterName, |
const String& propertyName); |
const CIMConstQualifierDecl& qualifierDecl); |
|
| |
static Array<Sint8>& appendClassNameElement( |
static void appendPropertyValueIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const String& className); |
const char* name, |
|
const CIMValue& value); |
| |
static Array<Sint8>& appendInstanceNameElement( |
static void appendPropertyListIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const CIMReference& instanceName); |
const CIMPropertyList& propertyList); |
| |
static Array<Sint8>& appendPropertyNameParameter( |
static void appendQualifierDeclarationIParameter( |
Array<Sint8>& out, | Array<Sint8>& out, |
const String& propertyName); |
const char* name, |
|
const CIMConstQualifierDecl& qualifierDecl); |
| |
static void indentedPrint( |
static Array<Sint8> formatHttpErrorRspMessage( |
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> formatSimpleMethodReqMessage( |
|
const char* host, |
|
const String& nameSpace, |
|
const CIMReference& path, |
|
const char* methodName, |
|
const Array<CIMParamValue>& parameters, |
|
const String& messageId, |
|
const String& authenticationHeader); |
|
|
|
static Array<Sint8> formatSimpleMethodRspMessage( |
|
const char* methodName, |
|
const String& messageId, |
|
const Array<Sint8>& body); |
|
|
|
static Array<Sint8> formatSimpleMethodErrorRspMessage( |
|
const String& methodName, |
|
const String& messageId, |
|
const CIMException& cimException); |
| |
static Array<Sint8> formatSimpleReqMessage( |
static Array<Sint8> formatSimpleIMethodReqMessage( |
const char* host, | const char* host, |
const String& nameSpace, | const String& nameSpace, |
const char* iMethodName, | const char* iMethodName, |
|
const String& messageId, |
|
const String& authenticationHeader, |
const Array<Sint8>& body); | const Array<Sint8>& body); |
| |
static Array<Sint8> formatSimpleRspMessage( |
static Array<Sint8> formatSimpleIMethodRspMessage( |
const char* iMethodName, | const char* iMethodName, |
|
const String& messageId, |
|
const Array<Sint8>& body); |
|
|
|
static Array<Sint8> formatSimpleIMethodErrorRspMessage( |
|
const String& iMethodName, |
|
const String& messageId, |
|
const CIMException& cimException); |
|
|
|
static void appendEMethodRequestHeader( |
|
Array<Sint8>& out, |
|
const char* host, |
|
const char* cimMethod, |
|
const String& authenticationHeader, |
|
Uint32 contentLength); |
|
|
|
static void appendEMethodResponseHeader( |
|
Array<Sint8>& out, |
|
Uint32 contentLength); |
|
|
|
static Array<Sint8> formatSimpleEMethodReqMessage( |
|
const char* host, |
|
const char* eMethodName, |
|
const String& messageId, |
|
const String& authenticationHeader, |
const Array<Sint8>& body); | const Array<Sint8>& body); |
| |
static Uint32 getNextMessageId(); |
static Array<Sint8> formatSimpleEMethodRspMessage( |
|
const char* eMethodName, |
|
const String& messageId, |
|
const Array<Sint8>& body); |
|
|
|
static Array<Sint8> formatSimpleEMethodErrorRspMessage( |
|
const String& eMethodName, |
|
const String& messageId, |
|
const CIMException& cimException); |
|
|
|
static void indentedPrint( |
|
PEGASUS_STD(ostream)& os, |
|
const char* text, |
|
Uint32 indentChars = 2); |
|
|
|
static String getNextMessageId(); |
| |
private: | private: |
| |
|
static void _appendMessageElementBegin( |
|
Array<Sint8>& out, |
|
const String& messageId); |
|
static void _appendMessageElementEnd( |
|
Array<Sint8>& out); |
|
|
|
static void _appendSimpleReqElementBegin(Array<Sint8>& out); |
|
static void _appendSimpleReqElementEnd(Array<Sint8>& out); |
|
|
|
static void _appendMethodCallElementBegin( |
|
Array<Sint8>& out, |
|
const char* name); |
|
static void _appendMethodCallElementEnd( |
|
Array<Sint8>& out); |
|
|
|
static void _appendIMethodCallElementBegin( |
|
Array<Sint8>& out, |
|
const char* name); |
|
static void _appendIMethodCallElementEnd( |
|
Array<Sint8>& out); |
|
|
|
static void _appendIParamValueElementBegin( |
|
Array<Sint8>& out, |
|
const char* name); |
|
static void _appendIParamValueElementEnd( |
|
Array<Sint8>& out); |
|
|
|
static void _appendSimpleRspElementBegin(Array<Sint8>& out); |
|
static void _appendSimpleRspElementEnd(Array<Sint8>& out); |
|
|
|
static void _appendMethodResponseElementBegin( |
|
Array<Sint8>& out, |
|
const char* name); |
|
static void _appendMethodResponseElementEnd( |
|
Array<Sint8>& out); |
|
|
|
static void _appendIMethodResponseElementBegin( |
|
Array<Sint8>& out, |
|
const char* name); |
|
static void _appendIMethodResponseElementEnd( |
|
Array<Sint8>& out); |
|
|
|
static void _appendErrorElement( |
|
Array<Sint8>& out, |
|
const CIMException& cimException); |
|
|
|
static void _appendIReturnValueElementBegin(Array<Sint8>& out); |
|
static void _appendIReturnValueElementEnd(Array<Sint8>& out); |
|
|
|
static void _appendSimpleExportReqElementBegin(Array<Sint8>& out); |
|
static void _appendSimpleExportReqElementEnd(Array<Sint8>& out); |
|
|
|
static void _appendEMethodCallElementBegin( |
|
Array<Sint8>& out, |
|
const char* name); |
|
static void _appendEMethodCallElementEnd( |
|
Array<Sint8>& out); |
|
|
|
static void _appendSimpleExportRspElementBegin(Array<Sint8>& out); |
|
static void _appendSimpleExportRspElementEnd(Array<Sint8>& out); |
|
|
|
static void _appendEMethodResponseElementBegin( |
|
Array<Sint8>& out, |
|
const char* name); |
|
static void _appendEMethodResponseElementEnd( |
|
Array<Sint8>& out); |
|
|
XmlWriter() { } | XmlWriter() { } |
}; | }; |
| |
inline Array<Sint8>& operator<<(Array<Sint8>& out, const char* x) |
PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<( |
{ |
Array<Sint8>& out, |
XmlWriter::append(out, x); |
const char* x); |
return out; |
|
} |
|
| |
inline Array<Sint8>& operator<<(Array<Sint8>& out, char x) |
PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(Array<Sint8>& out, char x); |
{ |
|
XmlWriter::append(out, x); |
|
return out; |
|
} |
|
| |
inline Array<Sint8>& operator<<(Array<Sint8>& out, Char16 x) |
PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(Array<Sint8>& out, Char16 x); |
{ |
|
XmlWriter::append(out, x); |
|
return out; |
|
} |
|
| |
inline Array<Sint8>& operator<<(Array<Sint8>& out, const String& x) |
PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<( |
{ |
Array<Sint8>& out, |
XmlWriter::append(out, x); |
const String& x); |
return out; |
|
} |
|
| |
inline Array<Sint8>& operator<<(Array<Sint8>& out, const Indentor& x) |
PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<( |
{ |
Array<Sint8>& out, |
XmlWriter::append(out, x); |
const Indentor& x); |
return out; |
|
} |
|
| |
inline Array<Sint8>& operator<<(Array<Sint8>& out, const Array<Sint8>& x) |
PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<( |
{ |
Array<Sint8>& out, |
out.appendArray(x); |
const Array<Sint8>& x); |
return out; |
|
} |
|
| |
inline Array<Sint8>& operator<<(Array<Sint8>& out, Uint32 x) |
PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<( |
{ |
Array<Sint8>& out, |
XmlWriter::append(out, x); |
Uint32 x); |
return out; |
|
} |
|
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |