version 1.45, 2001/07/08 03:58:32
|
version 1.46, 2001/07/08 05:37:09
|
|
|
const String& nameSpace, | const String& nameSpace, |
const String& className) | const String& className) |
{ | { |
|
// -- Get the class and check to see if it is an association class: |
|
|
|
CIMClass cimClass = getClass(nameSpace, className, false); |
|
Boolean isAssociation = cimClass.isAssociation(); |
|
|
// -- Disallow deletion if class has instances: | // -- Disallow deletion if class has instances: |
| |
String path = _getIndexFilePath(nameSpace, className); | String path = _getIndexFilePath(nameSpace, className); |
|
|
String realPath; | String realPath; |
| |
if (FileSystem::existsNoCase(path, realPath)) | if (FileSystem::existsNoCase(path, realPath)) |
|
|
// -- Delete the class (disallowed if there are subclasses): | // -- Delete the class (disallowed if there are subclasses): |
| |
_nameSpaceManager.deleteClass(nameSpace, className); | _nameSpaceManager.deleteClass(nameSpace, className); |
|
|
|
// -- Remove association: |
|
|
|
if (isAssociation) |
|
{ |
|
String assocFileName = _MakeAssocClassPath(nameSpace, _repositoryRoot); |
|
|
|
if (FileSystem::exists(assocFileName)) |
|
AssocClassTable::deleteAssociation(assocFileName, className); |
|
} |
} | } |
| |
void CIMRepository::deleteInstance( | void CIMRepository::deleteInstance( |
|
|
"unexpected failure in CIMRepository::deleteInstance()"); | "unexpected failure in CIMRepository::deleteInstance()"); |
} | } |
| |
// -- Remove if from the association table (if it is really association). |
// -- Remove it from the association table (if it is really association). |
// -- We ignore the return value intentionally. If it is an association, | // -- We ignore the return value intentionally. If it is an association, |
// -- true is returned. Otherwise, true is returned. | // -- true is returned. Otherwise, true is returned. |
| |
String assocFileName = _MakeAssocInstPath(nameSpace, _repositoryRoot); | String assocFileName = _MakeAssocInstPath(nameSpace, _repositoryRoot); |
| |
|
|
if (FileSystem::exists(assocFileName)) | if (FileSystem::exists(assocFileName)) |
AssocInstTable::deleteAssociation(assocFileName, instanceName); | AssocInstTable::deleteAssociation(assocFileName, instanceName); |
} | } |
|
|
const String& role, | const String& role, |
const String& resultRole) | const String& resultRole) |
{ | { |
String assocFileName = _MakeAssocInstPath(nameSpace, _repositoryRoot); |
|
Array<String> associatorNames; | Array<String> associatorNames; |
| |
// The return value of this function is ignored since it is okay for |
if (objectName.isClassName()) |
// the given object not to have any associators (in this case we just |
{ |
// return a zero-sized array of associators. |
String assocFileName = _MakeAssocClassPath(nameSpace, _repositoryRoot); |
|
|
|
AssocClassTable::getAssociatorNames( |
|
assocFileName, |
|
objectName.toString(), |
|
assocClass, |
|
resultClass, |
|
role, |
|
resultRole, |
|
associatorNames); |
|
} |
|
else |
|
{ |
|
String assocFileName = _MakeAssocInstPath(nameSpace, _repositoryRoot); |
| |
AssocInstTable::getAssociatorNames( | AssocInstTable::getAssociatorNames( |
assocFileName, | assocFileName, |
|
|
role, | role, |
resultRole, | resultRole, |
associatorNames); | associatorNames); |
|
} |
| |
Array<CIMReference> result; | Array<CIMReference> result; |
| |
|
|
if (tmpNameSpace.size() == 0) | if (tmpNameSpace.size() == 0) |
tmpNameSpace = nameSpace; | tmpNameSpace = nameSpace; |
| |
// ATTN: getInstance() should be able to handle instance names |
// ATTN: getInstance() should this be able to handle instance names |
// with host names and namespaces. |
// with host names and namespaces? |
| |
CIMReference tmpRef = names[i]; | CIMReference tmpRef = names[i]; |
tmpRef.setHost(String()); | tmpRef.setHost(String()); |
tmpRef.setNameSpace(String()); | tmpRef.setNameSpace(String()); |
| |
|
if (objectName.isClassName()) |
|
{ |
|
CIMClass cimClass = getClass( |
|
tmpNameSpace, |
|
tmpRef.getClassName(), |
|
false, |
|
includeQualifiers, |
|
includeClassOrigin, |
|
propertyList); |
|
|
|
result.append(CIMObjectWithPath(names[i], cimClass)); |
|
} |
|
else |
|
{ |
CIMInstance instance = getInstance( | CIMInstance instance = getInstance( |
tmpNameSpace, | tmpNameSpace, |
tmpRef, | tmpRef, |
|
|
| |
result.append(CIMObjectWithPath(names[i], instance)); | result.append(CIMObjectWithPath(names[i], instance)); |
} | } |
|
} |
| |
return result; | return result; |
} | } |
|
|
const String& resultClass, | const String& resultClass, |
const String& role) | const String& role) |
{ | { |
String assocFileName = _MakeAssocInstPath(nameSpace, _repositoryRoot); |
|
Array<String> tmpReferenceNames; | Array<String> tmpReferenceNames; |
| |
|
if (objectName.isClassName()) |
|
{ |
|
String assocFileName = _MakeAssocClassPath(nameSpace, _repositoryRoot); |
|
|
|
if (!AssocClassTable::getReferenceNames( |
|
assocFileName, |
|
objectName.getClassName(), |
|
resultClass, |
|
role, |
|
tmpReferenceNames)) |
|
{ |
|
// Ignore error! It's okay not to have references. |
|
} |
|
} |
|
else |
|
{ |
|
String assocFileName = _MakeAssocInstPath(nameSpace, _repositoryRoot); |
|
|
if (!AssocInstTable::getReferenceNames( | if (!AssocInstTable::getReferenceNames( |
assocFileName, | assocFileName, |
objectName, | objectName, |
|
|
role, | role, |
tmpReferenceNames)) | tmpReferenceNames)) |
{ | { |
throw PEGASUS_CIM_EXCEPTION(FAILED, "references not found for: " |
// Ignore error! It's okay not to have references. |
+ objectName.toString()); |
} |
} | } |
| |
Array<CIMReference> result; | Array<CIMReference> result; |