diff options
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/ldap/LdapConnModule.java')
-rw-r--r-- | pki/base/common/src/com/netscape/cmscore/ldap/LdapConnModule.java | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/LdapConnModule.java b/pki/base/common/src/com/netscape/cmscore/ldap/LdapConnModule.java index 0fa2f0192..7574bf1b3 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapConnModule.java +++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapConnModule.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.ldap; + import netscape.ldap.LDAPConnection; import com.netscape.certsrv.apps.CMS; @@ -33,6 +34,7 @@ import com.netscape.cmscore.ldapconn.LdapAuthInfo; import com.netscape.cmscore.ldapconn.LdapBoundConnFactory; import com.netscape.cmscore.ldapconn.LdapConnInfo; + public class LdapConnModule implements ILdapConnModule { protected IConfigStore mConfig = null; protected LdapBoundConnFactory mLdapConnFactory = null; @@ -40,7 +42,7 @@ public class LdapConnModule implements ILdapConnModule { private boolean mInited = false; /** - * instantiate connection factory. + * instantiate connection factory. */ public static final String PROP_LDAP = "ldap"; @@ -55,43 +57,44 @@ public class LdapConnModule implements ILdapConnModule { protected ISubsystem mPubProcessor; - public void init(ISubsystem p, IConfigStore config) throws EBaseException { + public void init(ISubsystem p, + IConfigStore config) + throws EBaseException { CMS.debug("LdapConnModule: init called"); if (mInited) { CMS.debug("LdapConnModule: already initialized. return."); - return; + return; } CMS.debug("LdapConnModule: init begins"); mPubProcessor = p; mConfig = config; /* - * mLdapConnFactory = new LdapBoundConnFactory(); - * mLdapConnFactory.init(mConfig.getSubStore("ldap")); - */ + mLdapConnFactory = new LdapBoundConnFactory(); + mLdapConnFactory.init(mConfig.getSubStore("ldap")); + */ // support publishing dirsrv with different pwd than internaldb IConfigStore ldap = mConfig.getSubStore("ldap"); - IConfigStore ldapconn = ldap - .getSubStore(ILdapBoundConnFactory.PROP_LDAPCONNINFO); - IConfigStore authinfo = ldap - .getSubStore(ILdapBoundConnFactory.PROP_LDAPAUTHINFO); - ILdapConnInfo connInfo = CMS.getLdapConnInfo(ldapconn); - LdapAuthInfo authInfo = new LdapAuthInfo(authinfo, - ldapconn.getString("host"), ldapconn.getInteger("port"), - connInfo.getSecure()); - - int minConns = mConfig.getInteger(ILdapBoundConnFactory.PROP_MINCONNS, - 3); - int maxConns = mConfig.getInteger(ILdapBoundConnFactory.PROP_MAXCONNS, - 15); + IConfigStore ldapconn = ldap.getSubStore( + ILdapBoundConnFactory.PROP_LDAPCONNINFO); + IConfigStore authinfo = ldap.getSubStore( + ILdapBoundConnFactory.PROP_LDAPAUTHINFO); + ILdapConnInfo connInfo = + CMS.getLdapConnInfo(ldapconn); + LdapAuthInfo authInfo = + new LdapAuthInfo(authinfo, ldapconn.getString("host"), + ldapconn.getInteger("port"), connInfo.getSecure()); + + int minConns = mConfig.getInteger(ILdapBoundConnFactory.PROP_MINCONNS, 3); + int maxConns = mConfig.getInteger(ILdapBoundConnFactory.PROP_MAXCONNS, 15); // must get authInfo from the config, don't default to internaldb!!! - CMS.debug("Creating LdapBoundConnFactory for LdapConnModule."); - mLdapConnFactory = new LdapBoundConnFactory(minConns, maxConns, - (LdapConnInfo) connInfo, authInfo); + CMS.debug("Creating LdapBoundConnFactory for LdapConnModule."); + mLdapConnFactory = + new LdapBoundConnFactory(minConns, maxConns, (LdapConnInfo)connInfo, authInfo); mInited = true; @@ -99,14 +102,15 @@ public class LdapConnModule implements ILdapConnModule { } /** - * Returns the internal ldap connection factory. This can be useful to get a - * ldap connection to the ldap publishing directory without having to get it - * again from the config file. Note that this means sharing a ldap - * connection pool with the ldap publishing module so be sure to return - * connections to pool. Use ILdapConnFactory.getConn() to get a Ldap - * connection to the ldap publishing directory. Use - * ILdapConnFactory.returnConn() to return the connection. - * + * Returns the internal ldap connection factory. + * This can be useful to get a ldap connection to the + * ldap publishing directory without having to get it again from the + * config file. Note that this means sharing a ldap connection pool + * with the ldap publishing module so be sure to return connections to pool. + * Use ILdapConnFactory.getConn() to get a Ldap connection to the ldap + * publishing directory. + * Use ILdapConnFactory.returnConn() to return the connection. + * * @see com.netscape.certsrv.ldap.ILdapBoundConnFactory * @see com.netscape.certsrv.ldap.ILdapConnFactory */ @@ -123,8 +127,9 @@ public class LdapConnModule implements ILdapConnModule { } public void log(int level, String msg) { - mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_LDAP, level, - "LdapPublishModule: " + msg); + mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_LDAP, level, + "LdapPublishModule: " + msg); } - + } + |