You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/05/22 11:14:05 UTC
svn commit: r408614 - in /lenya/trunk/src:
java/org/apache/lenya/cms/publication/
modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/
Author: andreas
Date: Mon May 22 02:14:01 2006
New Revision: 408614
URL: http://svn.apache.org/viewvc?rev=408614&view=rev
Log:
Removed dependency from DefaultDocumentBuilder to DefaultDocument
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java
lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuilder.java
lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentityMap.java
lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentityMapImpl.java
lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java
Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java?rev=408614&r1=408613&r2=408614&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java Mon May 22 02:14:01 2006
@@ -17,7 +17,6 @@
package org.apache.lenya.cms.publication;
-import org.apache.avalon.framework.container.ContainerUtil;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
@@ -45,36 +44,6 @@
}
protected ServiceManager manager;
-
- /**
- * @see org.apache.lenya.cms.publication.DocumentBuilder#buildDocument(org.apache.lenya.cms.publication.DocumentIdentityMap,
- * org.apache.lenya.cms.publication.DocumentIdentifier)
- */
- public Document buildDocument(DocumentIdentityMap map, DocumentIdentifier identifier)
- throws DocumentBuildException {
-
- DefaultDocument document = createDocument(map, identifier);
- ContainerUtil.enableLogging(document, getLogger());
- /*
- * document.setExtension(extension); document.setDocumentURL(originalURL);
- */
- return document;
- }
-
- /**
- * Creates a new document object. Override this method to create specific document objects,
- * e.g., for different document IDs.
- * @param map The identity map.
- * @param identifier The identifier.
- * @return A document.
- * @throws DocumentBuildException when something went wrong.
- */
- protected DefaultDocument createDocument(DocumentIdentityMap map, DocumentIdentifier identifier)
- throws DocumentBuildException {
- DefaultDocument document = new DefaultDocument(this.manager, map, identifier, getLogger());
- document.setDocumentURL(buildCanonicalDocumentUrl(identifier));
- return document;
- }
/**
* Removes all "."-separated extensions from a URL (e.g., <code>/foo.print.html</code> is
Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuilder.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuilder.java?rev=408614&r1=408613&r2=408614&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuilder.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentBuilder.java Mon May 22 02:14:01 2006
@@ -38,16 +38,6 @@
DocumentIdentifier getIdentitfier(String webappUrl) throws DocumentBuildException;
/**
- * Builds a document.
- * @param map The identity map the document belongs to.
- * @param identifier The document identifier.
- * @return A document.
- * @throws DocumentBuildException when something went wrong.
- */
- Document buildDocument(DocumentIdentityMap map, DocumentIdentifier identifier)
- throws DocumentBuildException;
-
- /**
* Checks if an URL corresponds to a CMS document.
* @param url The URL of the form /{publication-id}/...
* @return A boolean value.
Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentityMap.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentityMap.java?rev=408614&r1=408613&r2=408614&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentityMap.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentityMap.java Mon May 22 02:14:01 2006
@@ -27,6 +27,14 @@
/**
* Returns a document.
+ * @param identifier The identifier of the document.
+ * @return A document.
+ * @throws DocumentBuildException if an error occurs.
+ */
+ Document get(DocumentIdentifier identifier) throws DocumentBuildException;
+
+ /**
+ * Returns a document.
* @param publication The publication.
* @param area The area.
* @param documentId The document ID.
Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentityMapImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentityMapImpl.java?rev=408614&r1=408613&r2=408614&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentityMapImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentIdentityMapImpl.java Mon May 22 02:14:01 2006
@@ -301,7 +301,7 @@
area,
documentId,
language);
- document = builder.buildDocument(this, identifier);
+ document = buildDocument(this, identifier, builder);
} finally {
if (selector != null) {
if (builder != null) {
@@ -326,6 +326,41 @@
public Object buildObject(Object factory, String key) throws Exception {
return getIdentityMap().get((IdentifiableFactory) factory, key);
+ }
+
+ protected Document buildDocument(DocumentIdentityMap map, DocumentIdentifier identifier,
+ DocumentBuilder builder) throws DocumentBuildException {
+
+ DefaultDocument document = createDocument(map, identifier, builder);
+ ContainerUtil.enableLogging(document, getLogger());
+ return document;
+ }
+
+ /**
+ * Creates a new document object. Override this method to create specific document objects,
+ * e.g., for different document IDs.
+ * @param map The identity map.
+ * @param identifier The identifier.
+ * @param builder The document builder.
+ * @return A document.
+ * @throws DocumentBuildException when something went wrong.
+ */
+ protected DefaultDocument createDocument(DocumentIdentityMap map,
+ DocumentIdentifier identifier, DocumentBuilder builder) throws DocumentBuildException {
+ DefaultDocument document = new DefaultDocument(this.manager, map, identifier, getLogger());
+ final String canonicalUrl = builder.buildCanonicalUrl(identifier);
+ final String prefix = "/" + identifier.getPublication().getId() + "/"
+ + identifier.getArea();
+ final String canonicalDocumentUrl = canonicalUrl.substring(prefix.length());
+ document.setDocumentURL(canonicalDocumentUrl);
+ return document;
+ }
+
+ public Document get(DocumentIdentifier identifier) throws DocumentBuildException {
+ return get(identifier.getPublication(),
+ identifier.getArea(),
+ identifier.getId(),
+ identifier.getLanguage());
}
}
Modified: lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java?rev=408614&r1=408613&r2=408614&view=diff
==============================================================================
--- lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java (original)
+++ lenya/trunk/src/modules/webdav/java/src/org/apache/lenya/cms/usecases/webdav/Propfind.java Mon May 22 02:14:01 2006
@@ -17,27 +17,26 @@
package org.apache.lenya.cms.usecases.webdav;
import java.io.File;
+import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Vector;
-import java.text.SimpleDateFormat;
import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.cms.rc.RCEnvironment;
-import org.apache.lenya.cms.rc.RCML;
-import org.apache.lenya.cms.rc.RCMLEntry;
-import org.apache.lenya.cms.rc.RevisionController;
-import org.apache.lenya.cms.site.SiteManager;
-import org.apache.lenya.cms.site.usecases.SiteUsecase;
import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentBuilder;
import org.apache.lenya.cms.publication.DocumentIdentifier;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.PublicationException;
import org.apache.lenya.cms.publication.PublicationUtil;
import org.apache.lenya.cms.publication.Resource;
import org.apache.lenya.cms.publication.ResourcesManager;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.publication.DocumentBuilder;
+import org.apache.lenya.cms.rc.RCEnvironment;
+import org.apache.lenya.cms.rc.RCML;
+import org.apache.lenya.cms.rc.RCMLEntry;
+import org.apache.lenya.cms.rc.RevisionController;
+import org.apache.lenya.cms.site.SiteManager;
+import org.apache.lenya.cms.site.usecases.SiteUsecase;
/**
* Usecase to provide WebDAV propfind support for a document.
@@ -129,7 +128,7 @@
if (!request.equals("/" + _publication.getId() + "/authoring/")) {
String url = request.substring(0, request.length() - 1) + ".html";
DocumentIdentifier identifier = docBuilder.getIdentitfier(url);
- Document currentDoc = docBuilder.buildDocument(getDocumentIdentityMap(), identifier);
+ Document currentDoc = getDocumentIdentityMap().get(identifier);
if (currentDoc.exists()) {
resourcesManager = (ResourcesManager) this.manager.lookup(ResourcesManager.ROLE);
Resource[] resources = resourcesManager.getResources(currentDoc);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org