You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2021/03/21 14:09:10 UTC
[directory-fortress-core] branch jmeter updated: FC-290 - Pool
connection validation switch,
properly handle defaults by catching conversion exceptions in Config (when
property is not set)
This is an automated email from the ASF dual-hosted git repository.
smckinney pushed a commit to branch jmeter
in repository https://gitbox.apache.org/repos/asf/directory-fortress-core.git
The following commit(s) were added to refs/heads/jmeter by this push:
new 359a5f4 FC-290 - Pool connection validation switch, properly handle defaults by catching conversion exceptions in Config (when property is not set)
359a5f4 is described below
commit 359a5f448a93aa740ae9ff5b4593a2187587d6c6
Author: Shawn McKinney <sm...@symas.com>
AuthorDate: Sun Mar 21 09:09:05 2021 -0500
FC-290 - Pool connection validation switch, properly handle defaults by catching conversion exceptions in Config (when property is not set)
---
README-PROPERTIES.md | 14 ++++++++++-
build-config.xml | 4 ++--
build.properties.example | 8 +++----
slapd.properties.example | 6 ++---
.../fortress/core/ldap/LdapConnectionProvider.java | 2 +-
.../directory/fortress/core/util/Config.java | 28 ++++++++++++++++------
6 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/README-PROPERTIES.md b/README-PROPERTIES.md
index 905d2ae..09a9c49 100644
--- a/README-PROPERTIES.md
+++ b/README-PROPERTIES.md
@@ -84,6 +84,18 @@ This section describes the properties needed to control fortress core.
# This is min/max settings for LDAP connections. For testing and low-volume instances this will work:
min.admin.conn=1
max.admin.conn=10
+
+ # This speicifes the number of user LDAP connections (used for user authentication operations only) to maintain in the pool:
+ # User Pool:
+ user.min.conn=1
+ user.max.conn=10
+
+ # Used for slapd logger connection pool (OpenLDAP with access log enabled only)
+ min.log.conn=1
+ max.log.conn=3
+
+ # Applies to all pools, connection validated on retrieval with dummy ldapsearch. (default is false)
+ all.validate.conn=false
```
5. Give coordinates to the Config node that contains all of the other Fortress properties. This will match your LDAP's server's config node per Fortress Core setup.
@@ -329,4 +341,4 @@ This section describes the properties needed to control fortress core.
```
____________________________________________________________________________________
- #### END OF README
\ No newline at end of file
+ #### END OF README
diff --git a/build-config.xml b/build-config.xml
index 2a9aca1..50e5913 100644
--- a/build-config.xml
+++ b/build-config.xml
@@ -309,7 +309,7 @@
<replace file="${dst.bootstrap.conf}" token="@LOG_MAX_CONN@" value="${log.max.conn}"/>
<replace file="${dst.bootstrap.conf}" token="@USR_MIN_CONN@" value="${user.min.conn}"/>
<replace file="${dst.bootstrap.conf}" token="@USR_MAX_CONN@" value="${user.max.conn}"/>
- <replace file="${dst.bootstrap.conf}" token="@VALIDATE_CONN@" value="${validate.conn}"/>
+ <replace file="${dst.bootstrap.conf}" token="@VALIDATE_CONN@" value="${all.validate.conn}"/>
<replace file="${dst.bootstrap.conf}" token="@CFG_CRYPTO_PROP@" value="${crypto.prop}"/>
<replace file="${dst.bootstrap.conf}" token="@SERVER_TYPE@" value="${ldap.server.type}"/>
<replace file="${dst.bootstrap.conf}" token="@ROLE_OCCUPANTS@" value="${role.occupants}"/>
@@ -347,7 +347,7 @@
<replace file="${dst.remote.conf}" token="@LOG_MIN_CONN@" value="${log.min.conn}"/>
<replace file="${dst.remote.conf}" token="@LOG_MAX_CONN@" value="${log.max.conn}"/>
<replace file="${dst.remote.conf}" token="@USR_MIN_CONN@" value="${user.min.conn}"/>
- <replace file="${dst.remote.conf}" token="@VALIDATE_CONN@" value="${validate.conn}"/>
+ <replace file="${dst.remote.conf}" token="@VALIDATE_CONN@" value="${all.validate.conn}"/>
<replace file="${dst.remote.conf}" token="@USR_MAX_CONN@" value="${user.max.conn}"/>
<replace file="${dst.remote.conf}" token="@CFG_CRYPTO_PROP@" value="${crypto.prop}"/>
<replace file="${dst.remote.conf}" token="@ENABLE_REST@" value="${enable.mgr.impl.rest}"/>
diff --git a/build.properties.example b/build.properties.example
index 89e0b26..f74f37e 100644
--- a/build.properties.example
+++ b/build.properties.example
@@ -82,7 +82,7 @@ cfg.root.pw=secret
# This is the default:
ldap.client.type=apache
-# A value of 'false' disables storing user membership on role object, default is 'true':
+# A value of 'false' disables storing user membership on role object, default is 'false':
#role.occupants=false
# These are used to construct suffix for DIT, i.e. dc=example,dc=com.
@@ -115,12 +115,12 @@ admin.max.conn=10
user.min.conn=1
user.max.conn=10
-# Used for slapd logger connection pool. Leave zeros when using apacheds:
+# Used for slapd logger connection pool.
min.log.conn=1
max.log.conn=3
-# Applies to all pools, connection validated on retrieval with dummy ldapsearch. (default is true)
-validate.conn=true
+# Applies to all pools, connection validated on retrieval with dummy ldapsearch. (default is false)
+all.validate.conn=false
########################################################################
# 3. GROUP OBJECT CLASS DEFINITIONS
diff --git a/slapd.properties.example b/slapd.properties.example
index d371cf3..8983c5d 100644
--- a/slapd.properties.example
+++ b/slapd.properties.example
@@ -68,12 +68,12 @@ admin.max.conn=10
user.min.conn=1
user.max.conn=10
-# Used for slapd logger connection pool. Leave zeros when using apacheds:
+# Used for slapd logger connection pool.
log.min.conn=1
log.max.conn=3
-# Applies to all pools, connection validated on retrieval with dummy ldapsearch. (default is true)
-validate.conn=true
+# Applies to all pools, connection validated on retrieval with dummy ldapsearch. (default is false)
+all.validate.conn=false
#These are passwords used for LDAP audit log service accounts:
# Audit Pool:
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/LdapConnectionProvider.java b/src/main/java/org/apache/directory/fortress/core/ldap/LdapConnectionProvider.java
index 6c59481..63ac4fd 100644
--- a/src/main/java/org/apache/directory/fortress/core/ldap/LdapConnectionProvider.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/LdapConnectionProvider.java
@@ -125,7 +125,7 @@ public class LdapConnectionProvider
int max = Config.getInstance().getInt( GlobalIds.LDAP_ADMIN_POOL_MAX, 10 );
int logmin = Config.getInstance().getInt( GlobalIds.LDAP_LOG_POOL_MIN, 1 );
int logmax = Config.getInstance().getInt( GlobalIds.LDAP_LOG_POOL_MAX, 10 );
- boolean validate = Config.getInstance().getBoolean( GlobalIds.LDAP_VALIDATE_CONN, true );
+ boolean validate = Config.getInstance().getBoolean( GlobalIds.LDAP_VALIDATE_CONN, false );
boolean testWhileIdle = Config.getInstance().getBoolean( GlobalIds.LDAP_ADMIN_POOL_TEST_IDLE, true );
boolean logTestWhileIdle = Config.getInstance().getBoolean( GlobalIds.LDAP_LOG_POOL_TEST_IDLE, true );
diff --git a/src/main/java/org/apache/directory/fortress/core/util/Config.java b/src/main/java/org/apache/directory/fortress/core/util/Config.java
index 3b64e89..b5ba709 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/Config.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/Config.java
@@ -274,15 +274,22 @@ public final class Config
int value = defaultValue;
try
{
+
if ( config != null )
{
- value = config.getInt( key, defaultValue );
- LOG.debug( "getInt name [{}] value [{}]", key, value );
+ try
+ {
+ value = config.getInt( key, defaultValue );
+ LOG.debug( "getInt name [{}] value [{}]", key, value );
+ }
+ catch (org.apache.commons.configuration.ConversionException e )
+ {
+ LOG.debug( "getInt name [{}], conversion exception using default [{}]", key, defaultValue );
+ }
}
else
{
LOG.warn( "getInt invalid config, can't read prop [{}], using default [{}]", key, defaultValue );
-
}
}
catch (org.apache.commons.configuration.ConversionException e)
@@ -335,15 +342,22 @@ public final class Config
{
if ( config != null )
{
- value = config.getBoolean( key, defaultValue );
- LOG.debug( "getBoolean name [{}] value [{}]", key, value );
+ try
+ {
+ value = config.getBoolean( key, defaultValue );
+ LOG.debug( "getBoolean name [{}] value [{}]", key, value );
+ }
+ catch (org.apache.commons.configuration.ConversionException e )
+ {
+ LOG.debug( "getBoolean name [{}], conversion exception using default [{}]", key, defaultValue );
+ }
}
else
{
LOG.warn( "getBoolean - invalid config, can't read prop [{}], using default [{}]", key, defaultValue );
}
}
- catch (java.util.NoSuchElementException e )
+ catch (java.util.NoSuchElementException nse )
{
LOG.debug( "getBoolean - no such element [{}], using default [{}]", key, defaultValue );
}
@@ -833,4 +847,4 @@ public final class Config
}
return inConfig;
}
-}
\ No newline at end of file
+}