directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r414041 - in /directory/trunks/shared/ldap/src: main/antlr/ main/java/org/apache/directory/shared/ldap/trigger/ test/java/org/apache/directory/shared/ldap/trigger/
Date Wed, 14 Jun 2006 03:44:21 GMT
Author: akarasulu
Date: Tue Jun 13 20:44:21 2006
New Revision: 414041

URL: http://svn.apache.org/viewvc?rev=414041&view=rev
Log:
shared ldap now builds after the optimization branch merge

Modified:
    directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParser.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParserTest.java

Modified: directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g?rev=414041&r1=414040&r2=414041&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g (original)
+++ directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g Tue Jun 13 20:44:21
2006
@@ -20,13 +20,13 @@
 
 package org.apache.directory.shared.ldap.trigger;
 
-import javax.naming.Name;
 import javax.naming.NamingException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.directory.shared.ldap.name.DnParser;
-import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -66,11 +66,8 @@
 {
     private static final Logger log = LoggerFactory.getLogger( AntlrTriggerSpecificationParser.class
);
     
-    // subordinate parser instances
-    private DnParser dnParser;
-    
+    private NormalizerMappingResolver resolver;
     private boolean isNormalizing = false;
-    private NameComponentNormalizer normalizer;
     
     private ActionTime triggerActionTime;
     
@@ -83,44 +80,17 @@
     private List triggerStoredProcedureParameters;
     
     
-    /**
-     * Creates a (normalizing) subordinate DnParser for parsing Names.
-     * This method MUST be called for each instance while we cannot do
-     * constructor overloading for this class.
-     *
-     * @return the DnParser to be used for parsing Names
-     */
     public void init()
     {
-        try
-        {
-            if( isNormalizing )
-            {
-                dnParser = new DnParser( normalizer );
-            }
-            else
-            {
-                dnParser = new DnParser();
-            }
-        }
-        catch ( NamingException e )
-        {
-            String msg = "Failed to initialize the subordinate DnParser for this AntlrTriggerSpecificationParser";
-
-            // We throw a NPE since this variable cannot be null for proper operation
-            // so we can catch the null pointer before the dnParser is even used.
-
-            throw new NullPointerException( "dnParser is null: " + msg );
-        }
     }
 
 
     /**
      * Sets the NameComponentNormalizer for this parser's dnParser.
      */
-    public void setNormalizer(NameComponentNormalizer normalizer)
+    public void setNormalizerMappingResolver( NormalizerMappingResolver resolver )
     {
-        this.normalizer = normalizer;
+        this.resolver = resolver;
         this.isNormalizing = true;
     }
 }
@@ -559,7 +529,7 @@
     log.debug( "entered storedProcedureSearchContextOption()" );
     spSearchContextOption = null;
     SearchScope searchScope = SearchScope.BASE; // default scope
-    Name spSearchContext = null;
+    LdapDN spSearchContext = null;
 }
     :
     ID_searchContext ( SP )+ // FIXME: SP should not be mandatory if an OPEN_CURLY follows
@@ -580,7 +550,7 @@
     | ID_scope_subtree { scope = SearchScope.SUBTREE; }
     ;
 
-storedProcedureSearchContext returns [ Name spSearchContext ]
+storedProcedureSearchContext returns [ LdapDN spSearchContext ]
 {
     log.debug( "entered storedProcedureSearchContext()" );
     spSearchContext = null;
@@ -599,20 +569,20 @@
     { spName = spNameToken.getText(); }
     ;
 
-distinguishedName returns [ Name name ] 
+distinguishedName returns [ LdapDN name ] 
 {
     log.debug( "entered distinguishedName()" );
     name = null;
 }
     : nameToken:UTF8String
     {
-        name = dnParser.parse( nameToken.getText() );
+        name = new LdapDN( nameToken.getText() );
     }
     ;
     exception
     catch [Exception e]
     {
-        throw new RecognitionException( "name parser failed for " + nameToken.getText() +
" " + e.getMessage() );
+        throw new RecognitionException( "name parse failed for " + nameToken.getText() +
" " + e.getMessage() );
     }
 
 // -----------------------------------------------------------------------------

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParser.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParser.java?rev=414041&r1=414040&r2=414041&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParser.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParser.java
Tue Jun 13 20:44:21 2006
@@ -21,7 +21,7 @@
 import java.io.StringReader;
 import java.text.ParseException;
 
-import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
+import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
 
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
@@ -63,12 +63,12 @@
     /**
      * Creates a normalizing TriggerSpecification parser.
      */
-    public TriggerSpecificationParser( NameComponentNormalizer normalizer )
+    public TriggerSpecificationParser( NormalizerMappingResolver resolver )
     {
         this.lexer = new ReusableAntlrTriggerSpecificationLexer( new StringReader( "" ) );
         this.parser = new ReusableAntlrTriggerSpecificationParser( lexer );
 
-        this.parser.setNormalizer( normalizer );
+        this.parser.setNormalizerMappingResolver( resolver );
         this.parser.init(); // this method MUST be called while we cannot do
         // constructor overloading for ANTLR generated parser
         this.isNormalizing = true;

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParserTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParserTest.java?rev=414041&r1=414040&r2=414041&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParserTest.java
(original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParserTest.java
Tue Jun 13 20:44:21 2006
@@ -18,9 +18,9 @@
 package org.apache.directory.shared.ldap.trigger;
 
 
-import junit.framework.TestCase;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
-import org.apache.directory.shared.ldap.name.LdapName;
+import junit.framework.TestCase;
 
 
 /**
@@ -134,7 +134,7 @@
         assertEquals( triggerSpecification.getStoredProcedureOptions().size(), 1 );
         assertTrue( triggerSpecification.getStoredProcedureOptions().contains(
             new StoredProcedureSearchContextOption(
-                new LdapName( "cn=Auth,cn=System Stored Procedures,ou=system" ), SearchScope.ONE
) ) );
+                new LdapDN( "cn=Auth,cn=System Stored Procedures,ou=system" ), SearchScope.ONE
) ) );
         assertEquals( triggerSpecification.getStoredProcedureParameters().size(), 1 );
         assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
             StoredProcedureParameter.BindStoredProcedureParameter.NAME ) );



Mime
View raw message