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/10/31 19:18:28 UTC

[1/8] git commit: o Removed FCNQ from the code o Used teh Strings.isEmpty() method instead of testing for nullity and the length of a String

Repository: directory-fortress-core
Updated Branches:
  refs/heads/master c7bc8fcd1 -> b6258df4c


o Removed FCNQ from the code
o Used teh Strings.isEmpty() method instead of testing for nullity and
the length 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/9ea7bbc8
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/9ea7bbc8
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/9ea7bbc8

Branch: refs/heads/master
Commit: 9ea7bbc82c3a4cb981333cda3fe29c34490ce7b6
Parents: 3f2cbc5
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Fri Oct 31 13:53:34 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Fri Oct 31 13:53:34 2014 +0100

----------------------------------------------------------------------
 .../directory/fortress/core/rbac/ClassUtil.java | 28 +++++++++++---------
 1 file changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/9ea7bbc8/src/main/java/org/apache/directory/fortress/core/rbac/ClassUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/ClassUtil.java b/src/main/java/org/apache/directory/fortress/core/rbac/ClassUtil.java
index 9dde185..998f65e 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/ClassUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/ClassUtil.java
@@ -21,6 +21,7 @@ package org.apache.directory.fortress.core.rbac;
 
 import org.apache.directory.fortress.core.CfgException;
 import org.apache.directory.fortress.core.GlobalErrIds;
+import org.apache.directory.mavibot.btree.util.Strings;
 
 import java.io.InputStream;
 
@@ -52,34 +53,36 @@ public class ClassUtil
      * @throws org.apache.directory.fortress.core.CfgException in the event of failure to instantiate.
      *
      */
-    public static Object createInstance(String className)
-        throws CfgException
+    public static Object createInstance(String className) throws CfgException
     {
         Object target;
+        
         try
         {
-            if (className == null || className.length() == 0)
+            if ( Strings.isEmpty( className ) )
             {
                 String error = "createInstance() null or empty classname";
                 throw new CfgException(GlobalErrIds.FT_MGR_CLASS_NAME_NULL, error);
             }
-            target = Class.forName(className).newInstance();
+            
+            target = Class.forName( className ).newInstance();
         }
-        catch (java.lang.ClassNotFoundException e)
+        catch ( ClassNotFoundException e )
         {
             String error = "createInstance() className [" + className + "] caught java.lang.ClassNotFoundException=" + e;
             throw new CfgException(GlobalErrIds.FT_MGR_CLASS_NOT_FOUND, error, e);
         }
-        catch (java.lang.InstantiationException e)
+        catch ( InstantiationException e )
         {
             String error = "createInstance()  [" + className + "] caught java.lang.InstantiationException=" + e;
             throw new CfgException(GlobalErrIds.FT_MGR_INST_EXCEPTION, error, e);
         }
-        catch (java.lang.IllegalAccessException e)
+        catch ( IllegalAccessException e )
         {
             String error = "createInstance()  [" + className + "] caught java.lang.IllegalAccessException=" + e;
             throw new CfgException(GlobalErrIds.FT_MGR_ILLEGAL_ACCESS, error, e);
         }
+        
         return target;
 	}
 
@@ -88,16 +91,17 @@ public class ClassUtil
      * Find a file on the classloader and return as InputStream.
      * @param name contains the name of the file resource.
      * @return handle to the InputStream
-     * @throws org.apache.directory.fortress.core.CfgException in the event resource is not found on classloader.
+     * @throws CfgException in the event resource is not found on classloader.
      */
-    public static InputStream resourceAsStream(String name) throws CfgException
+    public static InputStream resourceAsStream( String name ) throws CfgException
     {
-        InputStream is;
-        is = ClassUtil.class.getClassLoader().getResourceAsStream(name);
-        if (is == null)
+        InputStream is = ClassUtil.class.getClassLoader().getResourceAsStream( name );
+        
+        if ( is == null )
         {
             throw new CfgException(GlobalErrIds.FT_RESOURCE_NOT_FOUND, name);
         }
+        
         return is;
     }
 }


[8/8] git commit: Added a property file to be able to run the ApacheDS tests in eclipseé

Posted by el...@apache.org.
Added a property file to be able to run the ApacheDS tests in eclipseé


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

Branch: refs/heads/master
Commit: b6258df4cb35f5a69c49faa66ee07532a21f4b23
Parents: c8dd5a6
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Fri Oct 31 19:18:16 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Fri Oct 31 19:18:16 2014 +0100

----------------------------------------------------------------------
 src/test/resources/fortress.properties | 170 ++++++++++++++++++++++++++++
 1 file changed, 170 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/b6258df4/src/test/resources/fortress.properties
----------------------------------------------------------------------
diff --git a/src/test/resources/fortress.properties b/src/test/resources/fortress.properties
new file mode 100644
index 0000000..de74818
--- /dev/null
+++ b/src/test/resources/fortress.properties
@@ -0,0 +1,170 @@
+#
+#   Licensed to the Apache Software Foundation (ASF) under one
+#   or more contributor license agreements.  See the NOTICE file
+#   distributed with this work for additional information
+#   regarding copyright ownership.  The ASF licenses this file
+#   to you under the Apache License, Version 2.0 (the
+#   "License"); you may not use this file except in compliance
+#   with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#   KIND, either express or implied.  See the License for the
+#   specific language governing permissions and limitations
+#   under the License.
+#
+
+# Host name and port of LDAP DIT:
+host=localhost
+port=10389
+
+# Used for SSL Connection to LDAP Server:
+enable.ldap.ssl=false
+enable.ldap.ssl.debug=flase
+trust.store=
+trust.store.password=
+trust.store.set.prop=
+
+# These credentials are used for read/write access to all nodes under suffix:
+admin.user=uid=admin,ou=system
+# LDAP admin root pass is encrypted using 'encrypt' target in build.xml:
+admin.pw=secret
+
+# This is min/max connection pool settings for User's who access their accounts in ou=People:
+# This is setting for ldap user's pool:
+min.user.conn=1
+max.user.conn=10
+
+# This is min/max settings for LDAP administrator pool which has read/write access to all nodes under suffix:
+min.admin.conn=1
+max.admin.conn=10
+
+# These credentials are used for read/write access to all nodes under slapd access log suffix:
+log.admin.user=uid=admin,ou=system
+# For corresponding log user:
+log.admin.pw=secret
+
+# This is min/max settings for LDAP administrator pool connections that have read/write access to all nodes under suffix:
+min.log.conn=1
+max.log.conn=10
+
+# enable this to see trace statements when connection pool allocates new connections:
+debug.ldap.pool=true
+# Default for pool reconnect flag is false:
+enable.pool.reconnect=true
+authn.type=default
+#authNType=realm
+ldap.server.type=APACHEDS
+
+# Define the high-level structure of LDAP DIT:
+suffix=dc=example,dc=com
+config.root=ou=Config,dc=example,dc=com
+user.root=ou=People,dc=example,dc=com
+pwpolicy.root=ou=Policies,dc=example,dc=com
+role.root=ou=Roles,ou=RBAC,dc=example,dc=com
+perm.root=ou=Permissions,ou=RBAC,dc=example,dc=com
+sdconstraint.root=ou=Constraints,ou=RBAC,dc=example,dc=com
+userou.root=ou=OS-U,ou=ARBAC,dc=example,dc=com
+permou.root=ou=OS-P,ou=ARBAC,dc=example,dc=com
+adminrole.root=ou=AdminRoles,ou=ARBAC,dc=example,dc=com
+adminperm.root=ou=AdminPerms,ou=ARBAC,dc=example,dc=com
+audit.root=cn=log,dc=example,dc=com
+group.root=ou=Groups,dc=example,dc=com
+example.root=ou=Examples,dc=example,dc=com
+
+superadmin.role=oamSuperAdmin
+
+# these properties will enable temporal constraint checks on role activations:
+temporal.validator.0=org.apache.directory.fortress.core.util.time.Date
+temporal.validator.1=org.apache.directory.fortress.core.util.time.LockDate
+temporal.validator.2=org.apache.directory.fortress.core.util.time.Timeout
+temporal.validator.3=org.apache.directory.fortress.core.util.time.ClockTime
+temporal.validator.4=org.apache.directory.fortress.core.util.time.Day
+
+# enabling this property will enable Dynamic Separation of Duty constraint checks on role activations:
+temporal.validator.dsd=org.apache.directory.fortress.core.rbac.DSDChecker
+
+# Users in the following list cannot be deleted using OAM admin functions (AdminMgr.deleteUser, AdminMgr.forceDeleteUser)
+sys.user.1=oamTU6User1
+sys.user.2=oamTU6User2
+sys.user.3=oamTU6User3
+sys.user.4=oamTU6User4
+sys.user.5=oamTU6User5
+
+# Fortress Class Definitions:  NOT NEEDED UNLESS OVERIDING DEFAULT IMPLEMENTATIONS
+accessmgr.implementation=org.apache.directory.fortress.core.rbac.AccessMgrImpl
+auditmgr.implementation=org.apache.directory.fortress.core.rbac.AuditMgrImpl
+
+dao.connector=@LDAP_CLIENT_TYPE@
+
+ehcache.config.file=ehcache.xml
+
+## Fortress Data Validation settings
+field.length=130
+
+#########  This section is for filtering out LDAP meta characters from search field input:
+#########  Ensure the chars are placed in ASCII value ascending order.
+
+# This must match the total number of items that need to be filtered in our list:
+ldap.filter.size=15
+
+#! 33 0041 0x21
+ldap.filter.1=!
+ldap.sub.1=21
+#% 37 0045 0x25
+ldap.filter.2=%
+ldap.sub.2=25
+#& 38 0046 0x26
+ldap.filter.3=&
+ldap.sub.3=26
+#( 40 0050 0x28
+ldap.filter.4=(
+ldap.sub.4=28
+#) 41 0051 0x29
+ldap.filter.5=)
+ldap.sub.5=29
+#* 42 0052 0x2a
+ldap.filter.6=*
+ldap.sub.6=2a
+#+ 43 0053 0x2b
+ldap.filter.7=+
+ldap.sub.7=2b
+#- 45 0055 0x2d
+ldap.filter.8=-
+ldap.sub.8=2d
+#/ 47 0057 0x2f
+ldap.filter.9=/
+ldap.sub.9=2f
+#< 60 0074 0x3c
+ldap.filter.10=<
+ldap.sub.10=3c
+#= 61 0075 0x3d
+ldap.filter.11==
+ldap.sub.11=3d
+#> 62 0076 0x3e
+ldap.filter.12=>
+ldap.sub.12=3e
+#\ 92 0134 0x5c
+ldap.filter.13=\\
+ldap.sub.13=5c
+#| 124 0174 0x7c
+ldap.filter.14=|
+ldap.sub.14=7c
+#~ 126 0176 0x7e
+ldap.filter.15=~
+ldap.sub.15=7e
+
+#keep alphanumerics and dashes
+#regXSafetext=^A-Za-z0-9- .
+
+user.objectclass=inetOrgPerson
+group.objectclass=configGroup
+group.protocol=configProtocol
+group.properties=configParameter
+#crypto.prop=
+enable.audit=true
+clientside.sorting=true
+attr.delimiter=$
\ No newline at end of file


[2/8] git commit: Added some space in the toString() method for clarity

Posted by el...@apache.org.
Added some space in the toString() method 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/cb03e335
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/cb03e335
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/cb03e335

Branch: refs/heads/master
Commit: cb03e33502359c8ff9b98d4579b14c54f209a99c
Parents: 9ea7bbc
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Fri Oct 31 14:32:43 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Fri Oct 31 14:32:43 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/cb03e335/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnit.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnit.java b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnit.java
index a975e5b..22e900f 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnit.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnit.java
@@ -450,10 +450,10 @@ public class OrgUnit extends FortEntity implements Graphable, Serializable
 
         sb.append( "OrgUnit object: \n" );
 
-        sb.append( "    name :" ).append( name ).append( '\n' );
-        sb.append( "    id :" ).append( id ).append( '\n' );
-        sb.append( "    description :" ).append( description ).append( '\n' );
-        sb.append( "    type :" ).append( type ).append( '\n' );
+        sb.append( "    name : " ).append( name ).append( '\n' );
+        sb.append( "    id : " ).append( id ).append( '\n' );
+        sb.append( "    description : " ).append( description ).append( '\n' );
+        sb.append( "    type : " ).append( type ).append( '\n' );
 
         if ( parents != null )
         {


[5/8] git commit: Removed a reference to us.jts.fortress

Posted by el...@apache.org.
Removed a reference to us.jts.fortress

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

Branch: refs/heads/master
Commit: 1324fa4087c14ef1077b220f22bdfcfc8c34afa9
Parents: 1663094
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Fri Oct 31 19:15:08 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Fri Oct 31 19:15:08 2014 +0100

----------------------------------------------------------------------
 build.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/1324fa40/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index ad9a647..46e93e3 100644
--- a/build.xml
+++ b/build.xml
@@ -268,7 +268,7 @@
        <property name="test.showoutput" value="yes" />
 
        <!-- define Maven coordinates (publishing only) -->
-       <property name="groupId" value="org.openldap" />
+       <property name="groupId" value="org.apache.directory" />
        <property name="artifactId" value="fortress" />
 
        <!-- defined maven snapshots and staging repository id and url (publishing only) -->


[6/8] git commit: Added some ignore

Posted by el...@apache.org.
Added some ignore


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

Branch: refs/heads/master
Commit: 1e753c5b2f35d15927a53724b25599dbf26fd38b
Parents: 1324fa4
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Fri Oct 31 19:15:59 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Fri Oct 31 19:15:59 2014 +0100

----------------------------------------------------------------------
 .gitignore | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/1e753c5b/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 4a9490d..17e7371 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,7 +8,6 @@ eclipse-classes
 *.ipr
 lib/*.jar
 build
-config
 dist
 .externalToolBuilders
 apache-ant-1.9.1


[4/8] git commit: added the dependencies on apacheDS modules instead of using apacheds-all

Posted by el...@apache.org.
added the dependencies on apacheDS modules instead of using apacheds-all


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

Branch: refs/heads/master
Commit: 16630940f831c78ff2dd88da6df7bd2a5c05821c
Parents: 40f0766
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Fri Oct 31 19:13:37 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Fri Oct 31 19:13:37 2014 +0100

----------------------------------------------------------------------
 pom.xml | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 159 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/16630940/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0c9485c..c6e7521 100644
--- a/pom.xml
+++ b/pom.xml
@@ -114,7 +114,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
     <version.ant>1.9.1</version.ant>
     <version.ant.launcher>1.9.1</version.ant.launcher>
     <version.antlr>2.7.7</version.antlr>
-    <version.apacheds.all>2.0.0-M17</version.apacheds.all>
+    <version.apacheds>2.0.0-M18-SNAPSHOT</version.apacheds>
     <version.api.all>1.0.0-M24</version.api.all>
     <version.commons.beanutils>1.7.0</version.commons.beanutils>
     <version.commons.beanutils-core>1.8.0</version.commons.beanutils-core>
@@ -171,7 +171,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
   <!-- The dependencies                                       -->
   <!-- ====================================================== --> 
   <dependencies>
-    <dependency>
+    <!-- dependency>
       <groupId>org.openldap</groupId>
       <artifactId>accelerator-api</artifactId>
       <version>${version.accelerator.api}</version>
@@ -181,7 +181,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
       <groupId>org.openldap</groupId>
       <artifactId>accelerator-impl</artifactId>
       <version>${version.accelerator.impl}</version>
-    </dependency>
+    </dependency -->
 
     <dependency>
       <groupId>commons-lang</groupId>
@@ -231,12 +231,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
       <version>${version.cxf.common.utilities}</version>
     </dependency>
 
-    <dependency>
+    <!-- dependency>
       <groupId>org.apache.directory.api</groupId>
       <artifactId>api-all</artifactId>
       <version>${version.api.all}</version>
       <type>jar</type>
-    </dependency>
+    </dependency -->
     
     <dependency>
       <groupId>org.apache.ant</groupId>
@@ -276,12 +276,165 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
     </dependency-->
 
     <!-- tests dependencies -->
-    <dependency>
+    <!-- dependency>
       <groupId>org.apache.directory.server</groupId>
       <artifactId>apacheds-all</artifactId>
       <version>${version.apacheds.all}</version>
       <type>jar</type>
       <scope>test</scope>
+    </dependency -->
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core-annotations</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core-api</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core-avl</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core-constants</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core-jndi</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-interceptor-kerberos</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.jdbm</groupId>
+      <artifactId>apacheds-jdbm1</artifactId>
+      <version>2.0.0-M2</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-jdbm-partition</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-kerberos-codec</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-ldif-partition</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-protocol-dhcp</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-protocol-dns</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-protocol-kerberos</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-protocol-ldap</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-protocol-ntp</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-protocol-shared</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-annotations</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-config</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-jndi</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-test-framework</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-xdbm-partition</artifactId>
+      <version>${version.apacheds}</version>
+      <scope>test</scope>
     </dependency>
 
     <dependency>


[3/8] git commit: o Used locks instead of syncrhonization o Make is really thread safe, by protecting the global pool access and updates, for all operations o Separated the getOrgSet() method into 2 methods, as we already test the type before calling thi

Posted by el...@apache.org.
o Used locks instead of syncrhonization
o Make is really thread safe, by protecting the global pool access and
updates, for all operations
o Separated the getOrgSet() method into 2 methods, as we already test
the type before calling this 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/40f07664
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/40f07664
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/40f07664

Branch: refs/heads/master
Commit: 40f0766442a25009293c698357093eff1ebf6353
Parents: cb03e33
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Fri Oct 31 16:34:28 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Fri Oct 31 16:34:28 2014 +0100

----------------------------------------------------------------------
 .../directory/fortress/core/rbac/OrgUnitP.java  | 155 +++++++++++++++----
 1 file changed, 126 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/40f07664/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitP.java b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitP.java
index da019f3..3d2aa36 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitP.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/OrgUnitP.java
@@ -22,10 +22,11 @@ package org.apache.directory.fortress.core.rbac;
 
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 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;
@@ -62,8 +63,8 @@ public final class OrgUnitP
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
 
     // these fields are used to synchronize access to the above static pools:
-    private static final Object userPoolSynchLock = new Object();
-    private static final Object permPoolSynchLock = new Object();
+    private static final Lock userPoolLock = new ReentrantLock();
+    private static final Lock permPoolLock = new ReentrantLock();
     private static Cache ouCache;
 
     // DAO class for OU data sets must be initializer before the other statics:
@@ -95,22 +96,42 @@ public final class OrgUnitP
     final boolean isValid( OrgUnit entity )
     {
         boolean result = false;
+        
         if ( entity.type == OrgUnit.Type.USER )
         {
-            Set<String> userPool = getOrgSet( entity );
-            if ( userPool != null && entity.getType() == OrgUnit.Type.USER )
+            try
+            {
+                userPoolLock.lock();
+                Set<String> userPool = getUserSet( entity );
+
+                if ( userPool != null )
+                {
+                    result = userPool.contains( entity.getName() );
+                }
+            }
+            finally
             {
-                result = userPool.contains( entity.getName() );
+                userPoolLock.unlock();
             }
         }
         else
         {
-            Set<String> permPool = getOrgSet( entity );
-            if ( permPool != null )
+            try
             {
-                result = permPool.contains( entity.getName() );
+                permPoolLock.lock();
+                Set<String> permPool = getPermSet( entity );
+
+                if ( permPool != null )
+                {
+                    result = permPool.contains( entity.getName() );
+                }
+            }
+            finally
+            {
+                permPoolLock.unlock();
             }
         }
+        
         return result;
     }
 
@@ -122,6 +143,7 @@ public final class OrgUnitP
     private static Set<String> loadOrgSet( OrgUnit orgUnit )
     {
         Set<String> ouSet = null;
+        
         try
         {
             ouSet = oDao.getOrgs( orgUnit );
@@ -131,6 +153,7 @@ public final class OrgUnitP
             String warning = "loadOrgSet static initializer caught SecurityException=" + se;
             LOG.info( warning, se );
         }
+        
         if ( orgUnit.getType() == OrgUnit.Type.USER )
         {
             // TODO:  add context id to this cache
@@ -147,26 +170,55 @@ public final class OrgUnitP
 
     /**
      *
-     * @param orgUnit will either be a User or Perm OU.
-     * @return Set containing the OU mapping to a particular type and tenant.
+     * @param orgUnit will be a Perm OU.
+     * @return Set containing the OU mapping to a Perm type and tenant.
      */
-    private static Set<String> getOrgSet( OrgUnit orgUnit )
+    private static Set<String> getPermSet( OrgUnit orgUnit )
     {
-        Set<String> orgSet;
-        if ( orgUnit.getType() == OrgUnit.Type.USER )
+        try
         {
-            orgSet = ( Set<String> ) ouCache.get( getKey( USER_OUS, orgUnit.getContextId() ) );
+            permPoolLock.lock();
+            @SuppressWarnings("unchecked")
+            Set<String> permSet = ( Set<String> ) ouCache.get( getKey( PERM_OUS, orgUnit.getContextId() ) );
+
+            if ( permSet == null )
+            {
+                permSet = loadOrgSet( orgUnit );
+            }
+            
+            return permSet;
         }
-        else
+        finally
         {
-            orgSet = ( Set<String> ) ouCache.get( getKey( PERM_OUS, orgUnit.getContextId() ) );
+            permPoolLock.unlock();
         }
+    }
+
 
-        if ( orgSet == null )
+    /**
+     *
+     * @param orgUnit will be a User OU
+     * @return Set containing the OU mapping to the user type and tenant.
+     */
+    private static Set<String> getUserSet( OrgUnit orgUnit )
+    {
+        try
+        {
+            userPoolLock.lock();
+            @SuppressWarnings("unchecked")
+            Set<String> userSet = ( Set<String> ) ouCache.get( getKey( USER_OUS, orgUnit.getContextId() ) );
+
+            if ( userSet == null )
+            {
+                userSet = loadOrgSet( orgUnit );
+            }
+            
+            return userSet;
+        }
+        finally
         {
-            orgSet = loadOrgSet( orgUnit );
+            userPoolLock.unlock();
         }
-        return orgSet;
     }
 
 
@@ -181,6 +233,7 @@ public final class OrgUnitP
     final OrgUnit read( OrgUnit entity ) throws SecurityException
     {
         validate( entity, false );
+        
         return oDao.findByKey( entity );
     }
 
@@ -213,24 +266,44 @@ public final class OrgUnitP
     {
         validate( entity, false );
         OrgUnit oe = oDao.create( entity );
+        
         if ( entity.getType() == OrgUnit.Type.USER )
         {
-            Set<String> userPool = getOrgSet( entity );
-            synchronized ( userPoolSynchLock )
+            try
             {
+                userPoolLock.lock();
+
+                Set<String> userPool = getUserSet( entity );
+                
                 if ( userPool != null )
+                {
                     userPool.add( entity.getName() );
+                }
+            }
+            finally
+            {
+                userPoolLock.unlock();
             }
         }
         else
         {
-            Set<String> permPool = getOrgSet( entity );
-            synchronized ( permPoolSynchLock )
+            try
             {
+                permPoolLock.lock();
+
+                Set<String> permPool = getPermSet( entity );
+                
                 if ( permPool != null )
+                {
                     permPool.add( entity.getName() );
+                }
+            }
+            finally
+            {
+                permPoolLock.unlock();
             }
         }
+        
         return oe;
     }
 
@@ -248,6 +321,7 @@ public final class OrgUnitP
     final OrgUnit update( OrgUnit entity ) throws SecurityException
     {
         validate( entity, false );
+        
         return oDao.update( entity );
     }
 
@@ -279,24 +353,42 @@ public final class OrgUnitP
     final OrgUnit delete( OrgUnit entity ) throws SecurityException
     {
         oDao.remove( entity );
+        
         if ( entity.getType() == OrgUnit.Type.USER )
         {
-            Set<String> userPool = getOrgSet( entity );
-            synchronized ( userPoolSynchLock )
+            try
             {
+                userPoolLock.lock();
+                Set<String> userPool = getUserSet( entity );
+
                 if ( userPool != null )
+                {
                     userPool.remove( entity.getName() );
+                }
+            }
+            finally
+            {
+                userPoolLock.unlock();
             }
         }
         else
         {
-            Set<String> permPool = getOrgSet( entity );
-            synchronized ( permPoolSynchLock )
+            try
             {
+                permPoolLock.lock();
+                Set<String> permPool = getPermSet( entity );
+
                 if ( permPool != null )
+                {
                     permPool.remove( entity.getName() );
+                }
+            }
+            finally
+            {
+                permPoolLock.unlock();
             }
         }
+        
         return entity;
     }
 
@@ -327,14 +419,17 @@ public final class OrgUnitP
         throws SecurityException
     {
         VUtil.safeText( entity.getName(), GlobalIds.OU_LEN );
+        
         if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
         {
             VUtil.description( entity.getDescription() );
         }
+        
         if ( entity.getType() == null )
         {
             String error = "validate null or empty org unit type";
             int errCode;
+            
             if ( entity.getType() == OrgUnit.Type.PERM )
             {
                 errCode = GlobalErrIds.ORG_TYPE_NULL_PERM;
@@ -343,6 +438,7 @@ public final class OrgUnitP
             {
                 errCode = GlobalErrIds.ORG_TYPE_NULL_USER;
             }
+            
             throw new SecurityException( errCode, error );
         }
     }
@@ -358,11 +454,12 @@ public final class OrgUnitP
     private static String getKey( String type, String contextId )
     {
         String key = type;
+        
         if ( VUtil.isNotNullOrEmpty( contextId ) && !contextId.equalsIgnoreCase( GlobalIds.NULL ) )
         {
             key += ":" + contextId;
-
         }
+        
         return key;
     }
 }
\ No newline at end of file


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

Branch: refs/heads/master
Commit: c8dd5a6a6ab2bc2aaa72c16d8b271bd2bebdc0ee
Parents: 1e753c5 c7bc8fc
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Fri Oct 31 19:17:30 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Fri Oct 31 19:17:30 2014 +0100

----------------------------------------------------------------------
 NOTICE.txt | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------