|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netscape.jndi.ldap.common.ShareableEnv
public class ShareableEnv
ShareableEnv manages a set of environment properties. The class enables a memory
efficient sharing of the environment between multiple contexts, while preserving
the semantics that each context has its own environment. If the environment for a
context is changed, the change is not visible to other contexts.
The efficiency is achieved by implementing inheritance and override of environment
properties ("subclass-on-write"). A read-only table of properties
is shared among multiple contexts (_sharedEnv. If a context wants to
modified a shared property, it will create a separate table (_privateEnv)
to make the modifications. This table overrides the values in the shared table.
Note1: The class is not thread safe, it requires external synchronization
Note2: The class does not provide enumaration. Call getAllProperties() and then
use the standard Hashtable enumaration techniques.
| Field Summary | |
|---|---|
protected ShareableEnv |
m_parentEnv
Shared environment inherited from the parent context |
protected int |
m_parentSharedEnvIdx
Index into parent _sharedEnv list. |
protected java.util.Hashtable |
m_privateEnv
A table of most recent environment modifications. |
protected java.util.Vector |
m_sharedEnv
A set of environment propeties that have been changed in this Context and are shared with one or more child contexts. |
| Constructor Summary | |
|---|---|
ShareableEnv(java.util.Hashtable initialEnv)
Constructor for the root context |
|
ShareableEnv(ShareableEnv parent,
int parentSharedEnvIdx)
Constructor for non root Contexts |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clone ShareableEnv |
protected void |
freezeUpdates()
Freeze all environment changes changes in the current context. |
java.util.Hashtable |
getAllProperties()
Create a table of all properties. |
java.lang.Object |
getProperty(java.lang.String prop)
Get the property value. |
static void |
main(java.lang.String[] args)
Test program |
java.lang.Object |
removeProperty(java.lang.String prop)
Remove property |
java.lang.Object |
setProperty(java.lang.String prop,
java.lang.Object val)
Set the property value. |
java.lang.String |
toString()
Return string representation of the object |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Hashtable m_privateEnv
protected java.util.Vector m_sharedEnv
protected ShareableEnv m_parentEnv
protected int m_parentSharedEnvIdx
| Constructor Detail |
|---|
public ShareableEnv(ShareableEnv parent,
int parentSharedEnvIdx)
parent - A reference to the parent context environmentparentSharedEnvIdx - index into parent's shared environemnt listpublic ShareableEnv(java.util.Hashtable initialEnv)
initialEnv - a hashtable with environemnt properties| Method Detail |
|---|
public java.lang.Object setProperty(java.lang.String prop,
java.lang.Object val)
prop - property nameval - property value
null if it did not exist before.public java.lang.Object getProperty(java.lang.String prop)
prop - property name
null if property is not foundpublic java.lang.Object removeProperty(java.lang.String prop)
prop - property name
null if it did not exist before.public java.util.Hashtable getAllProperties()
protected void freezeUpdates()
public java.lang.Object clone()
clone in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||