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 2010/07/05 22:24:33 UTC

svn commit: r960682 - in /directory: apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/ shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/ shared/trunk/ldap/src/main/java/org/apache/directory/...

Author: elecharny
Date: Mon Jul  5 20:24:33 2010
New Revision: 960682

URL: http://svn.apache.org/viewvc?rev=960682&view=rev
Log:
o Added a constant in SchemaConstants for the 'administrativeRole' AT
o Used it in the server

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
    directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=960682&r1=960681&r2=960682&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Mon Jul  5 20:24:33 2010
@@ -418,10 +418,12 @@ public class SubentryInterceptor extends
             // get the name of the administrative point and its administrativeRole attributes
             DN apName = name.getParent();
             Entry ap = addContext.lookup( apName, ByPassConstants.LOOKUP_BYPASS );
-            EntryAttribute administrativeRole = ap.get( "administrativeRole" );
+            
+            // The administrativeRole AT must exist and not be null
+            EntryAttribute administrativeRole = ap.get( SchemaConstants.ADMINISTRATIVE_ROLE_AT );
 
             // check that administrativeRole has something valid in it for us
-            if ( administrativeRole == null || administrativeRole.size() <= 0 )
+            if ( ( administrativeRole == null ) || ( administrativeRole.size() <= 0 ) )
             {
                 throw new LdapNoSuchAttributeException( I18n.err( I18n.ERR_306, apName ) );
             }
@@ -680,7 +682,7 @@ public class SubentryInterceptor extends
      */
     private boolean hasAdministrativeDescendant( OperationContext opContext, DN name ) throws LdapException
     {
-        ExprNode filter = new PresenceNode( "administrativeRole" );
+        ExprNode filter = new PresenceNode( SchemaConstants.ADMINISTRATIVE_ROLE_AT );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
 

Modified: directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java?rev=960682&r1=960681&r2=960682&view=diff
==============================================================================
--- directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java (original)
+++ directory/shared/trunk/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java Mon Jul  5 20:24:33 2010
@@ -291,6 +291,10 @@ public interface SchemaConstants
     String MODIFIERS_NAME_AT                        = "modifiersName";
     String MODIFIERS_NAME_AT_OID                    = "2.5.18.4";
     
+    // AdministrativeRole
+    String ADMINISTRATIVE_ROLE_AT                   = "administrativeRole";
+    String ADMINISTRATIVE_ROLE_AT_OID               = "2.5.18.5";
+    
     // SubtreeSpecification
     String SUBTREE_SPECIFICATION_AT                 = "subtreeSpecification";
     String SUBTREE_SPECIFICATION_AT_OID             = "2.5.18.6";

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java?rev=960682&r1=960681&r2=960682&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java Mon Jul  5 20:24:33 2010
@@ -40,7 +40,6 @@ import org.apache.directory.shared.ldap.
  */
 public class TriggerUtils
 {
-    public static final String ADMINISTRATIVE_ROLE_ATTR = "administrativeRole";
     public static final String TRIGGER_EXECUTION_SPECIFIC_AREA_ATTR_VALUE = "triggerExecutionSpecificArea";
     public static final String TRIGGER_EXECUTION_SUBENTRY_OC = "triggerExecutionSubentry";
     public static final String ENTRY_TRIGGER_SPECIFICATION_ATTR = "entryTriggerSpecification";
@@ -49,12 +48,12 @@ public class TriggerUtils
     
     public static void defineTriggerExecutionSpecificPoint( LdapContext apCtx ) throws NamingException
     {
-        Attributes ap = apCtx.getAttributes( "", new String[] { ADMINISTRATIVE_ROLE_ATTR } );
-        Attribute administrativeRole = ap.get( ADMINISTRATIVE_ROLE_ATTR );
+        Attributes ap = apCtx.getAttributes( "", new String[] { SchemaConstants.ADMINISTRATIVE_ROLE_AT } );
+        Attribute administrativeRole = ap.get( SchemaConstants.ADMINISTRATIVE_ROLE_AT );
         if ( administrativeRole == null || 
             !AttributeUtils.containsValueCaseIgnore( administrativeRole, TRIGGER_EXECUTION_SPECIFIC_AREA_ATTR_VALUE ) )
         {
-            Attributes changes = new BasicAttributes( ADMINISTRATIVE_ROLE_ATTR, TRIGGER_EXECUTION_SPECIFIC_AREA_ATTR_VALUE, true );
+            Attributes changes = new BasicAttributes( SchemaConstants.ADMINISTRATIVE_ROLE_AT, TRIGGER_EXECUTION_SPECIFIC_AREA_ATTR_VALUE, true );
             apCtx.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, changes );
         }
     }