version 1.2, 2008/08/20 15:09:03
|
version 1.3, 2008/08/21 17:54:03
|
|
|
| |
void FileBasedStore::createClass( | void FileBasedStore::createClass( |
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMClass& newClass) |
const CIMClass& newClass, |
|
const Array<ClassAssociation>& classAssocEntries) |
{ | { |
PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::createClass"); | PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::createClass"); |
| |
|
|
_streamer->encode(classXml, newClass); | _streamer->encode(classXml, newClass); |
_SaveObject(classFilePath, classXml, _streamer); | _SaveObject(classFilePath, classXml, _streamer); |
| |
|
if (classAssocEntries.size()) |
|
{ |
|
_addClassAssociationEntries(nameSpace, classAssocEntries); |
|
} |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
void FileBasedStore::modifyClass( | void FileBasedStore::modifyClass( |
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMClass& modifiedClass) |
const CIMClass& modifiedClass, |
|
Boolean isAssociation, |
|
const Array<ClassAssociation>& classAssocEntries) |
{ | { |
PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::modifyClass"); | PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::modifyClass"); |
| |
|
|
_streamer->encode(classXml, modifiedClass); | _streamer->encode(classXml, modifiedClass); |
_SaveObject(classFilePath, classXml, _streamer); | _SaveObject(classFilePath, classXml, _streamer); |
| |
|
// |
|
// Update the association entries |
|
// |
|
|
|
if (isAssociation) |
|
{ |
|
_removeClassAssociationEntries(nameSpace, modifiedClass.getClassName()); |
|
if (classAssocEntries.size()) |
|
{ |
|
_addClassAssociationEntries(nameSpace, classAssocEntries); |
|
} |
|
} |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
void FileBasedStore::deleteClass( | void FileBasedStore::deleteClass( |
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMName& className, | const CIMName& className, |
const CIMName& superClassName) |
const CIMName& superClassName, |
|
Boolean isAssociation, |
|
const Array<CIMNamespaceName>& dependentNameSpaceNames) |
{ | { |
PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::deleteClass"); | PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::deleteClass"); |
| |
|
// |
|
// Clean up the instance files in this namespace and in all dependent |
|
// namespaces. (It was already checked that no instances exist.) |
|
// |
|
|
|
for (Uint32 i = 0; i < dependentNameSpaceNames.size(); i++) |
|
{ |
|
String indexFilePath = |
|
_getInstanceIndexFilePath(nameSpace, className); |
|
String dataFilePath = |
|
_getInstanceDataFilePath(nameSpace, className); |
|
|
|
FileSystem::removeFileNoCase(indexFilePath); |
|
FileSystem::removeFileNoCase(dataFilePath); |
|
} |
|
|
// Remove class file | // Remove class file |
| |
String classFilePath = | String classFilePath = |
|
|
throw CannotRemoveFile(classFilePath); | throw CannotRemoveFile(classFilePath); |
} | } |
| |
|
// |
|
// Remove association entries |
|
// |
|
|
|
if (isAssociation) |
|
{ |
|
_removeClassAssociationEntries(nameSpace, className); |
|
} |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
|
|
void FileBasedStore::createInstance( | void FileBasedStore::createInstance( |
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMObjectPath& instanceName, | const CIMObjectPath& instanceName, |
const CIMInstance& cimInstance) |
const CIMInstance& cimInstance, |
|
const Array<InstanceAssociation>& instAssocEntries) |
{ | { |
PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::createInstance"); | PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::createInstance"); |
| |
|
|
| |
transaction.complete(); | transaction.complete(); |
| |
|
// |
|
// Create association entries if an association instance. |
|
// |
|
|
|
if (instAssocEntries.size()) |
|
{ |
|
_addInstanceAssociationEntries(nameSpace, instAssocEntries); |
|
} |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
|
|
| |
transaction.complete(); | transaction.complete(); |
| |
PEG_METHOD_EXIT(); |
// |
} |
// Delete from association table (if an association). |
|
// |
void FileBasedStore::deleteAllInstances( |
|
const CIMNamespaceName& nameSpace, |
|
const CIMName& className) |
|
{ |
|
PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::deleteAllInstances"); |
|
|
|
String indexFilePath = |
|
_getInstanceIndexFilePath(nameSpace, className); |
|
String dataFilePath = |
|
_getInstanceDataFilePath(nameSpace, className); |
|
| |
FileSystem::removeFileNoCase(indexFilePath); |
_removeInstanceAssociationEntries(nameSpace, instanceName); |
FileSystem::removeFileNoCase(dataFilePath); |
|
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
|
|
return false; | return false; |
} | } |
| |
void FileBasedStore::addClassAssociations( |
void FileBasedStore::_addClassAssociationEntries( |
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const Array<ClassAssociation>& classAssocEntries) | const Array<ClassAssociation>& classAssocEntries) |
{ | { |
PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::addClassAssociations"); |
PEG_METHOD_ENTER(TRC_REPOSITORY, |
|
"FileBasedStore::_addClassAssociationEntries"); |
| |
String assocFileName = _getAssocClassPath(nameSpace); | String assocFileName = _getAssocClassPath(nameSpace); |
PEGASUS_STD(ofstream) os; | PEGASUS_STD(ofstream) os; |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
Boolean FileBasedStore::removeClassAssociation( |
void FileBasedStore::_removeClassAssociationEntries( |
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMName& assocClassName) | const CIMName& assocClassName) |
{ | { |
PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::removeClassAssociation"); |
PEG_METHOD_ENTER(TRC_REPOSITORY, |
|
"FileBasedStore::_removeClassAssociationEntries"); |
| |
String assocFileName = _getAssocClassPath(nameSpace); | String assocFileName = _getAssocClassPath(nameSpace); |
|
|
Boolean returnStatus = |
|
AssocClassTable::deleteAssociation(assocFileName, assocClassName); | AssocClassTable::deleteAssociation(assocFileName, assocClassName); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return returnStatus; |
|
} | } |
| |
void FileBasedStore::getClassAssociatorNames( | void FileBasedStore::getClassAssociatorNames( |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
void FileBasedStore::addInstanceAssociations( |
void FileBasedStore::_addInstanceAssociationEntries( |
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const Array<InstanceAssociation>& instanceAssocEntries) | const Array<InstanceAssociation>& instanceAssocEntries) |
{ | { |
PEG_METHOD_ENTER(TRC_REPOSITORY, "FileBasedStore::addInstanceAssociations"); |
PEG_METHOD_ENTER(TRC_REPOSITORY, |
|
"FileBasedStore::_addInstanceAssociationEntries"); |
| |
String assocFileName = _getAssocInstPath(nameSpace); | String assocFileName = _getAssocInstPath(nameSpace); |
PEGASUS_STD(ofstream) os; | PEGASUS_STD(ofstream) os; |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
void FileBasedStore::removeInstanceAssociation( |
void FileBasedStore::_removeInstanceAssociationEntries( |
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMObjectPath& assocInstanceName) | const CIMObjectPath& assocInstanceName) |
{ | { |
PEG_METHOD_ENTER(TRC_REPOSITORY, | PEG_METHOD_ENTER(TRC_REPOSITORY, |
"FileBasedStore::removeInstanceAssociation"); |
"FileBasedStore::_removeInstanceAssociationEntries"); |
| |
String assocFileName = _getAssocInstPath(nameSpace); | String assocFileName = _getAssocInstPath(nameSpace); |
AssocInstTable::deleteAssociation(assocFileName, assocInstanceName); | AssocInstTable::deleteAssociation(assocFileName, assocInstanceName); |