Previous | Next | Trail Map | Building a Service Provider | Adding URL Support

Relationship to References

As suggested in the Object Factories (in the Java Objects and the Directory trail) lesson, a context implementation is supposed to invoke NamingManager.getObjectInstance()(in the API reference documentation) or DirectoryManager.getObjectInstance()(in the API reference documentation) before returning an object to the API user. If the object being returned is a Reference(in the API reference documentation) that has no factory (that is, its getFactoryClassName()(in the API reference documentation) method returns null), then these methods will check the Reference for an address of type "URL". When these methods find such an address, they will search for a URL context implementation to process the URL string in the address by using the algorithm described earlier in this lesson.

This feature provides a convenient way of using URLs as references. A program can create a reference with minimal information (a URL string) and bind it into a naming or directory service. When another program looks up the reference, the URL is automatically dereferenced into the object to which it refers. This mechanism is precisely the sort of thing needed to support federation: You can bind the URL of one naming service into the namespace of another naming service. This technique works especially well with well-known URL schemes (such as that for the LDAP) for which the URL context implementation is widely available. This is because you don't need to distribute its implementation.

Adding URL Support: End of Lesson

What's next? Now you can:


Previous | Next | Trail Map | Building a Service Provider | Adding URL Support