The Stibium Java JNDI Service Provider
Stibium includes a standards compliant JNDI Service Provider that can be used directly within the Java JNDI framework,
and which supports the JNDI standard Context and DirContext naming and directory service interfaces.
The Stibium JNDI service provider communicates with the Stibium server over a network using SOAP xml web services, and
includes a cryptographic client authentication mechanism which ensures the validity of each client-server call.
A Simple Coding Example - Using The Stibium JNDI Service Provider
The example below shows how to create and initialise a JNDI InitialDirContext using the Stibium JNDI service provider.
Note that the value of STIBIUM_LOC should be set to the network address of the Stibium server.
/**
* A: This example creates and initialises a Root Stibium DirContext.
*
* @throws NamingException
*/
public void exampleA() throws NamingException
{
// Create properties and specify the context factory.
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"RCRT.Stibium.naming.StibiumInitialContextFactory");
props.put(Context.PROVIDER_URL, STIBIUM_LOC);
DirContext iniContext = new InitialDirContext(props);
// Add the server location, account id and password to the initial context's environment.
iniContext.addToEnvironment(StibiumDirContext.STIBIUM_LOGIN_ID, "andrewg");
iniContext.addToEnvironment(StibiumDirContext.STIBIUM_PASSWORD, "secret_squirrel");
return;
} // exampleA
The JNDI Context Interface
The javax.naming.Context interface represents a naming context, which lies at the heart of how JNDI clients interact
with naming systems and services. This interface which is analogous to a directory in a conventional computer file system,
and includes methods for examining and updating its contents. The most important Context methods enable the following:
-
Name/Value pair entries to be added to, or removed from, a context's environment or the contents of an environment to be listed.
-
Contexts to be created and destroyed.
-
Named items to be bound, unbound or rebound to/from a given context.
-
Enumerations to be returned that contain the names, types and values of a context's contents.
-
A named binding to be accessed (which may be a bound value or a nested subcontext).
The JNDI DirContext Interface
The javax.naming.directory.DirContext interface extends the Context interface to provide additional functionality for
the storage and use of attributes. This includes storing attributes in association with contexts and bindings,
recovering and manipulating them, and searching for entries using them. The most important DirContext methods enable
the following:
-
Named attributes to be stored with contexts and/or bindings.
-
Client-defined or operational attributes to be accessed from contexts or bindings.
-
Attributes to be modified and deleted.
-
Searches to be undertaken for contexts and/or bindings that match attribute-related search criteria.