tyrex.naming

Class MemoryContext

public class MemoryContext extends Object implements Context

An in-memory JNDI service provider. 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 namespace and serve as the root of that namespace. Such a namespace is no accessible except through the creating 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 Context.PROVIDER_URL is set, the context will reference a node in a namespace shared by all such contexts. That tree is statically held in memory for the life time of the virtual machine.

Version: $Revision: 1.10 $ $Date: 2001/03/19 17:39:00 $

Author: Assaf Arkin

See Also: MemoryContextFactory

Field Summary
static NameParserDefaultNameParser
The default name parser for this context.
static StringNameSeparator
The default name separator for this context is '/'.
static StringReadOnly
Environment attribute to set a context read-only.
Constructor Summary
MemoryContext(Hashtable env)
Construct a new context with the specified environment attributes.
MemoryContext(MemoryBinding bindings, Hashtable env)
Construct a new context with the specified bindings and environment attributes.
Method Summary
ObjectaddToEnvironment(String name, Object value)
voidbind(String name, Object value)
voidbind(Name name, Object value)
voidclose()
NamecomposeName(Name name, Name prefix)
StringcomposeName(String name, String prefix)
ContextcreateSubcontext(String name)
ContextcreateSubcontext(Name name)
voiddebug(PrintWriter writer)
voiddestroySubcontext(String name)
voiddestroySubcontext(Name name)
MemoryBindinggetBindings()
Returns the bindings represented by this context.
HashtablegetEnvironment()
StringgetNameInNamespace()
NameParsergetNameParser(String name)
NameParsergetNameParser(Name name)
NamingEnumerationlist(String name)
NamingEnumerationlist(Name name)
NamingEnumerationlistBindings(String name)
NamingEnumerationlistBindings(Name name)
Objectlookup(String name)
Objectlookup(Name name)
ObjectlookupLink(String name)
ObjectlookupLink(Name name)
voidrebind(String name, Object value)
voidrebind(Name name, Object value)
ObjectremoveFromEnvironment(String name)
voidrename(String oldName, String newName)
voidrename(Name oldName, Name newName)
StringtoString()
voidunbind(String name)
voidunbind(Name name)

Field Detail

DefaultNameParser

public static final NameParser DefaultNameParser
The default name parser for this context.

NameSeparator

public static final String NameSeparator
The default name separator for this context is '/'.

ReadOnly

public static final String ReadOnly
Environment attribute to set a context read-only. The value must be a string equal to true. Once the context has been set read-only, it cannot be reset to read-write.

Constructor Detail

MemoryContext

public MemoryContext(Hashtable env)
Construct a new context with the specified environment attributes. The environment property Context.PROVIDER_URL names the underlying bindings. If the property is absent, the returned context has it's own binding space which is not shared with other contexts created in this manner.

Parameters: env The environment attributes

Throws: NotContextException The attribute Context.PROVIDER_URL does not specify a context InvalidNameException The attribute Context.PROVIDER_URL is an invalid name

MemoryContext

MemoryContext(MemoryBinding bindings, Hashtable env)
Construct a new context with the specified bindings and environment attributes.

Method Detail

addToEnvironment

public Object addToEnvironment(String name, Object value)

bind

public void bind(String name, Object value)

bind

public void bind(Name name, Object value)

close

public void close()

composeName

public Name composeName(Name name, Name prefix)

composeName

public String composeName(String name, String prefix)

createSubcontext

public Context createSubcontext(String name)

createSubcontext

public Context createSubcontext(Name name)

debug

void debug(PrintWriter writer)

destroySubcontext

public void destroySubcontext(String name)

destroySubcontext

public void destroySubcontext(Name name)

getBindings

public MemoryBinding getBindings()
Returns the bindings represented by this context. Used when assigning a memory context into the ENC.

getEnvironment

public Hashtable getEnvironment()

getNameInNamespace

public String getNameInNamespace()

getNameParser

public NameParser getNameParser(String name)

getNameParser

public NameParser getNameParser(Name name)

list

public NamingEnumeration list(String name)

list

public NamingEnumeration list(Name name)

listBindings

public NamingEnumeration listBindings(String name)

listBindings

public NamingEnumeration listBindings(Name name)

lookup

public Object lookup(String name)

lookup

public Object lookup(Name name)

lookupLink

public Object lookupLink(String name)

lookupLink

public Object lookupLink(Name name)

rebind

public void rebind(String name, Object value)

rebind

public void rebind(Name name, Object value)

removeFromEnvironment

public Object removeFromEnvironment(String name)

rename

public void rename(String oldName, String newName)

rename

public void rename(Name oldName, Name newName)

toString

public String toString()

unbind

public void unbind(String name)

unbind

public void unbind(Name name)
Original code is Copyright (c) 1999-2001, Intalio, Inc. All Rights Reserved. Contributions by MetaBoss team are Copyright (c) 2003-2005, Softaris Pty. Ltd. All Rights Reserved.