|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.dynamide.DynamideObject
com.dynamide.resource.ContextNode
public class ContextNode
| Field Summary |
|---|
| Fields inherited from class com.dynamide.DynamideObject |
|---|
m_id |
| Constructor Summary | |
|---|---|
ContextNode(DynamideObject owner)
|
|
ContextNode(DynamideObject owner,
java.lang.String key)
|
|
ContextNode(java.lang.String key)
|
|
| Method Summary | |
|---|---|
IContext |
bind(IContext context)
Binds an IContext node by the name in node.getKey(). |
IContext |
bind(java.lang.String key,
IContext context)
Accepts Object and IContext items. |
void |
bindAll(java.util.Map children)
Add children en masse. |
void |
bindAllAttributes(java.util.Map attributes)
Set the attributes en masse. |
void |
bindAttribute(java.lang.String attributeName,
java.lang.Object value)
|
java.lang.String |
dump()
Subclasses can override this with something more descriptive, for logging and debugging. |
java.lang.String |
dumpAttributes(boolean html)
|
java.lang.String |
dumpContext(boolean html)
|
java.lang.Object |
find(java.lang.String path)
Search using "/" as the separator, by simply calling find(path, "/"). |
java.lang.Object |
find(java.lang.String[] path)
Find an object, based on a path that is an array of strings, one for each context, starting from "this" object, For example, if you already have a handle to the root WebApps context, called "webapps" here: webapps.find({"/dynamide/demo"}); Or, String[] path = {"/dynamide/demo"}; webapps.find(path); To search from the root, use ResourceManager.find(String[]), which it gets from ContextNode. |
java.lang.Object |
find(java.lang.String path,
java.lang.String separator)
Find an object based on the path from the current context, using "separator" as the path element separator. |
IContext |
firstContext()
simply return the first context in list of contexts, or null if list is empty. |
java.lang.Object |
get(java.lang.String what)
Subclasses can override this. |
java.lang.Object |
getAttribute(java.lang.String attributeName)
|
int |
getAttributeCount()
You can use this method to return zero if you have not yet instantiated a collection of attributes. |
java.util.Map |
getAttributes()
You must not return null if the attributes are empty, but rather always return an empty Map. |
IContext |
getContext(java.lang.String key)
You either use the concrete com.dynamide.resource.ContextNode as a node in the context tree, or you implement this IContext interface. |
int |
getContextCount()
|
java.util.Map |
getContexts()
You must not return null if the contexts collection is empty, but rather always return an empty Map. |
java.lang.String |
getKey()
|
java.security.Permission |
getPermission(java.lang.String permissionName)
|
boolean |
hasAttribute(java.lang.String key)
|
boolean |
hasContext(java.lang.String key)
|
StringList |
listAttributeNames(IContext context,
boolean sort)
|
java.lang.String |
listAttributeNames(IContext context,
boolean sort,
java.lang.String lineBreak)
|
StringList |
listContextNames(IContext context,
boolean sort)
|
java.lang.String |
listContextNames(IContext context,
boolean sort,
java.lang.String lineBreak)
|
void |
lockPermissions(java.security.Permissions permissions)
Once permissions are set using lockPermissions, impls should not allow them to be changed. |
IContext |
rebind(IContext context)
Binds an IContext node by the name in context.getKey(). |
IContext |
rebind(java.lang.String key,
IContext context)
Accepts Object and IContext items. |
void |
rebindAttribute(java.lang.String attributeName,
java.lang.Object value)
|
IContext |
remove(java.lang.String key)
|
java.lang.Object |
removeAttribute(java.lang.String key)
|
IContext |
removeFirstContext()
simply return the first context in list of contexts, and remove it, or null if list is empty. |
void |
setKey(java.lang.String key)
|
java.lang.String |
toString()
|
void |
unlockPermissions(java.security.Permissions permissions)
|
void |
update()
(Optional) Implementations should re-read resources and lists of resources, e.g. files from disk. |
void |
writeCache(java.lang.String prefix,
java.io.File rootDirectory)
|
| Methods inherited from class com.dynamide.DynamideObject |
|---|
clearProfiler, dump, dumpHTML, expand, finalize, findParentExpander, findParentPage, findParentSession, findTopParentPage, getCategoryID, getDotName, getID, getNextGetter, getObjectID, getOwner, getProfiler, isDebugEnabled, isInfoEnabled, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logWarn, logWarn, logWarn, logWarn, popLogContext, printf, printProfiler, profileEnter, profileLeave, pushLogContext, setDotName, setID, setNextGetter, setObjectID, setOwner, sprintf, useProfiler, walkParents |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ContextNode(DynamideObject owner)
public ContextNode(DynamideObject owner,
java.lang.String key)
public ContextNode(java.lang.String key)
| Method Detail |
|---|
public java.lang.String getKey()
getKey in interface IContextpublic void setKey(java.lang.String key)
setKey in interface IContext
public void lockPermissions(java.security.Permissions permissions)
throws java.lang.SecurityException
lockPermissions in interface IContextjava.lang.SecurityException
public void unlockPermissions(java.security.Permissions permissions)
throws java.lang.SecurityException
unlockPermissions in interface IContextjava.lang.SecurityExceptionpublic java.security.Permission getPermission(java.lang.String permissionName)
getPermission in interface IContext
public java.lang.Object get(java.lang.String what)
throws java.lang.Exception
DynamideObject
get in interface IGetget in class DynamideObjectjava.lang.Exceptionpublic java.lang.Object getAttribute(java.lang.String attributeName)
getAttribute in interface IContextpublic boolean hasAttribute(java.lang.String key)
hasAttribute in interface IContextpublic int getAttributeCount()
IContext
getAttributeCount in interface IContextpublic java.util.Map getAttributes()
IContext
getAttributes in interface IContext
public void bindAttribute(java.lang.String attributeName,
java.lang.Object value)
throws java.lang.SecurityException,
ObjectAlreadyBoundException
bindAttribute in interface IContextjava.lang.SecurityException
ObjectAlreadyBoundException
public void rebindAttribute(java.lang.String attributeName,
java.lang.Object value)
throws java.lang.SecurityException
rebindAttribute in interface IContextjava.lang.SecurityException
public void bindAllAttributes(java.util.Map attributes)
throws java.lang.SecurityException,
ObjectAlreadyBoundException
bindAllAttributes in interface IContextjava.lang.SecurityException
ObjectAlreadyBoundExceptionpublic IContext firstContext()
IContext
firstContext in interface IContextpublic IContext removeFirstContext()
IContext
removeFirstContext in interface IContextpublic IContext getContext(java.lang.String key)
IContextYou either use the concrete com.dynamide.resource.ContextNode as a node in the context tree, or you implement this IContext interface. Then for getResource, return the "this" pointer to your implementation object. Optionally, you can perform some other operation to get the actual resource, in which case your concrete class is a proxy, lazy-loader, etc.
All implementations should check for the special cases: "." means "this context", as does the empty string, "". For both, return the current context, which in most implementations means:
public IContext getContext(String key){
if ( key.equals(".") || key.length() == 0 ) {
return this;
}
...
}
getContext in interface IContextpublic boolean hasContext(java.lang.String key)
hasContext in interface IContextpublic int getContextCount()
getContextCount in interface IContextpublic java.util.Map getContexts()
IContext
getContexts in interface IContext
public void bindAll(java.util.Map children)
throws java.lang.SecurityException,
ObjectAlreadyBoundException
bindAll in interface IContextjava.lang.SecurityException
ObjectAlreadyBoundException
public IContext bind(java.lang.String key,
IContext context)
throws java.lang.SecurityException,
ObjectAlreadyBoundException
bind in interface IContextjava.lang.SecurityException
ObjectAlreadyBoundException
public IContext bind(IContext context)
throws java.lang.SecurityException,
ObjectAlreadyBoundException
IContext
IContext root = new ContextNode(null, "root");
root.bind(new ContextNode(null, "child1")).bind(new ContextNode(null, "child2"));
bind in interface IContextjava.lang.SecurityException
ObjectAlreadyBoundExceptionIContext.bind(String,IContext)
public IContext rebind(java.lang.String key,
IContext context)
throws java.lang.SecurityException
rebind in interface IContextjava.lang.SecurityExceptionIContext.bind(String,IContext)
public IContext rebind(IContext context)
throws java.lang.SecurityException
IContext
rebind in interface IContextjava.lang.SecurityExceptionIContext.rebind(String,IContext)
public IContext remove(java.lang.String key)
throws java.lang.SecurityException
remove in interface IContextjava.lang.SecurityException
public java.lang.Object removeAttribute(java.lang.String key)
throws java.lang.SecurityException
removeAttribute in interface IContextjava.lang.SecurityExceptionpublic java.lang.Object find(java.lang.String[] path)
IContextFind an object, based on a path that is an array of strings, one for each context, starting from "this" object,
For example, if you already have a handle to the root WebApps context, called "webapps" here:
webapps.find({"/dynamide/demo"});
Or,
String[] path = {"/dynamide/demo"};
webapps.find(path);
To search from the root, use ResourceManager.find(String[]), which it gets from ContextNode.
String [] path= {"web-apps", "/dynamide/demo"};
Object o = ResourceManager.find(path)
Same rules as getContext(), which include: if the path is "" or ".', return a pointer to "this".
find in interface IContextpath - construct an array of strings, one for each context, starting from this object,
for example: find({"web-apps", "/dynamide/demo"});
then, to search from the root, use ResourceManager.find(String[]).
IContext.find(String,String),
find(String [] path),
IContext.getContext(String)public java.lang.Object find(java.lang.String path)
find in interface IContext
public java.lang.Object find(java.lang.String path,
java.lang.String separator)
IContextFind an object based on the path from the current context, using "separator" as the path element separator. Take care that separator does not appear in element names. If you cannot ensure this, use find(String[] path) instead.
Same rules as getContext(String), which include: if the path is "" or ".', return a pointer to "this".
find in interface IContextIContext.find(String [] path),
find(String [] path),
IContext.getContext(String)public void update()
IContext
update in interface IContextpublic java.lang.String dump()
DynamideObject
dump in class DynamideObjectpublic java.lang.String dumpContext(boolean html)
dumpContext in interface IContext
public void writeCache(java.lang.String prefix,
java.io.File rootDirectory)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String toString()
toString in class java.lang.Object
public java.lang.String listContextNames(IContext context,
boolean sort,
java.lang.String lineBreak)
public StringList listContextNames(IContext context,
boolean sort)
public java.lang.String listAttributeNames(IContext context,
boolean sort,
java.lang.String lineBreak)
public StringList listAttributeNames(IContext context,
boolean sort)
public java.lang.String dumpAttributes(boolean html)
dumpAttributes in interface IContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||