directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r637319 - in /directory/apacheds/branches/bigbang/core/src: main/java/org/apache/directory/server/core/ main/java/org/apache/directory/server/core/authz/ main/java/org/apache/directory/server/core/authz/support/ main/java/org/apache/directo...
Date Sat, 15 Mar 2008 00:58:18 GMT
Author: elecharny
Date: Fri Mar 14 17:58:15 2008
New Revision: 637319

URL: http://svn.apache.org/viewvc?rev=637319&view=rev
Log:
Fixed the core code to use the ServerAttribute and ServerValue classes.
Fixed the tests accordingly

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACITupleFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxValueCountFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MicroOperationFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RestrictedByFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Fri Mar 14 17:58:15 2008
@@ -107,6 +107,7 @@
 import java.io.IOException;
 import java.io.StringReader;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
@@ -983,7 +984,7 @@
                                 SchemaConstants.INET_ORG_PERSON_OC );
 
             serverEntry.put( SchemaConstants.UID_AT, PartitionNexus.ADMIN_UID );
-            serverEntry.put( SchemaConstants.USER_PASSWORD_AT, PartitionNexus.ADMIN_PASSWORD
);
+            serverEntry.put( SchemaConstants.USER_PASSWORD_AT, PartitionNexus.ADMIN_PASSWORD_BYTES
);
             serverEntry.put( SchemaConstants.DISPLAY_NAME_AT, "Directory Superuser" );
             serverEntry.put( SchemaConstants.CN_AT, "system administrator" );
             serverEntry.put( SchemaConstants.SN_AT, "administrator" );
@@ -1217,12 +1218,11 @@
         
         if ( userPassword instanceof byte[] )
         {
-            needToChangeAdminPassword = PartitionNexus.ADMIN_PASSWORD.equals( new String(
-                ( byte[] ) userPassword ) );
+            needToChangeAdminPassword = Arrays.equals( PartitionNexus.ADMIN_PASSWORD_BYTES,
( byte[] ) userPassword );
         }
-        else if ( userPassword.toString().equals( PartitionNexus.ADMIN_PASSWORD ) )
+        else if ( userPassword.toString().equals( PartitionNexus.ADMIN_PASSWORD_STRING )
)
         {
-            needToChangeAdminPassword = PartitionNexus.ADMIN_PASSWORD.equals( userPassword.toString()
);
+            needToChangeAdminPassword = PartitionNexus.ADMIN_PASSWORD_STRING.equals( userPassword.toString()
);
         }
 
         if ( needToChangeAdminPassword )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
Fri Mar 14 17:58:15 2008
@@ -481,7 +481,7 @@
             for ( Value<?> value:attribute )
             {
                 engine.checkPermission( registries, proxy, userGroups, principalDn, principal.getAuthenticationLevel(),
name, attribute
-                    .getUpId(), value.get(), ADD_PERMS, tuples, serverEntry, null );
+                    .getUpId(), value, ADD_PERMS, tuples, serverEntry, null );
             }
         }
 
@@ -749,7 +749,7 @@
                     principal.getAuthenticationLevel(), 
                     dn, 
                     attribute.getUpId(), 
-                    value.get(), 
+                    value, 
                     READ_PERMS, 
                     tuples, 
                     entry, 
@@ -1044,7 +1044,7 @@
     {
     	LdapDN name = opContext.getDn();
     	String oid = opContext.getOid();
-    	Object value = opContext.getValue();
+    	Value<?> value = (Value<?>)opContext.getValue();
     	
         // Access the principal requesting the operation, and bypass checks if it is the
admin
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -1209,7 +1209,7 @@
                         ctx.getPrincipal().getAuthenticationLevel(), 
                         normName, 
                         attr.getUpId(), 
-                        value.get(), 
+                        value, 
                         SEARCH_ATTRVAL_PERMS, 
                         tuples,
                         entry, 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
Fri Mar 14 17:58:15 2008
@@ -241,7 +241,7 @@
 
         for ( Modification mod : mods )
         {
-            if ( ((ServerAttribute)mod.getAttribute()).isA( SchemaConstants.PRESCRIPTIVE_ACI_AT
) )
+            if ( ((ServerAttribute)mod.getAttribute()).instanceOf( SchemaConstants.PRESCRIPTIVE_ACI_AT
) )
             {
                 subentryDeleted( normName, entry );
                 subentryAdded( normName, entry );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java
Fri Mar 14 17:58:15 2008
@@ -50,6 +50,7 @@
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
@@ -135,7 +136,7 @@
         AuthenticationLevel authenticationLevel, 
         LdapDN entryName, 
         String attrId, 
-        Object attrValue, 
+        Value<?> attrValue, 
         Collection<MicroOperation> microOperations, 
         Collection<ACITuple> aciTuples, 
         ServerEntry entry, 
@@ -193,7 +194,7 @@
         AuthenticationLevel authenticationLevel, 
         LdapDN entryName, 
         String attrId, 
-        Object attrValue, 
+        Value<?> attrValue, 
         Collection<MicroOperation> microOperations, 
         Collection<ACITuple> aciTuples, 
         ServerEntry entry, 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACITupleFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACITupleFilter.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACITupleFilter.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACITupleFilter.java
Fri Mar 14 17:58:15 2008
@@ -30,6 +30,7 @@
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -74,7 +75,7 @@
             AuthenticationLevel authenticationLevel, 
             LdapDN entryName, 
             String attrId,
-            Object attrValue, 
+            Value<?> attrValue, 
             ServerEntry entry, 
             Collection<MicroOperation> microOperations,
             ServerEntry entryView )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilter.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilter.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilter.java
Fri Mar 14 17:58:15 2008
@@ -31,6 +31,7 @@
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -54,7 +55,7 @@
             AuthenticationLevel authenticationLevel,
             LdapDN entryName, 
             String attrId, 
-            Object attrValue, 
+            Value<?> attrValue, 
             ServerEntry entry, 
             Collection<MicroOperation> microOperations,
             ServerEntry entryView )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
Fri Mar 14 17:58:15 2008
@@ -38,6 +38,7 @@
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
@@ -84,7 +85,7 @@
             AuthenticationLevel authenticationLevel,
             LdapDN entryName, 
             String attrId, 
-            Object attrValue, 
+            Value<?> attrValue, 
             ServerEntry entry, 
             Collection<MicroOperation> microOperations,
             ServerEntry entryView )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxValueCountFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxValueCountFilter.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxValueCountFilter.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxValueCountFilter.java
Fri Mar 14 17:58:15 2008
@@ -34,6 +34,7 @@
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
 import org.apache.directory.shared.ldap.aci.ProtectedItem.MaxValueCountItem;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -57,7 +58,7 @@
             AuthenticationLevel authenticationLevel,
             LdapDN entryName, 
             String attrId, 
-            Object attrValue, 
+            Value<?> attrValue, 
             ServerEntry entry, 
             Collection<MicroOperation> microOperations,
             ServerEntry entryView )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MicroOperationFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MicroOperationFilter.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MicroOperationFilter.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MicroOperationFilter.java
Fri Mar 14 17:58:15 2008
@@ -31,6 +31,7 @@
 import org.apache.directory.shared.ldap.aci.ACITuple;
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -55,7 +56,7 @@
             AuthenticationLevel authenticationLevel,
             LdapDN entryName, 
             String attrId, 
-            Object attrValue, 
+            Value<?> attrValue, 
             ServerEntry entry, 
             Collection<MicroOperation> microOperations,
             ServerEntry entryView )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java
Fri Mar 14 17:58:15 2008
@@ -32,6 +32,7 @@
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -63,7 +64,7 @@
             AuthenticationLevel authenticationLevel,
             LdapDN entryName, 
             String attrId, 
-            Object attrValue, 
+            Value<?> attrValue, 
             ServerEntry entry, 
             Collection<MicroOperation> microOperations,
             ServerEntry entryView )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilter.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilter.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilter.java
Fri Mar 14 17:58:15 2008
@@ -32,6 +32,7 @@
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.aci.UserClass;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -61,7 +62,7 @@
             AuthenticationLevel authenticationLevel,
             LdapDN entryName, 
             String attrId, 
-            Object attrValue, 
+            Value<?> attrValue, 
             ServerEntry entry, 
             Collection<MicroOperation> microOperations,
             ServerEntry entryView )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java
Fri Mar 14 17:58:15 2008
@@ -41,6 +41,7 @@
 import org.apache.directory.shared.ldap.aci.ProtectedItem.RestrictedByItem;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
@@ -82,7 +83,7 @@
             AuthenticationLevel authenticationLevel, 
             LdapDN entryName, 
             String attrId,
-            Object attrValue, 
+            Value<?> attrValue, 
             ServerEntry entry, 
             Collection<MicroOperation> microOperations,
             ServerEntry entryView )
@@ -108,7 +109,7 @@
 
 
     private boolean isRelated( ACITuple tuple, OperationScope scope, LdapDN userName, LdapDN
entryName, String attrId,
-                               Object attrValue, ServerEntry entry ) throws NamingException,
InternalError
+                               Value<?> attrValue, ServerEntry entry ) throws NamingException,
InternalError
     {
         String oid = null;
         
@@ -190,7 +191,7 @@
                     String attrOid = oidRegistry.getOid( attr.getID() );
                     AttributeType attrType = attrRegistry.lookup( attrOid );
                     
-                    if ( oid.equals( attrOid ) && AttributeUtils.containsValue( attr,
attrValue, attrType ) )
+                    if ( oid.equals( attrOid ) && AttributeUtils.containsValue( attr,
attrValue.get(), attrType ) )
                     {
                         return true;
                     }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilter.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilter.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilter.java
Fri Mar 14 17:58:15 2008
@@ -33,6 +33,7 @@
 import org.apache.directory.shared.ldap.aci.MicroOperation;
 import org.apache.directory.shared.ldap.aci.UserClass;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 
@@ -68,7 +69,7 @@
             AuthenticationLevel authenticationLevel,
             LdapDN entryName, 
             String attrId, 
-            Object attrValue, 
+            Value<?> attrValue, 
             ServerEntry entry, 
             Collection<MicroOperation> microOperations,
             ServerEntry entryView )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RestrictedByFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RestrictedByFilter.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RestrictedByFilter.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RestrictedByFilter.java
Fri Mar 14 17:58:15 2008
@@ -34,6 +34,7 @@
 import org.apache.directory.shared.ldap.aci.ProtectedItem;
 import org.apache.directory.shared.ldap.aci.ProtectedItem.RestrictedByItem;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -57,7 +58,7 @@
             AuthenticationLevel authenticationLevel,
             LdapDN entryName, 
             String attrId, 
-            Object attrValue, 
+            Value<?> attrValue, 
             ServerEntry entry, 
             Collection<MicroOperation> microOperations,
             ServerEntry entryView )
@@ -92,7 +93,7 @@
     }
 
 
-    public boolean isRemovable( ACITuple tuple, String attrId, Object attrValue, ServerEntry
entry ) throws NamingException
+    public boolean isRemovable( ACITuple tuple, String attrId, Value<?> attrValue,
ServerEntry entry ) throws NamingException
     {
         for ( ProtectedItem item : tuple.getProtectedItems() )
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
Fri Mar 14 17:58:15 2008
@@ -31,11 +31,16 @@
 
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.entry.ServerBinaryValue;
+import org.apache.directory.server.core.entry.ServerStringValue;
 import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
 import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
 import org.apache.directory.server.core.referral.ReferralInterceptor;
 import org.apache.directory.shared.ldap.NotImplementedException;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -167,8 +172,44 @@
      */
     public boolean compare( LdapDN name, String oid, Object value ) throws NamingException
     {
+        Value<?> val = null;
+        
+        AttributeType attributeType = getService().getRegistries().getAttributeTypeRegistry().lookup(
oid );
+        
         // make sure we add the request controls to operation
-        CompareOperationContext opCtx = new CompareOperationContext( registries, name, oid,
value );
+        if ( attributeType.getSyntax().isHumanReadable() )
+        {
+            if ( value instanceof String )
+            {
+                val = new ServerStringValue( attributeType, (String)value );
+            }
+            else if ( value instanceof byte[] )
+            {
+                val = new ServerStringValue( attributeType, StringTools.utf8ToString( (byte[])value
) );
+            }
+            else
+            {
+                throw new NamingException( "Bad value for the OID " + oid );
+            }
+        }
+        else
+        {
+            if ( value instanceof String )
+            {
+                val = new ServerBinaryValue( attributeType, StringTools.getBytesUtf8( (String)value
) );
+            }
+            else if ( value instanceof byte[] )
+            {
+                val = new ServerBinaryValue( attributeType, (byte[])value );
+            }
+            else
+            {
+                throw new NamingException( "Bad value for the OID " + oid );
+            }
+        }
+        
+        
+        CompareOperationContext opCtx = new CompareOperationContext( registries, name, oid,
val );
         opCtx.addRequestControls( requestControls );
 
         // execute operation

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
Fri Mar 14 17:58:15 2008
@@ -591,14 +591,7 @@
         }
 
         // see first if simple match without normalization succeeds
-        if ( compareContext.getValue() instanceof String )
-        {
-            if ( attr.contains( (String)compareContext.getValue()  ) )
-            {
-                return true;
-            }
-        }
-        else if ( attr.contains( (byte[])compareContext.getValue()  ) )
+        if ( attr.contains( (Value<?>)compareContext.getValue()  ) )
         {
             return true;
         }
@@ -611,7 +604,7 @@
          * through all values looking for a match.
          */
         Normalizer normalizer = attrType.getEquality().getNormalizer();
-        Object reqVal = normalizer.normalize( compareContext.getValue() );
+        Object reqVal = normalizer.normalize( ((Value<?>)compareContext.getValue()).get()
);
 
         for ( Value<?> value:attr )
         {
@@ -1002,7 +995,7 @@
                     {
                         serverEntry.put( attribute );
                     }
-                    else if ( containsPlus && ( type.getUsage() == UsageEnum.USER_APPLICATIONS
) )
+                    else if ( containsPlus && ( type.getUsage() != UsageEnum.USER_APPLICATIONS
) )
                     {
                         serverEntry.put( attribute );
                     }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexus.java
Fri Mar 14 17:58:15 2008
@@ -42,6 +42,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -59,7 +60,8 @@
     public final static String ADMIN_UID = "admin";
     
     /** the initial admin passwd set on startup */
-    public static final String ADMIN_PASSWORD = "secret";
+    public static final String ADMIN_PASSWORD_STRING = "secret";
+    public static final byte[] ADMIN_PASSWORD_BYTES = StringTools.getBytesUtf8( ADMIN_PASSWORD_STRING
);
     
    
     /**

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeClassLoader.java
Fri Mar 14 17:58:15 2008
@@ -49,7 +49,7 @@
     
     public void setAttribute( ServerAttribute attribute ) throws NamingException
     {
-        if ( attribute.getType().getSyntax().isHumanReadable() )
+        if ( attribute.getAttributeType().getSyntax().isHumanReadable() )
         {
             throw new InvalidAttributeValueException( "The attribute must be binary" );
         }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChecker.java
Fri Mar 14 17:58:15 2008
@@ -207,7 +207,7 @@
             return;
         }
 
-        if ( !attribute.isA( SchemaConstants.OBJECT_CLASS_AT ) )
+        if ( !attribute.instanceOf( SchemaConstants.OBJECT_CLASS_AT ) )
         {
             return;
         }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
Fri Mar 14 17:58:15 2008
@@ -1480,7 +1480,7 @@
 
             entry.remove( SchemaConstants.OBJECT_CLASS_AT );
 
-            ServerAttribute newOc = new DefaultServerAttribute( oc.getType() );
+            ServerAttribute newOc = new DefaultServerAttribute( oc.getAttributeType() );
 
             for ( ObjectClass currentOC:objectClasses )
             {
@@ -1501,9 +1501,9 @@
          */
         for ( ServerAttribute attribute:entry )
         {
-            if ( !attribute.getType().getSyntax().isHumanReadable() )
+            if ( !attribute.getAttributeType().getSyntax().isHumanReadable() )
             {
-                List<byte[]> binaries = new ArrayList<byte[]>();
+                List<Value<?>> binaries = new ArrayList<Value<?>>();
                 
                 for ( Value<?> value:attribute )
                 {
@@ -1511,11 +1511,13 @@
                 
                     if ( attrValue instanceof String )
                     {
-                        binaries.add( StringTools.getBytesUtf8( ( String ) attrValue ) );
+                        binaries.add( new ServerBinaryValue( attribute.getAttributeType(),

+                            StringTools.getBytesUtf8( ( String ) attrValue ) ) );
                     }
                     else
                     {
-                        binaries.add( (byte[])attrValue );
+                        binaries.add( new ServerBinaryValue( attribute.getAttributeType(),
+                            (byte[])attrValue ) );
                     }
                 }
                 
@@ -1664,9 +1666,9 @@
 
         for ( ServerAttribute attribute:entry )
         {
-            String attrOid = attribute.getType().getOid();
+            String attrOid = attribute.getAttributeType().getOid();
 
-            AttributeType attributeType = attribute.getType();
+            AttributeType attributeType = attribute.getAttributeType();
 
             if ( !attributeType.isCollective() && ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS
) )
             {
@@ -1711,7 +1713,7 @@
      */
     private void assertNumberOfAttributeValuesValid( ServerAttribute attribute ) throws InvalidAttributeValueException,
NamingException
     {
-        if ( attribute.size() > 1 && attribute.getType().isSingleValue() )
+        if ( attribute.size() > 1 && attribute.getAttributeType().isSingleValue()
)
         {                
             throw new LdapInvalidAttributeValueException( "More than one value has been provided
" +
                 "for the single-valued attribute: " + attribute.getUpId(), ResultCodeEnum.CONSTRAINT_VIOLATION
);
@@ -1726,7 +1728,7 @@
     {
         for ( ServerAttribute attribute:entry )
         {
-            must.remove( attribute.getType().getOid() );
+            must.remove( attribute.getAttributeType().getOid() );
         }
 
         if ( must.size() != 0 )
@@ -1818,7 +1820,7 @@
         // First, loop on all attributes
         for ( ServerAttribute attribute:entry )
         {
-            AttributeType attributeType = attribute.getType();
+            AttributeType attributeType = attribute.getAttributeType();
             SyntaxChecker syntaxChecker =  attributeType.getSyntax().getSyntaxChecker();
             
             if ( syntaxChecker instanceof AcceptAllSyntaxChecker )
@@ -1950,7 +1952,7 @@
         // Loops on all attributes
         for ( ServerAttribute attribute:entry )
         {
-            AttributeType attributeType = attribute.getType();
+            AttributeType attributeType = attribute.getAttributeType();
 
             // If the attributeType is H-R, check all of its values
             if ( attributeType.getSyntax().isHumanReadable() )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java
Fri Mar 14 17:58:15 2008
@@ -66,7 +66,7 @@
             throw new IllegalArgumentException( "objectClasses cannot be null" );
         }
         
-        if ( !objectClasses.isA( SchemaConstants.OBJECT_CLASS_AT ) )
+        if ( !objectClasses.instanceOf( SchemaConstants.OBJECT_CLASS_AT ) )
         {
             throw new IllegalArgumentException( "Attribute objectClasses should be of id
'objectClass'" );
         }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
Fri Mar 14 17:58:15 2008
@@ -88,7 +88,7 @@
             throw new IllegalArgumentException( "objectClasses argument cannot be null" );
         }
         
-        if ( !objectClasses.isA( SchemaConstants.OBJECT_CLASS_AT ) )
+        if ( !objectClasses.instanceOf( SchemaConstants.OBJECT_CLASS_AT ) )
         {
             throw new IllegalArgumentException( "objectClasses attribute must be for ID 'objectClass'"
);
         }

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
Fri Mar 14 17:58:15 2008
@@ -51,6 +51,7 @@
 import org.apache.directory.shared.ldap.aci.ProtectedItem.MaxValueCountItem;
 import org.apache.directory.shared.ldap.aci.ProtectedItem.RestrictedByItem;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 
@@ -229,15 +230,15 @@
         tuples = getTuples( new ProtectedItem.AttributeValue( convert( attributes )  ) );
 
         assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,
null, null, USER_NAME,
-            null, null, null, "cn", "valueA", null, null, null ).size() );
+            null, null, null, "cn", new ClientStringValue( "valueA" ), null, null, null ).size()
);
 
         assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,
null, null, USER_NAME,
-            null, null, null, "cn", "valueB", null, null, null ).size() );
+            null, null, null, "cn", new ClientStringValue( "valueB" ), null, null, null ).size()
);
 
         tuples = getTuples( new ProtectedItem.AttributeValue( convert( attributes )  ) );
 
         assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,
null, null, USER_NAME,
-            null, null, null, "sn", "valueA", null, null, null ).size() );
+            null, null, null, "sn", new ClientStringValue( "valueA" ), null, null, null ).size()
);
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
Fri Mar 14 17:58:15 2008
@@ -40,6 +40,7 @@
 import org.apache.directory.shared.ldap.aci.UserClass;
 import org.apache.directory.shared.ldap.aci.ProtectedItem.RestrictedByItem;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 import org.junit.BeforeClass;
@@ -133,12 +134,12 @@
         tuples.add( new ACITuple( UC_EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS,
MO_EMPTY_SET, true, 0 ) );
 
         assertEquals( 1, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,
null, null, null, null,
-            null, null, "sn", "1", ENTRY, null, null ).size() );
+            null, null, "sn", new ClientStringValue( "1" ), ENTRY, null, null ).size() );
 
         assertEquals( 1, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,
null, null, null, null,
-            null, null, "sn", "2", ENTRY, null, null ).size() );
+            null, null, "sn", new ClientStringValue( "2" ), ENTRY, null, null ).size() );
 
         assertEquals( 0, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE,
null, null, null, null,
-            null, null, "sn", "3", ENTRY, null, null ).size() );
+            null, null, "sn", new ClientStringValue( "3" ), ENTRY, null, null ).size() );
     }
 }

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java?rev=637319&r1=637318&r2=637319&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
Fri Mar 14 17:58:15 2008
@@ -141,11 +141,12 @@
         try
         {
             objectClasses = new DefaultServerAttribute( "cn", OBJECT_CLASS );
-            assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "" ), objectClasses
) );
+            assertFalse( evaluator.evaluate( new EqualityNode( "cn", "" ), objectClasses
) );
             fail( "should never get here due to an IAE" );
         }
-        catch ( IllegalArgumentException iae )
+        catch ( NamingException ne )
         {
+            assertTrue( true );
         }
     }
 



Mime
View raw message