directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [5/8] git commit: Used the defined SchemaConstants constants for MEMBER instead of having some locally defined one.
Date Wed, 29 Oct 2014 05:10:26 GMT
Used the defined SchemaConstants constants for MEMBER instead of
having some locally defined one.

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

Branch: refs/heads/master
Commit: c68593c1f31b4bdda0dc6ae420f35f1e5479f98b
Parents: 8818908
Author: Emmanuel L├ęcharny <elecharny@symas.com>
Authored: Wed Oct 29 06:03:59 2014 +0100
Committer: Emmanuel L├ęcharny <elecharny@symas.com>
Committed: Wed Oct 29 06:05:52 2014 +0100

----------------------------------------------------------------------
 .../fortress/core/ldap/suffix/SuffixDAO.java       | 17 +++++++++--------
 .../directory/fortress/core/rbac/SDUtil.java       |  7 ++++---
 2 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/c68593c1/src/main/java/org/apache/directory/fortress/core/ldap/suffix/SuffixDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/suffix/SuffixDAO.java b/src/main/java/org/apache/directory/fortress/core/ldap/suffix/SuffixDAO.java
index ba181fc..49ff943 100755
--- a/src/main/java/org/apache/directory/fortress/core/ldap/suffix/SuffixDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/suffix/SuffixDAO.java
@@ -20,6 +20,7 @@
 package org.apache.directory.fortress.core.ldap.suffix;
 
 
+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.entry.DefaultEntry;
 import org.apache.directory.api.ldap.model.entry.Entry;
@@ -28,7 +29,6 @@ import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.fortress.core.ldap.ApacheDsDataProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.directory.fortress.core.CreateException;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
@@ -69,8 +69,6 @@ final class SuffixDAO extends ApacheDsDataProvider
 {
     private static final String CLS_NM = SuffixDAO.class.getName();
     private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
-    private static final String DC = "dc";
-    private static final String O = "o";
     private static final String[] SUFFIX_OBJ_CLASS =
         {
             GlobalIds.SUFFIX_CLASS, GlobalIds.ORGANIZATION_CLASS
@@ -99,8 +97,8 @@ final class SuffixDAO extends ApacheDsDataProvider
             LOG.info( "create suffix dn [" + nodeDn + "]" );
             Entry myEntry = new DefaultEntry( nodeDn );
             myEntry.add( GlobalIds.OBJECT_CLASS, SUFFIX_OBJ_CLASS );
-            myEntry.add( DC, se.getName() );
-            myEntry.add( O, se.getDescription() );
+            myEntry.add( SchemaConstants.DC_AT, se.getName() );
+            myEntry.add( SchemaConstants.O_AT, se.getDescription() );
             ld = getAdminConnection();
             add( ld, myEntry );
         }
@@ -166,13 +164,16 @@ final class SuffixDAO extends ApacheDsDataProvider
      */
     private String getDn( Suffix se )
     {
-        String dn = DC + "=" + se.getName() + "," + DC + "=" + se.getDc();
+        String dn = SchemaConstants.DC_AT + "=" + se.getName() + "," + SchemaConstants.DC_AT
+ "=" + se.getDc();
+
         // only use this domain component variable if it has been set in the build.properties
file:
         if( VUtil.isNotNullOrEmpty( se.getDc2() ) && !se.getDc2().equals( "${suffix.dc2}"
))
         {
-            dn += "," + DC + "=" + se.getDc2();
+            dn += "," + SchemaConstants.DC_AT + "=" + se.getDc2();
         }
-        LOG.debug( "suffix=" + dn );
+        
+        LOG.debug( "suffix={}", dn );
+        
         return dn;
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/c68593c1/src/main/java/org/apache/directory/fortress/core/rbac/SDUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/SDUtil.java b/src/main/java/org/apache/directory/fortress/core/rbac/SDUtil.java
index 0eb4c88..52edccc 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/SDUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/SDUtil.java
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.fortress.core.rbac;
 
+import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.ReviewMgrFactory;
@@ -30,6 +31,7 @@ import org.apache.directory.fortress.core.util.cache.Cache;
 import org.apache.directory.fortress.core.util.cache.CacheMgr;
 import org.apache.directory.fortress.core.util.cache.DsdCacheEntry;
 import org.apache.directory.fortress.core.util.time.Constraint;
+
 import net.sf.ehcache.search.Attribute;
 import net.sf.ehcache.search.Query;
 import net.sf.ehcache.search.Result;
@@ -56,7 +58,6 @@ final class SDUtil
     private static final String FORTRESS_SSDS = "fortress.ssd";
     private static final SdP sp = new SdP();
     private static final String IS_DSD_CACHE_DISABLED_PARM = "enable.dsd.cache";
-    private static final String MEMBER = "member";
     private static final String DSD_NAME = "name";
     private static final String EMPTY_ELEMENT = "empty";
     private static final String CONTEXT_ID = "contextId";
@@ -242,7 +243,7 @@ final class SDUtil
         contextId = getContextId(contextId);
         Set<SDSet> finalSet = new HashSet<>();
         Attribute<String> context = m_dsdCache.getSearchAttribute(CONTEXT_ID);
-        Attribute<String> member = m_dsdCache.getSearchAttribute(MEMBER);
+        Attribute<String> member = m_dsdCache.getSearchAttribute(SchemaConstants.MEMBER_AT);
         Query query = m_dsdCache.createQuery();
         query.includeKeys();
         query.includeValues();
@@ -303,7 +304,7 @@ final class SDUtil
         else
         {
             // Search on roleName attribute which maps to 'member' attr on the cache record:
-            Attribute<String> member = m_dsdCache.getSearchAttribute(MEMBER);
+            Attribute<String> member = m_dsdCache.getSearchAttribute(SchemaConstants.MEMBER_AT);
             Attribute<String> context = m_dsdCache.getSearchAttribute(CONTEXT_ID);
             Query query = m_dsdCache.createQuery();
             query.includeKeys();


Mime
View raw message