svn commit: r742672 [2/6] - in /lenya/trunk: org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/ac/ org.apache.lenya.core.acusecases/src/main/java/org/apache/lenya/cms/ac/usecases/ org.apache.lenya.core.administration/src/main/java/org/apache/...

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentFactory.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentFactory.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentFactory.java Mon Feb  9 18:49:13 2009
@@ -17,23 +17,20 @@
  */
 package org.apache.lenya.cms.publication;
 
-import org.apache.lenya.cms.repository.RepositoryItemFactory;
-import org.apache.lenya.cms.repository.Session;
-
 /**
  * A DocumentIdentityMap avoids the multiple instanciation of a document object.
  * 
  * @version $Id$
  */
-public interface DocumentFactory extends RepositoryItemFactory {
+public interface DocumentFactory {
 
     /**
      * Returns a document.
      * @param identifier The identifier of the document.
      * @return A document.
-     * @throws DocumentBuildException if the document does not exist.
+     * @throws ResourceNotFoundException if the document does not exist.
      */
-    Document get(DocumentIdentifier identifier) throws DocumentBuildException;
+    Document get(DocumentIdentifier identifier) throws ResourceNotFoundException;
     
     /**
      * Returns a document.
@@ -42,10 +39,10 @@
      * @param uuid The document ID.
      * @param language The language.
      * @return A document.
-     * @throws DocumentBuildException if the document does not exist.
+     * @throws ResourceNotFoundException if the document does not exist.
      */
     Document get(Publication publication, String area, String uuid, String language)
-            throws DocumentBuildException;
+            throws ResourceNotFoundException;
 
     /**
      * Returns a revision of a document.
@@ -55,38 +52,18 @@
      * @param language The language.
      * @param revision The revision..
      * @return A document.
-     * @throws DocumentBuildException if the document does not exist.
+     * @throws ResourceNotFoundException if the document does not exist.
      */
     Document get(Publication publication, String area, String uuid, String language, int revision)
-            throws DocumentBuildException;
+            throws ResourceNotFoundException;
 
     /**
      * Returns the document identified by a certain web application URL.
      * @param webappUrl The web application URL.
      * @return A document.
-     * @throws DocumentBuildException if an error occurs.
+     * @throws ResourceNotFoundException if an error occurs.
      */
-    Document getFromURL(String webappUrl) throws DocumentBuildException;
-
-    /**
-     * Builds a clone of a document for another language.
-     * @param document The document to clone.
-     * @param language The language of the target document.
-     * @return A document.
-     * @throws DocumentBuildException if an error occurs.
-     * @deprecated use {@link DocumentLocator#getLanguageVersion(String)} instead.
-     */
-    Document getLanguageVersion(Document document, String language) throws DocumentBuildException;
-
-    /**
-     * Builds a clone of a document for another area.
-     * @param document The document to clone.
-     * @param area The area of the target document.
-     * @return A document.
-     * @throws DocumentBuildException if an error occurs.
-     * @deprecated use {@link DocumentLocator#getAreaVersion(String)} instead.
-     */
-    Document getAreaVersion(Document document, String area) throws DocumentBuildException;
+    Document getFromURL(String webappUrl) throws ResourceNotFoundException;
 
     /**
      * Builds a document for the default language.
@@ -94,18 +71,17 @@
      * @param area The area.
      * @param uuid The document UUID.
      * @return A document.
-     * @throws DocumentBuildException if an error occurs.
+     * @throws ResourceNotFoundException if an error occurs.
      */
     Document get(Publication publication, String area, String uuid)
-            throws DocumentBuildException;
+            throws ResourceNotFoundException;
 
     /**
      * Checks if a webapp URL represents a document.
      * @param webappUrl A web application URL.
      * @return A boolean value.
-     * @throws DocumentBuildException if an error occurs.
      */
-    boolean isDocument(String webappUrl) throws DocumentBuildException;
+    boolean isDocument(String webappUrl);
     
     /**
      * @return The session.
@@ -113,13 +89,6 @@
     Session getSession();
     
     /**
-     * @param locator The locator.
-     * @return A document.
-     * @throws DocumentBuildException if an error occurs.
-     */
-    Document get(DocumentLocator locator) throws DocumentBuildException;
-    
-    /**
      * @param id The publication ID.
      * @return A publication.
      * @throws PublicationException if the publication does not exist.

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryBuilder.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryBuilder.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryBuilder.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryBuilder.java Mon Feb  9 18:49:13 2009
@@ -17,8 +17,6 @@
  */
 package org.apache.lenya.cms.publication;
 
-import org.apache.lenya.cms.repository.Session;
-
 /**
  * Document factory builder.
  */

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentLocator.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentLocator.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentLocator.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentLocator.java Mon Feb  9 18:49:13 2009
@@ -20,6 +20,7 @@
 import java.util.Map;
 import java.util.WeakHashMap;
 
+
 /**
  * A DocumentLocator describes a document based on its path in the site structure. The actual
  * document doesn't have to exist.
@@ -196,4 +197,14 @@
         return DocumentLocator.getLocator(getPublicationId(), area, getPath(), getLanguage());
     }
 
+    public Document getDocument(Session session) throws ResourceNotFoundException {
+        try {
+            Publication pub = session.getPublication(getPublicationId());
+            return pub.getArea(getArea()).getSite().getNode(getPath()).getLink(getLanguage())
+                    .getDocument();
+        } catch (PublicationException e) {
+            throw new ResourceNotFoundException(e);
+        }
+    }
+
 }

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentManager.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentManager.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/DocumentManager.java Mon Feb  9 18:49:13 2009
@@ -32,19 +32,6 @@
     String ROLE = DocumentManager.class.getName();
 
     /**
-     * Checks if a document exists.
-     * @param factory The document factory.
-     * @param pub The publication.
-     * @param area The area.
-     * @param uuid The UUID.
-     * @param language The language.
-     * @return A boolean value.
-     * @throws PublicationException if an error occurs.
-     */
-    boolean exists(DocumentFactory factory, Publication pub, String area, String uuid,
-            String language) throws PublicationException;
-
-    /**
      * Copies a document from one location to another location.
      * @param sourceDocument The document to copy.
      * @param destination The destination document.
@@ -93,7 +80,6 @@
 
     /**
      * Creates a new document with the given parameters:
-     * @param factory The document factory.
      * @param resourceType the document type (aka resource type) of the new document
      * @param contentSourceUri The URI to read the content from.
      * @param pub The publication.
@@ -108,14 +94,13 @@
      * @throws DocumentBuildException if the document can not be created
      * @throws PublicationException if the document is already contained.
      */
-    Document add(DocumentFactory factory, ResourceType resourceType, String contentSourceUri,
+    Document add(ResourceType resourceType, String contentSourceUri,
             Publication pub, String area, String path, String language, String extension,
             String navigationTitle, boolean visibleInNav) throws DocumentBuildException,
             PublicationException;
 
     /**
      * Creates a new document without adding it to the site structure.
-     * @param factory The document factory.
      * @param resourceType the document type (aka resource type) of the new document
      * @param contentSourceUri The URI to read the content from.
      * @param pub The publication.
@@ -127,7 +112,7 @@
      * @throws DocumentBuildException if the document can not be created
      * @throws PublicationException if the document is already contained.
      */
-    Document add(DocumentFactory factory, ResourceType resourceType, String contentSourceUri,
+    Document add(ResourceType resourceType, String contentSourceUri,
             Publication pub, String area, String language, String extension)
             throws DocumentBuildException, PublicationException;
 

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/PageEnvelope.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/PageEnvelope.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/PageEnvelope.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/PageEnvelope.java Mon Feb  9 18:49:13 2009
@@ -22,7 +22,6 @@
 
 import java.io.File;
 
-import org.apache.avalon.framework.logger.ConsoleLogger;
 import org.apache.cocoon.environment.Request;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -188,17 +187,16 @@
 
     /**
      * Creates a page envelope from an object model.
-     * @param map The identity map to use.
+     * @param session The session to use.
      * @param contextPath The servlet context prefix.
      * @param webappUrl The web application URL.
      * @param servletContext The servlet context directory.
      * @param publication The publication.
      * @throws PageEnvelopeException when something went wrong.
      */
-    public PageEnvelope(DocumentFactory map, String contextPath,
+    public PageEnvelope(String contextPath,
             String webappUrl, File servletContext, Publication publication)
             throws PageEnvelopeException {
-        this.factory = map;
         this.context = contextPath;
         this.webappUrl = webappUrl;
         this.publication = publication;
@@ -206,14 +204,11 @@
 
     private String webappUrl;
 
-    private DocumentFactory factory;
-
     /**
-     * Returns the document factory.
-     * @return A document factory.
+     * @return The session.
      */
-    public DocumentFactory getDocumentFactory() {
-        return this.factory;
+    public Session getSession() {
+        return getPublication().getSession();
     }
 
     /**
@@ -286,7 +281,7 @@
             final Document doc = getDocument();
             try {
                 this.path = doc != null ? doc.getPath() :
-                    getPublication().getDocumentBuilder().getLocator(this.factory, this.webappUrl).getPath();
+                    getPublication().getDocumentBuilder().getLocator(getSession(), this.webappUrl).getPath();
             } catch (final Exception e) {
                 throw new RuntimeException(e);
             }
@@ -312,8 +307,8 @@
         if (!documentChecked) {
             try {
                 documentChecked = true;
-                if (getDocumentFactory().isDocument(this.webappUrl)) {
-                    this.document = getDocumentFactory().getFromURL(this.webappUrl);
+                if (getSession().getUriHandler().isDocument(this.webappUrl)) {
+                    this.document = getSession().getUriHandler().getDocument(this.webappUrl);
                 }
             } catch (final Exception e) {
                 throw new RuntimeException(e);

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/PageEnvelopeFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/PageEnvelopeFactory.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/PageEnvelopeFactory.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/PageEnvelopeFactory.java Mon Feb  9 18:49:13 2009
@@ -54,25 +54,23 @@
 
     /**
      * Returns the page envelope for the object model of a Cocoon component.
-     * @param map The document identity map to use.
      * @param objectModel The object model.
      * @param pub The publication.
      * @return A page envelope.
      * @throws PageEnvelopeException if something went wrong.
      */
-    public PageEnvelope getPageEnvelope(DocumentFactory map, Map objectModel, Publication pub)
+    public PageEnvelope getPageEnvelope(Map objectModel, Publication pub)
             throws PageEnvelopeException {
         Request request = ObjectModelHelper.getRequest(objectModel);
         String contextPath = request.getContextPath();
         Context context = ObjectModelHelper.getContext(objectModel);
         String webappUrl = ServletHelper.getWebappURI(request);
         String servletContextPath = context.getRealPath("");
-        return getPageEnvelope(map, contextPath, webappUrl, new File(servletContextPath), pub);
+        return getPageEnvelope(contextPath, webappUrl, new File(servletContextPath), pub);
     }
 
     /**
      * Creates a page envelope.
-     * @param map The document identity map to use.
      * @param contextPath The servlet context prefix.
      * @param webappUrl The web application URL.
      * @param servletContext The servlet context directory.
@@ -80,9 +78,9 @@
      * @return A page envelope.
      * @throws PageEnvelopeException if something went wrong.
      */
-    public PageEnvelope getPageEnvelope(DocumentFactory map, String contextPath, String webappUrl,
-            File servletContext, Publication pub) throws PageEnvelopeException {
-        PageEnvelope envelope = new PageEnvelope(map, contextPath, webappUrl, servletContext, pub);
+    public PageEnvelope getPageEnvelope(String contextPath, String webappUrl, File servletContext,
+            Publication pub) throws PageEnvelopeException {
+        PageEnvelope envelope = new PageEnvelope(contextPath, webappUrl, servletContext, pub);
         return envelope;
     }
 

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Publication.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Publication.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Publication.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Publication.java Mon Feb  9 18:49:13 2009
@@ -22,12 +22,10 @@
 
 import java.io.File;
 
-import org.apache.lenya.cms.repository.RepositoryItem;
-
 /**
  * A Lenya publication.
  */
-public interface Publication extends RepositoryItem {
+public interface Publication {
 
     /**
      * <code>AUTHORING_AREA</code> The authoring area
@@ -261,9 +259,9 @@
     /**
      * @param name The name.
      * @return An area object.
-     * @throws PublicationException if an error occurs.
+     * @throws ResourceNotFoundException if the area does not exist.
      */
-    Area getArea(String name) throws PublicationException;
+    Area getArea(String name) throws ResourceNotFoundException;
     
     /**
      * @return The names of all available areas.
@@ -271,11 +269,6 @@
     String[] getAreaNames();
     
     /**
-     * @return The document factory.
-     */
-    public DocumentFactory getFactory();
-    
-    /**
      * Saves the configuration of this publication.
      */
     void saveConfiguration();
@@ -285,4 +278,9 @@
      */
     String[] getModuleNames();
 
+    /**
+     * @return The session this publication object belongs to.
+     */
+    Session getSession();
+
 }

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Repository.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Repository.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Repository.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Repository.java Mon Feb  9 18:49:13 2009
@@ -26,5 +26,7 @@
     Session getSession(HttpServletRequest request);
 
     Session startSession(Identity identity, boolean modifiable);
+
+    void removeSession(HttpServletRequest request);
     
 }

Added: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/ResourceNotFoundException.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/ResourceNotFoundException.java?rev=742672&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/ResourceNotFoundException.java (added)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/ResourceNotFoundException.java Mon Feb  9 18:49:13 2009
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.lenya.cms.publication;
+
+public class ResourceNotFoundException extends RuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    public ResourceNotFoundException() {
+        super();
+    }
+
+    public ResourceNotFoundException(String arg0, Throwable arg1) {
+        super(arg0, arg1);
+    }
+
+    public ResourceNotFoundException(String arg0) {
+        super(arg0);
+    }
+
+    public ResourceNotFoundException(Throwable arg0) {
+        super(arg0);
+    }
+
+}

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Session.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Session.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Session.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/Session.java Mon Feb  9 18:49:13 2009
@@ -25,14 +25,17 @@
     
     Repository getRepository();
 
-    Publication getPublication(String id);
+    /**
+     * @param id The publication ID.
+     * @return A publication.
+     * @throws ResourceNotFoundException If the publication does not exist.
+     */
+    Publication getPublication(String id) throws ResourceNotFoundException;
     
     Publication[] getPublications();
 
     boolean existsPublication(String id);
 
-    DocumentFactory getDocumentFactory();
-
     Identity getIdentity();
 
     void commit() throws RepositoryException, ConcurrentModificationException;
@@ -41,4 +44,6 @@
 
     boolean isModifiable();
 
+    UriHandler getUriHandler();
+
 }

Added: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/UriHandler.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/UriHandler.java?rev=742672&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/UriHandler.java (added)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/UriHandler.java Mon Feb  9 18:49:13 2009
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.lenya.cms.publication;
+
+public interface UriHandler {
+    
+    boolean isDocument(String webappUri);
+    
+    Document getDocument(String webappUri) throws ResourceNotFoundException;
+    
+    boolean isPublication(String webappUri);
+    
+    Publication getPublication(String webappUri) throws PublicationException;
+    
+    boolean isArea(String webappUri);
+    
+    Area getArea(String webappUri) throws PublicationException;
+
+}

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentHelper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentHelper.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentHelper.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentHelper.java Mon Feb  9 18:49:13 2009
@@ -29,18 +29,13 @@
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.spring.configurator.WebAppContextUtils;
 import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
 import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentFactoryBuilder;
 import org.apache.lenya.cms.publication.DocumentLocator;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.PublicationException;
+import org.apache.lenya.cms.publication.Repository;
+import org.apache.lenya.cms.publication.Session;
 import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryManager;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
 import org.apache.lenya.util.ServletHelper;
 import org.springframework.web.context.WebApplicationContext;
 
@@ -50,7 +45,6 @@
 public class DocumentHelper {
 
     private Map objectModel;
-    private DocumentFactory documentFactory;
     private Publication publication;
 
     /**
@@ -60,26 +54,14 @@
      */
     public DocumentHelper(Map _objectModel) {
         WebApplicationContext context = WebAppContextUtils.getCurrentWebApplicationContext();
-        RepositoryManager repoMgr = (RepositoryManager) context.getBean(RepositoryManager.ROLE);
-        DocumentFactoryBuilder builder = (DocumentFactoryBuilder) context
-                .getBean(DocumentFactoryBuilder.class.getName());
-        
+        Repository repo = (Repository) context.getBean(Repository.class.getName());
+
         Request request = ObjectModelHelper.getRequest(_objectModel);
-        Session session;
-        try {
-            session = RepositoryUtil.getSession(repoMgr, request);
-        } catch (RepositoryException e) {
-            throw new RuntimeException(e);
-        }
+        Session session = repo.getSession(request);
 
-        this.documentFactory = builder.createDocumentFactory(session);
         this.objectModel = _objectModel;
-        try {
-            URLInformation info = new URLInformation(ServletHelper.getWebappURI(request));
-            this.publication = this.documentFactory.getPublication(info.getPublicationId());
-        } catch (PublicationException e) {
-            throw new RuntimeException(e);
-        }
+        URLInformation info = new URLInformation(ServletHelper.getWebappURI(request));
+        this.publication = session.getPublication(info.getPublicationId());
     }
 
     /**
@@ -98,10 +80,10 @@
 
         String url = null;
 
-        try {
             Request request = ObjectModelHelper.getRequest(this.objectModel);
             String webappUrl = ServletHelper.getWebappURI(request);
-            Document envDocument = this.documentFactory.getFromURL(webappUrl);
+            Document envDocument = this.publication.getSession().getUriHandler().getDocument(
+                    webappUrl);
             if (uuid == null) {
                 uuid = envDocument.getUUID();
             }
@@ -116,8 +98,7 @@
                 language = envDocument.getLanguage();
             }
 
-            Document document = this.documentFactory
-                    .get(this.publication, documentArea, uuid, language);
+            Document document = this.publication.getArea(documentArea).getDocument(uuid, language);
             url = document.getCanonicalWebappURL();
 
             String contextPath = request.getContextPath();
@@ -126,9 +107,6 @@
             }
 
             url = contextPath + url;
-        } catch (final DocumentBuildException e) {
-            throw new ProcessingException(e);
-        }
 
         return url;
 
@@ -148,14 +126,16 @@
         try {
             Request request = ObjectModelHelper.getRequest(this.objectModel);
             String webappUrl = ServletHelper.getWebappURI(request);
-            Document document = this.documentFactory.getFromURL(webappUrl);
+            Document document = this.publication.getSession().getUriHandler()
+                    .getDocument(webappUrl);
 
             contextPath = request.getContextPath();
 
             DocumentLocator parentLocator = document.getLocator().getParent("/index");
-            Document parent = this.documentFactory.get(parentLocator);
+            Document parent = this.publication.getArea(document.getArea()).getSite().getNode(
+                    parentLocator.getPath()).getLink(document.getLanguage()).getDocument();
             parentUrl = parent.getCanonicalWebappURL();
-        } catch (final DocumentBuildException e) {
+        } catch (final PublicationException e) {
             throw new ProcessingException(e);
         }
         if (contextPath == null) {
@@ -213,14 +193,7 @@
             existingLanguage = languages[0];
         }
 
-        Document existingVersion = null;
-        try {
-            existingVersion = document.getTranslation(existingLanguage);
-        } catch (DocumentException e) {
-            throw new DocumentException(e);
-        }
-
-        return existingVersion;
+        return document.getTranslation(existingLanguage);
     }
 
 }
\ No newline at end of file

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentSet.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentSet.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentSet.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentSet.java Mon Feb  9 18:49:13 2009
@@ -123,9 +123,9 @@
      * Visits the set.
      * 
      * @param visitor The visitor.
-     * @throws PublicationException if an error occurs during visiting.
+     * @throws Exception if an error occurs during visiting.
      */
-    public void visit(DocumentVisitor visitor) throws PublicationException {
+    public void visit(DocumentVisitor visitor) throws Exception {
         Document[] resources = getDocuments();
         for (int i = 0; i < resources.length; i++) {
             resources[i].accept(visitor);

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentVisitor.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentVisitor.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentVisitor.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/DocumentVisitor.java Mon Feb  9 18:49:13 2009
@@ -21,7 +21,6 @@
 package org.apache.lenya.cms.publication.util;
 
 import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.PublicationException;
 
 /**
  * Visitor for resources.
@@ -32,8 +31,8 @@
     /**
      * Visits a resource.
      * @param document The resource.
-     * @throws PublicationException if something went wrong.
+     * @throws Exception if an error occurs.
      */
-    void visitDocument(Document document) throws PublicationException;
+    void visitDocument(Document document) throws Exception;
 
 }

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/LanguageVersions.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/LanguageVersions.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/LanguageVersions.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/util/LanguageVersions.java Mon Feb  9 18:49:13 2009
@@ -21,7 +21,6 @@
 package org.apache.lenya.cms.publication.util;
 
 import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
 import org.apache.lenya.cms.publication.DocumentException;
 
 /**
@@ -41,12 +40,7 @@
         for (int i = 0; i < languages.length; i++) {
             if (!document.getLanguage().equals(languages[i])) {
                 Document languageVersion;
-                try {
-                    languageVersion = document.getFactory()
-                            .getLanguageVersion(document, languages[i]);
-                } catch (DocumentBuildException e) {
-                    throw new DocumentException(e);
-                }
+                languageVersion = document.getTranslation(languages[i]);
                 add(languageVersion);
             }
         }

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/Node.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/Node.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/Node.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/Node.java Mon Feb  9 18:49:13 2009
@@ -30,7 +30,7 @@
     /**
      * @return The session this node belongs to.
      */
-    Session getSession();
+    Session getRepositorySession();
 
     /**
      * The protocol with which to find Lenya nodes

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryItem.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryItem.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryItem.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryItem.java Mon Feb  9 18:49:13 2009
@@ -25,6 +25,6 @@
     /**
      * @return The session this item belongs to.
      */
-    Session getSession();
+    Session getRepositorySession();
     
 }

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/SessionImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/SessionImpl.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/SessionImpl.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/SessionImpl.java Mon Feb  9 18:49:13 2009
@@ -79,7 +79,7 @@
      * @param manager The service manager.
      * @param logger The logger.
      */
-    public SessionImpl(Identity identity, boolean modifiable, Log logger) {
+    protected SessionImpl(Identity identity, boolean modifiable, Log logger) {
 
         this.identityMap = new IdentityMapImpl(logger);
         this.identity = identity;

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/AbstractLink.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/AbstractLink.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/AbstractLink.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/AbstractLink.java Mon Feb  9 18:49:13 2009
@@ -21,8 +21,6 @@
 package org.apache.lenya.cms.site;
 
 import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentFactory;
 import org.apache.lenya.cms.publication.Publication;
 
 /**
@@ -34,15 +32,13 @@
 
     /**
      * Creates a new AbstractLink object.
-     * @param factory The document factory.
      * @param node The site node.
      * @param _label the actual label
      * @param _language the language
      */
-    public AbstractLink(DocumentFactory factory, SiteNode node, String _label, String _language) {
+    public AbstractLink(SiteNode node, String _label, String _language) {
         this.label = _label;
         this.language = _language;
-        this.factory = factory;
         this.node = node;
     }
 
@@ -98,7 +94,6 @@
     }
 
     private SiteNode node;
-    private DocumentFactory factory;
 
     public Document getDocument() {
         SiteNode node = getNode();
@@ -108,22 +103,19 @@
         }
         Publication pub = node.getStructure().getPublication();
         String area = node.getStructure().getArea();
-        try {
-            return this.factory.get(pub, area, uuid, getLanguage());
-        } catch (DocumentBuildException e) {
-            throw new RuntimeException(e);
-        }
+        return pub.getArea(area).getDocument(uuid, getLanguage());
     }
 
     public SiteNode getNode() {
         return this.node;
     }
-    
+
     public void setLabel(String label) {
         this.label = label;
         save();
     }
 
-    protected void save() {}
-    
+    protected void save() {
+    }
+
 }
\ No newline at end of file

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/AbstractSiteManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/AbstractSiteManager.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/AbstractSiteManager.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/AbstractSiteManager.java Mon Feb  9 18:49:13 2009
@@ -22,7 +22,6 @@
 import java.util.Comparator;
 
 import org.apache.cocoon.util.AbstractLogEnabled;
-import org.apache.lenya.cms.publication.DocumentFactory;
 
 /**
  * Abstract base class for site managers.
@@ -37,49 +36,45 @@
     public SiteNode[] sortAscending(SiteNode[] nodes) throws SiteException {
         if (nodes.length > 0) {
 
-            DocumentFactory map = nodes[0].getStructure().getPublication().getFactory();
-            if (!check(map, new NodeSet(nodes))) {
+            if (!check(new NodeSet(nodes))) {
                 throw new SiteException("The dependence relation is not a strict partial order!");
             }
 
-            SiteNode[] sortedNodes = (SiteNode[]) Arrays.asList(nodes).toArray(new SiteNode[nodes.length]);
-            Arrays.sort(sortedNodes, new NodeComparator(map));
+            SiteNode[] sortedNodes = (SiteNode[]) Arrays.asList(nodes).toArray(
+                    new SiteNode[nodes.length]);
+            Arrays.sort(sortedNodes, new NodeComparator());
             return sortedNodes;
-        }
-        else {
-            return  nodes;
+        } else {
+            return nodes;
         }
     }
 
     /**
      * Checks if the dependence relation is a strict partial order.
      * 
-     * @param map The identity map to operate on.
      * @param set The document set to check.
      * @return A boolean value.
      * @throws SiteException when something went wrong.
      */
-    protected boolean check(DocumentFactory map, NodeSet set) throws SiteException {
-        boolean isStrictPartialOrder = isIrreflexive(map, set) && isAntisymmetric(map, set)
-                && isTransitive(map, set);
+    protected boolean check(NodeSet set) throws SiteException {
+        boolean isStrictPartialOrder = isIrreflexive(set) && isAntisymmetric(set)
+                && isTransitive(set);
         return isStrictPartialOrder;
     }
 
     /**
      * Checks if the dependence relation is antisymmetric.
      * 
-     * @param map The identity map to operate on.
      * @param set The document set to check.
      * @return A boolean value.
      * @throws SiteException when something went wrong.
      */
-    protected boolean isAntisymmetric(DocumentFactory map, NodeSet set) throws SiteException {
+    protected boolean isAntisymmetric(NodeSet set) throws SiteException {
         SiteNode[] resources = set.getNodes();
         boolean isAntisymmetric = true;
         for (int i = 0; i < resources.length; i++) {
             for (int j = i + 1; j < resources.length; j++) {
-                if (requires(map, resources[i], resources[j])
-                        && requires(map, resources[j], resources[i])
+                if (requires(resources[i], resources[j]) && requires(resources[j], resources[i])
                         && !(resources[i] == resources[j])) {
                     isAntisymmetric = false;
                 }
@@ -91,20 +86,19 @@
     /**
      * Checks if the dependence relation is transitive.
      * 
-     * @param map The identity map to operate on.
      * @param set The document set to check.
      * @return A boolean value.
      * @throws SiteException when something went wrong.
      */
-    protected boolean isTransitive(DocumentFactory map, NodeSet set) throws SiteException {
+    protected boolean isTransitive(NodeSet set) throws SiteException {
         SiteNode[] resources = set.getNodes();
         boolean isTransitive = true;
         for (int i = 0; i < resources.length; i++) {
             for (int j = i + 1; j < resources.length; j++) {
                 for (int k = j + 1; k < resources.length; k++) {
-                    if (requires(map, resources[i], resources[j])
-                            && requires(map, resources[j], resources[k])
-                            && !requires(map, resources[i], resources[k])) {
+                    if (requires(resources[i], resources[j])
+                            && requires(resources[j], resources[k])
+                            && !requires(resources[i], resources[k])) {
                         isTransitive = false;
                     }
                 }
@@ -116,16 +110,15 @@
     /**
      * Checks if the dependence relation is irreflexive.
      * 
-     * @param map The identity map to operate on.
      * @param set The document set.
      * @return A boolean value
      * @throws SiteException
      */
-    protected boolean isIrreflexive(DocumentFactory map, NodeSet set) throws SiteException {
+    protected boolean isIrreflexive(NodeSet set) throws SiteException {
         SiteNode[] resources = set.getNodes();
         boolean isIrreflexive = true;
         for (int i = 0; i < resources.length; i++) {
-            if (requires(map, resources[i], resources[i])) {
+            if (requires(resources[i], resources[i])) {
                 isIrreflexive = false;
             }
         }
@@ -138,17 +131,6 @@
     public class NodeComparator implements Comparator {
 
         /**
-         * Ctor.
-         * 
-         * @param map The identity map to operate on.
-         */
-        public NodeComparator(DocumentFactory map) {
-            this.map = map;
-        }
-
-        private DocumentFactory map;
-
-        /**
          * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
          */
         public int compare(Object arg0, Object arg1) {
@@ -158,10 +140,9 @@
                 SiteNode doc2 = (SiteNode) arg1;
 
                 try {
-                    if (AbstractSiteManager.this.requires(map, doc1, doc2)) {
+                    if (AbstractSiteManager.this.requires(doc1, doc2)) {
                         result = 1;
-                    }
-                    else if (AbstractSiteManager.this.requires(map, doc2, doc1)) {
+                    } else if (AbstractSiteManager.this.requires(doc2, doc1)) {
                         result = -1;
                     }
                 } catch (SiteException e) {

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/SiteManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/SiteManager.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/SiteManager.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/SiteManager.java Mon Feb  9 18:49:13 2009
@@ -19,9 +19,9 @@
 package org.apache.lenya.cms.site;
 
 import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
 import org.apache.lenya.cms.publication.DocumentLocator;
 import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.Session;
 
 /**
  * <p>
@@ -35,8 +35,7 @@
  * </p>
  * <ul>
  * <li><em>irreflexive:</em> d <strong>&lt; </strong>d does not hold for any resource d</li>
- * <li><em>antisymmetric:</em> d <strong>&lt; </strong>e and e <strong>&lt; </strong>d implies
- * d=e</li>
+ * <li><em>antisymmetric:</em> d <strong>&lt; </strong>e and e <strong>&lt; </strong>d implies d=e</li>
  * <li><em>transitive:</em> d <strong>&lt; </strong>e and e <strong>&lt; </strong>f implies d
  * <strong>&lt; </strong>f</li>
  * </ul>
@@ -52,34 +51,32 @@
 
     /**
      * Checks if a resource requires another one.
-     * @param map The identity map to operate on.
      * @param dependingResource The depending resource.
      * @param requiredResource The required resource.
      * @return A boolean value.
      * @throws SiteException if an error occurs.
      */
-    boolean requires(DocumentFactory map, SiteNode dependingResource, SiteNode requiredResource)
-            throws SiteException;
+    boolean requires(SiteNode dependingResource, SiteNode requiredResource) throws SiteException;
 
     /**
      * Returns the resources which are required by a certain resource.
      * 
-     * @param map The identity map to operate on.
+     * @param session The session to operate on.
      * @param locator The depending locator.
      * @return An array of resources.
      * @throws SiteException if an error occurs.
      */
-    DocumentLocator[] getRequiredResources(DocumentFactory map, DocumentLocator locator) throws SiteException;
+    DocumentLocator[] getRequiredResources(Session session, DocumentLocator locator)
+            throws SiteException;
 
     /**
      * Returns the resources which require a certain resource.
      * 
-     * @param map The identity map to operate on.
      * @param resource The required resource.
      * @return An array of resources.
      * @throws SiteException if an error occurs.
      */
-    SiteNode[] getRequiringResources(DocumentFactory map, SiteNode resource) throws SiteException;
+    SiteNode[] getRequiringResources(SiteNode resource) throws SiteException;
 
     /**
      * Adds a document to the site structure.
@@ -124,7 +121,7 @@
      * @throws SiteException when something went wrong.
      */
     void copy(Document sourceDocument, Document destinationDocument) throws SiteException;
-    
+
     /**
      * Sets the visibility of a node in the navigation. It is meant to hide specific nodes within
      * the "public" navigation whereas the node is visible within the info/site area.
@@ -147,14 +144,12 @@
     /**
      * Returns all documents in a certain area.
      * 
-     * @param identityMap The identityMap to use.
      * @param publication The publication.
      * @param area The area.
      * @return An array of documents.
      * @throws SiteException if an error occurs.
      */
-    Document[] getDocuments(DocumentFactory identityMap, Publication publication, String area)
-            throws SiteException;
+    Document[] getDocuments(Publication publication, String area) throws SiteException;
 
     /**
      * Sorts a set of nodes using the "requires" relation.
@@ -166,23 +161,22 @@
     SiteNode[] sortAscending(SiteNode[] nodes) throws SiteException;
 
     /**
-     * @param map The identity map.
      * @param publication The publication.
      * @param area The area.
      * @return The object that holds the site structure information.
      * @throws SiteException if an error occurs.
      */
-    SiteStructure getSiteStructure(DocumentFactory map, Publication publication, String area)
-            throws SiteException;
+    SiteStructure getSiteStructure(Publication publication, String area) throws SiteException;
 
     /**
      * Checks if the document does already exist. If it does, returns a non-existing document with a
      * similar document ID. If it does not, the original document is returned.
-     * @param factory The document factory.
+     * @param session The session.
      * @param locator The locator.
      * @return A locator.
      * @throws SiteException if the new document could not be built.
      */
-    DocumentLocator getAvailableLocator(DocumentFactory factory, DocumentLocator locator) throws SiteException;
-    
+    DocumentLocator getAvailableLocator(Session session, DocumentLocator locator)
+            throws SiteException;
+
 }

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/SiteUtil.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/SiteUtil.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/SiteUtil.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/SiteUtil.java Mon Feb  9 18:49:13 2009
@@ -21,9 +21,9 @@
 import java.util.Set;
 
 import org.apache.cocoon.spring.configurator.WebAppContextUtils;
-import org.apache.lenya.cms.publication.DocumentFactory;
 import org.apache.lenya.cms.publication.DocumentLocator;
 import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.Session;
 
 /**
  * Utility to handle site structures.
@@ -51,11 +51,10 @@
             siteManager = (SiteManager) WebAppContextUtils.getCurrentWebApplicationContext()
                     .getBean(SiteManager.class.getName() + "/" + hint);
 
-            DocumentFactory map = node.getStructure().getPublication().getFactory();
             Set nodes = new HashSet();
             nodes.add(node);
 
-            SiteNode[] requiringNodes = siteManager.getRequiringResources(map, node);
+            SiteNode[] requiringNodes = siteManager.getRequiringResources(node);
             for (int i = 0; i < requiringNodes.length; i++) {
                 nodes.add(requiringNodes[i]);
             }
@@ -75,14 +74,14 @@
      * @return A document.
      * @throws SiteException if an error occurs.
      */
-    public static DocumentLocator getAvailableLocator(DocumentFactory factory,
+    public static DocumentLocator getAvailableLocator(Session session,
             DocumentLocator locator) throws SiteException {
         SiteManager siteManager = null;
         try {
-            Publication pub = factory.getPublication(locator.getPublicationId());
+            Publication pub = session.getPublication(locator.getPublicationId());
             siteManager = (SiteManager) WebAppContextUtils.getCurrentWebApplicationContext()
                     .getBean(SiteManager.ROLE + "/" + pub.getSiteManagerHint());
-            return siteManager.getAvailableLocator(factory, locator);
+            return siteManager.getAvailableLocator(session, locator);
         } catch (Exception e) {
             throw new SiteException(e);
         }

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/topicmap/TopicMapSiteManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/topicmap/TopicMapSiteManager.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/topicmap/TopicMapSiteManager.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/site/topicmap/TopicMapSiteManager.java Mon Feb  9 18:49:13 2009
@@ -18,9 +18,9 @@
 package org.apache.lenya.cms.site.topicmap;
 
 import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentFactory;
 import org.apache.lenya.cms.publication.DocumentLocator;
 import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.Session;
 import org.apache.lenya.cms.site.AbstractSiteManager;
 import org.apache.lenya.cms.site.SiteNode;
 import org.apache.lenya.cms.site.SiteException;
@@ -31,23 +31,12 @@
  */
 public class TopicMapSiteManager extends AbstractSiteManager {
 
-    /**
-     * @see org.apache.lenya.cms.site.SiteManager#requires(org.apache.lenya.cms.publication.DocumentFactory,
-     *      org.apache.lenya.cms.site.SiteNode, org.apache.lenya.cms.site.SiteNode)
-     */
-    public boolean requires(DocumentFactory map, SiteNode dependingResource,
-            SiteNode requiredResource) throws SiteException {
-        // TODO Auto-generated method stub
+    public boolean requires(SiteNode dependingResource, SiteNode requiredResource)
+            throws SiteException {
         return false;
     }
 
-    /**
-     * @see org.apache.lenya.cms.site.SiteManager#getRequiringResources(org.apache.lenya.cms.publication.DocumentFactory,
-     *      org.apache.lenya.cms.site.SiteNode)
-     */
-    public SiteNode[] getRequiringResources(DocumentFactory map, SiteNode resource)
-            throws SiteException {
-        // TODO Auto-generated method stub
+    public SiteNode[] getRequiringResources(SiteNode resource) throws SiteException {
         return null;
     }
 
@@ -55,15 +44,12 @@
      * @see org.apache.lenya.cms.site.SiteManager#add(org.apache.lenya.cms.publication.Document)
      */
     public void add(String path, Document document) throws SiteException {
-        // TODO Auto-generated method stub
-
     }
 
     /**
      * @see org.apache.lenya.cms.site.SiteManager#contains(org.apache.lenya.cms.publication.Document)
      */
     public boolean contains(Document resource) throws SiteException {
-        // TODO Auto-generated method stub
         return false;
     }
 
@@ -71,7 +57,6 @@
      * @see org.apache.lenya.cms.site.SiteManager#containsInAnyLanguage(org.apache.lenya.cms.publication.Document)
      */
     public boolean containsInAnyLanguage(Document resource) throws SiteException {
-        // TODO Auto-generated method stub
         return false;
     }
 
@@ -80,8 +65,6 @@
      *      org.apache.lenya.cms.publication.Document)
      */
     public void copy(Document sourceDocument, Document destinationDocument) throws SiteException {
-        // TODO Auto-generated method stub
-
     }
 
     /**
@@ -91,30 +74,17 @@
     public void setVisibleInNav(Document document, boolean visibleInNav) throws SiteException {
     }
 
-    /**
-     * @see org.apache.lenya.cms.site.SiteManager#getDocuments(org.apache.lenya.cms.publication.DocumentFactory,
-     *      org.apache.lenya.cms.publication.Publication, java.lang.String)
-     */
-    public Document[] getDocuments(DocumentFactory map, Publication publication, String area)
-            throws SiteException {
+    public Document[] getDocuments(Publication publication, String area) throws SiteException {
         // TODO Auto-generated method stub
         return null;
     }
 
-    /**
-     * @see org.apache.lenya.cms.site.SiteManager#getSiteStructure(org.apache.lenya.cms.publication.DocumentFactory,
-     *      org.apache.lenya.cms.publication.Publication, java.lang.String)
-     */
-    public SiteStructure getSiteStructure(DocumentFactory map, Publication publiation, String area)
-            throws SiteException {
+    public SiteStructure getSiteStructure(Publication publiation, String area) throws SiteException {
         // TODO Auto-generated method stub
         return null;
     }
 
-    /**
-     * @see org.apache.lenya.cms.site.SiteManager#getAvailableDocument(org.apache.lenya.cms.publication.Document)
-     */
-    public DocumentLocator getAvailableLocator(DocumentFactory factory, DocumentLocator document)
+    public DocumentLocator getAvailableLocator(Session session, DocumentLocator document)
             throws SiteException {
         return document;
     }
@@ -127,7 +97,7 @@
         // TODO Auto-generated method stub
     }
 
-    public DocumentLocator[] getRequiredResources(DocumentFactory map, DocumentLocator locator)
+    public DocumentLocator[] getRequiredResources(Session session, DocumentLocator locator)
             throws SiteException {
         return new DocumentLocator[0];
     }

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java Mon Feb  9 18:49:13 2009
@@ -175,7 +175,7 @@
         WorkflowEventDescriptor descriptor = new WorkflowEventDescriptor(version);
         RepositoryEvent event = RepositoryEventFactory.createEvent(getDocument(),
                 getLogger(), descriptor);
-        getDocument().getRepositoryNode().getSession().enqueueEvent(event);
+        getDocument().getRepositoryNode().getRepositorySession().enqueueEvent(event);
     }
 
     protected void addToMetaData(String versionString) {

Modified: lenya/trunk/org.apache.lenya.core.impl/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/pom.xml?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.impl/pom.xml Mon Feb  9 18:49:13 2009
@@ -14,6 +14,25 @@
   <artifactId>lenya-core-impl</artifactId>
   <packaging>jar</packaging>
   <name>Apache Lenya Core Implementation</name>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <!-- export our test classes in a separate jar -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  
+      
   <dependencies>
     <dependency>
       <groupId>org.apache.avalon.framework</groupId>
@@ -27,6 +46,7 @@
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
     </dependency>
+    
     <!-- Tests -->
     <dependency>
       <groupId>junit</groupId>
@@ -39,11 +59,14 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
+    <!-- FIXME: This dependency is transitive and should be obtained automatically
+      see http://jira.codehaus.org/browse/MNG-1378 -->
     <dependency>
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-sitemap-impl</artifactId>
-      <type>test-jar</type>
       <scope>test</scope>
+      <type>test-jar</type>
     </dependency>
+    
   </dependencies>
 </project>

Modified: lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/AreaImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/AreaImpl.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/AreaImpl.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/AreaImpl.java Mon Feb  9 18:49:13 2009
@@ -37,16 +37,16 @@
 
     private String name;
     private Publication pub;
-    private DocumentFactory factory;
     private NodeFactory nodeFactory;
+    private Session session;
 
     /**
-     * @param factory The factory.
+     * @param session The factory.
      * @param pub The publication.
      * @param name The area name.
      */
-    public AreaImpl(DocumentFactory factory, NodeFactory nodeFactory, Publication pub, String name) {
-        this.factory = factory;
+    public AreaImpl(Session session, NodeFactory nodeFactory, Publication pub, String name) {
+        this.session = session;
         this.pub = pub;
         this.name = name;
         this.nodeFactory = nodeFactory;
@@ -64,8 +64,8 @@
         } else {
             String sourceUri = DocumentImpl.getSourceURI(pub, name, uuid, language);
             try {
-                Node node = (Node) getPublication().getSession().getRepositoryItem(
-                        getNodeFactory(), sourceUri);
+                org.apache.lenya.cms.repository.Session repoSession = (org.apache.lenya.cms.repository.Session) this.session;
+                Node node = (Node) repoSession.getRepositoryItem(getNodeFactory(), sourceUri);
                 return node.exists();
             } catch (RepositoryException e) {
                 throw new RuntimeException(e);
@@ -77,8 +77,18 @@
         return this.nodeFactory;
     }
 
-    public Document getDocument(String uuid, String language) throws PublicationException {
-        return this.factory.get(getPublication(), getName(), uuid, language);
+    public Document getDocument(String uuid, String language) throws ResourceNotFoundException {
+        return getDocumentFactory().get(getPublication(), getName(), uuid, language);
+    }
+
+    public Document getDocument(String uuid, String language, int revision) throws ResourceNotFoundException {
+        return getDocumentFactory().get(getPublication(), getName(), uuid, language, revision);
+    }
+
+    protected DocumentFactory getDocumentFactory() {
+        SessionImpl sessionImpl = (SessionImpl) this.session;
+        DocumentFactory factory = sessionImpl.getDocumentFactory();
+        return factory;
     }
 
     public String getName() {
@@ -97,7 +107,7 @@
             try {
                 siteManager = (SiteManager) WebAppContextUtils.getCurrentWebApplicationContext()
                         .getBean(SiteManager.ROLE + "/" + getPublication().getSiteManagerHint());
-                this.site = siteManager.getSiteStructure(this.factory, getPublication(), getName());
+                this.site = siteManager.getSiteStructure(getPublication(), getName());
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }

Modified: lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryBuilderImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryBuilderImpl.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryBuilderImpl.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryBuilderImpl.java Mon Feb  9 18:49:13 2009
@@ -20,7 +20,6 @@
 import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.excalibur.source.SourceResolver;
 import org.apache.lenya.cms.metadata.MetaDataCache;
-import org.apache.lenya.cms.repository.Session;
 
 /**
  * Document factory builder implementation.
@@ -33,7 +32,7 @@
     private SourceResolver sourceResolver;
 
     public DocumentFactory createDocumentFactory(Session session) {
-        DocumentFactoryImpl factory = new DocumentFactoryImpl(session, getLogger());
+        DocumentFactoryImpl factory = new DocumentFactoryImpl(session);
         factory.setMetaDataCache(getMetaDataCache());
         factory.setPublicationManager(getPublicationManager());
         factory.setSourceResolver(getSourceResolver());

Modified: lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryImpl.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryImpl.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/publication/DocumentFactoryImpl.java Mon Feb  9 18:49:13 2009
@@ -20,30 +20,28 @@
 import java.util.Arrays;
 import java.util.StringTokenizer;
 
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.commons.lang.Validate;
 import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.excalibur.source.SourceResolver;
 import org.apache.lenya.cms.metadata.MetaDataCache;
 import org.apache.lenya.cms.repository.RepositoryException;
 import org.apache.lenya.cms.repository.RepositoryItem;
-import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.cms.site.SiteStructure;
+import org.apache.lenya.cms.repository.RepositoryItemFactory;
 
 /**
  * A DocumentIdentityMap avoids the multiple instanciation of a document object.
  * 
  * @version $Id: DocumentIdentityMap.java 264153 2005-08-29 15:11:14Z andreas $
  */
-public class DocumentFactoryImpl extends AbstractLogEnabled implements DocumentFactory {
+public class DocumentFactoryImpl implements DocumentFactory, RepositoryItemFactory {
+
+    private static final Log logger = LogFactory.getLog(DocumentFactoryImpl.class);
 
     private Session session;
     private MetaDataCache metaDataCache;
     private SourceResolver sourceResolver;
-
+    
     /**
      * @return The session.
      */
@@ -54,9 +52,8 @@
     /**
      * Ctor.
      * @param session The session to use.
-     * @param logger The logger to use.
      */
-    public DocumentFactoryImpl(Session session, Log logger) {
+    public DocumentFactoryImpl(Session session) {
         this.session = session;
     }
 
@@ -67,46 +64,50 @@
      * @param uuid The document UUID.
      * @param language The language.
      * @return A document.
-     * @throws DocumentBuildException if an error occurs.
+     * @throws ResourceNotFoundException if an error occurs.
      */
     public Document get(Publication publication, String area, String uuid, String language)
-            throws DocumentBuildException {
+            throws ResourceNotFoundException {
         return get(publication, area, uuid, language, -1);
     }
 
     public Document get(Publication publication, String area, String uuid, String language,
-            int revision) throws DocumentBuildException {
-        if (getLogger().isDebugEnabled())
-            getLogger().debug(
+            int revision) throws ResourceNotFoundException {
+        if (logger.isDebugEnabled())
+            logger.debug(
                     "DocumentIdentityMap::get() called on publication [" + publication.getId()
                             + "], area [" + area + "], UUID [" + uuid + "], language [" + language
                             + "]");
 
         String key = getKey(publication, area, uuid, language, revision);
 
-        if (getLogger().isDebugEnabled())
-            getLogger().debug(
+        if (logger.isDebugEnabled())
+            logger.debug(
                     "DocumentIdentityMap::get() got key [" + key + "] from DocumentFactory");
 
         try {
-            return (Document) getSession().getRepositoryItem(this, key);
+            return (Document) getRepositorySession().getRepositoryItem(this, key);
         } catch (RepositoryException e) {
-            throw new DocumentBuildException(e);
+            throw new ResourceNotFoundException(e);
         }
     }
 
+    protected org.apache.lenya.cms.repository.Session getRepositorySession() {
+        return (org.apache.lenya.cms.repository.Session) this.session;
+    }
+
     /**
      * Returns the document identified by a certain web application URL.
      * @param webappUrl The web application URL.
      * @return A document.
-     * @throws DocumentBuildException if an error occurs.
+     * @throws ResourceNotFoundException if an error occurs.
      */
-    public Document getFromURL(String webappUrl) throws DocumentBuildException {
+    public Document getFromURL(String webappUrl) throws ResourceNotFoundException {
         String key = getKey(webappUrl);
         try {
-            return (Document) getSession().getRepositoryItem(this, key);
+            return (Document) getRepositorySession().getRepositoryItem(this, key);
         } catch (RepositoryException e) {
-            throw new DocumentBuildException(e);
+            throw new ResourceNotFoundException(e);
         }
     }
 
@@ -127,9 +128,9 @@
      * @param document The document to clone.
      * @param area The area of the target document.
      * @return A document.
-     * @throws DocumentBuildException if an error occurs.
+     * @throws ResourceNotFoundException if an error occurs.
      */
-    public Document getAreaVersion(Document document, String area) throws DocumentBuildException {
+    public Document getAreaVersion(Document document, String area) throws ResourceNotFoundException {
         return get(document.getPublication(), area, document.getUUID(), document.getLanguage());
     }
 
@@ -139,10 +140,10 @@
      * @param area The area.
      * @param documentId The document ID.
      * @return A document.
-     * @throws DocumentBuildException if an error occurs.
+     * @throws ResourceNotFoundException if an error occurs.
      */
     public Document get(Publication publication, String area, String documentId)
-            throws DocumentBuildException {
+            throws ResourceNotFoundException {
         return get(publication, area, documentId, publication.getDefaultLanguage());
     }
 
@@ -176,9 +177,9 @@
      * Checks if a webapp URL represents a document.
      * @param webappUrl A web application URL.
      * @return A boolean value.
-     * @throws DocumentBuildException if an error occurs.
+     * @throws ResourceNotFoundException if an error occurs.
      */
-    public boolean isDocument(String webappUrl) throws DocumentBuildException {
+    public boolean isDocument(String webappUrl) throws ResourceNotFoundException {
         Validate.notNull(webappUrl);
         PublicationManager pubMgr = getPublicationManager();
         try {
@@ -187,12 +188,12 @@
             if (pubId != null && Arrays.asList(pubMgr.getPublicationIds()).contains(pubId)) {
                 Publication pub = pubMgr.getPublication(this, pubId);
                 DocumentBuilder builder = pub.getDocumentBuilder();
-                return builder.isDocument(this, webappUrl);
+                return builder.isDocument(this.session, webappUrl);
             } else {
                 return false;
             }
         } catch (PublicationException e) {
-            throw new DocumentBuildException(e);
+            throw new ResourceNotFoundException(e);
         }
     }
 
@@ -202,11 +203,12 @@
      * @param area The area.
      * @param uuid The document UUID.
      * @param language The language.
-     * @param revision 
+     * @param revision
      * @return A key.
      */
-    public String getKey(Publication publication, String area, String uuid, String language, int revision) {
-    	Validate.notNull(publication);
+    public String getKey(Publication publication, String area, String uuid, String language,
+            int revision) {
+        Validate.notNull(publication);
         Validate.notNull(area);
         Validate.notNull(uuid);
         Validate.notNull(language);
@@ -240,7 +242,7 @@
             URLInformation info = new URLInformation(webappUrl);
             Publication publication = getPublication(info.getPublicationId());
             DocumentBuilder builder = publication.getDocumentBuilder();
-            locator = builder.getLocator(this, webappUrl);
+            locator = builder.getLocator(this.session, webappUrl);
 
         } catch (Exception e) {
             throw new RuntimeException(e);
@@ -252,9 +254,9 @@
      * @see org.apache.lenya.transaction.IdentifiableFactory#build(org.apache.lenya.transaction.IdentityMap,
      *      java.lang.String)
      */
-    public RepositoryItem buildItem(Session session, String key) throws RepositoryException {
-        if (getLogger().isDebugEnabled())
-            getLogger().debug("DocumentFactory::build() called with key [" + key + "]");
+    public RepositoryItem buildItem(org.apache.lenya.cms.repository.Session session, String key) throws RepositoryException {
+        if (logger.isDebugEnabled())
+            logger.debug("DocumentFactory::build() called with key [" + key + "]");
 
         StringTokenizer tokenizer = new StringTokenizer(key, ":");
         String publicationId = tokenizer.nextToken();
@@ -270,47 +272,44 @@
             DocumentBuilder builder = publication.getDocumentBuilder();
             DocumentIdentifier identifier = new DocumentIdentifier(publicationId, area, uuid,
                     language);
-            document = buildDocument(this, identifier, revision, builder);
+            document = buildDocument(identifier, revision, builder);
         } catch (Exception e) {
             throw new RepositoryException(e);
         }
-        if (getLogger().isDebugEnabled())
-            getLogger().debug("DocumentFactory::build() done.");
+        if (logger.isDebugEnabled())
+            logger.debug("DocumentFactory::build() done.");
 
         return document;
     }
 
-    protected Document buildDocument(DocumentFactory map, DocumentIdentifier identifier,
-            int revision, DocumentBuilder builder) throws DocumentBuildException {
-
-        DocumentImpl document = createDocument(map, identifier, revision, builder);
-        return document;
+    protected Document buildDocument(DocumentIdentifier identifier, int revision,
+            DocumentBuilder builder) throws DocumentBuildException {
+        return createDocument(identifier, revision, builder);
     }
 
     /**
      * 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 revision The revision or -1 for the latest revision.
      * @param builder The document builder.
      * @return A document.
      * @throws DocumentBuildException when something went wrong.
      */
-    protected DocumentImpl createDocument(DocumentFactory map, DocumentIdentifier identifier,
-            int revision, DocumentBuilder builder) throws DocumentBuildException {
-        DocumentImpl doc = new DocumentImpl(map, identifier, revision, getLogger());
+    protected DocumentImpl createDocument(DocumentIdentifier identifier, int revision,
+            DocumentBuilder builder) throws DocumentBuildException {
+        DocumentImpl doc = new DocumentImpl(session, identifier, revision);
         doc.setMetaDataCache(getMetaDataCache());
         doc.setSourceResolver(getSourceResolver());
         return doc;
     }
 
-    public Document get(DocumentIdentifier identifier) throws DocumentBuildException {
+    public Document get(DocumentIdentifier identifier) throws ResourceNotFoundException {
         try {
             Publication pub = getPublication(identifier.getPublicationId());
             return get(pub, identifier.getArea(), identifier.getUUID(), identifier.getLanguage());
         } catch (PublicationException e) {
-            throw new DocumentBuildException(e);
+            throw new ResourceNotFoundException(e);
         }
     }
 
@@ -318,17 +317,6 @@
         return Document.TRANSACTIONABLE_TYPE;
     }
 
-    public Document get(DocumentLocator locator) throws DocumentBuildException {
-        try {
-            Publication pub = getPublication(locator.getPublicationId());
-            SiteStructure site = pub.getArea(locator.getArea()).getSite();
-            String uuid = site.getNode(locator.getPath()).getUuid();
-            return get(pub, locator.getArea(), uuid, locator.getLanguage());
-        } catch (PublicationException e) {
-            throw new DocumentBuildException(e);
-        }
-    }
-
     public Publication getPublication(String id) throws PublicationException {
         return getPublicationManager().getPublication(this, id);
     }
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.