directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cp...@apache.org
Subject [04/15] directory-fortress-core git commit: refactored to not use static initialization blocks
Date Thu, 05 May 2016 13:49:21 GMT
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/GroupDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/GroupDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/GroupDAO.java
index 1bbf25d..7a38421 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/GroupDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/GroupDAO.java
@@ -21,6 +21,9 @@
 package org.apache.directory.fortress.core.impl;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.cursor.CursorException;
@@ -34,24 +37,21 @@ import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.api.ldap.model.message.SearchScope;
-import org.apache.directory.fortress.core.model.Group;
-import org.apache.directory.fortress.core.model.PropUtil;
-import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.fortress.core.CreateException;
 import org.apache.directory.fortress.core.FinderException;
-import org.apache.directory.fortress.core.model.ObjectFactory;
+import org.apache.directory.fortress.core.GlobalErrIds;
+import org.apache.directory.fortress.core.GlobalIds;
+import org.apache.directory.fortress.core.RemoveException;
 import org.apache.directory.fortress.core.UpdateException;
-import org.apache.directory.fortress.core.util.Config;
 import org.apache.directory.fortress.core.ldap.LdapDataProvider;
+import org.apache.directory.fortress.core.model.Group;
+import org.apache.directory.fortress.core.model.ObjectFactory;
+import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.fortress.core.model.User;
+import org.apache.directory.fortress.core.util.Config;
+import org.apache.directory.ldap.client.api.LdapConnection;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.directory.fortress.core.CreateException;
-import org.apache.directory.fortress.core.GlobalErrIds;
-import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.RemoveException;
-
-import java.util.ArrayList;
-import java.util.List;
 
 
 /**
@@ -65,27 +65,33 @@ final class GroupDAO extends LdapDataProvider
     private static final String CLS_NM = GroupDAO.class.getName();
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
     private static final String GROUP_OBJECT_CLASS = "group.objectclass";
-    private static final String GROUP_OBJECT_CLASS_IMPL = Config.getProperty( GROUP_OBJECT_CLASS );
+    private String GROUP_OBJECT_CLASS_IMPL;
     private static final String GROUP_PROTOCOL_ATTR = "group.protocol";
-    private static final String GROUP_PROTOCOL_ATTR_IMPL = Config.getProperty( GROUP_PROTOCOL_ATTR );
+    private String GROUP_PROTOCOL_ATTR_IMPL;
     private static final String GROUP_PROPERTY_ATTR = "group.properties";
-    private static final String GROUP_PROPERTY_ATTR_IMPL = Config.getProperty( GROUP_PROPERTY_ATTR );
-    private static final String GROUP_OBJ_CLASS[] =
-        { SchemaConstants.TOP_OC, GROUP_OBJECT_CLASS_IMPL };
-    private static final String[] GROUP_ATRS =
-        {
-            SchemaConstants.CN_AT,
-            SchemaConstants.DESCRIPTION_AT,
-            GROUP_PROTOCOL_ATTR_IMPL,
-            GROUP_PROPERTY_ATTR_IMPL,
-            SchemaConstants.MEMBER_AT };
-
+    private String GROUP_PROPERTY_ATTR_IMPL;
+    private String[] GROUP_OBJ_CLASS;
+    private String[] GROUP_ATRS;
 
     /**
      * Package private default constructor.
      */
     GroupDAO()
     {
+        super();
+        GROUP_OBJECT_CLASS_IMPL = Config.getInstance().getProperty( GROUP_OBJECT_CLASS );
+        GROUP_PROTOCOL_ATTR_IMPL = Config.getInstance().getProperty( GROUP_PROTOCOL_ATTR );
+        GROUP_PROPERTY_ATTR_IMPL = Config.getInstance().getProperty( GROUP_PROPERTY_ATTR );
+        
+        GROUP_OBJ_CLASS = new String[]{SchemaConstants.TOP_OC, GROUP_OBJECT_CLASS_IMPL };
+        
+        GROUP_ATRS = new String[]
+            {
+                SchemaConstants.CN_AT,
+                SchemaConstants.DESCRIPTION_AT,
+                GROUP_PROTOCOL_ATTR_IMPL,
+                GROUP_PROPERTY_ATTR_IMPL,
+                SchemaConstants.MEMBER_AT };
     }
 
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/GroupMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/GroupMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/GroupMgrImpl.java
index dce47e2..acd2e67 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/GroupMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/GroupMgrImpl.java
@@ -44,8 +44,12 @@ import org.apache.directory.fortress.core.model.User;
 public class GroupMgrImpl extends Manageable implements GroupMgr, Serializable
 {
     private static final String CLS_NM = GroupMgrImpl.class.getName();
-    private static final GroupP GROUP_P = new GroupP();
+    private GroupP GROUP_P;
 
+    public GroupMgrImpl() {
+    	GROUP_P = new GroupP();
+	}
+    
     /**
      * {@inheritDoc}
      */

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/GroupP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/GroupP.java b/src/main/java/org/apache/directory/fortress/core/impl/GroupP.java
index 680c06d..856d201 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/GroupP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/GroupP.java
@@ -20,18 +20,18 @@
 package org.apache.directory.fortress.core.impl;
 
 
+import java.util.List;
+
 import org.apache.directory.api.util.Strings;
+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.ValidationException;
 import org.apache.directory.fortress.core.model.Group;
 import org.apache.directory.fortress.core.model.User;
+import org.apache.directory.fortress.core.util.VUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-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.util.VUtil;
-
-import java.util.List;
 
 
 /**
@@ -44,9 +44,12 @@ final class GroupP
 {
     private static final String CLS_NM = GroupP.class.getName();
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
-    private static GroupDAO gDao = new GroupDAO();
-
+    private GroupDAO gDao;
 
+    public GroupP(){
+    	gDao = new GroupDAO();
+    }
+    
     /**
      * Add a group node to the Directory Information Tree (DIT).
      *

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitDAO.java
index 1ae4ccb..c1e4dc1 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitDAO.java
@@ -40,19 +40,19 @@ import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.api.ldap.model.message.SearchScope;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.util.Strings;
-import org.apache.directory.fortress.core.model.Graphable;
-import org.apache.directory.fortress.core.model.OrgUnit;
-import org.apache.directory.ldap.client.api.LdapConnection;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.directory.fortress.core.CreateException;
 import org.apache.directory.fortress.core.FinderException;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.model.ObjectFactory;
 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.Graphable;
+import org.apache.directory.fortress.core.model.ObjectFactory;
+import org.apache.directory.fortress.core.model.OrgUnit;
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -123,7 +123,10 @@ final class OrgUnitDAO extends LdapDataProvider
             SchemaConstants.OU_AT
     };
 
-
+    public OrgUnitDAO(){
+    	super();
+    }
+    
     /**
      * @param entity
      * @return
@@ -706,13 +709,13 @@ final class OrgUnitDAO extends LdapDataProvider
         {
             entity.setType( OrgUnit.Type.PERM );
             //entity.setParents(PsoUtil.getParents(entity.getName().toUpperCase(), contextId));
-            entity.setChildren( PsoUtil.getChildren( entity.getName().toUpperCase(), contextId ) );
+            entity.setChildren( PsoUtil.getInstance().getChildren( entity.getName().toUpperCase(), contextId ) );
         }
         else if ( dn.contains( getRootDn( contextId, GlobalIds.OSU_ROOT ) ) )
         {
             entity.setType( OrgUnit.Type.USER );
             //entity.setParents(UsoUtil.getParents(entity.getName().toUpperCase(), contextId));
-            entity.setChildren( UsoUtil.getChildren( entity.getName().toUpperCase(), contextId ) );
+            entity.setChildren( UsoUtil.getInstance().getChildren( entity.getName().toUpperCase(), contextId ) );
         }
 
         entity.setParents( getAttributeSet( le, GlobalIds.PARENT_NODES ) );

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitP.java b/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitP.java
index 3c87d7d..4f96316 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/OrgUnitP.java
@@ -26,16 +26,16 @@ import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.directory.fortress.core.model.Graphable;
-import org.apache.directory.fortress.core.model.OrgUnit;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 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.model.Graphable;
+import org.apache.directory.fortress.core.model.OrgUnit;
 import org.apache.directory.fortress.core.util.VUtil;
 import org.apache.directory.fortress.core.util.cache.Cache;
 import org.apache.directory.fortress.core.util.cache.CacheMgr;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -70,13 +70,15 @@ public final class OrgUnitP
     private static Cache ouCache;
 
     // DAO class for OU data sets must be initializer before the other statics:
-    private static final OrgUnitDAO oDao = new OrgUnitDAO();
+    private OrgUnitDAO oDao;
     private static final String USER_OUS = "user.ous";
     private static final String PERM_OUS = "perm.ous";
     private static final String FORTRESS_OUS = "fortress.ous";
 
-    static
+    public void init()
     {
+        oDao = new OrgUnitDAO();
+    	
         CacheMgr cacheMgr = CacheMgr.getInstance();
         OrgUnitP.ouCache = cacheMgr.getCache( FORTRESS_OUS );
     }
@@ -87,6 +89,7 @@ public final class OrgUnitP
      */
     OrgUnitP()
     {
+    	init();
     }
 
 
@@ -143,7 +146,7 @@ public final class OrgUnitP
      * @param orgUnit The orgUnit
      * @return The set of associated User
      */
-    private static Set<String> loadUserSet( OrgUnit orgUnit )
+    private Set<String> loadUserSet( OrgUnit orgUnit )
     {
         Set<String> ouUserSet = null;
 
@@ -168,7 +171,7 @@ public final class OrgUnitP
      * @param orgUnit The orgUnit
      * @return The set of associated Perms
      */
-    private static Set<String> loadPermSet( OrgUnit orgUnit )
+    private Set<String> loadPermSet( OrgUnit orgUnit )
     {
         Set<String> ouPermSet = null;
 
@@ -193,7 +196,7 @@ public final class OrgUnitP
      * @param orgUnit will be a Perm OU.
      * @return Set containing the OU mapping to a Perm type and tenant.
      */
-    private static Set<String> getPermSet( OrgUnit orgUnit )
+    private Set<String> getPermSet( OrgUnit orgUnit )
     {
         @SuppressWarnings("unchecked")
         Set<String> permSet = ( Set<String> ) ouCache.get( getKey( PERM_OUS, orgUnit.getContextId() ) );
@@ -212,7 +215,7 @@ public final class OrgUnitP
      * @param orgUnit will be a User OU
      * @return Set containing the OU mapping to the user type and tenant.
      */
-    private static Set<String> getUserSet( OrgUnit orgUnit )
+    private Set<String> getUserSet( OrgUnit orgUnit )
     {
         @SuppressWarnings("unchecked")
         Set<String> userSet = ( Set<String> ) ouCache.get( getKey( USER_OUS, orgUnit.getContextId() ) );

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/OrganizationalUnitDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/OrganizationalUnitDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/OrganizationalUnitDAO.java
index e6bf4ca..7e53530 100644
--- a/src/main/java/org/apache/directory/fortress/core/impl/OrganizationalUnitDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/OrganizationalUnitDAO.java
@@ -27,14 +27,14 @@ import org.apache.directory.api.ldap.model.entry.DefaultEntry;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.fortress.core.CreateException;
+import org.apache.directory.fortress.core.GlobalErrIds;
+import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.RemoveException;
+import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 import org.apache.directory.fortress.core.model.OrganizationalUnit;
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.directory.fortress.core.GlobalErrIds;
-import org.apache.directory.fortress.core.GlobalIds;
 
 
 /**
@@ -75,6 +75,7 @@ final class OrganizationalUnitDAO extends LdapDataProvider
      */
     OrganizationalUnitDAO()
     {
+    	super();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
index a461aac..bcf7718 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
@@ -42,23 +42,23 @@ import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueEx
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchAttributeException;
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.api.ldap.model.message.SearchScope;
+import org.apache.directory.fortress.core.CreateException;
+import org.apache.directory.fortress.core.FinderException;
+import org.apache.directory.fortress.core.GlobalErrIds;
+import org.apache.directory.fortress.core.GlobalIds;
+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.AdminRole;
+import org.apache.directory.fortress.core.model.ObjectFactory;
 import org.apache.directory.fortress.core.model.OrgUnit;
 import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
+import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.Session;
 import org.apache.directory.fortress.core.model.User;
-import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.fortress.core.CreateException;
-import org.apache.directory.fortress.core.FinderException;
-import org.apache.directory.fortress.core.GlobalErrIds;
-import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.model.ObjectFactory;
-import org.apache.directory.fortress.core.RemoveException;
-import org.apache.directory.fortress.core.UpdateException;
-import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 
 
 /**
@@ -203,7 +203,10 @@ final class PermDAO extends LdapDataProvider
             GlobalIds.PROPS
     };
 
-
+    public PermDAO(){
+        super();
+    }
+    
     /**
      * @param entity
      * @return
@@ -917,7 +920,7 @@ final class PermDAO extends LdapDataProvider
         throws FinderException
     {
         // Audit can be turned off here with fortress config param: 'disable.audit=true'
-        if ( GlobalIds.IS_OPENLDAP && ! GlobalIds.IS_AUDIT_DISABLED )
+        if ( GlobalIds.getInstance().IS_OPENLDAP && ! GlobalIds.getInstance().IS_AUDIT_DISABLED )
         {
             try
             {
@@ -985,7 +988,7 @@ final class PermDAO extends LdapDataProvider
             else
             {
                 // RBAC Permission check include's User's inherited roles:
-                Set<String> activatedRoles = RoleUtil.getInheritedRoles( session.getRoles(), permission.getContextId() );
+                Set<String> activatedRoles = RoleUtil.getInstance().getInheritedRoles( session.getRoles(), permission.getContextId() );
 
                 for ( String role : roles )
                 {
@@ -1385,7 +1388,7 @@ final class PermDAO extends LdapDataProvider
                 }
                 else
                 {
-                    roles = RoleUtil.getAscendants( role.getName(), role.getContextId() );
+                    roles = RoleUtil.getInstance().getAscendants( role.getName(), role.getContextId() );
                 }
             }
             if ( CollectionUtils.isNotEmpty( roles ) )
@@ -1461,7 +1464,7 @@ final class PermDAO extends LdapDataProvider
             filterbuf.append( GlobalIds.FILTER_PREFIX );
             filterbuf.append( PERM_OP_OBJECT_CLASS_NAME );
             filterbuf.append( ")(|" );
-            Set<String> roles = RoleUtil.getInheritedRoles( user.getRoles(), user.getContextId() );
+            Set<String> roles = RoleUtil.getInstance().getInheritedRoles( user.getRoles(), user.getContextId() );
 
             if ( CollectionUtils.isNotEmpty( roles ) )
             {
@@ -1594,7 +1597,7 @@ final class PermDAO extends LdapDataProvider
             }
             else
             {
-                roles = RoleUtil.getInheritedRoles( session.getRoles(), session.getContextId() );
+                roles = RoleUtil.getInstance().getInheritedRoles( session.getRoles(), session.getContextId() );
             }
             if ( CollectionUtils.isNotEmpty( roles ) )
             {

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/PermP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PermP.java b/src/main/java/org/apache/directory/fortress/core/impl/PermP.java
index d806b60..fa39098 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PermP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PermP.java
@@ -62,8 +62,8 @@ final class PermP
     /**
      * Description of the Field
      */
-    private static final PermDAO pDao = new PermDAO();
-    private final OrgUnitP orgUnitP = new OrgUnitP();
+    private PermDAO pDao;
+    private OrgUnitP orgUnitP;
 
 
     /**
@@ -71,6 +71,8 @@ final class PermP
      */
     PermP()
     {
+        pDao = new PermDAO();
+        orgUnitP = new OrgUnitP();
     }
 
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/PolicyDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PolicyDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/PolicyDAO.java
index 2e4c15d..c58c4a5 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PolicyDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PolicyDAO.java
@@ -38,16 +38,16 @@ import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.api.ldap.model.message.SearchScope;
-import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.fortress.core.CreateException;
 import org.apache.directory.fortress.core.FinderException;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.model.ObjectFactory;
 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.ObjectFactory;
 import org.apache.directory.fortress.core.model.PwPolicy;
+import org.apache.directory.ldap.client.api.LdapConnection;
 
 
 /**
@@ -143,6 +143,9 @@ final class PolicyDAO extends LdapDataProvider
             SchemaConstants.CN_AT
     };
 
+    public PolicyDAO(){
+        super();
+    }
 
     /**
      * @param entity

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/PolicyP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PolicyP.java b/src/main/java/org/apache/directory/fortress/core/impl/PolicyP.java
index 827e758..83e82f6 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PolicyP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PolicyP.java
@@ -26,15 +26,15 @@ import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.directory.fortress.core.model.PwPolicy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 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.ValidationException;
+import org.apache.directory.fortress.core.model.PwPolicy;
 import org.apache.directory.fortress.core.util.cache.Cache;
 import org.apache.directory.fortress.core.util.cache.CacheMgr;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -63,7 +63,7 @@ final class PolicyP
     private static final int MAX_AGE = 157680000;
 
     // DAO class for ol pw policy data sets must be initialized before the other statics:
-    private static final PolicyDAO olDao = new PolicyDAO();
+    private PolicyDAO olDao;
     // this field is used to synchronize access to the above static data set:
     private static final ReadWriteLock policySetLock = new ReentrantReadWriteLock();
     // static field holds the list of names for all valid pw policies in effect:
@@ -75,8 +75,10 @@ final class PolicyP
     private static final String POLICIES = "policies";
     private static final String FORTRESS_POLICIES = "fortress.policies";
 
-    static
+    private void init()
     {
+    	olDao = new PolicyDAO();
+    	
         CacheMgr cacheMgr = CacheMgr.getInstance();
         PolicyP.policyCache = cacheMgr.getCache( FORTRESS_POLICIES );
     }
@@ -87,6 +89,7 @@ final class PolicyP
      */
     PolicyP()
     {
+    	init();
     }
 
 
@@ -371,7 +374,7 @@ final class PolicyP
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return Set of unique names.
      */
-    private static Set<String> loadPolicySet( String contextId )
+    private Set<String> loadPolicySet( String contextId )
     {
         Set<String> policySet = null;
 
@@ -396,7 +399,7 @@ final class PolicyP
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return set containing list of policy names active.
      */
-    private static Set<String> getPolicySet( String contextId )
+    private Set<String> getPolicySet( String contextId )
     {
         try
         {

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/PsoUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PsoUtil.java b/src/main/java/org/apache/directory/fortress/core/impl/PsoUtil.java
index 6145818..6c4618b 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PsoUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PsoUtil.java
@@ -63,19 +63,38 @@ import org.slf4j.LoggerFactory;
  */
 final class PsoUtil
 {
-    private static final Cache psoCache;
-    private static OrgUnitP orgUnitP = new OrgUnitP();
+    private Cache psoCache;
+    private OrgUnitP orgUnitP;
     private static final String CLS_NM = PsoUtil.class.getName();
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
 
+    private static volatile PsoUtil INSTANCE = null; 
+
+    public static PsoUtil getInstance() {
+        if(INSTANCE == null) {
+            synchronized (PsoUtil.class) {
+                if(INSTANCE == null){
+        	        INSTANCE = new PsoUtil();
+                }
+            }
+        }
+        return INSTANCE;
+    }
+    
+    public PsoUtil(){
+        init();
+    }
+    
     /**
      * Initialize the Perm OU hierarchies.  This will read the {@link org.apache.directory.fortress.core.model.Hier} data set from ldap and load into
      * the JGraphT simple digraph that referenced statically within this class.
      */
-    static
+    private void init()
     {
+        orgUnitP = new OrgUnitP();
+    	
         CacheMgr cacheMgr = CacheMgr.getInstance();
-        psoCache = cacheMgr.getCache( "fortress.pso" );
+        psoCache = cacheMgr.getCache( "fortress.pso" );                
     }
 
 
@@ -86,7 +105,7 @@ final class PsoUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return Set of names of descendants {@link org.apache.directory.fortress.core.model.OrgUnit}s of given parent.
      */
-    static Set<String> getDescendants( String name, String contextId )
+    Set<String> getDescendants( String name, String contextId )
     {
         return HierUtil.getDescendants( name, getGraph( contextId ) );
     }
@@ -99,7 +118,7 @@ final class PsoUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return Set of ou names that are ascendants of given child.
      */
-    static Set<String> getAscendants( String name, String contextId )
+    Set<String> getAscendants( String name, String contextId )
     {
         return HierUtil.getAscendants( name, getGraph( contextId ) );
     }
@@ -112,7 +131,7 @@ final class PsoUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return Set of names of children {@link org.apache.directory.fortress.core.model.OrgUnit}s of given parent.
      */
-    public static Set<String> getChildren( String name, String contextId )
+    public Set<String> getChildren( String name, String contextId )
     {
         return HierUtil.getChildren( name, getGraph( contextId ) );
     }
@@ -125,7 +144,7 @@ final class PsoUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return Set of ou names that are parents of given child.
      */
-    static Set<String> getParents( String name, String contextId )
+    Set<String> getParents( String name, String contextId )
     {
         return HierUtil.getParents( name, getGraph( contextId ) );
     }
@@ -138,7 +157,7 @@ final class PsoUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return int value contains the number of children of a given parent ou.
      */
-    static int numChildren( String name, String contextId )
+    int numChildren( String name, String contextId )
     {
         return HierUtil.numChildren( name, getGraph( contextId ) );
     }
@@ -151,7 +170,7 @@ final class PsoUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return contains Set of all descendants.
      */
-    static Set<String> getInherited( List<OrgUnit> ous, String contextId )
+    Set<String> getInherited( List<OrgUnit> ous, String contextId )
     {
         // create Set with case insensitive comparator:
         Set<String> iOUs = new TreeSet<>( String.CASE_INSENSITIVE_ORDER );
@@ -190,7 +209,7 @@ final class PsoUtil
      * @throws org.apache.directory.fortress.core.ValidationException
      *          in the event it fails one of the 3 checks.
      */
-    static void validateRelationship( OrgUnit child, OrgUnit parent, boolean mustExist )
+    void validateRelationship( OrgUnit child, OrgUnit parent, boolean mustExist )
         throws ValidationException
     {
         HierUtil.validateRelationship( getGraph( child.getContextId() ), child.getName(), parent.getName(), mustExist );
@@ -206,7 +225,7 @@ final class PsoUtil
      * @param op   used to pass the ldap op {@link org.apache.directory.fortress.core.model.Hier.Op#ADD}, {@link org.apache.directory.fortress.core.model.Hier.Op#MOD}, {@link org.apache.directory.fortress.core.model.Hier.Op#REM}
      * @throws org.apache.directory.fortress.core.SecurityException in the event of a system error.
      */
-    static void updateHier( String contextId, Relationship relationship, Hier.Op op ) throws SecurityException
+    void updateHier( String contextId, Relationship relationship, Hier.Op op ) throws SecurityException
     {
         HierUtil.updateHier( getGraph( contextId ), relationship, op );
     }
@@ -219,7 +238,7 @@ final class PsoUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return handle to simple digraph containing perm ou hierarchies.
      */
-    private static synchronized SimpleDirectedGraph<String, Relationship> loadGraph( String contextId )
+    private synchronized SimpleDirectedGraph<String, Relationship> loadGraph( String contextId )
     {
         Hier inHier = new Hier( Hier.Type.ROLE );
         inHier.setContextId( contextId );
@@ -252,7 +271,7 @@ final class PsoUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return handle to simple digraph containing perm ou hierarchies.
      */
-    private static SimpleDirectedGraph<String, Relationship> getGraph( String contextId )
+    private SimpleDirectedGraph<String, Relationship> getGraph( String contextId )
     {
         String key = getKey( contextId );        
         LOG.debug("Getting graph for key " + contextId);

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/PwPolicyMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PwPolicyMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/PwPolicyMgrImpl.java
index 0c7746a..b936a7a 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PwPolicyMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PwPolicyMgrImpl.java
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.fortress.core.impl;
 
+import java.util.List;
+
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.PwPolicyMgr;
 import org.apache.directory.fortress.core.SecurityException;
@@ -26,8 +28,6 @@ import org.apache.directory.fortress.core.model.PwPolicy;
 import org.apache.directory.fortress.core.model.User;
 import org.apache.directory.fortress.core.util.VUtil;
 
-import java.util.List;
-
 /**
  * This class is used to perform administrative and review functions on the PWPOLICIES and USERS data sets.
  * <h3></h3>
@@ -66,9 +66,14 @@ import java.util.List;
 public class PwPolicyMgrImpl  extends Manageable implements PwPolicyMgr
 {
     private static final String CLS_NM = PwPolicyMgrImpl.class.getName();
-    private static final PolicyP policyP = new PolicyP();
-    private static final UserP userP = new UserP();
-
+    private PolicyP policyP;
+    private UserP userP;
+
+    public PwPolicyMgrImpl() {
+    	policyP = new PolicyP();
+    	userP = new UserP();
+	}
+    
     /**
      * {@inheritDoc}
      */

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/ReviewMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ReviewMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/ReviewMgrImpl.java
index 88882e6..1600d17 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ReviewMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ReviewMgrImpl.java
@@ -80,11 +80,18 @@ import org.apache.directory.fortress.core.util.VUtil;
 public class ReviewMgrImpl extends Manageable implements ReviewMgr, Serializable
 {
     private static final String CLS_NM = ReviewMgrImpl.class.getName();
-    private static final UserP userP = new UserP();
-    private static final RoleP roleP = new RoleP();
-    private static final PermP permP = new PermP();
-    private static final SdP ssdP = new SdP();
-
+    private UserP userP = new UserP();
+    private RoleP roleP = new RoleP();
+    private PermP permP = new PermP();
+    private SdP ssdP = new SdP();
+
+    public ReviewMgrImpl() {
+        userP = new UserP();
+        roleP = new RoleP();
+        permP = new PermP();
+        ssdP = new SdP();
+	}
+    
     /**
      * {@inheritDoc}
      */
@@ -376,7 +383,7 @@ public class ReviewMgrImpl extends Manageable implements ReviewMgr, Serializable
         Set<String> iRoles = null;
         if (CollectionUtils.isNotEmpty( roles ))
         {
-            iRoles = RoleUtil.getInheritedRoles( roles, this.contextId );
+            iRoles = RoleUtil.getInstance().getInheritedRoles( roles, this.contextId );
         }
         return iRoles;
     }
@@ -529,7 +536,7 @@ public class ReviewMgrImpl extends Manageable implements ReviewMgr, Serializable
         if (assignedRoles != null)
         {
             // Get the descendant roles of all assigned roles from jgrapht hierarchical roles data set:
-            authorizedRoles = RoleUtil.getDescendantRoles(assignedRoles, this.contextId);
+            authorizedRoles = RoleUtil.getInstance().getDescendantRoles(assignedRoles, this.contextId);
         }
         return authorizedRoles;
     }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
index d942ad5..e21e916 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
@@ -36,18 +36,18 @@ import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.api.ldap.model.message.SearchScope;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
-import org.apache.directory.fortress.core.model.Graphable;
-import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.fortress.core.CreateException;
 import org.apache.directory.fortress.core.FinderException;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.model.ObjectFactory;
 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.ConstraintUtil;
+import org.apache.directory.fortress.core.model.Graphable;
+import org.apache.directory.fortress.core.model.ObjectFactory;
 import org.apache.directory.fortress.core.model.Role;
+import org.apache.directory.ldap.client.api.LdapConnection;
 
 
 /**
@@ -130,7 +130,10 @@ final class RoleDAO extends LdapDataProvider
             GlobalIds.FT_MODIFIER_AUX_OBJECT_CLASS_NAME
     };
 
-
+    public RoleDAO() {
+        super();
+	}
+    
     /**
      * @param entity
      * @return
@@ -648,7 +651,7 @@ final class RoleDAO extends LdapDataProvider
         entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
         entity.setOccupants( getAttributes( le, SchemaConstants.ROLE_OCCUPANT_AT ) );
         //entity.setParents(RoleUtil.getParents(entity.getName().toUpperCase(), contextId));
-        entity.setChildren( RoleUtil.getChildren( entity.getName().toUpperCase(), contextId ) );
+        entity.setChildren( RoleUtil.getInstance().getChildren( entity.getName().toUpperCase(), contextId ) );
         entity.setParents( getAttributeSet( le, GlobalIds.PARENT_NODES ) );
         unloadTemporal( le, entity );
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/RoleP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/RoleP.java b/src/main/java/org/apache/directory/fortress/core/impl/RoleP.java
index fccc075..da01dbb 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/RoleP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/RoleP.java
@@ -56,7 +56,7 @@ import org.apache.directory.fortress.core.util.VUtil;
  */
 final class RoleP
 {
-    private static RoleDAO rDao = new RoleDAO();
+    private RoleDAO rDao;
     private static final ConstraintValidator constraintValidator = VUtil.getConstraintValidator();
 
 
@@ -65,6 +65,7 @@ final class RoleP
      */
     RoleP()
     {
+    	rDao = new RoleDAO();
     }
 
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java b/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
index cf7052c..f966f3b 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/RoleUtil.java
@@ -64,17 +64,36 @@ import org.slf4j.LoggerFactory;
  */
 final class RoleUtil implements ParentUtil
 {
-    private static final Cache roleCache;
-    private static final RoleP roleP = new RoleP();
+    private Cache roleCache;
+    private RoleP roleP = new RoleP();
     private static final String CLS_NM = RoleUtil.class.getName();
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
 
+    private static volatile RoleUtil INSTANCE = null; 
+
+    public static RoleUtil getInstance() {
+        if(INSTANCE == null) {
+            synchronized (RoleUtil.class) {
+                if(INSTANCE == null){
+        	        INSTANCE = new RoleUtil();
+                }
+            }
+        }
+        return INSTANCE;
+    }
+    
+    public RoleUtil(){
+        init();
+    }
+    
     /**
      * Initialize the Role hierarchies.  This will read the {@link org.apache.directory.fortress.core.model.Hier} data set from ldap and load into
      * the JGraphT simple digraph that referenced statically within this class.
      */
-    static
+    private void init()
     {
+    	roleP = new RoleP();
+    	
         CacheMgr cacheMgr = CacheMgr.getInstance();
         roleCache = cacheMgr.getCache( "fortress.roles" );
     }
@@ -97,7 +116,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return boolean result, 'true' indicates parent/child relationship exists.
      */
-    static boolean isParent( String child, String parent, String contextId )
+    boolean isParent( String child, String parent, String contextId )
     {
         boolean result = false;
         Set<String> parents = getAscendants( child, contextId );
@@ -116,7 +135,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return Set of Role names are descendants {@link org.apache.directory.fortress.core.model.Role}s of given parent.
      */
-    static Set<String> getDescendants( String roleName, String contextId )
+    Set<String> getDescendants( String roleName, String contextId )
     {
         return HierUtil.getDescendants( roleName.toUpperCase(), getGraph( contextId ) );
     }
@@ -129,7 +148,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return Set of Role names are children {@link org.apache.directory.fortress.core.model.Role}s of given parent.
      */
-    static Set<String> getChildren( String roleName, String contextId )
+    Set<String> getChildren( String roleName, String contextId )
     {
         return HierUtil.getChildren( roleName.toUpperCase(), getGraph( contextId ) );
     }
@@ -142,7 +161,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return Set of Role names that are ascendants of given child.
      */
-    static Set<String> getAscendants( String roleName, String contextId )
+    Set<String> getAscendants( String roleName, String contextId )
     {
         return HierUtil.getAscendants( roleName.toUpperCase(), getGraph( contextId ) );
     }
@@ -155,7 +174,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return Set of Role names that are parents of given child.
      */
-    static Set<String> getParents( String roleName, String contextId )
+    Set<String> getParents( String roleName, String contextId )
     {
         return HierUtil.getParents( roleName.toUpperCase(), getGraph( contextId ) );
     }
@@ -181,7 +200,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return int value contains the number of children of a given parent nRole.
      */
-    static int numChildren( String roleName, String contextId )
+    int numChildren( String roleName, String contextId )
     {
         return HierUtil.numChildren( roleName.toUpperCase(), getGraph( contextId ) );
     }
@@ -195,7 +214,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return contains Set of all authorized RBAC Roles for a given User.
      */
-    static Set<String> getInheritedRoles( List<UserRole> uRoles, String contextId )
+    Set<String> getInheritedRoles( List<UserRole> uRoles, String contextId )
     {
         // create Set with case insensitive comparator:
         Set<String> iRoles = new TreeSet<>( String.CASE_INSENSITIVE_ORDER );
@@ -222,7 +241,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return set of ascendant roles associated with this entry.
      */
-    static Set<String> getAscendantRoles( List<String> roles, String contextId )
+    Set<String> getAscendantRoles( List<String> roles, String contextId )
     {
         // create Set with case insensitive comparator:
         Set<String> iRoles = new TreeSet<>( String.CASE_INSENSITIVE_ORDER );
@@ -248,7 +267,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return set of descendant roles associated with this entry.
      */
-    static Set<String> getDescendantRoles( Set<String> roles, String contextId )
+    Set<String> getDescendantRoles( Set<String> roles, String contextId )
     {
         // create Set with case insensitive comparator:
         Set<String> iRoles = new TreeSet<>( String.CASE_INSENSITIVE_ORDER );
@@ -277,7 +296,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return Set of names that are parents of given child.
      */
-    static Set<String> getAscendants( String childName, String parentName, boolean isInclusive, String contextId )
+    Set<String> getAscendants( String childName, String parentName, boolean isInclusive, String contextId )
     {
         return HierUtil.getAscendants( childName, parentName, isInclusive, getGraph( contextId ) );
     }
@@ -300,7 +319,7 @@ final class RoleUtil implements ParentUtil
      * @throws org.apache.directory.fortress.core.ValidationException
      *          in the event it fails one of the 3 checks.
      */
-    static void validateRelationship( Role childRole, Role parentRole, boolean mustExist )
+    void validateRelationship( Role childRole, Role parentRole, boolean mustExist )
         throws ValidationException
     {
         HierUtil.validateRelationship( getGraph( childRole.getContextId() ), childRole.getName(), parentRole.getName(),
@@ -317,7 +336,7 @@ final class RoleUtil implements ParentUtil
      * @param op   used to pass the ldap op {@link org.apache.directory.fortress.core.model.Hier.Op#ADD}, {@link org.apache.directory.fortress.core.model.Hier.Op#MOD}, {@link org.apache.directory.fortress.core.model.Hier.Op#REM}
      * @throws org.apache.directory.fortress.core.SecurityException in the event of a system error.
      */
-    static void updateHier( String contextId, Relationship relationship, Hier.Op op ) throws SecurityException
+    void updateHier( String contextId, Relationship relationship, Hier.Op op ) throws SecurityException
     {
         HierUtil.updateHier( getGraph( contextId ), relationship, op );
     }
@@ -330,7 +349,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return handle to simple digraph containing role hierarchies.
      */
-    private static synchronized SimpleDirectedGraph<String, Relationship> loadGraph( String contextId )
+    private synchronized SimpleDirectedGraph<String, Relationship> loadGraph( String contextId )
     {
         Hier inHier = new Hier( Hier.Type.ROLE );
         inHier.setContextId( contextId );
@@ -361,7 +380,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return key to this tenant's cache entry.
      */
-    private static String getKey( String contextId )
+    private String getKey( String contextId )
     {
         String key = HierUtil.Type.ROLE.toString();
 
@@ -379,7 +398,7 @@ final class RoleUtil implements ParentUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return handle to simple digraph containing role hierarchies.
      */
-    private static SimpleDirectedGraph<String, Relationship> getGraph( String contextId )
+    private SimpleDirectedGraph<String, Relationship> getGraph( String contextId )
     {
         String key = getKey( contextId );        
         LOG.debug("Getting graph for key " + contextId);

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/SDUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/SDUtil.java b/src/main/java/org/apache/directory/fortress/core/impl/SDUtil.java
index 7986f68..635e62b 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/SDUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/SDUtil.java
@@ -19,33 +19,33 @@
  */
 package org.apache.directory.fortress.core.impl;
 
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sf.ehcache.search.Attribute;
+import net.sf.ehcache.search.Query;
+import net.sf.ehcache.search.Result;
+import net.sf.ehcache.search.Results;
+
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
+import org.apache.directory.fortress.core.ReviewMgr;
 import org.apache.directory.fortress.core.ReviewMgrFactory;
 import org.apache.directory.fortress.core.SecurityException;
-import org.apache.directory.fortress.core.ReviewMgr;
-import org.apache.directory.fortress.core.util.Config;
+import org.apache.directory.fortress.core.model.Constraint;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.SDSet;
 import org.apache.directory.fortress.core.model.Session;
 import org.apache.directory.fortress.core.model.User;
 import org.apache.directory.fortress.core.model.UserRole;
+import org.apache.directory.fortress.core.util.Config;
 import org.apache.directory.fortress.core.util.cache.Cache;
 import org.apache.directory.fortress.core.util.cache.CacheMgr;
 import org.apache.directory.fortress.core.util.cache.DsdCacheEntry;
-import org.apache.directory.fortress.core.model.Constraint;
-
-import net.sf.ehcache.search.Attribute;
-import net.sf.ehcache.search.Query;
-import net.sf.ehcache.search.Result;
-import net.sf.ehcache.search.Results;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
 
 /**
  * This utilty provides functionality necessary for SSD and DSD processing and cannot be called by components outside fortress.
@@ -58,18 +58,33 @@ import java.util.Set;
  */
 final class SDUtil
 {
-    private static final Cache m_dsdCache;
+    private Cache m_dsdCache;
     private static final String FORTRESS_DSDS = "fortress.dsd";
-    private static final Cache m_ssdCache;
+    private Cache m_ssdCache;
     private static final String FORTRESS_SSDS = "fortress.ssd";
-    private static final SdP sp = new SdP();
+    private SdP sp;
     private static final String IS_DSD_CACHE_DISABLED_PARM = "enable.dsd.cache";
     private static final String DSD_NAME = "name";
     private static final String EMPTY_ELEMENT = "empty";
     private static final String CONTEXT_ID = "contextId";
 
-    static
+    private static volatile SDUtil INSTANCE = null; 
+
+    public static SDUtil getInstance() {
+        if(INSTANCE == null) {
+            synchronized (SDUtil.class) {
+                if(INSTANCE == null){
+        	        INSTANCE = new SDUtil();
+                }
+            }
+        }
+        return INSTANCE;
+    }
+    
+    private void init()
     {
+        sp = new SdP();
+    	
         // Get a reference to the CacheManager Singleton object:
         CacheMgr cacheMgr = CacheMgr.getInstance();
         // This cache contains a wrapper entry for DSD and is searchable by both DSD and Role name:
@@ -82,8 +97,9 @@ final class SDUtil
      * Private constructor
      *
      */
-    private SDUtil()
+    private SDUtil()    
     {
+        init();
     }
 
     /**
@@ -94,7 +110,7 @@ final class SDUtil
      * @throws org.apache.directory.fortress.core.SecurityException
      *
      */
-    static void validateSSD(UserRole uRole)
+    void validateSSD(UserRole uRole)
         throws SecurityException
     {
         validateSSD(new User(uRole.getUserId()), new Role(uRole.getName()));
@@ -109,7 +125,7 @@ final class SDUtil
      * @throws org.apache.directory.fortress.core.SecurityException
      *
      */
-    static void validateSSD(User user, Role role)
+    void validateSSD(User user, Role role)
         throws SecurityException
     {
         int matchCount;
@@ -156,7 +172,7 @@ final class SDUtil
      * @throws org.apache.directory.fortress.core.SecurityException
      *
      */
-    static void validateDSD(Session session, Constraint role)
+    void validateDSD(Session session, Constraint role)
         throws SecurityException
     {
         // get all activated roles from user's session:
@@ -198,7 +214,7 @@ final class SDUtil
                 else // Check the parents of activated role for DSD match:
                 {
                     // Now pull the activated role's list of parents.
-                    Set<String> parentSet = RoleUtil.getAscendants(actRole.getName(), session.getContextId());
+                    Set<String> parentSet = RoleUtil.getInstance().getAscendants(actRole.getName(), session.getContextId());
 
                     // Iterate over the list of parent roles:
                     for (String parentRole : parentSet)
@@ -228,7 +244,7 @@ final class SDUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.     *
      * @throws SecurityException in the event of system or rule violation.
      */
-    static void clearDsdCacheEntry(String name, String contextId)
+    void clearDsdCacheEntry(String name, String contextId)
     {
         Attribute<String> context = m_dsdCache.getSearchAttribute(CONTEXT_ID);
         Attribute<String> dsdName = m_dsdCache.getSearchAttribute(DSD_NAME);
@@ -251,7 +267,7 @@ final class SDUtil
      * @return un-ordered set of matching DSD's.
      * @throws SecurityException in the event of system or rule violation.
      */
-    private static Set<SDSet> getDsdCache(String name, String contextId)
+    private Set<SDSet> getDsdCache(String name, String contextId)
         throws SecurityException
     {
         contextId = getContextId(contextId);
@@ -294,7 +310,7 @@ final class SDUtil
      * @return un-ordered set of matching DSD's.
      * @throws SecurityException in the event of system or rule violation.
      */
-    static Set<SDSet> getDsdCache(Set<String> authorizedRoleSet, String contextId)
+    Set<SDSet> getDsdCache(Set<String> authorizedRoleSet, String contextId)
         throws SecurityException
     {
         contextId = getContextId(contextId);
@@ -305,7 +321,7 @@ final class SDUtil
             return dsdRetSets;
         }
         // Was the DSD Cache switched off?
-        boolean isCacheDisabled = Config.getBoolean(IS_DSD_CACHE_DISABLED_PARM, false);
+        boolean isCacheDisabled = Config.getInstance().getBoolean(IS_DSD_CACHE_DISABLED_PARM, false);
         // If so, get DSD's from LDAP:
         if (isCacheDisabled)
         {
@@ -357,7 +373,7 @@ final class SDUtil
      * @return List of DSD's who have matching Role members.
      * @throws SecurityException in the event of system or rule violation.
      */
-    private static Set<SDSet> putDsdCache(Set<String> authorizedRoleSet, String contextId)
+    private Set<SDSet> putDsdCache(Set<String> authorizedRoleSet, String contextId)
         throws SecurityException
     {
         contextId = getContextId(contextId);
@@ -415,7 +431,7 @@ final class SDUtil
      * @return Set of DSD's who have matching Role member.
      * @throws SecurityException in the event of system or rule violation.
      */
-    private static Set<SDSet> putDsdCache(String roleName, String contextId)
+    private Set<SDSet> putDsdCache(String roleName, String contextId)
         throws SecurityException
     {
         contextId = getContextId(contextId);
@@ -465,7 +481,7 @@ final class SDUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @throws SecurityException in the event of system or rule violation.
      */
-    static void clearSsdCacheEntry(String name, String contextId)
+    void clearSsdCacheEntry(String name, String contextId)
     {
         contextId = getContextId(contextId);
         m_ssdCache.clear(getKey(name, contextId));
@@ -479,7 +495,7 @@ final class SDUtil
      * @return List of SSD's who have matching Role member.
      * @throws SecurityException in the event of system or rule violation.
      */
-    private static List<SDSet> putSsdCache(String name, String contextId)
+    private List<SDSet> putSsdCache(String name, String contextId)
         throws SecurityException
     {
         Role role = new Role(name);
@@ -497,7 +513,7 @@ final class SDUtil
      * @return List of SSD's who have matching Role member.
      * @throws SecurityException in the event of system or rule violation.
      */
-    private static List<SDSet> getSsdCache(String name, String contextId)
+    private List<SDSet> getSsdCache(String name, String contextId)
         throws SecurityException
     {
         List<SDSet> ssdSets = (List<SDSet>) m_ssdCache.get(getKey(name, contextId));

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/SdDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/SdDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/SdDAO.java
index 53bb1a7..7ed5ad7 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/SdDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/SdDAO.java
@@ -39,17 +39,17 @@ import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.api.ldap.model.message.SearchScope;
-import org.apache.directory.fortress.core.model.SDSet;
-import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.fortress.core.CreateException;
 import org.apache.directory.fortress.core.FinderException;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.model.ObjectFactory;
 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.ObjectFactory;
 import org.apache.directory.fortress.core.model.Role;
+import org.apache.directory.fortress.core.model.SDSet;
+import org.apache.directory.ldap.client.api.LdapConnection;
 
 
 /**
@@ -137,6 +137,9 @@ final class SdDAO extends LdapDataProvider
             GlobalIds.FT_IID, SD_SET_NM, SchemaConstants.DESCRIPTION_AT, ROLES, SD_SET_CARDINALITY
     };
 
+    public SdDAO() {
+        super();
+	}
 
     /**
      * @param entity
@@ -448,7 +451,7 @@ final class SdDAO extends LdapDataProvider
             filterbuf.append( ")(" );
 
             // Include any parents target role may have:
-            Set<String> roles = RoleUtil.getAscendants( role.getName(), role.getContextId() );
+            Set<String> roles = RoleUtil.getInstance().getAscendants( role.getName(), role.getContextId() );
 
             if ( CollectionUtils.isNotEmpty( roles ) )
             {

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/SdP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/SdP.java b/src/main/java/org/apache/directory/fortress/core/impl/SdP.java
index e4362f0..594a1e0 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/SdP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/SdP.java
@@ -58,7 +58,7 @@ public final class SdP
     /**
      * Get the DAO created:
      */
-    private static final SdDAO sdDao = new SdDAO();
+    private SdDAO sdDao;
 
 
     /**
@@ -66,6 +66,7 @@ public final class SdP
      */
     SdP()
     {
+    	sdDao = new SdDAO();
     }
 
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/SuffixDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/SuffixDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/SuffixDAO.java
index d6f4ba8..5ddd3e5 100644
--- a/src/main/java/org/apache/directory/fortress/core/impl/SuffixDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/SuffixDAO.java
@@ -26,14 +26,14 @@ import org.apache.directory.api.ldap.model.cursor.CursorException;
 import org.apache.directory.api.ldap.model.entry.DefaultEntry;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.fortress.core.CreateException;
+import org.apache.directory.fortress.core.GlobalErrIds;
+import org.apache.directory.fortress.core.RemoveException;
+import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 import org.apache.directory.fortress.core.model.Suffix;
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.directory.fortress.core.CreateException;
-import org.apache.directory.fortress.core.GlobalErrIds;
-import org.apache.directory.fortress.core.RemoveException;
 
 
 /**
@@ -80,6 +80,7 @@ final class SuffixDAO extends LdapDataProvider
      */
     SuffixDAO()
     {
+        super();
     }
 
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
index eed8bb4..c547fc5 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
@@ -49,10 +49,21 @@ import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.api.ldap.model.message.BindResponse;
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.api.ldap.model.message.SearchScope;
+import org.apache.directory.fortress.core.CreateException;
+import org.apache.directory.fortress.core.FinderException;
+import org.apache.directory.fortress.core.GlobalErrIds;
+import org.apache.directory.fortress.core.GlobalIds;
+import org.apache.directory.fortress.core.PasswordException;
+import org.apache.directory.fortress.core.RemoveException;
+import org.apache.directory.fortress.core.SecurityException;
+import org.apache.directory.fortress.core.UpdateException;
+import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 import org.apache.directory.fortress.core.model.Address;
 import org.apache.directory.fortress.core.model.AdminRole;
 import org.apache.directory.fortress.core.model.ConstraintUtil;
+import org.apache.directory.fortress.core.model.ObjectFactory;
 import org.apache.directory.fortress.core.model.OrgUnit;
+import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.fortress.core.model.PwMessage;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.Session;
@@ -60,21 +71,10 @@ import org.apache.directory.fortress.core.model.User;
 import org.apache.directory.fortress.core.model.UserAdminRole;
 import org.apache.directory.fortress.core.model.UserRole;
 import org.apache.directory.fortress.core.model.Warning;
-import org.apache.directory.fortress.core.model.PropUtil;
+import org.apache.directory.fortress.core.util.Config;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.directory.fortress.core.CreateException;
-import org.apache.directory.fortress.core.FinderException;
-import org.apache.directory.fortress.core.GlobalErrIds;
-import org.apache.directory.fortress.core.GlobalIds;
-import org.apache.directory.fortress.core.model.ObjectFactory;
-import org.apache.directory.fortress.core.PasswordException;
-import org.apache.directory.fortress.core.RemoveException;
-import org.apache.directory.fortress.core.SecurityException;
-import org.apache.directory.fortress.core.UpdateException;
-import org.apache.directory.fortress.core.util.Config;
-import org.apache.directory.fortress.core.ldap.LdapDataProvider;
 
 
 /**
@@ -163,14 +163,9 @@ final class UserDAO extends LdapDataProvider
 
     // The Fortress User entity attributes are stored within standard LDAP object classes along with custom auxiliary
     // object classes:
-    private static final String USER_OBJ_CLASS[] =
-        { SchemaConstants.TOP_OC, Config.getProperty( USER_OBJECT_CLASS ),
-            USERS_AUX_OBJECT_CLASS_NAME, GlobalIds.PROPS_AUX_OBJECT_CLASS_NAME, GlobalIds
-            .FT_MODIFIER_AUX_OBJECT_CLASS_NAME, USERS_EXTENSIBLE_OBJECT,
-        //            POSIX_ACCOUNT_OBJECT_CLASS_NAME
-    };
-
-    private static final String objectClassImpl = Config.getProperty( USER_OBJECT_CLASS );
+    private String[] USER_OBJ_CLASS;
+
+    private String objectClassImpl;
     private static final String SYSTEM_USER = "ftSystem";
 
     /**
@@ -222,14 +217,23 @@ final class UserDAO extends LdapDataProvider
     private static String[] authnAtrs = null;
     private static String[] defaultAtrs = null;
 
-    static
+    private void init()
     {
-        LOG.debug( "GlobalIds.IS_OPENLDAP: " + GlobalIds.IS_OPENLDAP );
-        LOG.debug( "GlobalIds.IS_OPENLDAP ? OPENLDAP_PW_RESET : null: " + ( GlobalIds.IS_OPENLDAP ? OPENLDAP_PW_RESET
+        objectClassImpl = Config.getInstance().getProperty( USER_OBJECT_CLASS );
+    	
+        USER_OBJ_CLASS = new String[]
+            { SchemaConstants.TOP_OC, Config.getInstance().getProperty( USER_OBJECT_CLASS ),
+                USERS_AUX_OBJECT_CLASS_NAME, GlobalIds.PROPS_AUX_OBJECT_CLASS_NAME, GlobalIds
+                .FT_MODIFIER_AUX_OBJECT_CLASS_NAME, USERS_EXTENSIBLE_OBJECT,
+            //            POSIX_ACCOUNT_OBJECT_CLASS_NAME
+        };
+    	
+        LOG.debug( "GlobalIds.IS_OPENLDAP: " + GlobalIds.getInstance().IS_OPENLDAP );
+        LOG.debug( "GlobalIds.IS_OPENLDAP ? OPENLDAP_PW_RESET : null: " + ( GlobalIds.getInstance().IS_OPENLDAP ? OPENLDAP_PW_RESET
             : null ) );
-        LOG.debug( "GlobalIds.IS_OPENLDAP: " + GlobalIds.IS_OPENLDAP );
+        LOG.debug( "GlobalIds.IS_OPENLDAP: " + GlobalIds.getInstance().IS_OPENLDAP );
 
-        if ( GlobalIds.IS_OPENLDAP )
+        if ( GlobalIds.getInstance().IS_OPENLDAP )
         {
             // This default set of attributes contains all and is used for search operations.
             defaultAtrs = new String[]
@@ -395,6 +399,11 @@ final class UserDAO extends LdapDataProvider
         { GlobalIds.USER_ADMINROLE_DATA };
 
 
+    public UserDAO() {
+        super();
+        init();
+	}
+    
     /**
      * @param entity
      * @return
@@ -488,7 +497,7 @@ final class UserDAO extends LdapDataProvider
                 myEntry.add( SYSTEM_USER, entity.isSystem().toString().toUpperCase() );
             }
 
-            if ( GlobalIds.IS_OPENLDAP && StringUtils.isNotEmpty( entity.getPwPolicy() ) )
+            if ( GlobalIds.getInstance().IS_OPENLDAP && StringUtils.isNotEmpty( entity.getPwPolicy() ) )
             {
                 String pwdPolicyDn = GlobalIds.POLICY_NODE_TYPE + "=" + entity.getPwPolicy() + "," + getRootDn(
                     entity.getContextId(), GlobalIds.PPOLICY_ROOT );
@@ -593,7 +602,7 @@ final class UserDAO extends LdapDataProvider
                     entity.getTitle() ) );
             }
 
-            if ( GlobalIds.IS_OPENLDAP && StringUtils.isNotEmpty( entity.getPwPolicy() ) )
+            if ( GlobalIds.getInstance().IS_OPENLDAP && StringUtils.isNotEmpty( entity.getPwPolicy() ) )
             {
                 String szDn = GlobalIds.POLICY_NODE_TYPE + "=" + entity.getPwPolicy() + "," + getRootDn( entity
                     .getContextId(), GlobalIds.PPOLICY_ROOT );
@@ -1047,7 +1056,7 @@ final class UserDAO extends LdapDataProvider
                             case CHANGE_AFTER_RESET:
                                 // Don't throw exception if authenticating in J2EE Realm - The Web application must
                                 // give user a chance to modify their password.
-                                if ( !GlobalIds.IS_REALM )
+                                if ( !GlobalIds.getInstance().IS_REALM )
                                 {
                                     errMsg = msgHdr + "PASSWORD HAS BEEN RESET BY LDAP_ADMIN_POOL_UID";
                                     rc = GlobalErrIds.USER_PW_RESET;
@@ -1271,7 +1280,7 @@ final class UserDAO extends LdapDataProvider
             filterbuf.append( USERS_AUX_OBJECT_CLASS_NAME );
             filterbuf.append( ")(" );
 
-            Set<String> roles = RoleUtil.getDescendants( role.getName(), role.getContextId() );
+            Set<String> roles = RoleUtil.getInstance().getDescendants( role.getName(), role.getContextId() );
 
             if ( CollectionUtils.isNotEmpty( roles ) )
             {
@@ -1703,7 +1712,7 @@ final class UserDAO extends LdapDataProvider
             modify( ld, userDn, mods );
 
             // This modify update audit attributes on the User entry (if enabled):
-            if ( GlobalIds.IS_OPENLDAP && ! GlobalIds.IS_AUDIT_DISABLED )
+            if ( GlobalIds.getInstance().IS_OPENLDAP && ! GlobalIds.getInstance().IS_AUDIT_DISABLED )
             {
                 mods = new ArrayList<>();
                 modify( ld, userDn, mods, entity );
@@ -2079,7 +2088,7 @@ final class UserDAO extends LdapDataProvider
 
         entity.addProperties( PropUtil.getProperties( getAttributes( entry, GlobalIds.PROPS ) ) );
 
-        if ( GlobalIds.IS_OPENLDAP )
+        if ( GlobalIds.getInstance().IS_OPENLDAP )
         {
             szBoolean = getAttribute( entry, OPENLDAP_PW_RESET );
             if ( szBoolean != null && szBoolean.equalsIgnoreCase( "true" ) )

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/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 f5be195..f089540 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
@@ -390,7 +390,7 @@ final class UserP
             throw new PasswordException( session.getErrorId(), info );
         }
 
-        VUtil.validateConstraints( session, VUtil.ConstraintType.USER, false );
+        VUtil.getInstance().validateConstraints( session, VUtil.ConstraintType.USER, false );
 
         return session;
     }
@@ -453,7 +453,7 @@ final class UserP
             // Create the impl session without authentication of password.
             session = createSessionTrusted( user );
             // Check user temporal constraints.  This op usually performed during authentication.
-            VUtil.validateConstraints( session, VUtil.ConstraintType.USER, false );
+            VUtil.getInstance().validateConstraints( session, VUtil.ConstraintType.USER, false );
         }
         else
         {
@@ -480,7 +480,7 @@ final class UserP
             }
         }
         // Check role temporal constraints + activate roles:
-        VUtil.validateConstraints( session, VUtil.ConstraintType.ROLE, true );
+        VUtil.getInstance().validateConstraints( session, VUtil.ConstraintType.ROLE, true );
         return session;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/908a0734/src/main/java/org/apache/directory/fortress/core/impl/UsoUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UsoUtil.java b/src/main/java/org/apache/directory/fortress/core/impl/UsoUtil.java
index 6bec8f1..93939ee 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UsoUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UsoUtil.java
@@ -62,17 +62,33 @@ import org.slf4j.LoggerFactory;
  */
 final class UsoUtil
 {
-    private static final Cache usoCache;
-    private static final OrgUnitP orgUnitP = new OrgUnitP();
+    private Cache usoCache;
+    private OrgUnitP orgUnitP;
     private static final String CLS_NM = UsoUtil.class.getName();
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
 
+    private static volatile UsoUtil INSTANCE = null; 
+
+    public static UsoUtil getInstance() {
+        if(INSTANCE == null) {
+            synchronized (UsoUtil.class) {
+                if(INSTANCE == null){
+        	        INSTANCE = new UsoUtil();
+                }
+            }
+        }
+        return INSTANCE;
+    }
+    
+    
     /**
      * Initialize the User OU hierarchies.  This will read the {@link org.apache.directory.fortress.core.model.Hier} data set from ldap and load into
      * the JGraphT simple digraph that referenced statically within this class.
      */
-    static
+    private void init()
     {
+        orgUnitP = new OrgUnitP();
+    	
         CacheMgr cacheMgr = CacheMgr.getInstance();
         usoCache = cacheMgr.getCache( "fortress.uso" );
     }
@@ -83,6 +99,7 @@ final class UsoUtil
      */
     private UsoUtil()
     {
+        init();
     }
 
     /**
@@ -91,7 +108,7 @@ final class UsoUtil
      * @param name {@link org.apache.directory.fortress.core.model.OrgUnit#name} on 'ftOrgUnit' object class.
      * @return Set of names of descendants {@link org.apache.directory.fortress.core.model.OrgUnit}s of given parent.
      */
-    static Set<String> getDescendants( String name, String contextId )
+    Set<String> getDescendants( String name, String contextId )
     {
         return HierUtil.getDescendants( name, getGraph( contextId ) );
     }
@@ -103,7 +120,7 @@ final class UsoUtil
      * @param name maps to logical {@link org.apache.directory.fortress.core.model.OrgUnit#name} on 'ftOrgUnit' object class.
      * @return Set of ou names that are ascendants of given child.
      */
-    static Set<String> getAscendants( String name, String contextId )
+    Set<String> getAscendants( String name, String contextId )
     {
         return HierUtil.getAscendants( name, getGraph( contextId ) );
     }
@@ -115,7 +132,7 @@ final class UsoUtil
      * @param name {@link org.apache.directory.fortress.core.model.OrgUnit#name} maps on 'ftOrgUnit' object class.
      * @return Set of names of children {@link org.apache.directory.fortress.core.model.OrgUnit}s of given parent.
      */
-    public static Set<String> getChildren( String name, String contextId )
+    public Set<String> getChildren( String name, String contextId )
     {
         return HierUtil.getChildren( name, getGraph( contextId ) );
     }
@@ -127,7 +144,7 @@ final class UsoUtil
      * @param name maps to logical {@link org.apache.directory.fortress.core.model.OrgUnit#name} on 'ftOrgUnit' object class.
      * @return Set of ou names that are parents of given child.
      */
-    static Set<String> getParents( String name, String contextId )
+    Set<String> getParents( String name, String contextId )
     {
         return HierUtil.getParents( name, getGraph( contextId ) );
     }
@@ -139,7 +156,7 @@ final class UsoUtil
      * @param name maps to logical {@link org.apache.directory.fortress.core.model.OrgUnit#name} on 'ftOrgUnit' object class.
      * @return int value contains the number of children of a given parent ou.
      */
-    static int numChildren( String name, String contextId )
+    int numChildren( String name, String contextId )
     {
         return HierUtil.numChildren( name, getGraph( contextId ) );
     }
@@ -151,7 +168,7 @@ final class UsoUtil
      * @param ous contains list of {@link org.apache.directory.fortress.core.model.OrgUnit}s.
      * @return contains Set of all descendants.
      */
-    static Set<String> getInherited( List<OrgUnit> ous, String contextId )
+    Set<String> getInherited( List<OrgUnit> ous, String contextId )
     {
         // create Set with case insensitive comparator:
         Set<String> iOUs = new TreeSet<>( String.CASE_INSENSITIVE_ORDER );
@@ -192,7 +209,7 @@ final class UsoUtil
      * @throws org.apache.directory.fortress.core.ValidationException
      *          in the event it fails one of the 3 checks.
      */
-    static void validateRelationship( OrgUnit child, OrgUnit parent, boolean mustExist )
+    void validateRelationship( OrgUnit child, OrgUnit parent, boolean mustExist )
         throws ValidationException
     {
         HierUtil.validateRelationship( getGraph( child.getContextId() ), child.getName(), parent.getName(), mustExist );
@@ -208,7 +225,7 @@ final class UsoUtil
      * @param op   used to pass the ldap op {@link org.apache.directory.fortress.core.model.Hier.Op#ADD}, {@link org.apache.directory.fortress.core.model.Hier.Op#MOD}, {@link org.apache.directory.fortress.core.model.Hier.Op#REM}
      * @throws org.apache.directory.fortress.core.SecurityException in the event of a system error.
      */
-    static void updateHier( String contextId, Relationship relationship, Hier.Op op ) throws SecurityException
+    void updateHier( String contextId, Relationship relationship, Hier.Op op ) throws SecurityException
     {
         HierUtil.updateHier( getGraph( contextId ), relationship, op );
     }
@@ -221,7 +238,7 @@ final class UsoUtil
      * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
      * @return handle to simple digraph containing user ou hierarchies.
      */
-    private static synchronized SimpleDirectedGraph<String, Relationship> loadGraph( String contextId )
+    private synchronized SimpleDirectedGraph<String, Relationship> loadGraph( String contextId )
     {
         Hier inHier = new Hier( Hier.Type.ROLE );
         inHier.setContextId( contextId );
@@ -254,7 +271,7 @@ final class UsoUtil
      *
      * @return handle to simple digraph containing user ou hierarchies.
      */
-    private static SimpleDirectedGraph<String, Relationship> getGraph( String contextId )
+    private SimpleDirectedGraph<String, Relationship> getGraph( String contextId )
     {
         String key = getKey( contextId );        
         LOG.debug("Getting graph for key " + contextId);
@@ -273,7 +290,7 @@ final class UsoUtil
     }
 
 
-    private static String getKey( String contextId )
+    private String getKey( String contextId )
     {
         String key = HierUtil.Type.USO.toString();
         if ( StringUtils.isNotEmpty( contextId ) && !contextId.equalsIgnoreCase( GlobalIds.NULL ) )


Mime
View raw message