svn commit: r635107 [5/7] - in /lenya/branches/revolution/1.3.x: ./ src/cocoon/ src/java/org/apache/cocoon/components/source/ src/java/org/apache/lenya/ac/ src/java/org/apache/lenya/ac/cache/ src/java/org/apache/lenya/ac/file/ src/java/org/apache/lenya...

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatRelations.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatRelations.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatRelations.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatRelations.java Sat Mar  8 14:58:32 2008
@@ -15,24 +15,27 @@
    File file;
    Document relations;
    Element root;
-   Map map;
-   public FlatRelations(File pfile) {
-      file = pfile;
-      reset();
+   Map map = new HashMap();
+   public FlatRelations(File file) {
+      // System.out.println("FlatRelations FILE=" + file.getName() + (file.exists() ? " EXISTS" : " MISSING"));
+      this.file = file;
+      if(file.exists()){
+         reset();
+      }
    }
    public void reset() {
+      map = new HashMap(); // Initialize map before chance of errors.
       try{
          relations = DocumentHelper.readDocument(file);
-         map = new HashMap();
          root = relations.getDocumentElement();
          addResourceToMap(root);
-         // WORK: Log Catches properly
+         // TODO: Log Catches properly
       }catch(javax.xml.parsers.ParserConfigurationException pce){
          System.out.println("FlatRelations 1: Could not parse " + file.toString());
       }catch(org.xml.sax.SAXException saxe){
          System.out.println("FlatRelations 2: Could not parse " + file.toString());
       }catch(java.io.IOException ioe){
-         // File not found. Expected for non-Lenya1.3 pubs.
+         // File not found. Expected for non-Lenya-1.3 pubs.
       }
    }
    private void addResourceToMap(Element root) {
@@ -41,16 +44,39 @@
       for(int i = 0; i < length; i++){
          Element resource = (Element) resources.item(i);
          map.put(resource.getAttribute("full"), resource.getAttribute("unid"));
-         addResourceToMap(resource);
+         // System.out.println("FlatRelations " + resource.getAttribute("unid") + "=" + resource.getAttribute("full"));
+         // Recurse is unnecessary as getElementsByTagName returns all descendants.
+         // addResourceToMap(resource);
       }
    }
    public Element getRoot() {
       return root;
    }
-   public String getUNID(String unid) {
+   public String getUNID(String id) {
+      if(null == map){
+         System.out.println("FlatRelations.getUNID map=null");
+         return "";
+      }
+      if(null == id){
+         System.out.println("FlatRelations.getUNID unid=null");
+         return "";
+      }
       update();
-      if(map.containsKey(unid))
-         return (String) map.get(unid);
+      // Fix ID to start with one and only one slash.
+      String workId = id;
+      int pos = workId.indexOf('/');
+      if(pos == 0){
+         while('/' == workId.charAt(pos)){
+            pos++;
+         }
+         workId = workId.substring(pos);
+      }
+      workId = '/' + workId;
+      if(map.containsKey(workId)){
+         // System.out.println("FlatRelations.getUNID FOUND " + id + " -> " + workId + " -> " + (String) map.get(workId));
+         return (String) map.get(workId);
+      }
+      // System.out.println("FlatRelations.getUNID MISSING " + id + " -> " + workId);
       return "";
    }
    private void update() {

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatResource.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatResource.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatResource.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatResource.java Sat Mar  8 14:58:32 2008
@@ -3,8 +3,14 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import javax.xml.parsers.ParserConfigurationException;
+import org.apache.lenya.cms.content.Location;
 import org.apache.lenya.cms.content.Resource;
+import org.apache.lenya.cms.content.ResourceException;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.util.Globals;
 import org.apache.lenya.xml.DocumentHelper;
+import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -14,69 +20,105 @@
  * @since 1.3
  */
 public class FlatResource implements Resource {
-   File contentDirectory;
-   File resourceDirectory;
-   Document resource;
-   Element root;
-   String unid = "";
-   String id = "";
-   String type = "xml";
-   String doctype = "";
-   String defaultLanguage = "en";
-   String defaultLanguageParameter = "";
-   String defaultRevision = "live";
-   String extension = "";
-   String[] languages;
+   private static final String FILENAME_RESOURCE = "resource.xml";
+   private File contentDirectory;
+   private File resourceDirectory;
+   private Document resource;
+   private Element root;
+   private String unid = "";
+   private String id = "";
+   private String type = "";
+   private String doctype = "";
+   private String defaultLanguage = "en";
+   private String defaultLanguageParameter = "";
+   private String defaultRevision = "live";
+   // private String extension = ""; //Moved to revision
+   private String[] languages;
    boolean isChanged = false;
-   public FlatResource(File directory, String punid, String language, String revision) {
+   public FlatResource(File directory, String unid, String language, String revision) {
       contentDirectory = directory;
-      unid = punid;
+      this.unid = unid;
       if(language.length() > 0)
          defaultLanguage = language;
       defaultRevision = revision;
       init(false);
    }
-   public FlatResource(File directory, String punid, String language) {
+   public FlatResource(File directory, String unid, String language) {
       contentDirectory = directory;
-      unid = punid;
+      this.unid = unid;
       if(language.length() > 0)
          defaultLanguage = language;
       init(false);
    }
-   public FlatResource(File directory, String punid) {
+   public FlatResource(File directory, String unid) {
       contentDirectory = directory;
-      unid = punid;
+      this.unid = unid;
       init(true);
    }
-   private void init(boolean puseDefaultLanguage) {
-      boolean useDefaultLanguage = puseDefaultLanguage;
-      // Check if unid_lang!revision format
-      int pos = unid.lastIndexOf("!");
-      if(pos > 0){
-         defaultRevision = unid.substring(pos);
-         unid = unid.substring(0, pos);
-      }
-      pos = unid.lastIndexOf("_");
-      if(pos > 0){
-         defaultLanguage = unid.substring(pos + 1);
-         unid = unid.substring(0, pos);
-         useDefaultLanguage = false;
+   private void init(boolean useDefaultLanguage) {
+      // System.out.println("FlatResource.init BEGIN UNID=" + unid);
+      boolean workUseDefaultLanguage = useDefaultLanguage;
+      Location location = new Location(unid);
+      // Remove extra parts.
+      unid = location.getUnid();
+      // Revision
+      String tmpString = location.getRevision();
+      if(0 < tmpString.length()){
+         defaultRevision = tmpString;
+      }
+      // Language
+      tmpString = location.getLanguage();
+      if(0 < tmpString.length()){
+         defaultLanguage = tmpString;
+         workUseDefaultLanguage = false;
+      }else if(workUseDefaultLanguage){
+         if(defaultLanguageParameter.length() > 0){
+            defaultLanguage = defaultLanguageParameter;
+         }
       }
-      // TODO: defaultLanguage = Publication's default language.
       resourceDirectory = new File(contentDirectory, "resource" + File.separator + unid);
+      Publication pub = Globals.getPublication();
+      if(null != pub){
+         // Use Publication's Default Language. Only possible during Request.
+         if(1 > defaultLanguage.length()){
+            defaultLanguage = pub.getDefaultLanguage();
+         }
+         // unid may be id during Request. If not valid unid, translate id to unid.
+         // DESIGN: Can Content Structures be available outside a Publication?
+         String workUnid = unid;
+         int pos = unid.indexOf('/');
+         if(!resourceDirectory.exists()){
+            // Check structure named before first slash
+            // DESIGN: Use String.split()?
+            String structure = "live";
+            if(pos > 0){
+               structure = workUnid.substring(0, pos);
+               workUnid = workUnid.substring(pos);
+            }
+            workUnid = pub.getContent().getUNID(structure, workUnid);
+            if(0 != workUnid.length()){
+               resourceDirectory = new File(contentDirectory, "resource" + File.separator + workUnid);
+            }
+         }
+         if(!resourceDirectory.exists()){
+            // Check live structure
+            workUnid = pub.getContent().getUNID("live", unid);
+            if(0 != workUnid.length()){
+               resourceDirectory = new File(contentDirectory, "resource" + File.separator + workUnid);
+            }
+         }
+         unid = workUnid;
+      }
+      // System.out.println("FlatResource.init USING UNID=" + unid);
+      if(!resourceDirectory.exists()){
+         return;
+      }
       try{
-         resource = DocumentHelper.readDocument(new File(resourceDirectory, "resource.xml"));
+         resource = DocumentHelper.readDocument(new File(resourceDirectory, FILENAME_RESOURCE));
          root = resource.getDocumentElement();
          if(root.hasAttribute("defaultlanguage")){
             defaultLanguageParameter = root.getAttribute("defaultlanguage");
          }
-         if(useDefaultLanguage){
-            if(defaultLanguageParameter.length() > 0){
-               defaultLanguage = defaultLanguageParameter;
-            }else{
-               // TODO: Use Publication's Default Language
-            }
-         }
          if(root.hasAttribute("doctype"))
             doctype = root.getAttribute("doctype");
          if(root.hasAttribute("type"))
@@ -94,9 +136,30 @@
          languages = (String[]) list.toArray(new String[0]);
          Arrays.sort(languages);
       }catch(javax.xml.parsers.ParserConfigurationException pce){
+         System.out.println("FlatResource.init ParserConfigurationException UNID=" + unid);
       }catch(org.xml.sax.SAXException saxe){
+         System.out.println("FlatResource.init SAXException UNID=" + unid);
       }catch(java.io.IOException ioe){
+         // Expected for Lenya-1.2 Publications
+         // System.out.println("FlatResource.init IOException UNID=" + unid);
+      }
+      // Fix type
+      String workType = doctype;
+      String[] parts = doctype.split("/");
+      if(parts[parts.length - 1].length() > 0){
+         workType = parts[parts.length - 1];
+      }else if((parts.length > 1) && (parts[parts.length - 2].length() > 0)){
+         workType = parts[parts.length - 2];
+      }else{
+         parts = type.split("/");
+         if(parts[parts.length - 1].length() > 0){
+            workType = parts[parts.length - 1];
+         }else if((parts.length > 1) && (parts[parts.length - 2].length() > 0)){
+            workType = parts[parts.length - 2];
+         }
       }
+      doctype = workType;
+      type = workType;
    }
    public String getURI() {
       return getTranslation(defaultLanguage).getURI();
@@ -116,6 +179,9 @@
    public String getType() {
       return type;
    }
+   /**
+    * @deprecated Use getType()
+    */
    public String getDocumentType() {
       return doctype;
    }
@@ -161,11 +227,12 @@
    /**
     * Get variable for Index Filters
     */
-   public String get(String property, String fullid, String fulltype, String fulldoctype) {
+   // public String get(String property, String fullid, String fulltype, String fulldoctype) {
+   public String get(String property, String fullid, String fulltype) {
       if(property.equalsIgnoreCase("type")){
          return fulltype;
-      }else if(property.equalsIgnoreCase("doctype")){
-         return fulldoctype;
+         // }else if(property.equalsIgnoreCase("doctype")){
+         // return fulldoctype;
       }
       return get(property, fullid);
    }
@@ -254,30 +321,32 @@
       if(doctype.length() > 0)
          root.setAttribute("doctype", doctype);
       String tmp;
-      for(int l = 0; l < languages.length; l++){
-         Element te = addElement(document, root, "translation");
-         te.setAttribute("language", languages[l]);
-         FlatTranslation translation = getTranslation(languages[l]);
-         tmp = translation.getEdit();
-         if(tmp.length() > 0)
-            te.setAttribute("edit", tmp);
-         tmp = translation.getLive();
-         if(tmp.length() > 0)
-            te.setAttribute("live", tmp);
-         String[] revisions = translation.getRevisions();
-         for(int r = 0; r < revisions.length; r++){
-            Element re = addElement(document, te, "revision");
-            re.setAttribute("revision", revisions[r]);
-            FlatRevision revision = translation.getRevision(revisions[r]);
-            tmp = revision.getTitle();
-            if(tmp.length() > 0)
-               re.setAttribute("title", tmp);
-            tmp = revision.getExtension();
+      if(null != languages){
+         for(int l = 0; l < languages.length; l++){
+            Element te = addElement(document, root, "translation");
+            te.setAttribute("language", languages[l]);
+            FlatTranslation translation = getTranslation(languages[l]);
+            tmp = translation.getEdit();
             if(tmp.length() > 0)
-               re.setAttribute("extension", tmp);
-            tmp = revision.getHREF();
+               te.setAttribute("edit", tmp);
+            tmp = translation.getLive();
             if(tmp.length() > 0)
-               re.setAttribute("href", tmp);
+               te.setAttribute("live", tmp);
+            String[] revisions = translation.getRevisions();
+            for(int r = 0; r < revisions.length; r++){
+               Element re = addElement(document, te, "revision");
+               re.setAttribute("revision", revisions[r]);
+               FlatRevision revision = translation.getRevision(revisions[r]);
+               tmp = revision.getTitle();
+               if(tmp.length() > 0)
+                  re.setAttribute("title", tmp);
+               tmp = revision.getExtension();
+               if(tmp.length() > 0)
+                  re.setAttribute("extension", tmp);
+               tmp = revision.getHREF();
+               if(tmp.length() > 0)
+                  re.setAttribute("href", tmp);
+            }
          }
       }
       return document;
@@ -306,7 +375,7 @@
          if(translation.hasAttribute("action")){
             String action = translation.getAttribute("action");
             if(action.equalsIgnoreCase("delete")){
-               System.out.println("FlatResource.update - Delete Translation");
+               // System.out.println("FlatResource.update - Delete Translation");
                deleteTranslation(language);
                exist = false;
             }
@@ -326,13 +395,13 @@
             NodeList revisions = translation.getElementsByTagName("revision");
             int revisionslength = revisions.getLength();
             for(int r = 0; r < revisionslength; r++){
-               System.out.println("FlatResource.update - BEFORE");
+               // System.out.println("FlatResource.update - BEFORE");
                Element revision = (Element) revisions.item(r);
-               System.out.println("FlatResource.update - AFTER");
+               // System.out.println("FlatResource.update - AFTER");
                if(revision.hasAttribute("action")){
                   String action = revision.getAttribute("action");
                   if(action.equalsIgnoreCase("delete")){
-                     System.out.println("FlatResource.update - Delete Revision");
+                     // System.out.println("FlatResource.update - Delete Revision");
                      String revisionid = revision.getAttribute("revision");
                      ft.deleteRevision(revisionid);
                   }
@@ -341,6 +410,8 @@
             ft.save();
          }
       }
+      // Update Indexes
+      ((FlatContent) Globals.getPublication().getContent()).updateIndexes();
       // System.out.println("FlatResource.update - RETURN");
       return document;
    }
@@ -358,7 +429,7 @@
    }
    private void deleteTranslation(String language) {
       File translationDirectory = new File(resourceDirectory, language);
-      System.out.println("DELETE=" + translationDirectory.getAbsolutePath());
+      // System.out.println("DELETE=" + translationDirectory.getAbsolutePath());
       deleteFile(translationDirectory);
    }
    // TODO: Backup before delete. Use renameTo() to move outside the resource directory.
@@ -379,13 +450,13 @@
          try{
             doc = DocumentHelper.readDocument(file);
          }catch(javax.xml.parsers.ParserConfigurationException pce){
-            System.out.println("FlatResource.save - ParserConfigurationException:" + file.getAbsolutePath());
+            System.out.println("FlatResource.save - ParserConfigurationException: " + file.getAbsolutePath());
             return;
          }catch(org.xml.sax.SAXException saxe){
-            System.out.println("FlatResource.save - SAXException:" + file.getAbsolutePath());
+            System.out.println("FlatResource.save - SAXException: " + file.getAbsolutePath());
             return;
          }catch(java.io.IOException ioe){
-            System.out.println("FlatResource.save - Could not read file:" + file.getAbsolutePath());
+            System.out.println("FlatResource.save - Could not read file: " + file.getAbsolutePath());
             return;
          }
          root = doc.getDocumentElement();
@@ -394,13 +465,70 @@
          try{
             DocumentHelper.writeDocument(doc, file);
          }catch(javax.xml.transform.TransformerConfigurationException tce){
-            System.out.println("FlatResource.save - TransformerConfigurationException:" + file.getAbsolutePath());
+            System.out.println("FlatResource.save - TransformerConfigurationException: " + file.getAbsolutePath());
          }catch(javax.xml.transform.TransformerException te){
-            System.out.println("FlatResource.save - TransformerException:" + file.getAbsolutePath());
+            System.out.println("FlatResource.save - TransformerException: " + file.getAbsolutePath());
          }catch(java.io.IOException ioe2){
-            System.out.println("FlatResource.save - Could not write file:" + file.getAbsolutePath());
+            System.out.println("FlatResource.save - Could not write file: " + file.getAbsolutePath());
          }
-      }
+       }
       isChanged = false;
+   }
+   // <?xml version="1.0" encoding="UTF-8"?>
+   // <resource defaultlanguage="en" doctype="xhtml" id="doctypes" type="xml" unid="0002" xmlns=""/>
+   // TODO: Working here.
+   // TODO: Create specific Exception
+   static public FlatResource create(String unid, String type, String id) throws ResourceException {
+      String workUnid = unid;
+      if(unid.length() < 1){
+         workUnid = Globals.createUUID();
+      }
+      Publication publication = Globals.getPublication();
+      File contentDirectory = publication.getContentDirectory();
+      File resourceDirectory = new File(contentDirectory, "resource" + File.separator + workUnid);
+      if(resourceDirectory.exists()){
+         System.out.println("FlatResource.create: Resource creation failed because the Resource '" + workUnid + "' already exists." + resourceDirectory.getAbsolutePath());
+         throw new ResourceException("Resource creation failed because the Resource '" + workUnid + "' already exists: " + resourceDirectory.getAbsolutePath());
+      }
+      resourceDirectory.mkdirs();
+      File resource = new File(resourceDirectory, FILENAME_RESOURCE);
+      Document xml;
+      try{
+         xml = DocumentHelper.createDocument("", "resource", null);
+      }catch(DOMException e){
+         System.out.println("CreateResource: DOMException");
+         throw new ResourceException("CreateResource: DOMException", e);
+      }catch(ParserConfigurationException e){
+         System.out.println("CreateResource: ParserConfigurationException");
+         throw new ResourceException("CreateResource: ParserConfigurationException", e);
+      }
+      Element root = xml.getDocumentElement();
+      root.setAttribute("unid", workUnid);
+      root.setAttribute("id", id);
+      root.setAttribute("creator", Globals.getUser());
+      root.setAttribute("when", Globals.getDateString());
+      String workType = type;
+      int pos = type.lastIndexOf('/');
+      if(pos > 0)
+         workType = type.substring(pos + 1);
+      root.setAttribute("type", workType);
+      root.setAttribute("doctype", workType);
+      // TODO: Throw these Exceptions.
+      try{
+         DocumentHelper.writeDocument(xml, resource);
+      }catch(javax.xml.transform.TransformerConfigurationException tce){
+         System.out.println("CreateResource: TransformerConfigurationException");
+         throw new ResourceException("CreateResource: TransformerConfigurationException", tce);
+      }catch(javax.xml.transform.TransformerException te){
+         System.out.println("CreateResource: TransformerException");
+         throw new ResourceException("CreateResource: TransformerException", te);
+      }catch(java.io.IOException ioe){
+         System.out.println("CreateResource: IOException writing XML file.");
+         throw new ResourceException("CreateResource: IOException writing XML file: " + resource.getAbsolutePath(), ioe);
+      }
+      // Update Indexes
+      ((FlatContent) publication.getContent()).updateIndexes();
+      // Return
+      return new FlatResource(contentDirectory, workUnid);
    }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatTranslation.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatTranslation.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatTranslation.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/FlatTranslation.java Sat Mar  8 14:58:32 2008
@@ -2,6 +2,7 @@
 import java.io.File;
 import java.util.SortedSet;
 import java.util.TreeSet;
+import org.apache.lenya.util.Globals;
 import org.apache.lenya.xml.DocumentHelper;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -102,8 +103,10 @@
    public String getURI() {
       if(null == fr)
          fr = getRevision();
-      if(null == fr)
+      if(null == fr){
+         // System.out.println("FlatTranslation.getURI no revision.");
          return "";
+      }
       return fr.getURI();
    }
    public String getMetaURI() {
@@ -114,7 +117,7 @@
       return fr.getMetaURI();
    }
    public String getNewURI() {
-      String newRevision = getDateString();
+      String newRevision = Globals.getDateString();
       // WORK: Change Edit to newRevision
       return new File(translationDirectory, newRevision + ".xml").getPath();
    }
@@ -159,9 +162,6 @@
          return null;
       return new FlatRevision(translationDirectory, rev);
    }
-   private String getDateString() {
-      return Long.toString(new java.util.Date().getTime());
-   }
    void setLive(String revision) {
       live = revision;
       isChanged = true;
@@ -188,6 +188,7 @@
          }catch(java.io.IOException ioe2){
             System.out.println("FlatTranslation.save - Could not write file:" + file.getAbsolutePath());
          }
+         // TODO: Update indexes for this language.
       }
       isChanged = false;
    }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/SitetreeGenerator.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/SitetreeGenerator.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/SitetreeGenerator.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/flat/SitetreeGenerator.java Sat Mar  8 14:58:32 2008
@@ -12,9 +12,10 @@
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
 import org.apache.excalibur.source.SourceValidity;
+import org.apache.lenya.cms.content.Content;
 import org.apache.lenya.cms.publication.PageEnvelope;
-import org.apache.lenya.cms.publication.PageEnvelopeFactory;
 import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.util.Globals;
 import org.xml.sax.SAXException;
 /**
  * The <code>SitetreeGenerator</code> is a class that reads XML from a source and generates SAX Events. The SitetreeGenerator implements the <code>CacheableProcessingComponent</code> interface.
@@ -50,23 +51,20 @@
       super.setup(resolver, objectModel, src, par);
       try{
          PageEnvelope envelope;
-         // String publication = "FAILED";
-         Publication pub;
+         Publication pub = Globals.getPublication();
          String language = "en";
          try{
-            envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
-            pub = envelope.getPublication();
-            // publication = pub.getId();
+            envelope = PageEnvelope.getCurrent();
             language = envelope.getDocument().getLanguage();
          }catch(org.apache.lenya.cms.publication.PageEnvelopeException pee){
-            System.out.println("PEE EXCEPTION");
+            System.out.println("Sitetree Generator: could not use PageEnvelope.");
             throw new ProcessingException("Sitetree Generator: could not use PageEnvelope.");
          }
-         // Lenya1.3
-         if(pub.getContentType().equalsIgnoreCase("flat")){
+         // Lenya-1.3
+         if(pub.getContentType().equalsIgnoreCase(Content.TYPE_FLAT)){
             this.inputSource = super.resolver.resolveURI(pub.getContent().getIndexFilename(src, language));
          }else{
-            // Lenya1.2
+            // Lenya-1.2
             File testfile = new File(pub.getContentDirectory(), src + File.separator + "sitetree.xml");
             if(!testfile.exists())
                testfile = new File(pub.getContentDirectory(), "live" + File.separator + "sitetree.xml");

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalContent.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalContent.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalContent.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalContent.java Sat Mar  8 14:58:32 2008
@@ -2,6 +2,8 @@
 import java.io.File;
 import org.apache.lenya.cms.content.Content;
 import org.apache.lenya.cms.content.Resource;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.util.Globals;
 /**
  * 
  * @author solprovider
@@ -10,9 +12,9 @@
 public class HierarchicalContent implements Content {
    File directory;
    String[] languages = {"en"};
-   public HierarchicalContent(File pdirectory, String[] planguages) {
-      directory = pdirectory;
-      languages = planguages;
+   public HierarchicalContent(File directory, String[] languages) {
+      this.directory = directory;
+      this.languages = languages;
    }
    /* Content API */
    public String getIndexFilename(String indexName, String language) {
@@ -27,24 +29,22 @@
    }
    public String getURI(String unid, String language, String revision) {
       String area = revision;
-      if(area.equalsIgnoreCase("edit"))
-         area = "authoring";
+      if(area.equalsIgnoreCase("edit")){
+         area = Publication.AUTHORING_AREA;
+      }
       return new File(directory, area + unid + File.separator + "index_" + language + ".xml").getPath();
    }
    public String getMetaURI(String unid, String language, String revision) {
       String area = revision;
       if(area.equalsIgnoreCase("edit"))
-         area = "authoring";
+         area = Publication.AUTHORING_AREA;
       return new File(directory, area + unid + File.separator + "index_" + language + ".xml").getPath();
    }
    public String getNewURI(String unid, String language) {
-      return new File(directory, "live" + unid + File.separator + getDateString() + "_" + language + ".xml").getPath();
-   }
-   private String getDateString() {
-      return Long.toString(new java.util.Date().getTime());
+      return new File(directory, "live" + unid + File.separator + Globals.getDateString() + "_" + language + ".xml").getPath();
    }
    public Resource getResource(String unid) {
       // TODO: HierarchicalResource
-      return (Resource) null;
+      return (Resource) new HierarchicalResource(directory, unid);
    }
 }

Added: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalResource.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalResource.java?rev=635107&view=auto
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalResource.java (added)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/content/hierarchical/HierarchicalResource.java Sat Mar  8 14:58:32 2008
@@ -0,0 +1,109 @@
+package org.apache.lenya.cms.content.hierarchical;
+import java.io.File;
+import org.apache.lenya.cms.content.Location;
+import org.apache.lenya.cms.content.Resource;
+import org.apache.lenya.cms.publication.DocumentException;
+import org.apache.lenya.cms.publication.PageEnvelope;
+import org.apache.lenya.cms.publication.PageEnvelopeException;
+import org.apache.lenya.cms.publication.Publication;
+import org.w3c.dom.Document;
+/**
+ * ContentInputModule requires a Resource. <br>
+ * Deciding doctype would be better handled in Modules.
+ * 
+ * @author solprovider
+ * @since 1.3
+ */
+public class HierarchicalResource implements Resource {
+   private org.apache.lenya.cms.publication.Document doc;
+   private File contentDirectory;
+   private String language;
+   private String id;
+   private String area;
+   public HierarchicalResource(File contentDirectory, String unid) {
+      System.out.println("HierarchicalResource UNID=" + unid);
+      this.contentDirectory = contentDirectory;
+      Location location = new Location(unid);
+      id = location.getUnid();
+      language = location.getLanguage();
+      area = Publication.LIVE_AREA;
+      try{
+         PageEnvelope pe = PageEnvelope.getCurrent();
+         doc = pe.getDocument();
+         if(unid.equals(doc.getId())){
+            // If using current document, use doc from PageEnvelope.
+            area = doc.getArea();
+            language = doc.getLanguage();
+         }else{
+            doc = null;
+         }
+      }catch(PageEnvelopeException e){
+      }
+   }
+   public String getURI() {
+      if(null != doc){
+         return doc.getFile().getPath();
+      }
+      return new File(contentDirectory, area + id + File.separator + "index_" + language + ".xml").getPath();
+   }
+   public String getMetaURI() {
+      return getURI();
+   }
+   public String getNewURI() {
+      return "";
+   }
+   public String getUNID() {
+      return id;
+   }
+   public String getID() {
+      return id;
+   }
+   public String getType() {
+      return "xml";
+   }
+   public String getDocumentType() {
+      // System.out.println("HierarchicalResource.getDocumentType ID=" + id);
+      // Was returning "cocoon/{id}"
+      if(id.equalsIgnoreCase("index")){
+         return "homepage";
+      }
+      return "xhtml";
+   }
+   public String getLanguage() {
+      return language;
+   }
+   public String getDefaultLanguage() {
+      if(null != doc){
+         return doc.getLanguage();
+      }
+      return "";
+   }
+   public String[] getLanguages() {
+      if(null != doc){
+         try{
+            return doc.getLanguages();
+         }catch(DocumentException e){
+         }
+      }
+      return null;
+   }
+   public Document getInfoDocument() {
+      return null;
+   }
+   public Document update(Document document) {
+      return null;
+   }
+   public String getTitle() {
+      return getTitle(getDefaultLanguage());
+   }
+   public String getTitle(String language) {
+      if(null != doc){
+         return doc.getName();
+      }
+      return null;
+   }
+   public String getTitle(String language, String revision) {
+      // Hierarchical content does not support Revisions.
+      return getTitle(language);
+   }
+}

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=635107&r1=635106&r2=635107&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 Sat Mar  8 14:58:32 2008
@@ -8,11 +8,10 @@
  * @since 1.3
  */
 public class ModuleSet {
-   // TODO: Rewrite to use Map(type) = Module. Needs to handle >2 Types.
+   // Rewritten to use Map(type) = Module. Needed to handle >2 Types.
+   // DESIGN: Remove types because will cause problems with inheritance.
    Map modules = new HashMap();
    String defaultType;
-   // Module flat = null;
-   // Module hierarchical = null;
    public ModuleSet(Module module) {
       String type = module.getContentType();
       modules.put(type, module);

Modified: 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=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleSourceFactory.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/modules/ModuleSourceFactory.java Sat Mar  8 14:58:32 2008
@@ -28,7 +28,7 @@
       this.context = context;
    }
    public Source getSource(String location, Map parameters) throws IOException, MalformedURLException {
-      // System.out.println("MSF LOC=" + location);
+      // System.out.println("ModuleSourceFactory LOC=" + location);
       int pos;
       SourceResolver resolver = null;
       ComponentManager manager = CocoonComponentManager.getSitemapComponentManager();
@@ -79,10 +79,10 @@
             if(endpos > 0){
                moduleId = location.substring(pos, endpos);
                filepath = location.substring(endpos + 1);
-               // System.out.println("MSF MOD=" + module + " FIL=" + filepath);
+               // System.out.println("ModuleSourceFactory MOD=" + module + " FIL=" + filepath);
             }else{
                moduleId = location.substring(pos);
-               // System.out.println("MSF MOD=" + module + " POS=" + pos);
+               // System.out.println("ModuleSourceFactory MOD=" + module + " POS=" + pos);
             }
          }else{
             pos = location.indexOf(":/");

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/DocumentHelper.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/DocumentHelper.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/DocumentHelper.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/DocumentHelper.java Sat Mar  8 14:58:32 2008
@@ -14,253 +14,192 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.publication;
-
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
-
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
 import org.apache.lenya.util.ServletHelper;
-
 /**
  * Helper class to handle documents from XSP.
  */
 public class DocumentHelper {
-
-    private Map objectModel;
-
-    /**
-     * Ctor.
-     * 
-     * @param objectModel The Cocoon object model.
-     */
-    public DocumentHelper(Map objectModel) {
-        this.objectModel = objectModel;
-    }
-
-    /**
-     * Creates a document URL.<br/>
-     * If the document ID is null, the current document ID is used.<br/>
-     * If the document area is null, the current area is used.<br/>
-     * If the language is null, the current language is used.
-     * @param documentId The target document ID.
-     * @param documentArea The target area.
-     * @param language The target language.
-     * @return A string.
-     * @throws ProcessingException if something went wrong.
-     */
-    public String getDocumentUrl(String documentId, String documentArea, String language)
-        throws ProcessingException {
-
-        String url = null;
-        try {
-            PageEnvelope envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
-
-            if (documentId == null) {
-                documentId = envelope.getDocument().getId();
-            }
-
-            Request request = ObjectModelHelper.getRequest(objectModel);
-
-            if (documentArea == null) {
-                String webappUrl = ServletHelper.getWebappURI(request);
-                URLInformation info = new URLInformation(webappUrl);
-                String completeArea = info.getCompleteArea();
-                documentArea = completeArea;
-            }
-
-            if (language == null) {
-                language = envelope.getDocument().getLanguage();
-            }
-
-            Publication publication = envelope.getPublication();
-            DocumentBuilder builder = publication.getDocumentBuilder();
-
-            url = builder.buildCanonicalUrl(publication, documentArea, documentId, language);
-
-            String contextPath = request.getContextPath();
-            if (contextPath == null) {
-                contextPath = "";
-            }
-
-            url = contextPath + url;
-
-        } catch (Exception e) {
-            throw new ProcessingException(e);
-        }
-
-        return url;
-
-    }
-
-    /**
-     * Returns the complete URL of the parent document. If the document is a top-level document,
-     * the /index document is chosen. If the parent does not exist in the appropriate language, the
-     * default language is chosen.
-     * 
-     * @return A string.
-     * @throws ProcessingException when something went wrong.
-     */
-    public String getCompleteParentUrl() throws ProcessingException {
-
-        PageEnvelope envelope;
-        try {
-            envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
-        } catch (PageEnvelopeException e) {
-            throw new ProcessingException(e);
-        }
-
-        Document document = envelope.getDocument();
-        Publication publication = envelope.getPublication();
-
-        Request request = ObjectModelHelper.getRequest(objectModel);
-        String webappUrl = ServletHelper.getWebappURI(request);
-        URLInformation info = new URLInformation(webappUrl);
-        String completeArea = info.getCompleteArea();
-        DocumentBuilder builder = publication.getDocumentBuilder();
-
-        String parentId;
-
-        int lastSlashIndex = document.getId().lastIndexOf("/");
-        if (lastSlashIndex > 0) {
-            parentId = document.getId().substring(0, lastSlashIndex);
-        } else {
-            parentId = "/index";
-        }
-
-        String parentUrl = builder.buildCanonicalUrl(publication, completeArea, parentId);
-        Document parentDocument;
-
-        try {
-            parentDocument = builder.buildDocument(publication, parentUrl);
-            parentDocument = getExistingLanguageVersion(parentDocument, document.getLanguage());
-        } catch (Exception e) {
-            throw new ProcessingException(e);
-        }
-        parentUrl =
-            builder.buildCanonicalUrl(
-                publication,
-                completeArea,
-                parentDocument.getId(),
-                parentDocument.getLanguage());
-
-        String contextPath = request.getContextPath();
-        if (contextPath == null) {
+   private Map objectModel;
+   /**
+    * Ctor.
+    * 
+    * @param objectModel
+    *           The Cocoon object model.
+    */
+   public DocumentHelper(Map objectModel) {
+      this.objectModel = objectModel;
+   }
+   /**
+    * Creates a document URL.<br/> If the document ID is null, the current document ID is used.<br/> If the document area is null, the current area is used.<br/> If the language is null, the current language is used.
+    * 
+    * @param documentId
+    *           The target document ID.
+    * @param documentArea
+    *           The target area.
+    * @param language
+    *           The target language.
+    * @return A string.
+    * @throws ProcessingException
+    *            if something went wrong.
+    */
+   public String getDocumentUrl(String documentId, String documentArea, String language) throws ProcessingException {
+      String url = null;
+      try{
+         PageEnvelope envelope = PageEnvelope.getCurrent();
+         if(documentId == null){
+            documentId = envelope.getDocument().getId();
+         }
+         Request request = ObjectModelHelper.getRequest(objectModel);
+         if(documentArea == null){
+            String webappUrl = ServletHelper.getWebappURI(request);
+            URLInformation info = new URLInformation(webappUrl);
+            String completeArea = info.getCompleteArea();
+            documentArea = completeArea;
+         }
+         if(language == null){
+            language = envelope.getDocument().getLanguage();
+         }
+         Publication publication = envelope.getPublication();
+         DocumentBuilder builder = publication.getDocumentBuilder();
+         url = builder.buildCanonicalUrl(publication, documentArea, documentId, language);
+         String contextPath = request.getContextPath();
+         if(contextPath == null){
             contextPath = "";
-        }
-
-        return contextPath + parentUrl;
-    }
-
-    /**
-     * Returns an existing language version of a document. If the document exists in the default
-     * language, the default language version is returned. Otherwise, a random language version is
-     * returned. If no language version exists, a DocumentException is thrown.
-     * 
-     * @param document The document.
-     * @return A document.
-     * @throws DocumentException when an error occurs.
-     */
-    public static Document getExistingLanguageVersion(Document document) throws DocumentException {
-        return getExistingLanguageVersion(document, document.getPublication().getDefaultLanguage());
-    }
-    /**
-     * Returns an existing language version of a document. If the document exists in the preferred
-     * language, this version is returned. Otherwise, if the document exists in the default
-     * language, the default language version is returned. Otherwise, a random language version is
-     * returned. If no language version exists, a DocumentException is thrown.
-     * 
-     * @param document The document.
-     * @param preferredLanguage The preferred language.
-     * @return A document.
-     * @throws DocumentException when an error occurs.
-     */
-    public static Document getExistingLanguageVersion(Document document, String preferredLanguage)
-        throws DocumentException {
-
-        Publication publication = document.getPublication();
-        DocumentBuilder builder = publication.getDocumentBuilder();
-
-        String[] languages = document.getLanguages();
-
-        if (languages.length == 0) {
-            throw new DocumentException(
-                "The document [" + document.getId() + "] does not exist in any language!");
-        }
-
-        List languageList = Arrays.asList(languages);
-
-        String existingLanguage = null;
-
-        if (languageList.contains(preferredLanguage)) {
-            existingLanguage = preferredLanguage;
-        } else if (languageList.contains(publication.getDefaultLanguage())) {
-            existingLanguage = publication.getDefaultLanguage();
-        } else {
-            existingLanguage = languages[0];
-        }
-
-        document = builder.buildLanguageVersion(document, existingLanguage);
-
-        return document;
-    }
-
-    /**
-     * Returns the parent document of a document in the same language.
-     * @param document The document.
-     * @return A document or <code>null</code> if the document parameter is a top-level document.
-     * @throws ProcessingException when the parent document could not be created.
-     */
-    public static Document getParentDocument(Document document) throws ProcessingException {
-
-        Document parent = null;
-        String id = document.getId();
-        int lastSlashIndex = id.lastIndexOf("/");
-        if (lastSlashIndex > 0) {
-            String parentId = id.substring(0, lastSlashIndex);
-            Publication publication = document.getPublication();
-            DocumentBuilder builder = publication.getDocumentBuilder();
-            String url =
-                builder.buildCanonicalUrl(
-                    publication,
-                    document.getArea(),
-                    parentId,
-                    document.getLanguage());
-            try {
-                parent = builder.buildDocument(publication, url);
-            } catch (DocumentBuildException e) {
-                throw new ProcessingException(e);
-            }
-        }
-
-        return parent;
-    }
-
-    /** 
-     * Returns e.g. context:/lenya/pubs/default/content/authoring/tutorial/index_en.xml
-     * @param document The document to calculate the path for.
-     * @return The path of a document within Lenya (excluding the servlet context).
-     */
-    public String getSourceUri(final Document document) {
-        return 
-            "context:/" // Use lenya:/ protocoll here later
-            + Publication.PUBLICATION_PREFIX_URI 
-            + "/"
-            + document.getPublication().getId()
-            + "/"
-            + Publication.CONTENT_PATH
-            + "/"
-            + document.getArea()
-            + "/"
-            + document.getPublication().getPathMapper().getPath(
-                    document.getId(),
-                    document.getLanguage());
-        
-    }
+         }
+         url = contextPath + url;
+      }catch(Exception e){
+         throw new ProcessingException(e);
+      }
+      return url;
+   }
+   /**
+    * Returns the complete URL of the parent document. If the document is a top-level document, the /index document is chosen. If the parent does not exist in the appropriate language, the default language is chosen.
+    * 
+    * @return A string.
+    * @throws ProcessingException
+    *            when something went wrong.
+    */
+   public String getCompleteParentUrl() throws ProcessingException {
+      PageEnvelope envelope;
+      try{
+         envelope = PageEnvelope.getCurrent();
+      }catch(PageEnvelopeException e){
+         throw new ProcessingException(e);
+      }
+      Document document = envelope.getDocument();
+      Publication publication = envelope.getPublication();
+      Request request = ObjectModelHelper.getRequest(objectModel);
+      String webappUrl = ServletHelper.getWebappURI(request);
+      URLInformation info = new URLInformation(webappUrl);
+      String completeArea = info.getCompleteArea();
+      DocumentBuilder builder = publication.getDocumentBuilder();
+      String parentId;
+      int lastSlashIndex = document.getId().lastIndexOf("/");
+      if(lastSlashIndex > 0){
+         parentId = document.getId().substring(0, lastSlashIndex);
+      }else{
+         parentId = "/index";
+      }
+      String parentUrl = builder.buildCanonicalUrl(publication, completeArea, parentId);
+      Document parentDocument;
+      try{
+         parentDocument = builder.buildDocument(publication, parentUrl);
+         parentDocument = getExistingLanguageVersion(parentDocument, document.getLanguage());
+      }catch(Exception e){
+         throw new ProcessingException(e);
+      }
+      parentUrl = builder.buildCanonicalUrl(publication, completeArea, parentDocument.getId(), parentDocument.getLanguage());
+      String contextPath = request.getContextPath();
+      if(contextPath == null){
+         contextPath = "";
+      }
+      return contextPath + parentUrl;
+   }
+   /**
+    * Returns an existing language version of a document. If the document exists in the default language, the default language version is returned. Otherwise, a random language version is returned. If no language version exists, a DocumentException is thrown.
+    * 
+    * @param document
+    *           The document.
+    * @return A document.
+    * @throws DocumentException
+    *            when an error occurs.
+    */
+   public static Document getExistingLanguageVersion(Document document) throws DocumentException {
+      return getExistingLanguageVersion(document, document.getPublication().getDefaultLanguage());
+   }
+   /**
+    * Returns an existing language version of a document. If the document exists in the preferred language, this version is returned. Otherwise, if the document exists in the default language, the default language version is returned. Otherwise, a random language version is returned. If no language version exists, a DocumentException is thrown.
+    * 
+    * @param document
+    *           The document.
+    * @param preferredLanguage
+    *           The preferred language.
+    * @return A document.
+    * @throws DocumentException
+    *            when an error occurs.
+    */
+   public static Document getExistingLanguageVersion(Document document, String preferredLanguage) throws DocumentException {
+      Publication publication = document.getPublication();
+      DocumentBuilder builder = publication.getDocumentBuilder();
+      String[] languages = document.getLanguages();
+      if(languages.length == 0){
+         throw new DocumentException("The document [" + document.getId() + "] does not exist in any language!");
+      }
+      List languageList = Arrays.asList(languages);
+      String existingLanguage = null;
+      if(languageList.contains(preferredLanguage)){
+         existingLanguage = preferredLanguage;
+      }else if(languageList.contains(publication.getDefaultLanguage())){
+         existingLanguage = publication.getDefaultLanguage();
+      }else{
+         existingLanguage = languages[0];
+      }
+      document = builder.buildLanguageVersion(document, existingLanguage);
+      return document;
+   }
+   /**
+    * Returns the parent document of a document in the same language.
+    * 
+    * @param document
+    *           The document.
+    * @return A document or <code>null</code> if the document parameter is a top-level document.
+    * @throws ProcessingException
+    *            when the parent document could not be created.
+    */
+   public static Document getParentDocument(Document document) throws ProcessingException {
+      Document parent = null;
+      String id = document.getId();
+      int lastSlashIndex = id.lastIndexOf("/");
+      if(lastSlashIndex > 0){
+         String parentId = id.substring(0, lastSlashIndex);
+         Publication publication = document.getPublication();
+         DocumentBuilder builder = publication.getDocumentBuilder();
+         String url = builder.buildCanonicalUrl(publication, document.getArea(), parentId, document.getLanguage());
+         try{
+            parent = builder.buildDocument(publication, url);
+         }catch(DocumentBuildException e){
+            throw new ProcessingException(e);
+         }
+      }
+      return parent;
+   }
+   /**
+    * Returns e.g. context:/lenya/pubs/default/content/authoring/tutorial/index_en.xml
+    * 
+    * @param document
+    *           The document to calculate the path for.
+    * @return The path of a document within Lenya (excluding the servlet context).
+    */
+   public String getSourceUri(final Document document) {
+      return "context:/" // Use lenya:/ protocoll here later
+            + Publication.PUBLICATION_PREFIX_URI + "/" + document.getPublication().getId() + "/" + Publication.CONTENT_PATH + "/" + document.getArea() + "/" + document.getPublication().getPathMapper().getPath(document.getId(), document.getLanguage());
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilder.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilder.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilder.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilder.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.cms.publication;
 
 import java.io.File;
-
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
 import org.apache.lenya.cms.authoring.ParentChildCreatorInterface;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/PageEnvelope.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/PageEnvelope.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/PageEnvelope.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/PageEnvelope.java Sat Mar  8 14:58:32 2008
@@ -198,6 +198,9 @@
     */
    static public PageEnvelope getCurrent() throws PageEnvelopeException {
       Request request = Globals.getRequest();
+      if(null == request){
+         throw new PageEnvelopeException("Cannot access a PageEnvelope without a Request.");
+      }
       Object o = request.getAttribute(PageEnvelope.class.getName());
       if(null != o){
          return (PageEnvelope) o;

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=635107&r1=635106&r2=635107&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 Sat Mar  8 14:58:32 2008
@@ -20,12 +20,9 @@
 package org.apache.lenya.cms.publication;
 
 import java.io.File;
-
+import org.apache.lenya.cms.content.Content;
 import org.apache.lenya.cms.modules.PublicationModules;
 import org.apache.lenya.cms.publishing.PublishingEnvironment;
-// LENYA1.3 - BEGIN
-import org.apache.lenya.cms.content.Content;
-// LENYA1.3 - END
 
 
 /**

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/SiteTreeNodeImpl.java Sat Mar  8 14:58:32 2008
@@ -21,7 +21,6 @@
 
 import java.util.ArrayList;
 import java.util.List;
-
 import org.apache.lenya.xml.DocumentHelper;
 import org.apache.lenya.xml.NamespaceHelper;
 import org.apache.log4j.Logger;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/file/FilePublication.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/file/FilePublication.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/file/FilePublication.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/file/FilePublication.java Sat Mar  8 14:58:32 2008
@@ -21,7 +21,6 @@
 
 import java.io.File;
 import java.io.IOException;
-
 import org.apache.commons.io.FileUtils;
 import org.apache.lenya.cms.publication.AbstractPublication;
 import org.apache.lenya.cms.publication.Document;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentLanguagesHelper.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentLanguagesHelper.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentLanguagesHelper.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentLanguagesHelper.java Sat Mar  8 14:58:32 2008
@@ -14,82 +14,79 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.publication.xsp;
-
 import java.util.Map;
-
 import org.apache.cocoon.ProcessingException;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentBuilder;
 import org.apache.lenya.cms.publication.PageEnvelope;
 import org.apache.lenya.cms.publication.PageEnvelopeException;
-import org.apache.lenya.cms.publication.PageEnvelopeFactory;
-
 /**
  * Helper class for the policy GUI.
  */
 public class DocumentLanguagesHelper {
-
-    private PageEnvelope pageEnvelope = null;
-
-    /**
-	 * Create a new DocumentlanguageHelper.
-	 * 
-	 * @param objectModel the objectModel
-	 * 
-	 * @throws ProcessingException if the page envelope could not be created.
-	 */
-    public DocumentLanguagesHelper(Map objectModel) throws ProcessingException {
-        try {
-            this.pageEnvelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
-        } catch (PageEnvelopeException e) {
-            throw new ProcessingException(e);
-        }
-    }
-
-    /**
-	 * Compute the URL for a given language and the parameters given in the contructor.
-	 * 
-	 * @param language the language
-	 * 
-	 * @return the url for the given language
-	 * 
-	 * @throws ProcessingException if the document for the given language could not be created.
-	 */
-    public String getUrl(String language) throws ProcessingException {
-        Document doc = getDocument(language);
-        return pageEnvelope.getContext() + doc.getCompleteURL();
-    }
-
-    /**
-	 * Compute the info area URL for a given language and the parameters given in the contructor.
-	 * 
-	 * @param language the language
-	 * 
-	 * @return the url for the given language
-	 * 
-	 * @throws ProcessingException if the document for the given language could not be created.
-	 */
-    public String getInfoUrl(String language) throws ProcessingException {
-        Document doc = getDocument(language);
-        return pageEnvelope.getContext() + doc.getCompleteInfoURL();
-    }
-
-    /**
-	 * Create a document for a given language and the parameters given in the contructor.
-	 * 
-	 * @param language the language
-	 * 
-	 * @return the document with the given language
-	 * 
-	 * @throws ProcessingException if the document for the given language could not be created.
-	 */
-    protected Document getDocument(String language) throws ProcessingException {
-        DocumentBuilder builder = pageEnvelope.getPublication().getDocumentBuilder();
-        Document document = builder.buildLanguageVersion(pageEnvelope.getDocument(), language);
-        return document;
-    }
+   private PageEnvelope pageEnvelope = null;
+   /**
+    * Create a new DocumentlanguageHelper.
+    * 
+    * @param objectModel
+    *           the objectModel
+    * 
+    * @throws ProcessingException
+    *            if the page envelope could not be created.
+    */
+   public DocumentLanguagesHelper(Map objectModel) throws ProcessingException {
+      try{
+         this.pageEnvelope = PageEnvelope.getCurrent();
+      }catch(PageEnvelopeException e){
+         throw new ProcessingException(e);
+      }
+   }
+   /**
+    * Compute the URL for a given language and the parameters given in the contructor.
+    * 
+    * @param language
+    *           the language
+    * 
+    * @return the url for the given language
+    * 
+    * @throws ProcessingException
+    *            if the document for the given language could not be created.
+    */
+   public String getUrl(String language) throws ProcessingException {
+      Document doc = getDocument(language);
+      return pageEnvelope.getContext() + doc.getCompleteURL();
+   }
+   /**
+    * Compute the info area URL for a given language and the parameters given in the contructor.
+    * 
+    * @param language
+    *           the language
+    * 
+    * @return the url for the given language
+    * 
+    * @throws ProcessingException
+    *            if the document for the given language could not be created.
+    */
+   public String getInfoUrl(String language) throws ProcessingException {
+      Document doc = getDocument(language);
+      return pageEnvelope.getContext() + doc.getCompleteInfoURL();
+   }
+   /**
+    * Create a document for a given language and the parameters given in the contructor.
+    * 
+    * @param language
+    *           the language
+    * 
+    * @return the document with the given language
+    * 
+    * @throws ProcessingException
+    *            if the document for the given language could not be created.
+    */
+   protected Document getDocument(String language) throws ProcessingException {
+      DocumentBuilder builder = pageEnvelope.getPublication().getDocumentBuilder();
+      Document document = builder.buildLanguageVersion(pageEnvelope.getDocument(), language);
+      return document;
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java Sat Mar  8 14:58:32 2008
@@ -29,7 +29,6 @@
 import org.apache.lenya.cms.publication.DocumentIdToPathMapper;
 import org.apache.lenya.cms.publication.PageEnvelope;
 import org.apache.lenya.cms.publication.PageEnvelopeException;
-import org.apache.lenya.cms.publication.PageEnvelopeFactory;
 import org.apache.lenya.cms.publication.PathToDocumentIdMapper;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.SiteTree;
@@ -54,7 +53,7 @@
     */
    public DocumentReferencesHelper(Map objectModel) throws ProcessingException {
       try{
-         this.pageEnvelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
+         this.pageEnvelope = PageEnvelope.getCurrent();
       }catch(PageEnvelopeException e){
          throw new ProcessingException(e);
       }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/DefaultFilePublisher.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/DefaultFilePublisher.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/DefaultFilePublisher.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/DefaultFilePublisher.java Sat Mar  8 14:58:32 2008
@@ -23,7 +23,6 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.StringTokenizer;
-
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.lenya.cms.task.ExecutionException;
 import org.apache.log4j.Category;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ResourceFilePublisher.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ResourceFilePublisher.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ResourceFilePublisher.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ResourceFilePublisher.java Sat Mar  8 14:58:32 2008
@@ -23,10 +23,9 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.StringTokenizer;
-
+import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FilenameUtils;
-import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.lenya.cms.task.ExecutionException;
 import org.apache.log4j.Category;
 

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/AntTask.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/AntTask.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/AntTask.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/AntTask.java Sat Mar  8 14:58:32 2008
@@ -26,7 +26,6 @@
 import java.util.GregorianCalendar;
 import java.util.Iterator;
 import java.util.Map;
-
 import org.apache.avalon.framework.parameters.ParameterException;
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.lenya.cms.publishing.PublishingEnvironment;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/TaskParameters.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/TaskParameters.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/TaskParameters.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/TaskParameters.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.cms.task;
 
 import java.util.Map;
-
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.PublicationException;
 import org.apache.lenya.cms.publication.PublicationFactory;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/TaskWrapper.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/TaskWrapper.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/TaskWrapper.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/task/TaskWrapper.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.cms.task;
 
 import java.util.Map;
-
 import org.apache.lenya.xml.NamespaceHelper;
 import org.w3c.dom.Element;
 

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/workflow/CMSHistory.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/workflow/CMSHistory.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/workflow/CMSHistory.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/workflow/CMSHistory.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.cms.workflow;
 
 import java.io.File;
-
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentIdToPathMapper;
 import org.apache.lenya.cms.publication.Publication;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/workflow/RoleCondition.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/workflow/RoleCondition.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/workflow/RoleCondition.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/workflow/RoleCondition.java Sat Mar  8 14:58:32 2008
@@ -21,7 +21,6 @@
 
 import java.util.HashSet;
 import java.util.Set;
-
 import org.apache.lenya.workflow.Situation;
 import org.apache.lenya.workflow.WorkflowException;
 import org.apache.lenya.workflow.WorkflowInstance;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/IndexFiles.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/IndexFiles.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/IndexFiles.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/IndexFiles.java Sat Mar  8 14:58:32 2008
@@ -21,7 +21,6 @@
 
 import java.io.File;
 import java.util.Date;
-
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.index.IndexWriter;
 

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/AbstractIndexIteratorHandler.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/AbstractIndexIteratorHandler.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/AbstractIndexIteratorHandler.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/AbstractIndexIteratorHandler.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.lucene.index;
 
 import java.io.File;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
 

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/DocumentCreator.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/DocumentCreator.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/DocumentCreator.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/DocumentCreator.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.lucene.index;
 
 import java.io.File;
-
 import org.apache.lucene.document.Document;
 
 

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/Index.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/Index.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/Index.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/Index.java Sat Mar  8 14:58:32 2008
@@ -21,7 +21,6 @@
 
 import java.io.File;
 import java.util.Date;
-
 import org.apache.lenya.lucene.IndexConfiguration;
 import org.apache.lenya.xml.DOMUtil;
 import org.apache.lenya.xml.DocumentHelper;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/IndexIteratorHandler.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/IndexIteratorHandler.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/IndexIteratorHandler.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/IndexIteratorHandler.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.lucene.index;
 
 import java.io.File;
-
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
 

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/Indexer.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/Indexer.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/Indexer.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/lucene/index/Indexer.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.lucene.index;
 
 import java.io.File;
-
 import org.w3c.dom.Element;
 
 public interface Indexer {

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/net/ProxyConf.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/net/ProxyConf.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/net/ProxyConf.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/net/ProxyConf.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.net;
 
 import java.util.Vector;
-
 import org.apache.lenya.xml.XPointerFactory;
 import org.w3c.dom.Element;
 

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/search/crawler/HTMLHandler.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/search/crawler/HTMLHandler.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/search/crawler/HTMLHandler.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/search/crawler/HTMLHandler.java Sat Mar  8 14:58:32 2008
@@ -26,7 +26,6 @@
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.swing.text.MutableAttributeSet;
 import javax.swing.text.html.HTML;
 import javax.swing.text.html.HTML.Tag;

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=635107&r1=635106&r2=635107&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 Sat Mar  8 14:58:32 2008
@@ -2,14 +2,19 @@
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.util.Map;
+import org.apache.axis.components.uuid.UUIDGen;
+import org.apache.axis.components.uuid.UUIDGenFactory;
 import org.apache.cocoon.environment.Context;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.Response;
+import org.apache.cocoon.environment.Session;
 import org.apache.cocoon.environment.http.HttpContext;
 import org.apache.cocoon.environment.http.HttpEnvironment;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
+import org.apache.lenya.ac.Identity;
+import org.apache.lenya.ac.User;
 import org.apache.lenya.cms.publication.PageEnvelope;
 import org.apache.lenya.cms.publication.PageEnvelopeException;
 import org.apache.lenya.cms.publication.Publication;
@@ -28,6 +33,18 @@
     */
    private Globals() {
    }
+   // UUID Generation (from Lenya 2)
+   static private UUIDGen delegate;
+   static private UUIDGen getDelegate() {
+      if(delegate == null){
+         delegate = UUIDGenFactory.getUUIDGen();
+      }
+      return delegate;
+   }
+   static public String createUUID() {
+      return getDelegate().nextUUID();
+   }
+   // Lenya Functions
    static public String getAction() {
       HttpEnvironment he = (HttpEnvironment) getObjectModel().get("source-resolver");
       return he.getAction();
@@ -37,9 +54,17 @@
       HttpEnvironment he = (HttpEnvironment) getObjectModel().get("source-resolver");
       return he.getContentType();
    }
-   public static final Context getContext() {
+   static public final Context getContext() {
       return (Context) getObjectModel().get(ObjectModelHelper.CONTEXT_OBJECT);
    }
+   /**
+    * Use for modification times e.g. revision filenames.
+    * 
+    * @return current datetime (Date.getTime()) as String (Long.toString()).
+    */
+   static public String getDateString() {
+      return Long.toString(new java.util.Date().getTime());
+   }
    // file:///F:/eclipseWS/Lenya13x/build/lenya/webapp/lenya/modules/authoring/
    // file:///F:/eclipseWS/Lenya13x/build/lenya/webapp/lenya/modules/cache/module.xmap
    // file:///F:/eclipseWS/Lenya13x/build/lenya/webapp/lenya/modules/edit/
@@ -48,7 +73,7 @@
       HttpEnvironment he = (HttpEnvironment) getObjectModel().get("source-resolver");
       return he.getContext();
    }
-   public static final Long getExpires() {
+   static public final Long getExpires() {
       return (Long) getObjectModel().get(ObjectModelHelper.EXPIRES_OBJECT);
    }
    static public String getModuleId() {
@@ -106,7 +131,7 @@
       try{
          return PageEnvelope.getCurrent().getPublication();
       }catch(PageEnvelopeException e){
-         System.out.println("Globals.getPublication failed: " + e.getLocalizedMessage());
+         // getPublication may be called without a request. Return null.
       }
       return null;
    }
@@ -117,10 +142,14 @@
          return (Publication) null;
       }
    }
-   public static final Request getRequest() {
-      return (Request) getObjectModel().get(ObjectModelHelper.REQUEST_OBJECT);
+   static public final Request getRequest() {
+      try{
+         return (Request) getObjectModel().get(ObjectModelHelper.REQUEST_OBJECT);
+      }catch(NullPointerException npe){
+      }
+      return null;
    }
-   public static final Response getResponse() {
+   static public final Response getResponse() {
       return (Response) getObjectModel().get(ObjectModelHelper.RESPONSE_OBJECT);
    }
    // file:///F:/eclipseWS/Lenya13x/build/lenya/webapp/
@@ -170,8 +199,24 @@
       HttpContext hc = (HttpContext) getObjectModel().get("context");
       return (String) hc.getAttribute("javax.servlet.context.tempdir");
    }
-   public static final Throwable getThrowable() {
+   static public final Throwable getThrowable() {
       return (Throwable) getObjectModel().get(ObjectModelHelper.THROWABLE_OBJECT);
+   }
+   static public String getUser() {
+      String userid = "anonymous";
+      Request request = getRequest();
+      if(null != request){
+         Session session = request.getSession();
+         if(session != null){
+            Identity identity = (Identity) session.getAttribute(Identity.class.getName());
+            if(identity != null){
+               User user = identity.getUser();
+               if(user != null)
+                  userid = user.getId();
+            }
+         }
+      }
+      return userid;
    }
    // authoring/index.html
    // edit

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/HTML.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/HTML.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/HTML.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/HTML.java Sat Mar  8 14:58:32 2008
@@ -27,7 +27,6 @@
 import java.net.URLConnection;
 import java.util.Iterator;
 import java.util.List;
-
 import javax.swing.text.html.parser.ParserDelegator;
 
 

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/SSI.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/SSI.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/SSI.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/SSI.java Sat Mar  8 14:58:32 2008
@@ -25,7 +25,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-
 import org.apache.log4j.Category;
 
 

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/TidyCommandLine.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/TidyCommandLine.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/TidyCommandLine.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/util/TidyCommandLine.java Sat Mar  8 14:58:32 2008
@@ -25,7 +25,6 @@
 import java.io.FileWriter;
 import java.io.PrintWriter;
 import java.net.URL;
-
 import org.w3c.tidy.Tidy;
 
 

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/workflow/impl/History.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/workflow/impl/History.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/workflow/impl/History.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/workflow/impl/History.java Sat Mar  8 14:58:32 2008
@@ -28,9 +28,7 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-
 import javax.xml.transform.TransformerException;
-
 import org.apache.lenya.workflow.BooleanVariable;
 import org.apache.lenya.workflow.Event;
 import org.apache.lenya.workflow.Situation;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/DOMWriter.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/DOMWriter.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/DOMWriter.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/DOMWriter.java Sat Mar  8 14:58:32 2008
@@ -25,7 +25,6 @@
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.util.Vector;
-
 import org.apache.log4j.Category;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/DocumentHelper.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/DocumentHelper.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/DocumentHelper.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/DocumentHelper.java Sat Mar  8 14:58:32 2008
@@ -27,7 +27,6 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -38,7 +37,6 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-
 import org.apache.xml.resolver.tools.CatalogResolver;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/NamespaceHelper.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/NamespaceHelper.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/NamespaceHelper.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/NamespaceHelper.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.xml;
 
 import javax.xml.parsers.ParserConfigurationException;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Text;

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/XPath.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/XPath.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/XPath.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/XPath.java Sat Mar  8 14:58:32 2008
@@ -20,7 +20,6 @@
 package org.apache.lenya.xml;
 
 import java.util.StringTokenizer;
-
 import org.w3c.dom.Node;
 
 public class XPath {

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/parser/Parser.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/parser/Parser.java?rev=635107&r1=635106&r2=635107&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/parser/Parser.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/xml/parser/Parser.java Sat Mar  8 14:58:32 2008
@@ -21,7 +21,6 @@
 
 import java.io.InputStream;
 import java.io.Reader;
-
 import org.w3c.dom.CDATASection;
 import org.w3c.dom.Comment;
 import org.w3c.dom.Document;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.