version 1.69, 2002/08/05 16:14:41
|
version 1.78, 2002/09/11 21:20:24
|
|
|
return out; | return out; |
} | } |
| |
Array<Sint8>& operator<<(Array<Sint8>& out, Char16 x) |
Array<Sint8>& operator<<(Array<Sint8>& out, const Char16& x) |
{ | { |
XmlWriter::append(out, x); | XmlWriter::append(out, x); |
return out; | return out; |
|
|
return out; | return out; |
} | } |
| |
inline void _appendChar(Array<Sint8>& out, Char16 c) |
PEGASUS_STD(ostream)& operator<<(PEGASUS_STD(ostream)& os, const CIMDateTime& x) |
|
{ |
|
return os << x.toString(); |
|
} |
|
|
|
inline void _appendChar(Array<Sint8>& out, const Char16& c) |
{ | { |
out.append(Sint8(c)); | out.append(Sint8(c)); |
} | } |
| |
inline void _appendSpecialChar(Array<Sint8>& out, Char16 c) |
inline void _appendSpecialChar(Array<Sint8>& out, const Char16& c) |
{ | { |
// ATTN-B: Only UTF-8 handled for now. | // ATTN-B: Only UTF-8 handled for now. |
| |
|
|
_appendSpecialChar(os, *str++); | _appendSpecialChar(os, *str++); |
} | } |
| |
void XmlWriter::append(Array<Sint8>& out, Char16 x) |
void XmlWriter::append(Array<Sint8>& out, const Char16& x) |
{ | { |
_appendChar(out, x); | _appendChar(out, x); |
} | } |
|
|
out.append(' '); | out.append(' '); |
} | } |
| |
void XmlWriter::appendSpecial(Array<Sint8>& out, Char16 x) |
void XmlWriter::appendSpecial(Array<Sint8>& out, const Char16& x) |
{ | { |
_appendSpecialChar(out, x); | _appendSpecialChar(out, x); |
} | } |
|
|
{ | { |
out << "<LOCALNAMESPACEPATH>\n"; | out << "<LOCALNAMESPACEPATH>\n"; |
| |
char* tmp = nameSpace.allocateCString(); |
char* nameSpaceCopy = strdup(nameSpace.getCString()); |
|
for (const char* p = strtok(nameSpaceCopy, "/"); p; p = strtok(NULL, "/")) |
for (char* p = strtok(tmp, "/"); p; p = strtok(NULL, "/")) |
|
{ | { |
out << "<NAMESPACE NAME=\"" << p << "\"/>\n"; | out << "<NAMESPACE NAME=\"" << p << "\"/>\n"; |
} | } |
|
delete nameSpaceCopy; |
delete [] tmp; |
|
| |
out << "</LOCALNAMESPACEPATH>\n"; | out << "</LOCALNAMESPACEPATH>\n"; |
} | } |
|
|
XmlWriter::append(out, x); | XmlWriter::append(out, x); |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, Char16 x) |
inline void _appendValue(Array<Sint8>& out, const Char16& x) |
{ | { |
XmlWriter::appendSpecial(out, x); | XmlWriter::appendSpecial(out, x); |
} | } |
|
|
| |
inline void _appendValue(Array<Sint8>& out, const CIMDateTime& x) | inline void _appendValue(Array<Sint8>& out, const CIMDateTime& x) |
{ | { |
out << x.getString(); //ATTN: append() method? |
out << x.toString(); //ATTN: append() method? |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, const CIMObjectPath& x) | inline void _appendValue(Array<Sint8>& out, const CIMObjectPath& x) |
|
|
} | } |
| |
default: | default: |
throw CIMValueInvalidType(); |
PEGASUS_ASSERT(false); |
} | } |
} | } |
else if (value.getType() == CIMTYPE_REFERENCE) | else if (value.getType() == CIMTYPE_REFERENCE) |
|
|
} | } |
| |
default: | default: |
throw CIMValueInvalidType(); |
PEGASUS_ASSERT(false); |
} | } |
| |
out << "</VALUE>\n"; | out << "</VALUE>\n"; |
|
|
Array<Sint8>& out, | Array<Sint8>& out, |
const CIMConstObject& object) | const CIMConstObject& object) |
{ | { |
// ATTN-RK-P3-20020515: This could use some work |
if (object.isClass()) |
try |
|
{ | { |
CIMConstClass c(object); | CIMConstClass c(object); |
appendClassElement(out, c); | appendClassElement(out, c); |
} | } |
catch (DynamicCastFailed) |
else if (object.isInstance()) |
{ |
|
try |
|
{ | { |
CIMConstInstance i(object); | CIMConstInstance i(object); |
appendInstanceElement(out, i); | appendInstanceElement(out, i); |
} | } |
catch (DynamicCastFailed) |
// else PEGASUS_ASSERT(0); |
{ |
|
PEGASUS_ASSERT(0); |
|
} |
|
} |
|
} | } |
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
| |
void XmlWriter::appendQualifierFlavorEntity( | void XmlWriter::appendQualifierFlavorEntity( |
Array<Sint8>& out, | Array<Sint8>& out, |
Uint32 flavor) |
const CIMFlavor & flavor) |
{ | { |
if (!(flavor & CIMFlavor::OVERRIDABLE)) |
if (!(flavor.hasFlavor (CIMFlavor::OVERRIDABLE))) |
out << " OVERRIDABLE=\"false\""; | out << " OVERRIDABLE=\"false\""; |
| |
if (!(flavor & CIMFlavor::TOSUBCLASS)) |
if (!(flavor.hasFlavor (CIMFlavor::TOSUBCLASS))) |
out << " TOSUBCLASS=\"false\""; | out << " TOSUBCLASS=\"false\""; |
| |
if (flavor & CIMFlavor::TOINSTANCE) |
if (flavor.hasFlavor (CIMFlavor::TOINSTANCE)) |
out << " TOINSTANCE=\"true\""; | out << " TOINSTANCE=\"true\""; |
| |
if (flavor & CIMFlavor::TRANSLATABLE) |
if (flavor.hasFlavor (CIMFlavor::TRANSLATABLE)) |
out << " TRANSLATABLE=\"true\""; | out << " TRANSLATABLE=\"true\""; |
} | } |
| |
|
|
Array<Sint8>& out, | Array<Sint8>& out, |
const CIMException& cimException) | const CIMException& cimException) |
{ | { |
PEG_TRACE_STRING(TRC_XML_WRITER, Tracer::LEVEL2, |
Tracer::traceCIMException(TRC_XML_WRITER, Tracer::LEVEL2, cimException); |
cimException.getTraceDescription()); |
|
| |
out << "<ERROR"; | out << "<ERROR"; |
out << " CODE=\"" << Uint32(cimException.getCode()) << "\""; | out << " CODE=\"" << Uint32(cimException.getCode()) << "\""; |
String description = cimException.getDescription(); |
String description = TraceableCIMException(cimException).getDescription(); |
if (description != String::EMPTY) | if (description != String::EMPTY) |
{ | { |
out << " DESCRIPTION=\""; | out << " DESCRIPTION=\""; |
|
|
out << "<RETURNVALUE"; | out << "<RETURNVALUE"; |
| |
CIMType type = value.getType(); | CIMType type = value.getType(); |
if (type != CIMTYPE_NONE) |
|
{ |
|
out << " PARAMTYPE=\"" << cimTypeToString (type) << "\""; | out << " PARAMTYPE=\"" << cimTypeToString (type) << "\""; |
} |
|
| |
out << ">\n"; | out << ">\n"; |
| |
|
|
Array<Sint8> tmp; | Array<Sint8> tmp; |
CIMObjectPath localObjectPath = path; | CIMObjectPath localObjectPath = path; |
localObjectPath.setNameSpace(nameSpace); | localObjectPath.setNameSpace(nameSpace); |
|
localObjectPath.setHost(String::EMPTY); |
| |
_appendMessageElementBegin(out, messageId); | _appendMessageElementBegin(out, messageId); |
_appendSimpleReqElementBegin(out); | _appendSimpleReqElementBegin(out); |
|
|
tmp, | tmp, |
host, | host, |
methodName, | methodName, |
localObjectPath.toString(false), |
localObjectPath.toString(), |
authenticationHeader, | authenticationHeader, |
out.size()); | out.size()); |
tmp << out; | tmp << out; |
|
|
const String& messageId, | const String& messageId, |
const CIMException& cimException) | const CIMException& cimException) |
{ | { |
ArrayDestroyer<char> tmp1(methodName.allocateCString()); |
|
Array<Sint8> out; | Array<Sint8> out; |
Array<Sint8> tmp; | Array<Sint8> tmp; |
| |
_appendMessageElementBegin(out, messageId); | _appendMessageElementBegin(out, messageId); |
_appendSimpleRspElementBegin(out); | _appendSimpleRspElementBegin(out); |
_appendMethodResponseElementBegin(out, tmp1.getPointer()); |
_appendMethodResponseElementBegin(out, methodName.getCString()); |
_appendErrorElement(out, cimException); | _appendErrorElement(out, cimException); |
_appendMethodResponseElementEnd(out); | _appendMethodResponseElementEnd(out); |
_appendSimpleRspElementEnd(out); | _appendSimpleRspElementEnd(out); |
|
|
const String& messageId, | const String& messageId, |
const CIMException& cimException) | const CIMException& cimException) |
{ | { |
ArrayDestroyer<char> tmp1(iMethodName.allocateCString()); |
|
Array<Sint8> out; | Array<Sint8> out; |
Array<Sint8> tmp; | Array<Sint8> tmp; |
| |
_appendMessageElementBegin(out, messageId); | _appendMessageElementBegin(out, messageId); |
_appendSimpleRspElementBegin(out); | _appendSimpleRspElementBegin(out); |
_appendIMethodResponseElementBegin(out, tmp1.getPointer()); |
_appendIMethodResponseElementBegin(out, iMethodName.getCString()); |
_appendErrorElement(out, cimException); | _appendErrorElement(out, cimException); |
_appendIMethodResponseElementEnd(out); | _appendIMethodResponseElementEnd(out); |
_appendSimpleRspElementEnd(out); | _appendSimpleRspElementEnd(out); |
|
|
const String& messageId, | const String& messageId, |
const CIMException& cimException) | const CIMException& cimException) |
{ | { |
ArrayDestroyer<char> tmp1(eMethodName.allocateCString()); |
|
Array<Sint8> out; | Array<Sint8> out; |
Array<Sint8> tmp; | Array<Sint8> tmp; |
| |
_appendMessageElementBegin(out, messageId); | _appendMessageElementBegin(out, messageId); |
_appendSimpleExportRspElementBegin(out); | _appendSimpleExportRspElementBegin(out); |
_appendEMethodResponseElementBegin(out, tmp1.getPointer()); |
_appendEMethodResponseElementBegin(out, eMethodName.getCString()); |
_appendErrorElement(out, cimException); | _appendErrorElement(out, cimException); |
_appendEMethodResponseElementEnd(out); | _appendEMethodResponseElementEnd(out); |
_appendSimpleExportRspElementEnd(out); | _appendSimpleExportRspElementEnd(out); |