| | |
| | | fail("addEntries Exception:"+ e.getMessage() + " " + stackTraceToSingleLineString(e)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Get the entryUUID for a given DN. |
| | | * |
| | | * @throws Exception if the entry does not exist or does not have |
| | | * an entryUUID. |
| | | */ |
| | | protected String getEntryUUID(DN dn) throws Exception |
| | | { |
| | | Entry newEntry; |
| | | int count = 10; |
| | | if (count<1) |
| | | count=1; |
| | | String found = null; |
| | | while ((count> 0) && (found == null)) |
| | | { |
| | | Thread.sleep(100); |
| | | |
| | | Lock lock = null; |
| | | for (int i=0; i < 3; i++) |
| | | { |
| | | lock = LockManager.lockRead(dn); |
| | | if (lock != null) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (lock == null) |
| | | { |
| | | throw new Exception("could not lock entry " + dn); |
| | | } |
| | | |
| | | try |
| | | { |
| | | newEntry = DirectoryServer.getEntry(dn); |
| | | |
| | | if (newEntry != null) |
| | | { |
| | | List<Attribute> tmpAttrList = newEntry.getAttribute("entryuuid"); |
| | | Attribute tmpAttr = tmpAttrList.get(0); |
| | | |
| | | for (AttributeValue val : tmpAttr) |
| | | { |
| | | found = val.getValue().toString(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | LockManager.unlock(dn, lock); |
| | | } |
| | | count --; |
| | | } |
| | | if (found == null) |
| | | throw new Exception("Entry: " + dn + " Could not be found."); |
| | | return found; |
| | | } |
| | | } |