version 1.1.2.2, 2007/10/02 14:28:38
|
version 1.1.2.3, 2007/10/02 15:40:30
|
|
|
{ | { |
for (size_t i = 0; ns->classes[i]; i++) | for (size_t i = 0; ns->classes[i]; i++) |
{ | { |
const MetaClass* sc = ns->classes[i]; |
const MetaClass* mc = ns->classes[i]; |
| |
if (_eqi(sc->name, name)) |
if (_eqi(mc->name, name)) |
return sc; |
return mc; |
} | } |
| |
// Not found! | // Not found! |
|
|
| |
struct FeatureInfo | struct FeatureInfo |
{ | { |
const MetaFeature* sf; |
const MetaFeature* mf; |
const MetaClass* sc; |
const MetaClass* mc; |
}; | }; |
| |
static int _mergeFeatures( | static int _mergeFeatures( |
const MetaClass* sc, |
const MetaClass* mc, |
|
bool localOnly, |
FeatureInfo features[_MAX_FEATURES], | FeatureInfo features[_MAX_FEATURES], |
size_t& numFeatures) | size_t& numFeatures) |
{ | { |
if (sc->super) |
if (!localOnly && mc->super) |
{ | { |
if (_mergeFeatures(sc->super, features, numFeatures) != 0) |
if (_mergeFeatures(mc->super, localOnly, features, numFeatures) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
|
|
| |
// Process all features of this class: | // Process all features of this class: |
| |
for (size_t i = 0; sc->features[i]; i++) |
for (size_t i = 0; mc->features[i]; i++) |
{ | { |
const MetaFeature* sf = sc->features[i]; |
const MetaFeature* mf = mc->features[i]; |
| |
// Override feature if defined by ancestor class: | // Override feature if defined by ancestor class: |
| |
|
|
| |
for (size_t j = 0; j < numFeatures; j++) | for (size_t j = 0; j < numFeatures; j++) |
{ | { |
const MetaFeature* tmp = features[j].sf; |
const MetaFeature* tmp = features[j].mf; |
| |
if (_eqi(sf->name, tmp->name)) |
if (_eqi(mf->name, tmp->name)) |
{ | { |
features[j].sf = sf; |
features[j].mf = mf; |
features[j].sc = sc; |
features[j].mc = mc; |
found = true; | found = true; |
break; | break; |
} | } |
|
|
return -1; | return -1; |
} | } |
| |
features[numFeatures].sf = sf; |
features[numFeatures].mf = mf; |
features[numFeatures].sc = sc; |
features[numFeatures].mc = mc; |
numFeatures++; | numFeatures++; |
} | } |
} | } |
|
|
struct QualifierInfo | struct QualifierInfo |
{ | { |
const char* qualifier; | const char* qualifier; |
const MetaClass* sc; |
const MetaClass* mc; |
}; | }; |
| |
static const MetaFeature* _findFeature( | static const MetaFeature* _findFeature( |
const MetaClass* sc, |
const MetaClass* mc, |
const char* name) | const char* name) |
{ | { |
for (size_t i = 0; sc->features[i]; i++) |
for (size_t i = 0; mc->features[i]; i++) |
{ | { |
const MetaFeature* sf = sc->features[i]; |
const MetaFeature* mf = mc->features[i]; |
| |
if (_eqi(sf->name, name)) |
if (_eqi(mf->name, name)) |
return sf; |
return mf; |
} | } |
| |
// Not found! | // Not found! |
|
|
} | } |
| |
static const MetaFeature* _findParameter( | static const MetaFeature* _findParameter( |
const MetaMethod* sm, |
const MetaMethod* mm, |
const char* name) | const char* name) |
{ | { |
for (size_t i = 0; sm->parameters[i]; i++) |
for (size_t i = 0; mm->parameters[i]; i++) |
{ | { |
const MetaFeature* sf = sm->parameters[i]; |
const MetaFeature* mf = mm->parameters[i]; |
| |
if (_eqi(sm->name, name)) |
if (_eqi(mm->name, name)) |
return sf; |
return mf; |
} | } |
| |
// Not found! | // Not found! |
|
|
| |
static int _mergeQualifiers( | static int _mergeQualifiers( |
const MetaNameSpace* ns, | const MetaNameSpace* ns, |
const MetaClass* sc, |
const MetaClass* mc, |
const char* featureName, | const char* featureName, |
const char* parameterName, | const char* parameterName, |
bool depth, | bool depth, |
|
|
{ | { |
// Merge super-class qualifiers: | // Merge super-class qualifiers: |
| |
if (sc->super) |
if (mc->super) |
{ | { |
_mergeQualifiers(ns, sc->super, featureName, parameterName, depth + 1, |
_mergeQualifiers(ns, mc->super, featureName, parameterName, depth + 1, |
qualifiers, numQualifiers); | qualifiers, numQualifiers); |
} | } |
| |
|
|
if (!featureName && !parameterName) | if (!featureName && !parameterName) |
{ | { |
// Case 1: get class qualifiers: | // Case 1: get class qualifiers: |
quals = sc->qualifiers; |
quals = mc->qualifiers; |
} | } |
else if (featureName && !parameterName) | else if (featureName && !parameterName) |
{ | { |
// Case 2: get feature qualifiers: | // Case 2: get feature qualifiers: |
| |
const MetaFeature* sf = _findFeature(sc, featureName); |
const MetaFeature* mf = _findFeature(mc, featureName); |
| |
if (sf) |
if (mf) |
quals = sf->qualifiers; |
quals = mf->qualifiers; |
} | } |
else if (featureName && parameterName) | else if (featureName && parameterName) |
{ | { |
// Case 3: get parameter qualifiers: | // Case 3: get parameter qualifiers: |
| |
const MetaFeature* sf = _findFeature(sc, featureName); |
const MetaFeature* mf = _findFeature(mc, featureName); |
| |
if (sf && (sf->flags & META_FLAG_METHOD)) |
if (mf && (mf->flags & META_FLAG_METHOD)) |
{ | { |
const MetaMethod* sm = (const MetaMethod*)sf; |
const MetaMethod* mm = (const MetaMethod*)mf; |
const MetaFeature* p = _findParameter(sm, parameterName); |
const MetaFeature* p = _findParameter(mm, parameterName); |
| |
if (p) | if (p) |
quals = p->qualifiers; | quals = p->qualifiers; |
|
|
if (qi[0] == qj[0]) | if (qi[0] == qj[0]) |
{ | { |
qualifiers[j].qualifier = qi; | qualifiers[j].qualifier = qi; |
qualifiers[j].sc = sc; |
qualifiers[j].mc = mc; |
found = true; | found = true; |
break; | break; |
} | } |
|
|
} | } |
| |
qualifiers[numQualifiers].qualifier = qi; | qualifiers[numQualifiers].qualifier = qi; |
qualifiers[numQualifiers].sc = sc; |
qualifiers[numQualifiers].mc = mc; |
numQualifiers++; | numQualifiers++; |
} | } |
} | } |
|
|
template<class C> | template<class C> |
static int _addQualifiers( | static int _addQualifiers( |
const MetaNameSpace* ns, | const MetaNameSpace* ns, |
const MetaClass* sc, |
const MetaClass* mc, |
const char* featureName, | const char* featureName, |
const char* parameterName, | const char* parameterName, |
C& c) | C& c) |
|
|
size_t numQualifiers = 0; | size_t numQualifiers = 0; |
| |
if (_mergeQualifiers( | if (_mergeQualifiers( |
ns, sc, featureName, parameterName, 0, qualifiers, numQualifiers) != 0) |
ns, mc, featureName, parameterName, 0, qualifiers, numQualifiers) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
|
|
| |
static int _addProperty( | static int _addProperty( |
const MetaNameSpace* ns, | const MetaNameSpace* ns, |
const MetaClass* sc, |
const MetaClass* mc, |
const MetaProperty* sp, |
const MetaProperty* mp, |
const char* classOrigin, | const char* classOrigin, |
bool propagated, | bool propagated, |
|
bool includeQualifiers, |
|
bool includeClassOrigin, |
CIMClass& cc) | CIMClass& cc) |
{ | { |
// Make CIMvalue: | // Make CIMvalue: |
| |
CIMValue cv; | CIMValue cv; |
| |
if (_makeValue(cv, sp->type, sp->subscript, sp->value) != 0) |
if (_makeValue(cv, mp->type, mp->subscript, mp->value) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
|
|
| |
// Create property: | // Create property: |
| |
CIMProperty cp(sp->name, cv); |
CIMProperty cp(mp->name, cv); |
|
|
|
if (includeClassOrigin) |
cp.setClassOrigin(classOrigin); | cp.setClassOrigin(classOrigin); |
|
|
cp.setPropagated(propagated); | cp.setPropagated(propagated); |
| |
// Add qualifiers: | // Add qualifiers: |
| |
if (_addQualifiers(ns, sc, sp->name, 0, cp) != 0) |
if (includeQualifiers) |
|
{ |
|
if (_addQualifiers(ns, mc, mp->name, 0, cp) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
} | } |
|
} |
| |
// Add to class: | // Add to class: |
| |
|
|
| |
static int _addReference( | static int _addReference( |
const MetaNameSpace* ns, | const MetaNameSpace* ns, |
const MetaClass* sc, |
const MetaClass* mc, |
const MetaReference* sr, |
const MetaReference* mr, |
const char* classOrigin, | const char* classOrigin, |
bool propagated, | bool propagated, |
|
bool includeQualifiers, |
|
bool includeClassOrigin, |
CIMClass& cc) | CIMClass& cc) |
{ | { |
// Set isArray and arraySize: | // Set isArray and arraySize: |
|
|
Boolean isArray; | Boolean isArray; |
Uint32 arraySize; | Uint32 arraySize; |
| |
if (sr->subscript == -1) |
if (mr->subscript == -1) |
{ | { |
isArray = false; | isArray = false; |
arraySize = 0; | arraySize = 0; |
|
|
else | else |
{ | { |
isArray = true; | isArray = true; |
arraySize = sr->subscript; |
arraySize = mr->subscript; |
} | } |
| |
// Set referenceClassName: | // Set referenceClassName: |
| |
CIMName rcn = sr->ref->name; |
CIMName rcn = mr->ref->name; |
| |
// Create value: | // Create value: |
| |
|
|
| |
// Create property: | // Create property: |
| |
CIMProperty cp(sr->name, cv, arraySize, rcn, classOrigin, propagated); |
CIMProperty cp(mr->name, cv, arraySize, rcn); |
|
|
|
if (includeClassOrigin) |
|
cp.setClassOrigin(classOrigin); |
|
|
|
cp.setPropagated(propagated); |
| |
// Add qualifiers: | // Add qualifiers: |
| |
if (_addQualifiers(ns, sc, sr->name, 0, cp) != 0) |
if (includeQualifiers) |
|
{ |
|
if (_addQualifiers(ns, mc, mr->name, 0, cp) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
} | } |
|
} |
| |
// Add to class: | // Add to class: |
| |
|
|
| |
static int _addPropertyParameter( | static int _addPropertyParameter( |
const MetaNameSpace* ns, | const MetaNameSpace* ns, |
const MetaClass* sc, |
const MetaClass* mc, |
const MetaMethod* sm, |
const MetaMethod* mm, |
const MetaProperty* sp, |
const MetaProperty* mp, |
|
bool includeQualifiers, |
CIMMethod& cm) | CIMMethod& cm) |
{ | { |
// Create property: | // Create property: |
|
|
bool isArray; | bool isArray; |
Uint32 arraySize; | Uint32 arraySize; |
| |
if (sp->subscript == -1) |
if (mp->subscript == -1) |
{ | { |
isArray = false; | isArray = false; |
arraySize = 0; | arraySize = 0; |
|
|
else | else |
{ | { |
isArray = true; | isArray = true; |
arraySize = Uint32(sp->subscript); |
arraySize = Uint32(mp->subscript); |
} | } |
| |
CIMParameter cp(sp->name, CIMType(sp->type), isArray, arraySize); |
CIMParameter cp(mp->name, CIMType(mp->type), isArray, arraySize); |
| |
// Add qualifiers: | // Add qualifiers: |
| |
if (_addQualifiers(ns, sc, sm->name, sp->name, cm) != 0) |
if (includeQualifiers) |
|
{ |
|
if (_addQualifiers(ns, mc, mm->name, mp->name, cm) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
} | } |
|
} |
| |
// Add to method: | // Add to method: |
| |
|
|
| |
static int _addReferenceParameter( | static int _addReferenceParameter( |
const MetaNameSpace* ns, | const MetaNameSpace* ns, |
const MetaClass* sc, |
const MetaClass* mc, |
const MetaMethod* sm, |
const MetaMethod* mm, |
const MetaReference* sr, |
const MetaReference* mr, |
|
bool includeQualifiers, |
CIMMethod& cm) | CIMMethod& cm) |
{ | { |
// Create property: | // Create property: |
|
|
bool isArray; | bool isArray; |
Uint32 arraySize; | Uint32 arraySize; |
| |
if (sr->subscript == -1) |
if (mr->subscript == -1) |
{ | { |
isArray = false; | isArray = false; |
arraySize = 0; | arraySize = 0; |
|
|
else | else |
{ | { |
isArray = true; | isArray = true; |
arraySize = Uint32(sr->subscript); |
arraySize = Uint32(mr->subscript); |
} | } |
| |
CIMName rcn = sr->ref->name; |
CIMName rcn = mr->ref->name; |
CIMParameter cp(sr->name, CIMTYPE_REFERENCE, isArray, arraySize, rcn); |
CIMParameter cp(mr->name, CIMTYPE_REFERENCE, isArray, arraySize, rcn); |
| |
// Add qualifiers: | // Add qualifiers: |
| |
if (_addQualifiers(ns, sc, sm->name, sr->name, cm) != 0) |
if (includeQualifiers) |
|
{ |
|
if (_addQualifiers(ns, mc, mm->name, mr->name, cm) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
} | } |
|
} |
| |
// Add to method: | // Add to method: |
| |
|
|
| |
static int _addMethod( | static int _addMethod( |
const MetaNameSpace* ns, | const MetaNameSpace* ns, |
const MetaClass* sc, |
const MetaClass* mc, |
const MetaMethod* sm, |
const MetaMethod* mm, |
const char* classOrigin, | const char* classOrigin, |
bool propagated, | bool propagated, |
|
bool includeQualifiers, |
|
bool includeClassOrigin, |
CIMClass& cc) | CIMClass& cc) |
{ | { |
// Create method: | // Create method: |
| |
CIMMethod cm(sm->name, CIMType(sm->type)); |
CIMMethod cm(mm->name, CIMType(mm->type)); |
|
|
|
if (includeClassOrigin) |
cm.setClassOrigin(classOrigin); | cm.setClassOrigin(classOrigin); |
|
|
cm.setPropagated(propagated); | cm.setPropagated(propagated); |
| |
// Add parameters: | // Add parameters: |
| |
for (size_t i = 0; sm->parameters[i]; i++) |
for (size_t i = 0; mm->parameters[i]; i++) |
{ | { |
MetaFeature* sf = sm->parameters[i]; |
MetaFeature* mf = mm->parameters[i]; |
| |
if (sf->flags & META_FLAG_PROPERTY) |
if (mf->flags & META_FLAG_PROPERTY) |
{ | { |
MetaProperty* sp = (MetaProperty*)sf; |
MetaProperty* mp = (MetaProperty*)mf; |
_addPropertyParameter(ns, sc, sm, sp, cm); |
_addPropertyParameter(ns, mc, mm, mp, includeQualifiers, cm); |
} | } |
else if (sf->flags & META_FLAG_REFERENCE) |
else if (mf->flags & META_FLAG_REFERENCE) |
{ | { |
MetaReference* sr = (MetaReference*)sf; |
MetaReference* mr = (MetaReference*)mf; |
_addReferenceParameter(ns, sc, sm, sr, cm); |
_addReferenceParameter(ns, mc, mm, mr, includeQualifiers, cm); |
} | } |
} | } |
| |
// Add qualifiers: | // Add qualifiers: |
| |
if (_addQualifiers(ns, sc, sm->name, 0, cm) != 0) |
if (includeQualifiers) |
|
{ |
|
if (_addQualifiers(ns, mc, mm->name, 0, cm) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
} | } |
|
} |
| |
// Add to class: | // Add to class: |
| |
|
|
return 0; | return 0; |
} | } |
| |
|
static bool _hasProperty(const char* const* propertyList, const char* name) |
|
{ |
|
for (size_t i = 0; propertyList[i]; i++) |
|
{ |
|
if (_eqi(propertyList[i], name)) |
|
return true; |
|
} |
|
|
|
return false; |
|
} |
|
|
static int _addFeatures( | static int _addFeatures( |
const MetaNameSpace* ns, | const MetaNameSpace* ns, |
const MetaClass* sc, |
const MetaClass* mc, |
|
bool localOnly, |
|
bool includeQualifiers, |
|
bool includeClassOrigin, |
|
const char* const* propertyList, |
CIMClass& cc) | CIMClass& cc) |
{ | { |
|
|
// Merge features from all inheritance levels into a single array: | // Merge features from all inheritance levels into a single array: |
| |
FeatureInfo features[_MAX_FEATURES]; | FeatureInfo features[_MAX_FEATURES]; |
size_t numFeatures = 0; | size_t numFeatures = 0; |
| |
if (_mergeFeatures(sc, features, numFeatures) != 0) |
if (_mergeFeatures(mc, localOnly, features, numFeatures) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
|
|
| |
// Set propagated flag: | // Set propagated flag: |
| |
bool propagated = fi.sc != sc; |
bool propagated = fi.mc != mc; |
| |
// Set classOrigin: | // Set classOrigin: |
| |
const char* classOrigin = fi.sc->name; |
const char* classOrigin = fi.mc->name; |
| |
// Add the feature: |
// Skip feature not in property list: |
|
|
|
const MetaFeature* mf = fi.mf; |
| |
const MetaFeature* sf = fi.sf; |
if (propertyList && !_hasProperty(propertyList, mf->name)) |
|
continue; |
| |
if (sf->flags & META_FLAG_PROPERTY) |
// Add the feature: |
|
|
|
if (mf->flags & META_FLAG_PROPERTY) |
{ | { |
MetaProperty* sp = (MetaProperty*)sf; |
MetaProperty* mp = (MetaProperty*)mf; |
| |
if (_addProperty(ns, sc, sp, classOrigin, propagated, cc) != 0) |
if (_addProperty(ns, mc, mp, classOrigin, propagated, |
|
includeQualifiers, includeClassOrigin, cc) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
} | } |
} | } |
else if (sf->flags & META_FLAG_REFERENCE) |
else if (mf->flags & META_FLAG_REFERENCE) |
{ | { |
MetaReference* sr = (MetaReference*)sf; |
MetaReference* mr = (MetaReference*)mf; |
| |
if (_addReference(ns, sc, sr, classOrigin, propagated, cc) != 0) |
if (_addReference(ns, mc, mr, classOrigin, propagated, |
|
includeQualifiers, includeClassOrigin, cc) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
} | } |
} | } |
else if (sf->flags & META_FLAG_METHOD) |
else if (mf->flags & META_FLAG_METHOD) |
{ | { |
MetaMethod* sm = (MetaMethod*)sf; |
MetaMethod* mm = (MetaMethod*)mf; |
| |
if (_addMethod(ns, sc, sm, classOrigin, propagated, cc) != 0) |
if (_addMethod(ns, mc, mm, classOrigin, propagated, |
|
includeQualifiers, includeClassOrigin, cc) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
|
|
| |
static int _makeClass( | static int _makeClass( |
const MetaNameSpace* ns, | const MetaNameSpace* ns, |
CIMClass& cc, |
const MetaClass* mc, |
const MetaClass* sc) |
Boolean localOnly, |
|
Boolean includeQualifiers, |
|
Boolean includeClassOrigin, |
|
const char* const* propertyList, |
|
CIMClass& cc) |
{ | { |
try | try |
{ | { |
|
|
{ | { |
CIMName scn; | CIMName scn; |
| |
if (sc->super) |
if (mc->super) |
scn = sc->super->name; |
scn = mc->super->name; |
| |
cc = CIMClass(sc->name, scn); |
cc = CIMClass(mc->name, scn); |
} | } |
| |
// Add qualifiers: | // Add qualifiers: |
| |
if (_addQualifiers(ns, sc, 0, 0, cc) != 0) |
if (includeQualifiers) |
|
{ |
|
if (_addQualifiers(ns, mc, 0, 0, cc) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
} | } |
|
} |
| |
// Features: | // Features: |
| |
if (_addFeatures(ns, sc, cc) != 0) |
if (_addFeatures(ns, mc, localOnly, includeQualifiers, |
|
includeClassOrigin, propertyList, cc) != 0) |
{ | { |
printf("T[%u]\n", __LINE__); | printf("T[%u]\n", __LINE__); |
return -1; | return -1; |
|
|
return 0; | return 0; |
} | } |
| |
|
static char** _makePropertyList(const CIMPropertyList& propertyList) |
|
{ |
|
if (propertyList.isNull()) |
|
return 0; |
|
|
|
size_t size = propertyList.size(); |
|
char** pl = (char**)malloc(sizeof(char*) * (size + 1)); |
|
|
|
for (size_t i = 0; i < size; i++) |
|
pl[i] = strdup(*Str(propertyList[i])); |
|
|
|
pl[size] = 0; |
|
|
|
return pl; |
|
} |
|
|
|
static void _freePropertyList(char** pl) |
|
{ |
|
if (!pl) |
|
return; |
|
|
|
for (size_t i = 0; pl[i]; i++) |
|
{ |
|
free(pl[i]); |
|
} |
|
|
|
free(pl); |
|
} |
|
|
|
static void _printPropertyList(const char* const* pl) |
|
{ |
|
if (!pl) |
|
return; |
|
|
|
for (size_t i = 0; pl[i]; i++) |
|
printf("pl[%s]\n", pl[i]); |
|
} |
|
|
//============================================================================== | //============================================================================== |
// | // |
// class MetaRepository | // class MetaRepository |
|
|
Boolean includeClassOrigin, | Boolean includeClassOrigin, |
const CIMPropertyList& propertyList) | const CIMPropertyList& propertyList) |
{ | { |
return CIMClass(); |
printf("===== MetaRepository::getClass()\n"); |
|
|
|
// ATTN-MEB: propertyList ignored! |
|
|
|
#if defined(TEST_META_REPOSITORY) |
|
_init(); |
|
#endif |
|
|
|
// Lookup namespace: |
|
|
|
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
|
if (!ns) |
|
_throw(CIM_ERR_INVALID_NAMESPACE, "%s", *Str(nameSpace)); |
|
|
|
// Lookup class: |
|
|
|
const MetaClass* mc = _findClass(ns, *Str(className)); |
|
|
|
if (!mc) |
|
_throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); |
|
|
|
// Build property list: |
|
|
|
char** pl = _makePropertyList(propertyList); |
|
|
|
// Make class: |
|
|
|
CIMClass cc; |
|
|
|
if (_makeClass(ns, mc, localOnly, includeQualifiers, |
|
includeQualifiers, pl, cc) != 0) |
|
{ |
|
_freePropertyList(pl); |
|
_throw(CIM_ERR_FAILED, "conversion failed: %s", mc->name); |
|
} |
|
|
|
_freePropertyList(pl); |
|
return cc; |
} | } |
| |
Array<CIMClass> MetaRepository::enumerateClasses( | Array<CIMClass> MetaRepository::enumerateClasses( |
|
|
Boolean includeQualifiers, | Boolean includeQualifiers, |
Boolean includeClassOrigin) | Boolean includeClassOrigin) |
{ | { |
|
printf("===== MetaRepository::enumerateClasses()\n"); |
|
|
#if defined(TEST_META_REPOSITORY) | #if defined(TEST_META_REPOSITORY) |
_init(); | _init(); |
#endif | #endif |
| |
printf("MetaRepository::enumerateClasses()\n"); |
|
|
|
// Lookup namespace: | // Lookup namespace: |
| |
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); | const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
| |
for (size_t i = 0; ns->classes[i]; i++) | for (size_t i = 0; ns->classes[i]; i++) |
{ | { |
MetaClass* sc = ns->classes[i]; |
MetaClass* mc = ns->classes[i]; |
| |
// printf("CLASSNAME[%s]\n", sc->name); |
bool flag = false; |
| |
if (deepInheritance) | if (deepInheritance) |
{ | { |
if (_isSubClass(super, sc)) |
if (_isSubClass(super, mc)) |
{ |
flag = true; |
CIMClass cc; |
|
|
|
if (_makeClass(ns, cc, sc) != 0) |
|
_throw(CIM_ERR_FAILED, "conversion failed: %s", sc->name); |
|
else |
|
result.append(cc); |
|
} |
|
} | } |
else | else |
{ | { |
if (_isDirectSubClass(super, sc)) |
if (_isDirectSubClass(super, mc)) |
|
flag = true; |
|
} |
|
|
|
if (flag) |
{ | { |
CIMClass cc; | CIMClass cc; |
| |
if (_makeClass(ns, cc, sc) != 0) |
if (_makeClass(ns, mc, localOnly, includeQualifiers, |
_throw(CIM_ERR_FAILED, "conversion failed: %s", sc->name); |
includeQualifiers, 0, cc) != 0) |
|
{ |
|
_throw(CIM_ERR_FAILED, "conversion failed: %s", mc->name); |
|
} |
else | else |
result.append(cc); | result.append(cc); |
} | } |
} | } |
} |
|
| |
return result; | return result; |
} | } |
|
|
const CIMName& className, | const CIMName& className, |
Boolean deepInheritance) | Boolean deepInheritance) |
{ | { |
|
printf("===== MetaRepository::enumerateClassNames()\n"); |
|
|
|
#if defined(TEST_META_REPOSITORY) |
|
_init(); |
|
#endif |
|
|
// Lookup namespace: | // Lookup namespace: |
| |
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); | const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
| |
for (size_t i = 0; ns->classes[i]; i++) | for (size_t i = 0; ns->classes[i]; i++) |
{ | { |
MetaClass* sc = ns->classes[i]; |
MetaClass* mc = ns->classes[i]; |
| |
if (deepInheritance) | if (deepInheritance) |
{ | { |
if (_isSubClass(super, sc)) |
if (_isSubClass(super, mc)) |
result.append(sc->name); |
result.append(mc->name); |
} | } |
else | else |
{ | { |
if (_isDirectSubClass(super, sc)) |
if (_isDirectSubClass(super, mc)) |
result.append(sc->name); |
result.append(mc->name); |
} | } |
} | } |
| |