[Yanel-commits] rev 37266 - public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources

michi at wyona.com michi at wyona.com
Fri Jun 27 15:56:03 CEST 2008


Author: michi
Date: 2008-06-27 15:56:03 +0200 (Fri, 27 Jun 2008)
New Revision: 37266

Modified:
   public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java
Log:
use sitetree of realm

Modified: public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java	2008-06-27 13:54:42 UTC (rev 37265)
+++ public/yanel/trunk/src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/ResourceCreatorResource.java	2008-06-27 13:56:03 UTC (rev 37266)
@@ -629,9 +629,13 @@
         return resName;
     }
 
+    /**
+     * Return sitetree
+     */
     private StringBuffer getLookUp() {
         StringBuffer sb = new StringBuffer("");
-        Sitetree sitetree = (Sitetree) getYanel().getBeanFactory().getBean("repo-navigation");
+        //Sitetree sitetree = (Sitetree) getYanel().getBeanFactory().getBean("repo-navigation");
+        Sitetree sitetree = getRealm().getRepoNavigation();
         Node node = null;
         String lookinPath = getRequest().getParameter("lookin");
         if (lookinPath != null) {
@@ -639,14 +643,21 @@
         } else {
             node = sitetree.getNode(getRealm(), getPath());
         }
-        if (node.isCollection()) {
-            if(log.isDebugEnabled()) log.debug("Is Collection: " + node.getName());
-        } else if (node.isResource()) {
-            if (log.isDebugEnabled()) log.debug("Is Resource: " + node.getName());
-            node = node.getParent();
+
+        if (node != null) {
+            if (node.isCollection()) {
+                if(log.isDebugEnabled()) log.debug("Is Collection: " + node.getName());
+            } else if (node.isResource()) {
+                if (log.isDebugEnabled()) log.debug("Is Resource: " + node.getName());
+                node = node.getParent();
+            } else {
+                log.error("Neither collection nor resource: " + getPath());
+            }
         } else {
-            log.error("Neither collection nor resource: " + getPath());
+            log.error("No such path '" + getPath() + "' within sitetree! Root node will be used.");
+            node = sitetree.getNode(getRealm(), "/");
         }
+
         String rtps = getRequest().getParameter("resource-type");
         String resNamespace = rtps.substring(0, rtps.indexOf("::"));
         String resName = rtps.substring(rtps.indexOf("::") + 2);



More information about the Yanel-commits mailing list