Previous | Next | Trail Map | Java Objects and the Directory | Contents

State Factories

The Storing Objects in the Directory (in the Java Objects and the Directory trail) lesson gave examples of binding several types of objects. What if you want to bind yet another type of object that differs from all of the types shown so far? What determines the types of objects that a service provider is willing to bind?

The JNDI provides a general framework for transforming objects supplied to Context.bind()(in the API reference documentation) and related methods into a format acceptable to a service provider. This framework uses state factories. A state factory transforms an object into another object. The input is the object and optional attributes, supplied to Context.bind()(in the API reference documentation) and the output is another object and optional attributes, to be stored in the underlying naming service or directory. A service provider can be preconfigured with a set of state factories. For example, Sun's LDAP service provider has state factories for storing RMI and CORBA objects. The application can configure additional state factories for a service provider to use.

This lesson first describes how to write a state factory. It then discusses how service providers use state factories and concludes with an example of how to write a custom state factory.


Previous | Next | Trail Map | Java Objects and the Directory | Contents