You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2014/11/05 18:33:08 UTC

[01/20] git commit: Added a method assertContext that takes a methodName, instead of constructing it inside the body of the method.

Repository: directory-fortress-core
Updated Branches:
  refs/heads/master c464c7305 -> 1a4d9716a


Added a method assertContext that takes a methodName, instead of
constructing it inside the body of the method.

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

Branch: refs/heads/master
Commit: 29cf8aa4f9f30ab6315d6efea21ebe47ee00f880
Parents: 40f6d2f
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 16:50:41 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 16:50:41 2014 +0100

----------------------------------------------------------------------
 .../fortress/core/rbac/Manageable.java          | 29 ++++++++++++++++----
 1 file changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/29cf8aa4/src/main/java/org/apache/directory/fortress/core/rbac/Manageable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/Manageable.java b/src/main/java/org/apache/directory/fortress/core/rbac/Manageable.java
index 196c2e6..8971961 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/Manageable.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/Manageable.java
@@ -64,6 +64,7 @@ public abstract class Manageable implements org.apache.directory.fortress.core.M
         this.contextId = contextId;
     }
 
+    
     /**
      * Set A/RBAC session on entity and perform authorization on behalf of the caller if the {@link #adminSess} is set.
      *
@@ -83,7 +84,8 @@ public abstract class Manageable implements org.apache.directory.fortress.core.M
             AdminUtil.setEntitySession( this.adminSess, perm, entity, this.contextId );
         }
     }
-
+    
+    
     /**
      * Every Fortress Manager API (e.g. addUser, updateUser, addRole, ...) will perform authorization on behalf of the caller IFF the {@link AuditMgrImpl#adminSess} has been set before invocation.
      *
@@ -128,19 +130,34 @@ public abstract class Manageable implements org.apache.directory.fortress.core.M
         entity.setContextId(this.contextId);
     }
 
+    
     /**
      * Method will throw exception if entity reference is null, otherwise will set the contextId of the tenant onto the supplied entity reference.
      * @param className contains the class name of caller.
      * @param opName contains operation name of caller.
      * @param entity  used here to pass the tenant id into the Fortress DAO layer..
      * @param errorCode contains the error id to use if null.
-     * @throws org.apache.directory.fortress.core.ValidationException in the event object is null.
+     * @throws ValidationException in the event object is null.
      */
-    protected final void assertContext(String className, String opName, FortEntity entity, int errorCode)
-        throws ValidationException
+    protected final void assertContext( String className, String opName, FortEntity entity, int errorCode ) throws ValidationException
     {
-        VUtil.assertNotNull(entity, errorCode, getFullMethodName(className, opName));
-        entity.setContextId(this.contextId);
+        VUtil.assertNotNull( entity, errorCode, getFullMethodName( className, opName ) );
+        entity.setContextId( contextId );
+    }
+
+    
+    /**
+     * Method will throw exception if entity reference is null, otherwise will set the contextId of the tenant onto the supplied entity reference.
+     * 
+     * @param methodName contains the full method name of caller.
+     * @param entity  used here to pass the tenant id into the Fortress DAO layer..
+     * @param errorCode contains the error id to use if null.
+     * @throws ValidationException in the event object is null.
+     */
+    protected final void assertContext( String methodName, FortEntity entity, int errorCode ) throws ValidationException
+    {
+        VUtil.assertNotNull( entity, errorCode, methodName );
+        entity.setContextId( contextId );
     }
 
     /**


[16/20] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/directory-fortress-core

Posted by el...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/directory-fortress-core


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

Branch: refs/heads/master
Commit: 7e417f41a1aef2e57e19299f8560d870177d9d40
Parents: effe0e9 c464c73
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Wed Nov 5 11:00:23 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Wed Nov 5 11:00:23 2014 +0100

----------------------------------------------------------------------
 .../core/ldap/ApacheDsDataProvider.java         | 23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/7e417f41/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java
----------------------------------------------------------------------


[02/20] git commit: Fixed a LOG statement (removing a string concatenation)

Posted by el...@apache.org.
Fixed a LOG statement (removing a string concatenation)

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

Branch: refs/heads/master
Commit: 89acb727eac1a9dbeb0e359359b246e3266f785a
Parents: 29cf8aa
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 16:54:05 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 16:54:05 2014 +0100

----------------------------------------------------------------------
 .../fortress/core/rbac/AcceleratorDAO.java      | 64 ++++++++++++--------
 1 file changed, 39 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/89acb727/src/main/java/org/apache/directory/fortress/core/rbac/AcceleratorDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/AcceleratorDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/AcceleratorDAO.java
index b01b5a3..7e71ac7 100644
--- a/src/main/java/org/apache/directory/fortress/core/rbac/AcceleratorDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/AcceleratorDAO.java
@@ -20,6 +20,8 @@
 package org.apache.directory.fortress.core.rbac;
 
 
+import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.openldap.accelerator.api.addRole.RbacAddRoleRequest;
 import org.openldap.accelerator.api.addRole.RbacAddRoleRequestImpl;
@@ -36,9 +38,6 @@ import org.openldap.accelerator.api.deleteSession.RbacDeleteSessionResponse;
 import org.openldap.accelerator.api.dropRole.RbacDropRoleRequest;
 import org.openldap.accelerator.api.dropRole.RbacDropRoleRequestImpl;
 import org.openldap.accelerator.api.dropRole.RbacDropRoleResponse;
-import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.ldap.client.api.LdapConnection;
-
 import org.openldap.accelerator.api.sessionRoles.RbacSessionRolesRequest;
 import org.openldap.accelerator.api.sessionRoles.RbacSessionRolesRequestImpl;
 import org.openldap.accelerator.api.sessionRoles.RbacSessionRolesResponse;
@@ -47,6 +46,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.directory.fortress.core.SecurityException;
 import org.apache.directory.fortress.core.ldap.ApacheDsDataProvider;
 import org.apache.directory.fortress.core.util.attr.VUtil;
+import org.apache.directory.ldap.client.api.LdapConnection;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -62,7 +62,6 @@ import java.util.List;
  * @author Shawn McKinney
  */
 final class AcceleratorDAO extends ApacheDsDataProvider
-
 {
     private static final Logger LOG = LoggerFactory.getLogger( AcceleratorDAO.class.getName() );
 
@@ -86,6 +85,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
     {
         Session session = null;
         LdapConnection ld = null;
+        
         try
         {
             ld = getAdminConnection();
@@ -96,6 +96,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
             rbacCreateSessionRequest.setTenantId( user.getContextId() );
             rbacCreateSessionRequest.setUserIdentity( user.getUserId() );
             rbacCreateSessionRequest.setPassword( new String(user.getPassword()) );
+            
             if( VUtil.isNotNullOrEmpty( user.getRoles() ))
             {
                 for ( UserRole userRole : user.getRoles())
@@ -103,12 +104,14 @@ final class AcceleratorDAO extends ApacheDsDataProvider
                     rbacCreateSessionRequest.addRole( userRole.getName() );
                 }
             }
+            
             // Send the request
             RbacCreateSessionResponse rbacCreateSessionResponse = ( RbacCreateSessionResponse ) ld.extended(
                 rbacCreateSessionRequest );
-            LOG.debug( "createSession userId: " + user.getUserId() + ", sessionId: " +  rbacCreateSessionResponse.getSessionId() + ", resultCode: " +   rbacCreateSessionResponse.getLdapResult().getResultCode().getResultCode());
+            LOG.debug( "createSession userId: {}, sessionId: {}",user.getUserId(), rbacCreateSessionResponse.getSessionId() + ", resultCode: " +   rbacCreateSessionResponse.getLdapResult().getResultCode());
             session = new Session( user, rbacCreateSessionResponse.getSessionId() );
-            if(rbacCreateSessionResponse.getLdapResult().getResultCode().getResultCode() == 0)
+            
+            if ( rbacCreateSessionResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
             {
                 session.setAuthenticated(true);
             }
@@ -129,6 +132,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
         {
             closeAdminConnection( ld );
         }
+        
         return session;
     }
 
@@ -148,35 +152,31 @@ final class AcceleratorDAO extends ApacheDsDataProvider
      * @return True if user has access, false otherwise.
      * @throws SecurityException rethrows {@code LdapException} with {@code GlobalErrIds.ACEL_CHECK_ACCESS_ERR}.
      */
-    boolean checkAccess( Session session, Permission perm )
-        throws SecurityException
+    boolean checkAccess( Session session, Permission perm ) throws SecurityException
     {
         boolean result = false;
         LdapConnection ld = null;
+        
         try
         {
             ld = getAdminConnection();
             RbacCheckAccessRequest rbacCheckAccessRequest = new RbacCheckAccessRequestImpl();
             rbacCheckAccessRequest.setSessionId( session.getSessionId() );
             rbacCheckAccessRequest.setObject( perm.getObjName() );
+            
             // objectId is optional
             if(VUtil.isNotNullOrEmpty( perm.getObjId()))
             {
                 rbacCheckAccessRequest.setObjectId( perm.getObjId() );
             }
+            
             rbacCheckAccessRequest.setOperation( perm.getOpName() );
             // Send the request
             RbacCheckAccessResponse rbacCheckAccessResponse = ( RbacCheckAccessResponse ) ld.extended(
                 rbacCheckAccessRequest );
-            LOG.debug( "checkAccess result: {}", rbacCheckAccessResponse.getLdapResult().getResultCode().getResultCode());
-            if(rbacCheckAccessResponse.getLdapResult().getResultCode().getResultCode() == 0)
-            {
-                result = true;
-            }
-            else
-            {
-                result = false;
-            }
+            LOG.debug( "checkAccess result: {}", rbacCheckAccessResponse.getLdapResult().getResultCode() );
+            
+            result = rbacCheckAccessResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS;
         }
         catch ( LdapException e )
         {
@@ -188,6 +188,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
         {
             closeAdminConnection( ld );
         }
+        
         return result;
     }
 
@@ -205,6 +206,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
     void dropActiveRole( Session session, UserRole userRole ) throws SecurityException
     {
         LdapConnection ld = null;
+        
         try
         {
             ld = getAdminConnection();
@@ -215,8 +217,9 @@ final class AcceleratorDAO extends ApacheDsDataProvider
             // Send the request
             RbacDropRoleResponse rbacDropRoleResponse = ( RbacDropRoleResponse ) ld.extended(
                 dropRoleRequest );
-            LOG.debug( "dropActiveRole result: {}", rbacDropRoleResponse.getLdapResult().getResultCode().getResultCode());
-            if(rbacDropRoleResponse.getLdapResult().getResultCode().getResultCode() != 0)
+            LOG.debug( "dropActiveRole result: {}", rbacDropRoleResponse.getLdapResult().getResultCode() );
+            
+            if ( rbacDropRoleResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
             {
                 String info = "dropActiveRole Role [" + userRole.getName() + "] User ["
                     + session.getUserId() + "], not previously activated.";
@@ -234,6 +237,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
             closeAdminConnection( ld );
         }
     }
+    
 
     /**
      * Activate user role into rbac session
@@ -248,6 +252,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
     void addActiveRole( Session session, UserRole userRole ) throws SecurityException
     {
         LdapConnection ld = null;
+        
         try
         {
             ld = getAdminConnection();
@@ -258,12 +263,14 @@ final class AcceleratorDAO extends ApacheDsDataProvider
             // Send the request
             RbacAddRoleResponse rbacAddRoleResponse = ( RbacAddRoleResponse ) ld.extended(
                 addRoleRequest );
-            LOG.debug( "addActiveRole result: {}", rbacAddRoleResponse.getLdapResult().getResultCode().getResultCode());
-            if(rbacAddRoleResponse.getLdapResult().getResultCode().getResultCode() != 0)
+            LOG.debug( "addActiveRole result: {}", rbacAddRoleResponse.getLdapResult().getResultCode() );
+            
+            if ( rbacAddRoleResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
             {
                 String info;
                 int rc;
-                if(rbacAddRoleResponse.getLdapResult().getResultCode().getResultCode() == 20)
+                
+                if( rbacAddRoleResponse.getLdapResult().getResultCode() == ResultCodeEnum.ATTRIBUTE_OR_VALUE_EXISTS )
                 {
                     info = "addActiveRole Role [" + userRole.getName() + "] User ["
                         + session.getUserId() + "], already activated.";
@@ -275,6 +282,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
                         + session.getUserId() + "], not authorized for user.";
                     rc = GlobalErrIds.URLE_ACTIVATE_FAILED;
                 }
+                
                 throw new SecurityException( rc, info );
             }
         }
@@ -289,6 +297,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
             closeAdminConnection( ld );
         }
     }
+    
 
     /**
      * Delete the stored session on rbac accelerator server.
@@ -300,6 +309,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
     void deleteSession( Session session ) throws SecurityException
     {
         LdapConnection ld = null;
+        
         try
         {
             ld = getAdminConnection();
@@ -309,7 +319,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
             // Send the request
             RbacDeleteSessionResponse deleteSessionResponse = ( RbacDeleteSessionResponse ) ld.extended(
                 deleteSessionRequest );
-            LOG.debug( "deleteSession result: {}", deleteSessionResponse.getLdapResult().getResultCode().getResultCode());
+            LOG.debug( "deleteSession result: {}", deleteSessionResponse.getLdapResult().getResultCode());
         }
         catch ( LdapException e )
         {
@@ -338,6 +348,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
     {
         LdapConnection ld = null;
         List<UserRole> userRoleList = null;
+        
         try
         {
             ld = getAdminConnection();
@@ -348,9 +359,11 @@ final class AcceleratorDAO extends ApacheDsDataProvider
             RbacSessionRolesResponse sessionRolesResponse = ( RbacSessionRolesResponse ) ld.extended(
                 sessionRolesRequest );
             LOG.debug( "sessionRoles result: {}", sessionRolesResponse.getLdapResult().getResultCode().getResultCode());
-            if(VUtil.isNotNullOrEmpty( sessionRolesResponse.getRoles() ) )
+            
+            if ( VUtil.isNotNullOrEmpty( sessionRolesResponse.getRoles() ) )
             {
-                userRoleList = new ArrayList<>(  );
+                userRoleList = new ArrayList<UserRole>();
+                
                 for( String roleNm : sessionRolesResponse.getRoles() )
                 {
                     userRoleList.add( new UserRole( session.getUserId(), roleNm ) );
@@ -368,6 +381,7 @@ final class AcceleratorDAO extends ApacheDsDataProvider
         {
             closeAdminConnection( ld );
         }
+        
         return userRoleList;
     }
 }


[17/20] git commit: Formlatting the code

Posted by el...@apache.org.
Formlatting the code

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

Branch: refs/heads/master
Commit: 123e9187ba9df4ed495a30ae7fcb0909ed7a22ef
Parents: 7e417f4
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Wed Nov 5 18:24:13 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Wed Nov 5 18:24:13 2014 +0100

----------------------------------------------------------------------
 .../directory/fortress/core/rbac/Role.java      | 1151 +++++++++---------
 1 file changed, 580 insertions(+), 571 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/123e9187/src/main/java/org/apache/directory/fortress/core/rbac/Role.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/Role.java b/src/main/java/org/apache/directory/fortress/core/rbac/Role.java
index 8651808..f974266 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/Role.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/Role.java
@@ -189,608 +189,617 @@ import org.apache.directory.fortress.core.util.time.Constraint;
     {
         AdminRole.class
 })
-public class Role extends FortEntity
-implements Constraint, Graphable, java.io.Serializable
-{
-private String id; // this maps to ftId
-private String name; // this is ftRoleName
-private String description; // this is description
-@XmlTransient
-private String dn; // this attribute is automatically saved to each ldap record.
-@XmlTransient
-private List<String> occupants;
-private Set<String> parents;
-private Set<String> children;
-private String beginTime; // this attribute is ftCstr
-private String endTime; // this attribute is ftCstr
-private String beginDate; // this attribute is ftCstr
-private String endDate; // this attribute is ftCstr
-private String beginLockDate;// this attribute is ftCstr
-private String endLockDate; // this attribute is ftCstr
-private String dayMask; // this attribute is ftCstr
-private int timeout; // this attribute is ftCstr
-
-
-/**
- * Default constructor is used by internal Fortress classes.
- */
-public Role()
-{
-}
-
-
-/**
- * Construct a Role entity with a given name.
- *
- * @param name maps to 'cn' attribute on 'organizationalrole' object class.
- */
-public Role( String name )
-{
-    this.name = name;
-}
-
-
-/**
- * Construct an RBAC Role with a given temporal constraint.
- *
- * @param con maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-public Role( Constraint con )
-{
-    CUtil.copy( con, this );
-}
-
-
-/**
- * Required on DAO classes convert Temporal attributes stored on entity to raw data object format needed for ldap.  For internal use only.
- *
- * @return String that maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-public String getRawData()
-{
-    return rawData;
-}
-
-
-/**
- * Required on DAO classes convert Temporal from raw ldap data to entity attributes.  For internal use only.
- *
- * @param rawData maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-public void setRawData( String rawData )
-{
-    this.rawData = rawData;
-}
-
-private String rawData;
-
-
-/**
- * Gets the name required attribute of the Role object
- *
- * @return attribute maps to 'cn' attribute on 'organizationalrole' object class.
- */
-public String getName()
-{
-    return name;
-}
-
-
-/**
- * Sets the required name attribute on the Role object
- *
- */
-public void setName( String name )
-{
-    this.name = name;
-}
-
-
-/**
- * Set the occupant attribute with the contents of the User dn.
- * @param occupant maps to 'roleOccupant' attribute on 'organizationalrole' object class.
- */
-public void setOccupant( String occupant )
-{
-    if ( this.occupants == null )
+public class Role extends FortEntity implements Constraint, Graphable, java.io.Serializable
+{
+    private static final long serialVersionUID = 1L;
+    private String id; // this maps to ftId
+    private String name; // this is ftRoleName
+    private String description; // this is description
+    @XmlTransient
+    private String dn; // this attribute is automatically saved to each ldap record.
+    @XmlTransient
+    private List<String> occupants;
+    private Set<String> parents;
+    private Set<String> children;
+    private String beginTime; // this attribute is ftCstr
+    private String endTime; // this attribute is ftCstr
+    private String beginDate; // this attribute is ftCstr
+    private String endDate; // this attribute is ftCstr
+    private String beginLockDate;// this attribute is ftCstr
+    private String endLockDate; // this attribute is ftCstr
+    private String dayMask; // this attribute is ftCstr
+    private int timeout; // this attribute is ftCstr
+    
+    
+    /**
+     * Default constructor is used by internal Fortress classes.
+     */
+    public Role()
     {
-        this.occupants = new ArrayList<>();
     }
-    this.occupants.add( occupant );
-}
-
-
-/**
- * Return list of occupants for a particular Role entity.
- * @return List of type String containing User dn that maps to 'roleOccupant' attribute on 'organizationalrole' object class.
- */
-public List<String> getOccupants()
-{
-    return occupants;
-}
-
-
-/**
- * Set a list of occupants for a particular Role entity.
- * @param occupants contains a List of type String which maps to 'roleOccupant' attribute on 'organizationalrole' object class.
- */
-public void setOccupants( List<String> occupants )
-{
-    this.occupants = occupants;
-}
-
-
-/**
- * Returns optional description that is associated with Role.  This attribute is validated but not constrained by Fortress.
- *
- * @return value that is mapped to 'description' in 'organizationalrole' object class.
- */
-public String getDescription()
-{
-    return this.description;
-}
-
-
-/**
- * Sets the optional description that is associated with Role.  This attribute is validated but not constrained by Fortress.
- *
- * @param description that is mapped to same name in 'organizationalrole' object class.
- */
-public void setDescription( String description )
-{
-    this.description = description;
-}
-
-
-/**
- * Return the internal id that is associated with Role.  This attribute is generated automatically
- * by Fortress when new Role is added to directory and is not known or changeable by external client.
- *
- * @return attribute maps to 'ftId' in 'ftRls' object class.
- */
-public String getId()
-{
-    return id;
-}
-
-
-/**
- * Generate an internal Id that is associated with Role.  This method is used by DAO class and
- * is not available to outside classes.   The generated attribute maps to 'ftId' in 'ftRls' object class.
- */
-public void setId()
-{
-    // generate a unique id that will be used as the rDn for this entry:
-    UUID uuid = UUID.randomUUID();
-    this.id = uuid.toString();
-}
-
-
-/**
- * Set the internal Id that is associated with Role.  This method is used by DAO class and
- * is generated automatically by Fortress.  Attribute stored in LDAP cannot be changed by external caller.
- * This method can be used by client for search purposes only.
- *
- * @param id maps to 'ftId' in 'ftRls' object class.
- */
-public void setId( String id )
-{
-    this.id = id;
-}
-
-
-/**
- * temporal boolean flag is used by internal Fortress components.
- *
- * @return boolean indicating if temporal constraints are placed on Role.
- */
-@Override
-public boolean isTemporalSet()
-{
-    return ( beginTime != null || endTime != null || beginDate != null || endDate != null || beginLockDate != null
-        || endLockDate != null || dayMask != null );
-}
-
-
-/**
- * Contains the begin time of day Role is allowed to be activated in session.  The format is military time - HHMM, i.e. 0800 (8:00 am) or 1700 (5:00 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getBeginTime()
-{
-    return this.beginTime;
-}
-
-
-/**
- * Set the begin time of day Role is allowed to be activated in session.  The format is military time - HHMM, i.e. 0800 (8:00 am) or 1700 (5:00 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param beginTime maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setBeginTime( String beginTime )
-{
-    this.beginTime = beginTime;
-}
-
-
-/**
- * Contains the end time of day Role is allowed to be activated in session.  The format is military time - HHMM, i.e. 0000 (12:00 am) or 2359 (11:59 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getEndTime()
-{
-    return this.endTime;
-}
-
-
-/**
- * Set the end time of day Role is allowed to be activated in session.  The format is military time - HHMM, i.e. 0000 (12:00 am) or 2359 (11:59 p.m.).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param endTime maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setEndTime( String endTime )
-{
-    this.endTime = endTime;
-}
-
-
-/**
- * Contains the begin date when Role is allowed to be activated in session.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getBeginDate()
-{
-    return this.beginDate;
-}
-
-
-/**
- * Set the beginDate when Role is allowed to be activated in session.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param beginDate maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setBeginDate( String beginDate )
-{
-    this.beginDate = beginDate;
-}
-
-
-/**
- * Contains the end date when Role is allowed to be activated in session.  The format is - YYYYMMDD, i.e. 20101231 (December 31, 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getEndDate()
-{
-    return this.endDate;
-}
-
-
-/**
- * Set the end date when Role is not allowed to be activated in session.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param endDate maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setEndDate( String endDate )
-{
-    this.endDate = endDate;
-}
-
-
-/**
- * Contains the begin lock date when Role is temporarily not allowed to be activated in session.  The format is - YYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getBeginLockDate()
-{
-    return this.beginLockDate;
-}
-
-
-/**
- * Set the begin lock date when Role is temporarily not allowed to be activated in session.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param beginLockDate maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setBeginLockDate( String beginLockDate )
-{
-    this.beginLockDate = beginLockDate;
-}
-
-
-/**
- * Contains the end lock date when Role is allowed to be activated in session once again.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getEndLockDate()
-{
-    return this.endLockDate;
-}
-
-
-/**
- * Set the end lock date when Role is allowed to be activated in session once again.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param endLockDate maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setEndLockDate( String endLockDate )
-{
-    this.endLockDate = endLockDate;
-}
-
-
-/**
- * Get the daymask that indicates what days of week Role is allowed to be activated in session.  The format is 1234567, i.e. 23456 (Monday, Tuesday, Wednesday, Thursday, Friday).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public String getDayMask()
-{
-    return this.dayMask;
-}
-
-
-/**
- * Set the daymask that specifies what days of week Role is allowed to be activated in session.  The format is 1234567, i.e. 23456 (Monday, Tuesday, Wednesday, Thursday, Friday).
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param dayMask maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setDayMask( String dayMask )
-{
-    this.dayMask = dayMask;
-}
-
-
-/**
- * Return the integer timeout that contains total time (in seconds) that Role may remain inactive in User's session before it is deactivated.
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @return int maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public Integer getTimeout()
-{
-    return this.timeout;
-}
-
-
-/**
- * Set the integer timeout that contains max time (in seconds) that Role may remain inactive in User's session before it is deactivated.
- * This attribute is optional but if set will be validated for reasonableness.
- *
- * @param timeout maps to 'ftCstr' attribute in 'ftRls' object class.
- */
-@Override
-public void setTimeout( Integer timeout )
-{
-    this.timeout = timeout;
-}
-
-
-/**
- * Get the names of roles that are parents (direct ascendants) of this role.
- * @return Set of parent role names assigned to this role.
- */
-@Override
-public Set<String> getParents()
-{
-    if ( this.parents == null )
+    
+    
+    /**
+     * Construct a Role entity with a given name.
+     *
+     * @param name maps to 'cn' attribute on 'organizationalrole' object class.
+     */
+    public Role( String name )
     {
-        this.parents = new HashSet<>();
+        this.name = name;
     }
-    return parents;
-}
-
-
-/**
- * Set the names of roles names that are parents (direct ascendants) of this role.
- * @param parents contains the Set of parent role names assigned to this role.
- */
-@Override
-public void setParents( Set<String> parents )
-{
-    this.parents = parents;
-}
-
-
-/**
- * Set the occupant attribute with the contents of the User dn.
- * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
- */
-@Override
-public void setParent( String parent )
-{
-    if ( this.parents == null )
+    
+    
+    /**
+     * Construct an RBAC Role with a given temporal constraint.
+     *
+     * @param con maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    public Role( Constraint con )
     {
-        this.parents = new HashSet<>();
+        CUtil.copy( con, this );
     }
-    this.parents.add( parent );
-}
-
-
-/**
- * Set the occupant attribute with the contents of the User dn.
- * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
- */
-@Override
-public void delParent( String parent )
-{
-    if ( this.parents != null )
+    
+    
+    /**
+     * Required on DAO classes convert Temporal attributes stored on entity to raw data object format needed for ldap.  For internal use only.
+     *
+     * @return String that maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    public String getRawData()
     {
-        this.parents.remove( parent );
+        return rawData;
     }
-}
-
-
-/**
- * Return the Set of child role names (direct descendants) of this role.
- * @return Set of child role names assigned to this role.
- */
-public Set<String> getChildren()
-{
-    return children;
-}
-
-
-/**
- * Set the Set of child role names (direct descendants) of this role
- * @param children contains the Set of child role names assigned to this role.
- */
-public void setChildren( Set<String> children )
-{
-    this.children = children;
-}
-
-
-/**
- * Matches the name from two Role entities.
- *
- * @param thatObj contains a Role entity.
- * @return boolean indicating both objects contain matching Role names.
- */
-public boolean equals( Object thatObj )
-{
-    if ( this == thatObj )
+    
+    
+    /**
+     * Required on DAO classes convert Temporal from raw ldap data to entity attributes.  For internal use only.
+     *
+     * @param rawData maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    public void setRawData( String rawData )
     {
-        return true;
+        this.rawData = rawData;
     }
-
-    if ( name == null )
+    
+    private String rawData;
+    
+    
+    /**
+     * Gets the name required attribute of the Role object
+     *
+     * @return attribute maps to 'cn' attribute on 'organizationalrole' object class.
+     */
+    public String getName()
     {
-        return false;
+        return name;
     }
-
-    if ( !( thatObj instanceof Role ) )
+    
+    
+    /**
+     * Sets the required name attribute on the Role object
+     *
+     */
+    public void setName( String name )
     {
-        return false;
+        this.name = name;
     }
-
-    Role thatRole = ( Role ) thatObj;
-
-    if ( thatRole.getName() == null )
+    
+    
+    /**
+     * Set the occupant attribute with the contents of the User dn.
+     * @param occupant maps to 'roleOccupant' attribute on 'organizationalrole' object class.
+     */
+    public void setOccupant( String occupant )
     {
-        return false;
+        if ( this.occupants == null )
+        {
+            this.occupants = new ArrayList<>();
+        }
+        this.occupants.add( occupant );
     }
-
-    return thatRole.getName().equalsIgnoreCase( name );
-}
-
-
-/**
- * @see Object#toString()
- */
-public String toString()
-{
-    StringBuilder sb = new StringBuilder();
-
-    sb.append( "Role[" );
-
-    // The name
-    sb.append( name ).append( ", " );
-
-    if ( ( description != null ) && ( description.length() > 0 ) )
+    
+    
+    /**
+     * Return list of occupants for a particular Role entity.
+     * @return List of type String containing User dn that maps to 'roleOccupant' attribute on 'organizationalrole' object class.
+     */
+    public List<String> getOccupants()
     {
-        sb.append( description ).append( ", " );
+        return occupants;
     }
-
-    // the date
-    sb.append( "date : <" ).append( beginDate ).append( ", " ).append( endDate ).append( ">, " );
-
-    // The time
-    sb.append( "time : <" ).append( beginTime ).append( ", " ).append( endTime ).append( ">, " );
-
-    // The lock date
-    sb.append( "lock date : <" ).append( beginLockDate ).append( ", " ).append( endLockDate ).append( ">, " );
-
-    // The timeout
-    sb.append( "timeout : " ).append( timeout ).append( ", " );
-
-    // The day mask
-    sb.append( "daymask : " ).append( dayMask );
-
-    // The parents if any
-    if ( ( parents != null ) && ( parents.size() > 0 ) )
+    
+    
+    /**
+     * Set a list of occupants for a particular Role entity.
+     * @param occupants contains a List of type String which maps to 'roleOccupant' attribute on 'organizationalrole' object class.
+     */
+    public void setOccupants( List<String> occupants )
+    {
+        this.occupants = occupants;
+    }
+    
+    
+    /**
+     * Returns optional description that is associated with Role.  This attribute is validated but not constrained by Fortress.
+     *
+     * @return value that is mapped to 'description' in 'organizationalrole' object class.
+     */
+    public String getDescription()
+    {
+        return this.description;
+    }
+    
+    
+    /**
+     * Sets the optional description that is associated with Role.  This attribute is validated but not constrained by Fortress.
+     *
+     * @param description that is mapped to same name in 'organizationalrole' object class.
+     */
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+    
+    
+    /**
+     * Return the internal id that is associated with Role.  This attribute is generated automatically
+     * by Fortress when new Role is added to directory and is not known or changeable by external client.
+     *
+     * @return attribute maps to 'ftId' in 'ftRls' object class.
+     */
+    public String getId()
+    {
+        return id;
+    }
+    
+    
+    /**
+     * Generate an internal Id that is associated with Role.  This method is used by DAO class and
+     * is not available to outside classes.   The generated attribute maps to 'ftId' in 'ftRls' object class.
+     */
+    public void setId()
+    {
+        // generate a unique id that will be used as the rDn for this entry:
+        UUID uuid = UUID.randomUUID();
+        this.id = uuid.toString();
+    }
+    
+    
+    /**
+     * Set the internal Id that is associated with Role.  This method is used by DAO class and
+     * is generated automatically by Fortress.  Attribute stored in LDAP cannot be changed by external caller.
+     * This method can be used by client for search purposes only.
+     *
+     * @param id maps to 'ftId' in 'ftRls' object class.
+     */
+    public void setId( String id )
     {
-        sb.append( ", parents : {" );
+        this.id = id;
+    }
 
-        boolean isFirst = true;
 
-        for ( String parent : parents )
+    /**
+     * temporal boolean flag is used by internal Fortress components.
+     *
+     * @return boolean indicating if temporal constraints are placed on Role.
+     */
+    @Override
+    public boolean isTemporalSet()
+    {
+        return ( beginTime != null || endTime != null || beginDate != null || endDate != null || beginLockDate != null
+            || endLockDate != null || dayMask != null );
+    }
+    
+    
+    /**
+     * Contains the begin time of day Role is allowed to be activated in session.  The format is military time - HHMM, i.e. 0800 (8:00 am) or 1700 (5:00 p.m.).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getBeginTime()
+    {
+        return this.beginTime;
+    }
+    
+    
+    /**
+     * Set the begin time of day Role is allowed to be activated in session.  The format is military time - HHMM, i.e. 0800 (8:00 am) or 1700 (5:00 p.m.).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param beginTime maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setBeginTime( String beginTime )
+    {
+        this.beginTime = beginTime;
+    }
+    
+    
+    /**
+     * Contains the end time of day Role is allowed to be activated in session.  The format is military time - HHMM, i.e. 0000 (12:00 am) or 2359 (11:59 p.m.).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getEndTime()
+    {
+        return this.endTime;
+    }
+    
+    
+    /**
+     * Set the end time of day Role is allowed to be activated in session.  The format is military time - HHMM, i.e. 0000 (12:00 am) or 2359 (11:59 p.m.).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param endTime maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setEndTime( String endTime )
+    {
+        this.endTime = endTime;
+    }
+    
+    
+    /**
+     * Contains the begin date when Role is allowed to be activated in session.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getBeginDate()
+    {
+        return this.beginDate;
+    }
+    
+    
+    /**
+     * Set the beginDate when Role is allowed to be activated in session.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param beginDate maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setBeginDate( String beginDate )
+    {
+        this.beginDate = beginDate;
+    }
+    
+    
+    /**
+     * Contains the end date when Role is allowed to be activated in session.  The format is - YYYYMMDD, i.e. 20101231 (December 31, 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getEndDate()
+    {
+        return this.endDate;
+    }
+    
+    
+    /**
+     * Set the end date when Role is not allowed to be activated in session.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param endDate maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setEndDate( String endDate )
+    {
+        this.endDate = endDate;
+    }
+    
+    
+    /**
+     * Contains the begin lock date when Role is temporarily not allowed to be activated in session.  The format is - YYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getBeginLockDate()
+    {
+        return this.beginLockDate;
+    }
+    
+    
+    /**
+     * Set the begin lock date when Role is temporarily not allowed to be activated in session.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param beginLockDate maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setBeginLockDate( String beginLockDate )
+    {
+        this.beginLockDate = beginLockDate;
+    }
+    
+    
+    /**
+     * Contains the end lock date when Role is allowed to be activated in session once again.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getEndLockDate()
+    {
+        return this.endLockDate;
+    }
+    
+    
+    /**
+     * Set the end lock date when Role is allowed to be activated in session once again.  The format is - YYYYMMDD, i.e. 20100101 (January 1. 2010).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param endLockDate maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setEndLockDate( String endLockDate )
+    {
+        this.endLockDate = endLockDate;
+    }
+    
+    
+    /**
+     * Get the daymask that indicates what days of week Role is allowed to be activated in session.  The format is 1234567, i.e. 23456 (Monday, Tuesday, Wednesday, Thursday, Friday).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return attribute maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public String getDayMask()
+    {
+        return this.dayMask;
+    }
+    
+    
+    /**
+     * Set the daymask that specifies what days of week Role is allowed to be activated in session.  The format is 1234567, i.e. 23456 (Monday, Tuesday, Wednesday, Thursday, Friday).
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param dayMask maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setDayMask( String dayMask )
+    {
+        this.dayMask = dayMask;
+    }
+    
+    
+    /**
+     * Return the integer timeout that contains total time (in seconds) that Role may remain inactive in User's session before it is deactivated.
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @return int maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public Integer getTimeout()
+    {
+        return this.timeout;
+    }
+    
+    
+    /**
+     * Set the integer timeout that contains max time (in seconds) that Role may remain inactive in User's session before it is deactivated.
+     * This attribute is optional but if set will be validated for reasonableness.
+     *
+     * @param timeout maps to 'ftCstr' attribute in 'ftRls' object class.
+     */
+    @Override
+    public void setTimeout( Integer timeout )
+    {
+        this.timeout = timeout;
+    }
+    
+    
+    /**
+     * Get the names of roles that are parents (direct ascendants) of this role.
+     * @return Set of parent role names assigned to this role.
+     */
+    @Override
+    public Set<String> getParents()
+    {
+        if ( this.parents == null )
         {
-            if ( isFirst )
-            {
-                isFirst = false;
-            }
-            else
-            {
-                sb.append( '|' );
-            }
-
-            sb.append( parent );
+            this.parents = new HashSet<>();
         }
-
-        sb.append( '}' );
+        return parents;
     }
-
-    // The children if any
-    if ( ( children != null ) && ( children.size() > 0 ) )
+    
+    
+    /**
+     * Set the names of roles names that are parents (direct ascendants) of this role.
+     * @param parents contains the Set of parent role names assigned to this role.
+     */
+    @Override
+    public void setParents( Set<String> parents )
     {
-        sb.append( ", children : {" );
-
-        boolean isFirst = true;
-
-        for ( String child : children )
+        this.parents = parents;
+    }
+    
+    
+    /**
+     * Set the occupant attribute with the contents of the User dn.
+     * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
+     */
+    @Override
+    public void setParent( String parent )
+    {
+        if ( this.parents == null )
+        {
+            this.parents = new HashSet<>();
+        }
+        this.parents.add( parent );
+    }
+    
+    
+    /**
+     * Set the occupant attribute with the contents of the User dn.
+     * @param parent maps to 'ftParents' attribute on 'ftRls' object class.
+     */
+    @Override
+    public void delParent( String parent )
+    {
+        if ( this.parents != null )
+        {
+            this.parents.remove( parent );
+        }
+    }
+    
+    
+    /**
+     * Return the Set of child role names (direct descendants) of this role.
+     * @return Set of child role names assigned to this role.
+     */
+    public Set<String> getChildren()
+    {
+        return children;
+    }
+    
+    
+    /**
+     * Set the Set of child role names (direct descendants) of this role
+     * @param children contains the Set of child role names assigned to this role.
+     */
+    public void setChildren( Set<String> children )
+    {
+        this.children = children;
+    }
+    
+    
+    /**
+     * Matches the name from two Role entities.
+     *
+     * @param thatObj contains a Role entity.
+     * @return boolean indicating both objects contain matching Role names.
+     */
+    public boolean equals( Object thatObj )
+    {
+        if ( this == thatObj )
+        {
+            return true;
+        }
+    
+        if ( name == null )
         {
-            if ( isFirst )
+            return false;
+        }
+    
+        if ( !( thatObj instanceof Role ) )
+        {
+            return false;
+        }
+    
+        Role thatRole = ( Role ) thatObj;
+    
+        if ( thatRole.getName() == null )
+        {
+            return false;
+        }
+    
+        return thatRole.getName().equalsIgnoreCase( name );
+    }
+    
+    
+    /**
+     * @see Object#toString()
+     */
+    protected String toString( String tabs )
+    {
+        StringBuilder sb = new StringBuilder();
+    
+        sb.append( tabs ).append( "Role[" );
+    
+        // The name
+        sb.append( name ).append( ", " );
+    
+        if ( ( description != null ) && ( description.length() > 0 ) )
+        {
+            sb.append( description ).append( ", " );
+        }
+    
+        // the date
+        sb.append( "date : <" ).append( beginDate ).append( ", " ).append( endDate ).append( ">, " );
+    
+        // The time
+        sb.append( "time : <" ).append( beginTime ).append( ", " ).append( endTime ).append( ">, " );
+    
+        // The lock date
+        sb.append( "lock date : <" ).append( beginLockDate ).append( ", " ).append( endLockDate ).append( ">, " );
+    
+        // The timeout
+        sb.append( "timeout : " ).append( timeout ).append( ", " );
+    
+        // The day mask
+        sb.append( "daymask : " ).append( dayMask );
+    
+        // The parents if any
+        if ( ( parents != null ) && ( parents.size() > 0 ) )
+        {
+            sb.append( ", parents : {" );
+    
+            boolean isFirst = true;
+    
+            for ( String parent : parents )
             {
-                isFirst = false;
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    sb.append( '|' );
+                }
+    
+                sb.append( parent );
             }
-            else
+    
+            sb.append( '}' );
+        }
+    
+        // The children if any
+        if ( ( children != null ) && ( children.size() > 0 ) )
+        {
+            sb.append( ", children : {" );
+    
+            boolean isFirst = true;
+    
+            for ( String child : children )
             {
-                sb.append( '|' );
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    sb.append( '|' );
+                }
+    
+                sb.append( child );
             }
-
-            sb.append( child );
+    
+            sb.append( '}' );
         }
-
-        sb.append( '}' );
+    
+        sb.append( ']' );
+    
+        return sb.toString();
     }
-
-    sb.append( ']' );
-
-    return sb.toString();
+    
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return toString( "" );
     }
 }


[03/20] git commit: Made the constructor protected, accordingly (at least partially) to the comment

Posted by el...@apache.org.
Made the constructor protected, accordingly (at least partially) to the
comment

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

Branch: refs/heads/master
Commit: 8f2dcbcbcf79daa0dd448a0fc03fb29ada6fa792
Parents: 89acb72
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 16:54:54 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 16:54:54 2014 +0100

----------------------------------------------------------------------
 .../org/apache/directory/fortress/core/rbac/AccessMgrImpl.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/8f2dcbcb/src/main/java/org/apache/directory/fortress/core/rbac/AccessMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/AccessMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/rbac/AccessMgrImpl.java
index 5001b33..9749736 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/AccessMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/AccessMgrImpl.java
@@ -76,7 +76,7 @@ public class AccessMgrImpl extends Manageable implements AccessMgr
 
 
     // package private constructor ensures outside classes cannot use:
-    public AccessMgrImpl()
+    protected AccessMgrImpl()
     {
     }
 


[10/20] git commit: Added the read, modify and delete method that take a Dn as a parameter, instead of a String.

Posted by el...@apache.org.
Added the read, modify and delete method that take a Dn as a parameter,
instead of a String.

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

Branch: refs/heads/master
Commit: 056ce2bb5f6cd8166c4251f66438ea897d76fbe4
Parents: 13ac7c8
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 17:02:27 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 17:02:27 2014 +0100

----------------------------------------------------------------------
 .../core/ldap/ApacheDsDataProvider.java         | 80 +++++++++++++++++++-
 1 file changed, 79 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/056ce2bb/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java b/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java
index 15cf330..6d03635 100644
--- a/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java
@@ -339,6 +339,23 @@ public abstract class ApacheDsDataProvider
 
 
     /**
+     * Read the ldap record from specified location.
+     *
+     * @param connection handle to ldap connection.
+     * @param dn         contains ldap distinguished name.
+     * @param attrs      array contains array names to pull back.
+     * @return ldap entry.
+     * @throws LdapException in the event system error occurs.
+     */
+    protected Entry read( LdapConnection connection, Dn dn, String[] attrs ) throws LdapException
+    {
+        counters.incrementRead();
+
+        return connection.lookup( dn, attrs );
+    }
+
+
+    /**
      * Read the ldap record from specified location with user assertion.
      *
      * @param connection handle to ldap connection.
@@ -385,7 +402,7 @@ public abstract class ApacheDsDataProvider
     {
         counters.incrementAdd();
 
-        if ( GlobalIds.IS_AUDIT && entity != null && entity.getAdminSession() != null )
+        if ( GlobalIds.IS_AUDIT && ( entity != null ) && ( entity.getAdminSession() != null ) )
         {
             if ( VUtil.isNotNullOrEmpty( entity.getAdminSession().getInternalUserId() ) )
             {
@@ -423,6 +440,21 @@ public abstract class ApacheDsDataProvider
 
 
     /**
+     * Update exiting ldap entry to the directory.  Do not add audit context.
+     *
+     * @param connection handle to ldap connection.
+     * @param dn         contains distinguished node of entry.
+     * @param mods       contains data to modify.
+     * @throws LdapException in the event system error occurs.
+     */
+    protected void modify( LdapConnection connection, Dn dn, List<Modification> mods ) throws LdapException
+    {
+        counters.incrementMod();
+        connection.modify( dn, mods.toArray( new Modification[]{} ) );
+    }
+
+
+    /**
      * Update exiting ldap entry to the directory.  Add audit context.
      *
      * @param connection handle to ldap connection.
@@ -441,6 +473,24 @@ public abstract class ApacheDsDataProvider
 
 
     /**
+     * Update exiting ldap entry to the directory.  Add audit context.
+     *
+     * @param connection handle to ldap connection.
+     * @param dn         contains distinguished node of entry.
+     * @param mods       contains data to modify.
+     * @param entity     contains audit context.
+     * @throws LdapException in the event system error occurs.
+     */
+    protected void modify( LdapConnection connection, Dn dn, List<Modification> mods,
+        FortEntity entity ) throws LdapException
+    {
+        counters.incrementMod();
+        audit( mods, entity );
+        connection.modify( dn, mods.toArray( new Modification[]{} ) );
+    }
+
+
+    /**
      * Delete exiting ldap entry from the directory.  Do not add audit context.
      *
      * @param connection handle to ldap connection.
@@ -480,6 +530,31 @@ public abstract class ApacheDsDataProvider
 
 
     /**
+     * Delete exiting ldap entry from the directory.  Add audit context.  This method will call modify prior to
+     * delete which will
+     * force corresponding audit record to be written to slapd access log.
+     *
+     * @param connection handle to ldap connection.
+     * @param dn         contains distinguished node of entry targeted for removal..
+     * @param entity     contains audit context.
+     * @throws LdapException in the event system error occurs.
+     */
+    protected void delete( LdapConnection connection, Dn dn, FortEntity entity ) throws LdapException
+    {
+        counters.incrementDelete();
+        List<Modification> mods = new ArrayList<Modification>();
+        audit( mods, entity );
+
+        if ( mods.size() > 0 )
+        {
+            modify( connection, dn, mods );
+        }
+
+        connection.delete( dn );
+    }
+
+
+    /**
      * Delete exiting ldap entry and all descendants from the directory.  Do not add audit context.
      *
      * @param connection handle to ldap connection.
@@ -1260,16 +1335,19 @@ public abstract class ApacheDsDataProvider
         if ( VUtil.isNotNullOrEmpty( value ) )
         {
             int length = value.length();
+            
             if ( length > validLen )
             {
                 String error = "encodeSafeText value [" + value + "] invalid length [" + length + "]";
                 throw new LdapException( error );
             }
+            
             if ( GlobalIds.LDAP_FILTER_SIZE_FOUND )
             {
                 value = VUtil.escapeLDAPSearchFilter( value );
             }
         }
+        
         return value;
     }
 


[09/20] git commit: Added a /* no qualifier */ prefix for method that are package protected, for clarity.

Posted by el...@apache.org.
Added a /* no qualifier */ prefix for method that are package protected,
for clarity.

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

Branch: refs/heads/master
Commit: 13ac7c8afb5a01830829d2991ded8fa73dede2b9
Parents: 8fbf361
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 17:01:17 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 17:01:17 2014 +0100

----------------------------------------------------------------------
 .../org/apache/directory/fortress/core/rbac/DelAccessMgrImpl.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/13ac7c8a/src/main/java/org/apache/directory/fortress/core/rbac/DelAccessMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/DelAccessMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/rbac/DelAccessMgrImpl.java
index f9681ca..efcd507 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/DelAccessMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/DelAccessMgrImpl.java
@@ -60,7 +60,7 @@ public class DelAccessMgrImpl extends AccessMgrImpl implements DelAccessMgr
     private static final String SUPER_ADMIN = Config.getProperty("superadmin.role", "FortressSuperAdmin");
 
     // package private constructor ensures outside classes cannot use:
-    DelAccessMgrImpl()
+    /* No qualifier */ DelAccessMgrImpl()
     {}
 
     /**


[11/20] git commit: o Used Strings.isEmpty

Posted by el...@apache.org.
o Used Strings.isEmpty

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

Branch: refs/heads/master
Commit: 800ffdec86866cfbd92cfa244a56d9ede15d0dc5
Parents: 056ce2b
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 17:05:55 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 17:06:25 2014 +0100

----------------------------------------------------------------------
 .../fortress/core/ldap/group/GroupMgrFactory.java        |  9 +++++++--
 .../directory/fortress/core/ldap/group/GroupP.java       | 11 ++++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/800ffdec/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupMgrFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupMgrFactory.java b/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupMgrFactory.java
index 102587c..4a3bfd3 100755
--- a/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupMgrFactory.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupMgrFactory.java
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.fortress.core.ldap.group;
 
+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.cfg.Config;
@@ -41,6 +42,7 @@ public class GroupMgrFactory
 {
     private static String groupClassName = Config.getProperty( GlobalIds.GROUP_IMPLEMENTATION );
     private static final String CLS_NM = GroupMgrFactory.class.getName();
+    private static final String CREATE_INSTANCE_METHOD = CLS_NM + ".createInstance";
 
     /**
      * Create and return a reference to {@link GroupMgr} object using HOME context.
@@ -64,14 +66,16 @@ public class GroupMgrFactory
     public static GroupMgr createInstance(String contextId)
         throws SecurityException
     {
-        VUtil.assertNotNull( contextId, GlobalErrIds.CONTEXT_NULL, CLS_NM + ".createInstance" );
-        if (!VUtil.isNotNullOrEmpty(groupClassName))
+        VUtil.assertNotNull( contextId, GlobalErrIds.CONTEXT_NULL, CREATE_INSTANCE_METHOD );
+        
+        if ( Strings.isEmpty( groupClassName ) )
         {
             groupClassName = GroupMgrImpl.class.getName();
         }
 
         GroupMgr groupMgr = (GroupMgr) ClassUtil.createInstance(groupClassName);
         groupMgr.setContextId(contextId);
+        
         return groupMgr;
     }
 
@@ -102,6 +106,7 @@ public class GroupMgrFactory
     {
         GroupMgr groupMgr = createInstance(contextId);
         groupMgr.setAdmin(adminSess);
+        
         return groupMgr;
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/800ffdec/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupP.java b/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupP.java
index c311443..5588d20 100755
--- a/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupP.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupP.java
@@ -20,11 +20,11 @@
 package org.apache.directory.fortress.core.ldap.group;
 
 
+import org.apache.directory.api.util.Strings;
 import org.apache.directory.fortress.core.ValidationException;
 import org.apache.directory.fortress.core.rbac.User;
 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;
@@ -55,6 +55,7 @@ final class GroupP
     final Group add( Group group ) throws SecurityException
     {
         validate( group );
+        
         return gDao.create( group );
     }
 
@@ -68,6 +69,7 @@ final class GroupP
     final Group update( Group group ) throws SecurityException
     {
         validate( group );
+        
         return gDao.update( group );
     }
 
@@ -185,12 +187,13 @@ final class GroupP
      */
     private void validate( Group entity ) throws SecurityException
     {
-        if ( !VUtil.isNotNullOrEmpty( entity.getName() ) )
+        if ( Strings.isEmpty( entity.getName() ) )
         {
             String error = "validate name validation failed, null or empty value";
             LOG.warn( error );
             throw new ValidationException( GlobalErrIds.GROUP_NAME_NULL, error );
         }
+        
         if ( entity.getName().length() > GlobalIds.OU_LEN )
         {
             String name = entity.getName();
@@ -198,6 +201,7 @@ final class GroupP
             LOG.warn( error );
             throw new ValidationException( GlobalErrIds.GROUP_NAME_INVLD, error );
         }
+        
         if ( entity.getProtocol().length() > GlobalIds.OU_LEN )
         {
             String error = "validate protocol [" + entity.getProtocol() + "] invalid length [" + entity.getProtocol()
@@ -205,7 +209,8 @@ final class GroupP
             LOG.warn( error );
             throw new ValidationException( GlobalErrIds.GROUP_PROTOCOL_INVLD, error );
         }
-        if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
+        
+        if ( !Strings.isEmpty( entity.getDescription() ) )
         {
             VUtil.description( entity.getDescription() );
         }


[18/20] git commit: o Added a serialVersionUID o Calling the parent toString() in the toString() method

Posted by el...@apache.org.
o Added a serialVersionUID
o Calling the parent toString() in the toString() method

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

Branch: refs/heads/master
Commit: 035ad686e55c957c5e4e2b1217fb120ce9a943f1
Parents: 123e918
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Wed Nov 5 18:29:07 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Wed Nov 5 18:29:07 2014 +0100

----------------------------------------------------------------------
 .../org/apache/directory/fortress/core/rbac/AdminRole.java     | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/035ad686/src/main/java/org/apache/directory/fortress/core/rbac/AdminRole.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRole.java b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRole.java
index a0154ef..cdde8e5 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRole.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRole.java
@@ -177,6 +177,10 @@ import org.apache.directory.fortress.core.util.time.Constraint;
 })
 public class AdminRole extends Role implements Administrator
 {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 1L;
     private Set<String> osPs;
     private Set<String> osUs;
     private String beginRange;
@@ -507,6 +511,8 @@ public class AdminRole extends Role implements Administrator
 
         sb.append( "AdminRole object: \n" );
 
+        sb.append( super.toString( "    " ) ).append( '\n' );
+        
         if ( beginRange != null )
         {
             sb.append( "    beginRange :" ).append( beginRange ).append( '\n' );


[20/20] git commit: Added teh SchemaConstants instead of teh GlobalIds constants

Posted by el...@apache.org.
Added teh SchemaConstants instead of teh GlobalIds constants

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

Branch: refs/heads/master
Commit: 1a4d9716a8dc72a3aadbacd2e3598c2cc4591815
Parents: 24fe48d
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Wed Nov 5 18:32:22 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Wed Nov 5 18:32:22 2014 +0100

----------------------------------------------------------------------
 .../org/apache/directory/fortress/core/rbac/OrgUnitDAO.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/1a4d9716/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
index 31f645d..41f83f0 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
@@ -494,6 +494,8 @@ final class OrgUnitDAO extends ApacheDsDataProvider
             {
                 ouSet.add( getAttribute( searchResults.getEntry(), SchemaConstants.OU_AT ) );
             }
+            
+            searchResults.close();
         }
         catch ( LdapException e )
         {
@@ -604,11 +606,11 @@ final class OrgUnitDAO extends ApacheDsDataProvider
             switch ( orgUnit.type )
             {
                 case USER:
-                    dn = new Dn( GlobalIds.OU + "=" + orgUnit.getName(), getRootDn( orgUnit.getContextId(), GlobalIds.OSU_ROOT ) );
+                    dn = new Dn( SchemaConstants.OU_AT + "=" + orgUnit.getName(), getRootDn( orgUnit.getContextId(), GlobalIds.OSU_ROOT ) );
                     break;
     
                 case PERM:
-                    dn = new Dn( GlobalIds.OU + "=" + orgUnit.getName(), getRootDn( orgUnit.getContextId(), GlobalIds.PSU_ROOT ) );
+                    dn = new Dn( SchemaConstants.OU_AT + "=" + orgUnit.getName(), getRootDn( orgUnit.getContextId(), GlobalIds.PSU_ROOT ) );
                     break;
     
                 default:


[05/20] git commit: o The getDn method now returns a Dn instead of a String o Used constants from StringsConstants now that we depend on the LDAP API

Posted by el...@apache.org.
o The getDn method now returns a Dn instead of a String
o Used constants from StringsConstants now that we depend on the LDAP
API

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

Branch: refs/heads/master
Commit: a8533c8d36f89cf4ae14ef588594153b71a051f3
Parents: ab93bd2
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 16:57:48 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 16:57:48 2014 +0100

----------------------------------------------------------------------
 .../fortress/core/rbac/OrgUnitDAO.java          | 80 ++++++++++++--------
 1 file changed, 47 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/a8533c8d/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
index 90fd98f..31f645d 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitDAO.java
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
 
+import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.cursor.CursorException;
 import org.apache.directory.api.ldap.model.cursor.SearchCursor;
 import org.apache.directory.api.ldap.model.entry.DefaultEntry;
@@ -34,12 +35,14 @@ import org.apache.directory.api.ldap.model.entry.Modification;
 import org.apache.directory.api.ldap.model.entry.ModificationOperation;
 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.LdapInvalidDnException;
 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.ldap.client.api.LdapConnection;
+import org.apache.directory.mavibot.btree.util.Strings;
 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;
@@ -128,22 +131,24 @@ final class OrgUnitDAO extends ApacheDsDataProvider
     final OrgUnit create( OrgUnit entity ) throws CreateException
     {
         LdapConnection ld = null;
-        String dn = getDn( entity );
+        Dn dn = getDn( entity );
 
         try
         {
             Entry entry = new DefaultEntry( dn );
-            entry.add( GlobalIds.OBJECT_CLASS, ORGUNIT_OBJ_CLASS );
+            entry.add( SchemaConstants.OBJECT_CLASS_AT, ORGUNIT_OBJ_CLASS );
             entity.setId();
             entry.add( GlobalIds.FT_IID, entity.getId() );
+            
+            String description = entity.getDescription();
 
-            if ( entity.getDescription() != null && entity.getDescription().length() > 0 )
+            if ( !Strings.isEmpty( description ) )
             {
-                entry.add( GlobalIds.DESC, entity.getDescription() );
+                entry.add( GlobalIds.DESC, description );
             }
 
             // organizational name requires OU attribute:
-            entry.add( GlobalIds.OU, entity.getName() );
+            entry.add( SchemaConstants.OU_AT, entity.getName() );
 
             // These multi-valued attributes are optional.  The utility function will return quietly if no items are loaded into collection:
             loadAttrs( entity.getParents(), entry, GlobalIds.PARENT_NODES );
@@ -187,7 +192,7 @@ final class OrgUnitDAO extends ApacheDsDataProvider
     final OrgUnit update( OrgUnit entity ) throws UpdateException
     {
         LdapConnection ld = null;
-        String dn = getDn( entity );
+        Dn dn = getDn( entity );
 
         try
         {
@@ -241,7 +246,7 @@ final class OrgUnitDAO extends ApacheDsDataProvider
     final void deleteParent( OrgUnit entity ) throws UpdateException
     {
         LdapConnection ld = null;
-        String dn = getDn( entity );
+        Dn dn = getDn( entity );
 
         try
         {
@@ -283,7 +288,7 @@ final class OrgUnitDAO extends ApacheDsDataProvider
     final OrgUnit remove( OrgUnit entity ) throws RemoveException
     {
         LdapConnection ld = null;
-        String dn = getDn( entity );
+        Dn dn = getDn( entity );
 
         try
         {
@@ -326,7 +331,7 @@ final class OrgUnitDAO extends ApacheDsDataProvider
     {
         OrgUnit oe = null;
         LdapConnection ld = null;
-        String dn = getDn( entity );
+        Dn dn = getDn( entity );
 
         try
         {
@@ -474,7 +479,7 @@ final class OrgUnitDAO extends ApacheDsDataProvider
      */
     final Set<String> getOrgs( OrgUnit orgUnit ) throws FinderException
     {
-        Set<String> ouSet = new TreeSet<>( String.CASE_INSENSITIVE_ORDER );
+        Set<String> ouSet = new TreeSet<String>( String.CASE_INSENSITIVE_ORDER );
         LdapConnection ld = null;
         String orgUnitRoot = getOrgRoot( orgUnit );
 
@@ -487,7 +492,7 @@ final class OrgUnitDAO extends ApacheDsDataProvider
 
             while ( searchResults.next() )
             {
-                ouSet.add( getAttribute( searchResults.getEntry(), GlobalIds.OU ) );
+                ouSet.add( getAttribute( searchResults.getEntry(), SchemaConstants.OU_AT ) );
             }
         }
         catch ( LdapException e )
@@ -584,32 +589,41 @@ final class OrgUnitDAO extends ApacheDsDataProvider
 
 
     /**
-     * @param orgUnit
-     * @return
+     * Creates a new Dn for the given orgUnit
+     *  
+     * @param orgUnit The orgUnit
+     * @return A Dn
+     * @throws LdapInvalidDnException If the DN is invalid 
      */
-    private String getDn( OrgUnit orgUnit )
+    private Dn getDn( OrgUnit orgUnit )
     {
-        String dn = null;
-
-        switch ( orgUnit.type )
+        Dn dn = null;
+        
+        try
         {
-            case USER:
-                dn = GlobalIds.OU + "=" + orgUnit.getName() + ","
-                    + getRootDn( orgUnit.getContextId(), GlobalIds.OSU_ROOT );
-                break;
-
-            case PERM:
-                dn = GlobalIds.OU + "=" + orgUnit.getName() + ","
-                    + getRootDn( orgUnit.getContextId(), GlobalIds.PSU_ROOT );
-                break;
+            switch ( orgUnit.type )
+            {
+                case USER:
+                    dn = new Dn( GlobalIds.OU + "=" + orgUnit.getName(), getRootDn( orgUnit.getContextId(), GlobalIds.OSU_ROOT ) );
+                    break;
+    
+                case PERM:
+                    dn = new Dn( GlobalIds.OU + "=" + orgUnit.getName(), getRootDn( orgUnit.getContextId(), GlobalIds.PSU_ROOT ) );
+                    break;
+    
+                default:
+                    String warning = "getDn invalid type";
+                    LOG.warn( warning );
+                    break;
+            }
 
-            default:
-                String warning = "getDn invalid type";
-                LOG.warn( warning );
-                break;
+            return dn;
+        }
+        catch ( LdapInvalidDnException lide )
+        {
+            LOG.error( lide.getMessage() );
+            throw new RuntimeException( lide.getMessage() );
         }
-
-        return dn;
     }
 
 


[04/20] git commit: Adding missing generics

Posted by el...@apache.org.
Adding missing generics

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

Branch: refs/heads/master
Commit: ab93bd298f9203083ee460fdd6529f7a347a57e2
Parents: 8f2dcbc
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 16:55:23 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 16:55:23 2014 +0100

----------------------------------------------------------------------
 .../org/apache/directory/fortress/core/rbac/AdminRoleDAO.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/ab93bd29/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleDAO.java
index e0dfdaa..80c5182 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleDAO.java
@@ -239,6 +239,7 @@ final class AdminRoleDAO extends ApacheDsDataProvider
             if ( entity.isTemporalSet() )
             {
                 String szRawData = CUtil.setConstraint( entity );
+                
                 if ( VUtil.isNotNullOrEmpty( szRawData ) )
                 {
                     mods.add( new DefaultModification(
@@ -356,6 +357,7 @@ final class AdminRoleDAO extends ApacheDsDataProvider
     {
         LdapConnection ld = null;
         String dn = getDn( entity );
+        
         try
         {
             List<Modification> mods = new ArrayList<Modification>();
@@ -460,7 +462,7 @@ final class AdminRoleDAO extends ApacheDsDataProvider
      */
     final List<AdminRole> findRoles( AdminRole adminRole ) throws FinderException
     {
-        List<AdminRole> roleList = new ArrayList<>();
+        List<AdminRole> roleList = new ArrayList<AdminRole>();
         LdapConnection ld = null;
         String roleRoot = getRootDn( adminRole.getContextId(), GlobalIds.ADMIN_ROLE_ROOT );
         String filter;
@@ -508,7 +510,7 @@ final class AdminRoleDAO extends ApacheDsDataProvider
      */
     final List<String> findRoles( AdminRole adminRole, int limit ) throws FinderException
     {
-        List<String> roleList = new ArrayList<>();
+        List<String> roleList = new ArrayList<String>();
         LdapConnection ld = null;
         String roleRoot = getRootDn( adminRole.getContextId(), GlobalIds.ADMIN_ROLE_ROOT );
         String filter;


[08/20] git commit: Added constants for some method name

Posted by el...@apache.org.
Added constants for some method name

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

Branch: refs/heads/master
Commit: 8fbf3614ef803c2fa3b6419bafffb18202d96a4b
Parents: c1d87e8
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 17:00:41 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 17:00:41 2014 +0100

----------------------------------------------------------------------
 .../fortress/core/rbac/DelAdminMgrImpl.java       | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/8fbf3614/src/main/java/org/apache/directory/fortress/core/rbac/DelAdminMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/DelAdminMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/rbac/DelAdminMgrImpl.java
index ea6291c..ab6f3a3 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/DelAdminMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/DelAdminMgrImpl.java
@@ -51,6 +51,8 @@ import java.util.Set;
 public final class DelAdminMgrImpl extends Manageable implements DelAdminMgr
 {
     private static final String CLS_NM = DelAdminMgrImpl.class.getName();
+    private static final String ADD_OU_METHOD = ".addOU";
+    private static final String FULL_ADD_OU_METHOD = CLS_NM + "." + ADD_OU_METHOD;
     private static final OrgUnitP ouP = new OrgUnitP();
     private static final AdminRoleP admRP = new AdminRoleP();
     private static final PermP permP = new PermP();
@@ -332,18 +334,16 @@ public final class DelAdminMgrImpl extends Manageable implements DelAdminMgr
      *
      * @param entity contains OrgUnit name and type.
      * @return OrgUnit contains reference to entity added.
-     * @throws org.apache.directory.fortress.core.SecurityException
-     *          in the event of data validation or system error.
+     * @throws SecurityException in the event of data validation or system error.
      */
     @Override
-    public OrgUnit add(OrgUnit entity)
-        throws SecurityException
+    public OrgUnit add(OrgUnit entity) throws SecurityException
     {
-        String methodName = "addOU";
-        assertContext(CLS_NM, methodName, entity, GlobalErrIds.ORG_NULL);
-        setEntitySession(CLS_NM, methodName, entity);
-        VUtil.assertNotNull(entity.getType(), GlobalErrIds.ORG_TYPE_NULL, CLS_NM + "." + methodName);
-        return ouP.add(entity);
+        assertContext( ADD_OU_METHOD, entity, GlobalErrIds.ORG_NULL );
+        setEntitySession( CLS_NM, ADD_OU_METHOD, entity);
+        VUtil.assertNotNull( entity.getType(), GlobalErrIds.ORG_TYPE_NULL, FULL_ADD_OU_METHOD );
+        
+        return ouP.add( entity );
     }
 
     /**


[12/20] git commit: o Fixed a LOG o Used a better entry constructor

Posted by el...@apache.org.
o Fixed a LOG
o Used a better entry constructor

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

Branch: refs/heads/master
Commit: 6cda535628237ae8c17f5ee1fda74c5fa74aa481
Parents: 800ffde
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 17:07:34 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 17:07:34 2014 +0100

----------------------------------------------------------------------
 .../ldap/container/OrganizationalUnitDAO.java   | 22 ++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/6cda5356/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizationalUnitDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizationalUnitDAO.java b/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizationalUnitDAO.java
index f2e05cd..551362e 100755
--- a/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizationalUnitDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizationalUnitDAO.java
@@ -97,16 +97,21 @@ final class OrganizationalUnitDAO extends ApacheDsDataProvider
     {
         LdapConnection ld = null;
         String nodeDn = GlobalIds.OU + "=" + oe.getName() + ",";
+        
         if ( VUtil.isNotNullOrEmpty( oe.getParent() ) )
+        {
             nodeDn += GlobalIds.OU + "=" + oe.getParent() + ",";
+        }
+        
         nodeDn += getRootDn( oe.getContextId() );
+        
         try
         {
-            LOG.info( "create container dn [" + nodeDn + "]" );
-            Entry myEntry = new DefaultEntry( nodeDn );
-            myEntry.add( GlobalIds.OBJECT_CLASS, ORGUNIT_OBJ_CLASS );
-            myEntry.add( GlobalIds.OU, oe.getName() );
-            myEntry.add( GlobalIds.DESC, oe.getDescription() );
+            LOG.info( "create container dn [{}]",  nodeDn );
+            Entry myEntry = new DefaultEntry( nodeDn,
+                GlobalIds.OBJECT_CLASS, ORGUNIT_OBJ_CLASS,
+                GlobalIds.OU, oe.getName(),
+                GlobalIds.DESC, oe.getDescription() );
             ld = getAdminConnection();
             add( ld, myEntry );
         }
@@ -132,11 +137,16 @@ final class OrganizationalUnitDAO extends ApacheDsDataProvider
     {
         LdapConnection ld = null;
         String nodeDn = GlobalIds.OU + "=" + oe.getName() + ",";
+        
         if ( VUtil.isNotNullOrEmpty( oe.getParent() ) )
+        {
             nodeDn += GlobalIds.OU + "=" + oe.getParent() + ",";
+        }
+        
         nodeDn += getRootDn( oe.getContextId(), GlobalIds.SUFFIX );
 
-        LOG.info( "remove container dn [" + nodeDn + "]" );
+        LOG.info( "remove container dn [{}]", nodeDn );
+        
         try
         {
             ld = getAdminConnection();


[15/20] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/directory-fortress-core

Posted by el...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/directory-fortress-core


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

Branch: refs/heads/master
Commit: effe0e9d9e764b9ce54d3aad9e1eccfbf071c5ef
Parents: 61dc367 804ca39
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Tue Nov 4 16:48:54 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Tue Nov 4 16:48:54 2014 +0100

----------------------------------------------------------------------
 .../apache/directory/fortress/core/rbac/AdminRoleUtil.java  | 9 +++++----
 .../org/apache/directory/fortress/core/rbac/PsoUtil.java    | 9 +++++----
 .../org/apache/directory/fortress/core/rbac/RoleUtil.java   | 9 +++++----
 .../org/apache/directory/fortress/core/rbac/UsoUtil.java    | 9 +++++----
 4 files changed, 20 insertions(+), 16 deletions(-)
----------------------------------------------------------------------



[13/20] git commit: Fixed some LOG

Posted by el...@apache.org.
Fixed some LOG

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

Branch: refs/heads/master
Commit: 3e9404554a3a3ad4d310e3a384455e8276b9d2d7
Parents: 6cda535
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 17:08:14 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 17:08:14 2014 +0100

----------------------------------------------------------------------
 .../directory/fortress/core/rbac/DelegatedMgrImplTest.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3e940455/src/test/java/org/apache/directory/fortress/core/rbac/DelegatedMgrImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/rbac/DelegatedMgrImplTest.java b/src/test/java/org/apache/directory/fortress/core/rbac/DelegatedMgrImplTest.java
index ecdf3d6..c203dba 100755
--- a/src/test/java/org/apache/directory/fortress/core/rbac/DelegatedMgrImplTest.java
+++ b/src/test/java/org/apache/directory/fortress/core/rbac/DelegatedMgrImplTest.java
@@ -931,17 +931,17 @@ public class DelegatedMgrImplTest extends TestCase
     public static void addOrgUnit( String msg, String[] org )
     {
         LogUtil.logIt( msg );
+        
         try
         {
             DelAdminMgr dAdminMgr = DelAdminMgrFactory.createInstance( TestUtils.getContext() );
             OrgUnit ou = OrgUnitTestData.getOrgUnit( org );
             OrgUnit entity = dAdminMgr.add( ou );
-            LOG.debug( "addOrgUnit ou [" + entity.getName() + "] successful" );
+            LOG.debug( "addOrgUnit ou [{}] successful", entity.getName() );
         }
         catch ( SecurityException ex )
         {
-            LOG.error(
-                "addOrgUnit caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
+            LOG.error( "addOrgUnit caught SecurityException rc={}, msg={}", ex.getErrorId(), ex.getMessage(), ex );
             fail( ex.getMessage() );
         }
     }


[19/20] git commit: Improved teh wayw e build the DN

Posted by el...@apache.org.
Improved teh wayw e build the DN

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

Branch: refs/heads/master
Commit: 24fe48d9bfb6451ccd821ca6ea062a8de4990f2f
Parents: 035ad68
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Wed Nov 5 18:30:17 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Wed Nov 5 18:30:17 2014 +0100

----------------------------------------------------------------------
 .../fortress/core/ldap/ApacheDsDataProvider.java       | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/24fe48d9/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java b/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java
index 583e676..4b7591f 100644
--- a/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/ApacheDsDataProvider.java
@@ -277,7 +277,6 @@ public abstract class ApacheDsDataProvider
     protected String getRootDn( String contextId, String root )
     {
         String szDn = Config.getProperty( root );
-        StringBuilder dn = new StringBuilder();
 
         // The contextId must not be null, or "HOME" or "null"
         if ( VUtil.isNotNullOrEmpty( contextId ) && !contextId.equalsIgnoreCase( GlobalIds.NULL ) && !contextId
@@ -288,16 +287,22 @@ public abstract class ApacheDsDataProvider
             if ( idx != -1 )
             {
                 // Found. The DN is ,ou=<contextId>,  
+                StringBuilder dn = new StringBuilder();
+
                 dn.append( szDn.substring( 0, idx - 1 ) ).append( "," ).append( GlobalIds.OU ).append( "=" ).append(
                     contextId ).append( "," ).append( szDn.substring( idx ) );
+                
+                return dn.toString();
+            }
+            else
+            {
+                return "";
             }
         }
         else
         {
-            dn.append( szDn );
+            return szDn;
         }
-
-        return dn.toString();
     }
 
 


[07/20] git commit: Reformatted the code

Posted by el...@apache.org.
Reformatted the code

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

Branch: refs/heads/master
Commit: c1d87e8d9e395189747f4b5c2e12808ac074bf33
Parents: 4451b02
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 16:59:58 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 16:59:58 2014 +0100

----------------------------------------------------------------------
 .../fortress/core/rbac/FortEntity.java          | 286 +++++++++----------
 1 file changed, 143 insertions(+), 143 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/c1d87e8d/src/main/java/org/apache/directory/fortress/core/rbac/FortEntity.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/FortEntity.java b/src/main/java/org/apache/directory/fortress/core/rbac/FortEntity.java
index e1610cd..7789d97 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/FortEntity.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/FortEntity.java
@@ -90,147 +90,147 @@ import javax.xml.bind.annotation.XmlType;
 })
 public abstract class FortEntity
 {
-protected String modCode;
-protected String modId;
-@XmlTransient
-protected Session adminSession;
-protected long sequenceId;
-@XmlTransient
-protected String contextId;
-
-
-/**
- * Default constructor will call the setter to load a new internal ID into entity.
- */
-public FortEntity()
-{
-    setInternalId();
-}
-
-
-/**
- * Use this constructor to load administrative RBAC session into this entity.
- *
- * @param adminSession contains ARBAC Session object.
- */
-public FortEntity( Session adminSession )
-{
-    setInternalId();
-    this.adminSession = adminSession;
-}
-
-
-/**
- * This attribute is required but is set automatically by Fortress DAO class before object is persisted to ldap.
- * This generated internal id is associated with PermObj.  This method is used by DAO class and
- * is not available to outside classes.   The generated attribute maps to 'ftId' in 'ftObject' object class.
- */
-private void setInternalId()
-{
-    UUID uuid = UUID.randomUUID();
-    this.modId = uuid.toString();
-}
-
-
-/**
- * Return the ARBAC Session object that was loaded into this entity.
- *
- * @return ARBAC Session object.
- */
-public Session getAdminSession()
-{
-    return adminSession;
-}
-
-
-/**
- * Load an ARBAC Session object into this entity.  Once loaded, all Fortress Manager's will perform administrative
- * permission checks against the User who is contained within the Session.
- *
- * @param adminSession
- */
-public void setAdminSession( Session adminSession )
-{
-    this.adminSession = adminSession;
-}
-
-
-/**
- * Contains the Fortress modification code to be associated with an audit record.  This is the ObjectName.methodName
- * for the Manager API that was called.
- *
- * @return String contains the modification code maps to 'ftModCode' attribute in 'FortEntity' object class.
- */
-public String getModCode()
-{
-    return modCode;
-}
-
-
-/**
- * Set the Fortress modification code to be associated with an audit record.  Contains the Fortress modification code
- * which is ObjectName.methodName for the Manager API that was called.
- *
- * @param modCode contains the modification code maps to 'ftModCode' attribute in 'FortEntity' object class.
- */
-public void setModCode( String modCode )
-{
-    this.modCode = modCode;
-}
-
-
-/**
- * Get the unique ID that is to be associated with a particular audit record in directory.
- *
- * @return attribute that maps to 'ftModId' attribute in 'FortEntity' object class.
- */
-public String getModId()
-{
-    return modId;
-}
-
-
-/**
- * Return the contextId for this record.  The contextId is used for multi-tenancy to isolate data sets within a particular sub-tree within DIT
- *
- * @return value maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
- */
-public String getContextId()
-{
-    return contextId;
-}
-
-
-/**
- * Set the contextId associated with this record.  The contextId is used for multi-tenancy to isolate data sets within a particular sub-tree within DIT.
- * Package private to prevent outside classes from setting.
- *
- * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
- */
-public void setContextId( String contextId )
-{
-    this.contextId = contextId;
-}
-
-
-/**
- * Sequence id is used internal to Fortress.
- *
- * @return long value contains sequence id.
- */
-public long getSequenceId()
-{
-    return sequenceId;
-}
-
-
-/**
- * Sequence id is used internal to Fortress
- *
- * @param sequenceId contains sequence to use.
- */
-public void setSequenceId( long sequenceId )
-{
-    this.sequenceId = sequenceId;
-}
+    protected String modCode;
+    protected String modId;
+    @XmlTransient
+    protected Session adminSession;
+    protected long sequenceId;
+    @XmlTransient
+    protected String contextId;
+    
+    
+    /**
+     * Default constructor will call the setter to load a new internal ID into entity.
+     */
+    public FortEntity()
+    {
+        setInternalId();
+    }
+    
+    
+    /**
+     * Use this constructor to load administrative RBAC session into this entity.
+     *
+     * @param adminSession contains ARBAC Session object.
+     */
+    public FortEntity( Session adminSession )
+    {
+        setInternalId();
+        this.adminSession = adminSession;
+    }
+    
+    
+    /**
+     * This attribute is required but is set automatically by Fortress DAO class before object is persisted to ldap.
+     * This generated internal id is associated with PermObj.  This method is used by DAO class and
+     * is not available to outside classes.   The generated attribute maps to 'ftId' in 'ftObject' object class.
+     */
+    private void setInternalId()
+    {
+        UUID uuid = UUID.randomUUID();
+        this.modId = uuid.toString();
+    }
+    
+    
+    /**
+     * Return the ARBAC Session object that was loaded into this entity.
+     *
+     * @return ARBAC Session object.
+     */
+    public Session getAdminSession()
+    {
+        return adminSession;
+    }
+    
+    
+    /**
+     * Load an ARBAC Session object into this entity.  Once loaded, all Fortress Manager's will perform administrative
+     * permission checks against the User who is contained within the Session.
+     *
+     * @param adminSession
+     */
+    public void setAdminSession( Session adminSession )
+    {
+        this.adminSession = adminSession;
+    }
+    
+    
+    /**
+     * Contains the Fortress modification code to be associated with an audit record.  This is the ObjectName.methodName
+     * for the Manager API that was called.
+     *
+     * @return String contains the modification code maps to 'ftModCode' attribute in 'FortEntity' object class.
+     */
+    public String getModCode()
+    {
+        return modCode;
+    }
+    
+    
+    /**
+     * Set the Fortress modification code to be associated with an audit record.  Contains the Fortress modification code
+     * which is ObjectName.methodName for the Manager API that was called.
+     *
+     * @param modCode contains the modification code maps to 'ftModCode' attribute in 'FortEntity' object class.
+     */
+    public void setModCode( String modCode )
+    {
+        this.modCode = modCode;
+    }
+    
+    
+    /**
+     * Get the unique ID that is to be associated with a particular audit record in directory.
+     *
+     * @return attribute that maps to 'ftModId' attribute in 'FortEntity' object class.
+     */
+    public String getModId()
+    {
+        return modId;
+    }
+    
+    
+    /**
+     * Return the contextId for this record.  The contextId is used for multi-tenancy to isolate data sets within a particular sub-tree within DIT
+     *
+     * @return value maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
+     */
+    public String getContextId()
+    {
+        return contextId;
+    }
+    
+    
+    /**
+     * Set the contextId associated with this record.  The contextId is used for multi-tenancy to isolate data sets within a particular sub-tree within DIT.
+     * Package private to prevent outside classes from setting.
+     *
+     * @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
+     */
+    public void setContextId( String contextId )
+    {
+        this.contextId = contextId;
+    }
+    
+    
+    /**
+     * Sequence id is used internal to Fortress.
+     *
+     * @return long value contains sequence id.
+     */
+    public long getSequenceId()
+    {
+        return sequenceId;
+    }
+    
+    
+    /**
+     * Sequence id is used internal to Fortress
+     *
+     * @param sequenceId contains sequence to use.
+     */
+    public void setSequenceId( long sequenceId )
+    {
+        this.sequenceId = sequenceId;
+    }
 }
\ No newline at end of file


[06/20] git commit: o Declared a static field for the createInstance method name, avoiding a concatenation later o Used the Strings.isEmpty() method

Posted by el...@apache.org.
o Declared a static field for the createInstance method name, avoiding a
concatenation later
o Used the Strings.isEmpty() method

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

Branch: refs/heads/master
Commit: 4451b020760cef8eef8798e414e73cd617803ab7
Parents: a8533c8
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 16:59:13 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 16:59:13 2014 +0100

----------------------------------------------------------------------
 .../directory/fortress/core/DelAdminMgrFactory.java     | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/4451b020/src/main/java/org/apache/directory/fortress/core/DelAdminMgrFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/DelAdminMgrFactory.java b/src/main/java/org/apache/directory/fortress/core/DelAdminMgrFactory.java
index 649cc47..1db31d6 100755
--- a/src/main/java/org/apache/directory/fortress/core/DelAdminMgrFactory.java
+++ b/src/main/java/org/apache/directory/fortress/core/DelAdminMgrFactory.java
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.fortress.core;
 
+import org.apache.directory.api.util.Strings;
 import org.apache.directory.fortress.core.cfg.Config;
 import org.apache.directory.fortress.core.rbac.ClassUtil;
 import org.apache.directory.fortress.core.rbac.DelAdminMgrImpl;
@@ -39,6 +40,7 @@ public class DelAdminMgrFactory
 {
     private static String dAdminClassName = Config.getProperty(GlobalIds.DELEGATED_ADMIN_IMPLEMENTATION);
     private static final String CLS_NM = DelAdminMgrFactory.class.getName();
+    private static final String CREATE_INSTANCE_METHOD = CLS_NM + ".createInstance";
 
     /**
      * Create and return a reference to {@link DelAdminMgr} object using HOME context.
@@ -62,10 +64,11 @@ public class DelAdminMgrFactory
     public static DelAdminMgr createInstance(String contextId)
         throws SecurityException
     {
-        VUtil.assertNotNull(contextId, GlobalErrIds.CONTEXT_NULL, CLS_NM + ".createInstance");
-        if (!VUtil.isNotNullOrEmpty(dAdminClassName))
+        VUtil.assertNotNull( contextId, GlobalErrIds.CONTEXT_NULL, CREATE_INSTANCE_METHOD );
+        
+        if ( Strings.isEmpty( dAdminClassName ) )
         {
-            if(GlobalIds.IS_REST)
+            if ( GlobalIds.IS_REST )
             {
                 dAdminClassName = DelAdminMgrRestImpl.class.getName();
             }
@@ -75,8 +78,9 @@ public class DelAdminMgrFactory
             }
         }
 
-        DelAdminMgr delAdminMgr = (DelAdminMgr) ClassUtil.createInstance(dAdminClassName);
+        DelAdminMgr delAdminMgr = (DelAdminMgr) ClassUtil.createInstance( dAdminClassName );
         delAdminMgr.setContextId(contextId);
+        
         return delAdminMgr;
     }
 


[14/20] git commit: Minor formatting

Posted by el...@apache.org.
Minor formatting

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

Branch: refs/heads/master
Commit: 61dc367c7ed21f8cddc7da08b5c5432c3997949f
Parents: 3e94045
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Sun Nov 2 17:10:11 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Sun Nov 2 17:10:11 2014 +0100

----------------------------------------------------------------------
 .../directory/fortress/core/AccessMgrFactory.java      |  3 +--
 .../core/ldap/container/OrganizationalUnitP.java       |  5 +++++
 .../directory/fortress/core/rbac/AdminRoleP.java       | 13 +++++++++++++
 .../fortress/core/rbac/AccessMgrImplTest.java          |  2 ++
 .../apache/directory/fortress/core/rbac/TestUtils.java |  2 ++
 .../fortress/core/rbac/apacheds/AdminManagerTest.java  |  3 +++
 .../core/rbac/apacheds/FortressJUnitApachedsTest.java  |  1 -
 7 files changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/61dc367c/src/main/java/org/apache/directory/fortress/core/AccessMgrFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/AccessMgrFactory.java b/src/main/java/org/apache/directory/fortress/core/AccessMgrFactory.java
index 5a74567..076e37e 100755
--- a/src/main/java/org/apache/directory/fortress/core/AccessMgrFactory.java
+++ b/src/main/java/org/apache/directory/fortress/core/AccessMgrFactory.java
@@ -59,8 +59,7 @@ public class AccessMgrFactory
      * @return instance of {@link AccessMgr}.
      * @throws SecurityException in the event of failure during instantiation.
      */
-    public static AccessMgr createInstance(String contextId)
-        throws SecurityException
+    public static AccessMgr createInstance( String contextId) throws SecurityException
     {
         VUtil.assertNotNull(contextId, GlobalErrIds.CONTEXT_NULL, CLS_NM + ".createInstance");
         if (!VUtil.isNotNullOrEmpty(accessClassName))

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/61dc367c/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizationalUnitP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizationalUnitP.java b/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizationalUnitP.java
index 7ce72d8..ca036db 100755
--- a/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizationalUnitP.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/container/OrganizationalUnitP.java
@@ -118,12 +118,14 @@ public class OrganizationalUnitP
             LOG.warn( error );
             throw new ValidationException( GlobalErrIds.CNTR_NAME_INVLD, error );
         }
+        
         if ( !VUtil.isNotNullOrEmpty( entity.getName() ) )
         {
             String error = "validate name validation failed, null or empty value";
             LOG.warn( error );
             throw new ValidationException( GlobalErrIds.CNTR_NAME_NULL, error );
         }
+        
         if ( entity.getParent().length() > GlobalIds.OU_LEN )
         {
             String name = entity.getName();
@@ -132,13 +134,16 @@ public class OrganizationalUnitP
             LOG.warn( error );
             throw new ValidationException( GlobalErrIds.CNTR_PARENT_INVLD, error );
         }
+        
         if ( !VUtil.isNotNullOrEmpty( entity.getParent() ) )
         {
             String error = "validate parent validation failed, null or empty value";
             LOG.warn( error );
             throw new ValidationException( GlobalErrIds.CNTR_PARENT_NULL, error );
         }
+        
         VUtil.safeText( entity.getDescription(), GlobalIds.DESC_LEN );
+        
         if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
         {
             VUtil.description( entity.getDescription() );

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/61dc367c/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleP.java b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleP.java
index 35aece2..01f5978 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleP.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/AdminRoleP.java
@@ -306,10 +306,12 @@ public final class AdminRoleP
         throws SecurityException
     {
         VUtil.safeText( entity.getName(), GlobalIds.ROLE_LEN );
+        
         if ( VUtil.isNotNullOrEmpty( entity.getBeginRange() ) && VUtil.isNotNullOrEmpty( entity.getEndRange() ) )
         {
             VUtil.safeText( entity.getBeginRange(), GlobalIds.ROLE_LEN );
             VUtil.safeText( entity.getEndRange(), GlobalIds.ROLE_LEN );
+            
             if ( entity.getBeginRange().equalsIgnoreCase( entity.getEndRange() )
                 && ( !entity.isBeginInclusive() || !entity.isEndInclusive() ) )
             {
@@ -341,42 +343,52 @@ public final class AdminRoleP
             LOG.warn( error );
             throw new SecurityException( GlobalErrIds.ARLE_END_RANGE_NULL, error );
         }
+        
         if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
         {
             VUtil.description( entity.getDescription() );
         }
+        
         if ( entity.getTimeout() >= 0 )
         {
             VUtil.timeout( entity.getTimeout() );
         }
+        
         if ( VUtil.isNotNullOrEmpty( entity.getBeginTime() ) )
         {
             VUtil.beginTime( entity.getBeginTime() );
         }
+        
         if ( VUtil.isNotNullOrEmpty( entity.getEndTime() ) )
         {
             VUtil.endTime( entity.getEndTime() );
         }
+        
         if ( VUtil.isNotNullOrEmpty( entity.getBeginDate() ) )
         {
             VUtil.beginDate( entity.getBeginDate() );
         }
+        
         if ( VUtil.isNotNullOrEmpty( entity.getEndDate() ) )
         {
             VUtil.endDate( entity.getEndDate() );
         }
+        
         if ( VUtil.isNotNullOrEmpty( entity.getDayMask() ) )
         {
             VUtil.dayMask( entity.getDayMask() );
         }
+        
         if ( VUtil.isNotNullOrEmpty( entity.getBeginLockDate() ) )
         {
             VUtil.beginDate( entity.getBeginDate() );
         }
+        
         if ( VUtil.isNotNullOrEmpty( entity.getEndLockDate() ) )
         {
             VUtil.endDate( entity.getEndLockDate() );
         }
+        
         if ( VUtil.isNotNullOrEmpty( entity.getOsU() ) )
         {
             for ( String ou : entity.getOsU() )
@@ -387,6 +399,7 @@ public final class AdminRoleP
                 op.read( inOe );
             }
         }
+        
         if ( VUtil.isNotNullOrEmpty( entity.getOsP() ) )
         {
             for ( String ou : entity.getOsP() )

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/61dc367c/src/test/java/org/apache/directory/fortress/core/rbac/AccessMgrImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/rbac/AccessMgrImplTest.java b/src/test/java/org/apache/directory/fortress/core/rbac/AccessMgrImplTest.java
index 5804fc1..eaaca95 100755
--- a/src/test/java/org/apache/directory/fortress/core/rbac/AccessMgrImplTest.java
+++ b/src/test/java/org/apache/directory/fortress/core/rbac/AccessMgrImplTest.java
@@ -464,9 +464,11 @@ public class AccessMgrImplTest extends TestCase
     public static void createSessionsWithRolesTrusted( String msg, String[][] uArray, String[][] rArray )
     {
         LogUtil.logIt( msg );
+        
         try
         {
             AccessMgr accessMgr = AccessMgrFactory.createInstance( TestUtils.getContext() );
+            
             for ( String[] usr : uArray )
             {
                 User user = UserTestData.getUser( usr );

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/61dc367c/src/test/java/org/apache/directory/fortress/core/rbac/TestUtils.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/rbac/TestUtils.java b/src/test/java/org/apache/directory/fortress/core/rbac/TestUtils.java
index 8230d22..433f70d 100755
--- a/src/test/java/org/apache/directory/fortress/core/rbac/TestUtils.java
+++ b/src/test/java/org/apache/directory/fortress/core/rbac/TestUtils.java
@@ -65,10 +65,12 @@ public class TestUtils extends TestCase
     {
         // This property can be overriden with system property:
         String tenant = System.getProperty( GlobalIds.TENANT );
+        
         if ( VUtil.isNotNullOrEmpty( tenant ) && !tenant.equals( "${tenant}" ) )
         {
             contextId = tenant;
         }
+        
         return contextId;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/61dc367c/src/test/java/org/apache/directory/fortress/core/rbac/apacheds/AdminManagerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/rbac/apacheds/AdminManagerTest.java b/src/test/java/org/apache/directory/fortress/core/rbac/apacheds/AdminManagerTest.java
index da71f81..03c4f64 100644
--- a/src/test/java/org/apache/directory/fortress/core/rbac/apacheds/AdminManagerTest.java
+++ b/src/test/java/org/apache/directory/fortress/core/rbac/apacheds/AdminManagerTest.java
@@ -114,9 +114,11 @@ public class AdminManagerTest extends AbstractLdapTestUnit
     private void addUsers( String msg, String[][] uArray, boolean isAdmin )
     {
         LogUtil.logIt( msg );
+        
         try
         {
             AdminMgr adminMgr;
+            
             if ( isAdmin )
             {
                 adminMgr = getManagedAdminMgr();
@@ -125,6 +127,7 @@ public class AdminManagerTest extends AbstractLdapTestUnit
             {
                 adminMgr = AdminMgrFactory.createInstance( TestUtils.getContext() );
             }
+            
             for ( String[] usr : uArray )
             {
                 User user = UserTestData.getUser( usr );

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/61dc367c/src/test/java/org/apache/directory/fortress/core/rbac/apacheds/FortressJUnitApachedsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/rbac/apacheds/FortressJUnitApachedsTest.java b/src/test/java/org/apache/directory/fortress/core/rbac/apacheds/FortressJUnitApachedsTest.java
index 45fa6a4..8649332 100644
--- a/src/test/java/org/apache/directory/fortress/core/rbac/apacheds/FortressJUnitApachedsTest.java
+++ b/src/test/java/org/apache/directory/fortress/core/rbac/apacheds/FortressJUnitApachedsTest.java
@@ -35,7 +35,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.directory.fortress.core.SecurityException;
-import org.apache.directory.fortress.core.ldap.LdapCounters;
 import org.apache.directory.fortress.core.rbac.AccessMgrImplTest;
 import org.apache.directory.fortress.core.rbac.AdminMgrImplTest;
 import org.apache.directory.fortress.core.rbac.AdminRoleTestData;