|
|||||||||
| Home >> All >> org >> media >> [ naming overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.media.naming
Class MemoryContext

java.lang.Objectorg.media.naming.MemoryContext
- All Implemented Interfaces:
- javax.naming.Context
- public class MemoryContext
- extends java.lang.Object
- implements javax.naming.Context
- extends java.lang.Object
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>Context.PROVIDER_URL 55 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.
This class 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 :).
- Version:
- $Revision: 1.2 $ $Date: 2001/06/04 10:23:21 $
| Field Summary | |
private MemoryBinding |
_bindings
Holds the bindings associated with this context. |
private java.util.Hashtable |
_env
The environment attributes used to construct this context. |
private boolean |
_readOnly
True if this context has been set read-only. |
static javax.naming.NameParser |
DefaultNameParser
The default name parser for this context. |
static java.lang.String |
NameSeparator
The default name separator for this context is '/'. |
static java.lang.String |
ReadOnly
Environment attribute to set a context read-only. |
| Fields inherited from interface javax.naming.Context |
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES |
| Constructor Summary | |
|
MemoryContext(java.util.Hashtable env)
Construct a new context with the specified environment attributes. |
(package private) |
MemoryContext(MemoryBinding bindings,
java.util.Hashtable env)
Construct a new context with the specified bindings and environment attributes. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
ReadOnly
public static final java.lang.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.
- See Also:
- Constant Field Values
NameSeparator
public static final java.lang.String NameSeparator
- The default name separator for this context is '/'.
- See Also:
- Constant Field Values
DefaultNameParser
public static final javax.naming.NameParser DefaultNameParser
- The default name parser for this context.
_bindings
private final MemoryBinding _bindings
- Holds the bindings associated with this context. Multiple
contexts may share the same binding. The binding is selected
based on the Context.PROVIDER_URL>
Context.PROVIDER_URL55 attribute. The context's name in the name space is know to the bindings.
_env
private final java.util.Hashtable _env
- The environment attributes used to construct this context.
Will be passed on to all contexts constructed by this context.
_readOnly
private boolean _readOnly
- True if this context has been set read-only. Once it has
been set read-only, it cannot revert to writable and all
contexts returns by this context are read-only.
| Constructor Detail |
MemoryContext
public MemoryContext(java.util.Hashtable env) throws javax.naming.NamingException
- Construct a new context with the specified environment
attributes. The environment property Context.PROVIDER_URL>
Context.PROVIDER_URL55 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.
MemoryContext
MemoryContext(MemoryBinding bindings, java.util.Hashtable env)
- Construct a new context with the specified bindings and
environment attributes.
| Method Detail |
lookup
public java.lang.Object lookup(java.lang.String name) throws javax.naming.NamingException
- Specified by:
lookupin interfacejavax.naming.Context
lookup
public java.lang.Object lookup(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
lookupin interfacejavax.naming.Context
lookupLink
public java.lang.Object lookupLink(java.lang.String name) throws javax.naming.NamingException
- Specified by:
lookupLinkin interfacejavax.naming.Context
lookupLink
public java.lang.Object lookupLink(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
lookupLinkin interfacejavax.naming.Context
internalLookup
private java.lang.Object internalLookup(javax.naming.Name name, boolean resolveLinkRef) throws javax.naming.NamingException
bind
public void bind(java.lang.String name, java.lang.Object value) throws javax.naming.NamingException
- Specified by:
bindin interfacejavax.naming.Context
bind
public void bind(javax.naming.Name name, java.lang.Object value) throws javax.naming.NamingException
- Specified by:
bindin interfacejavax.naming.Context
rebind
public void rebind(java.lang.String name, java.lang.Object value) throws javax.naming.NamingException
- Specified by:
rebindin interfacejavax.naming.Context
rebind
public void rebind(javax.naming.Name name, java.lang.Object value) throws javax.naming.NamingException
- Specified by:
rebindin interfacejavax.naming.Context
unbind
public void unbind(java.lang.String name) throws javax.naming.NamingException
- Specified by:
unbindin interfacejavax.naming.Context
unbind
public void unbind(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
unbindin interfacejavax.naming.Context
rename
public void rename(java.lang.String oldName, java.lang.String newName) throws javax.naming.NamingException
- Specified by:
renamein interfacejavax.naming.Context
rename
public void rename(javax.naming.Name oldName, javax.naming.Name newName) throws javax.naming.NamingException
- Specified by:
renamein interfacejavax.naming.Context
list
public javax.naming.NamingEnumeration list(java.lang.String name) throws javax.naming.NamingException
- Specified by:
listin interfacejavax.naming.Context
list
public javax.naming.NamingEnumeration list(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
listin interfacejavax.naming.Context
listBindings
public javax.naming.NamingEnumeration listBindings(java.lang.String name) throws javax.naming.NamingException
- Specified by:
listBindingsin interfacejavax.naming.Context
listBindings
public javax.naming.NamingEnumeration listBindings(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
listBindingsin interfacejavax.naming.Context
createSubcontext
public javax.naming.Context createSubcontext(java.lang.String name) throws javax.naming.NamingException
- Specified by:
createSubcontextin interfacejavax.naming.Context
createSubcontext
public javax.naming.Context createSubcontext(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
createSubcontextin interfacejavax.naming.Context
destroySubcontext
public void destroySubcontext(java.lang.String name) throws javax.naming.NamingException
- Specified by:
destroySubcontextin interfacejavax.naming.Context
destroySubcontext
public void destroySubcontext(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
destroySubcontextin interfacejavax.naming.Context
getNameParser
public javax.naming.NameParser getNameParser(java.lang.String name) throws javax.naming.NamingException
- Specified by:
getNameParserin interfacejavax.naming.Context
getNameParser
public javax.naming.NameParser getNameParser(javax.naming.Name name) throws javax.naming.NamingException
- Specified by:
getNameParserin interfacejavax.naming.Context
composeName
public javax.naming.Name composeName(javax.naming.Name name, javax.naming.Name prefix) throws javax.naming.NamingException
- Specified by:
composeNamein interfacejavax.naming.Context
composeName
public java.lang.String composeName(java.lang.String name, java.lang.String prefix)
- Specified by:
composeNamein interfacejavax.naming.Context
getNameInNamespace
public java.lang.String getNameInNamespace() throws javax.naming.NamingException
- Specified by:
getNameInNamespacein interfacejavax.naming.Context
addToEnvironment
public java.lang.Object addToEnvironment(java.lang.String name, java.lang.Object value) throws javax.naming.NamingException
- Specified by:
addToEnvironmentin interfacejavax.naming.Context
getEnvironment
public java.util.Hashtable getEnvironment()
- Specified by:
getEnvironmentin interfacejavax.naming.Context
removeFromEnvironment
public java.lang.Object removeFromEnvironment(java.lang.String name)
- Specified by:
removeFromEnvironmentin interfacejavax.naming.Context
close
public void close()
- Specified by:
closein interfacejavax.naming.Context
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
getBindings
public MemoryBinding getBindings()
- Returns the bindings represented by this context.
Used when assigning a memory context into the ENC.
debug
void debug(java.io.PrintWriter writer)
|
|||||||||
| Home >> All >> org >> media >> [ naming overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.media.naming.MemoryContext