You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by th...@apache.org on 2006/03/03 12:59:03 UTC

svn commit: r382776 - in /lenya/trunk/src: java/org/apache/lenya/cms/repository/SourceNode.java pubs/blog/config/publication.xconf pubs/default/config/publication.xconf

Author: thorsten
Date: Fri Mar  3 03:59:01 2006
New Revision: 382776

URL: http://svn.apache.org/viewcvs?rev=382776&view=rev
Log:
Fixing Bug related to the contentDir. Further refactored code to be better understandable. Updated publications to refer to the top level instead of topLevel/content

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
    lenya/trunk/src/pubs/blog/config/publication.xconf
    lenya/trunk/src/pubs/default/config/publication.xconf

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java?rev=382776&r1=382775&r2=382776&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java Fri Mar  3 03:59:01 2006
@@ -56,6 +56,8 @@
 
     private String sourceURI;
     protected ServiceManager manager;
+    public static final String FILE_PREFIX = "file:/";
+    public static final String CONTEXT_PREFIX = "context://";
 
     /**
      * Ctor.
@@ -102,18 +104,23 @@
 	
 
         String realSourceURI = null;
+        String urlID = this.sourceURI.substring(Node.LENYA_PROTOCOL.length());
+        
         if (contentDir == null) {
             // Default
-            realSourceURI = "context://" + this.sourceURI.substring(Node.LENYA_PROTOCOL.length());
+            realSourceURI = CONTEXT_PREFIX + urlID;
         } else {
+            // Substitute "lenya://lenya/pubs/PUB_ID/content" by "contentDir"
+            String filePrefix = urlID.substring(0,urlID.indexOf(publicationId))+publicationId;
+            String tempString = urlID.substring(filePrefix.length()+1);
+            String fileMiddle= tempString.substring(0,tempString.indexOf("/"));
+            String fileSuffix = tempString.substring(fileMiddle.length()+1,tempString.length());
             if (new File(contentDir).isAbsolute()) {
                 // Absolute
-                // Substitute "lenya://lenya/pubs/PUB_ID/content" by "contentDir"
-                realSourceURI = "file:/" + new File(contentDir + this.sourceURI.substring(Node.LENYA_PROTOCOL.length() + new String("lenya/pubs/" + publicationId + "/content").length())).getAbsolutePath();
+                realSourceURI = FILE_PREFIX + contentDir + File.separator+fileMiddle+ File.separator+fileSuffix;
             } else {
                 // Relative
-                // Substitute "lenya://lenya/pubs/PUB_ID/content" by "contentDir"
-                realSourceURI = "context://" + contentDir + this.sourceURI.substring(Node.LENYA_PROTOCOL.length() + new String("lenya/pubs/" + publicationId + "/content").length());
+                realSourceURI = CONTEXT_PREFIX + contentDir +"/"+ fileMiddle + "/"+fileSuffix;
             }
         }
         if (getLogger().isDebugEnabled()) {

Modified: lenya/trunk/src/pubs/blog/config/publication.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/pubs/blog/config/publication.xconf?rev=382776&r1=382775&r2=382776&view=diff
==============================================================================
--- lenya/trunk/src/pubs/blog/config/publication.xconf (original)
+++ lenya/trunk/src/pubs/blog/config/publication.xconf Fri Mar  3 03:59:01 2006
@@ -35,7 +35,7 @@
   <!-- NOTE: The configuration of the content directory has NOT been fully tested yet and might lead to unexpected results. Use at own risk ;-) -->
   <!-- Relative to webapp context: -->
   <!--
-  <content-dir src="lenya/pubs/blog/content"/>
+  <content-dir src="lenya/pubs/blog"/>
   -->
   <!-- Absolute: -->
   <!--

Modified: lenya/trunk/src/pubs/default/config/publication.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/pubs/default/config/publication.xconf?rev=382776&r1=382775&r2=382776&view=diff
==============================================================================
--- lenya/trunk/src/pubs/default/config/publication.xconf (original)
+++ lenya/trunk/src/pubs/default/config/publication.xconf Fri Mar  3 03:59:01 2006
@@ -33,7 +33,9 @@
   <resource-type name="links" workflow="fallback://config/workflow/workflow.xml"/>
   <resource-type name="search" workflow="fallback://config/workflow/workflow.xml"/>
   <resource-type name="cforms" workflow="fallback://config/workflow/workflow.xml"/>
+  <resource-type name="mediaType" workflow="fallback://config/workflow/workflow.xml"/>
   
+  <module name="mediaType"/>
   <module name="xhtml"/>
   <module name="links"/>
   <module name="opendocument"/>
@@ -45,7 +47,7 @@
   <!-- NOTE: The configuration of the content directory has NOT been fully tested yet and might lead to unexpected results. Use at own risk ;-) -->
   <!-- Relative to webapp context: -->
   <!--
-  <content-dir src="lenya/pubs/default/content"/>
+  <content-dir src="lenya/pubs/default"/>
   -->
   <!-- Absolute: -->
   <!--



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org