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

Storing Objects in the Directory

There are different ways in which applications and services can use the directory to store and locate objects. An application might store Java objects into the directory. Another application might store information in attributes for representing its objects. Other systems might bind some reference information into the directory that can be used to communicate with the actual objects.

Which of these three method to use really depends on the application/system being built and how it needs to interoperate with other applications and systems that will share the objects stored in the directory. In general terms, a Java object's serialized form contains the object's state while an object's reference is a compact representation of addressing information that can be used to contact the object. Some examples are given in the Naming Concepts (in the Getting Started trail) lesson. An object's attributes are properties that are used to describe the object; some attributes might include addressing and/or state information.

This lesson shows you the different ways you can represent Java objects in the directory. Support for these representations depends on the service provider, but service providers are encouraged to support them. Also, individual service providers might support additional representations.


Before you go on: The examples in this lesson use the LDAP directory. The initial context used in these examples is initialized using the following environment properties:
// Set up environment for creating initial context
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, 
    "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");
Furthermore, you must either turn schema-checking off in the server, or add the schema that accompanies this tutorial to the server. Both of these tasks are typically performed by the directory server's administrator. See The Preparations (in the Basics trail) lesson for more information.


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