use of org.gluu.oxtrust.ldap.cache.model.GluuInumMap in project oxTrust by GluuFederation.
the class CacheRefreshTimer method removeTargetEntries.
private Pair<List<String>, List<String>> removeTargetEntries(LdapServerConnection inumDbServerConnection, PersistenceEntryManager targetPersistenceEntryManager, List<GluuSimplePerson> removedPersons, HashMap<String, GluuInumMap> inumInumMap) {
Date runDate = new Date(this.lastFinishedTime);
PersistenceEntryManager inumDbPersistenceEntryManager = inumDbServerConnection.getPersistenceEntryManager();
List<String> result1 = new ArrayList<String>();
List<String> result2 = new ArrayList<String>();
for (GluuSimplePerson removedPerson : removedPersons) {
String inum = removedPerson.getAttribute(OxTrustConstants.inum);
// Update GluuInumMap if it exist
GluuInumMap currentInumMap = inumInumMap.get(inum);
if (currentInumMap == null) {
log.warn("Can't find inum entry of person with DN: {}", removedPerson.getDn());
} else {
GluuInumMap removedInumMap = getMarkInumMapEntryAsRemoved(currentInumMap, ldapEntryManager.encodeTime(removedPerson.getDn(), runDate));
try {
inumDbPersistenceEntryManager.merge(removedInumMap);
result2.add(removedInumMap.getInum());
} catch (BasePersistenceException ex) {
log.error("Failed to update entry with inum '{}' and DN: {}", currentInumMap.getInum(), currentInumMap.getDn(), ex);
continue;
}
}
// Remove person from target server
try {
targetPersistenceEntryManager.removeRecursively(removedPerson.getDn());
result1.add(inum);
} catch (BasePersistenceException ex) {
log.error("Failed to remove person entry with inum '{}' and DN: {}", inum, removedPerson.getDn(), ex);
continue;
}
log.debug("Person with DN: '{}' removed from target server", removedPerson.getDn());
}
return new Pair<List<String>, List<String>>(result1, result2);
}
use of org.gluu.oxtrust.ldap.cache.model.GluuInumMap in project oxTrust by GluuFederation.
the class CacheRefreshService method generateInumForNewInumMap.
public String generateInumForNewInumMap(String inumbBaseDn, LdapEntryManager ldapEntryManager) {
String newInum = generateInumForNewInumMapImpl();
String newDn = getDnForInum(inumbBaseDn, newInum);
GluuInumMap inumMap = new GluuInumMap();
inumMap.setDn(newDn);
while (containsInumMap(ldapEntryManager, inumMap)) {
newInum = generateInumForNewInumMapImpl();
newDn = getDnForInum(inumbBaseDn, newInum);
inumMap.setDn(newDn);
}
return newInum;
}
use of org.gluu.oxtrust.ldap.cache.model.GluuInumMap in project oxTrust by GluuFederation.
the class CacheRefreshTimer method addGluuInumMap.
private GluuInumMap addGluuInumMap(String inumbBaseDn, PersistenceEntryManager inumDbPersistenceEntryManager, String[] primaryKeyAttrName, String[][] primaryKeyValues) {
String inum = cacheRefreshService.generateInumForNewInumMap(inumbBaseDn, inumDbPersistenceEntryManager);
String inumDn = cacheRefreshService.getDnForInum(inumbBaseDn, inum);
GluuInumMap inumMap = new GluuInumMap();
inumMap.setDn(inumDn);
inumMap.setInum(inum);
inumMap.setPrimaryKeyAttrName(primaryKeyAttrName[0]);
inumMap.setPrimaryKeyValues(primaryKeyValues[0]);
if (primaryKeyAttrName.length > 1) {
inumMap.setSecondaryKeyAttrName(primaryKeyAttrName[1]);
inumMap.setSecondaryKeyValues(primaryKeyValues[1]);
}
if (primaryKeyAttrName.length > 2) {
inumMap.setTertiaryKeyAttrName(primaryKeyAttrName[2]);
inumMap.setTertiaryKeyValues(primaryKeyValues[2]);
}
inumMap.setStatus(GluuStatus.ACTIVE);
cacheRefreshService.addInumMap(inumDbPersistenceEntryManager, inumMap);
return inumMap;
}
Aggregations