extensions.gem
Class ContextBean

java.lang.Object
  |
  +--extensions.gem.ContextBean

public class ContextBean
extends java.lang.Object

Program: ContextBean.java Comments: Implements WebFlowContext-style hashtable trees.


Constructor Summary
ContextBean()
           
 
Method Summary
 void addChildContext(java.lang.String childName)
          Add a child context
 boolean createNewContext(java.lang.String descDir, java.lang.String Name, java.lang.String parent)
          Create a new context.
 boolean deleteChildDir(java.lang.String childDir)
          This method deletes all files and subdirectories and finally the directory itself.
 ContextBean getChild(java.lang.String childName)
           
 java.util.Hashtable getChildren()
          Returns the child contexts.
 ContextBean getContext()
           
 java.util.Hashtable getContextHash()
           
 java.lang.String getContextValue(java.lang.String name)
          General methods for getting and setting some context value.
 java.lang.String getName()
          Simple accessor for context name.
 void init(java.lang.String name, java.lang.String descDir)
          For the given descriptor directory, restore recursively the existing contexts.
 boolean removeChildContext(java.lang.String childName)
          Remove a child context.
 void restoreChildContext(java.lang.String childName)
           
 void restoreContext(java.lang.String descDir)
          Restores the context from the specified directory.
 void setContextValue(java.lang.String name, java.lang.String value)
           
 boolean writeContextToFile(java.util.Hashtable ht, java.lang.String descDir)
          Writes the context hash to the specified directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextBean

public ContextBean()
Method Detail

init

public void init(java.lang.String name,
                 java.lang.String descDir)
For the given descriptor directory, restore recursively the existing contexts.

createNewContext

public boolean createNewContext(java.lang.String descDir,
                                java.lang.String Name,
                                java.lang.String parent)
Create a new context.

getContextValue

public java.lang.String getContextValue(java.lang.String name)
General methods for getting and setting some context value. Use add/removeChildContext to manage children.

setContextValue

public void setContextValue(java.lang.String name,
                            java.lang.String value)

getContext

public ContextBean getContext()

addChildContext

public void addChildContext(java.lang.String childName)
Add a child context

removeChildContext

public boolean removeChildContext(java.lang.String childName)
Remove a child context. Note that we keep a running hashtable of the child names in the Hashtable children.

deleteChildDir

public boolean deleteChildDir(java.lang.String childDir)
This method deletes all files and subdirectories and finally the directory itself. Note that applying File.delete() to a directory only works if the directory is empty.

writeContextToFile

public boolean writeContextToFile(java.util.Hashtable ht,
                                  java.lang.String descDir)
Writes the context hash to the specified directory.

restoreContext

public void restoreContext(java.lang.String descDir)
Restores the context from the specified directory. Recursively adds all children.

restoreChildContext

public void restoreChildContext(java.lang.String childName)

getContextHash

public java.util.Hashtable getContextHash()

getChildren

public java.util.Hashtable getChildren()
Returns the child contexts.

getChild

public ContextBean getChild(java.lang.String childName)

getName

public java.lang.String getName()
Simple accessor for context name.