version 1.1.2.6, 2007/10/03 00:03:14
|
version 1.1.2.9, 2007/10/04 22:25:54
|
|
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "MetaTypes.h" |
|
#include <cstdarg> | #include <cstdarg> |
#include <cassert> | #include <cassert> |
#include "MetaRepository.h" | #include "MetaRepository.h" |
#include <Pegasus/Common/System.h> | #include <Pegasus/Common/System.h> |
|
#include <Pegasus/Common/Once.h> |
#if 0 |
#include "MetaTypes.h" |
# define TEST_META_REPOSITORY |
|
#endif |
|
|
|
#if defined(TEST_META_REPOSITORY) |
|
# include "root_cimv2_namespace.h" |
|
# include "root_PG_Internal_namespace.h" |
|
# include "root_PG_InterOp_namespace.h" |
|
#endif |
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
typedef const MetaClass* ConstMetaClassPtr; |
|
#define PEGASUS_ARRAY_T ConstMetaClassPtr |
|
# include <Pegasus/Common/ArrayInter.h> |
|
# include <Pegasus/Common/ArrayImpl.h> |
|
#undef PEGASUS_ARRAY_T |
|
|
static const size_t _MAX_NAMESPACES = 32; | static const size_t _MAX_NAMESPACES = 32; |
static const MetaNameSpace* _nameSpaces[_MAX_NAMESPACES]; | static const MetaNameSpace* _nameSpaces[_MAX_NAMESPACES]; |
static size_t _nameSpacesSize = 0; | static size_t _nameSpacesSize = 0; |
|
|
static const size_t _MAX_FEATURES = 1024; | static const size_t _MAX_FEATURES = 1024; |
static const size_t _MAX_QUALIFIERS = 1024; | static const size_t _MAX_QUALIFIERS = 1024; |
| |
static inline void _init() |
|
{ |
|
#if defined(TEST_META_REPOSITORY) |
|
if (_nameSpacesSize == 0) |
|
{ |
|
MetaRepository::addNameSpace(&root_PG_InterOp_namespace); |
|
MetaRepository::addNameSpace(&root_cimv2_namespace); |
|
MetaRepository::addNameSpace(&root_PG_Internal_namespace); |
|
} |
|
#endif |
|
} |
|
|
|
//============================================================================== |
|
// |
|
// Local definitions: |
|
// |
|
//============================================================================== |
|
|
|
PEGASUS_FORMAT(2, 3) | PEGASUS_FORMAT(2, 3) |
static void _throw(CIMStatusCode code, const char* format, ...) | static void _throw(CIMStatusCode code, const char* format, ...) |
{ | { |
|
|
return sub->super == super; | return sub->super == super; |
} | } |
| |
static const MetaClass* _findClass( |
|
const MetaNameSpace* ns, |
|
const char* name) |
|
{ |
|
for (size_t i = 0; ns->classes[i]; i++) |
|
{ |
|
const MetaClass* mc = ns->classes[i]; |
|
|
|
if (_eqi(mc->name, name)) |
|
return mc; |
|
} |
|
|
|
// Not found! |
|
return 0; |
|
} |
|
|
|
static const MetaQualifierDecl* _findQualifierDecl( |
|
const MetaNameSpace* ns, |
|
const char* name) |
|
{ |
|
for (size_t i = 0; ns->classes[i]; i++) |
|
{ |
|
const MetaQualifierDecl* mqd = ns->qualifiers[i]; |
|
|
|
if (_eqi(mqd->name, name)) |
|
return mqd; |
|
} |
|
|
|
// Not found! |
|
return 0; |
|
} |
|
|
|
static char** _makePropertyList(const CIMPropertyList& propertyList) | static char** _makePropertyList(const CIMPropertyList& propertyList) |
{ | { |
if (propertyList.isNull()) | if (propertyList.isNull()) |
|
|
printf("pl[%s]\n", pl[i]); | printf("pl[%s]\n", pl[i]); |
} | } |
| |
|
static bool _contains(const Array<const MetaClass*>& x, const MetaClass* mc) |
|
{ |
|
Uint32 n = x.size(); |
|
const MetaClass* const* p = x.getData(); |
|
|
|
while (n--) |
|
{ |
|
if (*p++ == mc) |
|
return true; |
|
} |
|
|
|
return false; |
|
} |
|
|
|
static void _associators( |
|
const MetaNameSpace* ns, |
|
const CIMName& className, |
|
const CIMName& assocClass, |
|
const CIMName& resultClass, |
|
const String& role, |
|
const String& resultRole, |
|
Array<const MetaClass*>& result) |
|
{ |
|
// Lookup source class: |
|
|
|
const MetaClass* mc = FindClass(ns, *Str(className)); |
|
|
|
if (!mc) |
|
_throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); |
|
|
|
|
|
// Lookup result class (if any). |
|
|
|
const MetaClass* rmc = 0; |
|
|
|
if (!resultClass.isNull()) |
|
{ |
|
rmc = FindClass(ns, *Str(resultClass)); |
|
|
|
if (!rmc) |
|
_throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(resultClass)); |
|
} |
|
|
|
// Convert these to UTF8 now to avoid doing so in loop below. |
|
|
|
Str ac(assocClass); |
|
Str r(role); |
|
Str rr(resultRole); |
|
|
|
// Process association classes: |
|
|
|
for (size_t i = 0; ns->classes[i]; i++) |
|
{ |
|
MetaClass* amc = ns->classes[i]; |
|
|
|
// Skip non-association classes: |
|
|
|
if (!(amc->flags & META_FLAG_ASSOCIATION)) |
|
continue; |
|
|
|
// Filter by assocClass parameter: |
|
|
|
if (!assocClass.isNull() && !_eqi(ac, amc->name)) |
|
continue; |
|
|
|
// Process reference properties: |
|
|
|
MetaFeatureInfo features[META_MAX_FEATURES]; |
|
size_t size = 0; |
|
MergeFeatures(amc, false, META_FLAG_REFERENCE, features, size); |
|
|
|
for (size_t j = 0; j < size; j++) |
|
{ |
|
const MetaFeature* mf = features[j].mf; |
|
|
|
// Skip non references: |
|
|
|
if (!(mf->flags & META_FLAG_REFERENCE)) |
|
continue; |
|
|
|
const MetaReference* mr = (const MetaReference*)mf; |
|
|
|
// Filter by role parameter. |
|
|
|
if (role.size() && !_eqi(r, mf->name)) |
|
continue; |
|
|
|
// Filter by source class: |
|
|
|
if (!IsA(mr->ref, mc)) |
|
continue; |
|
|
|
// Process result reference: |
|
|
|
for (size_t k = 0; k < size; k++) |
|
{ |
|
const MetaFeature* rmf = features[k].mf; |
|
|
|
// Skip the feature under consideration: |
|
|
|
if (rmf == mf) |
|
continue; |
|
|
|
// Skip non references: |
|
|
|
if (!(rmf->flags & META_FLAG_REFERENCE)) |
|
continue; |
|
|
|
const MetaReference* rmr = (const MetaReference*)rmf; |
|
|
|
// Filter by resultRole parameter. |
|
|
|
if (resultRole.size() && !_eqi(rr, rmf->name)) |
|
continue; |
|
|
|
// Skip references not of the result class kind: |
|
|
|
if (rmc && !IsA(rmr->ref, rmc)) |
|
continue; |
|
|
|
// ATTN: should we include entire class hierarchy under |
|
// result class? |
|
|
|
// If reached, then save this one. |
|
|
|
if (!_contains(result, rmr->ref)) |
|
result.append(rmr->ref); |
|
} |
|
} |
|
} |
|
} |
|
|
|
static void _references( |
|
const MetaNameSpace* ns, |
|
const CIMName& className, |
|
const CIMName& resultClass, |
|
const String& role, |
|
Array<const MetaClass*>& result) |
|
{ |
|
// Lookup source class: |
|
|
|
const MetaClass* mc = FindClass(ns, *Str(className)); |
|
|
|
if (!mc) |
|
_throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); |
|
|
|
// Lookup result class (if any). |
|
|
|
const MetaClass* rmc = 0; |
|
|
|
if (!resultClass.isNull()) |
|
{ |
|
rmc = FindClass(ns, *Str(resultClass)); |
|
|
|
if (!rmc) |
|
_throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(resultClass)); |
|
} |
|
|
|
// Convert these to UTF8 now to avoid doing so in loop below. |
|
|
|
Str r(role); |
|
|
|
// Process association classes: |
|
|
|
for (size_t i = 0; ns->classes[i]; i++) |
|
{ |
|
MetaClass* amc = ns->classes[i]; |
|
|
|
// Skip non-association classes: |
|
|
|
if (!(amc->flags & META_FLAG_ASSOCIATION)) |
|
continue; |
|
|
|
// Filter by result class: |
|
|
|
if (rmc && !IsA(rmc, amc)) |
|
continue; |
|
|
|
// Process reference properties: |
|
|
|
MetaFeatureInfo features[META_MAX_FEATURES]; |
|
size_t size = 0; |
|
MergeFeatures(amc, false, META_FLAG_REFERENCE, features, size); |
|
|
|
for (size_t j = 0; j < size; j++) |
|
{ |
|
const MetaFeature* mf = features[j].mf; |
|
|
|
// Skip non references: |
|
|
|
if (!(mf->flags & META_FLAG_REFERENCE)) |
|
continue; |
|
|
|
const MetaReference* mr = (const MetaReference*)mf; |
|
|
|
// Filter by role parameter. |
|
|
|
if (role.size() && !_eqi(r, mf->name)) |
|
continue; |
|
|
|
// Filter by source class: |
|
|
|
if (!IsA(mr->ref, mc)) |
|
continue; |
|
|
|
// Add this one to the output: |
|
|
|
if (!_contains(result, amc)) |
|
result.append((MetaClass*)amc); |
|
} |
|
} |
|
} |
|
|
|
//============================================================================== |
|
// |
|
// _getHostName() |
|
// |
|
//============================================================================== |
|
|
|
static Once _once = PEGASUS_ONCE_INITIALIZER; |
|
static const char* _hostName = 0; |
|
|
|
static void _initHostName() |
|
{ |
|
String hn = System::getHostName(); |
|
_hostName = strdup(*Str(hn)); |
|
} |
|
|
|
static inline const char* _getHostName() |
|
{ |
|
once(&_once, _initHostName); |
|
return _hostName; |
|
} |
|
|
//============================================================================== | //============================================================================== |
// | // |
// class MetaRepository | // class MetaRepository |
|
|
Boolean includeClassOrigin, | Boolean includeClassOrigin, |
const CIMPropertyList& propertyList) | const CIMPropertyList& propertyList) |
{ | { |
printf("===== MetaRepository::getClass()\n"); |
|
_init(); |
|
|
|
// Lookup namespace: | // Lookup namespace: |
| |
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); | const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
| |
// Lookup class: | // Lookup class: |
| |
const MetaClass* mc = _findClass(ns, *Str(className)); |
const MetaClass* mc = FindClass(ns, *Str(className)); |
| |
if (!mc) | if (!mc) |
_throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); | _throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); |
|
|
| |
CIMClass cc; | CIMClass cc; |
| |
if (MakeClass(ns, mc, localOnly, includeQualifiers, |
if (MakeClass(_getHostName(), ns, mc, localOnly, includeQualifiers, |
includeQualifiers, pl, cc) != 0) |
includeClassOrigin, pl, cc) != 0) |
{ | { |
_freePropertyList(pl); | _freePropertyList(pl); |
_throw(CIM_ERR_FAILED, "conversion failed: %s", mc->name); | _throw(CIM_ERR_FAILED, "conversion failed: %s", mc->name); |
|
|
Boolean includeQualifiers, | Boolean includeQualifiers, |
Boolean includeClassOrigin) | Boolean includeClassOrigin) |
{ | { |
printf("===== MetaRepository::enumerateClasses()\n"); |
|
_init(); |
|
|
|
// Lookup namespace: | // Lookup namespace: |
| |
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); | const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
| |
if (!className.isNull()) | if (!className.isNull()) |
{ | { |
super = _findClass(ns, *Str(className)); |
super = FindClass(ns, *Str(className)); |
| |
if (!super) | if (!super) |
_throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); | _throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); |
|
|
{ | { |
CIMClass cc; | CIMClass cc; |
| |
if (MakeClass(ns, mc, localOnly, includeQualifiers, |
if (MakeClass(_getHostName(), ns, mc, localOnly, includeQualifiers, |
includeQualifiers, 0, cc) != 0) |
includeClassOrigin, 0, cc) != 0) |
{ | { |
_throw(CIM_ERR_FAILED, "conversion failed: %s", mc->name); | _throw(CIM_ERR_FAILED, "conversion failed: %s", mc->name); |
} | } |
else |
|
result.append(cc); | result.append(cc); |
} | } |
} | } |
|
|
const CIMName& className, | const CIMName& className, |
Boolean deepInheritance) | Boolean deepInheritance) |
{ | { |
printf("===== MetaRepository::enumerateClassNames()\n"); |
|
_init(); |
|
|
|
// Lookup namespace: | // Lookup namespace: |
| |
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); | const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
| |
if (!className.isNull()) | if (!className.isNull()) |
{ | { |
super = _findClass(ns, *Str(className)); |
super = FindClass(ns, *Str(className)); |
| |
if (!super) | if (!super) |
_throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); | _throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); |
|
|
Boolean deepInheritance, | Boolean deepInheritance, |
Array<CIMName>& subClassNames) | Array<CIMName>& subClassNames) |
{ | { |
printf("===== MetaRepository::getSubClassNames()\n"); |
|
_init(); |
|
|
|
subClassNames = MetaRepository::enumerateClassNames( | subClassNames = MetaRepository::enumerateClassNames( |
nameSpace, className, deepInheritance); | nameSpace, className, deepInheritance); |
} | } |
|
|
const CIMName& className, | const CIMName& className, |
Array<CIMName>& superClassNames) | Array<CIMName>& superClassNames) |
{ | { |
printf("===== MetaRepository::getSuperClassNames()\n"); |
|
_init(); |
|
|
|
superClassNames.clear(); | superClassNames.clear(); |
| |
// Lookup namespace: | // Lookup namespace: |
|
|
| |
// Lookup class: | // Lookup class: |
| |
const MetaClass* mc = _findClass(ns, *Str(className)); |
const MetaClass* mc = FindClass(ns, *Str(className)); |
| |
if (!mc) | if (!mc) |
_throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); | _throw(CIM_ERR_NOT_FOUND, "unknown class: %s", *Str(className)); |
|
|
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const NameSpaceAttributes& attributes) | const NameSpaceAttributes& attributes) |
{ | { |
printf("===== MetaRepository::createNameSpace()\n"); |
|
|
|
_throw(CIM_ERR_NOT_SUPPORTED, "createNameSpace()"); | _throw(CIM_ERR_NOT_SUPPORTED, "createNameSpace()"); |
} | } |
| |
|
|
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const NameSpaceAttributes& attributes) | const NameSpaceAttributes& attributes) |
{ | { |
printf("===== MetaRepository::modifyNameSpace()\n"); |
|
|
|
_throw(CIM_ERR_NOT_SUPPORTED, "modifyNameSpace()"); | _throw(CIM_ERR_NOT_SUPPORTED, "modifyNameSpace()"); |
} | } |
| |
Array<CIMNamespaceName> MetaRepository::enumerateNameSpaces() | Array<CIMNamespaceName> MetaRepository::enumerateNameSpaces() |
{ | { |
printf("===== MetaRepository::enumerateNameSpaces()\n"); |
|
_init(); |
|
|
|
Array<CIMNamespaceName> nameSpaces; | Array<CIMNamespaceName> nameSpaces; |
| |
for (size_t i = 0; i < _nameSpacesSize; i++) | for (size_t i = 0; i < _nameSpacesSize; i++) |
|
|
void MetaRepository::deleteNameSpace( | void MetaRepository::deleteNameSpace( |
const CIMNamespaceName& nameSpace) | const CIMNamespaceName& nameSpace) |
{ | { |
printf("===== MetaRepository::deleteNameSpace()\n"); |
|
|
|
_throw(CIM_ERR_NOT_SUPPORTED, "deleteNameSpace()"); | _throw(CIM_ERR_NOT_SUPPORTED, "deleteNameSpace()"); |
} | } |
| |
|
|
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
NameSpaceAttributes& attributes) | NameSpaceAttributes& attributes) |
{ | { |
printf("===== MetaRepository::getNameSpaceAttributes()\n"); |
|
|
|
_throw(CIM_ERR_NOT_SUPPORTED, "getNameSpaceAttributes()"); | _throw(CIM_ERR_NOT_SUPPORTED, "getNameSpaceAttributes()"); |
| |
return false; | return false; |
|
|
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
String& remoteInfo) | String& remoteInfo) |
{ | { |
printf("===== MetaRepository::isRemoteNameSpace()\n"); |
|
|
|
return false; | return false; |
} | } |
| |
|
|
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMName& qualifierName) | const CIMName& qualifierName) |
{ | { |
printf("===== MetaRepository::getQualifier()\n"); |
|
_init(); |
|
|
|
// Lookup namespace: | // Lookup namespace: |
| |
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); | const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
| |
// Lookup qualifier: | // Lookup qualifier: |
| |
const MetaQualifierDecl* mqd = _findQualifierDecl(ns, *Str(qualifierName)); |
const MetaQualifierDecl* mqd = FindQualifierDecl(ns, *Str(qualifierName)); |
| |
if (!mqd) | if (!mqd) |
_throw(CIM_ERR_NOT_FOUND, "unknown qualifier: %s", *Str(qualifierName)); | _throw(CIM_ERR_NOT_FOUND, "unknown qualifier: %s", *Str(qualifierName)); |
|
|
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMQualifierDecl& qualifierDecl) | const CIMQualifierDecl& qualifierDecl) |
{ | { |
printf("===== MetaRepository::setQualifier()\n"); |
|
|
|
_throw(CIM_ERR_NOT_SUPPORTED, "setQualifier()"); | _throw(CIM_ERR_NOT_SUPPORTED, "setQualifier()"); |
| |
} | } |
|
|
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMName& qualifierName) | const CIMName& qualifierName) |
{ | { |
printf("===== MetaRepository::deleteQualifier()\n"); |
|
|
|
_throw(CIM_ERR_NOT_SUPPORTED, "deleteQualifier()"); | _throw(CIM_ERR_NOT_SUPPORTED, "deleteQualifier()"); |
} | } |
| |
Array<CIMQualifierDecl> MetaRepository::enumerateQualifiers( | Array<CIMQualifierDecl> MetaRepository::enumerateQualifiers( |
const CIMNamespaceName& nameSpace) | const CIMNamespaceName& nameSpace) |
{ | { |
printf("===== MetaRepository::enumerateQualifiers()\n"); |
|
_init(); |
|
|
|
// Lookup namespace: | // Lookup namespace: |
| |
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); | const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
return result; | return result; |
} | } |
| |
|
Array<CIMObjectPath> MetaRepository::associatorClassPaths( |
|
const CIMNamespaceName& nameSpace, |
|
const CIMName& className, |
|
const CIMName& assocClass, |
|
const CIMName& resultClass, |
|
const String& role, |
|
const String& resultRole) |
|
{ |
|
// Lookup namespace: |
|
|
|
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
|
if (!ns) |
|
_throw(CIM_ERR_INVALID_NAMESPACE, "%s", *Str(nameSpace)); |
|
|
|
// Get associator meta-classes: |
|
|
|
Array<const MetaClass*> mcs; |
|
_associators(ns, className, assocClass, resultClass, role, resultRole, mcs); |
|
|
|
// Convert meta-classes to object names: |
|
|
|
Array<CIMObjectPath> result; |
|
|
|
for (Uint32 i = 0; i < mcs.size(); i++) |
|
result.append(CIMObjectPath(_getHostName(), nameSpace, mcs[i]->name)); |
|
|
|
return result; |
|
} |
|
|
|
Array<CIMObject> MetaRepository::associatorClasses( |
|
const CIMNamespaceName& nameSpace, |
|
const CIMName& className, |
|
const CIMName& assocClass, |
|
const CIMName& resultClass, |
|
const String& role, |
|
const String& resultRole, |
|
Boolean includeQualifiers, |
|
Boolean includeClassOrigin, |
|
const CIMPropertyList& propertyList) |
|
{ |
|
// Lookup namespace: |
|
|
|
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
|
if (!ns) |
|
_throw(CIM_ERR_INVALID_NAMESPACE, "%s", *Str(nameSpace)); |
|
|
|
// Get associator meta-classes: |
|
|
|
Array<const MetaClass*> mcs; |
|
_associators(ns, className, assocClass, resultClass, role, resultRole, mcs); |
|
|
|
// Convert meta-classes to classes. |
|
|
|
Array<CIMObject> result; |
|
|
|
char** pl = _makePropertyList(propertyList); |
|
|
|
for (Uint32 i = 0; i < mcs.size(); i++) |
|
{ |
|
const MetaClass* mc = mcs[i]; |
|
CIMClass cc; |
|
|
|
if (MakeClass(_getHostName(), ns, mc, false, includeQualifiers, |
|
includeClassOrigin, pl, cc) != 0) |
|
{ |
|
_freePropertyList(pl); |
|
_throw(CIM_ERR_FAILED, "conversion failed: %s", mc->name); |
|
} |
|
|
|
result.append(cc); |
|
} |
|
|
|
_freePropertyList(pl); |
|
return result; |
|
} |
|
|
|
Array<CIMObject> MetaRepository::referenceClasses( |
|
const CIMNamespaceName& nameSpace, |
|
const CIMName& className, |
|
const CIMName& resultClass, |
|
const String& role, |
|
Boolean includeQualifiers, |
|
Boolean includeClassOrigin, |
|
const CIMPropertyList& propertyList) |
|
{ |
|
// Lookup namespace: |
|
|
|
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
|
if (!ns) |
|
_throw(CIM_ERR_INVALID_NAMESPACE, "%s", *Str(nameSpace)); |
|
|
|
// Get reference meta-classes: |
|
|
|
Array<const MetaClass*> mcs; |
|
_references(ns, className, resultClass, role, mcs); |
|
|
|
// Convert meta-classes to classes. |
|
|
|
Array<CIMObject> result; |
|
|
|
char** pl = _makePropertyList(propertyList); |
|
|
|
for (Uint32 i = 0; i < mcs.size(); i++) |
|
{ |
|
const MetaClass* mc = mcs[i]; |
|
CIMClass cc; |
|
|
|
if (MakeClass(_getHostName(), ns, mc, false, includeQualifiers, |
|
includeClassOrigin, pl, cc) != 0) |
|
{ |
|
_freePropertyList(pl); |
|
_throw(CIM_ERR_FAILED, "conversion failed: %s", mc->name); |
|
} |
|
|
|
result.append(cc); |
|
} |
|
|
|
_freePropertyList(pl); |
|
return result; |
|
} |
|
|
|
Array<CIMObjectPath> MetaRepository::referenceClassPaths( |
|
const CIMNamespaceName& nameSpace, |
|
const CIMName& className, |
|
const CIMName& resultClass, |
|
const String& role) |
|
{ |
|
// Lookup namespace: |
|
|
|
const MetaNameSpace* ns = _findNameSpace(*Str(nameSpace)); |
|
|
|
if (!ns) |
|
_throw(CIM_ERR_INVALID_NAMESPACE, "%s", *Str(nameSpace)); |
|
|
|
// Get reference meta-classes: |
|
|
|
Array<const MetaClass*> mcs; |
|
_references(ns, className, resultClass, role, mcs); |
|
|
|
// Convert meta-classes to object paths. |
|
|
|
Array<CIMObjectPath> result; |
|
|
|
for (Uint32 i = 0; i < mcs.size(); i++) |
|
result.append(CIMObjectPath(_getHostName(), nameSpace, mcs[i]->name)); |
|
|
|
return result; |
|
} |
|
|
|
const MetaClass* MetaRepository::findMetaClass( |
|
const char* nameSpace, |
|
const char* className) |
|
{ |
|
// Lookup namespace: |
|
|
|
const MetaNameSpace* ns = _findNameSpace(nameSpace); |
|
|
|
if (!ns) |
|
return 0; |
|
|
|
return FindClass(ns, className); |
|
} |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |