directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r399693 - 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 Thu, 04 May 2006 13:02:06 GMT
Author: ersiner
Date: Thu May  4 06:02:05 2006
New Revision: 399693

URL: http://svn.apache.org/viewcvs?rev=399693&view=rev
Log:
Fixed a bug which was preventing reuse of the parser.
Added toString() overrides to TriggerSpecification bean, et all.
Added always accepting ldap operation token listener (I will completely remove this stuff).
There is no "del" anymore, we only support "delete".

Modified:
    directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/ActionTime.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/GenericLdapOperationTokenListener.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/SearchScope.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureLanguageOption.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecification.java
    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/viewcvs/directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g?rev=399693&r1=399692&r2=399693&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g (original)
+++ directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g Thu May  4 06:02:05
2006
@@ -80,9 +80,9 @@
     
     private String triggerStoredProcedureName;
     
-    private List triggerStoredProcedureOptions = new ArrayList();
+    private List triggerStoredProcedureOptions;
     
-    private List triggerStoredProcedureParameters = new ArrayList();
+    private List triggerStoredProcedureParameters;
     
     /**
      * Creates a (normalizing) subordinate DnParser for parsing Names.
@@ -139,6 +139,8 @@
 {
     log.debug( "entered wrapperEntryPoint()" );
     triggerSpec = null;
+    triggerStoredProcedureOptions = new ArrayList();
+    triggerStoredProcedureParameters = new ArrayList();
 }
     :
     ( SP )* triggerSpec=triggerSpecification ( SP )* EOF
@@ -182,7 +184,7 @@
     | searchOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.SEARCH;
}
     | modifyOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.MODIFY;
}
     | addOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.ADD; }
-    | delOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.DEL; }
+    | deleteOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.DELETE;
}
     | modDNOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.MODDN;
}
     | compareOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.COMPARE;
}
     | abandonOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.ABANDON;
}
@@ -283,21 +285,21 @@
     CLOSE_PARAN
     ;
 
-delOperationAndStoredProcedureCall
+deleteOperationAndStoredProcedureCall
 {
-    log.debug( "entered delOperationAndStoredProcedureCall()" );
+    log.debug( "entered deleteOperationAndStoredProcedureCall()" );
 }
     :
-    ( ID_del | ID_delete )
+    ID_delete
     {
-    	if ( caller.ldapOperationTokenRead( LdapOperation.DEL ) == false )
+    	if ( caller.ldapOperationTokenRead( LdapOperation.DELETE ) == false )
     	{
-    		throw new ConditionalParserFailureBasedOnCallerFeedback( LdapOperation.DEL );
+    		throw new ConditionalParserFailureBasedOnCallerFeedback( LdapOperation.DELETE );
     	}
     }
     theCompositeRuleForCallAndSPNameAndSPOptionList
     OPEN_PARAN ( SP )*
-        ( delStoredProcedureParameterList )?
+        ( deleteStoredProcedureParameterList )?
     CLOSE_PARAN
     ;
 
@@ -441,13 +443,13 @@
         ( SEP ( SP )* addStoredProcedureParameter ( SP )* )*
     ;
 
-delStoredProcedureParameterList
+deleteStoredProcedureParameterList
 {
-    log.debug( "entered delStoredProcedureParameterList()" );
+    log.debug( "entered deleteStoredProcedureParameterList()" );
 }
     :
-    delStoredProcedureParameter ( SP )*
-        ( SEP ( SP )* delStoredProcedureParameter ( SP )* )*
+    deleteStoredProcedureParameter ( SP )*
+        ( SEP ( SP )* deleteStoredProcedureParameter ( SP )* )*
     ;
 
 modDNStoredProcedureParameterList
@@ -542,12 +544,12 @@
     | genericStoredProcedureParameter
     ;
 
-delStoredProcedureParameter
+deleteStoredProcedureParameter
 {
-    log.debug( "entered delStoredProcedureParameter()" );
+    log.debug( "entered deleteStoredProcedureParameter()" );
 }
-    : ID_name { triggerStoredProcedureParameters.add( StoredProcedureParameter.DelStoredProcedureParameter.NAME
); }
-    | ID_deletedEntry { triggerStoredProcedureParameters.add( StoredProcedureParameter.DelStoredProcedureParameter.DELETED_ENTRY
); }
+    : ID_name { triggerStoredProcedureParameters.add( StoredProcedureParameter.DeleteStoredProcedureParameter.NAME
); }
+    | ID_deletedEntry { triggerStoredProcedureParameters.add( StoredProcedureParameter.DeleteStoredProcedureParameter.DELETED_ENTRY
); }
     | genericStoredProcedureParameter
     ;
 
@@ -733,7 +735,6 @@
     ID_search  = "search";
     ID_modify  = "modify";
     ID_add = "add";
-    ID_del = "del";
     ID_delete = "delete";
     ID_modDN = "moddn";
     ID_compare = "compare";
@@ -768,7 +769,7 @@
     ID_entry = "$entry";
     // ID_attributes = "$attributes"; // defined before
     
-    // del specific parameters
+    // delete specific parameters
     // ID_name = "$name"; // defined before
     ID_deletedEntry = "$deletedentry";
     

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/ActionTime.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/ActionTime.java?rev=399693&r1=399692&r2=399693&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/ActionTime.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/ActionTime.java
Thu May  4 06:02:05 2006
@@ -52,6 +52,9 @@
     }
 
 
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
     public String toString()
     {
         return name;

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/GenericLdapOperationTokenListener.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/GenericLdapOperationTokenListener.java?rev=399693&r1=399692&r2=399693&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/GenericLdapOperationTokenListener.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/GenericLdapOperationTokenListener.java
Thu May  4 06:02:05 2006
@@ -31,17 +31,30 @@
     public static final GenericLdapOperationTokenListener SearchListener = new GenericLdapOperationTokenListener(
LdapOperation.SEARCH );
     public static final GenericLdapOperationTokenListener ModifyListener = new GenericLdapOperationTokenListener(
LdapOperation.MODIFY );
     public static final GenericLdapOperationTokenListener AddListener = new GenericLdapOperationTokenListener(
LdapOperation.ADD );
-    public static final GenericLdapOperationTokenListener DelListener = new GenericLdapOperationTokenListener(
LdapOperation.DEL );
+    public static final GenericLdapOperationTokenListener DelListener = new GenericLdapOperationTokenListener(
LdapOperation.DELETE );
     public static final GenericLdapOperationTokenListener ModDNListener = new GenericLdapOperationTokenListener(
LdapOperation.MODDN );
     public static final GenericLdapOperationTokenListener CompareListener = new GenericLdapOperationTokenListener(
LdapOperation.COMPARE );
     public static final GenericLdapOperationTokenListener AbandonListener = new GenericLdapOperationTokenListener(
LdapOperation.ABANDON );
     public static final GenericLdapOperationTokenListener ExtendedListener = new GenericLdapOperationTokenListener(
LdapOperation.EXTENDED );
+    public static final GenericLdapOperationTokenListener AnyOperationListener =
+        new GenericLdapOperationTokenListener()
+        {
+            public boolean ldapOperationTokenRead(LdapOperation ldapOperation)
+            {
+                return true;
+            };
+        };
     
     private LdapOperation ldapOperation;
     
     private GenericLdapOperationTokenListener( LdapOperation ldapOperation )
     {
         this.ldapOperation = ldapOperation;
+    }
+    
+    private GenericLdapOperationTokenListener()
+    {
+        
     }
 
     public boolean ldapOperationTokenRead( LdapOperation ldapOperation )

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java?rev=399693&r1=399692&r2=399693&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java
Thu May  4 06:02:05 2006
@@ -36,7 +36,7 @@
 
     public static final LdapOperation ADD = new LdapOperation( "add" );
 
-    public static final LdapOperation DEL = new LdapOperation( "del" );
+    public static final LdapOperation DELETE = new LdapOperation( "delete" );
 
     public static final LdapOperation MODDN = new LdapOperation( "moddn" );
 

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/SearchScope.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/SearchScope.java?rev=399693&r1=399692&r2=399693&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/SearchScope.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/SearchScope.java
Thu May  4 06:02:05 2006
@@ -46,10 +46,15 @@
         return name;
     }
 
+    
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
     public String toString()
     {
-        return name;
+        return "scope" + "\"" + name + "\"";
     }
+    
 
     /* (non-Javadoc)
      * @see java.lang.Object#hashCode()

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureLanguageOption.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureLanguageOption.java?rev=399693&r1=399692&r2=399693&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureLanguageOption.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureLanguageOption.java
Thu May  4 06:02:05 2006
@@ -37,6 +37,15 @@
     {
         return language;
     }
+    
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "language " + "\"" + language + "\"";
+    }
 
     /* (non-Javadoc)
      * @see java.lang.Object#hashCode()

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java?rev=399693&r1=399692&r2=399693&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java
Thu May  4 06:02:05 2006
@@ -28,9 +28,9 @@
 public class StoredProcedureParameter
 {
 
-    public static final StoredProcedureParameter OPERATION_TIME = new StoredProcedureParameter(
"operationTime" );
+    public static final StoredProcedureParameter OPERATION_TIME = new StoredProcedureParameter(
"$operationTime" );
     public static final StoredProcedureParameter OPERATION_PRINCIPAL = new StoredProcedureParameter(
-        "operationPrincipal" );
+        "$operationPrincipal" );
 
     private final String name;
 
@@ -164,8 +164,8 @@
     public static class AddStoredProcedureParameter extends StoredProcedureParameter
     {
 
-        public static final DelStoredProcedureParameter ENTRY = new DelStoredProcedureParameter(
"$entry" );
-        public static final DelStoredProcedureParameter ATTRIBUTES = new DelStoredProcedureParameter(
"$attributes" );
+        public static final AddStoredProcedureParameter ENTRY = new AddStoredProcedureParameter(
"$entry" );
+        public static final AddStoredProcedureParameter ATTRIBUTES = new AddStoredProcedureParameter(
"$attributes" );
 
 
         private AddStoredProcedureParameter( String name )
@@ -175,15 +175,15 @@
 
     }
 
-    public static class DelStoredProcedureParameter extends StoredProcedureParameter
+    public static class DeleteStoredProcedureParameter extends StoredProcedureParameter
     {
 
-        public static final AddStoredProcedureParameter NAME = new AddStoredProcedureParameter(
"$name" );
-        public static final AddStoredProcedureParameter DELETED_ENTRY = new AddStoredProcedureParameter(
+        public static final DeleteStoredProcedureParameter NAME = new DeleteStoredProcedureParameter(
"$name" );
+        public static final DeleteStoredProcedureParameter DELETED_ENTRY = new DeleteStoredProcedureParameter(
             "$deletedEntry" );
 
 
-        private DelStoredProcedureParameter( String name )
+        private DeleteStoredProcedureParameter( String name )
         {
             super( name );
         }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecification.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecification.java?rev=399693&r1=399692&r2=399693&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecification.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecification.java
Thu May  4 06:02:05 2006
@@ -73,6 +73,18 @@
         return storedProcedureParameters;
     }
 
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return actionTime + " " + 
+            ldapOperation +
+            " CALL \"" + storedProcedureName + "\" { " +
+            storedProcedureOptions + " } ( " + storedProcedureParameters + " )";
+    }
+
     /* (non-Javadoc)
      * @see java.lang.Object#hashCode()
      */

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParser.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParser.java?rev=399693&r1=399692&r2=399693&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
Thu May  4 06:02:05 2006
@@ -49,7 +49,7 @@
     /**
      * Creates a TriggerSpecification parser.
      */
-    public TriggerSpecificationParser()
+    public TriggerSpecificationParser( LdapOperationTokenListener listener )
     {
         this.lexer = new ReusableAntlrTriggerSpecificationLexer( new StringReader( "" ) );
         this.parser = new ReusableAntlrTriggerSpecificationParser( lexer );
@@ -57,13 +57,22 @@
         this.parser.init(); // this method MUST be called while we cannot do
         // constructor overloading for antlr generated parser
         this.isNormalizing = false;
+        this.registerLdapOperationTokenListener( listener );
+    }
+    
+    /**
+     * Creates a TriggerSpecification parser.
+     */
+    public TriggerSpecificationParser()
+    {
+        this( GenericLdapOperationTokenListener.AnyOperationListener );
     }
 
 
     /**
      * Creates a normalizing TriggerSpecification parser.
      */
-    public TriggerSpecificationParser(NameComponentNormalizer normalizer)
+    public TriggerSpecificationParser( LdapOperationTokenListener listener, NameComponentNormalizer
normalizer )
     {
         this.lexer = new ReusableAntlrTriggerSpecificationLexer( new StringReader( "" ) );
         this.parser = new ReusableAntlrTriggerSpecificationParser( lexer );
@@ -72,6 +81,15 @@
         this.parser.init(); // this method MUST be called while we cannot do
         // constructor overloading for ANTLR generated parser
         this.isNormalizing = true;
+        this.registerLdapOperationTokenListener( listener );
+    }
+    
+    /**
+     * Creates a normalizing TriggerSpecification parser.
+     */
+    public TriggerSpecificationParser( NameComponentNormalizer normalizer )
+    {
+        this( GenericLdapOperationTokenListener.AnyOperationListener, normalizer );
     }
 
 

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParserTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/trigger/TriggerSpecificationParserTest.java?rev=399693&r1=399692&r2=399693&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
Thu May  4 06:02:05 2006
@@ -68,13 +68,13 @@
         assertNotNull( triggerSpecification );
         assertEquals( triggerSpecification.getActionTime(), ActionTime.BEFORE );
         assertEquals( triggerSpecification.getStoredProcedureName(), "BackupUtilities.backupDeletedEntry"
);
-        assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.DEL );
+        assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.DELETE );
         assertEquals( triggerSpecification.getStoredProcedureOptions().size(), 0 );
         assertEquals( triggerSpecification.getStoredProcedureParameters().size(), 2 );
         assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
-            StoredProcedureParameter.DelStoredProcedureParameter.NAME ) );
+            StoredProcedureParameter.DeleteStoredProcedureParameter.NAME ) );
         assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
-            StoredProcedureParameter.DelStoredProcedureParameter.DELETED_ENTRY ) );
+            StoredProcedureParameter.DeleteStoredProcedureParameter.DELETED_ENTRY ) );
     }
     
     public void testWithGenericParameters() throws Exception



Mime
View raw message