version 1.3, 2006/05/31 19:59:46
|
version 1.4, 2006/11/14 18:34:57
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Robert Kieninger (kieningr@de.ibm.com) |
|
// |
|
// Modified By: |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
|
Array<AssocClassCache*> AssocClassCache::_assocClassCacheList; | Array<AssocClassCache*> AssocClassCache::_assocClassCacheList; |
| |
| |
/** Retrieves a singleton instance of the class cache for the |
/** |
* given namespace. |
Retrieves a singleton instance of the class cache for the given namespace. |
*/ | */ |
AssocClassCache* AssocClassCache::getAssocClassCache(const String& nameSpace) | AssocClassCache* AssocClassCache::getAssocClassCache(const String& nameSpace) |
{ | { |
|
|
delete(_assocClassCacheList[idx-1]); | delete(_assocClassCacheList[idx-1]); |
_assocClassCacheList.remove(idx-1); | _assocClassCacheList.remove(idx-1); |
} | } |
|
|
} | } |
| |
/** Retrieve the list of entries for a from class through direct | /** Retrieve the list of entries for a from class through direct |
* access via the from class name. |
access via the from class name. |
*/ | */ |
Boolean AssocClassCache::getAssocClassEntry(const String& fromClassName, |
Boolean AssocClassCache::getAssocClassEntry( |
|
const String& fromClassName, |
Array< Array<String> >& entryList) | Array< Array<String> >& entryList) |
{ | { |
return _assocClassCache->lookup(fromClassName,entryList); | return _assocClassCache->lookup(fromClassName,entryList); |
} | } |
| |
/** Add a new record to the association cache. | /** Add a new record to the association cache. |
* If an entry for the given from class name already exists, |
If an entry for the given from class name already exists, |
* the new entry is appended to the old entry. Otherwise a new entry |
the new entry is appended to the old entry. Otherwise a new entry |
* is added to the cache. |
is added to the cache. |
*/ | */ |
Boolean AssocClassCache::addRecord(const String& fromClassName, |
Boolean AssocClassCache::addRecord( |
|
const String& fromClassName, |
Array<String> assocClassRecord) | Array<String> assocClassRecord) |
{ | { |
Array< Array<String> > oldAssocClassEntryList; | Array< Array<String> > oldAssocClassEntryList; |
|
|
} | } |
| |
/** Remove an entry from the association cache specified by the given | /** Remove an entry from the association cache specified by the given |
* from class name. |
from class name. |
*/ | */ |
Boolean AssocClassCache::removeEntry(const String& fromClassName) | Boolean AssocClassCache::removeEntry(const String& fromClassName) |
{ | { |
return _assocClassCache->remove(fromClassName); | return _assocClassCache->remove(fromClassName); |
} | } |
| |
/** Remove an association record from the association cache specified by the given |
/** Remove an association record from the association cache specified by the |
* from class name and association name. |
given from class name and association name. |
*/ | */ |
Boolean AssocClassCache::removeRecord(const String& fromClassName, |
Boolean AssocClassCache::removeRecord( |
|
const String& fromClassName, |
const String& assocClassName) | const String& assocClassName) |
{ | { |
Array< Array<String> > oldAssocClassEntryList; | Array< Array<String> > oldAssocClassEntryList; |
|
|
// The first entry in each record is the association class | // The first entry in each record is the association class |
// name. Find the record for the association class and remove | // name. Find the record for the association class and remove |
// it from the cache entry. | // it from the cache entry. |
if (String::equalNoCase(oldAssocClassEntryList[idx][ASSOC_CLASS_NAME_INDEX], |
if (String::equalNoCase( |
|
oldAssocClassEntryList[idx][ASSOC_CLASS_NAME_INDEX], |
assocClassName)) | assocClassName)) |
{ | { |
_assocClassCache->remove(fromClassName); | _assocClassCache->remove(fromClassName); |
if (oldAssocClassEntryList.size() > 1) | if (oldAssocClassEntryList.size() > 1) |
{ | { |
oldAssocClassEntryList.remove(idx); | oldAssocClassEntryList.remove(idx); |
_assocClassCache->insert(fromClassName,oldAssocClassEntryList); |
_assocClassCache->insert( |
|
fromClassName, oldAssocClassEntryList); |
} | } |
return true; | return true; |
} | } |