directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r398243 - 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 Sat, 29 Apr 2006 21:48:35 GMT
Author: ersiner
Date: Sat Apr 29 14:48:34 2006
New Revision: 398243

URL: http://svn.apache.org/viewcvs?rev=398243&view=rev
Log:
changes and notes:

* Added a dummy TriggerSpecification implementation without any logic inside.
I'm not sure if this will fit our needs. This may face an extensive update while writing the Trigger Interceptor.
* Modified the grammar populate the bean.
* Modified test cases for testing bean population.

Added:
    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/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/StoredProcedureOption.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/StoredProcedureSearchContextOption.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecification.java
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/viewcvs/directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g?rev=398243&r1=398242&r2=398243&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g (original)
+++ directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g Sat Apr 29 14:48:34 2006
@@ -22,6 +22,8 @@
 
 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;
@@ -41,7 +43,7 @@
  * @see http://docs.safehaus.org/display/APACHEDS/Grammar+for+Triggers
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$ $Date$
+ * @version $Rev:$, $Date:$
  */
 class AntlrTriggerSpecificationParser extends Parser;
 
@@ -70,6 +72,16 @@
     private boolean isNormalizing = false;
     private NameComponentNormalizer normalizer;
     
+    private ActionTime triggerActionTime;
+    
+    private LdapOperation triggerLdapOperation;
+    
+    private String triggerStoredProcedureName;
+    
+    private List triggerStoredProcedureOptions = new ArrayList();
+    
+    private List triggerStoredProcedureParameters = new ArrayList();
+    
     /**
      * Creates a (normalizing) subordinate DnParser for parsing Names.
      * This method MUST be called for each instance while we cannot do
@@ -116,49 +128,58 @@
 //  parser productions
 // ----------------------------------------------------------------------------
 
-wrapperEntryPoint
+wrapperEntryPoint returns [ TriggerSpecification triggerSpec ]
 {
     log.debug( "entered wrapperEntryPoint()" );
+    triggerSpec = null;
 }
     :
-    ( SP )* triggerSpecification ( SP )* EOF
+    ( SP )* triggerSpec=triggerSpecification ( SP )* EOF
     ;
 
 // -----------------------------------------------------------------------------
 //  main rules
 // -----------------------------------------------------------------------------
 
-triggerSpecification
+triggerSpecification returns [ TriggerSpecification triggerSpec ]
 {
     log.debug( "entered triggerSpecification()" );
+    triggerSpec = null;
 }
     :
     actionTime ( SP )+ ldapOperationAndStoredProcedureCall
+    { triggerSpec = new TriggerSpecification( triggerLdapOperation,
+                                              triggerActionTime,
+                                              triggerStoredProcedureName,
+                                              triggerStoredProcedureOptions,
+                                              triggerStoredProcedureParameters
+                                            );
+    }
     ;
     
 actionTime
 {
     log.debug( "entered actionTime()" );
 }
-    : ID_BEFORE
-    | ID_AFTER
-    | ID_INSTEADOF
+    : ID_BEFORE { triggerActionTime = ActionTime.BEFORE; }
+    | ID_AFTER { triggerActionTime = ActionTime.AFTER; }
+    | ID_INSTEADOF { triggerActionTime = ActionTime.INSTEADOF; }
     ;
     
 ldapOperationAndStoredProcedureCall
 {
     log.debug( "entered ldapOperationAndStoredProcedureCall()" );
 }
-    : bindOperationAndStoredProcedureCall
-    | unbindOperationAndStoredProcedureCall
-    | searchOperationAndStoredProcedureCall
-    | modifyOperationAndStoredProcedureCall
-    | addOperationAndStoredProcedureCall
-    | delOperationAndStoredProcedureCall
-    | modDNOperationAndStoredProcedureCall
-    | compareOperationAndStoredProcedureCall
-    | abandonOperationAndStoredProcedureCall
-    | extendedOperationAndStoredProcedureCall
+    : bindOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.BIND; }
+    | unbindOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.UNBIND; }
+    | searchOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.SEARCH; }
+    | modifyOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.MODIFY; }
+    | addOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.ADD; }
+    | delOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.DEL; }
+    | modDNOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.MODDN; }
+    | compareOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.COMPARE; }
+    | abandonOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.ABANDON; }
+    | extendedOperationAndStoredProcedureCall { triggerLdapOperation = LdapOperation.EXTENDED; }
     ;
 
 // -----------------------------------------------------------------------------
@@ -289,8 +310,9 @@
     log.debug( "entered theCompositeRuleForCallAndSPNameAndSPOptionList()" );
 }
     :
-    ( SP )+ ID_CALL ( SP )+ fullyQualifiedStoredProcedureName ( SP )*
-        ( genericStoredProcedureOptionList ( SP )* )?
+    ( SP )+ ID_CALL ( SP )+ triggerStoredProcedureName=fullyQualifiedStoredProcedureName ( SP )*
+        ( genericStoredProcedureOptionList ( SP )* )?
+    {  }
     ;
 
 // -----------------------------------------------------------------------------
@@ -395,9 +417,9 @@
 {
     log.debug( "entered bindStoredProcedureParameter()" );
 }
-    : ID_version
-    | ID_name
-    | ID_authentication
+    : ID_version { triggerStoredProcedureParameters.add( StoredProcedureParameter.BindStoredProcedureParameter.VERSION ); }
+    | ID_name { triggerStoredProcedureParameters.add( StoredProcedureParameter.BindStoredProcedureParameter.NAME ); }
+    | ID_authentication { triggerStoredProcedureParameters.add( StoredProcedureParameter.BindStoredProcedureParameter.AUTHENTICATION ); }
     | genericStoredProcedureParameter
     ;
 
@@ -412,14 +434,14 @@
 {
     log.debug( "entered searchStoredProcedureParameter()" );
 }
-    : ID_baseObject
-    | ID_scope
-    | ID_derefAliases
-    | ID_sizeLimit
-    | ID_timeLimit
-    | ID_typesOnly
-    | ID_filter
-    | ID_attributes
+    : ID_baseObject { triggerStoredProcedureParameters.add( StoredProcedureParameter.SearchStoredProcedureParameter.BASE_OBJECT ); }
+    | ID_scope { triggerStoredProcedureParameters.add( StoredProcedureParameter.SearchStoredProcedureParameter.SCOPE ); }
+    | ID_derefAliases { triggerStoredProcedureParameters.add( StoredProcedureParameter.SearchStoredProcedureParameter.DEREF_ALIASES ); }
+    | ID_sizeLimit { triggerStoredProcedureParameters.add( StoredProcedureParameter.SearchStoredProcedureParameter.SIZE_LIMIT ); }
+    | ID_timeLimit { triggerStoredProcedureParameters.add( StoredProcedureParameter.SearchStoredProcedureParameter.TIME_LIMIT ); }
+    | ID_typesOnly { triggerStoredProcedureParameters.add( StoredProcedureParameter.SearchStoredProcedureParameter.TYPES_ONLY ); }
+    | ID_filter { triggerStoredProcedureParameters.add( StoredProcedureParameter.SearchStoredProcedureParameter.FILTER ); }
+    | ID_attributes { triggerStoredProcedureParameters.add( StoredProcedureParameter.SearchStoredProcedureParameter.ATTRIBUTES ); }
     | genericStoredProcedureParameter
     ;
 
@@ -427,10 +449,10 @@
 {
     log.debug( "entered modifyStoredProcedureParameter()" );
 }
-    : ID_object
-    | ID_modification
-    | ID_oldEntry
-    | ID_newEntry
+    : ID_object { triggerStoredProcedureParameters.add( StoredProcedureParameter.ModifyStoredProcedureParameter.OBJECT ); }
+    | ID_modification { triggerStoredProcedureParameters.add( StoredProcedureParameter.ModifyStoredProcedureParameter.MODIFICATION ); }
+    | ID_oldEntry { triggerStoredProcedureParameters.add( StoredProcedureParameter.ModifyStoredProcedureParameter.OLD_ENTRY ); }
+    | ID_newEntry { triggerStoredProcedureParameters.add( StoredProcedureParameter.ModifyStoredProcedureParameter.NEW_ENTRY ); }
     | genericStoredProcedureParameter
     ;
 
@@ -438,8 +460,8 @@
 {
     log.debug( "entered addStoredProcedureParameter()" );
 }
-    : ID_entry
-    | ID_attributes
+    : ID_entry { triggerStoredProcedureParameters.add( StoredProcedureParameter.AddStoredProcedureParameter.ENTRY ); }
+    | ID_attributes { triggerStoredProcedureParameters.add( StoredProcedureParameter.AddStoredProcedureParameter.ATTRIBUTES ); }
     | genericStoredProcedureParameter
     ;
 
@@ -447,8 +469,8 @@
 {
     log.debug( "entered delStoredProcedureParameter()" );
 }
-    : ID_name
-    | ID_deletedEntry
+    : ID_name { triggerStoredProcedureParameters.add( StoredProcedureParameter.DelStoredProcedureParameter.NAME ); }
+    | ID_deletedEntry { triggerStoredProcedureParameters.add( StoredProcedureParameter.DelStoredProcedureParameter.DELETED_ENTRY ); }
     | genericStoredProcedureParameter
     ;
 
@@ -456,10 +478,10 @@
 {
     log.debug( "entered modDNStoredProcedureParameter()" );
 }
-    : ID_entry
-    | ID_newrdn
-    | ID_deleteoldrdn
-    | ID_newSuperior
+    : ID_entry { triggerStoredProcedureParameters.add( StoredProcedureParameter.ModDNStoredProcedureParameter.ENTRY ); }
+    | ID_newrdn { triggerStoredProcedureParameters.add( StoredProcedureParameter.ModDNStoredProcedureParameter.NEW_RDN ); }
+    | ID_deleteoldrdn { triggerStoredProcedureParameters.add( StoredProcedureParameter.ModDNStoredProcedureParameter.DELETE_OLD_RDN ); }
+    | ID_newSuperior { triggerStoredProcedureParameters.add( StoredProcedureParameter.ModDNStoredProcedureParameter.NEW_SUPERIOR ); }
     | genericStoredProcedureParameter
     ;
 
@@ -467,8 +489,8 @@
 {
     log.debug( "entered compareStoredProcedureParameter()" );
 }
-    : ID_entry
-    | ID_ava
+    : ID_entry { triggerStoredProcedureParameters.add( StoredProcedureParameter.CompareStoredProcedureParameter.ENTRY ); }
+    | ID_ava { triggerStoredProcedureParameters.add( StoredProcedureParameter.CompareStoredProcedureParameter.AVA ); }
     | genericStoredProcedureParameter
     ;
 
@@ -476,7 +498,7 @@
 {
     log.debug( "entered abandonStoredProcedureParameter()" );
 }
-    : ID_messageId
+    : ID_messageId { triggerStoredProcedureParameters.add( StoredProcedureParameter.AbandonStoredProcedureParameter.MESSAGE_ID ); }
     | genericStoredProcedureParameter
     ;
     
@@ -484,8 +506,8 @@
 {
     log.debug( "entered extendedStoredProcedureParameter()" );
 }
-    : ID_requestName
-    | ID_requestValue
+    : ID_requestName { triggerStoredProcedureParameters.add( StoredProcedureParameter.ExtendedStoredProcedureParameter.REQUEST_NAME ); }
+    | ID_requestValue { triggerStoredProcedureParameters.add( StoredProcedureParameter.ExtendedStoredProcedureParameter.REQUEST_VALUE ); }
     | genericStoredProcedureParameter
     ;
 
@@ -495,8 +517,8 @@
 {
     log.debug( "entered genericStoredProcedureParameter()" );
 }
-    :
-    ID_operationTime | ID_operationPrincipal
+    : ID_operationTime { triggerStoredProcedureParameters.add( StoredProcedureParameter.OPERATION_TIME ); }
+    | ID_operationPrincipal { triggerStoredProcedureParameters.add( StoredProcedureParameter.OPERATION_PRINCIPAL ); }
     ;
 
 // -----------------------------------------------------------------------------
@@ -513,55 +535,64 @@
 genericStoredProcedureOption
 {
     log.debug( "entered genericStoredProcedureOption()" );
+    StoredProcedureOption spOption = null;
 }
-    :
-    storedProcedureLanguageOption | storedProcedureSearchContextOption
+    : ( spOption=storedProcedureLanguageOption | spOption=storedProcedureSearchContextOption )
+    { triggerStoredProcedureOptions.add( spOption ); }
     ;
 
-storedProcedureLanguageOption
+storedProcedureLanguageOption returns [ StoredProcedureLanguageOption spLanguageOption ]
 {
     log.debug( "entered storedProcedureLanguageOption()" );
+    spLanguageOption = null;
 }
-    :
-    ID_language ( SP )+ languageToken:UTF8String
+    : ID_language ( SP )+ languageToken:UTF8String
+    { spLanguageOption = new StoredProcedureLanguageOption( languageToken.getText() ); }
     ;
 
-storedProcedureSearchContextOption
+storedProcedureSearchContextOption returns [ StoredProcedureSearchContextOption spSearchContextOption ]
 {
     log.debug( "entered storedProcedureSearchContextOption()" );
+    spSearchContextOption = null;
+    SearchScope searchScope = SearchScope.BASE; // default scope
+    Name spSearchContext = null;
 }
     :
     ID_searchContext ( SP )+
         ( OPEN_CURLY ( SP )*
-            ( ID_search_scope ( SP )+ storedProcedureSearchScope ( SP )* )?
+            ( ID_search_scope ( SP )+ searchScope=storedProcedureSearchScope ( SP )* )?
         CLOSE_CURLY ( SP )+ )?
-    storedProcedureSearchContext
+    spSearchContext=storedProcedureSearchContext
+    { spSearchContextOption = new StoredProcedureSearchContextOption( spSearchContext, searchScope ); }
     ;
 
-storedProcedureSearchScope
+storedProcedureSearchScope returns [ SearchScope scope ]
 {
     log.debug( "entered storedProcedureSearchScope()" );
+    scope = null;
 }
-    : ID_scope_base
-    | ID_scope_one
-    | ID_scope_subtree
+    : ID_scope_base { scope = SearchScope.BASE; }
+    | ID_scope_one { scope = SearchScope.ONE; }
+    | ID_scope_subtree { scope = SearchScope.SUBTREE; }
     ;
 
-storedProcedureSearchContext
+storedProcedureSearchContext returns [ Name spSearchContext ]
 {
     log.debug( "entered storedProcedureSearchContext()" );
+    spSearchContext = null;
 }
-    : distinguishedName
+    : spSearchContext=distinguishedName
     ;
 
 // -----------------------------------------------------------------------------
 
-fullyQualifiedStoredProcedureName
+fullyQualifiedStoredProcedureName returns [ String spName ] 
 {
     log.debug( "entered fullyQualifiedStoredProcedureName()" );
+    spName = null;
 }
-    :
-    spNameToken:UTF8String
+    : spNameToken:UTF8String
+    { spName = spNameToken.getText(); }
     ;
 
 distinguishedName returns [ Name name ] 
@@ -569,8 +600,7 @@
     log.debug( "entered distinguishedName()" );
     name = null;
 }
-    :
-    nameToken:UTF8String
+    : nameToken:UTF8String
     {
         name = dnParser.parse( nameToken.getText() );
     }

Added: 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=398243&view=auto
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/ActionTime.java (added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/ActionTime.java Sat Apr 29 14:48:34 2006
@@ -0,0 +1,59 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.trigger;
+
+
+/**
+ * An enumeration that represents action times
+ * for an LDAP trigger specification.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev:$, $Date:$
+ */
+public class ActionTime
+{
+    public static final ActionTime BEFORE = new ActionTime( "BEFORE" );
+
+    public static final ActionTime AFTER = new ActionTime( "AFTER" );
+
+    public static final ActionTime INSTEADOF = new ActionTime( "INSTEADOF" );
+
+    
+    private final String name;
+
+
+    private ActionTime( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Returns the name of this action time.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public String toString()
+    {
+        return name;
+    }
+}

Added: 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=398243&view=auto
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java (added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/LdapOperation.java Sat Apr 29 14:48:34 2006
@@ -0,0 +1,72 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.trigger;
+
+
+/**
+ * An enumeration that represents all standard LDAP operations.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev:$, $Date:$
+ */
+public class LdapOperation
+{
+    public static final LdapOperation BIND = new LdapOperation( "bind" );
+
+    public static final LdapOperation UNBIND = new LdapOperation( "unbind" );
+
+    public static final LdapOperation SEARCH = new LdapOperation( "search" );
+
+    public static final LdapOperation MODIFY = new LdapOperation( "modify" );
+
+    public static final LdapOperation ADD = new LdapOperation( "add" );
+
+    public static final LdapOperation DEL = new LdapOperation( "del" );
+
+    public static final LdapOperation MODDN = new LdapOperation( "moddn" );
+
+    public static final LdapOperation COMPARE = new LdapOperation( "compare" );
+    
+    public static final LdapOperation ABANDON = new LdapOperation( "abandon" );
+    
+    public static final LdapOperation EXTENDED = new LdapOperation( "extended" );
+
+    
+    private final String name;
+
+
+    private LdapOperation( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Returns the name of this LDAP operation.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public String toString()
+    {
+        return name;
+    }
+}

Added: 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=398243&view=auto
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/SearchScope.java (added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/SearchScope.java Sat Apr 29 14:48:34 2006
@@ -0,0 +1,53 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.trigger;
+
+
+/**
+ * An enumeration that represents LDAP search scopes.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev:$, $Date:$
+ */
+public class SearchScope
+{
+    public static final SearchScope BASE = new SearchScope( "base" );
+
+    public static final SearchScope ONE = new SearchScope( "one" );
+
+    public static final SearchScope SUBTREE = new SearchScope( "subtree" );
+
+    
+    private final String name;
+
+
+    private SearchScope( String name )
+    {
+        this.name = name;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public String toString()
+    {
+        return name;
+    }
+}

Added: 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=398243&view=auto
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureLanguageOption.java (added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureLanguageOption.java Sat Apr 29 14:48:34 2006
@@ -0,0 +1,66 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.trigger;
+
+
+/**
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev:$, $Date:$
+ */
+public class StoredProcedureLanguageOption implements StoredProcedureOption
+{
+    
+    private String language;
+    
+    public StoredProcedureLanguageOption( String language )
+    {
+        this.language = language;
+    }
+    
+    public String getLanguage()
+    {
+        return language;
+    }
+
+    public boolean equals( Object obj )
+    {
+        if ( obj == this )
+        {
+            return true;
+        }
+        
+        if ( obj instanceof StoredProcedureLanguageOption )
+        {
+            StoredProcedureLanguageOption splo = ( StoredProcedureLanguageOption ) obj; 
+            if ( splo.getLanguage().equals( this.getLanguage() ) )
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+}

Added: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureOption.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureOption.java?rev=398243&view=auto
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureOption.java (added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureOption.java Sat Apr 29 14:48:34 2006
@@ -0,0 +1,31 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.trigger;
+
+
+
+/**
+ * Just a marker interface for Stored Procedure Options.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev:$, $Date:$
+ */
+public interface StoredProcedureOption
+{
+
+}

Added: 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=398243&view=auto
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java (added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java Sat Apr 29 14:48:34 2006
@@ -0,0 +1,220 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.trigger;
+
+
+/**
+ * An entity that represents a stored procedure parameter which can be
+ * specified in an LDAP Trigger Specification.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev:$, $Date:$
+ */
+public class StoredProcedureParameter
+{
+
+    public static final StoredProcedureParameter OPERATION_TIME = new StoredProcedureParameter( "operationTime" );
+    public static final StoredProcedureParameter OPERATION_PRINCIPAL = new StoredProcedureParameter(
+        "operationPrincipal" );
+
+    private final String name;
+
+
+    protected StoredProcedureParameter( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Returns the name of this Stored Procedure Parameter.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public String toString()
+    {
+        return name;
+    }
+    
+    // Operation Specific Subclasses
+
+    public static class BindStoredProcedureParameter extends StoredProcedureParameter
+    {
+
+        public static final BindStoredProcedureParameter VERSION = new BindStoredProcedureParameter( "$version" );
+        public static final BindStoredProcedureParameter NAME = new BindStoredProcedureParameter( "$name" );
+        public static final BindStoredProcedureParameter AUTHENTICATION = new BindStoredProcedureParameter(
+            "$authentication" );
+
+
+        private BindStoredProcedureParameter( String name )
+        {
+            super( name );
+        }
+
+    }
+
+    public static class UnbindStoredProcedureParameter extends StoredProcedureParameter
+    {
+
+        private UnbindStoredProcedureParameter( String name )
+        {
+            super( name );
+        }
+
+    }
+
+    public static class SearchStoredProcedureParameter extends StoredProcedureParameter
+    {
+
+        public static final SearchStoredProcedureParameter BASE_OBJECT = new SearchStoredProcedureParameter(
+            "$baseObject" );
+        public static final SearchStoredProcedureParameter SCOPE = new SearchStoredProcedureParameter( "$scope" );
+        public static final SearchStoredProcedureParameter DEREF_ALIASES = new SearchStoredProcedureParameter(
+            "$derefAliases" );
+        public static final SearchStoredProcedureParameter SIZE_LIMIT = new SearchStoredProcedureParameter(
+            "$sizeLimit" );
+        public static final SearchStoredProcedureParameter TIME_LIMIT = new SearchStoredProcedureParameter(
+            "$timeLimit" );
+        public static final SearchStoredProcedureParameter TYPES_ONLY = new SearchStoredProcedureParameter(
+            "$typesOnly" );
+        public static final SearchStoredProcedureParameter FILTER = new SearchStoredProcedureParameter( "$filter" );
+        public static final SearchStoredProcedureParameter ATTRIBUTES = new SearchStoredProcedureParameter(
+            "$attributes" );
+
+
+        private SearchStoredProcedureParameter( String name )
+        {
+            super( name );
+        }
+
+    }
+
+    public static class ModifyStoredProcedureParameter extends StoredProcedureParameter
+    {
+
+        public static final ModifyStoredProcedureParameter OBJECT = new ModifyStoredProcedureParameter( "$object" );
+        public static final ModifyStoredProcedureParameter MODIFICATION = new ModifyStoredProcedureParameter(
+            "$modification" );
+        public static final ModifyStoredProcedureParameter OLD_ENTRY = new ModifyStoredProcedureParameter( "$oldEntry" );
+        public static final ModifyStoredProcedureParameter NEW_ENTRY = new ModifyStoredProcedureParameter( "$newEntry" );
+
+
+        private ModifyStoredProcedureParameter( String name )
+        {
+            super( name );
+        }
+
+    }
+
+    public static class AddStoredProcedureParameter extends StoredProcedureParameter
+    {
+
+        public static final DelStoredProcedureParameter ENTRY = new DelStoredProcedureParameter( "$entry" );
+        public static final DelStoredProcedureParameter ATTRIBUTES = new DelStoredProcedureParameter( "$attributes" );
+
+
+        private AddStoredProcedureParameter( String name )
+        {
+            super( name );
+        }
+
+    }
+
+    public static class DelStoredProcedureParameter extends StoredProcedureParameter
+    {
+
+        public static final AddStoredProcedureParameter NAME = new AddStoredProcedureParameter( "$name" );
+        public static final AddStoredProcedureParameter DELETED_ENTRY = new AddStoredProcedureParameter(
+            "$deletedEntry" );
+
+
+        private DelStoredProcedureParameter( String name )
+        {
+            super( name );
+        }
+
+    }
+
+    public static class ModDNStoredProcedureParameter extends StoredProcedureParameter
+    {
+
+        public static final ModDNStoredProcedureParameter ENTRY = new ModDNStoredProcedureParameter( "$entry" );
+        public static final ModDNStoredProcedureParameter NEW_RDN = new ModDNStoredProcedureParameter( "$newrdn" );
+        public static final ModDNStoredProcedureParameter DELETE_OLD_RDN = new ModDNStoredProcedureParameter(
+            "$deleteoldrdn" );
+        public static final ModDNStoredProcedureParameter NEW_SUPERIOR = new ModDNStoredProcedureParameter(
+            "$newSuperior" );
+
+
+        private ModDNStoredProcedureParameter( String name )
+        {
+            super( name );
+        }
+
+    }
+
+    public static class CompareStoredProcedureParameter extends StoredProcedureParameter
+    {
+
+        public static final CompareStoredProcedureParameter ENTRY = new CompareStoredProcedureParameter( "$entry" );
+        public static final CompareStoredProcedureParameter AVA = new CompareStoredProcedureParameter( "$ava" );
+
+
+        private CompareStoredProcedureParameter( String name )
+        {
+            super( name );
+        }
+
+    }
+    
+    public static class AbandonStoredProcedureParameter extends StoredProcedureParameter
+    {
+
+        public static final AbandonStoredProcedureParameter MESSAGE_ID = new  AbandonStoredProcedureParameter( "$messageId"
+     );
+
+
+        private AbandonStoredProcedureParameter( String name )
+        {
+            super( name );
+        }
+
+    }
+
+    public static class ExtendedStoredProcedureParameter extends StoredProcedureParameter
+    {
+
+        public static final ExtendedStoredProcedureParameter REQUEST_NAME = new ExtendedStoredProcedureParameter(
+            "$requestName" );
+        public static final ExtendedStoredProcedureParameter REQUEST_VALUE = new ExtendedStoredProcedureParameter(
+            "$requestValue" );
+
+
+        private ExtendedStoredProcedureParameter( String name )
+        {
+            super( name );
+        }
+
+    }
+
+}

Added: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureSearchContextOption.java
URL: http://svn.apache.org/viewcvs/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureSearchContextOption.java?rev=398243&view=auto
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureSearchContextOption.java (added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureSearchContextOption.java Sat Apr 29 14:48:34 2006
@@ -0,0 +1,87 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.trigger;
+
+import javax.naming.Name;
+
+
+/**
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev:$, $Date:$
+ */
+public class StoredProcedureSearchContextOption implements StoredProcedureOption
+{
+    
+    private final Name baseObject;
+    private SearchScope searchScope;
+
+    
+    public StoredProcedureSearchContextOption( Name baseObject )
+    {
+        // the default search scope is "base"
+        this( baseObject, SearchScope.BASE );
+    }
+    
+    public StoredProcedureSearchContextOption( Name baseObject, SearchScope searchScope )
+    {
+        this.baseObject = baseObject;
+        this.searchScope = searchScope;
+    }
+
+    public Name getBaseObject()
+    {
+        return baseObject;
+    }
+    
+    public SearchScope getSearchScope()
+    {
+        return searchScope;
+    }
+
+    public String toString()
+    {
+        return baseObject.toString();
+    }
+
+    public boolean equals( Object obj )
+    {
+        if ( obj == this )
+        {
+            return true;
+        }
+        
+        if ( obj instanceof StoredProcedureSearchContextOption )
+        {
+            StoredProcedureSearchContextOption stsco = ( StoredProcedureSearchContextOption ) obj;
+            if ( stsco.getBaseObject().equals( this.getBaseObject() ) && stsco.getSearchScope().equals( this.getSearchScope() ) )
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        else
+        {
+            return false;
+        }
+    }
+    
+}

Added: 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=398243&view=auto
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecification.java (added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecification.java Sat Apr 29 14:48:34 2006
@@ -0,0 +1,76 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.shared.ldap.trigger;
+
+import java.util.List;
+
+/**
+ * The Trigger Specification Bean.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev:$, $Date:$
+ */
+public class TriggerSpecification
+{
+    
+    private LdapOperation ldapOperation;
+    
+    private ActionTime actionTime;
+    
+    private String storedProcedureName;
+    
+    private List storedProcedureOptions;
+    
+    private List storedProcedureParameters;
+    
+    public TriggerSpecification( LdapOperation ldapOperation, ActionTime actionTime, String storedProcedureName, List storedProcedureOptions, List storedProcedureParameters )
+    {
+        super();
+        this.ldapOperation = ldapOperation;
+        this.actionTime = actionTime;
+        this.storedProcedureName = storedProcedureName;
+        this.storedProcedureOptions = storedProcedureOptions;
+        this.storedProcedureParameters = storedProcedureParameters;
+    }
+
+    public ActionTime getActionTime()
+    {
+        return actionTime;
+    }
+
+    public LdapOperation getLdapOperation()
+    {
+        return ldapOperation;
+    }
+
+    public String getStoredProcedureName()
+    {
+        return storedProcedureName;
+    }
+
+    public List getStoredProcedureOptions()
+    {
+        return storedProcedureOptions;
+    }
+
+    public List getStoredProcedureParameters()
+    {
+        return storedProcedureParameters;
+    }
+    
+}

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=398243&r1=398242&r2=398243&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 Sat Apr 29 14:48:34 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -28,12 +28,12 @@
 
 
 /**
- * A reusable wrapper around the antlr generated parser for an ACIItem as
- * defined by X.501. This class enables the reuse of the antlr parser/lexer pair
- * without having to recreate them every time.
+ * A reusable wrapper around the ANTLR generated parser for a
+ * TriggerSpecification. This class enables the reuse of the antlr parser/lexer
+ * pair without having to recreate them every time.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 379008 $
+ * @version $Rev:$, $Date:$
  */
 public class TriggerSpecificationParser
 {
@@ -47,7 +47,7 @@
 
 
     /**
-     * Creates a ACIItem parser.
+     * Creates a TriggerSpecification parser.
      */
     public TriggerSpecificationParser()
     {
@@ -61,7 +61,7 @@
 
 
     /**
-     * Creates a normalizing ACIItem parser.
+     * Creates a normalizing TriggerSpecification parser.
      */
     public TriggerSpecificationParser(NameComponentNormalizer normalizer)
     {
@@ -70,14 +70,17 @@
 
         this.parser.setNormalizer( normalizer );
         this.parser.init(); // this method MUST be called while we cannot do
-        // constructor overloading for antlr generated parser
+        // constructor overloading for ANTLR generated parser
         this.isNormalizing = true;
     }
 
 
     /**
      * Initializes the plumbing by creating a pipe and coupling the parser/lexer
-     * pair with it. param spec the specification to be parsed
+     * pair with it.
+     * 
+     * @param
+     *          spec the specification to be parsed
      */
     private synchronized void reset( String spec )
     {
@@ -88,42 +91,43 @@
 
 
     /**
-     * Parses an ACIItem without exhausting the parser.
+     * Parses an TriggerSpecification without exhausting the parser.
      * 
      * @param spec
-     *            the specification to be parsed
+     *          the specification to be parsed
      * @return the specification bean
      * @throws ParseException
-     *             if there are any recognition errors (bad syntax)
+     *          if there are any recognition errors (bad syntax)
      */
-    public synchronized void parse( String spec ) throws ParseException
+    public synchronized TriggerSpecification parse( String spec ) throws ParseException
     {
+        TriggerSpecification triggerSpecification = null;
 
         if ( spec == null || spec.trim().equals( "" ) )
         {
-            return;
+            return null;
         }
 
         reset( spec ); // reset and initialize the parser / lexer pair
 
         try
         {
-            this.parser.wrapperEntryPoint();
+            triggerSpecification = this.parser.wrapperEntryPoint();
         }
         catch ( TokenStreamException e )
         {
-            String msg = "TokenStreamException: Parser failure on ACIItem:\n\t" + spec;
-            msg += "\nAntlr exception trace:\n";
-            e.printStackTrace();
+            String msg = "Parser failure on Trigger Specification:\n\t" + spec;
+            msg += "\nAntlr exception trace:\n" + e.getMessage();
             throw new ParseException( msg, 0 );
         }
         catch ( RecognitionException e )
         {
-            String msg = "RecognitionException: Parser failure on ACIItem:\n\t" + spec;
-            msg += "\nAntlr exception trace:\n";
-            e.printStackTrace();
+            String msg = "Parser failure on Trigger Specification:\n\t" + spec;
+            msg += "\nAntlr exception trace:\n" + e.getMessage();
             throw new ParseException( msg, e.getColumn() );
         }
+        
+        return triggerSpecification;
 
     }
 

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=398243&r1=398242&r2=398243&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 Sat Apr 29 14:48:34 2006
@@ -18,6 +18,8 @@
 package org.apache.directory.shared.ldap.trigger;
 
 
+import org.apache.directory.shared.ldap.name.LdapName;
+
 import junit.framework.TestCase;
 
 
@@ -25,6 +27,7 @@
  * Unit tests for {@link org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser}.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev:$, $Date:$
  */
 public class TriggerSpecificationParserTest extends TestCase
 {
@@ -54,34 +57,76 @@
 
     public void testWithOperationParameters() throws Exception
     {
+        TriggerSpecification triggerSpecification = null;
+        
         String spec = "BEFORE delete CALL \"BackupUtilities.backupDeletedEntry\" ($name, $deletedEntry)";
 
-        parser.parse( spec );
+        triggerSpecification = parser.parse( spec );
+        
+        assertNotNull( triggerSpecification );
     }
     
     public void testWithGenericParameters() throws Exception
     {
+        TriggerSpecification triggerSpecification = null;
+        
         String spec = "AFTER add CALL \"Logger.logAddOperation\" ($entry, $attributes, $operationPrincipal)";
 
-        parser.parse( spec );
+        triggerSpecification = parser.parse( spec );
+        
+        assertNotNull( triggerSpecification );
+        assertEquals( triggerSpecification.getActionTime(), ActionTime.AFTER );
+        assertEquals( triggerSpecification.getStoredProcedureName(), "Logger.logAddOperation" );
+        assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.ADD );
+        assertTrue( triggerSpecification.getStoredProcedureOptions().size() == 0 );
+        assertTrue( triggerSpecification.getStoredProcedureParameters().size() == 3 );
+        assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
+            StoredProcedureParameter.AddStoredProcedureParameter.ENTRY ) );
+        assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
+            StoredProcedureParameter.AddStoredProcedureParameter.ATTRIBUTES ) );
+        assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
+            StoredProcedureParameter.OPERATION_PRINCIPAL ) );
     }
     
     public void testWithLanguageOptionAndComments() throws Exception
     {
+        TriggerSpecification triggerSpecification = null;
+        
         String spec = "INSTEADOF search # do not do search \n" +
             "CALL \"RestrictionUtilities.searchNoWay\"{language \"Java\"}() # but run a procedure";
 
-        parser.parse( spec );
+        triggerSpecification = parser.parse( spec );
+        
+        assertNotNull( triggerSpecification );
+        assertEquals( triggerSpecification.getActionTime(), ActionTime.INSTEADOF );
+        assertEquals( triggerSpecification.getStoredProcedureName(), "RestrictionUtilities.searchNoWay" );
+        assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.SEARCH );
+        assertEquals( triggerSpecification.getStoredProcedureOptions().size(), 1 );
+        assertTrue( triggerSpecification.getStoredProcedureOptions().contains( new StoredProcedureLanguageOption( "Java" ) ) );
+        assertEquals( triggerSpecification.getStoredProcedureParameters().size(),  0 );
     }
     
     public void testWithSearchContextOption() throws Exception
     {
+        TriggerSpecification triggerSpecification = null;
+        
         String spec = "BEFORE bind  # Action Time and Operation \n" +
             "CALL \"AuthUtilities.beforeBind\"  # Stored Procedure Call \n" +
             "{ searchContext { scope one } \"cn=Auth,cn=System Stored Procedures,ou=system\" }  # Stored Procedure Call Options \n" +
             "($name)  # Stored Procedure Parameter(s)";
 
-        parser.parse( spec );
+        triggerSpecification = parser.parse( spec );
+        
+        assertNotNull( triggerSpecification );
+        assertEquals( triggerSpecification.getActionTime(), ActionTime.BEFORE );
+        assertEquals( triggerSpecification.getStoredProcedureName(), "AuthUtilities.beforeBind" );
+        assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.BIND );
+        assertEquals( triggerSpecification.getStoredProcedureOptions().size(), 1 );
+        assertTrue( triggerSpecification.getStoredProcedureOptions().contains(
+            new StoredProcedureSearchContextOption( new LdapName( "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