summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java')
-rw-r--r--src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java41
1 files changed, 22 insertions, 19 deletions
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<listDN.length-1)
{
@@ -308,11 +311,11 @@ public class LDAPLookup implements Lookup
Logger.msg(8,"Initializing LDAP Boot tree");
//create org
- LDAPLookupUtils.createOrganizationContext(getConnection(), Path.mGlobalPath);
+ LDAPLookupUtils.createOrganizationContext(getConnection(), mGlobalPath);
//create root
- LDAPLookupUtils.createCristalContext(getConnection(), Path.mRootPath);
+ LDAPLookupUtils.createCristalContext(getConnection(), mRootPath);
//create local
- LDAPLookupUtils.createCristalContext(getConnection(), Path.mLocalPath);
+ LDAPLookupUtils.createCristalContext(getConnection(), mLocalPath);
}
@Override
@@ -329,8 +332,8 @@ public class LDAPLookup implements Lookup
while (strTokenizer.hasMoreTokens())
{
String line = strTokenizer.nextToken();
- Logger.msg(8,"Checking " + line+Path.mLocalPath);
- LDAPLookupUtils.createCristalContext(getConnection(), line+Path.mLocalPath);
+ Logger.msg(8,"Checking " + line+mLocalPath);
+ LDAPLookupUtils.createCristalContext(getConnection(), line+mLocalPath);
}
}
@@ -405,7 +408,7 @@ public class LDAPLookup implements Lookup
public Class<?> 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);