You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by so...@apache.org on 2008/01/28 23:27:02 UTC

svn commit: r616087 [2/3] - in /lenya/branches/revolution/1.3.x: ./ lib/ src/java/org/apache/lenya/cms/cocoon/components/modules/input/ src/java/org/apache/lenya/cms/cocoon/components/source/impl/ src/java/org/apache/lenya/cms/content/ src/java/org/apa...

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Module.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Module.java?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Module.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Module.java Mon Jan 28 14:26:58 2008
@@ -1,6 +1,8 @@
 package org.apache.lenya.cms.modules;
 import java.io.File;
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
@@ -9,20 +11,18 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
+import org.apache.lenya.cms.content.Content;
 import org.xml.sax.SAXException;
-abstract class Module {
-   public static final String TYPE_FLAT = "flat";
-   public static final String TYPE_HIERARCHICAL = "hierarchical";
+public abstract class Module {
    public static final String MODULE_XML = "module.xml";
    Map inheritList; // String names of other Modules in this publication.
    Map requiredList; // required Modules: id = reason
    Map recommendedList; // recommended Modules: id = reason
    Map optionalList; // optional Modules: id = reason
-   Map variables; // String
-   Map files; // filename -> actual location as String (Better as File or
-   // Source?)
+   Map variables = new HashMap(); // nameString = valueString
+   Map files; // filename -> actual location as String (Better as File or Source?)
    File moduleDirectory;
-   String type = TYPE_HIERARCHICAL;
+   String type = Content.TYPE_HIERARCHICAL;
    String id;
    String name;
    String minimum = "1.3";
@@ -34,6 +34,7 @@
    String description = "";
    String usage = "";
    public Module(File moduleDirectory, String publicationId) {
+      resetFiles();
       String pubIdError = (publicationId.length() > 1 ? publicationId + " - " : "");
       this.moduleDirectory = moduleDirectory;
       id = moduleDirectory.getName();
@@ -90,6 +91,16 @@
                String reason = optional.getValue("");
                optionalList.put(id, reason);
             }
+            // Parameters
+            Configuration[] parameters = config.getChildren("parameter");
+            int numparameters = parameters.length;
+            for(int vR = 0; vR < numparameters; vR++){
+               Configuration optional = parameters[vR];
+               // Get attributes
+               String name = optional.getAttribute("name", "");
+               String value = optional.getValue("");
+               variables.put(name, value);
+            }
             // Inherits
             Configuration[] inherits = config.getChildren("inherit");
             inheritList = new TreeMap();
@@ -104,7 +115,7 @@
                // TODO: Cheap shortcuts. Rewrite inheritList storage later.
                int priorityLength = priority.length();
                String priorityPrefix = priorityLength > 3 ? priority : "000" + priority.substring(priorityLength);
-               String publicationPrefix = publication.length() > 0 ? publication + "." : "";
+               String publicationPrefix = publication.length() > 0 ? publication + "." : publicationId + ".";
                inheritList.put(priorityPrefix + "." + publicationPrefix + id, publicationPrefix + id);
             }
          }catch(ConfigurationException e){
@@ -134,5 +145,68 @@
          set.add(tokens.nextToken());
       return set;
    }
-   abstract public String getFile(String filename);
+   public void resetFiles() {
+      files = new HashMap();
+   }
+   /**
+    * Retrieves the absolute path to the first file found following inheritance. Does not check Global for Publication Modules. Used by publication.PublicationModules.
+    * 
+    * @param filename
+    * @return
+    */
+   public String getFile(String filename) {
+      String ret = "";
+      // Check cache
+      if(files.containsKey(filename)){
+         ret = (String) files.get(filename);
+         // Check if cached filename still exists?
+         File file = new File(ret);
+         if(!file.exists()){
+            ret = "";
+         }
+      }
+      if(ret.length() < 1){
+         // Check this Module.
+         File file = new File(moduleDirectory, filename);
+         if(file.exists()){
+            ret = file.getAbsolutePath();
+         }
+      }
+      if(ret.length() < 1){
+         // Check Module Inheritance
+         Iterator inherit = inheritList.entrySet().iterator();
+         while(inherit.hasNext() && (ret.length() < 1)){
+            ret = Modules.getModule((String) inherit.next(), type).getFile(filename);
+         }
+      }
+      if(ret.length() > 0){
+         files.put(filename, ret);
+      }
+      return ret;
+   }
+   /**
+    * Retrieves parameter set in this module and specified inheritance. Does not check Global for Publication Modules. Used by publication.PublicationModules.
+    * 
+    * @param parameterName
+    * @return
+    */
+   public String getVariable(String parameterName) {
+      String ret = "";
+      // Check cache
+      if(variables.containsKey(parameterName)){
+         ret = (String) variables.get(parameterName);
+      }else{
+         Module module;
+         // Check Module Inheritance
+         Iterator inherit = inheritList.entrySet().iterator();
+         while(inherit.hasNext() && (ret.length() < 1)){
+            module = Modules.getModule((String) inherit.next(), type);
+            if(null != module)
+               ret = module.getVariable(parameterName);
+         }
+      }
+      if(ret.length() > 0)
+         variables.put(parameterName, ret);
+      return ret;
+   }
 }

Copied: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleGlobal.java (from r615141, lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/GlobalModule.java)
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleGlobal.java?p2=lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleGlobal.java&p1=lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/GlobalModule.java&r1=615141&r2=616087&rev=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/GlobalModule.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleGlobal.java Mon Jan 28 14:26:58 2008
@@ -1,32 +1,7 @@
 package org.apache.lenya.cms.modules;
-
 import java.io.File;
-import java.util.Iterator;
-
-public class GlobalModule extends Module {
-
-	public GlobalModule(File moduleDirectory) {
-		super(moduleDirectory, "");
-	}
-   /**
-    * Retrieves the absolute path to the first file found following inheritance.
-    * @param filename
-    * @return
-    */
-   public String getFile(String filename){
-      // Check cache
-      if(files.containsKey(filename)) return (String) files.get(filename);
-      // Check this Module.
-      File file = new File(moduleDirectory, filename);
-      if(file.exists()) return file.getAbsolutePath();
-      // Check Module Inheritance
-      Iterator inherit = inheritList.entrySet().iterator();
-      String ret = "";
-      while(inherit.hasNext() && (ret.length() < 1)){
-         ret = Modules.getModule((String)inherit.next(), type).getFile(filename);
-      }
-      if(ret.length() > 0)   return ret;
-      // Check Global Module using id.
-      return Modules.getModule(id, type).getFile(filename);
+public class ModuleGlobal extends Module {
+   public ModuleGlobal(File moduleDirectory) {
+      super(moduleDirectory, "");
    }
 }

Added: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleInputModule.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleInputModule.java?rev=616087&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleInputModule.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleInputModule.java Mon Jan 28 14:26:58 2008
@@ -0,0 +1,90 @@
+package org.apache.lenya.cms.modules;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.StringTokenizer;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.lenya.cms.cocoon.components.modules.input.AbstractPageEnvelopeModule;
+import org.apache.lenya.cms.publication.PageEnvelope;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationModules;
+/**
+ * Retrieves Module Variables from publication.xconf and module.xml.
+ * 
+ * Variables are specified as <module name="modulename"><variable name="{variablename}">{value}</variable></module>
+ */
+public class ModuleInputModule extends AbstractPageEnvelopeModule implements Serviceable, ThreadSafe {
+   private ServiceManager manager;
+   /**
+    * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+    */
+   private String moduleId = "";
+   public Object getAttribute(String name, Configuration modeConf, Map objectModel) throws ConfigurationException {
+      if(getLogger().isDebugEnabled()){
+         getLogger().debug("Resolving [" + name + "]");
+      }
+      init();
+      // Standard Variables
+      if(name.equalsIgnoreCase("module"))
+         return moduleId;
+      // Module Variables
+      PageEnvelope pe = getEnvelope(objectModel);
+      Publication pub = pe.getPublication();
+      PublicationModules modules = pub.getModules();
+      return modules.getVariable(moduleId, name);
+//      return Modules.getModule(pub.getId(), moduleId, pub.getContentType()).getVariable(name);
+   }
+   /**
+    * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+    */
+   public Iterator getAttributeNames(Configuration modeConf, Map objectModel) throws ConfigurationException {
+      return Collections.EMPTY_SET.iterator();
+   }
+   /**
+    * @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+    */
+   public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel) throws ConfigurationException {
+      Object[] objects = {getAttribute(name, modeConf, objectModel)};
+      return objects;
+   }
+   /**
+    * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+    */
+   public void service(ServiceManager manager) throws ServiceException {
+      this.manager = manager;
+   }
+   /**
+    * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+    */
+   public void configure(Configuration conf) throws ConfigurationException {
+      super.configure(conf);
+   }
+   private void init() {
+      String uri = "";
+      try{
+         SourceResolver resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
+         Source source = resolver.resolveURI("");
+         uri = source.getURI();
+         if(resolver != null)
+            manager.release(resolver);
+      }catch(org.apache.avalon.framework.service.ServiceException se){
+         // Report Error?
+      }catch(java.net.MalformedURLException mue){
+         // Report Error?
+      }catch(java.io.IOException ioe){
+         // Report Error?
+      }
+      // TODO: Release resolver
+      StringTokenizer tokens = new StringTokenizer(uri, "/");
+      while(tokens.hasMoreTokens() && !(tokens.nextToken().equals("modules")));
+      if(tokens.hasMoreTokens())
+         moduleId = tokens.nextToken();
+   }
+}
\ No newline at end of file

Copied: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulePublication.java (from r615141, lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModule.java)
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulePublication.java?p2=lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulePublication.java&p1=lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModule.java&r1=615141&r2=616087&rev=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModule.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulePublication.java Mon Jan 28 14:26:58 2008
@@ -1,37 +1,9 @@
 package org.apache.lenya.cms.modules;
 import java.io.File;
-import java.util.Iterator;
-public class PublicationModule extends Module {
+public class ModulePublication extends Module {
    String publication;
-   public PublicationModule(File moduleDirectory, String publicationId) {
+   public ModulePublication(File moduleDirectory, String publicationId) {
       super(moduleDirectory, publicationId);
       publication = publicationId;
-   }
-   /**
-    * Retrieves the absolute path to the first file found following inheritance.
-    * 
-    * @param filename
-    * @return
-    */
-   public String getFile(String filename) {
-      // Check cache
-      if(files.containsKey(filename))
-         return (String) files.get(filename);
-      // Check this Module.
-      File file = new File(moduleDirectory, filename);
-      if(file.exists())
-         return file.getAbsolutePath();
-      // Check Module Inheritance
-      Iterator inherit = inheritList.entrySet().iterator();
-      String ret = "";
-      while(inherit.hasNext() && (ret.length() < 1)){
-         ret = Modules.getModule((String) inherit.next(), type).getFile(filename);
-      }
-      if(ret.length() > 0)
-         return ret;
-      // Check Publication Inheritance
-      // TODO: Check Publication's inheritance.
-      // Check Global Module using id.
-      return Modules.getModule(id, type).getFile(filename);
    }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleSet.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleSet.java?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleSet.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleSet.java Mon Jan 28 14:26:58 2008
@@ -1,4 +1,5 @@
 package org.apache.lenya.cms.modules;
+import org.apache.lenya.cms.content.Content;
 public class ModuleSet {
    Module flat = null;
    Module hierarchical = null;
@@ -11,18 +12,18 @@
       return hierarchical;
    }
    public void add(Module module) {
-      if(Module.TYPE_FLAT.equalsIgnoreCase(module.getType())){
+      if(Content.TYPE_FLAT.equalsIgnoreCase(module.getType())){
          if(null == flat){
             flat = module;
-         }else if(Module.TYPE_FLAT.equalsIgnoreCase(flat.getType())){
+         }else if(Content.TYPE_FLAT.equalsIgnoreCase(flat.getType())){
             flat = compareModules(flat, module);
          }else{
             flat = module;
          }
-      }else if(Module.TYPE_HIERARCHICAL.equalsIgnoreCase(module.getType())){
+      }else if(Content.TYPE_HIERARCHICAL.equalsIgnoreCase(module.getType())){
          if(null == hierarchical){
             hierarchical = module;
-         }else if(Module.TYPE_HIERARCHICAL.equalsIgnoreCase(hierarchical.getType())){
+         }else if(Content.TYPE_HIERARCHICAL.equalsIgnoreCase(hierarchical.getType())){
             hierarchical = compareModules(hierarchical, module);
          }else{
             hierarchical = module;

Added: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleSourceFactory.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleSourceFactory.java?rev=616087&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleSourceFactory.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleSourceFactory.java Mon Jan 28 14:26:58 2008
@@ -0,0 +1,154 @@
+package org.apache.lenya.cms.modules;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.components.CocoonComponentManager;
+import org.apache.cocoon.components.ContextHelper;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceFactory;
+import org.apache.excalibur.source.SourceNotFoundException;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.source.SourceUtil;
+import org.apache.excalibur.source.URIAbsolutizer;
+import org.apache.excalibur.source.impl.FileSource;
+import org.apache.lenya.cms.publication.PageEnvelope;
+import org.apache.lenya.cms.publication.PageEnvelopeFactory;
+import org.apache.lenya.cms.publication.Publication;
+/**
+ * 2000125: Integrated with org.apache.lenya.cms.modules
+ * 
+ * @author solprovider
+ * 
+ */
+public class ModuleSourceFactory implements SourceFactory, ThreadSafe, URIAbsolutizer, Contextualizable {
+   protected org.apache.avalon.framework.context.Context context;
+   public void contextualize(org.apache.avalon.framework.context.Context context) throws ContextException {
+      this.context = context;
+   }
+   public Source getSource(String location, Map parameters) throws IOException, MalformedURLException {
+      // System.out.println("MSF LOC=" + location);
+      int pos;
+      SourceResolver resolver = null;
+      ComponentManager manager = CocoonComponentManager.getSitemapComponentManager();
+      try{
+         resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
+      }catch(org.apache.avalon.framework.component.ComponentException ce){
+      }
+      if(null == resolver){
+         System.out.println("ModuleSourceFactory ComponentException");
+         return new FileSource(location);
+      }
+      String uri = resolver.resolveURI("").getURI();
+      String publication;
+      Publication pub;
+      try{
+         PageEnvelope envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(ContextHelper.getObjectModel(context));
+         pub = envelope.getPublication();
+         publication = pub.getId();
+      }catch(org.apache.lenya.cms.publication.PageEnvelopeException pee){
+         throw new MalformedURLException("ModuleSourceFactory PageEnvelopeException. Could not get Publication.");
+      }
+      // Reset moduleInheritance
+      boolean needsReset = false;
+      if(location.indexOf("::") != -1)
+         needsReset = true;
+      // Decide Usage
+      pos = location.indexOf(":///");
+      int endpos;
+      String moduleId = getModuleID(uri);
+      // BUG ALERT:
+      // <map:mount> tries both module://module/filepath and module://module/
+      // If filepath has a default, the second attempt will error.
+      // Not having the default destroys Flow:
+      // source = resolver.resolveURI("cocoon:/pipeline");
+      // var is = new
+      // Packages.org.xml.sax.InputSource(source.getInputStream());
+      // This errors.
+      // Every Module must have a module.xmap (even if it is empty)!
+      String filepath = "module.xmap";
+      if(pos != -1){ // module:/filepath/filename.ext
+         // Get current Module ID
+         filepath = location.substring(pos + 4);
+      }else{
+         pos = location.indexOf("://");
+         if(pos != -1){ // module://modulename/filepath/filename.ext
+            pos += 3;
+            endpos = location.indexOf("/", pos + 1);
+            if(endpos > 0){
+               moduleId = location.substring(pos, endpos);
+               filepath = location.substring(endpos + 1);
+               // System.out.println("MSF MOD=" + module + " FIL=" + filepath);
+            }else{
+               moduleId = location.substring(pos);
+               // System.out.println("MSF MOD=" + module + " POS=" + pos);
+            }
+         }else{
+            pos = location.indexOf(":/");
+            if(pos != -1){ // module:///publication/modulename/filepath/filename.ext
+               pos += 2;
+               endpos = location.indexOf("/", pos);
+               if(endpos > 0){
+                  publication = location.substring(pos, endpos);
+                  pos = endpos + 1;
+                  endpos = location.indexOf("/", pos);
+                  if(endpos > 0){
+                     moduleId = location.substring(pos, endpos);
+                     filepath = location.substring(endpos + 1);
+                  }else{
+                     moduleId = location.substring(pos);
+                  }
+               }else{
+                  publication = location.substring(pos);
+               }
+            }else{
+               // /filepath/filename.ext (Default protocol)
+               filepath = location;
+            }
+         }
+      }
+      // Verify
+      if(publication.length() < 1)
+         throw new MalformedURLException("No Publication ID found.");
+      if(moduleId.length() < 1)
+         moduleId = getModuleID(uri);
+      // BUG ALERT: See description above about no default
+      if(filepath.length() < 1)
+         filepath = "module.xmap";
+      // ## Get Module - BEGIN
+      // System.out.println("GetFile P=" + publication + " M=" + moduleId + " R=" + filepath);
+      String newlocation = pub.getModules().getFile(moduleId, filepath, needsReset);
+      // System.out.println("GetModule F=" + newlocation);
+      if(newlocation.length() < 1)
+         throw new SourceNotFoundException("Not found: " + location + " -> " + newlocation);
+      System.out.println("ModuleSource: " + newlocation);
+      FileSource source = new FileSource("file://" + newlocation);
+      System.out.println("FileSource: " + source.getURI());
+      File file = source.getFile();
+      System.out.println("File: " + file.getAbsolutePath());
+      return source;
+      // return new FileSource(newlocation);
+   }
+   public void release(Source source1) {
+   }
+   public String absolutize(String baseURI, String location) {
+      return SourceUtil.absolutize(baseURI, location, false, false);
+   }
+   private String getModuleID(String uri) throws MalformedURLException {
+      String module = "";
+      int pos = uri.indexOf("modules/");
+      if(pos > -1){
+         pos += "modules/".length();
+         int endpos = uri.indexOf("/", pos);
+         if(endpos > -1){
+            module = uri.substring(pos, endpos);
+         }else
+            module = uri.substring(pos);
+      }
+      return module;
+   }
+}
\ No newline at end of file

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Modules.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Modules.java?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Modules.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Modules.java Mon Jan 28 14:26:58 2008
@@ -3,14 +3,14 @@
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.cocoon.util.IOUtils;
+import org.apache.lenya.cms.content.Content;
 /**
  * Singleton class containing all Modules.
  * 
  * @author solprovider
  */
 public class Modules {
-   static Map globalModules;
-   static Map publicationModules;
+   static Map modules;
    static String servletContextPath;
    private static volatile boolean isInitialized = false;
    private Modules() {
@@ -22,8 +22,7 @@
       initialize();
    }
    private static synchronized void initialize() {
-      globalModules = new HashMap();
-      publicationModules = new HashMap();
+      modules = new HashMap();
       // Global Modules
       File globalModulesPath = new File(servletContextPath, "lenya" + File.separator + "modules");
       File[] moduleDirectories = globalModulesPath.listFiles();
@@ -32,25 +31,25 @@
          for(int md = 0; md < mdLength; md++){
             File moduleDirectory = moduleDirectories[md];
             if(moduleDirectory.isDirectory()){
-               Module newModule = new GlobalModule(moduleDirectory);
-               String id = newModule.getId();
-               if(globalModules.containsKey(id)){
-                  Object o = globalModules.get(id);
+               Module newModule = new ModuleGlobal(moduleDirectory);
+               String id = "." + newModule.getId(); // GlobalModules' IDs start with '.'
+               if(modules.containsKey(id)){
+                  Object o = modules.get(id);
                   if(Module.class.isAssignableFrom(o.getClass())){
                      Module oldModule = (Module) o;
                      ModuleSet moduleSet = new ModuleSet();
                      moduleSet.add(oldModule);
                      moduleSet.add(newModule);
-                     globalModules.put(id, moduleSet);
+                     modules.put(id, moduleSet);
                   }else if(ModuleSet.class.isAssignableFrom(o.getClass())){
                      ModuleSet moduleSet = (ModuleSet) o;
                      moduleSet.add(newModule);
-                     globalModules.put(id, moduleSet);
+                     modules.put(id, moduleSet);
                   }else{
                      System.out.println("GlobalModules: Found class " + o.getClass().toString());
                   }
                }else{
-                  globalModules.put(id, newModule);
+                  modules.put(id, newModule);
                }
             }
          }
@@ -71,25 +70,25 @@
                for(int md = 0; md < pmdLength; md++){
                   File moduleDirectory = publicationModuleDirectories[md];
                   if(moduleDirectory.isDirectory()){
-                     Module newModule = new PublicationModule(moduleDirectory, pubid);
+                     Module newModule = new ModulePublication(moduleDirectory, pubid);
                      String id = pubid + "." + newModule.getId();
-                     if(publicationModules.containsKey(id)){
-                        Object o = publicationModules.get(id);
+                     if(modules.containsKey(id)){
+                        Object o = modules.get(id);
                         if(Module.class.isAssignableFrom(o.getClass())){
                            Module oldModule = (Module) o;
                            ModuleSet moduleSet = new ModuleSet();
                            moduleSet.add(oldModule);
                            moduleSet.add(newModule);
-                           publicationModules.put(id, moduleSet);
+                           modules.put(id, moduleSet);
                         }else if(ModuleSet.class.isAssignableFrom(o.getClass())){
                            ModuleSet moduleSet = (ModuleSet) o;
                            moduleSet.add(newModule);
-                           publicationModules.put(id, moduleSet);
+                           modules.put(id, moduleSet);
                         }else{
                            System.out.println("PublicationModules: Found class " + o.getClass().toString());
                         }
                      }else{
-                        publicationModules.put(id, newModule);
+                        modules.put(id, newModule);
                      }
                   }
                }
@@ -97,30 +96,51 @@
          }
       } // END Publication Modules
       isInitialized = true;
+      // TESTING
+      // Set keyset = new TreeSet(modules.keySet());
+      // Iterator iterator = keyset.iterator();
+      // while(iterator.hasNext()){
+      // System.out.println("MODULE=" + (String) iterator.next());
+      // }
    }
-   static public Module getModule(String id, String type) {
-      while(!isInitialized)
+   static public Module getModule(String publicationId, String moduleId, String contentType) {
+      return(getModule(publicationId + "." + moduleId, contentType));
+   }
+   /**
+    * Retrieves Module using formatted id. Dangerous outside this package -- creates confusion with 3 parameter function. Not private -- needed by Module.
+    * 
+    * @param id
+    *           PublicationID.ModuleID or ModuleID for Global Modules
+    * @param contentType
+    *           See Module Constant: TYPE_FLAT, TYPE_HIERARCHICAL
+    * @return
+    */
+   static Module getModule(String id, String contentType) {
+      while(!isInitialized){
          try{
             Thread.currentThread().wait(1000);
          }catch(InterruptedException e){
             e.printStackTrace();
          }
-      if(publicationModules.containsKey(id))
-         return getModuleByType(publicationModules.get(id), type);
-      if(globalModules.containsKey(id))
-         return getModuleByType(globalModules.get(id), type);
+      }
+      if(modules.containsKey(id))
+         return getModuleByType(modules.get(id), contentType);
       return null;
    }
    static private Module getModuleByType(Object o, String type) {
       if(Module.class.isAssignableFrom(o.getClass())){
+         // System.out.println("GetModuleByType Module");
          return (Module) o;
       }else if(ModuleSet.class.isAssignableFrom(o.getClass())){
-         if(Module.TYPE_HIERARCHICAL.equals(type)){
+         if(Content.TYPE_HIERARCHICAL.equals(type)){
+            // System.out.println("GetModuleByType Hierarchical");
             return (Module) ((ModuleSet) o).getHierarchical();
          }else{
+            // System.out.println("GetModuleByType Flat");
             return (Module) ((ModuleSet) o).getFlat();
          }
       }
+      // System.out.println("GetModuleByType Null");
       return null;
    }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/AbstractPublication.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/AbstractPublication.java?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/AbstractPublication.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/AbstractPublication.java Mon Jan 28 14:26:58 2008
@@ -56,12 +56,13 @@
    private static final String ATTRIBUTE_XPATH = "xpath";
    private static final String ELEMENT_CONTENT_DIR = "content-dir";
    // Lenya1.3 - BEGIN
-   private Modules modules;
+   private PublicationModules modules;
    private Content content;
    private File publicationDirectory;
    private File contentDirectory;
-   private String contentType = "hierarchical";
+   private String contentType = Content.TYPE_HIERARCHICAL;
    // Lenya1.3 - END
+   //TODO: Reload Publication
    /**
     * Creates a new instance of Publication
     * 
@@ -153,17 +154,18 @@
          // Lenya1.3 - BEGIN
          // Content
          Configuration contentConfig = config.getChild("content");
-         contentType = contentConfig.getAttribute("type", "hierarchical");
+         contentType = contentConfig.getAttribute("type", Content.TYPE_HIERARCHICAL);
          String contentConfigValue = contentConfig.getValue(CONTENT_PATH);
          publicationDirectory = new File(getServletContext(), PUBLICATION_PREFIX + File.separator + getId());
          contentDirectory = new File(publicationDirectory, contentConfigValue);
-         if(contentType.equalsIgnoreCase("flat")){
+         // TODO: Move code based on ContentType to Content package.
+         if(contentType.equalsIgnoreCase(Content.TYPE_FLAT)){
             content = (Content) new FlatContent(contentDirectory, getLanguages());
          }else{
             content = (Content) new HierarchicalContent(contentDirectory, getLanguages());
          }
          // Modules
-         modules = new Modules(id, servletContextPath, config.getChild("modules"));
+         modules = new PublicationModules(id, contentType, servletContextPath, config.getChild("modules"));
          // Lenya1.3 - END
       }catch(PublicationException e){
          throw e;
@@ -176,7 +178,7 @@
       livemountpoint = config.getChild(LIVE_MOUNT_POINT).getValue("");
    }
    // Lenya1.3 - BEGIN
-   public Modules getModules() {
+   public PublicationModules getModules() {
       return modules;
    }
    public Content getContent() {
@@ -201,15 +203,13 @@
     * Returns the publishing environment of this publication.
     * 
     * @return A {@link PublishingEnvironment}object.
-    * @deprecated It is planned to decouple the environments from the
-    *             publication.
+    * @deprecated It is planned to decouple the environments from the publication.
     */
    public PublishingEnvironment getEnvironment() {
       return environment;
    }
    /**
-    * Returns the servlet context this publication belongs to (usually, the
-    * <code>webapps/lenya</code> directory).
+    * Returns the servlet context this publication belongs to (usually, the <code>webapps/lenya</code> directory).
     * 
     * @return A <code>File</code> object.
     */
@@ -232,8 +232,7 @@
     * Return the directory of a specific area.
     * 
     * @param area
-    *           a <code>File</code> representing the root of the area content
-    *           directory.
+    *           a <code>File</code> representing the root of the area content directory.
     * @return the directory of the given content area.
     * @deprecated Areas are bad. Do not use them.
     */
@@ -301,8 +300,7 @@
       return (String[]) languages.toArray(new String[languages.size()]);
    }
    /**
-    * Get the breadcrumb prefix. It can be used as a prefix if a publication is
-    * part of a larger site
+    * Get the breadcrumb prefix. It can be used as a prefix if a publication is part of a larger site
     * 
     * @return the breadcrumb prefix
     */
@@ -310,9 +308,7 @@
       return breadcrumbprefix;
    }
    /**
-    * Get the SSL prefix. If you want to serve SSL-protected pages through a
-    * special site, use this prefix. This can come in handy if you have multiple
-    * sites that need SSL protection and you want to share one SSL certificate.
+    * Get the SSL prefix. If you want to serve SSL-protected pages through a special site, use this prefix. This can come in handy if you have multiple sites that need SSL protection and you want to share one SSL certificate.
     * 
     * @return the SSL prefix
     */
@@ -320,11 +316,7 @@
       return sslprefix;
    }
    /**
-    * Get the Live mount point. The live mount point is used to rewrite links
-    * that are of the form /contextprefix/publication/area/documentid to
-    * /livemountpoint/documentid This is useful if you serve your live area
-    * through mod_proxy. to enable this functionality, set the Live mount point
-    * to / or something else. An empty mount point disables the feature.
+    * Get the Live mount point. The live mount point is used to rewrite links that are of the form /contextprefix/publication/area/documentid to /livemountpoint/documentid This is useful if you serve your live area through mod_proxy. to enable this functionality, set the Live mount point to / or something else. An empty mount point disables the feature.
     * 
     * @return the Live mount point
     */
@@ -332,8 +324,7 @@
       return livemountpoint;
    }
    /**
-    * Get the sitetree for a specific area of this publication. Sitetrees are
-    * created on demand and are cached.
+    * Get the sitetree for a specific area of this publication. Sitetrees are created on demand and are cached.
     * 
     * @param area
     *           the area
@@ -354,11 +345,9 @@
       return sitetree;
    }
    /**
-    * Get the sitetree for a specific area of this publication. Sitetrees are
-    * created on demand and are cached.
+    * Get the sitetree for a specific area of this publication. Sitetrees are created on demand and are cached.
     * 
-    * @deprecated Please use getTree() because this method returns the interface
-    *             and not a specific implementation
+    * @deprecated Please use getTree() because this method returns the interface and not a specific implementation
     * @see getTree()
     * @param area
     *           the area
@@ -426,12 +415,9 @@
       return key.hashCode();
    }
    /**
-    * Template method to copy a document. Override
-    * {@link #copyDocumentSource(Document, Document)} to implement access to a
-    * custom repository.
+    * Template method to copy a document. Override {@link #copyDocumentSource(Document, Document)} to implement access to a custom repository.
     * 
-    * @see org.apache.lenya.cms.publication.Publication#copyDocument(org.apache.lenya.cms.publication.Document,
-    *      org.apache.lenya.cms.publication.Document)
+    * @see org.apache.lenya.cms.publication.Publication#copyDocument(org.apache.lenya.cms.publication.Document, org.apache.lenya.cms.publication.Document)
     */
    public void copyDocument(Document sourceDocument, Document destinationDocument) throws PublicationException {
       copyDocumentSource(sourceDocument, destinationDocument);
@@ -577,8 +563,7 @@
     */
    protected abstract void deleteDocumentSource(Document document) throws PublicationException;
    /**
-    * @see org.apache.lenya.cms.publication.Publication#moveDocument(org.apache.lenya.cms.publication.Document,
-    *      org.apache.lenya.cms.publication.Document)
+    * @see org.apache.lenya.cms.publication.Publication#moveDocument(org.apache.lenya.cms.publication.Document, org.apache.lenya.cms.publication.Document)
     */
    public void moveDocument(Document sourceDocument, Document destinationDocument) throws PublicationException {
       copyDocument(sourceDocument, destinationDocument);
@@ -598,8 +583,7 @@
       return area + ":" + isSslProtected;
    }
    /**
-    * @see org.apache.lenya.cms.publication.Publication#getProxy(org.apache.lenya.cms.publication.Document,
-    *      boolean)
+    * @see org.apache.lenya.cms.publication.Publication#getProxy(org.apache.lenya.cms.publication.Document, boolean)
     */
    public Proxy getProxy(Document document, boolean isSslProtected) {
       Object key = getProxyKey(document.getArea(), isSslProtected);

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Publication.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Publication.java?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Publication.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Publication.java Mon Jan 28 14:26:58 2008
@@ -258,7 +258,7 @@
     String[] getRewriteAttributeXPaths();
 
 //Lenya1.3 - BEGIN
-    Modules getModules();
+    PublicationModules getModules();
     Content getContent();
     File getContentDirectory();
     String getContentType();

Copied: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/PublicationModules.java (from r615137, lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Modules.java)
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/PublicationModules.java?p2=lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/PublicationModules.java&p1=lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Modules.java&r1=615137&r2=616087&rev=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/Modules.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/PublicationModules.java Mon Jan 28 14:26:58 2008
@@ -1,285 +1,269 @@
-package org.apache.lenya.cms.publication;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-
-//TODO: Rearchitect so can reset all without restarting Lenya?
-
-public class Modules {
-   private ArrayList templates   = new ArrayList(); // Default list of Publications for inherit.
-//TODO: external and exclude should have defaults in module.xml.  
-//Current algorithm needs replacing.  
-//Use TRUE, FALSE, UNSET rather than Boolean.
-//Change exclude to Map.
-   private Map external    = new HashMap();   // Every Module in Publication with Boolean.
-   private Set exclude     = new HashSet();   // Only Modules excluded.
-   private Map inherit     = new HashMap();   // Only Modules overriding inherit.
-   private Map modules = new HashMap();   // Only Modules overriding inherit with new moduleID.
-   boolean allAllowed  = true;
-   boolean allExternal = true;
-   static Map variables = new HashMap();  //publication.module.variablename = value from publication.xconf
-   static Map defaultvariables = new HashMap();  //publication.module.variablename = value from module.xml
-   static Map globalvariables = new HashMap(); //module.variable = value from global module.xml
-   static boolean isGlobalvariablesSet = false;
-   private String servletContextPath;
-
-//Dev testing
-   Configuration config;
-
-   public Modules(String publication, String servletContextPath, Configuration config){
-      if(null == config) return;
-      int i;
-      this.servletContextPath = servletContextPath;
-      this.config = config;  //TESTING
-      
-      String[] attrnames = config.getAttributeNames();
-      for(i = 0; i < attrnames.length; i++ ) {
-         try{
-            String attribute = attrnames[i];
-            String value = config.getAttribute(attrnames[i]);
-            if(attribute.equalsIgnoreCase("include")){
-               if(!value.equalsIgnoreCase("all")) allAllowed = false;
-            }else if(attribute.equalsIgnoreCase("external")){
-               if(!(value.equalsIgnoreCase("all") | value.equalsIgnoreCase("true"))) allExternal = false;
-            }else if((attribute.equalsIgnoreCase("inherit")|attribute.equalsIgnoreCase("template"))){
-               templates.add(value);
-            }
-         }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){ 
-            //TODO: Log Errors?
-         }
-      }  //For each Attribute
-      Configuration[] children = config.getChildren();
-      for(int c = 0; c < children.length; c++ ) {
-         String element = children[c].getName();
-         attrnames = children[c].getAttributeNames();
-         if(element.equalsIgnoreCase("inherit")){
-            for(i = 0; i < attrnames.length; i++ ) {
-               try{
-                  templates.add(children[c].getAttribute(attrnames[i]));
-               }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){ 
-                  //TODO: Log Errors?
-               }
-            }
-            try{
-                  templates.add(children[c].getValue());
-            }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){ 
-               // Error means no value
-            }
-         }else if(element.equalsIgnoreCase("module")){
-             boolean isExternal = true;
-             boolean isExcluded = false;
-             String name = "";
-             String template = "";
-             String module = "";
-             for(i = 0; i < attrnames.length; i++ ) {
-                String attribute = attrnames[i];
-                try{
-                   String value = children[c].getAttribute(attrnames[i]);
-                   if(attribute.equalsIgnoreCase("external")){
-                      if(!(value.equalsIgnoreCase("yes") | value.equalsIgnoreCase("true"))) isExternal = false;
-                   }else if(attribute.equalsIgnoreCase("exclude")){
-                      if(!(value.equalsIgnoreCase("yes") | value.equalsIgnoreCase("true"))) isExcluded = true;
-                   }else if(attribute.equalsIgnoreCase("name")){
-                      name = value;
-                   }else if((attribute.equalsIgnoreCase("inherit")|attribute.equalsIgnoreCase("template"))){
-                      template = value;
-                   }else if(attribute.equalsIgnoreCase("module")){
-                      module = value;
-                   }
-               }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){ 
-                  //TODO: Log Errors?
-               }
-             }
-             if(name.length() > 0){
-                if(isExcluded){
-                   exclude.add(name);
-                }else{
-                   external.put(name, new Boolean(isExternal));
-                   if(template.length() > 0) inherit.put(name, template);
-                   if(module.length() > 0) inherit.put(name, module);
-                   //Variables
-                   Map varmap = getVariablesFromConfiguration(children[c]);
-                   Iterator keys = varmap.keySet().iterator();
-                   while(keys.hasNext()){
-                      String key = (String) keys.next();
-                      variables.put(publication + "." + name + "." + key, varmap.get(key));
-                   }
-/* OBSOLETE
-                   Configuration[] vchildren = children[c].getChildren();
-                   for(int v = 0; v < vchildren.length; v++ ) {
-                      String velement = vchildren[v].getName();
-                      if(velement.equalsIgnoreCase("variable")|velement.equalsIgnoreCase("param")|
-                            velement.equalsIgnoreCase("parameter")){
-                         try{
-                            String vname = vchildren[v].getAttribute("name");
-                            String vvalue = vchildren[v].getValue();
-                            variables.put(publication + "." + name + "." + vname, vvalue);
-                         }catch(org.apache.avalon.framework.configuration.ConfigurationException vce){
-                            // Do Nothing?
-                         }  //try
-                      }  // if variable
-                   } //for
-OBSOLETE - END */
-               } // isExcluded
-            } // Has name
-         } //element tag
-      } // for each child
-      // Get variables from module.xml if each is not set
-      loadModuleVariables(publication);
-      loadGlobalVariables();
-   }  // function
-   public boolean isExternal(String moduleID){
-      if(exclude.contains(moduleID)) return false;
-      if(allExternal) return true;
-      if(external.containsKey(moduleID)) return ((Boolean) external.get(moduleID)).booleanValue();
-      //TODO: Check parent templates?
-      return allAllowed;
-   }
-
-   public boolean isAllowed(String moduleID){
-      if(exclude.contains(moduleID)) return false;
-      if(allAllowed) return true;
-      if(external.containsKey(moduleID)) return true;
-      return false;
-   }
-   public String[] getTemplates(String moduleId){
-      if(inherit.containsKey(moduleId)){ 
-         ArrayList tmpArray = new ArrayList();
-         tmpArray.add(inherit.get(moduleId));
-         tmpArray.addAll(templates);
-         return (String[]) tmpArray.toArray(new String[0]);
-      }
-      return (String[]) templates.toArray(new String[0]);
-   }
-   public String getInheritedModule(String moduleId){
-      if(modules.containsKey(moduleId)) return (String) modules.get(moduleId);
-      return moduleId; 
-   }
-
-   public String getVariable(String publication, String module, String varname){
-      String moduleID = module;
-      if(exclude.contains(moduleID)) return "";
-      if(variables.containsKey(publication + "." + moduleID + "." + varname)){
-         return (String) variables.get(publication + "." + moduleID + "." + varname);
-      }
-//TODO: ModuleID could change with inheritance.  Use inherit.
-      String[] templates = getTemplates(moduleID);
-      for(int i = 0; i < templates.length; i++) {
-         if(variables.containsKey(templates[i] + "." + moduleID + "." + varname)){
-               return (String) variables.get(templates[i] + "." + moduleID + "." + varname);
-         }
-      }
-      moduleID = module;
-      //Check Module Variables
-      if(defaultvariables.containsKey(publication + "." + moduleID + "." + varname)){
-         return (String) defaultvariables.get(publication + "." + moduleID + "." + varname);
-      }
-//TODO: ModuleID could change with inheritance.  Use inherit.
-      for(int i = 0; i < templates.length; i++) {
-         if(defaultvariables.containsKey(templates[i] + "." + moduleID + "." + varname)){
-               return (String) defaultvariables.get(templates[i] + "." + moduleID + "." + varname);
-         }
-      }
-      //Check Global Variables
-      //ModuleID could change with inheritance.  Only check highest inheritance, not current module.
-      if(globalvariables.containsKey(moduleID + "." + varname)){
-         return (String) globalvariables.get(moduleID + "." + varname);
-      }
-      //Default
-      return "";
-   }
-
-   public void loadModuleVariables(String publication){
-      File directory = new File(servletContextPath, Publication.PUBLICATION_PREFIX 
-            + File.separator + publication + File.separator + "modules");
-      //For each directory in pub/modules, check directory/module.xml
-      if(directory.exists() && directory.isDirectory()){
-         String[] files = directory.list();
-         for(int f = 0; f < files.length; f++) {
-            File moduledirectory = new File(directory, files[f]);
-            if(moduledirectory.exists() && moduledirectory.isDirectory()){
-               File modulexml = new File(moduledirectory, "module.xml");
-               if(modulexml.exists()){
-                  Map varmap = getModuleXMLValues(modulexml);
-                  Iterator keys = varmap.keySet().iterator();
-                  while(keys.hasNext()){
-                     String key = (String) keys.next();
-                     defaultvariables.put(publication + "." + files[f] + "." + key, varmap.get(key));             
-System.out.println("Default:"+ publication + "." + files[f] + "." + key +"="+ varmap.get(key));             
-                  }
-               }
-            }
-         }
-      }
-   }
-
-   public void loadGlobalVariables(){
-      if(!isGlobalvariablesSet){
-         File directory = new File(servletContextPath, "lenya" + File.separator + "modules");
-//For each directory in lenya/modules, check directory/module.xml
-         if(directory.exists() && directory.isDirectory()){
-            String[] files = directory.list();
-            for(int f = 0; f < files.length; f++) {
-               File moduledirectory = new File(directory, files[f]);
-               if(moduledirectory.exists() && moduledirectory.isDirectory()){
-                  File modulexml = new File(moduledirectory, "module.xml");
-                  if(modulexml.exists()){
-                     Map varmap = getModuleXMLValues(modulexml);
-                     Iterator keys = varmap.keySet().iterator();
-                     while(keys.hasNext()){
-                        String key = (String) keys.next();
-                        globalvariables.put(files[f] + "." + key, varmap.get(key));             
-                     }
-                  }
-               }
-            }
-         }
-         //Finish
-         isGlobalvariablesSet = true;
-      }
-   }
-   private Map getModuleXMLValues(File modulexml){
-         DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
-      try{
-         Configuration config = builder.buildFromFile(modulexml);
-//TEST: Is top level?
-         return getVariablesFromConfiguration(config);
-      }catch(org.xml.sax.SAXException saxe){
-      }catch(java.io.IOException ioe){
-      }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){
-      }
-      return new HashMap();
-   }
-   private Map getVariablesFromConfiguration(Configuration config){
-      Map map = new HashMap();
-      Configuration[] vchildren = config.getChildren();
-      for(int v = 0; v < vchildren.length; v++ ) {
-         String velement = vchildren[v].getName();
-//Standardize on "parameter"?
-         if(velement.equalsIgnoreCase("variable")|velement.equalsIgnoreCase("param")
-               |velement.equalsIgnoreCase("parameter")){
-            try{
-               map.put(vchildren[v].getAttribute("name"), vchildren[v].getValue());
-            }catch(org.apache.avalon.framework.configuration.ConfigurationException vce){
-               // Do Nothing?
-            }  //try
-         }  // if variable
-      } //for
-      return map;
-   }
-
-   private Publication getPublication(String publication){
-      try{
-         return PublicationFactory.getPublication(publication, servletContextPath);
-      }catch(org.apache.lenya.cms.publication.PublicationException pe){
-         return (Publication) null;
-      }
-   }
+package org.apache.lenya.cms.publication;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.lenya.cms.modules.Module;
+import org.apache.lenya.cms.modules.Modules;
+//TODO: Rearchitect so can reset all without restarting Lenya?
+public class PublicationModules {
+   private List templates = new ArrayList(); // Default list of Publications for inherit.
+   // TODO: external and exclude should have defaults in module.xml.
+   // Current algorithm needs replacing.
+   // Use TRUE, FALSE, UNSET rather than Boolean.
+   // Change exclude to Map.
+   private Map external = new HashMap(); // Every Module in Publication with Boolean.
+   private Set exclude = new HashSet(); // Only Modules excluded.
+   private Map inherit = new HashMap(); // Only Modules overriding inherit.
+   private Map files = new HashMap();
+   // private Map modules = new HashMap(); // Only Modules overriding inherit with new moduleID.
+   boolean allAllowed = true;
+   boolean allExternal = true;
+   static Map variables = new HashMap(); // publication.module.variablename = value from publication.xconf
+   // static Map defaultvariables = new HashMap(); // publication.module.variablename = value from module.xml
+   // static Map globalvariables = new HashMap(); // module.variable = value from global module.xml
+   // static boolean isGlobalvariablesSet = false;
+   private String publicationId;
+   private String servletContextPath;
+   private String contentType;
+   // Dev testing
+   Configuration config;
+   public PublicationModules(String publicationId, String contentType, String servletContextPath, Configuration config) {
+      if(null == config)
+         return;
+      int i;
+      this.publicationId = publicationId;
+      this.servletContextPath = servletContextPath;
+      this.contentType = contentType;
+      this.config = config; // TESTING
+      String[] attrnames = config.getAttributeNames();
+      for(i = 0; i < attrnames.length; i++){
+         try{
+            String attribute = attrnames[i];
+            String value = config.getAttribute(attrnames[i]);
+            if(attribute.equalsIgnoreCase("include")){
+               if(!value.equalsIgnoreCase("all"))
+                  allAllowed = false;
+            }else if(attribute.equalsIgnoreCase("external")){
+               if(!(value.equalsIgnoreCase("all") | value.equalsIgnoreCase("true")))
+                  allExternal = false;
+            }else if((attribute.equalsIgnoreCase("inherit") | attribute.equalsIgnoreCase("template"))){
+               templates.add(value);
+            }
+         }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){
+            // TODO: Log Errors?
+         }
+      } // For each Attribute
+      Configuration[] children = config.getChildren();
+      for(int c = 0; c < children.length; c++){
+         String element = children[c].getName();
+         attrnames = children[c].getAttributeNames();
+         if(element.equalsIgnoreCase("inherit")){
+            for(i = 0; i < attrnames.length; i++){
+               try{
+                  templates.add(children[c].getAttribute(attrnames[i]));
+               }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){
+                  // TODO: Log Errors?
+               }
+            }
+            try{
+               templates.add(children[c].getValue());
+            }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){
+               // Error means no value
+            }
+         }else if(element.equalsIgnoreCase("module")){
+            boolean isExternal = true;
+            boolean isExcluded = false;
+            String name = "";
+            String template = "";
+            String module = "";
+            for(i = 0; i < attrnames.length; i++){
+               String attribute = attrnames[i];
+               try{
+                  String value = children[c].getAttribute(attrnames[i]);
+                  if(attribute.equalsIgnoreCase("external")){
+                     if(!(value.equalsIgnoreCase("yes") | value.equalsIgnoreCase("true")))
+                        isExternal = false;
+                  }else if(attribute.equalsIgnoreCase("exclude")){
+                     if(!(value.equalsIgnoreCase("yes") | value.equalsIgnoreCase("true")))
+                        isExcluded = true;
+                  }else if(attribute.equalsIgnoreCase("name")){
+                     name = value;
+                  }else if((attribute.equalsIgnoreCase("inherit") | attribute.equalsIgnoreCase("template"))){
+                     template = value;
+                  }else if(attribute.equalsIgnoreCase("module")){
+                     module = value;
+                  }
+               }catch(org.apache.avalon.framework.configuration.ConfigurationException ce){
+                  // TODO: Log Errors?
+               }
+            }
+            if(name.length() > 0){
+               if(isExcluded){
+                  exclude.add(name);
+               }else{
+                  external.put(name, new Boolean(isExternal));
+                  if(template.length() > 0)
+                     inherit.put(name, template);
+                  if(module.length() > 0)
+                     inherit.put(name, module);
+                  // Variables
+                  Map varmap = getVariablesFromConfiguration(children[c]);
+                  Iterator keys = varmap.keySet().iterator();
+                  while(keys.hasNext()){
+                     String key = (String) keys.next();
+                     variables.put(publicationId + "." + name + "." + key, varmap.get(key));
+                  }
+               } // isExcluded
+            } // Has name
+         } // element tag
+      } // for each child
+   } // function
+   public boolean isExternal(String moduleId) {
+      if(exclude.contains(moduleId))
+         return false;
+      if(allExternal)
+         return true;
+      if(external.containsKey(moduleId))
+         return ((Boolean) external.get(moduleId)).booleanValue();
+      // TODO: Check parent templates?
+      return allAllowed;
+   }
+   public boolean isAllowed(String moduleId) {
+      if(exclude.contains(moduleId))
+         return false;
+      if(allAllowed)
+         return true;
+      if(external.containsKey(moduleId))
+         return true;
+      return false;
+   }
+   // public String[] getTemplates(String moduleId) {
+   // if(inherit.containsKey(moduleId)){
+   // ArrayList tmpArray = new ArrayList();
+   // tmpArray.add(inherit.get(moduleId));
+   // tmpArray.addAll(templates);
+   // return (String[]) tmpArray.toArray(new String[0]);
+   // }
+   // return (String[]) templates.toArray(new String[0]);
+   // }
+   // public String getInheritedModule(String moduleId) {
+   // if(modules.containsKey(moduleId))
+   // return (String) modules.get(moduleId);
+   // return moduleId;
+   // }
+   public String getVariable(String moduleId, String varname) {
+      // TODO: Add reset. Do InputModules support double colon syntax?
+      if(exclude.contains(moduleId))
+         return "";
+      if(variables.containsKey(publicationId + "." + moduleId + "." + varname)){
+         return (String) variables.get(publicationId + "." + moduleId + "." + varname);
+      }
+      // Check Module Variables
+      String ret = "";
+      Module module = Modules.getModule(publicationId, moduleId, contentType);
+      if(null != module){
+         ret = module.getVariable(varname);
+      }
+      if(ret.length() < 1){
+         // Check inheritance
+         // NOTE: contentType remains of this Publication, not the Inherited Publication.
+         Iterator iterator = templates.iterator();
+         while(iterator.hasNext() && (ret.length() < 1)){
+            String i_pubid = (String) iterator.next();
+            // Inherited Publication variables
+            if(variables.containsKey(i_pubid + "." + moduleId + "." + varname)){
+               return (String) variables.get(i_pubid + "." + moduleId + "." + varname);
+            }
+            // Inherited Publication Module variables
+            if(ret.length() < 1){
+               module = Modules.getModule(i_pubid, moduleId, contentType);
+               if(null != module){
+                  ret = module.getVariable(varname);
+               }
+            }
+         }
+      }
+      if(ret.length() < 1){
+         // Check Global Module
+         module = Modules.getModule("", moduleId, contentType);
+         if(null != module){
+            ret = module.getVariable(varname);
+         }
+      }
+      if(ret.length() > 0){
+         variables.put(publicationId + "." + moduleId + "." + varname, ret);
+      }
+      return ret;
+   }
+   public String getFile(String moduleId, String filename, boolean reset) {
+      if(reset){
+         files = new HashMap();
+      }
+      if(exclude.contains(moduleId))
+         return "";
+      if(files.containsKey(moduleId + "." + filename)){
+         return (String) files.get(moduleId + "." + filename);
+      }
+      // Check Module Variables
+      String ret = "";
+      Module module = Modules.getModule(publicationId, moduleId, contentType);
+      if(null != module){
+         if(reset)
+            module.resetFiles();
+         ret = module.getFile(filename);
+      }
+      if(ret.length() < 1){
+         // Check inheritance
+         Iterator iterator = templates.iterator();
+         while(iterator.hasNext() && (ret.length() < 1)){
+            module = Modules.getModule((String) iterator.next(), moduleId, contentType);
+            if(null != module){
+               if(reset)
+                  module.resetFiles();
+               ret = module.getFile(filename);
+            }
+         }
+      }
+      if(ret.length() < 1){
+         // Check Global Module
+         module = Modules.getModule("", moduleId, contentType);
+         if(null != module){
+            if(reset)
+               module.resetFiles();
+            ret = module.getFile(filename);
+         }
+      }
+      if(ret.length() > 0){
+         files.put(moduleId + "." + filename, ret);
+      }
+      return ret;
+   }
+   private Map getVariablesFromConfiguration(Configuration config) {
+      Map map = new HashMap();
+      Configuration[] vchildren = config.getChildren();
+      for(int v = 0; v < vchildren.length; v++){
+         String velement = vchildren[v].getName();
+         // Standardize on "parameter"?
+         if(velement.equalsIgnoreCase("variable") | velement.equalsIgnoreCase("param") | velement.equalsIgnoreCase("parameter")){
+            try{
+               map.put(vchildren[v].getAttribute("name"), vchildren[v].getValue());
+            }catch(org.apache.avalon.framework.configuration.ConfigurationException vce){
+               // Do Nothing?
+            } // try
+         } // if variable
+      } // for
+      return map;
+   }
+   // private Publication getPublication() {
+   // try{
+   // return PublicationFactory.getPublication(publicationId, servletContextPath);
+   // }catch(org.apache.lenya.cms.publication.PublicationException pe){
+   // return (Publication) null;
+   // }
+   // }
 }

Modified: lenya/branches/revolution/1.3.x/src/webapp/WEB-INF/cocoon-xconf.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/WEB-INF/cocoon-xconf.xsl?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/WEB-INF/cocoon-xconf.xsl (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/WEB-INF/cocoon-xconf.xsl Mon Jan 28 14:26:58 2008
@@ -112,8 +112,8 @@
     </component-instance>
 
 <!-- Lenya1.3 BEGIN -->
-<component-instance class="org.apache.lenya.cms.cocoon.components.modules.input.ContentModule" name="content" logger="core.modules.input.module"/>
-<component-instance class="org.apache.lenya.cms.cocoon.components.modules.input.ModuleModule" name="module" logger="core.modules.input.module"/>
+<component-instance class="org.apache.lenya.cms.content.ContentInputModule" name="content" logger="core.modules.input.module"/>
+<component-instance class="org.apache.lenya.cms.modules.ModuleInputModule" name="module" logger="core.modules.input.module"/>
 <component-instance class="org.apache.lenya.cms.cocoon.components.modules.input.PublicationModule" name="publication" logger="core.modules.input.module"/>
 <component-instance class="org.apache.lenya.cms.cocoon.components.modules.input.Usecase2ModuleModule" name="u2m" logger="core.modules.input.usecase2module"/>
 <component-instance class="org.apache.lenya.cms.cocoon.components.modules.input.VirtualModule" name="virtual" logger="core.modules.input.module"/>
@@ -127,8 +127,8 @@
   <xsl:copy>
     <xsl:copy-of select="@*"/>
     <xsl:apply-templates/>
-    <component-instance class="org.apache.lenya.cms.cocoon.components.source.impl.ModuleSourceFactory" name="module"/>
-    <component-instance class="org.apache.lenya.cms.cocoon.components.source.impl.ContentSourceFactory" name="content"/>
+    <component-instance class="org.apache.lenya.cms.modules.ModuleSourceFactory" name="module"/>
+    <component-instance class="org.apache.lenya.cms.content.ContentSourceFactory" name="content"/>
     <component-instance class="org.apache.lenya.cms.cocoon.components.source.impl.VirtualSourceFactory" name="virtual"/>
   </xsl:copy>
 </xsl:template>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/doctypes.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/doctypes.xmap?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/doctypes.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/doctypes.xmap Mon Jan 28 14:26:58 2008
@@ -14,9 +14,9 @@
     <map:pipeline>
       <map:match pattern="*/*/*/**.xml">
         <map:match type="step" pattern="view-revision">
-          <map:generate type="serverpages" src="module:///../../../../content/rc/view.xsp">
+          <map:generate type="serverpages" src="module://lenya/rc/view.xsp">
           </map:generate>
-          <map:transform src="module:///../../../../xslt/rc/toDoc.xsl"/>
+          <map:transform src="module://lenya/rc/toDoc.xsl"/>
         <map:transform src="module:///../../xslt/{../3}2xhtml.xsl">
           <map:parameter name="rendertype" value="{1}"/>
           <map:parameter name="nodeid" value="{page-envelope:document-node-id}"/>
@@ -29,8 +29,12 @@
       <!-- parametrized doctype matcher -->
       <!-- pattern="{rendertype}/{area}/{doctype}/{document-path}" -->
       <map:match pattern="*/*/*/**.xml">
-        <map:generate src="module:///../../content/{2}/{4}.xml"/>
-        <map:transform src="module:///../../xslt/{3}2xhtml.xsl">
+<!-- WARNING: Different path needed by Global and Publication Modules. -->
+        <map:generate src="module:///../../pubs/{publication:publication}/content/{2}/{4}.xml"/>
+<!--        <map:generate src="module:///../../content/{2}/{4}.xml"/> -->
+<!-- WARNING: Different path needed by Global and Publication Modules. -->
+        <map:transform src="module:///../../pubs/{publication:publication}/xslt/{3}2xhtml.xsl">
+<!--        <map:transform src="module:///../../xslt/{3}2xhtml.xsl"> -->
           <map:parameter name="rendertype" value="{1}"/>
           <map:parameter name="nodeid" value="{page-envelope:document-node-id}"/>
           <map:parameter name="language" value="{page-envelope:document-language}"/>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xmap Mon Jan 28 14:26:58 2008
@@ -28,19 +28,15 @@
       <map:transform type="i18n">      
         <map:parameter name="locale" value="{request:locale}"/>
       </map:transform>    
-      <map:transform src="module:///../../../../xslt/util/page2xhtml.xsl">
+      <map:transform src="module://lenya/util/page2xhtml.xsl">
         <map:parameter name="contextprefix" value="{request:contextPath}"/>
       </map:transform>
-      <map:transform src="module:///../../../../xslt/util/strip_namespaces.xsl"/>
+      <map:transform src="module://lenya/util/strip_namespaces.xsl"/>
       <map:select type="parameter">
         <map:parameter name="parameter-selector-test" value="{statusCode}"/>
         <map:when test="">
           <map:serialize/>
         </map:when>
-        <!-- FIXME workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=32336 -->
-        <map:when test="404">
-          <map:serialize status-code="404"/>
-        </map:when>
         <map:otherwise>
           <map:serialize status-code="{statusCode}"/>
         </map:otherwise>
@@ -49,7 +45,6 @@
   </map:resources>
 
   <map:pipelines>
-
     <map:component-configurations>
       <global-variables>
         <cache-dir>work/cache</cache-dir>
@@ -95,8 +90,8 @@
       <map:handle-errors>
         <map:select type="exception">
            <map:when test="resourcenotfound">
-             <map:generate src="module:///../../../../content/util/empty.xml" />
-            <map:transform src="module:///../../../../xslt/exception/document-does-not-exist.xsl">
+             <map:generate src="module://lenya/util/empty.xml" />
+            <map:transform src="module://lenya/exception/document-does-not-exist.xsl">
               <map:parameter name="documentid" value="{page-envelope:document-id}"/>
               <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
             </map:transform>
@@ -106,7 +101,7 @@
           </map:when>
       <map:otherwise>
         <map:generate type="notifying"/>
-        <map:transform src="module:///../../../../../stylesheets/system/error2html.xslt">
+        <map:transform src="module://lenya/system/error2html.xslt">
           <map:parameter name="contextPath" value="{request:contextPath}"/>
         </map:transform>
       </map:otherwise>
@@ -129,7 +124,9 @@
           <map:part src="cocoon://navigation/{2}/{3}/search/{5}.xml"/>
           <map:part src="cocoon:/lenya-document-{1}/{3}/{4}/{page-envelope:document-path}" label="xdebug"/>
         </map:aggregate>
-        <map:transform src="module:///../../xslt/page2xhtml-{4}.xsl">
+<!-- WARNING: Different path needed by Global and Publication Modules. -->
+        <map:transform src="module:///../../pubs/{publication:publication}/xslt/page2xhtml-{4}.xsl">
+<!--        <map:transform src="module:///../../xslt/page2xhtml-{4}.xsl"> -->
           <map:parameter name="root" value="{page-envelope:context-prefix}/{2}/{3}"/>
           <map:parameter name="url" value="{5}"/>
           <map:parameter name="document-id" value="{page-envelope:document-id}"/>
@@ -165,14 +162,14 @@
               <map:match pattern="authoring/**.html">
                 <map:transform src="cocoon://lenya-page/{page-envelope:publication-id}/{../../1}.xml?doctype={page-envelope:document-type}"/>
               </map:match>
-              <map:transform src="module:///../../../../xslt/util/strip_namespaces.xsl"/>
+              <map:transform src="module://lenya/util/strip_namespaces.xsl"/>
               <map:serialize type="xhtml"/>
         </map:act>
 
         <!-- There is no version of the requested document-id for the
              requested language. -->
-        <map:generate type="serverpages" src="module:///../../../../content/exception/missing-language.xsp"/>
-        <map:transform src="module:///../../../../xslt/exception/missing-language.xsl"/>
+        <map:generate type="serverpages" src="module://lenya/exception/missing-language.xsp"/>
+        <map:transform src="module://lenya/exception/missing-language.xsl"/>
         <map:call resource="style-cms-page"/>
 
       </map:match>
@@ -180,8 +177,8 @@
       <map:handle-errors>
         <map:select type="exception">
           <map:when test="document-does-not-exist">
-            <map:generate src="module:///../../../../content/util/empty.xml"/>
-            <map:transform src="module:///../../../../xslt/exception/document-does-not-exist.xsl">
+            <map:generate src="module://lenya/util/empty.xml"/>
+            <map:transform src="module://lenya/exception/document-does-not-exist.xsl">
               <map:parameter name="documentid" value="{page-envelope:document-id}"/>
               <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
             </map:transform>
@@ -190,8 +187,8 @@
             </map:call>
           </map:when>
            <map:when test="resourcenotfound">
-             <map:generate src="module:///../../../../content/util/empty.xml" />
-            <map:transform src="module:///../../../../xslt/exception/document-does-not-exist.xsl">
+             <map:generate src="module://lenya/util/empty.xml" />
+            <map:transform src="module://lenya/exception/document-does-not-exist.xsl">
               <map:parameter name="documentid" value="{page-envelope:document-id}"/>
               <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
             </map:transform>
@@ -201,7 +198,7 @@
           </map:when>
       <map:otherwise>
         <map:generate type="notifying"/>
-        <map:transform src="module:///../../../../../stylesheets/system/error2html.xslt">
+        <map:transform src="module://lenya/system/error2html.xslt">
           <map:parameter name="contextPath" value="{request:contextPath}"/>
         </map:transform>
       </map:otherwise>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xml?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/authoring/module.xml Mon Jan 28 14:26:58 2008
@@ -1,14 +1,6 @@
-<module id="authoring" name="Authoring">
-   <version>
-      <minimum>1.2</minimum>
-      <created>1.3</created>
-      <content>hierarchical</content>
-   </version>
-   <dependencies>
-      <required id="navigation">Used to build pages</required>
-      <recommended id="edit">Failover if called by a flat content publication.</recommended>
-   </dependencies>
-<description>This is the Lenya 1.2 authoring code moved to a Module.  It only supports Hierarchical Content.</description>
-   <usage>
-   </usage>
+<module id="authoring" name="Authoring" minimum="1.2" created="1.3" content="hierarchical">
+   <required id="lenya">Required files.</required>
+   <required id="navigation">Used to build pages</required>
+   <recommended id="edit">Failover if called by a flat content publication.</recommended>
+   <description>This is the Lenya 1.2 authoring code moved to a Module.  It only supports Hierarchical Content.</description>
 </module>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xmap?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xmap Mon Jan 28 14:26:58 2008
@@ -40,13 +40,13 @@
             </map:select>
             <!-- Else Cache -->
                <map:generate src="cocoon://{page-envelope:publication-id}/{1}/cocoon/{1}/{2}"/>
-               <map:transform src="module:///../../../../xslt/authoring/edit/addSourceTags.xsl">
+               <map:transform src="module://lenya/edit/addSourceTags.xsl">
                   <map:parameter name="source" value="{module:cache-dir}/{1}/{2}"/>
                </map:transform>
                <map:transform type="write-source">
                   <map:parameter name="serializer" value="html-no-dtd"/>
                </map:transform>
-               <map:transform src="module:///../../../../xslt/authoring/edit/removeSourceTags.xsl"/>
+               <map:transform src="module://lenya/edit/removeSourceTags.xsl"/>
                <map:serialize type="html"/>
          </map:match>
       </map:pipeline>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xml?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/cache/module.xml Mon Jan 28 14:26:58 2008
@@ -1,14 +1,5 @@
-<module id="cache" name="Cache">
-<parameter name="cache-dir">module:///work/</parameter>
-<!-- Parameter was top-level -->
-   <version>
-      <minimum>1.2</minimum>
-      <created>1.3</created>
-   </version>
-   <parameters>
-<parameter name="cache-dir">module:///work/</parameter>
-   </parameters>
-<description>Handles smart caching of Resources.</description>
-   <usage>
-   </usage>
+<module id="cache" name="Cache" minimum="1.2" created="1.3">
+   <required id="lenya">Required files.</required>
+   <parameter name="cache-dir">module:///work/</parameter>
+   <description>Handles smart caching of Resources.</description>
 </module>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xmap?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xmap Mon Jan 28 14:26:58 2008
@@ -61,7 +61,7 @@
              </map:transform>
              <map:serialize type="xml"/>
              </map:act>
-            <map:generate src="module:///../../../../content/util/empty.xml"/>
+            <map:generate src="module://lenya/util/empty.xml"/>
             <map:serialize type="xml"/>
         </map:match>
         <map:match pattern="rinfo">

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xml?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/flat/module.xml Mon Jan 28 14:26:58 2008
@@ -1,10 +1,5 @@
-<module id="flat" name="MigrateHierarchicalToFlat">
-   <version>
-      <minimum>1.3</minimum>
-      <maximum>1.3.1</maximum>
-      <created>1.3</created>
-      <content>hierarchical</content>
-   </version>
+<module id="flat" name="MigrateHierarchicalToFlat" minimum="1.2" created="1.3" content="hierarchical" maximum="1.3.1">
+   <required id="lenya">Required files.</required>
    <description>Migrates hierarchical content to flat content.  Does not change the publication content type.</description>
    <usage>
 See 13UPGRADE.txt

Added: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/README.txt
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/README.txt?rev=616087&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/README.txt (added)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/README.txt Mon Jan 28 14:26:58 2008
@@ -0,0 +1,34 @@
+<module id="form" name="Form">
+   <version>
+      <minimum>1.2</minimum>
+      <created>1.3</created>
+   </version>
+<description>Handles forms.</description>
+<usage>
+=== post.xsp
+Creates XML from POST data.
+<map:generate type="serverpages" src="module://form/post.xsp"/>
+
+=== formfixer.xsl
+Adds the language to the ACTION for i18n-compatible URLs with CForms.
+
+=== forms-samples-styling.xsl
+From the Cocoon "form" block.
+Adds formatting to a form
+
+=== XMAP Usage of formfixer.xsl and forms-sampling.xsl
+
+To Generate the Form:
+<map:generate src="CForms-Template.xml"/>
+<map:transform type="forms"/>
+<map:transform src="module://form/formfixer.xsl">
+   <map:parameter name="language" value="{page-envelope:document-language}"/>
+</map:transform>
+<map:transform src="module://form/forms-samples-styling.xsl"/>
+
+For Continuation:
+<map:match pattern="**/*_*.more">
+   <map:call continuation="{2}"/>
+</map:match>
+</usage>
+</module>
\ No newline at end of file

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/module.xml?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/form/module.xml Mon Jan 28 14:26:58 2008
@@ -1,13 +1,9 @@
-<module id="form" name="Form">
-   <version>
-      <minimum>1.2</minimum>
-      <created>1.3</created>
-   </version>
+<module id="form" name="Form" minimum="1.2" created="1.3">
 <description>Handles forms.</description>
 <usage>
+See README.txt for example code.
 === post.xsp
 Creates XML from POST data.
-<map:generate type="serverpages" src="module://form/post.xsp"/>
 
 === formfixer.xsl
 Adds the language to the ACTION for i18n-compatible URLs with CForms.
@@ -17,18 +13,5 @@
 Adds formatting to a form
 
 === XMAP Usage of formfixer.xsl and forms-sampling.xsl
-
-To Generate the Form:
-<map:generate src="CForms-Template.xml"/>
-<map:transform type="forms"/>
-<map:transform src="module://form/formfixer.xsl">
-   <map:parameter name="language" value="{page-envelope:document-language}"/>
-</map:transform>
-<map:transform src="module://form/forms-samples-styling.xsl"/>
-
-For Continuation:
-<map:match pattern="**/*_*.more">
-   <map:call continuation="{2}"/>
-</map:match>
 </usage>
 </module>

Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/homepage/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/homepage/module.xml?rev=616087&r1=616086&r2=616087&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/homepage/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/homepage/module.xml Mon Jan 28 14:26:58 2008
@@ -1,13 +1,7 @@
-<module id="homepage" name="Homepage">
-   <version>
-      <minimum>1.3</minimum>
-      <created>1.3</created>
-   </version>
-   <dependencies>
-      <resourcePath>/xml</resourcePath>
-      <required id="navigation">For menus.</required>
-      <recommended id="cache">Improve performance by storing homepage for anonymous people.</recommended>
-   </dependencies>
+<module id="homepage" name="Homepage" minimum="1.3" created="1.3">
+   <resourcePath>/xml</resourcePath>
+   <required id="navigation">For menus.</required>
+   <recommended id="cache">Improve performance by storing homepage for anonymous people.</recommended>
    <description>Alternate layout for homepage.</description>
    <usage>
    </usage>



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