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 2018/07/20 13:13:36 UTC
directory-fortress-core git commit: revert the ldap api 2.0.0
migration
Repository: directory-fortress-core
Updated Branches:
refs/heads/master 7fdd12f6a -> e0902a4ee
revert the ldap api 2.0.0 migration
Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/e0902a4e
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/e0902a4e
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/e0902a4e
Branch: refs/heads/master
Commit: e0902a4ee2c88d6e57f24cf43c922f0e56c29cdf
Parents: 7fdd12f
Author: Shawn McKinney <sm...@apache.org>
Authored: Fri Jul 20 07:00:29 2018 -0500
Committer: Shawn McKinney <sm...@apache.org>
Committed: Fri Jul 20 07:00:29 2018 -0500
----------------------------------------------------------------------
pom.xml | 2 +-
.../core/ldap/LdapConnectionProvider.java | 19 +++++----
.../fortress/core/ldap/LdapDataProvider.java | 42 ++++++++++----------
3 files changed, 31 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/e0902a4e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4736f18..c302984 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,7 +95,7 @@
<version.antlr>2.7.7</version.antlr>
<version.apache.jdbm1>2.0.0-M3</version.apache.jdbm1>
<version.apacheds>2.0.0.AM25-SNAPSHOT</version.apacheds>
- <version.api.all>2.0.0.AM1-SNAPSHOT</version.api.all>
+ <version.api.all>1.0.2</version.api.all>
<version.commons.beanutils>1.7.0</version.commons.beanutils>
<version.commons.beanutils-core>1.8.0</version.commons.beanutils-core>
<version.commons.codec>1.10</version.commons.codec>
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/e0902a4e/src/main/java/org/apache/directory/fortress/core/ldap/LdapConnectionProvider.java
----------------------------------------------------------------------
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 3a60db7..8359df6 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
@@ -25,7 +25,6 @@ import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.pool.PoolableObjectFactory;
import org.apache.commons.pool.impl.GenericObjectPool;
-import org.apache.commons.pool2.PooledObjectFactory;
import org.apache.directory.api.ldap.codec.api.LdapApiService;
import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
import org.apache.directory.api.ldap.codec.standalone.StandaloneLdapApiService;
@@ -177,7 +176,7 @@ public class LdapConnectionProvider
listExOps.add( "org.openldap.accelerator.impl.dropRole.RbacDropRoleFactory" );
listExOps.add( "org.openldap.accelerator.impl.deleteSession.RbacDeleteSessionFactory" );
listExOps.add( "org.openldap.accelerator.impl.sessionRoles.RbacSessionRolesFactory" );
- LdapApiService ldapApiService = new StandaloneLdapApiService( null, new ArrayList<String>(), listExOps );
+ LdapApiService ldapApiService = new StandaloneLdapApiService( new ArrayList<String>(), listExOps );
if ( !LdapApiServiceFactory.isInitialized() )
{
@@ -191,13 +190,13 @@ public class LdapConnectionProvider
throw new CfgRuntimeException( GlobalErrIds.FT_APACHE_LDAP_POOL_INIT_FAILED, error, ex );
}
- PooledObjectFactory<LdapConnection> poolFactory = new ValidatingPoolableLdapConnectionFactory( config );
+ PoolableObjectFactory<LdapConnection> poolFactory = new ValidatingPoolableLdapConnectionFactory( config );
// Create the Admin pool
adminPool = new LdapConnectionPool( poolFactory );
adminPool.setTestOnBorrow( true );
- adminPool.setBlockWhenExhausted(false);
- adminPool.setMaxTotal( max );
+ adminPool.setWhenExhaustedAction( GenericObjectPool.WHEN_EXHAUSTED_GROW );
+ adminPool.setMaxActive( max );
adminPool.setMinIdle( min );
adminPool.setMaxIdle( -1 );
//adminPool.setMaxWait( 0 );
@@ -205,8 +204,8 @@ public class LdapConnectionProvider
// Create the User pool
userPool = new LdapConnectionPool( poolFactory );
userPool.setTestOnBorrow( true );
- userPool.setBlockWhenExhausted( false );
- userPool.setMaxTotal( max );
+ userPool.setWhenExhaustedAction( GenericObjectPool.WHEN_EXHAUSTED_GROW );
+ userPool.setMaxActive( max );
userPool.setMinIdle( min );
userPool.setMaxIdle( -1 );
@@ -247,8 +246,8 @@ public class LdapConnectionProvider
poolFactory = new ValidatingPoolableLdapConnectionFactory( logConfig );
logPool = new LdapConnectionPool( poolFactory );
logPool.setTestOnBorrow( true );
- logPool.setBlockWhenExhausted( false );
- logPool.setMaxTotal( logmax );
+ logPool.setWhenExhaustedAction( GenericObjectPool.WHEN_EXHAUSTED_GROW );
+ logPool.setMaxActive( logmax );
logPool.setMinIdle( logmin );
}
}
@@ -399,4 +398,4 @@ public class LdapConnectionProvider
LOG.warn( "Error closing log pool: " + e );
}
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/e0902a4e/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java b/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
index d7ad982..3643b6b 100644
--- a/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
@@ -90,7 +90,7 @@ public abstract class LdapDataProvider
private static final int MAX_DEPTH = 100;
private static final LdapCounters COUNTERS = new LdapCounters();
private static final PasswordPolicy PP_REQ_CTRL = new PasswordPolicyImpl();
-
+
/**
* Given a contextId and a fortress param name return the LDAP dn.
*
@@ -106,8 +106,8 @@ public abstract class LdapDataProvider
if ( StringUtils.isNotEmpty( contextId ) && !contextId.equalsIgnoreCase( GlobalIds.NULL ) && !contextId
.equals( GlobalIds.HOME ) )
{
- int idx = szDn.indexOf( Config.getInstance().getProperty( GlobalIds.SUFFIX ) );
- if ( idx > 0 )
+ int idx = szDn.indexOf( Config.getInstance().getProperty( GlobalIds.SUFFIX ) );
+ if ( idx > 0 )
{
// Found. The DN is ,ou=<contextId>,
StringBuilder dn = new StringBuilder();
@@ -713,9 +713,9 @@ public abstract class LdapDataProvider
Attribute attr = entry.get( attributeName );
if ( attr != null )
{
- for ( Value value : attr )
+ for ( Value<?> value : attr )
{
- attrValues.add( value.getValue() );
+ attrValues.add( value.getString() );
}
}
else
@@ -765,9 +765,9 @@ public abstract class LdapDataProvider
if ( entry != null && entry.containsAttribute( attributeName ) )
{
- for ( Value value : entry.get( attributeName ) )
+ for ( Value<?> value : entry.get( attributeName ) )
{
- attrValues.add( value.getValue() );
+ attrValues.add( value.getString() );
}
}
@@ -828,7 +828,7 @@ public abstract class LdapDataProvider
{
try
{
- return new Dn( dn ).getRdn().getValue();
+ return new Dn( dn ).getRdn().getNormValue();
}
catch ( LdapInvalidDnException lide )
{
@@ -1109,14 +1109,14 @@ public abstract class LdapDataProvider
if ( ( props != null ) && ( props.size() > 0 ) )
{
Attribute attr = null;
-
+
for ( Enumeration<?> e = props.propertyNames(); e.hasMoreElements(); )
{
// This LDAP attr is stored as a name-value pair separated by a ':'.
String key = ( String ) e.nextElement();
String val = props.getProperty( key );
String prop = key + separator + val;
-
+
if ( attr == null )
{
attr = new DefaultAttribute( attrName );
@@ -1126,7 +1126,7 @@ public abstract class LdapDataProvider
attr.add( prop );
}
}
-
+
if ( attr != null )
{
entry.add( attr );
@@ -1137,7 +1137,7 @@ public abstract class LdapDataProvider
/**
* Encode some text so that it can be used in a LDAP filter.
- *
+ *
* @param value The value to encode
* @param validLen The maximum accepted length of the value.
* @return String containing encoded data.
@@ -1232,9 +1232,9 @@ public abstract class LdapDataProvider
*
* @param connection handle to ldap connection object.
*/
- protected void closeUserConnection( LdapConnection connection )
+ protected void closeUserConnection( LdapConnection connection )
{
- LdapConnectionProvider.getInstance().closeUserConnection(connection);
+ LdapConnectionProvider.getInstance().closeUserConnection(connection);
}
@@ -1246,7 +1246,7 @@ public abstract class LdapDataProvider
*/
public LdapConnection getAdminConnection() throws LdapException
{
- return LdapConnectionProvider.getInstance().getAdminConnection();
+ return LdapConnectionProvider.getInstance().getAdminConnection();
}
@@ -1258,7 +1258,7 @@ public abstract class LdapDataProvider
*/
protected LdapConnection getLogConnection() throws LdapException
{
- return LdapConnectionProvider.getInstance().getLogConnection();
+ return LdapConnectionProvider.getInstance().getLogConnection();
}
@@ -1270,7 +1270,7 @@ public abstract class LdapDataProvider
*/
protected LdapConnection getUserConnection() throws LdapException
{
- return LdapConnectionProvider.getInstance().getUserConnection();
+ return LdapConnectionProvider.getInstance().getUserConnection();
}
@@ -1285,7 +1285,7 @@ public abstract class LdapDataProvider
}
-
+
/**
* Perform encoding on supplied input string for certain unsafe ascii characters. These chars may be unsafe
@@ -1334,7 +1334,7 @@ public abstract class LdapDataProvider
* Closes all the ldap connection pools.
*/
public static void closeAllConnectionPools(){
- LdapConnectionProvider.getInstance().closeAllConnectionPools();
+ LdapConnectionProvider.getInstance().closeAllConnectionPools();
}
-
-}
+
+}
\ No newline at end of file