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, 33 insertions, 38 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 7574bf1b..0fa2f019 100644 --- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapConnModule.java +++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapConnModule.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.ldap; - import netscape.ldap.LDAPConnection; import com.netscape.certsrv.apps.CMS; @@ -34,7 +33,6 @@ 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; @@ -42,7 +40,7 @@ public class LdapConnModule implements ILdapConnModule { private boolean mInited = false; /** - * instantiate connection factory. + * instantiate connection factory. */ public static final String PROP_LDAP = "ldap"; @@ -57,44 +55,43 @@ 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; @@ -102,15 +99,14 @@ 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 */ @@ -127,9 +123,8 @@ 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); } - -} +} |