![]() ![]() ![]() ![]() |
Contents |
There are different ways in which applications and services can use the directory to store and locate objects. An application might store (a copy of) the object itself, or a reference to an object, or attributes that describe the object. 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
lesson. An object's attributes are properties that are used to describe the object; some attributes might include addressing and/or state information.
Which of these three methods 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. Another factor is the support provided by the service provider and underlying directory service.
Programmatically, all applications use one of the following methods when storing objects in the directory:
The application passes the object that it wants to store to one of these methods, and depending on the types of objects supported by the service provider, the object will be transformed into a representation acceptable to the underlying directory service.This lesson shows how to create different types of objects and store them into the directory:
- Java serializable objects
- Referenceable objects and JNDI references
- Objects with attributes (DirContext)
- Java Remote Method Invocation (RMI) objects (including those that use IIOP)
- CORBA objects
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");Schema: In order to run these examples successfully, you must either turn off schema-checking in the server, or add the Java schema and the CORBA schema that accompany this tutorial to the server. Both of these tasks are typically performed by the directory server's administrator. See the Preparations
lesson for more information.
Software Requirements: In addition to the software requirements listed in the Preparations
lesson, you also need the following archive files when using the examples related to RMI and CORBA: ldapbp.jar, and rmiregistry.jar. The ldapbp.jar can be downloaded as part of the LDAP service provider from the JNDI Web site. rmiregistry.jar is available as part of the Java 2 SDK, v 1.3. So, if you are using that SDK, you won't need to add rmiregistry.jar separately. Otherwise, you can download it from the JNDI Web site.
To try the CORBA and RMI/IIOP examples, you need the CORBA classes. If you are using the Java 2 SDK, v 1.2 or higher releases, you already have those classes. Otherwise, you need to install Java IDL, a version of which comes with the RMI-IIOP Standard Extension.
If you are not using the Java 2 SDK, v 1.3, and you want to try the RMI example that uses IIOP, you need to download and install the RMI-IIOP Standard Extension.
![]() ![]() ![]() ![]() |
Contents |