version 1.28, 2002/03/24 13:33:07
|
version 1.29, 2002/03/25 16:27:51
|
|
|
#include "XmlWriter.h" | #include "XmlWriter.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
PEGASUS_USING_STD; |
| |
CIMClassRep::CIMClassRep( | CIMClassRep::CIMClassRep( |
const CIMReference& reference, | const CIMReference& reference, |
|
|
| |
if (_superClassName.size()) | if (_superClassName.size()) |
{ | { |
|
//cout << "KSTEST Class Resolve with Super class " << getClassName() |
|
//<< " superClass " << _superClassName << endl; |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// First check to see if the super-class really exists: |
// First check to see if the super-class really exists and the subclassing legal: |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
CIMConstClass superClass | CIMConstClass superClass |
= context->lookupClass(nameSpace, _superClassName); | = context->lookupClass(nameSpace, _superClassName); |
|
|
if (!superClass._rep->_resolved) | if (!superClass._rep->_resolved) |
throw ClassNotResolved(_superClassName); | throw ClassNotResolved(_superClassName); |
#endif | #endif |
|
// If subclass is abstract but superclass not, throw CIM Exception |
| |
|
/* ATTN:KS-24 Mar 2002 P1 - Test this and confirm that rule is correct |
|
if isAbstract() && !superclass.isAbstract() |
|
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_SUPERCLASS,_superClassName); |
|
*/ |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// Iterate all the properties of *this* class. Resolve each one and | // Iterate all the properties of *this* class. Resolve each one and |
// set the class-origin: | // set the class-origin: |
|
|
// the class-origin and propagated flag accordingly. | // the class-origin and propagated flag accordingly. |
| |
Uint32 pos = PEG_NOT_FOUND; | Uint32 pos = PEG_NOT_FOUND; |
/* ATTN: KS move to simpler |
/* ATTN: KS move to simpler version of the find |
for (Uint32 j = m, n = _properties.size(); j < n; j++) | for (Uint32 j = m, n = _properties.size(); j < n; j++) |
{ | { |
if (CIMName::equal(_properties[j].getName(), | if (CIMName::equal(_properties[j].getName(), |
|
|
} | } |
else | else |
{ | { |
|
// Property Qualifiers must propagate if allowed |
// If property exists in the superclass and in the subclass, | // If property exists in the superclass and in the subclass, |
// then, enumerate the qualifiers of the superclass's property. | // then, enumerate the qualifiers of the superclass's property. |
// If a qualifier is defined on the superclass's property | // If a qualifier is defined on the superclass's property |
|
|
CIMQualifier superClassQualifier = | CIMQualifier superClassQualifier = |
superproperty.getQualifier(i); | superproperty.getQualifier(i); |
const String name = superClassQualifier.getName(); | const String name = superClassQualifier.getName(); |
|
/* ATTN KS This is replacement find function. |
|
if((Uint32 j = subproperty.findQualifier(q.getName()) == PEG_NOT_FOUND) |
|
{ |
|
subproperty.addQualifier(superClassQualifier); |
|
|
|
} |
|
*/ |
for (Uint32 j = 0, m = subproperty.getQualifierCount(); | for (Uint32 j = 0, m = subproperty.getQualifierCount(); |
j < m; | j < m; |
j++) | j++) |
|
|
// the class-origin and propagated flag accordingly. | // the class-origin and propagated flag accordingly. |
| |
Uint32 pos = PEG_NOT_FOUND; | Uint32 pos = PEG_NOT_FOUND; |
/********************** |
/********************** KS move to simpler version |
for (Uint32 j = m, n = _methods.size(); j < n; j++) | for (Uint32 j = m, n = _methods.size(); j < n; j++) |
{ | { |
if (CIMName::equal(_methods[j].getName(), | if (CIMName::equal(_methods[j].getName(), |
|
|
method.setPropagated(true); | method.setPropagated(true); |
_methods.insert(m++, method); | _methods.insert(m++, method); |
} | } |
|
|
} | } |
| |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// Validate the qualifiers of this class: | // Validate the qualifiers of this class: |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
|
//cout << "KSTEST Class Qualifiers resolve for class" << getClassName() << endl; |
_qualifiers.resolve( | _qualifiers.resolve( |
context, | context, |
nameSpace, | nameSpace, |
|
|
superClass._rep->_qualifiers, | superClass._rep->_qualifiers, |
true); | true); |
} | } |
else |
else // No SuperClass exsts |
{ | { |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// Resolve each property: | // Resolve each property: |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
|
//cout << "KSTEST Class Resolve, No Super class " << getClassName() << endl; |
| |
for (Uint32 i = 0, n = _properties.size(); i < n; i++) | for (Uint32 i = 0, n = _properties.size(); i < n; i++) |
_properties[i].resolve(context, nameSpace, false, true); | _properties[i].resolve(context, nameSpace, false, true); |
|
|
toXml(tmp); | toXml(tmp); |
tmp.append('\0'); | tmp.append('\0'); |
XmlWriter::indentedPrint(os, tmp.getData(), 4); | XmlWriter::indentedPrint(os, tmp.getData(), 4); |
// cout << tmp.getData() << endl; |
|
} | } |
| |
void CIMClassRep::printMof(PEGASUS_STD(ostream) &os) const | void CIMClassRep::printMof(PEGASUS_STD(ostream) &os) const |