Class JndiExamples
java.lang.Object
net.jrodolfo.java_evolution.java03.jndi.JndiExamples
Demonstrates Java Naming and Directory Interface (JNDI), included in J2SE
1.3.
Production JNDI providers often point to LDAP, DNS, RMI registries, or application-server resources. This example uses a tiny in-memory provider so the provider model, names, contexts, bindings, and lookups can be exercised without external infrastructure.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMinimal in-memory context for demonstrating focused JNDI operations.static final classJNDI provider factory selected throughContext.INITIAL_CONTEXT_FACTORY. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbindAndLookup(String name, Object value) Binds a name and looks it up again through the JNDI API.Creates anInitialContextconfigured with the in-memory provider used by this example.
-
Constructor Details
-
JndiExamples
public JndiExamples()
-
-
Method Details
-
createContext
Creates anInitialContextconfigured with the in-memory provider used by this example.- Returns:
- configured initial context
- Throws:
NamingException- when the context cannot be created
-
bindAndLookup
Binds a name and looks it up again through the JNDI API.- Parameters:
name- object namevalue- object to bind- Returns:
- object returned by lookup
- Throws:
NamingException- when binding or lookup fails
-