svn commit: r618280 - in /lenya/branches/revolution/1.3.x: ./ src/java/org/apache/lenya/cms/modules/ src/java/org/apache/lenya/util/ src/webapp/ src/webapp/lenya/modules/file/ src/webapp/lenya/modules/home/ src/webapp/lenya/modules/homepage/ src/webapp...
[email protected] Mon, 04 Feb 2008 13:40:06 -0000
Newsgroups
gmane.comp.cms.lenya.cvs
Message-ID
<[email protected] >
Author: solprovider
Date: Mon Feb 4 05:40:04 2008
New Revision: 618280
URL: http://svn.apache.org/viewvc?rev=618280&view=rev
Log:
Added PublicationModulesGenerator.
Added:
lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModulesGenerator.java
Modified:
lenya/branches/revolution/1.3.x/13TODO.txt
lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/Module.java
lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleInputModule.java
lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulesGenerator.java
lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModules.java
lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/Globals.java
lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/file/module.xml
lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/home/module.xml
lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/homepage/module.xml
lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/link/module.xml
lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/publication/module.xmap
lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/text/module.xml
lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/module.xml
lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xml/module.xml
lenya/branches/revolution/1.3.x/src/webapp/sitemap.xmap
Modified: lenya/branches/revolution/1.3.x/13TODO.txt
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/13TODO.txt?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/13TODO.txt (original)
+++ lenya/branches/revolution/1.3.x/13TODO.txt Mon Feb 4 05:40:04 2008
@@ -1,3 +1,5 @@
+DESIGN: Does Module differentiation by ContentType cause confusion with inheritance? A module overriding one type will intercept calls to all types.
+
Create New Resource: Publication has Resource Types. Use Generator. Choose Type. Create required languages. Use Transformer. Pass to Edit Module.
Edit-Save must clear Cache.
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=618280&r1=618279&r2=618280&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 Feb 4 05:40:04 2008
@@ -19,26 +19,27 @@
*/
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
+ Set inheritList = new LinkedHashSet(); // String names of other Modules in this publication.
+ Map requiredList = new TreeMap(); // required Modules: id = reason
+ Map recommendedList = new TreeMap(); // recommended Modules: id = reason
+ Map optionalList = new TreeMap(); // optional Modules: id = reason
Map variables = new HashMap(); // nameString = valueString
Map files; // filename -> actual location as String (Better as File or Source?)
File moduleDirectory;
private String type = Content.TYPE_DEFAULT;
- String id;
- String name;
- String minimum = "1.3";
- String maximum = "";
- String created = "1.3";
- long modified = 1;
- String resource = "";
- String description = "";
- String usage = "";
+ private String id;
+ private String name = "";
+ private String minimum = "1.3";
+ private String maximum = "";
+ private String created = "1.3";
+ private long modified = 1;
+ private String resource = "";
+ private String description = "";
+ private String usage = "";
+ private String publicationId = "";
public Module(File moduleDirectory, String publicationId) {
resetFiles();
- String pubIdError = (publicationId.length() > 1 ? publicationId + " - " : "");
+ this.publicationId = publicationId;
this.moduleDirectory = moduleDirectory;
id = moduleDirectory.getName();
File configFile = new File(moduleDirectory, MODULE_XML);
@@ -58,6 +59,7 @@
}catch(NumberFormatException nfe){
modified = 1;
}
+ // Resource
resource = config.getAttribute("resource", "");
if((resource.length() > 0) && !resource.endsWith("/" + id)){
if(resource.endsWith("/")){
@@ -74,7 +76,6 @@
usage = usageConf.getValue("");
// Required
Configuration[] requireds = config.getChildren("required");
- requiredList = new TreeMap();
int numRequireds = requireds.length;
for(int vR = 0; vR < numRequireds; vR++){
Configuration required = requireds[vR];
@@ -85,7 +86,6 @@
}
// Recommended
Configuration[] recommendeds = config.getChildren("recommended");
- recommendedList = new TreeMap();
int numrecommendeds = recommendeds.length;
for(int vR = 0; vR < numrecommendeds; vR++){
Configuration recommended = recommendeds[vR];
@@ -96,7 +96,6 @@
}
// Optional
Configuration[] optionals = config.getChildren("optional");
- optionalList = new TreeMap();
int numoptionals = optionals.length;
for(int vR = 0; vR < numoptionals; vR++){
Configuration optional = optionals[vR];
@@ -117,27 +116,33 @@
}
// Inherits
Configuration[] inherits = config.getChildren("inherit");
- inheritList = new TreeMap();
int numInherits = inherits.length;
for(int vI = 0; vI < numInherits; vI++){
Configuration inherit = inherits[vI];
// Get attributes
- String priority = inherit.getAttribute("priority", "");
- String publication = inherit.getAttribute("publication", "");
- String id = inherit.getAttribute("id", "");
- // Massage
- // 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 + "." : publicationId + ".";
- inheritList.put(priorityPrefix + "." + publicationPrefix + id, publicationPrefix + id);
+ String publication = inherit.getAttribute("publication", publicationId);
+ String module = inherit.getAttribute("id", id);
+ String key = publication + "." + module;
+ inheritList.add(key);
+ }
+ // Resource parents inherit after specified inheritance.
+ // Added from bottom to top: xml/xhtml/home inherits from xhtml then xml.
+ if(resource.length() > 0){
+ // System.out.println("RESOURCE " + resource + "=" + id);
+ String[] parents = resource.split("/");
+ for(int p = parents.length - 1; p > -1; p--){
+ String parent = parents[p];
+ if((parent.length() > 0) && (!parent.equalsIgnoreCase(id)) && (!inheritList.contains(parent))){
+ inheritList.add(parents[p]);
+ }
+ }
}
}catch(ConfigurationException e){
- System.out.println("Module " + pubIdError + id + " has a ConfigurationException.\n" + e.getLocalizedMessage());
+ System.out.println("Module " + publicationId + "." + id + " has a ConfigurationException.\n" + e.getLocalizedMessage());
}catch(SAXException e){
- System.out.println("Module " + pubIdError + id + " has a SAXException.\n" + e.getLocalizedMessage());
+ System.out.println("Module " + publicationId + "." + id + " has a SAXException.\n" + e.getLocalizedMessage());
}catch(IOException e){
- System.out.println("Module " + pubIdError + id + " has an IOException.\n" + e.getLocalizedMessage());
+ System.out.println("Module " + publicationId + "." + id + " has an IOException.\n" + e.getLocalizedMessage());
}
}
}
@@ -188,7 +193,7 @@
}
if(ret.length() < 1){
// Check Module Inheritance
- Iterator inherit = inheritList.entrySet().iterator();
+ Iterator inherit = inheritList.iterator();
while(inherit.hasNext() && (ret.length() < 1)){
ret = Modules.getModule((String) inherit.next(), type).getFile(filename);
}
@@ -212,7 +217,7 @@
}else{
Module module;
// Check Module Inheritance
- Iterator inherit = inheritList.entrySet().iterator();
+ Iterator inherit = inheritList.iterator();
while(inherit.hasNext() && (ret.length() < 1)){
module = Modules.getModule((String) inherit.next(), type);
if(null != module)
@@ -222,5 +227,28 @@
if(ret.length() > 0)
variables.put(parameterName, ret);
return ret;
+ }
+ /**
+ * Package only. Do not allow Modules implementation to escape package.
+ *
+ * @return publicationId.moduleId
+ */
+ String getKey() {
+ return publicationId + "." + id;
+ }
+ public String getResource() {
+ return resource;
+ }
+ public String getName() {
+ return name;
+ }
+ public String getDescription() {
+ return description;
+ }
+ public String getUsage() {
+ return usage;
+ }
+ public String getPublicationId() {
+ return publicationId;
}
}
Modified: 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=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleInputModule.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleInputModule.java Mon Feb 4 05:40:04 2008
@@ -24,11 +24,10 @@
*/
private String moduleId = "";
public Object getAttribute(String name, Configuration modeConf, Map objectModel) throws ConfigurationException {
- System.out.println(Globals.getObjectModel());
if(getLogger().isDebugEnabled()){
getLogger().debug("Resolving [" + name + "]");
}
- moduleId = Globals.getModule();
+ moduleId = Globals.getModuleId();
// Standard Variables
if(name.equalsIgnoreCase("module")){
return moduleId;
Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulesGenerator.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulesGenerator.java?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulesGenerator.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModulesGenerator.java Mon Feb 4 05:40:04 2008
@@ -3,6 +3,7 @@
import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.caching.CacheableProcessingComponent;
import org.apache.cocoon.generation.ServiceableGenerator;
@@ -84,12 +85,13 @@
private void handleModule(ContentHandler handler, Module module) throws SAXException {
AttributesImpl attributes = new AttributesImpl();
attributes.addAttribute(URI, ATTR_MODULE_TYPE, ATTR_MODULE_TYPE, "CDATA", module.getContentType());
- attributes.addAttribute(URI, ATTR_MODULE_NAME, ATTR_MODULE_NAME, "CDATA", module.name);
- if(module.resource.length() > 0){
- attributes.addAttribute(URI, ATTR_MODULE_TYPE, ATTR_MODULE_TYPE, "CDATA", module.resource);
+ attributes.addAttribute(URI, ATTR_MODULE_NAME, ATTR_MODULE_NAME, "CDATA", module.getName());
+ String resource = module.getResource();
+ if(resource.length() > 0){
+ attributes.addAttribute(URI, ATTR_MODULE_TYPE, ATTR_MODULE_TYPE, "CDATA", resource);
}
handler.startElement(URI, ELEMENT_MODULE, ELEMENT_MODULE, attributes);
- String description = module.description;
+ String description = module.getDescription();
int length = description.length();
if(length > 0){
handler.startElement(URI, ELEMENT_DESCRIPTION, ELEMENT_DESCRIPTION, null);
@@ -111,6 +113,16 @@
attributes.addAttribute(URI, ATTR_MODULE_ID, ATTR_MODULE_ID, "CDATA", (String) entry.getKey());
handler.startElement(URI, element, element, attributes);
handler.characters(description.toCharArray(), 0, description.length());
+ handler.endElement(URI, element, element);
+ }
+ }
+ private void handleList(ContentHandler handler, Set set, String element) throws SAXException {
+ Iterator iterator = set.iterator();
+ while(iterator.hasNext()){
+ String entry = (String) iterator.next();
+ AttributesImpl attributes = new AttributesImpl();
+ attributes.addAttribute(URI, ATTR_MODULE_ID, ATTR_MODULE_ID, "CDATA", entry);
+ handler.startElement(URI, element, element, attributes);
handler.endElement(URI, element, element);
}
}
Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModules.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModules.java?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModules.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModules.java Mon Feb 4 05:40:04 2008
@@ -6,7 +6,9 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.lenya.util.Globals;
/**
*
* @author solprovider
@@ -30,6 +32,8 @@
static Map variables = new HashMap(); // publication.module.variablename = value from publication.xconf
private String publicationId;
private String contentType;
+ private Map sourceModules = null;
+ private Map resources = null;
// Dev testing
Configuration config;
public PublicationModules(String publicationId, String contentType, Configuration config) {
@@ -123,7 +127,14 @@
} // Has name
} // element tag
} // for each child
+ // TODO: Templates should append all templates of inherited publications. Need to verify template has finished loading. Careful about locking loops -- this pub inherits from that pub inherits from another pub that inherits from this pub.
} // function
+ /**
+ * AllExternal overrides External.
+ *
+ * @param moduleId
+ * @return
+ */
public boolean isExternal(String moduleId) {
if(exclude.contains(moduleId))
return false;
@@ -157,6 +168,66 @@
// return (String) modules.get(moduleId);
// return moduleId;
// }
+ /**
+ * Returns Map("moduleId") = "inheritedFromPublication" Expected to be used only for Publication creation and modification (using the PublicationModulesGenerator) so performance (e.g. using a cache) is unimportant.
+ */
+ public Map getSourceModules() {
+ if(null != sourceModules){
+ return sourceModules;
+ }
+ Map modules = new HashMap();
+ Set modulesList = new HashSet();
+ if(allAllowed){ // Every module from local, global, and inherited publications.
+ Iterator iterator = Modules.modules.keySet().iterator();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+ String[] parts = key.split("\\.", 2);
+ String publication = parts[0];
+ // TODO: Add inherited pubs' inheritance.
+ if((publication.length() < 1) || publication.equalsIgnoreCase(publicationId) || templates.contains(publication)){
+ String module = parts[1];
+ if(!exclude.contains(module)){
+ // System.out.println("KEY=" + key + " P=" + publication + " M=" + module);
+ modulesList.add(module);
+ }
+ }
+ }
+ }else{ // Only included
+ modulesList = external.keySet();
+ }
+ // Get current
+ resources = new TreeMap();
+ Iterator iterator = modulesList.iterator();
+ while(iterator.hasNext()){
+ String moduleId = (String) iterator.next();
+ String filepath = getFile(moduleId, ".", false);
+ String inheritedModuleId = Globals.getModuleId(filepath);
+ String inheritedPublication = Globals.getPublicationId(filepath);
+ Module inheritedModule = Modules.getModule(inheritedPublication, inheritedModuleId, contentType);
+ if(null == inheritedModule){
+ System.out.println(moduleId + "Module found at " + filepath + " could not be opened as Publication " + inheritedPublication + " Module " + inheritedModuleId);
+ }else{
+ String resource = inheritedModule.getResource();
+ if(resource.length() > 0){
+ resources.put(resource, inheritedModule);
+ }
+ // System.out.println("FP=" + filepath + " MI=" + moduleId + " P=" + inheritedPublication + " M=" + inheritedModuleId + " R=" + resource);
+ modules.put(moduleId, inheritedModule);
+ }
+ }
+ // TODO: Add required modules?
+ return modules;
+ }
+ /**
+ *
+ * @return Alphabetically sorted Set of resource name Strings.
+ */
+ public Map getResources() {
+ if(null == resources){
+ getSourceModules();
+ }
+ return resources;
+ }
public String getVariable(String moduleId, String varname) {
// TODO: Add reset. Do InputModules support double colon syntax?
if(exclude.contains(moduleId))
Added: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModulesGenerator.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModulesGenerator.java?rev=618280&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModulesGenerator.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/PublicationModulesGenerator.java Mon Feb 4 05:40:04 2008
@@ -0,0 +1,87 @@
+package org.apache.lenya.cms.modules;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.caching.CacheableProcessingComponent;
+import org.apache.cocoon.generation.ServiceableGenerator;
+import org.apache.excalibur.source.SourceValidity;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.util.Globals;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+public class PublicationModulesGenerator extends ServiceableGenerator implements CacheableProcessingComponent {
+ private static final String PREFIX = "publication";
+ private static final String URI = "http://apache.org/lenya/1.3/" + PREFIX;
+ private static final String ELEMENT_TOP = "modules";
+ private static final String ELEMENT_MODULE = "module";
+ private static final String ATTR_MODULE_ID = "id";
+ private static final String ATTR_MODULE_SOURCE_PUBLICATION = "publication";
+ private static final String ATTR_MODULE_SOURCE_MODULE = "module";
+ private static final String ELEMENT_RESOURCE = "resource";
+ private static final String ATTR_RESOURCE = "resource";
+ private static final String ATTR_MODULE_NAME = "name";
+ private static final String ATTR_PUB_ID = "publication";
+ public Serializable getKey() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ public SourceValidity getValidity() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ public void generate() throws IOException, SAXException, ProcessingException {
+ Publication publication = Globals.getPublication();
+ PublicationModules modules = publication.getModules();
+ Map modulesMap = modules.getSourceModules();
+ Map resources = modules.getResources();
+ ContentHandler handler = this.contentHandler;
+ handler.startDocument();
+ handler.startPrefixMapping(PREFIX, URI);
+ AttributesImpl attributes = new AttributesImpl();
+ // attributes.addAttribute("", "xmlns", "xmlns", "CDATA", URI);
+ attributes.addAttribute(URI, ATTR_PUB_ID, ATTR_PUB_ID, "CDATA", publication.getId());
+ // attributes.addAttribute("xmlns", PREFIX, "xmlns:" + PREFIX, "CDATA", URI);
+ handler.startElement(URI, ELEMENT_TOP, ELEMENT_TOP, attributes);
+ handleResources(handler, resources);
+ handleModules(handler, modulesMap);
+ handler.endElement(URI, ELEMENT_TOP, ELEMENT_TOP);
+ handler.endDocument();
+ }
+ private void handleResources(ContentHandler handler, Map resources) throws SAXException {
+ Iterator moduleI = resources.entrySet().iterator();
+ while(moduleI.hasNext()){
+ Map.Entry entry = (Map.Entry) moduleI.next();
+ String resource = (String) entry.getKey();
+ Module module = (Module) entry.getValue();
+ String publicationId = module.getPublicationId();
+ String moduleId = module.getId();
+ AttributesImpl attributes = new AttributesImpl();
+ attributes.addAttribute(URI, ATTR_RESOURCE, ATTR_RESOURCE, "CDATA", resource);
+ attributes.addAttribute(URI, ATTR_MODULE_SOURCE_PUBLICATION, ATTR_MODULE_SOURCE_PUBLICATION, "CDATA", publicationId);
+ attributes.addAttribute(URI, ATTR_MODULE_SOURCE_MODULE, ATTR_MODULE_SOURCE_MODULE, "CDATA", moduleId);
+ attributes.addAttribute(URI, ATTR_MODULE_NAME, ATTR_MODULE_NAME, "CDATA", module.getName());
+ handler.startElement(URI, ELEMENT_RESOURCE, ELEMENT_RESOURCE, attributes);
+ handler.endElement(URI, ELEMENT_RESOURCE, ELEMENT_RESOURCE);
+ }
+ }
+ private void handleModules(ContentHandler handler, Map modules) throws SAXException {
+ Iterator moduleI = modules.entrySet().iterator();
+ while(moduleI.hasNext()){
+ Map.Entry entry = (Map.Entry) moduleI.next();
+ String moduleKey = (String) entry.getKey();
+ Module module = (Module) entry.getValue();
+ String publicationId = module.getPublicationId();
+ String moduleId = module.getId();
+ AttributesImpl attributes = new AttributesImpl();
+ attributes.addAttribute(URI, ATTR_MODULE_ID, ATTR_MODULE_ID, "CDATA", moduleKey);
+ attributes.addAttribute(URI, ATTR_MODULE_SOURCE_PUBLICATION, ATTR_MODULE_SOURCE_PUBLICATION, "CDATA", publicationId);
+ attributes.addAttribute(URI, ATTR_MODULE_SOURCE_MODULE, ATTR_MODULE_SOURCE_MODULE, "CDATA", moduleId);
+ attributes.addAttribute(URI, ATTR_MODULE_NAME, ATTR_MODULE_NAME, "CDATA", module.getName());
+ handler.startElement(URI, ELEMENT_MODULE, ELEMENT_MODULE, attributes);
+ handler.endElement(URI, ELEMENT_MODULE, ELEMENT_MODULE);
+ }
+ }
+}
Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/Globals.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/Globals.java?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/Globals.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/Globals.java Mon Feb 4 05:40:04 2008
@@ -51,12 +51,44 @@
public static final Long getExpires() {
return (Long) getObjectModel().get(ObjectModelHelper.EXPIRES_OBJECT);
}
- static public String getModule() {
+ static public String getModuleId() {
Source source = getSource();
if(null == source)
return "";
+ return getModuleId(source.getURI());
+ }
+ /**
+ * Retrieves ModuleId parsing after "modules". Works with filepath and URIs. Empty string returns empty string.
+ *
+ * @param filepath
+ * @return
+ */
+ static public String getModuleId(String filepath) {
+ if(filepath.length() < 1){
+ return "";
+ }
+ String ret = "";
+ String[] strings = filepath.split("^(.*)modules");
+ if(1 < strings.length){
+ strings = strings[1].split("[/\\\\]");
+ if(1 < strings.length){
+ ret = strings[1];
+ }
+ }
+ return ret;
+ }
+ /**
+ * Retrieves PublicationId parsing after "pubs". Works with filepath and URIs. Empty string returns empty string.
+ *
+ * @param filepath
+ * @return
+ */
+ static public String getPublicationId(String filepath) {
+ if(filepath.length() < 1){
+ return "";
+ }
String ret = "";
- String[] strings = source.getURI().split("^(.*)modules");
+ String[] strings = filepath.split("^(.*)pubs");
if(1 < strings.length){
strings = strings[1].split("[/\\\\]");
if(1 < strings.length){
Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/file/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/file/module.xml?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/file/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/file/module.xml Mon Feb 4 05:40:04 2008
@@ -1,14 +1,6 @@
-<module id="file" name="File">
- <version>
- <minimum>1.3</minimum>
- <created>1.3</created>
- <content>flat</content>
- </version>
- <dependencies>
- <resourcePath>/</resourcePath>
+<module id="file" name="File" resource="/" minimum="1.3" created="1.3" content="flat">
<required id="form">Required.</required>
<recommended id="edit">Because.</recommended>
- </dependencies>
<description>Handles binary file Resources.</description>
<usage>
</usage>
Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/home/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/home/module.xml?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/home/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/home/module.xml Mon Feb 4 05:40:04 2008
@@ -1,7 +1,8 @@
-<module id="homepage" name="Homepage" inherit="xhtml" minimum="1.3" created="1.3" resourcePath="/xml/xhtml">
+<module id="home" name="Home" inherit="xhtml" minimum="1.3" created="1.3" resource="/xml/xhtml">
<!-- Homepage Concept was originally xml/homepage Resource type. This should be child of /xml/xhtml and inherit xmap from live/xml/xhtml.
Allows removal of special case in live/module.xmap once 1.2 backwards-compatibility is not needed.
Change migration (flat) module. -->
+ <inherit id="xhtml">For processing as an XHTML Resource.</inherit>
<description>Alternate XSL for home resource type.</description>
<usage>
</usage>
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=618280&r1=618279&r2=618280&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 Feb 4 05:40:04 2008
@@ -1,5 +1,4 @@
-<module id="homepage" name="Homepage" minimum="1.3" created="1.3">
- <resourcePath>/xml</resourcePath>
+<module id="homepage" name="Homepage" minimum="1.3" created="1.3" resource="/xml/xhtml">
<required id="navigation">For menus.</required>
<recommended id="cache">Improve performance by storing homepage for anonymous people.</recommended>
<description>Alternate layout for homepage.</description>
Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/link/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/link/module.xml?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/link/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/link/module.xml Mon Feb 4 05:40:04 2008
@@ -1,4 +1,4 @@
-<module id="link" name="Link" minimum="1.3" created="1.3" content="flat" resourcePath="/">
+<module id="link" name="Link" minimum="1.3" created="1.3" content="flat" resource="/">
<required id="form">?Because.</required>
<recommended id="edit">For editing</recommended>
<description>Link Resource Type</description>
Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/publication/module.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/publication/module.xmap?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/publication/module.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/publication/module.xmap Mon Feb 4 05:40:04 2008
@@ -3,8 +3,14 @@
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:pipelines>
<map:pipeline>
+ <map:match pattern="{module:module}/all">
<map:generate type="modules"/>
<map:serialize type="xml"/>
+ </map:match>
+ <map:match pattern="{module:module}/*">
+ <map:generate type="publication-modules"/>
+ <map:serialize type="xml"/>
+ </map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/text/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/text/module.xml?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/text/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/text/module.xml Mon Feb 4 05:40:04 2008
@@ -1,7 +1,4 @@
-<module id="text" name="Text" minimum="1.2" created="1.3">
- <dependencies>
- <resourcePath>/</resourcePath>
- </dependencies>
+<module id="text" name="Text" minimum="1.2" created="1.3" resource="/">
<description>Text Resource Type</description>
<usage>
This will be the base resource type for non-XML text resources such as CSS and JavaScript files.
Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/module.xml?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xhtml/module.xml Mon Feb 4 05:40:04 2008
@@ -1,4 +1,4 @@
-<module id="xhtml" name="XHTML" minimum="1.3" created="1.3" content="hierarchical">
+<module id="xhtml" name="XHTML" minimum="1.3" created="1.3" content="hierarchical" resource="/xml">
<required id="lenya">Required files.</required>
<description>XHTML Resource Type</description>
</module>
Modified: lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xml/module.xml
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xml/module.xml?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xml/module.xml (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/lenya/modules/xml/module.xml Mon Feb 4 05:40:04 2008
@@ -1,12 +1,5 @@
-<module id="xml" name="XML">
- <version>
- <minimum>1.2</minimum>
- <created>1.3</created>
- </version>
- <dependencies>
- <resourcePath>/</resourcePath>
- <required id="form">Because.</required>
- </dependencies>
+<module id="xml" name="XML" minimum="1.2" created="1.3" resource="/">
+ <required id="form">Because.</required>
<description>XML Resource Type</description>
<usage>
</usage>
Modified: lenya/branches/revolution/1.3.x/src/webapp/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/webapp/sitemap.xmap?rev=618280&r1=618279&r2=618280&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/webapp/sitemap.xmap (original)
+++ lenya/branches/revolution/1.3.x/src/webapp/sitemap.xmap Mon Feb 4 05:40:04 2008
@@ -49,7 +49,8 @@
<!-- LENYA1.3 BEGIN -->
<map:generator name="sitetree" label="content,data" logger="sitemap.generator.sitetree" src="org.apache.lenya.cms.content.flat.SitetreeGenerator"/>
<map:generator name="modules" label="content,data" logger="sitemap.generator.modules" src="org.apache.lenya.cms.modules.ModulesGenerator"/>
-<!-- From Lenya-1.2.x -->
+ <map:generator name="publication-modules" label="content,data" logger="sitemap.generator.publicationmodules" src="org.apache.lenya.cms.modules.PublicationModulesGenerator"/>
+ <!-- From Lenya-1.2.x -->
<map:generator name="sitetree2" logger="sitemap.generator.sitetree" pool-grow="2" pool-max="16" pool-min="2" src="org.apache.lenya.cms.cocoon.generation.SiteTreeGenerator"/>
<!-- LENYA1.3 END -->
</map:generators>