directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r419984 - in /directory/trunks: apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/ apacheds/core-unit/src/test/resources/org/apache/directory/server/core/trigger/ apacheds/core/src/main/java/org/apache/directory/serv...
Date Fri, 07 Jul 2006 21:05:01 GMT
Author: ersiner
Date: Fri Jul  7 14:05:01 2006
New Revision: 419984

URL: http://svn.apache.org/viewvc?rev=419984&view=rev
Log:
Added a new generic stored procedure parameter for the trigger system: $rootDSE.
>From now on a stored procedure which is to be invoked via a trigger can specify $rootDSE
identifier in the parameter list and it will be passed a rootDSE LdapContext with credentials
of the invoker.
Before this change we were forcing all stored procedures to take a LdapContext parameter.
It's not mandatory now.

Also fixed several parts of the code to reflect this update.


Modified:
    directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java
    directory/trunks/apacheds/core-unit/src/test/resources/org/apache/directory/server/core/trigger/LoggingUtilities.java
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
    directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java
    directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/trigger/StoredProcedureParameter.java

Modified: directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java?rev=419984&r1=419983&r2=419984&view=diff
==============================================================================
--- directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java
(original)
+++ directory/trunks/apacheds/core-unit/src/test/java/org/apache/directory/server/core/trigger/DefaulTriggerServiceTest.java
Fri Jul  7 14:05:01 2006
@@ -51,7 +51,7 @@
         
         // Create the Triger Specification within a Trigger Subentry.
         createTriggerSubentry( "triggerSubentry1",
-            "AFTER delete CALL \"" + BackupUtilities.class.getName() + ".backupDeleted\"
( $name, $operationPrincipal, $deletedEntry )" );
+            "AFTER delete CALL \"" + BackupUtilities.class.getName() + ".backupDeleted\"
( $rootDSE, $name, $operationPrincipal, $deletedEntry )" );
         
         // Create a test entry which is selected by the Trigger Subentry.
         Attributes testEntry = new BasicAttributes( "ou", "testou", true );

Modified: directory/trunks/apacheds/core-unit/src/test/resources/org/apache/directory/server/core/trigger/LoggingUtilities.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core-unit/src/test/resources/org/apache/directory/server/core/trigger/LoggingUtilities.java?rev=419984&r1=419983&r2=419984&view=diff
==============================================================================
--- directory/trunks/apacheds/core-unit/src/test/resources/org/apache/directory/server/core/trigger/LoggingUtilities.java
(original)
+++ directory/trunks/apacheds/core-unit/src/test/resources/org/apache/directory/server/core/trigger/LoggingUtilities.java
Fri Jul  7 14:05:01 2006
@@ -7,7 +7,7 @@
 
 public class LoggingUtilities
 {
-    public static void logWarningForDeletedEntry( LdapContext ctx, Name deletedEntryName,
Name operationPrincipal ) throws NamingException
+    public static void logWarningForDeletedEntry( Name deletedEntryName, Name operationPrincipal
) throws NamingException
     {
         System.out.println( "User \"" + operationPrincipal + "\" is about to delete entry
\"" + deletedEntryName + "\"." );
     }

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java?rev=419984&r1=419983&r2=419984&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
(original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
Fri Jul  7 14:05:01 2006
@@ -30,6 +30,8 @@
 
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.jndi.ServerContext;
+import org.apache.directory.server.core.jndi.ServerLdapContext;
+import org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
 
@@ -44,6 +46,7 @@
         injectors = new HashMap();
         injectors.put( StoredProcedureParameter.OPERATION_PRINCIPAL, $operationPrincipalInjector.inject()
);
         injectors.put( StoredProcedureParameter.OPERATION_TIME, $operationTimeInjector.inject()
);
+        injectors.put( StoredProcedureParameter.ROOT_DSE, $rootDSE.inject() );
     }
     
     protected Name getOperationPrincipal() throws NamingException
@@ -103,5 +106,12 @@
         };
     };
 
+    MicroInjector $rootDSE = new MicroInjector()
+    {
+        public Object inject() throws NamingException
+        {
+            return ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller() ).getRootContext();
+        };
+    };
 
 }

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java?rev=419984&r1=419983&r2=419984&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
(original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
Fri Jul  7 14:05:01 2006
@@ -474,11 +474,9 @@
     private Object executeTrigger( TriggerSpecification tsec, StoredProcedureParameterInjector
injector, ServerLdapContext callerRootCtx ) throws NamingException
     {
         List arguments = new ArrayList();
-        arguments.add( callerRootCtx );
         arguments.addAll( injector.getArgumentsToInject( tsec.getStoredProcedureParameters()
) );
         
         List typeList = new ArrayList();
-        typeList.add( callerRootCtx.getClass() );
         typeList.addAll( getTypesFromValues( arguments ) );
         
         Class[] types = ( Class[] ) ( getTypesFromValues( arguments ).toArray( EMPTY_CLASS_ARRAY
) );

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java?rev=419984&r1=419983&r2=419984&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java
(original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/DefaultServerTriggerServiceTest.java
Fri Jul  7 14:05:01 2006
@@ -84,7 +84,7 @@
         
         // Create the Triger Specification within a Trigger Subentry.
         createTriggerSubentry( ctx, "triggerSubentry1",
-            "AFTER delete CALL \"" + BackupUtilities.class.getName() + ".backupDeleted\"
( $name, $operationPrincipal, $deletedEntry )" );
+            "AFTER delete CALL \"" + BackupUtilities.class.getName() + ".backupDeleted\"
( $rootDSE, $name, $operationPrincipal, $deletedEntry )" );
         
         // Create a test entry which is selected by the Trigger Subentry.
         Attributes testEntry = new BasicAttributes( "ou", "testou", true );

Modified: directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g?rev=419984&r1=419983&r2=419984&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g (original)
+++ directory/trunks/shared/ldap/src/main/antlr/TriggerSpecification.g Fri Jul  7 14:05:01
2006
@@ -493,6 +493,7 @@
 }
     : ID_operationTime { triggerStoredProcedureParameters.add( StoredProcedureParameter.OPERATION_TIME
); }
     | ID_operationPrincipal { triggerStoredProcedureParameters.add( StoredProcedureParameter.OPERATION_PRINCIPAL
); }
+    | ID_rootDSE { triggerStoredProcedureParameters.add( StoredProcedureParameter.ROOT_DSE
); }
     ;
 
 // -----------------------------------------------------------------------------
@@ -688,6 +689,7 @@
     // generic parameters
     ID_operationTime = "$operationtime";
     ID_operationPrincipal = "$operationprincipal";
+    ID_rootDSE = "$rootDSE";
     
     ID_CALL = "call";
     

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?rev=419984&r1=419983&r2=419984&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
Fri Jul  7 14:05:01 2006
@@ -29,8 +29,8 @@
 {
 
     public static final StoredProcedureParameter OPERATION_TIME = new StoredProcedureParameter(
"$operationTime" );
-    public static final StoredProcedureParameter OPERATION_PRINCIPAL = new StoredProcedureParameter(
-        "$operationPrincipal" );
+    public static final StoredProcedureParameter OPERATION_PRINCIPAL = new StoredProcedureParameter(
"$operationPrincipal" );
+    public static final StoredProcedureParameter ROOT_DSE = new StoredProcedureParameter(
"$rootDSE" );
 
     private final String name;
 



Mime
View raw message