Representation in the Directory

 


File System

Sun's file system service provider supports storing Java objects in the file system. Specifically, it supports the binding of Referenceable objects. Such objects are stored as a set of properties in a file called .bindings. The parent directory that contains this .bindings file is the parent context of these bindings.

For example, if you have a file directory called food, then you can add a binding to it as follows:

ctx.bind("food/fav", new Fruit("orange"));

The binding for "fav" will be stored in the file food/.bindings. You can subsequently look up the object

Fruit f = (Fruit) ctx.lookup("food/fav");

See The Basics trail for more examples.

Representation in the Directory