directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <>
Subject Re: AW: Exploring triggers
Date Wed, 08 Feb 2017 09:54:44 GMT

Le 07/02/2017 à 23:34, Humbi a écrit :

> Hm. Sorry, I don't have a working trigger that actually alters things on the LDAP server.
What do you want to alter? Entries (with Apache DS LDAP API od JNDI) ?

The version that *was* working years ago was based on JNDI. We have
switched to LDAP API in teh server, for every parts of it *but*
triggers. That would mst certainly require some review.

The involved code is not that big, it's a set of 10 classes in the
apacheds-trigger-interceptor module

The core class is the triggerInterceptor class, where each update LDAP
operations are handled by a separate method. Modify, for instance is
handled by :

     * {@inheritDoc}
    public void modify( ModifyOperationContext modifyContext ) throws
        // Bypass trigger handling if the service is disabled.
        if ( !enabled )
            next( modifyContext );

        Dn normName = modifyContext.getDn();

        // Gather supplementary data.
        Entry originalEntry = modifyContext.getEntry();

        StoredProcedureParameterInjector injector = new
ModifyStoredProcedureParameterInjector( modifyContext );

        // Gather Trigger Specifications which apply to the entry being
        List<TriggerSpecification> triggerSpecs = new
        addPrescriptiveTriggerSpecs( modifyContext, triggerSpecs,
normName, originalEntry );
        addEntryTriggerSpecs( triggerSpecs, originalEntry );

        Map<ActionTime, List<TriggerSpecification>> triggerMap =
            triggerSpecs, LdapOperation.MODIFY );

        next( modifyContext );

        triggerSpecCache.subentryModified( modifyContext, originalEntry );

        // Fire AFTER Triggers.
        List<TriggerSpecification> afterTriggerSpecs = triggerMap.get(
ActionTime.AFTER );
        executeTriggers( modifyContext, afterTriggerSpecs, injector );

Once we have fetched the SP to use from the subentry, and called the
underlaying update (the 'next' call), we can process the trigger, which
is done by the last line. At the end, it calls the StoredProcedure.

It's easy to put a breakpoint in this part of the code, and to run the
server from teh debugger (or to attach it to a debugger) : you just have
to start the class, in the
apacheds-service module, passing "./target/instance" as an argument, and
the following VM arguments :


Emmanuel Lecharny

View raw message