From c6204281c819ea4514952ed7623e282babcb5f8c Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 27 Feb 2013 21:36:23 +0100 Subject: More --- .../java/com/c2kernel/lookup/ldap/LDAPLookup.java | 41 ++++++++++++---------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java') diff --git a/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java b/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java index 3ca1749..d52371c 100644 --- a/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java +++ b/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java @@ -53,6 +53,9 @@ public class LDAPLookup implements Lookup private LDAPPropertyManager mPropManager; private final LDAPRoleManager mRoleManager; + protected static String mGlobalPath; //cern.ch + protected static String mRootPath; //cristal2 + protected static String mLocalPath; //lab27 /** @@ -69,14 +72,14 @@ public class LDAPLookup implements Lookup mLDAPConn = createConnection(mLDAPProps); - Path.mGlobalPath=props.mGlobalPath; - Path.mRootPath=props.mRootPath; - Path.mLocalPath=props.mLocalPath; + mGlobalPath=props.mGlobalPath; + mRootPath=props.mRootPath; + mLocalPath=props.mLocalPath; - EntityPath.mTypeRoot = "cn=entity,"+props.mLocalPath; - DomainPath.mTypeRoot = "cn=domain,"+props.mLocalPath; + EntityPath.setTypeRoot("cn=entity,"+props.mLocalPath); + DomainPath.setTypeRoot("cn=domain,"+props.mLocalPath); - mNextKeyManager = new NextKeyManager(this, "cn=last,"+EntityPath.mTypeRoot); + mNextKeyManager = new NextKeyManager(this, "cn=last,"+EntityPath.getTypeRoot()); Logger.msg(7, "LDAP.useOldProps="+Gateway.getProperty("LDAP.useOldProps", "false")); if (Gateway.getProperty("LDAP.useOldProps", "false").equals("true")) { Logger.debug(1, "Using Kernel 2.1 LDAP Property Format"); @@ -86,7 +89,7 @@ public class LDAPLookup implements Lookup Logger.debug(1, "Using Kernel 2.2 LDAP Property Format"); mPropManager = new LDAPPropertyManager(this); } - mRoleManager = new LDAPRoleManager(this, "cn=agent,"+DomainPath.mTypeRoot, EntityPath.mTypeRoot); + mRoleManager = new LDAPRoleManager(this, "cn=agent,"+DomainPath.getTypeRoot(), EntityPath.getTypeRoot()); } @@ -159,7 +162,7 @@ public class LDAPLookup implements Lookup * Disconnects the connection with the LDAP server during shutdown */ @Override - public void disconnect() { + public void close() { Logger.msg(1, "LDAP Lookup: Shutting down LDAP connection."); if (mLDAPConn != null) { try { @@ -265,7 +268,7 @@ public class LDAPLookup implements Lookup public void delete(Path path) throws ObjectCannotBeUpdated { try { - LDAPLookupUtils.delete(getConnection(),path.getDN()+Path.mLocalPath); + LDAPLookupUtils.delete(getConnection(),path.getDN()+mLocalPath); } catch (LDAPException ex) { throw new ObjectCannotBeUpdated(ex.getLDAPErrorMessage(), ""); } @@ -281,7 +284,7 @@ public class LDAPLookup implements Lookup if (!LDAPLookupUtils.exists(getConnection(),dn)) { String listDN[] = path.getPath(); - String name = "cn="+ path.getRoot() + "," + Path.mLocalPath; + String name = "cn="+ path.getRoot() + "," + mLocalPath; int i=0; while (i getEntityClass(Path path) throws ObjectNotFoundException { String[] attr = { LDAPConnection.ALL_USER_ATTRS }; try { - LDAPEntry anEntry=getConnection().read(path.getDN()+Path.mLocalPath,attr); + LDAPEntry anEntry=getConnection().read(path.getDN()+mLocalPath,attr); String type = LDAPLookupUtils.getFirstAttributeValue(anEntry, "objectClass"); if (type.equals("cristalentity")) return TraceableEntity.class; @@ -460,16 +463,16 @@ public class LDAPLookup implements Lookup LDAPLookupUtils.getFirstAttributeValue(entry, "jobList").equals("TRUE")); } else if (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","aliasObject") || - (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(DomainPath.mTypeRoot))) + (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(DomainPath.getTypeRoot()))) { DomainPath domainPath = new DomainPath(); domainPath.setDN(dn); thisPath = domainPath; } else if (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalentity") || - (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(EntityPath.mTypeRoot))) + (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalcontext") && dn.endsWith(EntityPath.getTypeRoot()))) { - if(dn.endsWith(EntityPath.mTypeRoot)) { + if(dn.endsWith(EntityPath.getTypeRoot())) { EntityPath entityPath; if (entityKey != -1) entityPath = new EntityPath(entityKey); -- cgit v1.2.3