[Yanel-commits] rev 22799 -
public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources
michi at wyona.com
michi at wyona.com
Tue Feb 20 10:08:43 CET 2007
Author: michi
Date: 2007-02-20 10:08:41 +0100 (Tue, 20 Feb 2007)
New Revision: 22799
Modified:
public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
Log:
check if node exists and possibly create it
Modified: public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
===================================================================
--- public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java 2007-02-19 22:15:41 UTC (rev 22798)
+++ public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java 2007-02-20 09:08:41 UTC (rev 22799)
@@ -441,6 +441,11 @@
try {
// TODO: XHTML template should not be hardcoded!
Repository repo = getRealm().getRepository();
+ if (!repo.existsNode(getPath())) {
+ // TODO: create node recursively ...
+ repo.getRootNode().addNode(new org.wyona.commons.io.Path(getPath().toString()).getName(), org.wyona.yarep.core.NodeType.RESOURCE);
+ log.warn("Node has been created: " + getPath());
+ }
Writer writer = new java.io.OutputStreamWriter(repo.getNode(getPath()).getOutputStream());
writer.write("<?xml version=\"1.0\"?>");
writer.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
@@ -460,6 +465,11 @@
int lastIndex = name.lastIndexOf(".");
if (lastIndex > 0) nameWithoutSuffix = name.substring(0, lastIndex);
String introspectionPath = parent + "/introspection-" + nameWithoutSuffix + ".xml";
+ if (!repo.existsNode(introspectionPath)) {
+ // TODO: create node recursively ...
+ repo.getRootNode().addNode(new org.wyona.commons.io.Path(introspectionPath).getName(), org.wyona.yarep.core.NodeType.RESOURCE);
+ log.warn("Introspection node has been created: " + introspectionPath);
+ }
writer = new java.io.OutputStreamWriter(repo.getNode(introspectionPath).getOutputStream());
writer.write(getIntrospection(name));
writer.close();
More information about the Yanel-commits
mailing list