You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by jw...@apache.org on 2005/05/12 19:18:17 UTC

svn commit: r169853 - in /lenya/trunk/src/java/org/apache/lenya/cms: editors/forms/ publication/ repository/ site/tree/

Author: jwkaltz
Date: Thu May 12 10:18:15 2005
New Revision: 169853

URL: http://svn.apache.org/viewcvs?rev=169853&view=rev
Log:
use constants / convenience methods instead of lenya:// for accessing content

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/FormsEditor.java   (contents, props changed)
    lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/OneFormEditor.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/Publication.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/PublicationImpl.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/Resource.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java   (contents, props changed)
    lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java   (contents, props changed)
    lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/FormsEditor.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/FormsEditor.java?rev=169853&r1=169852&r2=169853&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/FormsEditor.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/FormsEditor.java Thu May 12 10:18:15 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright  1999-2004 The Apache Software Foundation
+ * Copyright  1999-2005 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@
 import org.apache.excalibur.source.ModifiableSource;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
+import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.usecase.DocumentUsecase;
 import org.apache.lenya.cms.usecase.UsecaseException;
 import org.apache.lenya.transaction.Transactionable;
@@ -106,7 +107,9 @@
         super.advance();
 
         String form = getParameterAsString("form");
-        String pubUrl = "context://lenya/pubs/" + getSourceDocument().getPublication().getId();
+        String pubUrl = "context://" 
+            + Publication.PUBLICATION_PREFIX + "/"
+            + getSourceDocument().getPublication().getId();
         String schemaUri = pubUrl + "/config/doctypes/schemas/" + form + ".rng";
         String unnumberTagsXslUri = "context://lenya/usecases/edit/forms/unnumberTags.xsl";
         String numberTagsXslUri = "context://lenya/usecases/edit/forms/numberTags.xsl";
@@ -730,4 +733,4 @@
 
     }
 
-}
\ No newline at end of file
+}

Propchange: lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/FormsEditor.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/OneFormEditor.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/OneFormEditor.java?rev=169853&r1=169852&r2=169853&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/OneFormEditor.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/editors/forms/OneFormEditor.java Thu May 12 10:18:15 2005
@@ -31,6 +31,7 @@
 import org.apache.excalibur.source.SourceResolver;
 import org.apache.lenya.cms.publication.DocumentType;
 import org.apache.lenya.cms.publication.DocumentTypeResolver;
+import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.usecase.DocumentUsecase;
 import org.apache.lenya.cms.usecase.UsecaseException;
 import org.apache.lenya.transaction.Transactionable;
@@ -42,7 +43,7 @@
 /**
  * One form editor.
  * 
- * @version $Id:$
+ * @version $Id$
  */
 public class OneFormEditor extends DocumentUsecase {
 
@@ -86,8 +87,10 @@
         }
 
         String pubId = getSourceDocument().getPublication().getId();
-        String schemaUri = "context://lenya/pubs/" + pubId + "/config/doctypes/schemas/"
-                + doctype.getName() + ".rng";
+        String schemaUri = "context://" 
+            + Publication.PUBLICATION_PREFIX_URI + "/" 
+            + pubId + "/config/doctypes/schemas/"
+            + doctype.getName() + ".rng";
         Source schemaSource = null;
         ModifiableSource xmlSource = null;
         SourceResolver resolver = null;

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java?rev=169853&r1=169852&r2=169853&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java Thu May 12 10:18:15 2005
@@ -407,7 +407,7 @@
             try {
                 final String path = getPublication().getPathMapper()
                         .getPath(getId(), getLanguage());
-                final String uri = "lenya://lenya/pubs/" + getPublication().getId()
+                final String uri = getPublication().getSourceURI()
                         + "/content/workflow/history/" + path;
                 this.history = new CMSHistory(uri, this.manager);
             } catch (WorkflowException e) {
@@ -473,7 +473,7 @@
      */
     public String getSourceURI() {
         String path = publication.getPathMapper().getPath(getId(), getLanguage());
-        return "lenya://lenya/pubs/" + publication.getId() + "/content/" + getArea() + "/" + path;
+        return publication.getSourceURI() + "/content/" + getArea() + "/" + path;
     }
 
     /**

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java?rev=169853&r1=169852&r2=169853&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java Thu May 12 10:18:15 2005
@@ -194,8 +194,7 @@
                     Configuration sampleConf = creatorConf.getChild(SAMPLE_NAME, false);
                     if (sampleConf != null) {
                         String sampleLocation = sampleConf.getValue();
-                        // FIXME: is there a cleaner way to set this ?
-                        String pubBase = "lenya://lenya/pubs/" + publication.getId();
+                        String pubBase = publication.getSourceURI();
                         type.setSampleContentLocation(pubBase + "/" + DOCTYPE_SAMPLES + sampleLocation);
                     }
                 } 

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/Publication.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/Publication.java?rev=169853&r1=169852&r2=169853&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/Publication.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/Publication.java Thu May 12 10:18:15 2005
@@ -183,4 +183,9 @@
      */
     Publication[] getTemplates();
 
-}
\ No newline at end of file
+    /**
+     * @return the URI source under which all contents of this
+     * publication can be accessed
+     */
+    String getSourceURI();
+}

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/PublicationImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/PublicationImpl.java?rev=169853&r1=169852&r2=169853&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/PublicationImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/PublicationImpl.java Thu May 12 10:18:15 2005
@@ -15,8 +15,6 @@
  *
  */
 
-/* $Id$  */
-
 package org.apache.lenya.cms.publication;
 
 import java.io.File;
@@ -29,6 +27,7 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.lenya.cms.repository.Node;
 
 /**
  * A publication.
@@ -405,4 +404,12 @@
         loadConfiguration();
         return this.instantiatorHint;
     }
+
+    /**
+     * @see org.apache.lenya.cms.publication.Publication#getSourceURI()
+     */
+    public String getSourceURI() {
+        return Node.LENYA_PROTOCOL + PUBLICATION_PREFIX_URI + "/" + this.id;
+    }
+
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/Resource.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/Resource.java?rev=169853&r1=169852&r2=169853&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/Resource.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/Resource.java Thu May 12 10:18:15 2005
@@ -98,13 +98,12 @@
      * @return The directory URI where the resources are located.
      */
     public String getBaseURI() {
-        String resourcesUri = getResourcesURI().substring("lenya://".length());
+        String resourcesUri = getResourcesURI().substring(Node.LENYA_PROTOCOL.length());
         return "context://" + resourcesUri;
     }
 
     protected String getResourcesURI() {
-        String pubId = document.getPublication().getId();
-        String resourcesUri = "lenya://lenya/pubs/" + pubId + "/"
+        String resourcesUri = document.getPublication().getSourceURI() + "/"
                 + ResourcesManager.RESOURCES_PREFIX + "/" + document.getArea() + document.getId();
         return resourcesUri;
     }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java?rev=169853&r1=169852&r2=169853&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java Thu May 12 10:18:15 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright  1999-2004 The Apache Software Foundation
+ * Copyright  1999-2005 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -30,6 +30,11 @@
 public interface Node extends Transactionable {
 
     /**
+     * The protocol with which to find Lenya nodes
+     */
+    String LENYA_PROTOCOL = "lenya://";
+
+    /**
      * The identifiable type.
      */
     String IDENTIFIABLE_TYPE = "node";
@@ -70,4 +75,4 @@
      */
     String getMimeType() throws TransactionException;
 
-}
\ No newline at end of file
+}

Propchange: lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java?rev=169853&r1=169852&r2=169853&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java Thu May 12 10:18:15 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright  1999-2004 The Apache Software Foundation
+ * Copyright  1999-2005 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@
     }
 
     protected String getRealSourceURI() {
-        return "context://" + this.sourceUri.substring("lenya://".length());
+        return "context://" + this.sourceUri.substring(Node.LENYA_PROTOCOL.length());
     }
 
     /**
@@ -135,9 +135,10 @@
      * @throws IOException if an error occurs.
      */
     protected String getRCPath() throws IOException {
-        String publicationsPath = this.sourceUri.substring("lenya://lenya/pubs/".length());
+        String pubBase = Node.LENYA_PROTOCOL + Publication.PUBLICATION_PREFIX_URI + "/";
+        String publicationsPath = this.sourceUri.substring(pubBase.length());
         String publicationId = publicationsPath.split("/")[0];
-        String path = "lenya://lenya/pubs/" + publicationId + "/";
+        String path = pubBase + publicationId + "/";
         return this.sourceUri.substring(path.length());
     }
 
@@ -162,7 +163,8 @@
     protected RevisionController getRevisionController() throws TransactionException {
         if (this.revisionController == null) {
             try {
-                String publicationsPath = this.sourceUri.substring("lenya://lenya/pubs/".length());
+                String pubBase = Node.LENYA_PROTOCOL + Publication.PUBLICATION_PREFIX_URI + "/";
+                String publicationsPath = this.sourceUri.substring(pubBase.length());
                 String publicationId = publicationsPath.split("/")[0];
 
                 Source contextSource = null;

Propchange: lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java?rev=169853&r1=169852&r2=169853&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java Thu May 12 10:18:15 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright  1999-2004 The Apache Software Foundation
+ * Copyright  1999-2005 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@
      */
     protected DefaultSiteTree(Publication publication, String _area, ServiceManager manager)
             throws SiteException {
-        this.sourceUri = "lenya://lenya/pubs/" + publication.getId() + "/content/" + _area + "/"
+        this.sourceUri = publication.getSourceURI() + "/content/" + _area + "/"
                 + SITE_TREE_FILENAME;
         this.area = _area;
         this.manager = manager;
@@ -571,4 +571,4 @@
         }
     }
 
-}
\ No newline at end of file
+}



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