![]() ![]() ![]() ![]() |
Naming Operations |
The Context interface contains methods for creating and destroying a subcontext. A subcontext is a context that is bound in another context of the same type. In a file system, this corresponds to creating and removing a subdirectory.
Creating a Context
To create a context, you supply the name of the context you want to create to the createSubcontext()method:
This example creates a new context, called "new", that is a child of ctx. If you list the context ctx, you will see that there is now an entry for "new".// Create the context Context result = ctx.createSubcontext("new");Destroying a Context
To destroy a context, you supply the name of the context to destroy to the destroySubcontext()method:
This example destroys the context "new" in the context "ctx".// Destroy the context ctx.destroySubcontext("new");Naming Operations: End of Lesson
![]()
![]()
What's next? Now you can:
- Continue on in this trail to learn how to perform directory operations using the JNDI.
- Go to the Java Objects and the Directory
trail to learn how to store and retrieve objects to/from the directory.
![]() ![]() ![]() ![]() |
Naming Operations |