use of com.iplanet.am.sdk.common.CacheBlock in project OpenAM by OpenRock.
the class CachedRemoteServicesImpl method renameEntry.
/**
* Renames an entry. Currently used for only user renaming.
*
* @param token
* the sso token
* @param objectType
* the type of entry
* @param entryDN
* the entry DN
* @param newName
* the new name (i.e., if RDN is cn=John, the value passed should
* be "John"
* @param deleteOldName
* if true the old name is deleted otherwise it is retained.
* @return new <code>DN</code> of the renamed entry
* @throws AMException
* if the operation was not successful
*/
public String renameEntry(SSOToken token, int objectType, String entryDN, String newName, boolean deleteOldName) throws AMException {
String newDN = super.renameEntry(token, objectType, entryDN, newName, deleteOldName);
// Just rename the dn in the cache. Don't remove the entry. So when the
// event notification happens, it won't find the entry as it is already
// renamed. Chances are this cache rename operation may happen before
// the notification thread trys clean up.
// NOTE: We should have the code to remove the entry for rename
// operation as the operation could have been performed by some other
// process such as amadmin.
String oldDN = LDAPUtils.formatToRFC(entryDN);
CacheBlock cb = (CacheBlock) sdkCache.remove(oldDN);
newDN = LDAPUtils.formatToRFC(newDN);
sdkCache.put(newDN, cb);
return newDN;
}
use of com.iplanet.am.sdk.common.CacheBlock in project OpenAM by OpenRock.
the class CachedRemoteServicesImpl method updateCache.
/**
* Method that updates the cache entries locally. This method does a write
* through cache
*/
private void updateCache(SSOToken token, String dn, Map stringAttributes, Map byteAttributes) throws SSOException {
String key = LDAPUtils.formatToRFC(dn);
CacheBlock cb = (CacheBlock) sdkCache.get(key);
if (cb != null && !cb.hasExpiredAndUpdated() && cb.isExists()) {
String pDN = MiscUtils.getPrincipalDN(token);
cb.replaceAttributes(pDN, stringAttributes, byteAttributes);
}
}
Aggregations