[Yanel-commits] rev 24521 - public/yanel/trunk/src/contributions/resources/atom-entry/src/java/org/wyona/yanel/impl/resources

michi at wyona.com michi at wyona.com
Wed May 16 10:58:09 CEST 2007


Author: michi
Date: 2007-05-16 10:58:07 +0200 (Wed, 16 May 2007)
New Revision: 24521

Modified:
   public/yanel/trunk/src/contributions/resources/atom-entry/src/java/org/wyona/yanel/impl/resources/AtomEntryResource.java
Log:
node creation resp. writing fixed

Modified: public/yanel/trunk/src/contributions/resources/atom-entry/src/java/org/wyona/yanel/impl/resources/AtomEntryResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/atom-entry/src/java/org/wyona/yanel/impl/resources/AtomEntryResource.java	2007-05-16 08:57:45 UTC (rev 24520)
+++ public/yanel/trunk/src/contributions/resources/atom-entry/src/java/org/wyona/yanel/impl/resources/AtomEntryResource.java	2007-05-16 08:58:07 UTC (rev 24521)
@@ -29,8 +29,6 @@
 import org.wyona.yarep.core.RepositoryFactory;
 import org.wyona.yarep.util.RepoPath;
 
-import javax.servlet.http.HttpServletRequest;
-
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.sax.SAXSource;
@@ -190,7 +188,13 @@
             entry.setPublished(date);
         }
 
-        OutputStream out = getRealm().getRepository().getOutputStream(new org.wyona.yarep.core.Path(getPath()));
+        Repository repo = getRealm().getRepository();
+        org.wyona.commons.io.Path atomEntryPath = new org.wyona.commons.io.Path(getPath());
+        if (!repo.existsNode(getPath())) {
+            // TODO: Create node recursively in case parent does not exist!
+            repo.getNode(atomEntryPath.getParent().toString()).addNode(atomEntryPath.getName(), org.wyona.yarep.core.NodeType.RESOURCE);
+        }
+        OutputStream out = repo.getOutputStream(new org.wyona.yarep.core.Path(getPath()));
 
         org.apache.abdera.writer.Writer writer = abdera.getWriter();
         writer.writeTo(entry, out);




More information about the Yanel-commits mailing list