In a hierarchical naming system, we need to represent “folders within folders.” How do we model nested containers where a context (like /usr) contains another full context (like people) that itself can contain bindings?
A subcontext is a context that is contained within another context. For example, /usr/people is a subcontext of /usr. Each subcontext is a full-fledged context in its own right and can contain more bindings or additional subcontexts, enabling tree-structured naming.
- A subcontext is created within a parent context using
createSubcontext() - In file system terms, a subcontext is a “subfolder”
/usris a context;peoplewithin/usris a subcontext- Subcontexts can be nested arbitrarily deep (
/usr/people/ed) - Each subcontext implements the full
Contextinterface
- Full context: A subcontext is a complete Context, not a partial one
- Nestable: Can be nested arbitrarily deep
- Tree structure: Forms the hierarchical naming tree
- Created via API:
Context.createSubcontext(name) - Resolved through path: Accessed via compound names
- Built from: JNDI Context — a subcontext is a type of context
- Built from: JNDI Naming Concepts — subcontexts are a core concept
- Related: Compound Name — compound names traverse subcontexts
- Related: JNDI Binding — subcontexts contain bindings
- Builds into: JNDI — JNDI provides subcontext operations
- Destroying subcontexts: May fail if subcontext is not empty
- Circular references: Avoid creating circular subcontext structures
- Provider support: Not all providers support subcontext creation
- Deep hierarchies: Very deep nesting may impact performance