The Next Naming System

Once a service provider has determined the nns pointer by using the techniques described in the previous section, it next must turn the nns pointer into a context, called the continuation context, and continue the operation in that context. To do this, the JNDI provides the following utility methods.

The argument to these methods is a CannotProceedException.

The purpose of these methods is to get a context in the nns in which to continue the operation by using the nns pointer and other information in the CannotProceedException.

 

 

The Continuation Context

The JNDI obtains the continuation context based on information supplied in the CannotProceedException. The service provider must complete the information in the CannotProceedException. The following table describes the fields of this exception.

Field Description
resolved name The name of the resolved object, relative to the starting context for this operation.
resolved object The nns pointer. This is used as the object argument to the object factory.
remaining name The part of the composite name that remains to be processed.
"alt" name The name of the resolved object, relative to "alt" name context. This is used as the name argument to the object factory.
"alt" name context The context in which to resolve "alt" name. This is used as the context argument to the object factory.
environment The environment of the current context. This is used as the environment argument to the object factory.
remaining new name The remaining name to be used as the "new name" argument for Context.rename().

The JNDI uses the information in the exception to find an object factory, described in the Object Factories lesson, which returns an instance of Context. If the JNDI cannot find an appropriate context in which to continue the operation, then it throws the CannotProceedException received from the service provider.

 

 

Resolving Through Subinterfaces

Notice from the previous description that the object factory that produces the continuation context must return an instance of Context. The instance does not need to implement other subinterfaces of Context. This is because it does not make sense to require intermediate naming systems to implement all of the subinterfaces of the terminal naming system. For resolution to be successful, the JNDI has the following two requirements.

    li> The providers for the originating and terminal naming system must implement the subinterface.

    li> The providers for all other intermediate naming systems are required to implement either the subinterface or both the Resolver and Context interfaces.

The Resolver interface is intended to allow resolution to proceed through a provider that does not support the interface to one that does. DirectoryManager.getContinuationDirContext() automatically uses the Resolver interface when necessary. See the Building a Service Provider trail for details.

 

 

Completing the Operation

After the provider gets a continuation context, it invokes the originally intended context operation on the continuation context by using as the name argument the remaining components of the composite name. Here is an example that does this for DirContext.search().
DirContext cctx = DirectoryManager.getContinuationDirContext(cpe);
answer = cctx.search(cpe.getRemainingName(), matchingAttrs);

The processing then continues to the next naming system. There, the following three-step procedure repeats until the terminal naming system is reached.

    li> Determining the composite name components to process.

    li> Process the results of Step 1.

    li>Continue to the next naming system.

At this point, the actual operation is carried out.

Federation: End of Lesson

What's next? Now you can:

    li> Continue on in this trail to read up on miscellaneous topics such as class loading and link references.


Federation