Implement rootPrototype app property that allows to force-set the root object prototype.

This commit is contained in:
hns 2005-05-12 16:16:39 +00:00
parent 95dd5feb63
commit 70eb0c5e5d

View file

@ -755,9 +755,14 @@ public final class Application implements IPathElement, Runnable {
// no custom root object is defined - use standard helma objectmodel // no custom root object is defined - use standard helma objectmodel
else { else {
String rootId = props.getProperty("rootid", "0"); String rootId = props.getProperty("rootid", "0");
rootObject = nmgr.safe.getNode(rootId, rootMapping); Node rootNode = nmgr.safe.getNode(rootId, rootMapping);
// set the root node's prototype, if requested by rootPrototype property
return rootObject; String rootProto = props.getProperty("rootprototype");
if (rootProto != null && !rootProto.equals(rootNode.getPrototype())) {
rootNode.setPrototype(rootProto);
rootNode.setDbMapping(getDbMapping(rootProto));
}
return rootNode;
} }
} }