Provides the JNDI Environment & Service Naming Contexts


Class Summary
MemoryBinding Name/value bindings for use inside MemoryContext.
MemoryContext An in-memory JNDI service provider.
MemoryContextFactory Implements a context factory for MemoryContext.
MemoryContextTest Simple calss to show the MemoryContext usage mode.

Package Description

Provides the JNDI Environment & Service Naming Contexts

This package was inspired by the tyrex.naming package from the Tyrex project. All credits for the good stuff should go to Assaf Arkin and the Exolab group, all the bad stuff blame it on me :).

An in-memory namespace is available through the MemoryContext JNDI service provider. The in-memory namespace holds objects directly in memory including factories and services that cannot be held in a persistent namespace. It supports two modes of operation, a tree shared between all instances through a shared namespace, and trees created dynamically with access controlled by their creator. See In-Memory Context for more details.

The in-memory JNDI service provider has the following properties:

The caller must had adequate security permission to access the shared in-memory namespace (creating a private namespace requires no permission) and to set/unset the ENC for the current thread, see Access Permissions for more details.

In-Memory Context

MemoryContext is an in-memory JNDI service provider. It binds objects into a namespace held entirely in memory, supporting serializable, remoteable and local objects. The in-memory service provider is particularly useful for holding resource factories (the JNDI ENC) and exposing run-time services and configuration objects.

An instance of MemoryContext constructed with no environment attribute will use it's own tree of bindings. Such a tree is no accessible except through context created from the original context, and is garbage collected when all such contexts are no longer referenced. If necessary the root context can be duplicated using lookup( "" ).

If the environment attribute PROVIDER_URL is used, the context will reference a node in a tree shared by all such contexts. That tree is statically held in memory for the life time of the virtual machine.

MemoryContextFactory implements a context factory for MemoryContext. When set properly InitialContext will return a MemoryContext referencing the named path in the memory model. Typically applications will use it to construct an in-memory namespace under the shared root, e.g.:

MemoryContextFactory factory;
Hashtable            env;

// Set up the path
env = new Hashtable();
env.put( Context.PROVIDER_URL, "services" );
// Obtain the context for services
factory = new MemoryContextFactory();
ctx = factory.getInitialContext( env );

// Alternatively, construct MemoryContext directly

env = new Hashtable();
env.put( Context.PROVIDER_URL, "services" );
ctx = new MemoryContext( env );

$Revision: 1.3 $ $Date: 2002/10/18 22:14:17 $
Remus Pereni

"Copyright 2000-2002 Internet Multicasting Services, & noLimits Technologies. All Rights Reserved."