version 1.1.2.8, 2007/11/08 23:29:55
|
version 1.1.2.9, 2007/11/13 22:02:13
|
|
|
| |
static void (*_saveCallback)(const Buffer& buffer, void* data); | static void (*_saveCallback)(const Buffer& buffer, void* data); |
static void* _saveData; | static void* _saveData; |
|
|
static void (*_loadCallback)(Buffer& buffer, void* data); | static void (*_loadCallback)(Buffer& buffer, void* data); |
static void* _loadData; | static void* _loadData; |
| |
|
static void (*_initializeCallback)(MemoryResidentRepository* rep, void* data); |
|
static void* _initializeData; |
|
|
MemoryResidentRepository::MemoryResidentRepository() | MemoryResidentRepository::MemoryResidentRepository() |
{ | { |
// Load users data if any: | // Load users data if any: |
_processLoadHandler(); |
_processLoadCallback(); |
|
|
|
// Call initialize callback if any. |
|
|
|
if (_initializeCallback) |
|
(*_initializeCallback)(this, _initializeData); |
} | } |
| |
MemoryResidentRepository::~MemoryResidentRepository() | MemoryResidentRepository::~MemoryResidentRepository() |
|
|
Throw((CIM_ERR_NOT_FOUND, "%s", *Str(instanceName))); | Throw((CIM_ERR_NOT_FOUND, "%s", *Str(instanceName))); |
| |
_rep.remove(pos); | _rep.remove(pos); |
_processSaveHandler(); |
_processSaveCallback(); |
} | } |
| |
void MemoryResidentRepository::createClass( | void MemoryResidentRepository::createClass( |
|
|
// Add instance to array: | // Add instance to array: |
| |
_rep.append(NamespaceInstancePair(nameSpace, ci)); | _rep.append(NamespaceInstancePair(nameSpace, ci)); |
_processSaveHandler(); |
_processSaveCallback(); |
| |
return cop; | return cop; |
} | } |
|
|
// Replace original instance. | // Replace original instance. |
| |
_rep[pos].second = resultInstance; | _rep[pos].second = resultInstance; |
_processSaveHandler(); |
_processSaveCallback(); |
} | } |
| |
Array<CIMClass> MemoryResidentRepository::enumerateClasses( | Array<CIMClass> MemoryResidentRepository::enumerateClasses( |
|
|
const CIMObjectPath& instanceName, | const CIMObjectPath& instanceName, |
const CIMName& propertyName) | const CIMName& propertyName) |
{ | { |
Throw((CIM_ERR_NOT_SUPPORTED, "getProperty()")); |
CIMInstance ci = getInstance( |
return CIMValue(); |
false, nameSpace, instanceName, false, true, true, CIMPropertyList()); |
|
|
|
Uint32 pos = ci.findProperty(propertyName); |
|
|
|
if (pos == PEG_NOT_FOUND) |
|
{ |
|
Throw((CIM_ERR_NO_SUCH_PROPERTY, "%s", *Str(propertyName))); |
|
} |
|
|
|
return ci.getProperty(pos).getValue(); |
} | } |
| |
void MemoryResidentRepository::setProperty( | void MemoryResidentRepository::setProperty( |
|
|
const CIMValue& newValue, | const CIMValue& newValue, |
const ContentLanguageList& contentLangs) | const ContentLanguageList& contentLangs) |
{ | { |
Throw((CIM_ERR_NOT_SUPPORTED, "setProperty()")); |
CIMInstance ci(instanceName.getClassName()); |
|
ci.addProperty(CIMProperty(propertyName, newValue)); |
|
ci.setPath(instanceName); |
|
|
|
Array<CIMName> tmp; |
|
tmp.append(propertyName); |
|
CIMPropertyList properties(tmp); |
|
|
|
modifyInstance( |
|
true, nameSpace, ci, false, properties, ContentLanguageList()); |
} | } |
| |
CIMQualifierDecl MemoryResidentRepository::getQualifier( | CIMQualifierDecl MemoryResidentRepository::getQualifier( |
|
|
} | } |
| |
void MemoryResidentRepository::installSaveCallback( | void MemoryResidentRepository::installSaveCallback( |
void (*handler)(const Buffer& buffer, void* data), |
void (*callback)(const Buffer& buffer, void* data), |
void * data) | void * data) |
{ | { |
_saveCallback = handler; |
_saveCallback = callback; |
_saveData = data; | _saveData = data; |
} | } |
| |
void MemoryResidentRepository::installLoadCallback( | void MemoryResidentRepository::installLoadCallback( |
void (*handler)(Buffer& buffer, void* data), |
void (*callback)(Buffer& buffer, void* data), |
void * data) | void * data) |
{ | { |
_loadCallback = handler; |
_loadCallback = callback; |
_loadData = data; | _loadData = data; |
} | } |
| |
void MemoryResidentRepository::_processSaveHandler() |
void MemoryResidentRepository::_processSaveCallback() |
{ | { |
if (!_saveCallback) | if (!_saveCallback) |
return; | return; |
|
|
(*_saveCallback)(out, _saveData); | (*_saveCallback)(out, _saveData); |
} | } |
| |
void MemoryResidentRepository::_processLoadHandler() |
void MemoryResidentRepository::_processLoadCallback() |
{ | { |
if (!_loadCallback) | if (!_loadCallback) |
return; | return; |
|
|
return true; | return true; |
} | } |
| |
|
void MemoryResidentRepository::installInitializeCallback( |
|
void (*callback)(MemoryResidentRepository* repository, void * data), |
|
void *data) |
|
{ |
|
_initializeCallback = callback; |
|
_initializeData = data; |
|
} |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |