directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r808784 - in /directory: apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/ apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/ sha...
Date Fri, 28 Aug 2009 07:16:42 GMT
Author: elecharny
Date: Fri Aug 28 07:16:41 2009
New Revision: 808784

URL: http://svn.apache.org/viewvc?rev=808784&view=rev
Log:
o The AttributeTypeRegistry.getOid() method now throws an exception if the OID can't be find
o Fixed many compilation pbs in xdbm-search

Removed:
    directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NoMatchingRuleAttributeType.java
    directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrderingOnlyMatchingRuleAttributeType.java
Modified:
    directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
    directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
    directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java
    directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
    directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
    directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java

Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java?rev=808784&r1=808783&r2=808784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
(original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
Fri Aug 28 07:16:41 2009
@@ -154,7 +154,7 @@
              * If the element's value is smaller, then we delegate to the
              * before() method of the userIdxCursor.
              */
-            int compareValue = lessEqEvaluator.getComparator().compare( element.getValue(),
+            int compareValue = lessEqEvaluator.getLdapComparator().compare( element.getValue(),
                  lessEqEvaluator.getExpression().getValue().get() );
 
             if ( compareValue > 0 )
@@ -186,7 +186,7 @@
         checkNotClosed( "afterValue()" );
         if ( userIdxCursor != null )
         {
-            int comparedValue = lessEqEvaluator.getComparator().compare( value,
+            int comparedValue = lessEqEvaluator.getLdapComparator().compare( value,
                  lessEqEvaluator.getExpression().getValue().get() );
 
             /*
@@ -223,7 +223,7 @@
         checkNotClosed( "after()" );
         if ( userIdxCursor != null )
         {
-            int comparedValue = lessEqEvaluator.getComparator().compare( element.getValue(),
+            int comparedValue = lessEqEvaluator.getLdapComparator().compare( element.getValue(),
                  lessEqEvaluator.getExpression().getValue().get() );
 
             /*
@@ -353,7 +353,7 @@
             {
                 checkNotClosed( "next()" );
                 IndexEntry<?,ServerEntry> candidate = userIdxCursor.get();
-                if ( lessEqEvaluator.getComparator().compare( candidate.getValue(),
+                if ( lessEqEvaluator.getLdapComparator().compare( candidate.getValue(),
                      lessEqEvaluator.getExpression().getValue().get() ) <= 0 )
                 {
                     return available = true;

Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=808784&r1=808783&r2=808784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
(original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
Fri Aug 28 07:16:41 2009
@@ -80,7 +80,7 @@
         this.node = node;
         this.registries = registries;
 
-        String oid = registries.getOidRegistry().getOid( node.getAttribute() );
+        String oid = registries.getAttributeTypeRegistry().getOid( node.getAttribute() );
         type = registries.getAttributeTypeRegistry().lookup( oid );
 
         MatchingRule rule = type.getSubstr();
@@ -96,7 +96,7 @@
         }
         else
         {
-            normalizer = new NoOpNormalizer();
+            normalizer = new NoOpNormalizer( type.getSyntaxOid() );
         }
         
         // compile the regular expression to search for a matching attribute

Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java?rev=808784&r1=808783&r2=808784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java
(original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java
Fri Aug 28 07:16:41 2009
@@ -175,7 +175,7 @@
     {
         try
         {
-            node.setAttribute( registries.getOidRegistry().getOid( node.getAttribute() )
);
+            node.setAttribute( registries.getAttributeTypeRegistry().getOid( node.getAttribute()
) );
             return node;
         }
         catch ( NamingException ne )
@@ -215,7 +215,7 @@
 
         try
         {
-            node.setAttribute( registries.getOidRegistry().getOid( node.getAttribute() )
);
+            node.setAttribute( registries.getAttributeTypeRegistry().getOid( node.getAttribute()
) );
             node.setValue( normalized );
             return node;
         }
@@ -293,7 +293,7 @@
 
         try
         {
-            node.setAttribute( registries.getOidRegistry().getOid( node.getAttribute() )
);
+            node.setAttribute( registries.getAttributeTypeRegistry().getOid( node.getAttribute()
) );
 
             if ( normInitial != null )
             {
@@ -338,7 +338,7 @@
     {
         try
         {
-            node.setAttribute( registries.getOidRegistry().getOid( node.getAttribute() )
);
+            node.setAttribute( registries.getAttributeTypeRegistry().getOid( node.getAttribute()
) );
             return node;
         }
         catch ( NamingException ne )

Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=808784&r1=808783&r2=808784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
Fri Aug 28 07:16:41 2009
@@ -25,9 +25,14 @@
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.ForwardIndexEntry;
 import org.apache.directory.server.xdbm.tools.StoreUtils;
-import org.apache.directory.server.schema.registries.*;
-import org.apache.directory.server.schema.bootstrap.*;
 import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.server.schema.bootstrap.ApacheSchema;
+import org.apache.directory.server.schema.bootstrap.ApachemetaSchema;
+import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
+import org.apache.directory.server.schema.bootstrap.CollectiveSchema;
+import org.apache.directory.server.schema.bootstrap.CoreSchema;
+import org.apache.directory.server.schema.bootstrap.SystemSchema;
+import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.entry.ServerEntry;
@@ -37,7 +42,11 @@
 import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.filter.GreaterEqNode;
-import org.apache.directory.shared.ldap.schema.*;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.SchemaUtils;
+import org.apache.directory.shared.ldap.schema.comparators.StringComparator;
+import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
@@ -47,7 +56,9 @@
 import org.apache.commons.io.FileUtils;
 import org.junit.Before;
 import org.junit.After;
-import org.junit.Test;import static org.junit.Assert.assertTrue;import static org.junit.Assert.assertFalse;
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
@@ -60,7 +71,6 @@
 import java.util.UUID;
 
 
-
 /**
  * Tests the GreaterEqEvaluator and GreaterEqCursor classes for correct operation.
  *
@@ -671,7 +681,11 @@
     @Test ( expected = IllegalStateException.class )
     public void testEvaluatorAttributeNoMatchingRule() throws Exception
     {
-        AttributeType at = new NoMatchingRuleAttributeType();
+        AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000"
);
+        at.addName( "bogus" );
+        at.setSchemaName( "other" );
+        at.setSyntax( new BogusSyntax() );
+        
         registries.getAttributeTypeRegistry().register( at );
         registries.getLdapSyntaxRegistry().register( at.getSyntax() );
         SyntaxCheckerDescription desc = new SyntaxCheckerDescription( at.getSyntax().getOid()
);
@@ -681,7 +695,7 @@
         names.add( "bogus" );
         desc.setNames( names );
         desc.setObsolete( false );
-        registries.getSyntaxCheckerRegistry().register( desc, at.getSyntax().getSyntaxChecker()
);
+        registries.getSyntaxCheckerRegistry().register( at.getSyntax().getSyntaxChecker()
);
 
         GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3"
) );
         new GreaterEqEvaluator( node, store, registries );
@@ -692,7 +706,17 @@
     @Test
     public void testEvaluatorAttributeOrderingMatchingRule() throws Exception
     {
-        AttributeType at = new OrderingOnlyMatchingRuleAttributeType();
+        MatchingRule mr = new MatchingRule( "1.1" );
+        mr.setSyntax( new BogusSyntax() );
+        mr.setLdapComparator( new StringComparator() );
+        mr.setNormalizer( new NoOpNormalizer( "1.1" ) );
+        
+        AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000"
);
+        at.addName( "bogus" );
+        at.setSchemaName( "other" );
+        at.setSyntax( new BogusSyntax() );
+        at.setOrdering( mr );
+            
         registries.getAttributeTypeRegistry().register( at );
         registries.getLdapSyntaxRegistry().register( at.getSyntax() );
         SyntaxCheckerDescription desc = new SyntaxCheckerDescription( at.getSyntax().getOid()
);
@@ -702,7 +726,7 @@
         names.add( "bogus" );
         desc.setNames( names );
         desc.setObsolete( false );
-        registries.getSyntaxCheckerRegistry().register( desc, at.getSyntax().getSyntaxChecker()
);
+        registries.getSyntaxCheckerRegistry().register( at.getSyntax().getSyntaxChecker()
);
 
         GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3"
) );
         new GreaterEqEvaluator( node, store, registries );

Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=808784&r1=808783&r2=808784&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
Fri Aug 28 07:16:41 2009
@@ -44,7 +44,10 @@
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.filter.LessEqNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.SchemaUtils;
+import org.apache.directory.shared.ldap.schema.comparators.StringComparator;
+import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
@@ -718,7 +721,11 @@
     @Test ( expected = IllegalStateException.class )
     public void testEvaluatorAttributeNoMatchingRule() throws Exception
     {
-        AttributeType at = new NoMatchingRuleAttributeType();
+        AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000"
);
+        at.addName( "bogus" );
+        at.setSchemaName( "other" );
+        at.setSyntax( new BogusSyntax() );
+        
         registries.getAttributeTypeRegistry().register( at );
 
         LessEqNode node = new LessEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
@@ -731,7 +738,17 @@
     @Test
     public void testEvaluatorAttributeOrderingMatchingRule() throws Exception
     {
-        AttributeType at = new OrderingOnlyMatchingRuleAttributeType();
+        MatchingRule mr = new MatchingRule( "1.1" );
+        mr.setSyntax( new BogusSyntax() );
+        mr.setLdapComparator( new StringComparator() );
+        mr.setNormalizer( new NoOpNormalizer( "1.1" ) );
+        
+        AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000"
);
+        at.addName( "bogus" );
+        at.setSchemaName( "other" );
+        at.setSyntax( new BogusSyntax() );
+        at.setOrdering( mr );
+
         registries.getAttributeTypeRegistry().register( at );
         registries.getLdapSyntaxRegistry().register( at.getSyntax() );
         SyntaxCheckerDescription desc = new SyntaxCheckerDescription( at.getSyntax().getOid()
);
@@ -741,7 +758,7 @@
         names.add( "bogus" );
         desc.setNames( names );
         desc.setObsolete( false );
-        registries.getSyntaxCheckerRegistry().register( desc, at.getSyntax().getSyntaxChecker()
);
+        registries.getSyntaxCheckerRegistry().register( at.getSyntax().getSyntaxChecker()
);
 
         LessEqNode node = new LessEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
         new LessEqEvaluator( node, store, registries );

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java?rev=808784&r1=808783&r2=808784&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/Registries.java
Fri Aug 28 07:16:41 2009
@@ -91,9 +91,9 @@
      *
      * @param oidRegistry the OID registry
      */
-    public Registries( OidRegistry oidRegistry )
+    public Registries()
     {
-        this.oidRegistry = oidRegistry;
+        this.oidRegistry = new OidRegistry();
         normalizerRegistry = new NormalizerRegistry( oidRegistry );
         comparatorRegistry = new ComparatorRegistry( oidRegistry );
         syntaxCheckerRegistry = new SyntaxCheckerRegistry( oidRegistry );

Modified: directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java?rev=808784&r1=808783&r2=808784&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/SchemaObjectRegistry.java
Fri Aug 28 07:16:41 2009
@@ -280,8 +280,9 @@
      *
      * @param name The name we are looking the oid for
      * @return The numericOID associated with this name
+     * @throws NamingException If the OID can't be found
      */
-    public String getOid( String name )
+    public String getOid( String name ) throws NamingException
     {
         T schemaObject = byOid.get( name );
         
@@ -290,6 +291,6 @@
             return schemaObject.getOid();
         }
         
-        return null;
+        throw new NamingException( "Can't find an OID for the name " + name );
     }
 }



Mime
View raw message