version 1.4, 2001/02/20 07:25:57
|
version 1.58.4.5, 2013/11/21 20:55:19
|
|
|
//BEGIN_LICENSE |
//%LICENSE//////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// Licensed to The Open Group (TOG) under one or more contributor license |
|
// 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 | // Permission is hereby granted, free of charge, to any person obtaining a |
// copy of this software and associated documentation files (the "Software"), | // copy of this software and associated documentation files (the "Software"), |
|
|
// and/or sell copies of the Software, and to permit persons to whom the | // and/or sell copies of the Software, and to permit persons to whom the |
// Software is furnished to do so, subject to the following conditions: | // Software is furnished to do so, subject to the following conditions: |
// | // |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
// The above copyright notice and this permission notice shall be included |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
// in all copies or substantial portions of the Software. |
// 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 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
//BEGIN_HISTORY |
// 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: |
////////////////////////////////////////////////////////////////////////// |
// | // |
// $Log$ |
//%///////////////////////////////////////////////////////////////////////////// |
// Revision 1.4 2001/02/20 07:25:57 mike |
|
// Added basic create-instance in repository and in client. |
|
// |
|
// Revision 1.3 2001/02/19 01:47:16 mike |
|
// Renamed names of the form CIMConst to ConstCIM. |
|
// |
|
// Revision 1.2 2001/02/16 02:06:07 mike |
|
// Renamed many classes and headers. |
|
// |
|
// Revision 1.1.1.1 2001/01/14 19:53:33 mike |
|
// Pegasus import |
|
// |
|
// |
|
//END_HISTORY |
|
|
|
//////////////////////////////////////////////////////////////////////////////// |
|
// |
|
// XmlReader.h |
|
// |
|
//////////////////////////////////////////////////////////////////////////////// |
|
| |
#ifndef Pegasus_XmlReader_h | #ifndef Pegasus_XmlReader_h |
#define Pegasus_XmlReader_h | #define Pegasus_XmlReader_h |
|
|
#include <Pegasus/Common/XmlParser.h> | #include <Pegasus/Common/XmlParser.h> |
#include <Pegasus/Common/CIMFlavor.h> | #include <Pegasus/Common/CIMFlavor.h> |
#include <Pegasus/Common/CIMScope.h> | #include <Pegasus/Common/CIMScope.h> |
#include <Pegasus/Common/CIMReference.h> |
#include <Pegasus/Common/CIMType.h> |
|
#include <Pegasus/Common/CIMObjectPath.h> |
|
#include <Pegasus/Common/Linkage.h> |
|
#include <Pegasus/Common/UintArgs.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
class CIMProperty; | class CIMProperty; |
class CIMParameter; | class CIMParameter; |
class CIMMethod; | class CIMMethod; |
|
class CIMObject; |
|
class CIMParamValue; |
|
class CIMValue; |
|
|
|
struct CharString |
|
{ |
|
const char *value; |
|
Uint32 length; |
|
CharString(const char *value, Uint32 length) : |
|
value(value), length(length) |
|
{ |
|
} |
|
}; |
| |
class PEGASUS_COMMON_LINKAGE XmlReader | class PEGASUS_COMMON_LINKAGE XmlReader |
{ | { |
public: | public: |
| |
static void expectXmlDeclaration( |
static void getXmlDeclaration( |
|
XmlParser& parser, |
|
const char*& xmlVersion, |
|
const char*& xmlEncoding); |
|
|
|
static Boolean testXmlDeclaration( |
XmlParser& parser, | XmlParser& parser, |
XmlEntry& entry); | XmlEntry& entry); |
| |
|
|
XmlEntry& entry, | XmlEntry& entry, |
const char* tagName); | const char* tagName); |
| |
|
static void skipElement( |
|
XmlParser& parser, |
|
XmlEntry& entry); |
|
|
static Boolean expectContentOrCData( | static Boolean expectContentOrCData( |
XmlParser& parser, | XmlParser& parser, |
XmlEntry& entry); | XmlEntry& entry); |
|
|
XmlEntry& entry, | XmlEntry& entry, |
const char* tagName); | const char* tagName); |
| |
static Boolean testContentOrCData( |
static Boolean testStartTagOrEmptyTag( |
XmlParser& parser, | XmlParser& parser, |
XmlEntry& entry); | XmlEntry& entry); |
| |
static void testCimStartTag(XmlParser& parser); |
static Boolean testContentOrCData( |
|
XmlParser& parser, |
|
XmlEntry& entry); |
| |
static Boolean getIsArrayAttribute( |
static void getCimStartTag( |
Uint32 lineNumber, |
XmlParser& parser, |
const XmlEntry& entry, |
const char*& cimVersion, |
const char* tagName, |
const char*& dtdVersion); |
Boolean& value); |
|
| |
static String getCimNameAttribute( |
static CIMName getCimNameAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
const char* elementName, | const char* elementName, |
|
|
const XmlEntry& entry, | const XmlEntry& entry, |
const char* elementName); | const char* elementName); |
| |
static String getClassOriginAttribute( |
static CIMName getClassOriginAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
const char* tagName); | const char* tagName); |
| |
static String getReferenceClassAttribute( |
typedef enum _embeddedObjectAttributeType |
|
{ |
|
NO_EMBEDDED_OBJECT = 0, |
|
EMBEDDED_OBJECT_ATTR = 1, |
|
EMBEDDED_INSTANCE_ATTR = 2 |
|
} EmbeddedObjectAttributeType; |
|
|
|
static EmbeddedObjectAttributeType getEmbeddedObjectAttribute( |
|
Uint32 lineNumber, |
|
const XmlEntry& entry, |
|
const char* tagName); |
|
|
|
static CIMName getReferenceClassAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
const char* elementName); | const char* elementName); |
| |
static String getSuperClassAttribute( |
static CIMName getSuperClassAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
const char* tagName); | const char* tagName); |
| |
static CIMType getCimTypeAttribute( |
static Boolean getCimTypeAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
const char* tagName); |
CIMType& cimType, // Output parameter |
|
const char* tagName, |
|
const char* attributeName = "TYPE", |
|
Boolean required = true); |
| |
static Boolean getCimBooleanAttribute( | static Boolean getCimBooleanAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
|
|
Boolean defaultValue, | Boolean defaultValue, |
Boolean required); | Boolean required); |
| |
static Boolean stringToReal( |
static String decodeURICharacters(String uriString); |
const char* stringValue, |
|
Real64& x); |
static CIMValue stringToValue( |
|
Uint32 lineNumber, |
static Boolean stringToSignedInteger( |
const char* valueString, |
const char* stringValue, |
CIMType type); |
Sint64& x); |
|
|
|
static Boolean stringToUnsignedInteger( |
|
const char* stringValue, |
|
Uint64& x); |
|
| |
static CIMValue stringToValue( | static CIMValue stringToValue( |
Uint32 lineNumber, | Uint32 lineNumber, |
const char* valueString, | const char* valueString, |
|
Uint32 valueStringLen, |
CIMType type); | CIMType type); |
| |
|
|
|
/* getValueElement - Gets the CIMType and CIMValue for a single |
|
XML Value element. It expects <VALUE> as the start tag. |
|
@return Returns True if the value element exists |
|
*/ |
static Boolean getValueElement( | static Boolean getValueElement( |
XmlParser& parser, | XmlParser& parser, |
CIMType type, | CIMType type, |
CIMValue& value); | CIMValue& value); |
| |
|
static Boolean getStringValueElement( |
|
XmlParser& parser, |
|
String& str, |
|
Boolean required); |
|
|
|
// KS_PULL_BEGIN |
|
static Boolean getUint32ArgValueElement( |
|
XmlParser& parser, |
|
Uint32Arg& val, |
|
Boolean required); |
|
|
|
static Boolean getUint32ValueElement( |
|
XmlParser& parser, |
|
Uint32& val, |
|
Boolean required); |
|
|
|
static Boolean getUint64ValueElement( |
|
XmlParser& parser, |
|
Uint64Arg& val, |
|
Boolean required); |
|
//KS_PULL_END |
|
|
static CIMValue stringArrayToValue( | static CIMValue stringArrayToValue( |
Uint32 lineNumber, | Uint32 lineNumber, |
const Array<const char*>& array, | const Array<const char*>& array, |
|
|
CIMType type, | CIMType type, |
CIMValue& value); | CIMValue& value); |
| |
static Uint32 getFlavor( |
static CIMFlavor getFlavor( |
XmlEntry& entry, | XmlEntry& entry, |
Uint32 lineNumber, | Uint32 lineNumber, |
const char* tagName); | const char* tagName); |
| |
static Uint32 getOptionalScope( |
static CIMScope getOptionalScope( |
XmlParser& parser); | XmlParser& parser); |
| |
static Boolean getQualifierElement( | static Boolean getQualifierElement( |
|
|
| |
static Boolean getNameSpaceElement( | static Boolean getNameSpaceElement( |
XmlParser& parser, | XmlParser& parser, |
String& nameSpaceComponent); |
CIMName& nameSpaceComponent); |
| |
static Boolean getLocalNameSpacePathElement( | static Boolean getLocalNameSpacePathElement( |
XmlParser& parser, | XmlParser& parser, |
|
|
| |
static Boolean getClassNameElement( | static Boolean getClassNameElement( |
XmlParser& parser, | XmlParser& parser, |
String& className, |
CIMName& className, |
Boolean required = false); | Boolean required = false); |
| |
static KeyBinding::CIMType getValueTypeAttribute( |
static CIMKeyBinding::Type getValueTypeAttribute( |
Uint32 lineNumber, | Uint32 lineNumber, |
const XmlEntry& entry, | const XmlEntry& entry, |
const char* elementName); | const char* elementName); |
| |
static Boolean getKeyValueElement( | static Boolean getKeyValueElement( |
XmlParser& parser, | XmlParser& parser, |
KeyBinding::CIMType& type, |
CIMKeyBinding::Type& type, |
String& value); | String& value); |
| |
static Boolean getKeyBindingElement( | static Boolean getKeyBindingElement( |
XmlParser& parser, | XmlParser& parser, |
String& name, |
CIMName& name, |
String& value, | String& value, |
KeyBinding::CIMType& type); |
CIMKeyBinding::Type& type); |
| |
static Boolean getInstanceNameElement( | static Boolean getInstanceNameElement( |
XmlParser& parser, | XmlParser& parser, |
String& className, | String& className, |
Array<KeyBinding>& keyBindings); |
Array<CIMKeyBinding>& keyBindings); |
|
|
|
static Boolean getInstanceNameElement( |
|
XmlParser& parser, |
|
CIMObjectPath& instanceName); |
| |
static Boolean getInstancePathElement( | static Boolean getInstancePathElement( |
XmlParser& parser, | XmlParser& parser, |
CIMReference& reference); |
CIMObjectPath& reference); |
| |
static Boolean getLocalInstancePathElement( | static Boolean getLocalInstancePathElement( |
XmlParser& parser, | XmlParser& parser, |
CIMReference& reference); |
CIMObjectPath& reference); |
| |
static Boolean getClassPathElement( | static Boolean getClassPathElement( |
XmlParser& parser, | XmlParser& parser, |
CIMReference& reference); |
CIMObjectPath& reference); |
| |
static Boolean getLocalClassPathElement( | static Boolean getLocalClassPathElement( |
XmlParser& parser, | XmlParser& parser, |
CIMReference& reference); |
CIMObjectPath& reference); |
| |
static Boolean getValueReferenceElement( | static Boolean getValueReferenceElement( |
XmlParser& parser, | XmlParser& parser, |
CIMReference& reference); |
CIMObjectPath& reference); |
|
|
|
static Boolean getValueReferenceArrayElement( |
|
XmlParser& parser, |
|
CIMValue& value); |
| |
static Boolean getPropertyReferenceElement( | static Boolean getPropertyReferenceElement( |
XmlParser& parser, | XmlParser& parser, |
|
|
XmlParser& parser, | XmlParser& parser, |
CIMParameter& parameter); | CIMParameter& parameter); |
| |
|
static Boolean getParameterReferenceArrayElement( |
|
XmlParser& parser, |
|
CIMParameter& parameter); |
|
|
static Boolean getQualifierDeclElement( | static Boolean getQualifierDeclElement( |
XmlParser& parser, | XmlParser& parser, |
CIMQualifierDecl& qualifierDecl); | CIMQualifierDecl& qualifierDecl); |
|
|
XmlParser& parser, | XmlParser& parser, |
CIMInstance& cimInstance); | CIMInstance& cimInstance); |
| |
static void getObject(XmlParser& parser, CIMClass& x) |
static Boolean getNamedInstanceElement( |
{ |
XmlParser& parser, |
if (!getClassElement(parser, x)) |
CIMInstance& namedInstance); |
{ |
|
throw XmlValidationError(parser.getLine(), |
|
"expected CLASS element"); |
|
} |
|
} |
|
| |
static void getObject(XmlParser& parser, CIMInstance& x) |
//EXP_PULL_BEGIN |
{ |
static Boolean getInstanceWithPathElement( |
if (!getInstanceElement(parser, x)) |
XmlParser& parser, |
{ |
CIMInstance& namedInstance); |
throw XmlValidationError(parser.getLine(), |
//EXP_PULL_END |
"expected INSTANCE element"); |
|
} |
|
} |
|
| |
static void getObject(XmlParser& parser, CIMQualifierDecl& x) |
static void getObject(XmlParser& parser, CIMClass& x); |
{ |
|
if (!getQualifierDeclElement(parser, x)) |
static void getObject(XmlParser& parser, CIMInstance& x); |
{ |
|
throw XmlValidationError(parser.getLine(), |
static void getObject(XmlParser& parser, CIMQualifierDecl& x); |
"expected QUALIFIER.DECLARATION element"); |
|
} |
|
} |
|
| |
static Boolean getMessageStartTag( | static Boolean getMessageStartTag( |
XmlParser& parser, | XmlParser& parser, |
Uint32& id, |
String& id, |
const char*& protocolVersion); |
String& protocolVersion); |
| |
static Boolean getIMethodCallStartTag( | static Boolean getIMethodCallStartTag( |
XmlParser& parser, | XmlParser& parser, |
|
|
| |
static Boolean getIMethodResponseStartTag( | static Boolean getIMethodResponseStartTag( |
XmlParser& parser, | XmlParser& parser, |
const char*& name); |
const char*& name, |
|
Boolean& isEmptyTag); |
| |
static Boolean getIParamValueTag( | static Boolean getIParamValueTag( |
XmlParser& parser, | XmlParser& parser, |
const char*& name); |
const char*& name, |
|
Boolean& isEmptyTag); |
|
|
|
// EXP_PULL_BEGIN |
|
|
|
static Boolean getParamValueTag( |
|
XmlParser& parser, |
|
const char*& name, |
|
Boolean& isEmptyTag); |
|
|
|
static Boolean getIReturnValueTag( |
|
XmlParser& parser, |
|
const char*& name, |
|
Boolean& isEmptyTag); |
|
// EXP_PULL_END |
|
static void rejectNullIParamValue( |
|
XmlParser& parser, |
|
Boolean isEmptyTag, |
|
const char* paramName); |
|
|
|
// EXP_PULL_BEGIN |
|
static void rejectNullParamValue( |
|
XmlParser& parser, |
|
Boolean isEmptyTag, |
|
const char* paramName); |
|
static void rejectNullIReturnValue( |
|
XmlParser& parser, |
|
Boolean isEmptyTag, |
|
const char* paramName); |
|
// EXP_PULL_END |
|
static Boolean getPropertyValue( |
|
XmlParser& parser, |
|
CIMValue& cimValue); |
| |
static Boolean getBooleanValueElement( | static Boolean getBooleanValueElement( |
XmlParser& parser, | XmlParser& parser, |
|
|
| |
static Boolean getErrorElement( | static Boolean getErrorElement( |
XmlParser& parser, | XmlParser& parser, |
CimException::Code& code, |
CIMException& cimException, |
const char*& description, |
|
Boolean required = false); | Boolean required = false); |
| |
|
static Boolean getValueObjectElement( |
|
XmlParser& parser, |
|
CIMObject& object); |
|
|
|
static Boolean getValueObjectWithPathElement( |
|
XmlParser& parser, |
|
CIMObject& objectWithPath); |
|
|
|
static Boolean getValueObjectWithLocalPathElement( |
|
XmlParser& parser, |
|
CIMObject& objectWithPath); |
|
|
|
static void getObjectArray( |
|
XmlParser& parser, |
|
Array<CIMObject>& objectArray); |
|
|
|
static Boolean getObjectNameElement( |
|
XmlParser& parser, |
|
CIMObjectPath& objectName); |
|
|
|
static Boolean getObjectPathElement( |
|
XmlParser& parser, |
|
CIMObjectPath& objectPath); |
|
|
|
static Boolean getEMethodCallStartTag( |
|
XmlParser& parser, |
|
const char*& name); |
|
|
|
static Boolean getEMethodResponseStartTag( |
|
XmlParser& parser, |
|
const char*& name, |
|
Boolean& isEmptyTag); |
|
|
|
static Boolean getEParamValueTag( |
|
XmlParser& parser, |
|
const char*& name); |
|
|
|
static Boolean getMethodCallStartTag( |
|
XmlParser& parser, |
|
const char*& name); |
|
|
|
static Boolean getMethodResponseStartTag( |
|
XmlParser& parser, |
|
const char*& name, |
|
Boolean& isEmptyTag); |
|
|
|
static Boolean getParamValueElement( |
|
XmlParser& parser, |
|
CIMParamValue& paramValue); |
|
|
|
static Boolean getReturnValueElement( |
|
XmlParser& parser, |
|
CIMValue& returnValue); |
|
|
|
static Boolean isSupportedCIMVersion( |
|
const char* cimVersion); |
|
|
|
static Boolean isSupportedProtocolVersion( |
|
const String& protocolVersion); |
|
|
|
static Boolean isSupportedDTDVersion( |
|
const char* dtdVersion); |
private: | private: |
| |
|
static CIMValue _stringArrayToValue( |
|
Uint32 lineNumber, |
|
const Array<CharString>& array, |
|
CIMType type); |
|
|
XmlReader() | XmlReader() |
{ | { |
| |