What is it?
The mechanism is a means for injecting and isolating orthogonal services into calls against the nexus. The nexus is the hub used to route calls to partitions to perform CRUD operations upon entries. By injecting these services at this level, partition implementators need not duplicate fuctionality. Services such as authentication, authorization, schema checking, normalization, operational attribute maintenance and more are introduced using Interceptors are used to handle specific steps before storing an object in the backend. W e will use them to authenticate a user, normalize a DN, log some information, etc...
They are like filters in servlet.
. By using interceptors, partition implementors need not be concerned with these aspects and can focus on raw CRUD operations against their backing stores what ever they may be.
How does it work?
Before we talk more about interceptors we must quickly cover the JNDI provider implementation since it is somewhat related.
JNDI Implementation
The JNDI implementation is composed of a set of JNDI Context implementations, a ContextFactory implementation and a set of helper classes.
- DeadContext
- JavaLdapSupport
- ServerContext
- ServerDirContext
- ServerLdapContext
- AbstractContextFactory
- CoreContextFactory
- ServerDirObjectFactory
- ServerDirStateFactory
Every JNDI Context implementation in the provider holds a dedicated reference to a nexus proxy object. This proxy contains all the operations that the nexus contains. The proxy object is at the heart of the mechanism. We will disuss it more after covering the rest of the JNDI provider.
Calls made against JNDI Contexts take relative names as arguments. These names are relative to the distinguished name of the JNDI Context. Within the Context implementations these relative names are transformed into absolute distinguished names. The transformed names are used to make calls against the proxy.
Additional processing may occur before or after a call is made by a context on its proxy to manage JNDI provider specific functions. One such example is the handling of Java objects for serialization and the use of object and state factories.
The nexus proxy object
As mentioned above, each Context that is created has a nexus proxy. The proxy maintains a handle on the context as well.
Section | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Warning | ||
---|---|---|
| ||
This page needs to be overworked |
Operation handling within interceptors
Each operation is associated with a method in each interceptors, even if it does nothing else than calling the next interceptor.
The base idea is to allow pre and post actions to be executed before and after the call of the next interceptors :
Each interceptor process the pre action, call the next interceptor, wait for the response, execute the post action, and returns. We have to implement this chain of interceptors in a way which allows us to add new interceptors, or new pre or post actions, without having to modify the existing code or mechanism.
...