Adding URL Support

 


Relationship to References

As suggested in the Object Factories lesson, a context implementation is supposed to invoke NamingManager.getObjectInstance() or DirectoryManager.getObjectInstance() before returning an object to the API user. If the object being returned is a Reference that has no factory (that is, its getFactoryClassName() 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:

  • Continue on in this trail to learn how to add federation support to a service provider.
  • Go to the Miscellaneous lesson to learn how to add various enhancements to a service provider, such as adding support for referrals and bundling factories.

Adding URL Support