summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java b/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java
index 0d3cbd4..e5497f2 100644
--- a/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java
+++ b/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java
@@ -9,7 +9,6 @@ import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer;
-import java.util.UUID;
import org.omg.CORBA.Object;
@@ -33,7 +32,6 @@ import com.c2kernel.utils.Logger;
import com.novell.ldap.LDAPAttribute;
import com.novell.ldap.LDAPAttributeSet;
import com.novell.ldap.LDAPConnection;
-import com.novell.ldap.LDAPDN;
import com.novell.ldap.LDAPEntry;
import com.novell.ldap.LDAPException;
import com.novell.ldap.LDAPSearchConstraints;
@@ -178,16 +176,11 @@ public class LDAPLookup implements LookupManager{
+ entityKey);
String objClass = LDAPLookupUtils.getFirstAttributeValue(domEntry,
"objectClass");
- try {
- ItemPath referencedPath = new ItemPath(UUID.fromString(entityKey));
- if (objClass.equals("cristalagent"))
- return new AgentPath(referencedPath);
-
- return referencedPath;
- } catch (IllegalArgumentException ex) {
- throw new InvalidItemPathException(entityKey);
- }
+ ItemPath referencedPath = ItemPath.fromUUIDString(entityKey);
+ if (objClass.equals("cristalagent"))
+ return new AgentPath(referencedPath);
+ return referencedPath;
}
@@ -371,7 +364,7 @@ public class LDAPLookup implements LookupManager{
}
@Override
- public ItemPath getItemPath(UUID uuid) throws ObjectNotFoundException, InvalidItemPathException {
+ public ItemPath getItemPath(String uuid) throws ObjectNotFoundException, InvalidItemPathException {
String[] attr = { LDAPConnection.ALL_USER_ATTRS };
try {
ItemPath item = new ItemPath(uuid);
@@ -397,23 +390,23 @@ public class LDAPLookup implements LookupManager{
* 'ior' and 'uniquemember'
* @throws ObjectNotFoundException
* @throws ObjectNotFoundException
+ * @throws
*/
protected Path nodeToPath(LDAPEntry entry) throws InvalidItemPathException, ObjectNotFoundException
{
String dn = entry.getDN();
- UUID entityKey;
+ ItemPath entityKey;
org.omg.CORBA.Object ior;
// extract syskey
try {
- String entityKeyStr = LDAPLookupUtils.getFirstAttributeValue(entry,"cn");
- entityKey = UUID.fromString(entityKeyStr);
+ String entityKeyStr = LDAPLookupUtils.getFirstAttributeValue(entry, "cn");
+ entityKey = ItemPath.fromUUIDString(entityKeyStr);
} catch (ObjectNotFoundException ex) {
entityKey = null;
- } catch (IllegalArgumentException ex) {
+ } catch (InvalidItemPathException ex) {
entityKey = null;
}
-
// extract IOR
try {
@@ -428,7 +421,7 @@ public class LDAPLookup implements LookupManager{
if (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalagent"))
{ //cristalagent
String agentID = LDAPLookupUtils.getFirstAttributeValue(entry,"uid");
- thisPath = new AgentPath(new ItemPath(entityKey), agentID);
+ thisPath = new AgentPath(entityKey, agentID);
}
else if (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalrole"))
{ //cristalrole
@@ -446,15 +439,15 @@ public class LDAPLookup implements LookupManager{
(LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(mItemTypeRoot)))
{
if(dn.endsWith(mItemTypeRoot)) {
- ItemPath entityPath = new ItemPath(entityKey);
- thisPath = entityPath;
+ if (entityKey == null) throw new InvalidItemPathException(entry.getDN()+" was not a valid itemPath");
+ thisPath = entityKey;
}
else
- throw new ObjectNotFoundException("Entity found outside entity tree");
+ throw new ObjectNotFoundException("Entity found outside entity tree", "");
}
else
{
- throw new ObjectNotFoundException("Unrecognised LDAP entry. Not a cristal entry");
+ throw new ObjectNotFoundException("Unrecognised LDAP entry. Not a cristal entry", "");
}
//set IOR if we have one