Contents |
You can use the JNDI to perform naming operations, including read operations and operations for updating the namespace. The following operations are described in this lesson:
- Looking up an object
- Listing the contents of a context
- Adding, overwriting, and removing a binding
- Renaming an object
- Creating and destroying subcontexts
Configuration
The examples in this lesson use the file system service provider. They assume that you have set up a sample file namespace using the configuration program (Setup) that accompanies this trail. See the Preparations lesson for instructions on running this program. If you use another service provider or choose to use another part of the file namespace, then the behavior will differ from what is shown here.The initial context used in these examples is initialized using the following environment properties.
// Set up environment for creating the initial context Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); env.put(Context.PROVIDER_URL, "file:/tmp/tutorial"); Context ctx = new InitialContext(env);
Contents |