You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ed...@apache.org on 2005/11/09 18:36:22 UTC

svn commit: r332086 - /lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/AbstractPublication.java

Author: edith
Date: Wed Nov  9 09:36:18 2005
New Revision: 332086

URL: http://svn.apache.org/viewcvs?rev=332086&view=rev
Log:
Get the content path with help of the new PublicationContentDirModule in all default's sitemaps

Modified:
    lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/AbstractPublication.java

Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/AbstractPublication.java
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/AbstractPublication.java?rev=332086&r1=332085&r2=332086&view=diff
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/AbstractPublication.java (original)
+++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/publication/AbstractPublication.java Wed Nov  9 09:36:18 2005
@@ -54,13 +54,14 @@
     private HashMap siteTrees = new HashMap();
     private String[] rewriteAttributeXPaths = { };
     private boolean hasSitetree = true;
-
+    
     private static final String ELEMENT_PROXY = "proxy";
     private static final String ATTRIBUTE_AREA = "area";
     private static final String ATTRIBUTE_URL = "url";
     private static final String ATTRIBUTE_SSL = "ssl";
     private static final String ELEMENT_REWRITE_ATTRIBUTE = "link-attribute";
     private static final String ATTRIBUTE_XPATH = "xpath";
+	private static final String ELEMENT_CONTENT_DIR = "content-dir";
 
     /**
      * Creates a new instance of Publication
@@ -160,6 +161,16 @@
             }
             this.rewriteAttributeXPaths = (String[]) xPaths.toArray(new String[xPaths.size()]);
 
+
+            Configuration[] contentDirConfigs = config.getChildren(ELEMENT_CONTENT_DIR);
+            for (int i = 0; i < contentDirConfigs.length; i++){
+            	String area = contentDirConfigs[i].getAttribute(ATTRIBUTE_AREA);
+            	String dir = contentDirConfigs[i].getValue();
+                Object key = getContentDirKey(area);
+            	this.areaContentDir.put(key, dir);
+            }
+
+            
         } catch (PublicationException e) {
             throw e;
         } catch (Exception e) {
@@ -218,7 +229,13 @@
      * @return the directory of the given content area.
      */
     public File getContentDirectory(String area) {
-        return new File(getDirectory(), CONTENT_PATH + File.separator + area);
+    	Object key = getContentDirKey(area);
+    	String contentDir = (String) this.areaContentDir.get(key);
+        if (contentDir!= null) {
+        	return new File(contentDir);
+        } else {
+    		return new File(getDirectory(), CONTENT_PATH + File.separator + area);
+    	}
     }
 
     /**
@@ -632,5 +649,11 @@
      */
     public String[] getRewriteAttributeXPaths() {
         return this.rewriteAttributeXPaths;
+    }
+
+    private Map areaContentDir = new HashMap();
+
+    protected Object getContentDirKey(String area) {
+        return area;
     }
 }



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