directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r440458 [2/2] - in /directory/trunks: apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/ apacheds/core/src/main/java/org/apache/directory/server/core/subtree/ apacheds/core/src/main/java/org/apache/directory/server/c...
Date Tue, 05 Sep 2006 19:35:35 GMT
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java?view=diff&rev=440458&r1=440457&r2=440458
==============================================================================
--- 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
Tue Sep  5 12:35:34 2006
@@ -20,6 +20,8 @@
 
 package org.apache.directory.shared.ldap.trigger;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * An entity that represents a stored procedure parameter which can be
@@ -28,14 +30,50 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev:$, $Date:$
  */
-public class StoredProcedureParameter
+public abstract class StoredProcedureParameter
 {
+    public static class Generic_LDAP_CONTEXT extends StoredProcedureParameter
+    {
+        private LdapDN ctxName;
+        
+        private Generic_LDAP_CONTEXT( LdapDN ctxName )
+        {
+            super( "$ldapContext" );
+            this.ctxName = ctxName;
+        }
+        
+        public static StoredProcedureParameter instance( LdapDN ctxName )
+        {
+            return new Generic_LDAP_CONTEXT( ctxName );
+        }
+        
+        public LdapDN getCtxName()
+        {
+            return ctxName;
+        }
+        
+        public String toString()
+        {
+            return name + " \"" + ctxName.getUpName() + "\"";
+        }
+    }
+    
+    public static class Generic_OPERATION_PRINCIPAL extends StoredProcedureParameter
+    {
+        private static Generic_OPERATION_PRINCIPAL instance = new Generic_OPERATION_PRINCIPAL(
"$operationPrincipal" );
+        
+        private Generic_OPERATION_PRINCIPAL( String identifier )
+        {
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
+        }
+    }
 
-    public static final StoredProcedureParameter OPERATION_TIME = new StoredProcedureParameter(
"$operationTime" );
-    public static final StoredProcedureParameter OPERATION_PRINCIPAL = new StoredProcedureParameter(
"$operationPrincipal" );
-    public static final StoredProcedureParameter ROOT_DSE = new StoredProcedureParameter(
"$rootDSE" );
-
-    private final String name;
+    protected final String name;
 
 
     protected StoredProcedureParameter( String name )
@@ -92,79 +130,88 @@
             return false;
         return true;
     }
+
     
     // Operation Specific Subclasses
 
-    public static class BindStoredProcedureParameter extends StoredProcedureParameter
+    /*public static class ModifyStoredProcedureParameter 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" );
+        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 BindStoredProcedureParameter( String name )
+        private ModifyStoredProcedureParameter( String name )
         {
             super( name );
         }
 
+    }*/
+    
+    public static class Modify_OBJECT extends StoredProcedureParameter
+    {
+        private static Modify_OBJECT instance = new Modify_OBJECT( "$object" );
+        
+        private Modify_OBJECT( String identifier )
+        {
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
+        }
     }
-
-    public static class UnbindStoredProcedureParameter extends StoredProcedureParameter
+    
+    public static class Modify_MODIFICATION extends StoredProcedureParameter
     {
-
-        private UnbindStoredProcedureParameter( String name )
+        private static Modify_MODIFICATION instance = new Modify_MODIFICATION( "$modification"
);
+        
+        private Modify_MODIFICATION( String identifier )
         {
-            super( name );
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
         }
-
     }
-
-    public static class SearchStoredProcedureParameter extends StoredProcedureParameter
+    
+    public static class Modify_OLD_ENTRY 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 )
+        private static Modify_OLD_ENTRY instance = new Modify_OLD_ENTRY( "$oldEntry" );
+        
+        private Modify_OLD_ENTRY( String identifier )
         {
-            super( name );
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
         }
-
     }
-
-    public static class ModifyStoredProcedureParameter extends StoredProcedureParameter
+    
+    public static class Modify_NEW_ENTRY 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 )
+        private static Modify_NEW_ENTRY instance = new Modify_NEW_ENTRY( "$newEntry" );
+        
+        private Modify_NEW_ENTRY( String identifier )
         {
-            super( name );
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
         }
-
     }
 
-    public static class AddStoredProcedureParameter extends StoredProcedureParameter
+    /*public static class AddStoredProcedureParameter extends StoredProcedureParameter
     {
 
         public static final AddStoredProcedureParameter ENTRY = new AddStoredProcedureParameter(
"$entry" );
@@ -176,9 +223,39 @@
             super( name );
         }
 
+    }*/
+    
+    public static class Add_ENTRY extends StoredProcedureParameter
+    {
+        private static Add_ENTRY instance = new Add_ENTRY( "$entry" );
+        
+        private Add_ENTRY( String identifier )
+        {
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
+        }
+    }
+    
+    public static class Add_ATTRIBUTES extends StoredProcedureParameter
+    {
+        private static Add_ATTRIBUTES instance = new Add_ATTRIBUTES( "$attributes" );
+        
+        private Add_ATTRIBUTES( String identifier )
+        {
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
+        }
     }
 
-    public static class DeleteStoredProcedureParameter extends StoredProcedureParameter
+    /*public static class DeleteStoredProcedureParameter extends StoredProcedureParameter
     {
 
         public static final DeleteStoredProcedureParameter NAME = new DeleteStoredProcedureParameter(
"$name" );
@@ -191,68 +268,113 @@
             super( name );
         }
 
+    }*/
+    
+    public static class Delete_NAME extends StoredProcedureParameter
+    {
+        private static Delete_NAME instance = new Delete_NAME( "$name" );
+        
+        private Delete_NAME( String identifier )
+        {
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
+        }
+    }
+    
+    public static class Delete_DELETED_ENTRY extends StoredProcedureParameter
+    {
+        private static Delete_DELETED_ENTRY instance = new Delete_DELETED_ENTRY( "$deletedEntry"
);
+        
+        private Delete_DELETED_ENTRY( String identifier )
+        {
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
+        }
     }
 
-    public static class ModDNStoredProcedureParameter extends StoredProcedureParameter
+    /*public static class ModifyDNStoredProcedureParameter 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(
+        public static final ModifyDNStoredProcedureParameter ENTRY = new ModifyDNStoredProcedureParameter(
"$entry" );
+        public static final ModifyDNStoredProcedureParameter NEW_RDN = new ModifyDNStoredProcedureParameter(
"$newrdn" );
+        public static final ModifyDNStoredProcedureParameter DELETE_OLD_RDN = new ModifyDNStoredProcedureParameter(
             "$deleteoldrdn" );
-        public static final ModDNStoredProcedureParameter NEW_SUPERIOR = new ModDNStoredProcedureParameter(
+        public static final ModifyDNStoredProcedureParameter NEW_SUPERIOR = new ModifyDNStoredProcedureParameter(
             "$newSuperior" );
 
 
-        private ModDNStoredProcedureParameter( String name )
+        private ModifyDNStoredProcedureParameter( String name )
         {
             super( name );
         }
 
+    }*/
+    
+    public static class ModifyDN_ENTRY extends StoredProcedureParameter
+    {
+        private static ModifyDN_ENTRY instance = new ModifyDN_ENTRY( "$entry" );
+        
+        private ModifyDN_ENTRY( String identifier )
+        {
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
+        }
     }
-
-    public static class CompareStoredProcedureParameter extends StoredProcedureParameter
+    
+    public static class ModifyDN_NEW_RDN extends StoredProcedureParameter
     {
-
-        public static final CompareStoredProcedureParameter ENTRY = new CompareStoredProcedureParameter(
"$entry" );
-        public static final CompareStoredProcedureParameter AVA = new CompareStoredProcedureParameter(
"$ava" );
-
-
-        private CompareStoredProcedureParameter( String name )
+        private static ModifyDN_NEW_RDN instance = new ModifyDN_NEW_RDN( "$newrdn" );
+        
+        private ModifyDN_NEW_RDN( String identifier )
         {
-            super( name );
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
         }
-
     }
     
-    public static class AbandonStoredProcedureParameter extends StoredProcedureParameter
+    public static class ModifyDN_DELETE_OLD_RDN extends StoredProcedureParameter
     {
-
-        public static final AbandonStoredProcedureParameter MESSAGE_ID = new  AbandonStoredProcedureParameter(
"$messageId"
-     );
-
-
-        private AbandonStoredProcedureParameter( String name )
+        private static ModifyDN_DELETE_OLD_RDN instance = new ModifyDN_DELETE_OLD_RDN( "$deleteoldrdn"
);
+        
+        private ModifyDN_DELETE_OLD_RDN( String identifier )
         {
-            super( name );
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
         }
-
     }
-
-    public static class ExtendedStoredProcedureParameter extends StoredProcedureParameter
+    
+    public static class ModifyDN_NEW_SUPERIOR extends StoredProcedureParameter
     {
-
-        public static final ExtendedStoredProcedureParameter REQUEST_NAME = new ExtendedStoredProcedureParameter(
-            "$requestName" );
-        public static final ExtendedStoredProcedureParameter REQUEST_VALUE = new ExtendedStoredProcedureParameter(
-            "$requestValue" );
-
-
-        private ExtendedStoredProcedureParameter( String name )
+        private static ModifyDN_NEW_SUPERIOR instance = new ModifyDN_NEW_SUPERIOR( "$newSuperior"
);
+        
+        private ModifyDN_NEW_SUPERIOR( String identifier )
         {
-            super( name );
+            super( identifier );
+        }
+        
+        public static StoredProcedureParameter instance()
+        {
+            return instance;
         }
-
     }
-
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecification.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerSpecification.java?view=diff&rev=440458&r1=440457&r2=440458
==============================================================================
--- 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
Tue Sep  5 12:35:34 2006
@@ -120,7 +120,7 @@
             while ( it.hasNext() )
             {
                 StoredProcedureParameter spParameter = ( StoredProcedureParameter ) it.next();
-                buffer.append( spParameter );
+                buffer.append( spParameter.toString() );
                 if ( it.hasNext() )
                 {
                     buffer.append( ", " );

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java?view=diff&rev=440458&r1=440457&r2=440458
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/TriggerUtils.java
Tue Sep  5 12:35:34 2006
@@ -30,33 +30,64 @@
 import javax.naming.ldap.LdapContext;
 
 /**
- * A utility class for working with Triggers Subentries.
+ * A utility class for working with Triggers Execution Administrative Points
+ * Trigger Execution Subentries and Trigger Specifications.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev:$
  */
 public class TriggerUtils
 {
+    public static String ADMINISTRATIVE_ROLE_ATTR = "administrativeRole";
+    public static String TRIGGER_EXECUTION_SPECIFIC_AREA_ATTR_VALUE = "triggerExecutionSpecificArea";
+    public static String TRIGGER_EXECUTION_SUBENTRY_OC = "triggerExecutionSubentry";
+    public static String ENTRY_TRIGGER_SPECIFICATION_ATTR = "entryTriggerSpecification";
+    public static String PRESCRIPTIVE_TRIGGER_SPECIFICATION_ATTR = "prescriptiveTriggerSpecification";
     
-    public static void loadTriggerSpecification( LdapContext ctx, String cn, String subtree,
String triggerSpec ) throws NamingException
+    
+    public static void defineTriggerExecutionSpecificPoint( LdapContext apCtx ) throws NamingException
     {
-        Attributes ap = ctx.getAttributes( "", new String[] { "administrativeRole" } );
-        Attribute administrativeRole = ap.get( "administrativeRole" );
-        if ( administrativeRole == null || !administrativeRole.contains( "triggerSpecificArea"
) )
+        Attributes ap = apCtx.getAttributes( "", new String[] { ADMINISTRATIVE_ROLE_ATTR
} );
+        Attribute administrativeRole = ap.get( ADMINISTRATIVE_ROLE_ATTR );
+        if ( administrativeRole == null || !administrativeRole.contains( TRIGGER_EXECUTION_SPECIFIC_AREA_ATTR_VALUE
) )
         {
-            Attributes changes = new BasicAttributes( "administrativeRole", "triggerSpecificArea",
true );
-            ctx.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, changes );
+            Attributes changes = new BasicAttributes( ADMINISTRATIVE_ROLE_ATTR, TRIGGER_EXECUTION_SPECIFIC_AREA_ATTR_VALUE,
true );
+            apCtx.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, changes );
         }
-        
-        Attributes subentry = new BasicAttributes( "cn", cn, true );
+    }
+    
+    
+    public static void createTriggerExecutionSubentry(
+        LdapContext apCtx,
+        String subentryCN,
+        String subtreeSpec ) throws NamingException
+    {
+        Attributes subentry = new BasicAttributes( "cn", subentryCN, true );
         Attribute objectClass = new BasicAttribute( "objectClass" );
         subentry.put( objectClass );
         objectClass.add( "top" );
         objectClass.add( "subentry" );
-        objectClass.add( "triggerSubentry" );
-        subentry.put( "subtreeSpecification", subtree );
-        subentry.put( "prescriptiveTrigger", triggerSpec );
-        ctx.createSubcontext( "cn=" + cn, subentry );
+        objectClass.add( TRIGGER_EXECUTION_SUBENTRY_OC );
+        subentry.put( "subtreeSpecification", subtreeSpec );
+        apCtx.createSubcontext( "cn=" + subentryCN, subentry );
+    }
+    
+    
+    public static void loadPrescriptiveTriggerSpecification(
+        LdapContext apCtx,
+        String subentryCN,
+        String triggerSpec ) throws NamingException
+    {        
+        Attributes changes = new BasicAttributes( PRESCRIPTIVE_TRIGGER_SPECIFICATION_ATTR,
triggerSpec, true );
+        apCtx.modifyAttributes( "cn=" + subentryCN, DirContext.ADD_ATTRIBUTE, changes );
+    }
+    
+    
+    public static void loadEntryTriggerSpecification(
+        LdapContext ctx,
+        String triggerSpec ) throws NamingException
+    {        
+        Attributes changes = new BasicAttributes( ENTRY_TRIGGER_SPECIFICATION_ATTR, triggerSpec,
true );
+        ctx.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, changes );
     }
-
 }

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?view=diff&rev=440458&r1=440457&r2=440458
==============================================================================
--- 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 Sep  5 12:35:34 2006
@@ -52,7 +52,7 @@
     /**
      * Creates a TriggerSpecificationParserTest instance.
      */
-    public TriggerSpecificationParserTest(String s)
+    public TriggerSpecificationParserTest( String s )
     {
         super( s );
         parser = new TriggerSpecificationParser();
@@ -62,27 +62,27 @@
     {        
         TriggerSpecification triggerSpecification = null;
         
-        String spec = "BEFORE delete CALL \"BackupUtilities.backupDeletedEntry\" ($name,
$deletedEntry)";
+        String spec = "AFTER Delete CALL \"BackupUtilities.backupDeletedEntry\" ($name, $deletedEntry)";
 
         triggerSpecification = parser.parse( spec );
         
         assertNotNull( triggerSpecification );
-        assertEquals( triggerSpecification.getActionTime(), ActionTime.BEFORE );
+        assertEquals( triggerSpecification.getActionTime(), ActionTime.AFTER );
         assertEquals( triggerSpecification.getStoredProcedureName(), "BackupUtilities.backupDeletedEntry"
);
         assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.DELETE );
         assertEquals( triggerSpecification.getStoredProcedureOptions().size(), 0 );
         assertEquals( triggerSpecification.getStoredProcedureParameters().size(), 2 );
         assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
-            StoredProcedureParameter.DeleteStoredProcedureParameter.NAME ) );
+            StoredProcedureParameter.Delete_NAME.instance() ) );
         assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
-            StoredProcedureParameter.DeleteStoredProcedureParameter.DELETED_ENTRY ) );
+            StoredProcedureParameter.Delete_DELETED_ENTRY.instance() ) );
     }
     
     public void testWithGenericParameters() throws Exception
     {        
         TriggerSpecification triggerSpecification = null;
         
-        String spec = "AFTER add CALL \"Logger.logAddOperation\" ($entry, $attributes, $operationPrincipal)";
+        String spec = "AFTER Add CALL \"Logger.logAddOperation\" ($entry, $attributes, $operationPrincipal)";
 
         triggerSpecification = parser.parse( spec );
         
@@ -93,29 +93,28 @@
         assertEquals( triggerSpecification.getStoredProcedureOptions().size(), 0 );
         assertEquals( triggerSpecification.getStoredProcedureParameters().size(), 3 );
         assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
-            StoredProcedureParameter.AddStoredProcedureParameter.ENTRY ) );
+            StoredProcedureParameter.Add_ENTRY.instance() ) );
         assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
-            StoredProcedureParameter.AddStoredProcedureParameter.ATTRIBUTES ) );
+            StoredProcedureParameter.Add_ATTRIBUTES.instance()) );
         assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
-            StoredProcedureParameter.OPERATION_PRINCIPAL ) );
+            StoredProcedureParameter.Generic_OPERATION_PRINCIPAL.instance() ) );
     }
     
-    public void testWithLanguageOptionAndComments() throws Exception
+    public void testWithLanguageSchemeOption() throws Exception
     {        
         TriggerSpecification triggerSpecification = null;
         
-        String spec = "INSTEADOF search # do not do search \n" +
-            "CALL \"RestrictionUtilities.searchNoWay\"{language \"Java\"}() # but run a procedure";
+        String spec = "AFTER Modify CALL \"Logger.logModifyOperation\" {languageScheme \"Java\"}()";
 
         triggerSpecification = parser.parse( spec );
         
         assertNotNull( triggerSpecification );
-        assertEquals( triggerSpecification.getActionTime(), ActionTime.INSTEADOF );
-        assertEquals( triggerSpecification.getStoredProcedureName(), "RestrictionUtilities.searchNoWay"
);
-        assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.SEARCH );
+        assertEquals( triggerSpecification.getActionTime(), ActionTime.AFTER );
+        assertEquals( triggerSpecification.getStoredProcedureName(), "Logger.logModifyOperation"
);
+        assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.MODIFY );
         assertEquals( triggerSpecification.getStoredProcedureOptions().size(), 1 );
         assertTrue( triggerSpecification.getStoredProcedureOptions().contains(
-            new StoredProcedureLanguageOption( "Java" ) ) );
+            new StoredProcedureLanguageSchemeOption( "Java" ) ) );
         assertEquals( triggerSpecification.getStoredProcedureParameters().size(),  0 );
     }
     
@@ -123,24 +122,47 @@
     {        
         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)";
+        String spec = "AFTER ModifyDN.Rename CALL \"Logger.logModifyDNRenameOperation\" \n"
+
+            "{ searchContext { scope one } \"cn=Logger,ou=Stored Procedures,ou=system\" }
\n" +
+            "($entry, $newrdn)  # Stored Procedure Parameter(s)";
 
         triggerSpecification = parser.parse( spec );
         
         assertNotNull( triggerSpecification );
-        assertEquals( triggerSpecification.getActionTime(), ActionTime.BEFORE );
-        assertEquals( triggerSpecification.getStoredProcedureName(), "AuthUtilities.beforeBind"
);
-        assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.BIND );
+        assertEquals( triggerSpecification.getActionTime(), ActionTime.AFTER );
+        assertEquals( triggerSpecification.getStoredProcedureName(), "Logger.logModifyDNRenameOperation"
);
+        assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.MODIFYDN_RENAME
);
         assertEquals( triggerSpecification.getStoredProcedureOptions().size(), 1 );
         assertTrue( triggerSpecification.getStoredProcedureOptions().contains(
             new StoredProcedureSearchContextOption(
-                new LdapDN( "cn=Auth,cn=System Stored Procedures,ou=system" ), SearchScope.ONE
) ) );
-        assertEquals( triggerSpecification.getStoredProcedureParameters().size(), 1 );
+                new LdapDN( "cn=Logger,ou=Stored Procedures,ou=system" ), SearchScope.ONE
) ) );
+        assertEquals( triggerSpecification.getStoredProcedureParameters().size(), 2 );
+        assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
+            StoredProcedureParameter.ModifyDN_ENTRY.instance() ) );
+        assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
+            StoredProcedureParameter.ModifyDN_NEW_RDN.instance() ) );
+    }
+    
+    public void testWithLdapContextParameter() throws Exception
+    {        
+        TriggerSpecification triggerSpecification = null;
+        
+        String spec = "AFTER Delete CALL \"BackupUtilities.backupDeletedEntry\" ($ldapContext
\"ou=Backup,ou=System\", $name, $deletedEntry)";
+
+        triggerSpecification = parser.parse( spec );
+        
+        assertNotNull( triggerSpecification );
+        assertEquals( triggerSpecification.getActionTime(), ActionTime.AFTER );
+        assertEquals( triggerSpecification.getStoredProcedureName(), "BackupUtilities.backupDeletedEntry"
);
+        assertEquals( triggerSpecification.getLdapOperation(), LdapOperation.DELETE );
+        assertEquals( triggerSpecification.getStoredProcedureOptions().size(), 0 );
+        assertEquals( triggerSpecification.getStoredProcedureParameters().size(), 3 );
+        assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
+            StoredProcedureParameter.Delete_NAME.instance() ) );
+        assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
+            StoredProcedureParameter.Delete_DELETED_ENTRY.instance() ) );
         assertTrue( triggerSpecification.getStoredProcedureParameters().contains(
-            StoredProcedureParameter.BindStoredProcedureParameter.NAME ) );
+            StoredProcedureParameter.Generic_LDAP_CONTEXT.instance( new LdapDN( "ou=Backup,ou=System"
) ) ) );
     }
     
 }



Mime
View raw message