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 2006/01/18 23:47:08 UTC

svn commit: r370296 - in /directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree: Index.java IndexEnumeration.java SubstringEnumerator.java SubstringEvaluator.java

Author: elecharny
Date: Wed Jan 18 14:47:04 2006
New Revision: 370296

URL: http://svn.apache.org/viewcvs?rev=370296&view=rev
Log:
- Get rid of a.o.regexp and oro, replaced them by jdk 1.4 regexp

Modified:
    directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/Index.java
    directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/IndexEnumeration.java
    directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/SubstringEnumerator.java
    directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/SubstringEvaluator.java

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/Index.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/Index.java?rev=370296&r1=370295&r2=370296&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/Index.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/Index.java Wed Jan 18 14:47:04 2006
@@ -18,13 +18,13 @@
 
 
 import java.math.BigInteger;
+import java.util.regex.Pattern;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 
 import org.apache.ldap.common.schema.AttributeType;
-import org.apache.regexp.RE;
 
 
 /**
@@ -106,9 +106,9 @@
     IndexEnumeration listIndices( Object attrVal, boolean isGreaterThan )
         throws NamingException;
 
-    IndexEnumeration listIndices( RE regex ) throws NamingException;
+    IndexEnumeration listIndices( Pattern regex ) throws NamingException;
 
-    IndexEnumeration listIndices( RE regex, String prefix )
+    IndexEnumeration listIndices( Pattern regex, String prefix )
         throws NamingException;
 
     boolean hasValue( Object attrVal, BigInteger id ) 
@@ -117,7 +117,7 @@
     boolean hasValue( Object attrVal, BigInteger id, boolean isGreaterThan )
         throws NamingException;
 
-    boolean hasValue( RE regex, BigInteger id ) throws NamingException;
+    boolean hasValue( Pattern regex, BigInteger id ) throws NamingException;
 
     void close() throws NamingException;
 

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/IndexEnumeration.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/IndexEnumeration.java?rev=370296&r1=370295&r2=370296&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/IndexEnumeration.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/IndexEnumeration.java Wed Jan 18 14:47:04 2006
@@ -18,13 +18,11 @@
 
 
 import java.util.NoSuchElementException;
+import java.util.regex.Pattern;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 
-import org.apache.regexp.RE;
-
-
 /**
  * A NamingEnumeration over an Index which returns IndexRecords.
  * 
@@ -35,7 +33,7 @@
     implements NamingEnumeration
 {
     /** */
-    private final RE re;
+    private final Pattern re;
     /** */
     private final IndexRecord tmp = new IndexRecord();
     /** */
@@ -70,7 +68,7 @@
 
 
     public IndexEnumeration( NamingEnumeration list, boolean swapKeyVal,
-                             RE regex )
+                             Pattern regex )
         throws NamingException
     {
         re = regex;
@@ -171,7 +169,7 @@
             // If regex is null just transfer into prefetched from tmp record
             // but if it is not then use it to match.  Successful match shorts
             // while loop.
-            if ( null == re || re.match( ( String ) tmp.getIndexKey() ) ) 
+            if ( null == re || re.matcher( ( String ) tmp.getIndexKey() ).matches() )
             {
                 prefetched.copy( tmp );
                 return;

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/SubstringEnumerator.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/SubstringEnumerator.java?rev=370296&r1=370295&r2=370296&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/SubstringEnumerator.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/SubstringEnumerator.java Wed Jan 18 14:47:04 2006
@@ -27,6 +27,9 @@
 package org.apache.ldap.server.partition.impl.btree;
 
 
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 
@@ -35,8 +38,6 @@
 import org.apache.ldap.common.schema.AttributeType;
 import org.apache.ldap.common.schema.Normalizer;
 import org.apache.ldap.server.schema.AttributeTypeRegistry;
-import org.apache.regexp.RE;
-import org.apache.regexp.RESyntaxException;
 
 
 /**
@@ -84,7 +85,7 @@
     public NamingEnumeration enumerate( final ExprNode node )
         throws NamingException
     {
-        RE regex = null;
+        Pattern regex = null;
         Index idx = null;
         final SubstringNode snode = ( SubstringNode ) node;
         AttributeType type = attributeTypeRegistry.lookup( snode.getAttribute() );
@@ -100,7 +101,7 @@
             {
                 regex = snode.getRegex( normalizer );
             } 
-            catch ( RESyntaxException e ) 
+            catch ( PatternSyntaxException e ) 
             {
                 NamingException ne = new NamingException( "SubstringNode '" 
                     + node + "' had incorrect syntax" );

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/SubstringEvaluator.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/SubstringEvaluator.java?rev=370296&r1=370295&r2=370296&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/SubstringEvaluator.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/ldap/server/partition/impl/btree/SubstringEvaluator.java Wed Jan 18 14:47:04 2006
@@ -17,6 +17,9 @@
 package org.apache.ldap.server.partition.impl.btree;
 
 
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -28,9 +31,6 @@
 import org.apache.ldap.common.schema.Normalizer;
 import org.apache.ldap.server.schema.AttributeTypeRegistry;
 import org.apache.ldap.server.schema.OidRegistry;
-import org.apache.regexp.RE;
-import org.apache.regexp.RESyntaxException;
-
 
 /**
  * Evaluates substring filter assertions on an entry.
@@ -70,7 +70,7 @@
     public boolean evaluate( ExprNode node, IndexRecord record )
         throws NamingException
     {
-        RE regex = null; 
+        Pattern regex = null; 
         SubstringNode snode = ( SubstringNode ) node;
         String oid = oidRegistry.getOid( snode.getAttribute() );
         AttributeType type = attributeTypeRegistry.lookup( oid );
@@ -94,11 +94,11 @@
             {
                 regex = snode.getRegex( normalizer );
             } 
-            catch ( RESyntaxException e ) 
+            catch ( PatternSyntaxException pse ) 
             {
                 NamingException ne = new NamingException( "SubstringNode '" 
                     + node + "' had " + "incorrect syntax" );
-                ne.setRootCause( e );
+                ne.setRootCause( pse );
                 throw ne;
             }
 
@@ -108,7 +108,7 @@
                 IndexRecord rec = ( IndexRecord ) list.next();
             
                 // once match is found cleanup and return true
-                if ( regex.match( ( String ) rec.getIndexKey() ) ) 
+                if ( regex.matcher( ( String ) rec.getIndexKey() ).matches() ) 
                 {
                     list.close();
                     return true;
@@ -144,11 +144,11 @@
         {
             regex = snode.getRegex( normalizer );
         } 
-        catch ( RESyntaxException e ) 
+        catch ( PatternSyntaxException pse ) 
         {
             NamingException ne = new NamingException( "SubstringNode '" 
                 + node + "' had " + "incorrect syntax" );
-            ne.setRootCause( e );
+            ne.setRootCause( pse );
             throw ne;
         }
         
@@ -165,7 +165,7 @@
                 normalizer.normalize( list.next() );
             
             // Once match is found cleanup and return true
-            if ( regex.match( value ) ) 
+            if ( regex.matcher( value ).matches() ) 
             {
                 list.close();
                 return true;
@@ -175,4 +175,4 @@
         // we fell through so a match was not found - assertion was false.
         return false;
     }
-}
+}
\ No newline at end of file