You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by cp...@apache.org on 2016/05/05 13:49:23 UTC

[06/15] directory-fortress-core git commit: working on getting junit tests running after refactor

working on getting junit tests running after refactor


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/d0924b2b
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/d0924b2b
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/d0924b2b

Branch: refs/heads/master
Commit: d0924b2b7304a609cff8e1a44a3f79eb764f6738
Parents: 908a073
Author: clp207 <cl...@psu.edu>
Authored: Thu Apr 21 15:52:41 2016 -0400
Committer: clp207 <cl...@psu.edu>
Committed: Thu Apr 21 15:52:41 2016 -0400

----------------------------------------------------------------------
 .../fortress/core/ConfigMgrFactory.java         |   8 +-
 .../directory/fortress/core/GlobalIds.java      |  30 +-
 .../fortress/core/impl/AdminRoleP.java          |   6 +-
 .../directory/fortress/core/impl/ConfigDAO.java |   8 +-
 .../fortress/core/impl/ConfigMgrImpl.java       |   6 +-
 .../directory/fortress/core/impl/UserP.java     |  12 +-
 .../fortress/core/ldap/LdapDataProvider.java    | 136 ++-----
 .../directory/fortress/core/ldap/LdapUtil.java  | 117 ++++++
 .../directory/fortress/core/util/Config.java    | 201 ++---------
 .../fortress/core/util/LocalConfig.java         | 360 +++++++++++++++++++
 .../fortress/core/util/cache/CacheMgr.java      |   2 +-
 .../fortress/core/util/crypto/EncryptUtil.java  |   5 +-
 12 files changed, 575 insertions(+), 316 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/ConfigMgrFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ConfigMgrFactory.java b/src/main/java/org/apache/directory/fortress/core/ConfigMgrFactory.java
index 6d85d3f..7430775 100755
--- a/src/main/java/org/apache/directory/fortress/core/ConfigMgrFactory.java
+++ b/src/main/java/org/apache/directory/fortress/core/ConfigMgrFactory.java
@@ -35,7 +35,7 @@ import org.apache.directory.fortress.core.util.Config;
  */
 public final class ConfigMgrFactory
 {
-    private final static String ENABLE_REST = "enable.mgr.impl.rest";
+    public final static String ENABLE_REST = "enable.mgr.impl.rest";
     
     private ConfigMgrFactory()
     {
@@ -54,6 +54,12 @@ public final class ConfigMgrFactory
     	String configClassName = Config.getInstance().getProperty( GlobalIds.CONFIG_IMPLEMENTATION );
     	boolean IS_REST = ((Config.getInstance().getProperty(ENABLE_REST) != null) && (Config.getInstance().getProperty(ENABLE_REST).equalsIgnoreCase("true")));
     	
+        return ConfigMgrFactory.createInstance(configClassName, IS_REST);
+    }
+    
+    public static ConfigMgr createInstance(String configClassName, boolean IS_REST)
+            throws SecurityException
+    {
         if (configClassName == null || configClassName.compareTo("") == 0)
         {
             if(IS_REST)

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/GlobalIds.java b/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
index 0fe67a3..0b42189 100755
--- a/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
+++ b/src/main/java/org/apache/directory/fortress/core/GlobalIds.java
@@ -59,8 +59,6 @@ public final class GlobalIds
      */
     private GlobalIds()
     {
-    	init();
-    	
     	IS_AUDIT_DISABLED = ( ( Config.getInstance().getProperty( DISABLE_AUDIT ) != null ) && ( Config
     	        .getInstance().getProperty( DISABLE_AUDIT ).equalsIgnoreCase( "true" ) ) );
     	
@@ -71,10 +69,7 @@ public final class GlobalIds
     	        .getInstance().getProperty( GlobalIds.AUTHENTICATION_TYPE ) );
     	
     	IS_OPENLDAP = ( ( Config.getInstance().getProperty( SERVER_TYPE ) != null ) && ( Config
-    	        .getInstance().getProperty( SERVER_TYPE ).equalsIgnoreCase( "openldap" ) ) );
-    	
-    	LDAP_FILTER_SIZE_FOUND = ( Config
-    	        .getInstance().getProperty( LDAP_FILTER_SIZE_PROP ) != null );
+    	        .getInstance().getProperty( SERVER_TYPE ).equalsIgnoreCase( "openldap" ) ) );    	    	
     	
     	DELIMITER = Config.getInstance().getProperty( "attr.delimiter", "$" );
     }
@@ -463,10 +458,6 @@ public final class GlobalIds
      */
     public static final String LDAP_FILTER_SIZE_PROP = "ldap.filter.size";
 
-    /**
-     * Used during ldap filter processing.
-     */
-    public boolean LDAP_FILTER_SIZE_FOUND;
     public static final String APACHE_LDAP_API = "apache";
     public static final String AUTH_Z_FAILED = "authzfailed";
     public static final String POP_NAME = "ftOpNm";
@@ -497,25 +488,6 @@ public final class GlobalIds
     private static int ldapFilterSize = 25;
 
     /**
-     * enable the ldap filter size variable to be used later during filter processing.
-     */
-    private void init()
-    {
-        try
-        {
-            String lenProp = Config.getInstance().getProperty( LDAP_FILTER_SIZE_PROP );
-            if ( LDAP_FILTER_SIZE_FOUND )
-            {
-                ldapFilterSize = Integer.valueOf( lenProp );
-            }
-        }
-        catch ( java.lang.NumberFormatException nfe )
-        {
-            //ignore
-        }
-    }
-
-    /**
      * Maximum number of entries allowed for ldap filter replacements.
      */
     public static final int LDAP_FILTER_SIZE = ldapFilterSize;

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleP.java b/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleP.java
index e6e0008..75483cc 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/AdminRoleP.java
@@ -60,8 +60,8 @@ public final class AdminRoleP
 {
     private static final String CLS_NM = AdminRoleP.class.getName();
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
-    private static final AdminRoleDAO rDao = new AdminRoleDAO();
-    private static final OrgUnitP op = new OrgUnitP();
+    private AdminRoleDAO rDao;
+    private OrgUnitP op;
     private static final ConstraintValidator constraintValidator = VUtil.getConstraintValidator();
 
     /**
@@ -69,6 +69,8 @@ public final class AdminRoleP
      */
     AdminRoleP()
     {
+        rDao = new AdminRoleDAO();
+        op = new OrgUnitP();
     }
 
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
index b2278b4..f971c46 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
@@ -39,7 +39,7 @@ import org.apache.directory.fortress.core.RemoveException;
 import org.apache.directory.fortress.core.UpdateException;
 import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 import org.apache.directory.fortress.core.model.PropUtil;
-import org.apache.directory.fortress.core.util.Config;
+import org.apache.directory.fortress.core.util.LocalConfig;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -86,12 +86,12 @@ final class ConfigDAO extends LdapDataProvider
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
     private String CONFIG_ROOT_DN;
 
-    private static final String CONFIG_OBJ_CLASS[] =
+    private final String CONFIG_OBJ_CLASS[] =
         {
             SchemaConstants.DEVICE_OC, GlobalIds.PROPS_AUX_OBJECT_CLASS_NAME
     };
 
-    private static final String[] CONFIG_ATRS =
+    private final String[] CONFIG_ATRS =
         {
             SchemaConstants.CN_AT, GlobalIds.PROPS
     };
@@ -104,7 +104,7 @@ final class ConfigDAO extends LdapDataProvider
     {
     	super();
     	
-    	CONFIG_ROOT_DN = Config.getInstance().getProperty( GlobalIds.CONFIG_ROOT_PARAM );
+    	CONFIG_ROOT_DN = LocalConfig.getInstance().getProperty( GlobalIds.CONFIG_ROOT_PARAM );
     }
 
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java
index 5dea257..2c80df4 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java
@@ -41,8 +41,12 @@ import org.apache.directory.fortress.core.SecurityException;
  */
 public class ConfigMgrImpl implements ConfigMgr, Serializable
 {
-    private static final ConfigP cfgP = new ConfigP();
+    private ConfigP cfgP;
 
+    public ConfigMgrImpl() {
+    	cfgP = new ConfigP();
+    }
+    
     /**
      * {@inheritDoc}
      */

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UserP.java b/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
index f089540..30af294 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
@@ -69,11 +69,11 @@ final class UserP
 {
     //private static final boolean IS_SESSION_PROPS_ENABLED = Config.getBoolean( "user.session.props.enabled", false );
     private static final String CLS_NM = UserP.class.getName();
-    private static UserDAO uDao = new UserDAO();
+    private static UserDAO uDao;
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
-    private static final PolicyP policyP = new PolicyP();
-    private static final AdminRoleP admRoleP = new AdminRoleP();
-    private static final OrgUnitP orgUnitP = new OrgUnitP();
+    private PolicyP policyP;
+    private AdminRoleP admRoleP;
+    private OrgUnitP orgUnitP;
 
 
     /**
@@ -81,6 +81,10 @@ final class UserP
      */
     UserP()
     {
+    	uDao = new UserDAO();
+        policyP = new PolicyP();
+        admRoleP = new AdminRoleP();
+        orgUnitP = new OrgUnitP();
     }
 
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/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 4c47e5e..6c6979d 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
@@ -76,6 +76,7 @@ import org.apache.directory.fortress.core.model.FortEntity;
 import org.apache.directory.fortress.core.model.Hier;
 import org.apache.directory.fortress.core.model.Relationship;
 import org.apache.directory.fortress.core.util.Config;
+import org.apache.directory.fortress.core.util.LocalConfig;
 import org.apache.directory.fortress.core.util.crypto.EncryptUtil;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapConnectionConfig;
@@ -133,65 +134,62 @@ public abstract class LdapDataProvider
 
     private static final PasswordPolicy PP_REQ_CTRL = new PasswordPolicyImpl();
 
-    private static final char[] LDAP_META_CHARS = loadLdapEscapeChars();
-    private static final String[] LDAP_REPL_VALS = loadValidLdapVals();
-
     public LdapDataProvider(){
     	init();
     }
     
     private void init()
-    {
+    {    			
     	IS_SSL = (
-    	        Config.getInstance().getProperty( GlobalIds.ENABLE_LDAP_SSL ) != null &&
-    	            Config.getInstance().getProperty( GlobalIds.ENABLE_LDAP_SSL ).equalsIgnoreCase( "true" ) &&
-    	            Config.getInstance().getProperty( GlobalIds.TRUST_STORE ) != null &&
-    	        Config.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ) != null );	
+    			LocalConfig.getInstance().getProperty( GlobalIds.ENABLE_LDAP_SSL ) != null &&
+    			LocalConfig.getInstance().getProperty( GlobalIds.ENABLE_LDAP_SSL ).equalsIgnoreCase( "true" ) &&
+    			LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE ) != null &&
+    			LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ) != null );	
     	
         IS_SET_TRUST_STORE_PROP = (
     	        IS_SSL &&
-    	            Config.getInstance().getProperty( GlobalIds.SET_TRUST_STORE_PROP ) != null &&
-    	        Config.getInstance().getProperty( GlobalIds.SET_TRUST_STORE_PROP ).equalsIgnoreCase( "true" ) );
+    	        LocalConfig.getInstance().getProperty( GlobalIds.SET_TRUST_STORE_PROP ) != null &&
+    	        LocalConfig.getInstance().getProperty( GlobalIds.SET_TRUST_STORE_PROP ).equalsIgnoreCase( "true" ) );
     	
-    	IS_SSL_DEBUG = ( ( Config.getInstance().getProperty( GlobalIds.ENABLE_LDAP_SSL_DEBUG ) != null ) && ( Config
+    	IS_SSL_DEBUG = ( ( LocalConfig.getInstance().getProperty( GlobalIds.ENABLE_LDAP_SSL_DEBUG ) != null ) && ( LocalConfig
     			.getInstance().getProperty( GlobalIds.ENABLE_LDAP_SSL_DEBUG ).equalsIgnoreCase( "true" ) ) );	
     	
     	
-        String host = Config.getInstance().getProperty( GlobalIds.LDAP_HOST, "localhost" );
-        int port = Config.getInstance().getInt( GlobalIds.LDAP_PORT, 389 );
-        int min = Config.getInstance().getInt( GlobalIds.LDAP_ADMIN_POOL_MIN, 1 );
-        int max = Config.getInstance().getInt( GlobalIds.LDAP_ADMIN_POOL_MAX, 10 );
-        int logmin = Config.getInstance().getInt( LDAP_LOG_POOL_MIN, 1 );
-        int logmax = Config.getInstance().getInt( LDAP_LOG_POOL_MAX, 10 );
+        String host = LocalConfig.getInstance().getProperty( GlobalIds.LDAP_HOST, "localhost" );
+        int port = LocalConfig.getInstance().getInt( GlobalIds.LDAP_PORT, 389 );
+        int min = LocalConfig.getInstance().getInt( GlobalIds.LDAP_ADMIN_POOL_MIN, 1 );
+        int max = LocalConfig.getInstance().getInt( GlobalIds.LDAP_ADMIN_POOL_MAX, 10 );
+        int logmin = LocalConfig.getInstance().getInt( LDAP_LOG_POOL_MIN, 1 );
+        int logmax = LocalConfig.getInstance().getInt( LDAP_LOG_POOL_MAX, 10 );
         LOG.info( "LDAP POOL:  host=[{}], port=[{}], min=[{}], max=[{}]", host, port, min, max );
 
         if ( IS_SET_TRUST_STORE_PROP )
         {
             LOG.info( "Set JSSE truststore properties in Apache LDAP client:" );
-            LOG.info( "javax.net.ssl.trustStore: {}", Config.getInstance().getProperty( GlobalIds.TRUST_STORE ) );
+            LOG.info( "javax.net.ssl.trustStore: {}", LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE ) );
             LOG.info( "javax.net.debug: {}", IS_SSL_DEBUG );
-            System.setProperty( "javax.net.ssl.trustStore", Config.getInstance().getProperty( GlobalIds.TRUST_STORE ) );
-            System.setProperty( "javax.net.ssl.trustStorePassword", Config.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ) );
+            System.setProperty( "javax.net.ssl.trustStore", LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE ) );
+            System.setProperty( "javax.net.ssl.trustStorePassword", LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ) );
             System.setProperty( "javax.net.debug", Boolean.valueOf( IS_SSL_DEBUG ).toString() );
         }
 
         LdapConnectionConfig config = new LdapConnectionConfig();
         config.setLdapHost( host );
         config.setLdapPort( port );
-        config.setName( Config.getInstance().getProperty( GlobalIds.LDAP_ADMIN_POOL_UID, "" ) );
+        config.setName( LocalConfig.getInstance().getProperty( GlobalIds.LDAP_ADMIN_POOL_UID, "" ) );
 
         config.setUseSsl( IS_SSL );
         //config.setTrustManagers( new NoVerificationTrustManager() );
 
-        if(Config.getInstance().getBoolean(ENABLE_LDAP_STARTTLS, false)){
+        if(LocalConfig.getInstance().getBoolean(ENABLE_LDAP_STARTTLS, false)){
         	config.setUseTls(true);
         }
         
-        if ( IS_SSL && StringUtils.isNotEmpty( Config.getInstance().getProperty( GlobalIds.TRUST_STORE ) )
-            && StringUtils.isNotEmpty( Config.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ) ) )
+        if ( IS_SSL && StringUtils.isNotEmpty( LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE ) )
+            && StringUtils.isNotEmpty( LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ) ) )
         {
             // validate certificates but allow self-signed certs if within this truststore:
-            config.setTrustManagers( new LdapClientTrustStoreManager( Config.getInstance().getProperty( GlobalIds.TRUST_STORE ), Config.getInstance().getProperty( GlobalIds.TRUST_STORE_PW )
+            config.setTrustManagers( new LdapClientTrustStoreManager( LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE ), LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE_PW )
                 .toCharArray(), null,
                 true ) );
         }
@@ -199,11 +197,11 @@ public abstract class LdapDataProvider
         String adminPw;
         if ( EncryptUtil.isEnabled() )
         {
-            adminPw = EncryptUtil.getInstance().decrypt( Config.getInstance().getProperty( GlobalIds.LDAP_ADMIN_POOL_PW ) );
+            adminPw = EncryptUtil.getInstance().decrypt( LocalConfig.getInstance().getProperty( GlobalIds.LDAP_ADMIN_POOL_PW ) );
         }
         else
         {
-            adminPw = Config.getInstance().getProperty( GlobalIds.LDAP_ADMIN_POOL_PW );
+            adminPw = LocalConfig.getInstance().getProperty( GlobalIds.LDAP_ADMIN_POOL_PW );
         }
 
         config.setCredentials( adminPw );
@@ -258,28 +256,28 @@ public abstract class LdapDataProvider
             LdapConnectionConfig logConfig = new LdapConnectionConfig();
             logConfig.setLdapHost( host );
             logConfig.setLdapPort( port );
-            logConfig.setName( Config.getInstance().getProperty( GlobalIds.LDAP_ADMIN_POOL_UID, "" ) );
+            logConfig.setName( LocalConfig.getInstance().getProperty( GlobalIds.LDAP_ADMIN_POOL_UID, "" ) );
 
             logConfig.setUseSsl( IS_SSL );
 
-            if ( IS_SSL && StringUtils.isNotEmpty( Config.getInstance().getProperty( GlobalIds.TRUST_STORE ) )
-                && StringUtils.isNotEmpty( Config.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ) ) )
+            if ( IS_SSL && StringUtils.isNotEmpty( LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE ) )
+                && StringUtils.isNotEmpty( LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ) ) )
             {
                 // validate certificates but allow self-signed certs if within this truststore:
-                logConfig.setTrustManagers( new LdapClientTrustStoreManager( Config.getInstance().getProperty( GlobalIds.TRUST_STORE ),
-                    Config.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ).toCharArray(),
+                logConfig.setTrustManagers( new LdapClientTrustStoreManager( LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE ),
+                	LocalConfig.getInstance().getProperty( GlobalIds.TRUST_STORE_PW ).toCharArray(),
                     null, true ) );
             }
 
-            logConfig.setName( Config.getInstance().getProperty( LDAP_LOG_POOL_UID, "" ) );
+            logConfig.setName( LocalConfig.getInstance().getProperty( LDAP_LOG_POOL_UID, "" ) );
             String logPw;
             if ( EncryptUtil.isEnabled() )
             {
-                logPw = EncryptUtil.getInstance().decrypt( Config.getInstance().getProperty( LDAP_LOG_POOL_PW ) );
+                logPw = EncryptUtil.getInstance().decrypt( LocalConfig.getInstance().getProperty( LDAP_LOG_POOL_PW ) );
             }
             else
             {
-                logPw = Config.getInstance().getProperty( LDAP_LOG_POOL_PW );
+                logPw = LocalConfig.getInstance().getProperty( LDAP_LOG_POOL_PW );
             }
             logConfig.setCredentials( logPw );
             poolFactory = new ValidatingPoolableLdapConnectionFactory( logConfig );
@@ -1345,7 +1343,7 @@ public abstract class LdapDataProvider
                 throw new LdapException( error );
             }
 
-            if ( GlobalIds.getInstance().LDAP_FILTER_SIZE_FOUND )
+            if ( LdapUtil.getInstance().isLdapfilterSizeFound() )
             {
                 value = escapeLDAPSearchFilter( value );
             }
@@ -1517,63 +1515,7 @@ public abstract class LdapDataProvider
     }
 
 
-    /**
-     *
-     */
-    private static char[] loadLdapEscapeChars()
-    {
-        if ( !GlobalIds.getInstance().LDAP_FILTER_SIZE_FOUND )
-        {
-            return null;
-        }
-
-        char[] ldapMetaChars = new char[GlobalIds.LDAP_FILTER_SIZE];
-
-        for ( int i = 1;; i++ )
-        {
-            String prop = GlobalIds.LDAP_FILTER + i;
-            String value = Config.getInstance().getProperty( prop );
-
-            if ( value == null )
-            {
-                break;
-            }
-
-            ldapMetaChars[i - 1] = value.charAt( 0 );
-        }
-
-        return ldapMetaChars;
-    }
-
-
-    /**
-     *
-     */
-    private static String[] loadValidLdapVals()
-    {
-        if ( !GlobalIds.getInstance().LDAP_FILTER_SIZE_FOUND )
-        {
-            return null;
-        }
-
-        String[] ldapReplacements = new String[GlobalIds.LDAP_FILTER_SIZE];
-
-        for ( int i = 1;; i++ )
-        {
-            String prop = GlobalIds.LDAP_SUB + i;
-            String value = Config.getInstance().getProperty( prop );
-
-            if ( value == null )
-            {
-                break;
-            }
-
-            ldapReplacements[i - 1] = value;
-        }
-
-        return ldapReplacements;
-    }
-
+  
 
     /**
      * Perform encoding on supplied input string for certain unsafe ascii characters.  These chars may be unsafe
@@ -1583,7 +1525,7 @@ public abstract class LdapDataProvider
      * @param filter contains the data to filter.
      * @return possibly modified input string for matched characters.
      */
-    protected static String escapeLDAPSearchFilter( String filter )
+    protected String escapeLDAPSearchFilter( String filter )
     {
         StringBuilder sb = new StringBuilder();
         int filterLen = filter.length();
@@ -1596,14 +1538,14 @@ public abstract class LdapDataProvider
 
             for ( ; j < GlobalIds.LDAP_FILTER_SIZE; j++ )
             {
-                if ( LDAP_META_CHARS[j] > curChar )
+                if ( LdapUtil.getInstance().getLdapMetaChars()[j] > curChar )
                 {
                     break;
                 }
-                else if ( curChar == LDAP_META_CHARS[j] )
+                else if ( curChar == LdapUtil.getInstance().getLdapMetaChars()[j] )
                 {
                     sb.append( "\\" );
-                    sb.append( LDAP_REPL_VALS[j] );
+                    sb.append( LdapUtil.getInstance().getLdapReplVals()[j] );
                     found = true;
                     break;
                 }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/ldap/LdapUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/LdapUtil.java b/src/main/java/org/apache/directory/fortress/core/ldap/LdapUtil.java
new file mode 100644
index 0000000..f0ccf81
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/LdapUtil.java
@@ -0,0 +1,117 @@
+package org.apache.directory.fortress.core.ldap;
+
+import org.apache.directory.fortress.core.GlobalIds;
+import org.apache.directory.fortress.core.util.Config;
+
+
+public class LdapUtil {
+
+	private boolean ldapfilterSizeFound = false;
+	private int ldapFilterSize = 25;	
+    private char[] ldapMetaChars;
+    private String[] ldapReplVals;
+	
+    private static volatile LdapUtil INSTANCE = null; 
+
+    public static LdapUtil getInstance() {
+        if(INSTANCE == null) {
+            synchronized (LdapUtil.class) {
+                if(INSTANCE == null){
+        	        INSTANCE = new LdapUtil();
+                }
+            }
+        }
+        return INSTANCE;
+    }        
+
+    /**
+    *
+    */
+   private static char[] loadLdapEscapeChars()
+   {
+       if ( !LdapUtil.getInstance().isLdapfilterSizeFound() )
+       {
+           return null;
+       }
+
+       char[] ldapMetaChars = new char[LdapUtil.getInstance().getLdapFilterSize()];
+
+       for ( int i = 1;; i++ )
+       {
+           String prop = GlobalIds.LDAP_FILTER + i;
+           String value = Config.getInstance().getProperty( prop );
+
+           if ( value == null )
+           {
+               break;
+           }
+
+           ldapMetaChars[i - 1] = value.charAt( 0 );
+       }
+
+       return ldapMetaChars;
+   }
+
+
+   /**
+    *
+    */
+   private static String[] loadValidLdapVals()
+   {
+       if ( !LdapUtil.getInstance().isLdapfilterSizeFound() )
+       {
+           return null;
+       }
+
+       String[] ldapReplacements = new String[LdapUtil.getInstance().getLdapFilterSize()];
+
+       for ( int i = 1;; i++ )
+       {
+           String prop = GlobalIds.LDAP_SUB + i;
+           String value = Config.getInstance().getProperty( prop );
+
+           if ( value == null )
+           {
+               break;
+           }
+
+           ldapReplacements[i - 1] = value;
+       }
+
+       return ldapReplacements;
+   }
+
+    
+	public boolean isLdapfilterSizeFound() {
+		return ldapfilterSizeFound;
+	}
+
+	public void setLdapfilterSizeFound(boolean ldapfilterSizeFound) {
+		this.ldapfilterSizeFound = ldapfilterSizeFound;
+	}
+
+	public int getLdapFilterSize() {
+		return ldapFilterSize;
+	}
+
+	public void setLdapFilterSize(int ldapFilterSize) {
+		this.ldapFilterSize = ldapFilterSize;
+	}
+
+	public char[] getLdapMetaChars() {
+		return ldapMetaChars;
+	}
+
+	public void setLdapMetaChars(char[] ldapMetaChars) {
+		this.ldapMetaChars = ldapMetaChars;
+	}
+
+	public String[] getLdapReplVals() {
+		return ldapReplVals;
+	}
+
+	public void setLdapReplVals(String[] ldapReplVals) {
+		this.ldapReplVals = ldapReplVals;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/util/Config.java
----------------------------------------------------------------------
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 d3d773d..4efc574 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
@@ -20,12 +20,10 @@
 package org.apache.directory.fortress.core.util;
 
 
-import java.net.URL;
 import java.util.Enumeration;
 import java.util.Properties;
 
 import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.commons.lang.StringUtils;
 import org.apache.directory.fortress.core.CfgException;
 import org.apache.directory.fortress.core.CfgRuntimeException;
 import org.apache.directory.fortress.core.ConfigMgr;
@@ -33,6 +31,7 @@ import org.apache.directory.fortress.core.ConfigMgrFactory;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.SecurityException;
+import org.apache.directory.fortress.core.ldap.LdapUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,27 +50,11 @@ import org.slf4j.LoggerFactory;
  */
 public final class Config
 {
-    private static final String PROP_FILE = "fortress.properties";
-    private static final String USER_PROP_FILE = "fortress.user.properties";
-    private static final String EXT_LDAP_HOST = "fortress.host";
-    private static final String EXT_LDAP_PORT = "fortress.port";
-    private static final String EXT_LDAP_ADMIN_POOL_UID = "fortress.admin.user";
-    private static final String EXT_LDAP_ADMIN_POOL_PW = "fortress.admin.pw";
-    private static final String EXT_LDAP_ADMIN_POOL_MIN = "fortress.min.admin.conn";
-    private static final String EXT_LDAP_ADMIN_POOL_MAX = "fortress.max.admin.conn";
-    private static final String EXT_ENABLE_LDAP_SSL = "fortress.enable.ldap.ssl";
-    private static final String EXT_ENABLE_LDAP_SSL_DEBUG = "fortress.enable.ldap.ssl.debug";
-    private static final String EXT_TRUST_STORE = "fortress.trust.store";
-    private static final String EXT_TRUST_STORE_PW = "fortress.trust.store.password";
-    private static final String EXT_SET_TRUST_STORE_PROP = "fortress.trust.store.set.prop";
-    private static final String EXT_CONFIG_REALM = "fortress.config.realm";
-    private static final String EXT_CONFIG_ROOT_DN = "fortress.config.root";
-    private static final String EXT_SERVER_TYPE = "fortress.ldap.server.type";
     private static PropertiesConfiguration config;
     private static final String CLS_NM = Config.class.getName();
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
 
-    private static volatile Config INSTANCE = null; 
+    private static volatile Config INSTANCE = null;    
     
     public static Config getInstance() {
         if(INSTANCE == null) {
@@ -88,31 +71,7 @@ public final class Config
     {
         try
         {
-            // Load the system config file.
-            URL fUrl = Config.class.getClassLoader().getResource( PROP_FILE );
-            config = new PropertiesConfiguration();
-            config.setDelimiterParsingDisabled( true );
-            if ( fUrl == null )
-            {
-                String error = "static init: Error, null cfg file: " + PROP_FILE;
-                LOG.warn( error );
-            }
-            else
-            {
-                LOG.info( "static init: found from: {} path: {}", PROP_FILE, fUrl.getPath() );
-                config.load( fUrl );
-                LOG.info( "static init: loading from: {}", PROP_FILE );
-            }
-
-            URL fUserUrl = Config.class.getClassLoader().getResource( USER_PROP_FILE );
-            if ( fUserUrl != null )
-            {
-                LOG.info( "static init: found user properties from: {} path: {}", USER_PROP_FILE, fUserUrl.getPath() );
-                config.load( fUserUrl );
-            }
-
-            // Check to see if any of the ldap connection parameters have been overridden:
-            getExternalConfig();
+            config = LocalConfig.getInstance().getConfig();
 
             // Retrieve parameters from the config node stored in target LDAP DIT:
             String realmName = config.getString( GlobalIds.CONFIG_REALM, "DEFAULT" );
@@ -129,22 +88,33 @@ public final class Config
                         config.setProperty( key, val );
                     }
                 }
+                
+                //init ldap util vals since config is stored ons erver
+            	boolean ldapfilterSizeFound = ( getProperty( GlobalIds.LDAP_FILTER_SIZE_PROP ) != null );
+            	LdapUtil.getInstance().setLdapfilterSizeFound(ldapfilterSizeFound);
+            	
+                try
+                {
+                    String lenProp = getProperty( GlobalIds.LDAP_FILTER_SIZE_PROP );
+                    if ( ldapfilterSizeFound )
+                    {
+                        LdapUtil.getInstance().setLdapFilterSize(Integer.valueOf( lenProp ));
+                    }
+                }
+                catch ( java.lang.NumberFormatException nfe )
+                {
+                    //ignore
+                }
+
             }
             else
             {
                 LOG.info( "static init: config realm not setup" );
             }
         }
-        catch ( org.apache.commons.configuration.ConfigurationException ex )
-        {
-            String error = "static init: Error loading from cfg file: [" + PROP_FILE
-                + "] ConfigurationException=" + ex;
-            LOG.error( error );
-            throw new CfgRuntimeException( GlobalErrIds.FT_CONFIG_BOOTSTRAP_FAILED, error, ex );
-        }
         catch ( SecurityException se )
         {
-            String error = "static init: Error loading from cfg file: [" + PROP_FILE + "] SecurityException="
+            String error = "static init: Error loading from remote config: SecurityException="
                 + se;
             LOG.error( error );
             throw new CfgRuntimeException( GlobalErrIds.FT_CONFIG_INITIALIZE_FAILED, error, se );
@@ -381,7 +351,10 @@ public final class Config
         Properties props = null;
         try
         {
-            ConfigMgr cfgMgr = ConfigMgrFactory.createInstance();
+        	String configClassName = this.getProperty( GlobalIds.CONFIG_IMPLEMENTATION );
+        	boolean IS_REST = ((this.getProperty(ConfigMgrFactory.ENABLE_REST) != null) && (this.getProperty(ConfigMgrFactory.ENABLE_REST).equalsIgnoreCase("true")));        	
+        	
+            ConfigMgr cfgMgr = ConfigMgrFactory.createInstance(configClassName, IS_REST);                       
             props = cfgMgr.read( realmName );
         }
         catch ( CfgException ce )
@@ -399,126 +372,4 @@ public final class Config
         return props;
     }
 
-
-    /**
-     * This method is called during configuration initialization.  It determines if
-     * the ldap connection coordinates have been overridden as system properties.
-     */
-    private void getExternalConfig()
-    {
-        String PREFIX = "getExternalConfig override name [{}] value [{}]";
-        // Check to see if the ldap host has been overridden by a system property:
-        String szValue = System.getProperty( EXT_LDAP_HOST );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.LDAP_HOST, szValue );
-            LOG.info( PREFIX, GlobalIds.LDAP_HOST, szValue );
-        }
-        // Check to see if the ldap port has been overridden by a system property:
-        szValue = System.getProperty( EXT_LDAP_PORT );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.LDAP_PORT, szValue );
-            LOG.info( PREFIX, GlobalIds.LDAP_PORT, szValue );
-        }
-
-        // Check to see if the admin pool uid has been overridden by a system property:
-        szValue = System.getProperty( EXT_LDAP_ADMIN_POOL_UID );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.LDAP_ADMIN_POOL_UID, szValue );
-            // never display ldap admin userid name to log:
-            LOG.info( "getExternalConfig override name [{}]", GlobalIds.LDAP_ADMIN_POOL_UID );
-        }
-
-        // Check to see if the admin pool pw has been overridden by a system property:
-        szValue = System.getProperty( EXT_LDAP_ADMIN_POOL_PW );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.LDAP_ADMIN_POOL_PW, szValue );
-            // never display password of any type to log:
-            LOG.info( "getExternalConfig override name [{}]", GlobalIds.LDAP_ADMIN_POOL_PW );
-        }
-
-        // Check to see if the admin pool min connections has been overridden by a system property:
-        szValue = System.getProperty( EXT_LDAP_ADMIN_POOL_MIN );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.LDAP_ADMIN_POOL_MIN, szValue );
-            LOG.info( PREFIX, GlobalIds.LDAP_ADMIN_POOL_MIN, szValue );
-        }
-
-        // Check to see if the admin pool max connections has been overridden by a system property:
-        szValue = System.getProperty( EXT_LDAP_ADMIN_POOL_MAX );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.LDAP_ADMIN_POOL_MAX, szValue );
-            LOG.info( PREFIX, GlobalIds.LDAP_ADMIN_POOL_MAX, szValue );
-        }
-
-        // Check to see if ssl enabled parameter has been overridden by a system property:
-        szValue = System.getProperty( EXT_ENABLE_LDAP_SSL );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.ENABLE_LDAP_SSL, szValue );
-            LOG.info( PREFIX, GlobalIds.ENABLE_LDAP_SSL, szValue );
-        }
-
-        // Check to see if the ssl debug enabled parameter has been overridden by a system property:
-        szValue = System.getProperty( EXT_ENABLE_LDAP_SSL_DEBUG );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.ENABLE_LDAP_SSL_DEBUG, szValue );
-            LOG.info( PREFIX, GlobalIds.ENABLE_LDAP_SSL_DEBUG, szValue );
-        }
-
-        // Check to see if the trust store location has been overridden by a system property:
-        szValue = System.getProperty( EXT_TRUST_STORE );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.TRUST_STORE, szValue );
-            LOG.info( PREFIX, GlobalIds.TRUST_STORE, szValue );
-        }
-
-        // Check to see if the trust store password has been overridden by a system property:
-        szValue = System.getProperty( EXT_TRUST_STORE_PW );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.TRUST_STORE_PW, szValue );
-            // never display password value to log:
-            LOG.info( "getExternalConfig override name [{}]", GlobalIds.TRUST_STORE_PW );
-        }
-
-        // Check to see if the trust store set parameter has been overridden by a system property:
-        szValue = System.getProperty( EXT_SET_TRUST_STORE_PROP );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.SET_TRUST_STORE_PROP, szValue );
-            LOG.info( PREFIX, GlobalIds.SET_TRUST_STORE_PROP, szValue );
-        }
-
-        // Check to see if the config realm name has been overridden by a system property:
-        szValue = System.getProperty( EXT_CONFIG_REALM );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.CONFIG_REALM, szValue );
-            LOG.info( PREFIX, GlobalIds.CONFIG_REALM, szValue );
-        }
-
-        // Check to see if the config realm name has been overridden by a system property:
-        szValue = System.getProperty( EXT_CONFIG_ROOT_DN );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.CONFIG_ROOT_PARAM, szValue );
-            LOG.info( PREFIX, GlobalIds.CONFIG_ROOT_PARAM, szValue );
-        }
-
-        // Check to see if the ldap server type has been overridden by a system property:
-        szValue = System.getProperty( EXT_SERVER_TYPE  );
-        if( StringUtils.isNotEmpty( szValue ))
-        {
-            config.setProperty( GlobalIds.SERVER_TYPE, szValue );
-            LOG.info( PREFIX, GlobalIds.SERVER_TYPE, szValue );
-        }
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/util/LocalConfig.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/LocalConfig.java b/src/main/java/org/apache/directory/fortress/core/util/LocalConfig.java
new file mode 100644
index 0000000..7c612e1
--- /dev/null
+++ b/src/main/java/org/apache/directory/fortress/core/util/LocalConfig.java
@@ -0,0 +1,360 @@
+package org.apache.directory.fortress.core.util;
+
+import java.net.URL;
+
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.lang.StringUtils;
+import org.apache.directory.fortress.core.CfgRuntimeException;
+import org.apache.directory.fortress.core.GlobalErrIds;
+import org.apache.directory.fortress.core.GlobalIds;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LocalConfig {
+
+    private static final String CLS_NM = LocalConfig.class.getName();
+    private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
+	
+    private static final String PROP_FILE = "fortress.properties";
+    private static final String USER_PROP_FILE = "fortress.user.properties";
+    private static final String EXT_LDAP_HOST = "fortress.host";
+    private static final String EXT_LDAP_PORT = "fortress.port";
+    private static final String EXT_LDAP_ADMIN_POOL_UID = "fortress.admin.user";
+    private static final String EXT_LDAP_ADMIN_POOL_PW = "fortress.admin.pw";
+    private static final String EXT_LDAP_ADMIN_POOL_MIN = "fortress.min.admin.conn";
+    private static final String EXT_LDAP_ADMIN_POOL_MAX = "fortress.max.admin.conn";
+    private static final String EXT_ENABLE_LDAP_SSL = "fortress.enable.ldap.ssl";
+    private static final String EXT_ENABLE_LDAP_SSL_DEBUG = "fortress.enable.ldap.ssl.debug";
+    private static final String EXT_TRUST_STORE = "fortress.trust.store";
+    private static final String EXT_TRUST_STORE_PW = "fortress.trust.store.password";
+    private static final String EXT_SET_TRUST_STORE_PROP = "fortress.trust.store.set.prop";
+    private static final String EXT_CONFIG_REALM = "fortress.config.realm";
+    private static final String EXT_CONFIG_ROOT_DN = "fortress.config.root";
+    private static final String EXT_SERVER_TYPE = "fortress.ldap.server.type";
+	
+    private PropertiesConfiguration config;
+	
+    private static volatile LocalConfig INSTANCE = null;    
+    
+    public static LocalConfig getInstance() {
+        if(INSTANCE == null) {
+            synchronized (LocalConfig.class) {
+                if(INSTANCE == null){
+                    INSTANCE = new LocalConfig();
+                }
+            }
+        }
+        return INSTANCE;
+    }
+	
+    private void init()
+    {
+        try
+        {
+            // Load the system config file.
+            URL fUrl = Config.class.getClassLoader().getResource( PROP_FILE );
+            config = new PropertiesConfiguration();
+            config.setDelimiterParsingDisabled( true );
+            if ( fUrl == null )
+            {
+                String error = "static init: Error, null cfg file: " + PROP_FILE;
+                LOG.warn( error );
+            }
+            else
+            {
+                LOG.info( "static init: found from: {} path: {}", PROP_FILE, fUrl.getPath() );
+                config.load( fUrl );
+                LOG.info( "static init: loading from: {}", PROP_FILE );
+            }
+
+            URL fUserUrl = Config.class.getClassLoader().getResource( USER_PROP_FILE );
+            if ( fUserUrl != null )
+            {
+                LOG.info( "static init: found user properties from: {} path: {}", USER_PROP_FILE, fUserUrl.getPath() );
+                config.load( fUserUrl );
+            }
+
+            // Check to see if any of the ldap connection parameters have been overridden:
+            getExternalConfig();
+        }
+        catch ( org.apache.commons.configuration.ConfigurationException ex )
+        {
+            String error = "static init: Error loading from cfg file: [" + PROP_FILE
+                + "] ConfigurationException=" + ex;
+            LOG.error( error );
+            throw new CfgRuntimeException( GlobalErrIds.FT_CONFIG_BOOTSTRAP_FAILED, error, ex );
+        }
+    }
+
+    /**
+     * Private constructor
+     *
+     */
+    private LocalConfig()
+    {
+        init();
+    }
+    
+    /**
+     * This method is called during configuration initialization.  It determines if
+     * the ldap connection coordinates have been overridden as system properties.
+     */
+    private void getExternalConfig()
+    {
+        String PREFIX = "getExternalConfig override name [{}] value [{}]";
+        // Check to see if the ldap host has been overridden by a system property:
+        String szValue = System.getProperty( EXT_LDAP_HOST );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.LDAP_HOST, szValue );
+            LOG.info( PREFIX, GlobalIds.LDAP_HOST, szValue );
+        }
+        // Check to see if the ldap port has been overridden by a system property:
+        szValue = System.getProperty( EXT_LDAP_PORT );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.LDAP_PORT, szValue );
+            LOG.info( PREFIX, GlobalIds.LDAP_PORT, szValue );
+        }
+
+        // Check to see if the admin pool uid has been overridden by a system property:
+        szValue = System.getProperty( EXT_LDAP_ADMIN_POOL_UID );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.LDAP_ADMIN_POOL_UID, szValue );
+            // never display ldap admin userid name to log:
+            LOG.info( "getExternalConfig override name [{}]", GlobalIds.LDAP_ADMIN_POOL_UID );
+        }
+
+        // Check to see if the admin pool pw has been overridden by a system property:
+        szValue = System.getProperty( EXT_LDAP_ADMIN_POOL_PW );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.LDAP_ADMIN_POOL_PW, szValue );
+            // never display password of any type to log:
+            LOG.info( "getExternalConfig override name [{}]", GlobalIds.LDAP_ADMIN_POOL_PW );
+        }
+
+        // Check to see if the admin pool min connections has been overridden by a system property:
+        szValue = System.getProperty( EXT_LDAP_ADMIN_POOL_MIN );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.LDAP_ADMIN_POOL_MIN, szValue );
+            LOG.info( PREFIX, GlobalIds.LDAP_ADMIN_POOL_MIN, szValue );
+        }
+
+        // Check to see if the admin pool max connections has been overridden by a system property:
+        szValue = System.getProperty( EXT_LDAP_ADMIN_POOL_MAX );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.LDAP_ADMIN_POOL_MAX, szValue );
+            LOG.info( PREFIX, GlobalIds.LDAP_ADMIN_POOL_MAX, szValue );
+        }
+
+        // Check to see if ssl enabled parameter has been overridden by a system property:
+        szValue = System.getProperty( EXT_ENABLE_LDAP_SSL );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.ENABLE_LDAP_SSL, szValue );
+            LOG.info( PREFIX, GlobalIds.ENABLE_LDAP_SSL, szValue );
+        }
+
+        // Check to see if the ssl debug enabled parameter has been overridden by a system property:
+        szValue = System.getProperty( EXT_ENABLE_LDAP_SSL_DEBUG );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.ENABLE_LDAP_SSL_DEBUG, szValue );
+            LOG.info( PREFIX, GlobalIds.ENABLE_LDAP_SSL_DEBUG, szValue );
+        }
+
+        // Check to see if the trust store location has been overridden by a system property:
+        szValue = System.getProperty( EXT_TRUST_STORE );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.TRUST_STORE, szValue );
+            LOG.info( PREFIX, GlobalIds.TRUST_STORE, szValue );
+        }
+
+        // Check to see if the trust store password has been overridden by a system property:
+        szValue = System.getProperty( EXT_TRUST_STORE_PW );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.TRUST_STORE_PW, szValue );
+            // never display password value to log:
+            LOG.info( "getExternalConfig override name [{}]", GlobalIds.TRUST_STORE_PW );
+        }
+
+        // Check to see if the trust store set parameter has been overridden by a system property:
+        szValue = System.getProperty( EXT_SET_TRUST_STORE_PROP );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.SET_TRUST_STORE_PROP, szValue );
+            LOG.info( PREFIX, GlobalIds.SET_TRUST_STORE_PROP, szValue );
+        }
+
+        // Check to see if the config realm name has been overridden by a system property:
+        szValue = System.getProperty( EXT_CONFIG_REALM );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.CONFIG_REALM, szValue );
+            LOG.info( PREFIX, GlobalIds.CONFIG_REALM, szValue );
+        }
+
+        // Check to see if the config realm name has been overridden by a system property:
+        szValue = System.getProperty( EXT_CONFIG_ROOT_DN );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.CONFIG_ROOT_PARAM, szValue );
+            LOG.info( PREFIX, GlobalIds.CONFIG_ROOT_PARAM, szValue );
+        }
+
+        // Check to see if the ldap server type has been overridden by a system property:
+        szValue = System.getProperty( EXT_SERVER_TYPE  );
+        if( StringUtils.isNotEmpty( szValue ))
+        {
+            config.setProperty( GlobalIds.SERVER_TYPE, szValue );
+            LOG.info( PREFIX, GlobalIds.SERVER_TYPE, szValue );
+        }
+    }
+
+	public PropertiesConfiguration getConfig() {
+		return config;
+	}
+	
+    /**
+     * Gets the prop attribute as String value from the apache commons cfg component.
+     *
+     * @param name contains the name of the property.
+     * @return contains the value associated with the property or null if not not found.
+     */
+    public String getProperty( String name )
+    {
+        String value = null;
+        if ( config != null )
+        {
+            value = ( String ) config.getProperty( name );
+            LOG.debug( "getProperty name [{}] value [{}]", name, value );
+        }
+        else
+        {
+            LOG.error( "getProperty invalid config, can't read prop [{}]", name );
+        }
+        return value;
+    }
+    
+
+    /**
+     * Get the property value from the apache commons config but specify a default value if not found.
+     *
+     * @param name         contains the name of the property.
+     * @param defaultValue specified by client will be returned if property value is not found.
+     * @return contains the value for the property as a String.
+     */
+    public String getProperty( String name, String defaultValue )
+    {
+        String value = null;
+        if ( config != null )
+        {
+            value = ( String ) config.getProperty( name );
+        }
+        else
+        {
+            String warn = "getProperty invalid config, can't read prop [" + name + "]";
+            LOG.warn( warn );
+        }
+        if ( value == null || value.length() == 0 )
+        {
+            value = defaultValue;
+        }
+        return value;
+    }
+    
+    /**
+     * Gets the int attribute of the Config class, or 0 if not found.
+     *
+     * @param key name of the property name.
+     * @return The int value or 0 if not found.
+     */
+    public int getInt( String key )
+    {
+        int value = 0;
+        if ( config != null )
+        {
+            value = config.getInt( key );
+        }
+        else
+        {
+            String warn = "getInt invalid config, can't read prop [" + key + "]";
+            LOG.warn( warn );
+        }
+        return value;
+    }
+
+
+    /**
+     * Gets the int attribute of the Config class or default value if not found.
+     *
+     * @param key          name of the property name.
+     * @param defaultValue to use if property not found.
+     * @return The int value or default value if not found.
+     */
+    public int getInt( String key, int defaultValue )
+    {
+        int value = 0;
+        if ( config != null )
+        {
+            value = config.getInt( key, defaultValue );
+        }
+        else
+        {
+            String warn = "getInt invalid config, can't read prop [" + key + "]";
+            LOG.warn( warn );
+        }
+        return value;
+    }
+
+    /**
+     * Gets the boolean attribute associated with the name or false if not found.
+     *
+     * @param key name of the property name.
+     * @return The boolean value or false if not found.
+     */
+    public boolean getBoolean( String key )
+    {
+        boolean value = false;
+        if ( config != null )
+        {
+            value = config.getBoolean( key );
+        }
+        else
+        {
+            String warn = "getBoolean - invalid config, can't read prop [" + key + "]";
+            LOG.warn( warn );
+        }
+        return value;
+    }
+
+
+    /**
+     * Gets the boolean attribute associated with the name or false if not found.
+     *
+     * @param key          name of the property name.
+     * @param defaultValue specified by client will be returned if property value is not found.
+     * @return The boolean value or false if not found.
+     */
+    public boolean getBoolean( String key, boolean defaultValue )
+    {
+        boolean value = defaultValue;
+        if ( config != null )
+        {
+            value = config.getBoolean( key, defaultValue );
+        }
+        else
+        {
+            String warn = "getBoolean - invalid config, can't read prop [" + key + "]";
+            LOG.warn( warn );
+        }
+        return value;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java b/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
index 95dc7f3..843cf35 100644
--- a/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
@@ -97,7 +97,7 @@ public final class CacheMgr
      * @return reference to cache for specified object.
      */
     public Cache getCache( String cacheName )
-    {
+    {    	
         return CacheFactory.createInstance( cacheName, mEhCacheImpl );
     }
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/d0924b2b/src/main/java/org/apache/directory/fortress/core/util/crypto/EncryptUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/crypto/EncryptUtil.java b/src/main/java/org/apache/directory/fortress/core/util/crypto/EncryptUtil.java
index bf5d516..d2bd30f 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/crypto/EncryptUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/crypto/EncryptUtil.java
@@ -20,6 +20,7 @@
 package org.apache.directory.fortress.core.util.crypto;
 
 import org.apache.directory.fortress.core.util.Config;
+import org.apache.directory.fortress.core.util.LocalConfig;
 import org.jasypt.util.text.BasicTextEncryptor;
 
 /**
@@ -48,7 +49,7 @@ public final class EncryptUtil
     private void init()
     {
         textEncryptor = new BasicTextEncryptor();
-        textEncryptor.setPassword(Config.getInstance().getProperty(CRYPTO_PROP, "adlfarerovcja;39 d"));
+        textEncryptor.setPassword(LocalConfig.getInstance().getProperty(CRYPTO_PROP, "adlfarerovcja;39 d"));
     }
 
     /**
@@ -84,7 +85,7 @@ public final class EncryptUtil
     public static boolean isEnabled()
     {
         boolean result = false;
-        if(Config.getInstance().getProperty(CRYPTO_PROP)!= null && !Config.getInstance().getProperty(CRYPTO_PROP).equals("${crypto.prop}"))
+        if(LocalConfig.getInstance().getProperty(CRYPTO_PROP)!= null && !Config.getInstance().getProperty(CRYPTO_PROP).equals("${crypto.prop}"))
         {
             result = true;
         }