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/11/27 15:02:17 UTC

svn commit: r479620 [1/2] - in /lenya/trunk/src: impl/java/org/apache/lenya/cms/publication/ java/org/apache/lenya/ac/ java/org/apache/lenya/cms/cocoon/flow/ java/org/apache/lenya/cms/cocoon/source/ java/org/apache/lenya/cms/cocoon/transformation/ java...

Author: andreas
Date: Mon Nov 27 06:02:13 2006
New Revision: 479620

URL: http://svn.apache.org/viewvc?view=rev&rev=479620
Log:
Refactored SourceNode and observation mechanism, generate observation events before transaction is committed.

Added:
    lenya/trunk/src/java/org/apache/lenya/cms/observation/DocumentEvent.java
    lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java
    lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/ContentSourceWrapper.java
    lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/MetaSourceWrapper.java
    lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceWrapper.java
Modified:
    lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java
    lenya/trunk/src/java/org/apache/lenya/ac/Credential.java
    lenya/trunk/src/java/org/apache/lenya/ac/Policy.java
    lenya/trunk/src/java/org/apache/lenya/ac/PolicyManager.java
    lenya/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelper.java
    lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSource.java
    lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSourceFactory.java
    lenya/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/MetaDataTransformer.java
    lenya/trunk/src/java/org/apache/lenya/cms/observation/ObservationException.java
    lenya/trunk/src/java/org/apache/lenya/cms/observation/ObservationRegistry.java
    lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java
    lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryListener.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/IdentityDocumentIdToPathMapper.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java
    lenya/trunk/src/java/org/apache/lenya/cms/rc/RCML.java
    lenya/trunk/src/java/org/apache/lenya/cms/rc/RevisionController.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/NodeListener.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItem.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryUtil.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/Session.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
    lenya/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java
    lenya/trunk/src/java/org/apache/lenya/transaction/Transactionable.java
    lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWork.java
    lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java
    lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/CredentialImpl.java
    lenya/trunk/src/modules-core/janitor/java/src/org/apache/lenya/cms/janitor/ContentJanitor.java
    lenya/trunk/src/modules-core/observation-impl/java/src/org/apache/lenya/cms/observation/ObservationManager.java
    lenya/trunk/src/modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/TestListener.java
    lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/JCRSourceNode.java
    lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/components/Indexer.java
    lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/components/impl/IndexManagerImpl.java
    lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/fieldmodel/DateFieldDefinition.java
    lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/fieldmodel/FieldDefinition.java
    lenya/trunk/src/modules/lucene/java/src/org/apache/lenya/cms/lucene/IndexUpdaterImpl.java
    lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/RepoNode.java
    lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java
    lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeFactory.java
    lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeHistory.java
    lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java
    lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRevision.java

Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/DocumentImpl.java Mon Nov 27 06:02:13 2006
@@ -19,7 +19,6 @@
 package org.apache.lenya.cms.publication;
 
 import java.io.File;
-import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -412,6 +411,11 @@
      * @see Document#getResourceType()
      */
     public ResourceType getResourceType() throws DocumentException {
+        
+        if (!exists()) {
+            throw new DocumentException("The document [" + this + "] doesn't exist!");
+        }
+        
         if (this.resourceType == null) {
             ServiceSelector selector = null;
             try {

Modified: lenya/trunk/src/java/org/apache/lenya/ac/Credential.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/ac/Credential.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/Credential.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/Credential.java Mon Nov 27 06:02:13 2006
@@ -32,5 +32,18 @@
      */
     Role getRole();
 
+    /**
+     * @return The method, one of {@link #GRANT} and {@link #DENY}.
+     */
     String getMethod();
+    
+    /**
+     * The "grant" method.
+     */
+    String GRANT = "grant";
+    
+    /**
+     * The "deny" method.
+     */
+    String DENY = "deny";
 }

Modified: lenya/trunk/src/java/org/apache/lenya/ac/Policy.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/ac/Policy.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/Policy.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/Policy.java Mon Nov 27 06:02:13 2006
@@ -26,8 +26,19 @@
  */
 public interface Policy {
     
+    /**
+     * The identity was not matched in this policy.
+     */
     int RESULT_NOT_MATCHED = 0;
+    
+    /**
+     * The role is denied for the identity.
+     */
     int RESULT_DENIED = 1;
+    
+    /**
+     * The role is granted for the identity.
+     */
     int RESULT_GRANTED = 2;
     
     /**
@@ -54,8 +65,17 @@
      */
     boolean isEmpty() throws AccessControlException;
     
+    /**
+     * @param identity The identity.
+     * @return All credentials defined by this policy for this identity.
+     * @throws AccessControlException if an error occurs.
+     */
     Credential[] getCredentials(Identity identity) throws AccessControlException;
     
+    /**
+     * @return All credentials defined by this policy.
+     * @throws AccessControlException if an error occurs.
+     */
     Credential[] getCredentials() throws AccessControlException;
 
 }

Modified: lenya/trunk/src/java/org/apache/lenya/ac/PolicyManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/ac/PolicyManager.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/PolicyManager.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/PolicyManager.java Mon Nov 27 06:02:13 2006
@@ -55,8 +55,8 @@
     /**
      * Return all credentials for this url
      * 
+     * @param controller The Accreditable Manager
      * @param url The AC url
-     * @param manager The Accreditable Manager
      * @return An array of credentials
      * @throws AccessControlException when something went wrong.
      */

Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelper.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelper.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/flow/FlowHelper.java Mon Nov 27 06:02:13 2006
@@ -118,7 +118,7 @@
      * @param backup Wether a new revision should be created.
      * @throws FileReservedCheckInException
      * @throws Exception
-     * @see RevisionController#reservedCheckIn(String, String, boolean, boolean)
+     * @see RevisionController#reservedCheckIn(org.apache.lenya.cms.repository.Node, String, boolean, boolean)
      */
     void reservedCheckIn(FOM_Cocoon cocoon, boolean backup) throws FileReservedCheckInException,
             Exception;

Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSource.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSource.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSource.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSource.java Mon Nov 27 06:02:13 2006
@@ -41,6 +41,11 @@
     Source archive;
     String documentName;
 
+    /**
+     * Ctor.
+     * @param archive The archive source.
+     * @param fileName The filename.
+     */
     public ZipSource(Source archive, String fileName) {
         this.archive = archive;
         this.documentName = fileName;

Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSourceFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSourceFactory.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSourceFactory.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/ZipSourceFactory.java Mon Nov 27 06:02:13 2006
@@ -47,6 +47,9 @@
     implements SourceFactory, ThreadSafe, Serviceable {
 
     protected ServiceManager manager;
+    /**
+     * The URL scheme, including the colon.
+     */
     public static String ZIP_SOURCE_SCHEME = "zip:";
 
     public Source getSource(String location, Map parameters)

Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/MetaDataTransformer.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/MetaDataTransformer.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/MetaDataTransformer.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/transformation/MetaDataTransformer.java Mon Nov 27 06:02:13 2006
@@ -20,8 +20,10 @@
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
-import org.xml.sax.helpers.DefaultHandler;;
 
+/**
+ * Meta data transformer.
+ */
 public class MetaDataTransformer extends AbstractSAXTransformer implements
         Disposable {
     /**

Added: lenya/trunk/src/java/org/apache/lenya/cms/observation/DocumentEvent.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/observation/DocumentEvent.java?view=auto&rev=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/observation/DocumentEvent.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/observation/DocumentEvent.java Mon Nov 27 06:02:13 2006
@@ -0,0 +1,88 @@
+/*
+ * 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.observation;
+
+import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.cms.repository.Session;
+
+/**
+ * Document-related event.
+ */
+public class DocumentEvent extends RepositoryEvent {
+
+    private String pubId;
+    private String area;
+    private String uuid;
+    private String language;
+    private ResourceType resourceType;
+
+    /**
+     * Ctor.
+     * @param session The session.
+     * @param pubId The publication ID.
+     * @param area The area.
+     * @param uuid The UUID.
+     * @param language The language.
+     * @param resourceType The resource type.
+     */
+    public DocumentEvent(Session session, String pubId, String area, String uuid, String language,
+            ResourceType resourceType) {
+        super(session);
+        this.pubId = pubId;
+        this.area = area;
+        this.uuid = uuid;
+        this.language = language;
+        this.resourceType = resourceType;
+    }
+
+    /**
+     * @return The area.
+     */
+    public String getArea() {
+        return area;
+    }
+
+    /**
+     * @return The publication ID.
+     */
+    public String getPublicationId() {
+        return pubId;
+    }
+
+    /**
+     * @return The UUID.
+     */
+    public String getUuid() {
+        return uuid;
+    }
+
+    /**
+     * @return The language.
+     */
+    public String getLanguage() {
+        return language;
+    }
+
+    /**
+     * @return The resource type.
+     */
+    public ResourceType getResourceType() {
+        return this.resourceType;
+    }
+
+}

Modified: lenya/trunk/src/java/org/apache/lenya/cms/observation/ObservationException.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/observation/ObservationException.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/observation/ObservationException.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/observation/ObservationException.java Mon Nov 27 06:02:13 2006
@@ -17,7 +17,12 @@
  */
 package org.apache.lenya.cms.observation;
 
+/**
+ * Observation-specific exception.
+ */
 public class ObservationException extends Exception {
+
+    private static final long serialVersionUID = -4025029670092614593L;
 
     /**
      * 

Modified: lenya/trunk/src/java/org/apache/lenya/cms/observation/ObservationRegistry.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/observation/ObservationRegistry.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/observation/ObservationRegistry.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/observation/ObservationRegistry.java Mon Nov 27 06:02:13 2006
@@ -20,8 +20,14 @@
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.repository.NodeListener;
 
+/**
+ * Observation registry.
+ */
 public interface ObservationRegistry extends NodeListener {
 
+    /**
+     * The Avalon service role.
+     */
     String ROLE = ObservationRegistry.class.getName();
 
     /**

Modified: lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEvent.java Mon Nov 27 06:02:13 2006
@@ -17,52 +17,28 @@
  */
 package org.apache.lenya.cms.observation;
 
-import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.cms.repository.Session;
 
 /**
- * Repository event.
+ * A repository event provides additional information if a document was added, changed, or removed.
  */
 public class RepositoryEvent {
 
-    private String pubId;
-    private String area;
-    private String uuid;
-    private String documentUrl;
-    private String language;
-    private ResourceType resourceType;
+    private Session session;
 
-    public RepositoryEvent(String pubId, String area, String uuid, String language,
-            ResourceType resourceType, String documentUrl) {
-        this.pubId = pubId;
-        this.area = area;
-        this.uuid = uuid;
-        this.language = language;
-        this.documentUrl = documentUrl;
-        this.resourceType = resourceType;
-    }
-
-    public String getArea() {
-        return area;
-    }
-
-    public String getDocumentUrl() {
-        return documentUrl;
-    }
-
-    public String getPublicationId() {
-        return pubId;
-    }
-
-    public String getUuid() {
-        return uuid;
-    }
-
-    public String getLanguage() {
-        return language;
+    /**
+     * Ctor.
+     * @param session The session.
+     */
+    public RepositoryEvent(Session session) {
+        this.session = session;
     }
     
-    public ResourceType getResourceType() {
-        return this.resourceType;
+    /**
+     * @return The session.
+     */
+    public Session getSession() {
+        return this.session;
     }
 
 }

Added: lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java?view=auto&rev=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryEventFactory.java Mon Nov 27 06:02:13 2006
@@ -0,0 +1,110 @@
+/*
+ * 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.observation;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentException;
+import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentUtil;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.repository.Node;
+
+/**
+ * Factory to create repository events.
+ */
+public class RepositoryEventFactory {
+
+    /**
+     * Creates a repository event for a node.
+     * @param manager The service manager.
+     * @param node The node.
+     * @param logger The logger.
+     * @return An event.
+     */
+    public static final RepositoryEvent createEvent(ServiceManager manager, Node node, Logger logger) {
+        RepositoryEvent event;
+        Document doc = null;
+        if (!node.getSourceURI().endsWith("meta")) {
+            doc = getDocument(manager, node, logger);
+        }
+        if (doc != null) {
+            try {
+                event = new DocumentEvent(node.getSession(), doc.getPublication().getId(), doc
+                        .getArea(), doc.getUUID(), doc.getLanguage(), doc.getResourceType());
+            } catch (DocumentException e) {
+                throw new RuntimeException(e);
+            }
+        } else {
+            event = new RepositoryEvent(node.getSession());
+        }
+        return event;
+    }
+
+    /**
+     * @param manager The service manager.
+     * @param node The node.
+     * @param logger The logger.
+     * @return The document represented by the node or <code>null</code> if
+     *         the node doesn't represent a document.
+     */
+    protected static final Document getDocument(ServiceManager manager, Node node, Logger logger) {
+
+        final String sourceUri = node.getSourceURI();
+        if (sourceUri.endsWith(".xml")) {
+            return null;
+        }
+
+        Document doc = null;
+
+        if (!sourceUri.startsWith("lenya://")) {
+            throw new IllegalStateException("The source URI [" + sourceUri
+                    + "] doesn't start with lenya://");
+        }
+
+        String path = sourceUri.substring("lenya://lenya/pubs/".length());
+
+        String[] steps = path.split("/");
+        String pubId = steps[0];
+        String area = steps[2];
+
+        try {
+
+            DocumentFactory factory = DocumentUtil
+                    .createDocumentFactory(manager, node.getSession());
+            Publication pub = factory.getPublication(pubId);
+            String docPath = path.substring((pubId + "/content/" + area).length());
+
+            String uuid = docPath.substring(1, docPath.length() - "/en".length());
+            String language = docPath.substring(docPath.length() - "en".length());
+
+            doc = factory.get(pub, area, uuid, language);
+
+            if (doc == null) {
+                // this happens if the node was not a document node
+                logger.info("No document found for node [" + sourceUri + "]");
+            }
+
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return doc;
+    }
+
+}

Modified: lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryListener.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryListener.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryListener.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/observation/RepositoryListener.java Mon Nov 27 06:02:13 2006
@@ -26,12 +26,12 @@
      * Called when a document was changed.
      * @param event The event.
      */
-    void documentChanged(RepositoryEvent event);
+    void documentChanged(DocumentEvent event);
 
     /**
      * Called when a document was removed.
      * @param event The event.
      */
-    void documentRemoved(RepositoryEvent event);
+    void documentRemoved(DocumentEvent event);
     
 }

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?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocumentBuilder.java Mon Nov 27 06:02:13 2006
@@ -134,7 +134,8 @@
 
     /**
      * Builds the canonical document URL.
-     * @param locator The document.
+     * @param factory The document factory.
+     * @param locator The document locator.
      * @return A string.
      */
     protected String buildCanonicalDocumentUrl(DocumentFactory factory, DocumentLocator locator) {
@@ -157,10 +158,6 @@
         return url;
     }
 
-    /**
-     * @see org.apache.lenya.cms.publication.DocumentBuilder#buildCanonicalUrl(
-     *      org.apache.lenya.cms.publication.DocumentLocator)
-     */
     public String buildCanonicalUrl(DocumentFactory factory, DocumentLocator doc) {
 
         String documentUrl = buildCanonicalDocumentUrl(factory, doc);
@@ -168,9 +165,6 @@
         return url;
     }
 
-    /**
-     * @see org.apache.lenya.cms.publication.DocumentBuilder#getLocator( java.lang.String)
-     */
     public DocumentLocator getLocator(DocumentFactory factory, String webappUrl)
             throws DocumentBuildException {
 

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java Mon Nov 27 06:02:13 2006
@@ -113,6 +113,7 @@
     /**
      * Returns the date of the last modification of this document.
      * @return A date denoting the date of the last modification.
+     * @throws DocumentException if an error occurs.
      */
     long getLastModified() throws DocumentException;
 

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/IdentityDocumentIdToPathMapper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/IdentityDocumentIdToPathMapper.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/IdentityDocumentIdToPathMapper.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/IdentityDocumentIdToPathMapper.java Mon Nov 27 06:02:13 2006
@@ -39,14 +39,6 @@
     }
 
     /**
-     * @see org.apache.lenya.cms.publication.DocumentIdToPathMapper#getDirectory(org.apache.lenya.cms.publication.Publication,
-     *      java.lang.String, java.lang.String)
-     */
-    public File getDirectory(Publication publication, String area, String documentId) {
-        return getFile(publication, area, documentId, null).getParentFile();
-    }
-
-    /**
      * @see org.apache.lenya.cms.publication.DocumentIdToPathMapper#getPath(java.lang.String,
      *      java.lang.String)
      */

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/PageEnvelope.java Mon Nov 27 06:02:13 2006
@@ -167,6 +167,7 @@
 
     /**
      * Constructor.
+     * @param manager The service manager.
      */
     protected PageEnvelope(ServiceManager manager) {
         this.manager = manager;
@@ -174,6 +175,7 @@
 
     /**
      * Creates a page envelope from an object model.
+     * @param manager The service manager.
      * @param map The identity map to use.
      * @param contextPath The servlet context prefix.
      * @param webappUrl The web application URL.

Modified: lenya/trunk/src/java/org/apache/lenya/cms/rc/RCML.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/rc/RCML.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/rc/RCML.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/rc/RCML.java Mon Nov 27 06:02:13 2006
@@ -117,7 +117,6 @@
     /**
      * Prune the list of entries and delete the corresponding backups. Limit the number of entries
      * to the value maximalNumberOfEntries (2maxNumberOfRollbacks(configured)+1)
-     * @param backupDir The backup directory
      * @throws Exception if an error occurs
      */
     public void pruneEntries() throws Exception;

Modified: lenya/trunk/src/java/org/apache/lenya/cms/rc/RevisionController.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/rc/RevisionController.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/rc/RevisionController.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/rc/RevisionController.java Mon Nov 27 06:02:13 2006
@@ -207,7 +207,9 @@
             }
         }
         
-        rcml.makeBackup(time);
+        if (backup) {
+            rcml.makeBackup(time);
+        }
 
         if (newVersion) {
             rcml.checkOutIn(RCML.ci, identity, time, backup);

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java Mon Nov 27 06:02:13 2006
@@ -20,6 +20,7 @@
 import java.io.OutputStream;
 import java.util.Collection;
 
+import org.apache.lenya.cms.observation.RepositoryEvent;
 import org.apache.lenya.cms.rc.RCML;
 
 /**
@@ -122,18 +123,6 @@
      */
     void registerRemoved() throws RepositoryException;
     
-    /**
-     * @param listener The listener to add.
-     * @throws RepositoryException if the listener is already registered.
-     */
-    void addListener(NodeListener listener) throws RepositoryException;
-    
-    /**
-     * Checks if a listener is registered.
-     * @param listener The listener.
-     * @return A boolean value.
-     */
-    boolean isListenerRegistered(NodeListener listener);
     
     /**
      * @return The RCML to use for this node.
@@ -144,4 +133,9 @@
      * @return The revision history.
      */
     History getHistory();
+    
+    /**
+     * @return The event to use when this node is added/changed/removed.
+     */
+    RepositoryEvent getEvent();
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/NodeListener.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/NodeListener.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/NodeListener.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/NodeListener.java Mon Nov 27 06:02:13 2006
@@ -17,8 +17,7 @@
  */
 package org.apache.lenya.cms.repository;
 
-import org.apache.lenya.ac.Identity;
-
+import org.apache.lenya.cms.observation.RepositoryEvent;
 
 /**
  * Listener for nodes.
@@ -26,15 +25,13 @@
 public interface NodeListener {
 
     /**
-     * @param node The node which has changed.
-     * @param identity The identity who changed the node.
+     * @param event The event describing the change.
      */
-    void nodeChanged(Node node, Identity identity);
+    void nodeChanged(RepositoryEvent event);
     
     /**
-     * @param node The node which has been removed.
-     * @param identity The identity who removed the node.
+     * @param event The event describing the removal.
      */
-    void nodeRemoved(Node node, Identity identity);
+    void nodeRemoved(RepositoryEvent event);
     
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItem.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItem.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItem.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryItem.java Mon Nov 27 06:02:13 2006
@@ -17,6 +17,9 @@
  */
 package org.apache.lenya.cms.repository;
 
+/**
+ * Marker interface for repository items.
+ */
 public interface RepositoryItem {
     
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java Mon Nov 27 06:02:13 2006
@@ -69,7 +69,7 @@
     }
 
     public Session createSession(Identity identity) throws RepositoryException {
-        return new SessionImpl(new IdentityMapImpl(getLogger()), identity, getLogger());
+        return new SessionImpl(new IdentityMapImpl(getLogger()), identity, this.manager, getLogger());
     }
 
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryUtil.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryUtil.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryUtil.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/RepositoryUtil.java Mon Nov 27 06:02:13 2006
@@ -40,8 +40,7 @@
             Identity identity = getIdentity(request);
             session = createSession(manager, identity);
             request.setAttribute(Session.class.getName(), session);
-        }
-        else if (session.getIdentity() == null) {
+        } else if (session.getIdentity() == null) {
             Identity identity = getIdentity(request);
             if (identity != null) {
                 session.setIdentity(identity);

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/Session.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/Session.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/Session.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/Session.java Mon Nov 27 06:02:13 2006
@@ -51,4 +51,17 @@
     RepositoryItem getRepositoryItem(RepositoryItemFactory factory, String key)
             throws RepositoryException;
 
+    /**
+     * @param listener The listener to add.
+     * @throws RepositoryException if the listener is already registered.
+     */
+    void addListener(NodeListener listener) throws RepositoryException;
+    
+    /**
+     * Checks if a listener is registered.
+     * @param listener The listener.
+     * @return A boolean value.
+     */
+    boolean isListenerRegistered(NodeListener listener);
+
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java Mon Nov 27 06:02:13 2006
@@ -17,10 +17,17 @@
  */
 package org.apache.lenya.cms.repository;
 
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.lenya.ac.Identity;
+import org.apache.lenya.cms.observation.ObservationRegistry;
+import org.apache.lenya.cms.observation.RepositoryEvent;
 import org.apache.lenya.transaction.IdentityMap;
 import org.apache.lenya.transaction.Lock;
 import org.apache.lenya.transaction.Lockable;
@@ -35,19 +42,36 @@
  */
 public class SessionImpl extends AbstractLogEnabled implements Session {
 
+    private ServiceManager manager;
+    
     /**
      * Ctor.
      * @param map The identity map.
      * @param identity The identity.
+     * @param manager The service manager.
      * @param logger The logger.
      */
-    public SessionImpl(IdentityMap map, Identity identity, Logger logger) {
+    public SessionImpl(IdentityMap map, Identity identity, ServiceManager manager, Logger logger) {
         
         Assert.notNull("identity map", map);
         
+        this.manager = manager;
         this.unitOfWork = new UnitOfWorkImpl(map, identity, logger);
         this.unitOfWork.setIdentity(identity);
         ContainerUtil.enableLogging(this, logger);
+        
+        ObservationRegistry registry = null;
+        try {
+            registry = (ObservationRegistry) this.manager.lookup(ObservationRegistry.ROLE);
+            addListener(registry);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        finally {
+            if (registry != null) {
+                this.manager.release(registry);
+            }
+        }
     }
 
     public Identity getIdentity() {
@@ -59,7 +83,7 @@
     /**
      * @return The unit of work.
      */
-    public UnitOfWork getUnitOfWork() {
+    protected UnitOfWork getUnitOfWork() {
         return this.unitOfWork;
     }
 
@@ -68,11 +92,41 @@
      * @throws RepositoryException if an error occurs.
      */
     public void commit() throws RepositoryException {
+        
+        Set modifiedEvents = createEvents(this.modifiedObjects);
+        Set removedEvents = createEvents(this.removedObjects);
+        
         try {
             getUnitOfWork().commit();
         } catch (TransactionException e) {
             throw new RepositoryException(e);
         }
+        
+        for (Iterator i = modifiedEvents.iterator(); i.hasNext(); ) {
+            RepositoryEvent event = (RepositoryEvent) i.next();
+            for (Iterator l = this.listeners.iterator(); l.hasNext(); ) {
+                NodeListener listener = (NodeListener) l.next();
+                listener.nodeChanged(event);
+            }
+        }
+        for (Iterator i = removedEvents.iterator(); i.hasNext(); ) {
+            RepositoryEvent event = (RepositoryEvent) i.next();
+            for (Iterator l = this.listeners.iterator(); l.hasNext(); ) {
+                NodeListener listener = (NodeListener) l.next();
+                listener.nodeRemoved(event);
+            }
+        }
+    }
+
+    protected Set createEvents(Set transactionables) {
+        Set events = new HashSet();
+        for (Iterator i = transactionables.iterator(); i.hasNext(); ) {
+            Transactionable t = (Transactionable) i.next();
+            if (t instanceof Node) {
+                events.add(((Node) t).getEvent());
+            }
+        }
+        return events;
     }
 
     /**
@@ -97,17 +151,24 @@
         return (RepositoryItem) ((UnitOfWorkImpl) getUnitOfWork()).getIdentityMap().get(wrapper,
                 key);
     }
+    
+    private Set newObjects = new HashSet();
+    private Set modifiedObjects = new HashSet();
+    private Set removedObjects = new HashSet();
 
     public void registerNew(Transactionable object) throws TransactionException {
         getUnitOfWork().registerNew(object);
+        this.newObjects.add(object);
     }
 
     public void registerDirty(Transactionable object) throws TransactionException {
         getUnitOfWork().registerDirty(object);
+        this.modifiedObjects.add(object);
     }
 
     public void registerRemoved(Transactionable object) throws TransactionException {
         getUnitOfWork().registerRemoved(object);
+        this.removedObjects.add(object);
     }
 
     public void setIdentity(Identity identity) {
@@ -124,6 +185,20 @@
 
     public void removeLock(Lockable lockable) throws TransactionException {
         getUnitOfWork().removeLock(lockable);
+    }
+
+    private Set listeners = new HashSet();
+
+    public void addListener(NodeListener listener) throws RepositoryException {
+        if (this.listeners.contains(listener)) {
+            throw new RepositoryException("The listener [" + listener
+                    + "] is already registered for node [" + this + "]!");
+        }
+        this.listeners.add(listener);
+    }
+
+    public boolean isListenerRegistered(NodeListener listener) {
+        return this.listeners.contains(listener);
     }
 
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/SiteUtil.java Mon Nov 27 06:02:13 2006
@@ -17,9 +17,7 @@
  */
 package org.apache.lenya.cms.site;
 
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
 
 import org.apache.avalon.framework.service.ServiceException;
@@ -28,7 +26,6 @@
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentBuildException;
 import org.apache.lenya.cms.publication.DocumentBuilder;
-import org.apache.lenya.cms.publication.DocumentException;
 import org.apache.lenya.cms.publication.DocumentFactory;
 import org.apache.lenya.cms.publication.DocumentLocator;
 import org.apache.lenya.cms.publication.Publication;
@@ -84,183 +81,6 @@
             }
         }
         return new NodeSet(manager, subsite);
-    }
-
-    /**
-     * Replace the target documents.
-     */
-    public static final int MODE_REPLACE = 0;
-
-    /**
-     * Cancel the command if one of the target document(s) exists.
-     */
-    public static final int MODE_CANCEL = 1;
-
-    /**
-     * Change the ID of a target document if it already exists.
-     */
-    public static final int MODE_CHANGE_ID = 2;
-
-    /**
-     * Returns a document set that represents the transfer of a sub-site to another location.
-     * 
-     * @param manager The service manager.
-     * @param source The source document.
-     * @param target The target document.
-     * @param mode The mode: {@link #MODE_REPLACE},{@link #MODE_CANCEL},{@link #MODE_CHANGE_ID}.
-     * @return A map which maps source to target documents.
-     * @throws SiteException if an error occurs.
-     */
-    public static Map getTransferedSubSite(ServiceManager manager, Document source,
-            DocumentLocator target, int mode) throws SiteException {
-        Map map = new HashMap();
-        ServiceSelector selector = null;
-        SiteManager siteManager = null;
-        try {
-            selector = (ServiceSelector) manager.lookup(SiteManager.ROLE + "Selector");
-            siteManager = (SiteManager) selector.select(source.getPublication()
-                    .getSiteManagerHint());
-
-            NodeSet subSite = SiteUtil.getSubSite(manager, source.getLink().getNode());
-            for (NodeIterator i = subSite.ascending(); i.hasNext(); ) {
-                SiteNode node = i.next();
-                String[] languages = node.getLanguages();
-                for (int l = 0; l < languages.length; l++) {
-                    Document doc = node.getLink(languages[l]).getDocument();
-                    DocumentLocator targetLoc = SiteUtil.getTransferedDocument(siteManager,
-                            doc,
-                            source,
-                            target,
-                            mode);
-                    if (targetLoc != null) {
-                        map.put(doc, targetLoc);
-                    }
-                }
-            }
-
-        } catch (Exception e) {
-            throw new SiteException(e);
-        } finally {
-            if (selector != null) {
-                if (siteManager != null) {
-                    selector.release(siteManager);
-                }
-                manager.release(selector);
-            }
-        }
-        return map;
-    }
-
-    public static DocumentLocator getTransferedDocument(SiteManager siteManager, Document source,
-            Document baseSource, DocumentLocator baseTarget, int mode) throws SiteException,
-            DocumentException, DocumentBuildException {
-
-        String targetArea = baseTarget.getArea();
-        String baseSourcePath = siteManager.getSiteStructure(baseSource.getFactory(),
-                baseSource.getPublication(),
-                baseSource.getArea())
-                .getByUuid(baseSource.getUUID(), baseSource.getLanguage())
-                .getNode()
-                .getPath();
-
-        SiteStructure sourceSite = siteManager.getSiteStructure(source.getFactory(),
-                source.getPublication(),
-                source.getArea());
-        String sourcePath = sourceSite.getByUuid(source.getUUID(), source.getLanguage())
-                .getNode()
-                .getPath();
-        String suffix = sourcePath.substring(baseSourcePath.length());
-        String targetPath = baseTarget.getPath() + suffix;
-
-        DocumentLocator target = DocumentLocator.getLocator(baseTarget.getPublicationId(),
-                targetArea,
-                targetPath,
-                source.getLanguage());
-        switch (mode) {
-        case MODE_REPLACE:
-            break;
-        case MODE_CANCEL:
-            if (sourceSite.contains(target.getPath())) {
-                target = null;
-            }
-            break;
-        case MODE_CHANGE_ID:
-            target = siteManager.getAvailableLocator(source.getFactory(), target);
-            break;
-        }
-        return target;
-    }
-
-    /**
-     * Returns a document set that represents the transfer of a sub-site to another area.
-     * 
-     * @param manager The service manager.
-     * @param source The source document.
-     * @param targetArea The target area.
-     * @param mode The mode: {@link #MODE_REPLACE},{@link #MODE_CANCEL},{@link #MODE_CHANGE_ID}.
-     * @return A map which maps sources to targets.
-     * @throws SiteException if an error occurs.
-     */
-    public static Map getTransferedSubSite(ServiceManager manager, Document source,
-            String targetArea, int mode) throws SiteException {
-
-        Map map = new HashMap();
-        ServiceSelector selector = null;
-        SiteManager siteManager = null;
-        try {
-            selector = (ServiceSelector) manager.lookup(SiteManager.ROLE + "Selector");
-            siteManager = (SiteManager) selector.select(source.getPublication()
-                    .getSiteManagerHint());
-
-            NodeSet subsite = SiteUtil.getSubSite(manager, source.getLink().getNode());
-            for (NodeIterator i = subsite.ascending(); i.hasNext(); ) {
-                SiteNode node = i.next();
-                String[] langs = node.getLanguages();
-                for (int l = 0; l < langs.length; l++) {
-                    Document doc = node.getLink(langs[l]).getDocument();
-                    DocumentLocator target = SiteUtil.getTransferedDocument(siteManager,
-                            doc,
-                            targetArea,
-                            mode);
-                    if (target != null) {
-                        map.put(doc, target);
-                    }
-                }
-            }
-
-        } catch (Exception e) {
-            throw new SiteException(e);
-        } finally {
-            if (selector != null) {
-                if (siteManager != null) {
-                    selector.release(siteManager);
-                }
-                manager.release(selector);
-            }
-        }
-        return map;
-    }
-
-    public static DocumentLocator getTransferedDocument(SiteManager siteManager, Document source,
-            String targetArea, int mode) throws SiteException, DocumentException,
-            DocumentBuildException {
-        DocumentLocator target = source.getLocator().getAreaVersion(targetArea);
-        switch (mode) {
-        case MODE_REPLACE:
-            break;
-        case MODE_CANCEL:
-            SiteStructure site = siteManager.getSiteStructure(source.getFactory(),
-                    source.getPublication(),
-                    target.getArea());
-            if (site.contains(target.getPath())) {
-                target = null;
-            }
-            break;
-        case MODE_CHANGE_ID:
-            target = siteManager.getAvailableLocator(source.getFactory(), target);
-            break;
-        }
-        return target;
     }
 
     /**

Modified: lenya/trunk/src/java/org/apache/lenya/transaction/Transactionable.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/transaction/Transactionable.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/transaction/Transactionable.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/transaction/Transactionable.java Mon Nov 27 06:02:13 2006
@@ -42,14 +42,4 @@
      */
     void createTransactionable() throws TransactionException;
     
-    /**
-     * Notify the transactionable that it has been changed.
-     */
-    void changed();
-    
-    /**
-     * Notify the transactionable that it has been removed.
-     */
-    void removed();
-    
 }

Modified: lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWork.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWork.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWork.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWork.java Mon Nov 27 06:02:13 2006
@@ -97,4 +97,5 @@
      * @throws TransactionException if no lock is placed on this transactionable.
      */
     void removeLock(Lockable lockable) throws TransactionException;
+
 }

Modified: lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java Mon Nov 27 06:02:13 2006
@@ -166,23 +166,6 @@
             }
         }
 
-        notifyTransactionables();
-
-    }
-
-    protected void notifyTransactionables() {
-        for (Iterator i = this.newObjects.iterator(); i.hasNext();) {
-            Transactionable t = (Transactionable) i.next();
-            t.changed();
-        }
-        for (Iterator i = this.modifiedObjects.iterator(); i.hasNext();) {
-            Transactionable t = (Transactionable) i.next();
-            t.changed();
-        }
-        for (Iterator i = this.removedObjects.iterator(); i.hasNext();) {
-            Transactionable t = (Transactionable) i.next();
-            t.removed();
-        }
     }
 
     private Identity identity;

Modified: lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/CredentialImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/CredentialImpl.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/CredentialImpl.java (original)
+++ lenya/trunk/src/modules-core/ac-impl/java/src/org/apache/lenya/ac/impl/CredentialImpl.java Mon Nov 27 06:02:13 2006
@@ -31,8 +31,6 @@
     private Accreditable accreditable;
     private Role role;
     private String method = DENY;
-    protected static final String GRANT = "grant";
-    protected static final String DENY = "deny";
 
     /**
      * Creates a new credential object.
@@ -85,10 +83,16 @@
         return method;
     }
 
+    /**
+     * @return if the method is {@link Credential#GRANT}.
+     */
     public boolean isGranted() {
         return this.method.equals(GRANT);
     }
 
+    /**
+     * @return if the method is {@link Credential#DENY}.
+     */
     public boolean isDenied() {
         return this.method.equals(DENY);
     }

Modified: lenya/trunk/src/modules-core/janitor/java/src/org/apache/lenya/cms/janitor/ContentJanitor.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/janitor/java/src/org/apache/lenya/cms/janitor/ContentJanitor.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules-core/janitor/java/src/org/apache/lenya/cms/janitor/ContentJanitor.java (original)
+++ lenya/trunk/src/modules-core/janitor/java/src/org/apache/lenya/cms/janitor/ContentJanitor.java Mon Nov 27 06:02:13 2006
@@ -11,8 +11,8 @@
 import org.apache.cocoon.environment.Request;
 import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
 import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.apache.lenya.cms.observation.DocumentEvent;
 import org.apache.lenya.cms.observation.ObservationRegistry;
-import org.apache.lenya.cms.observation.RepositoryEvent;
 import org.apache.lenya.cms.observation.RepositoryListener;
 import org.apache.lenya.cms.publication.DocumentFactory;
 import org.apache.lenya.cms.publication.DocumentUtil;
@@ -24,10 +24,10 @@
 public class ContentJanitor extends AbstractLogEnabled implements Serviceable, Startable,
         ThreadSafe, RepositoryListener {
 
-    public void documentChanged(RepositoryEvent event) {
+    public void documentChanged(DocumentEvent event) {
     }
 
-    public void documentRemoved(RepositoryEvent event) {
+    public void documentRemoved(DocumentEvent event) {
         ContextUtility util = null;
         try {
             util = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);

Modified: lenya/trunk/src/modules-core/observation-impl/java/src/org/apache/lenya/cms/observation/ObservationManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/observation-impl/java/src/org/apache/lenya/cms/observation/ObservationManager.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules-core/observation-impl/java/src/org/apache/lenya/cms/observation/ObservationManager.java (original)
+++ lenya/trunk/src/modules-core/observation-impl/java/src/org/apache/lenya/cms/observation/ObservationManager.java Mon Nov 27 06:02:13 2006
@@ -28,29 +28,27 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.lenya.ac.Identity;
 import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentException;
 import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentIdentifier;
 import org.apache.lenya.cms.publication.DocumentUtil;
 import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.repository.Node;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.publication.PublicationException;
+import org.apache.lenya.util.Assert;
 
 /**
- * Observation manager. Works as an observation registry and sends the notifications.
+ * Observation manager. Works as an observation registry and sends the
+ * notifications.
  */
 public class ObservationManager extends AbstractLogEnabled implements ObservationRegistry,
         ThreadSafe, Serviceable {
 
     private Map identifier2listeners = new HashMap();
-    private Map identifier2doc = new HashMap();
     private Set listeners = new HashSet();
 
     public synchronized void registerListener(RepositoryListener listener, Document doc)
             throws ObservationException {
-        Set listeners = getListeners(doc);
+        Set listeners = getListeners(doc.getIdentifier());
         if (listeners.contains(listener)) {
             throw new ObservationException("The listener [" + listener
                     + "] is already registered for the document [" + doc + "].");
@@ -58,12 +56,11 @@
         listeners.add(listener);
     }
 
-    protected Set getListeners(Document doc) {
-        Set listeners = (Set) this.identifier2listeners.get(doc.getIdentifier());
+    protected Set getListeners(DocumentIdentifier doc) {
+        Set listeners = (Set) this.identifier2listeners.get(doc);
         if (listeners == null) {
             listeners = new HashSet();
-            this.identifier2listeners.put(doc.getIdentifier(), listeners);
-            this.identifier2doc.put(doc.getIdentifier(), doc);
+            this.identifier2listeners.put(doc, listeners);
         }
         return listeners;
     }
@@ -76,46 +73,24 @@
         this.listeners.add(listener);
     }
 
-    public void documentChanged(Document doc) {
-        RepositoryEvent event = createEvent(doc);
-        Set allListeners = getAllListeners(doc);
-        Notifier notifier = new Notifier(allListeners, event) {
-            public void notify(RepositoryListener listener, RepositoryEvent event) {
-                listener.documentChanged(event);
-            }
-        };
-        new Thread(notifier).run();
-    }
+    protected DocumentIdentifier getIdentifier(DocumentEvent event) {
 
-    protected RepositoryEvent createEvent(Document doc) {
+        Assert.notNull("event", event);
+
+        DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, event
+                .getSession());
+        Publication pub;
         try {
-            String url = null;
-            if (doc.hasLink()) {
-                url = doc.getCanonicalDocumentURL();
-            }
-            return new RepositoryEvent(doc.getPublication().getId(),
-                    doc.getArea(),
-                    doc.getUUID(),
-                    doc.getLanguage(),
-                    doc.getResourceType(),
-                    url);
-        } catch (DocumentException e) {
+            pub = factory.getPublication(event.getPublicationId());
+        } catch (PublicationException e) {
             throw new RuntimeException(e);
         }
+        DocumentIdentifier id = new DocumentIdentifier(pub, event.getArea(), event.getUuid(), event
+                .getLanguage());
+        return id;
     }
 
-    public void documentRemoved(Document doc) {
-        RepositoryEvent event = createEvent(doc);
-        Set allListeners = getAllListeners(doc);
-        Notifier notifier = new Notifier(allListeners, event) {
-            public void notify(RepositoryListener listener, RepositoryEvent event) {
-                listener.documentRemoved(event);
-            }
-        };
-        new Thread(notifier).run();
-    }
-
-    protected Set getAllListeners(Document doc) {
+    protected Set getAllListeners(DocumentIdentifier doc) {
         Set allListeners = new HashSet();
         synchronized (this) {
             allListeners.addAll(this.listeners);
@@ -124,12 +99,12 @@
         return allListeners;
     }
 
-    public abstract class Notifier implements Runnable {
+    protected abstract class Notifier implements Runnable {
 
         private Set listeners;
         private RepositoryEvent event;
 
-        public Notifier(Set listeners, RepositoryEvent event) {
+        protected Notifier(Set listeners, RepositoryEvent event) {
             this.listeners = listeners;
             this.event = event;
         }
@@ -141,70 +116,37 @@
             }
         }
 
-        public abstract void notify(RepositoryListener listener, RepositoryEvent event);
+        protected abstract void notify(RepositoryListener listener, RepositoryEvent event);
     }
 
-    public void nodeChanged(Node node, Identity identity) {
-        Document doc = getDocument(node, identity);
-        if (doc != null) {
-            documentChanged(doc);
+    public void nodeChanged(RepositoryEvent event) {
+        Assert.notNull("event", event);
+        if (event instanceof DocumentEvent) {
+            final DocumentEvent docEvent = (DocumentEvent) event;
+            DocumentIdentifier id = getIdentifier(docEvent);
+            Set allListeners = getAllListeners(id);
+            Notifier notifier = new Notifier(allListeners, event) {
+                public void notify(RepositoryListener listener, RepositoryEvent event) {
+                    listener.documentChanged(docEvent);
+                }
+            };
+            new Thread(notifier).run();
         }
     }
 
-    public void nodeRemoved(Node node, Identity identity) {
-        Document doc = getDocument(node, identity);
-        if (doc != null) {
-            documentRemoved(doc);
-        }
-    }
-
-    protected Document getDocument(Node node, Identity identity) {
-
-        if (node.getSourceURI().endsWith(".xml")) {
-            return null;
-        }
-
-        Document doc = null;
-
-        final String sourceUri = node.getSourceURI();
-        if (!sourceUri.startsWith("lenya://")) {
-            throw new IllegalStateException("The source URI [" + sourceUri
-                    + "] doesn't start with lenya://");
-        }
-
-        String path = sourceUri.substring("lenya://lenya/pubs/".length());
-
-        String[] steps = path.split("/");
-        String pubId = steps[0];
-        String area = steps[2];
-
-        try {
-
-            Session session = RepositoryUtil.createSession(manager, identity);
-            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
-            Publication pub = factory.getPublication(pubId);
-            String docPath = path.substring((pubId + "/content/" + area).length());
-
-            String uuid;
-            if (docPath.charAt(docPath.length() - 3) == '_') {
-                uuid = docPath.substring(0, docPath.length() - "/index_en".length());
-            } else {
-                uuid = docPath.substring(1, docPath.length() - "/en".length());
-            }
-
-            String language = docPath.substring(docPath.length() - "en".length());
-
-            doc = factory.get(pub, area, uuid, language);
-
-            if (doc == null) {
-                // this happens if the node was not a document node
-                this.getLogger().info("No document found for node [" + sourceUri + "]");
-            }
-
-        } catch (Exception e) {
-            throw new RuntimeException(e);
+    public void nodeRemoved(RepositoryEvent event) {
+        Assert.notNull("event", event);
+        if (event instanceof DocumentEvent) {
+            final DocumentEvent docEvent = (DocumentEvent) event;
+            DocumentIdentifier id = getIdentifier(docEvent);
+            Set allListeners = getAllListeners(id);
+            Notifier notifier = new Notifier(allListeners, event) {
+                public void notify(RepositoryListener listener, RepositoryEvent event) {
+                    listener.documentRemoved(docEvent);
+                }
+            };
+            new Thread(notifier).run();
         }
-        return doc;
     }
 
     private ServiceManager manager;

Modified: lenya/trunk/src/modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/TestListener.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/TestListener.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/TestListener.java (original)
+++ lenya/trunk/src/modules-core/observation-impl/java/test/org/apache/lenya/cms/observation/TestListener.java Mon Nov 27 06:02:13 2006
@@ -8,7 +8,7 @@
     private boolean changed = false;
     private boolean removed = false;
 
-    public void documentChanged(RepositoryEvent event) {
+    public void documentChanged(DocumentEvent event) {
         this.changed = true;
     }
     
@@ -25,7 +25,7 @@
         this.removed = false;
     }
 
-    public void documentRemoved(RepositoryEvent event) {
+    public void documentRemoved(DocumentEvent event) {
         this.removed = true;
     }
     

Modified: lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/JCRSourceNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/JCRSourceNode.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/JCRSourceNode.java (original)
+++ lenya/trunk/src/modules-optional/jcrsource/java/src/org/apache/lenya/cms/jcr/JCRSourceNode.java Mon Nov 27 06:02:13 2006
@@ -43,7 +43,7 @@
     }
 
     /**
-     * @see org.apache.lenya.cms.repository.SourceNode#getRealSourceURI()
+     * @see org.apache.lenya.cms.repository.SourceNode#getRealSourceUri()
      */
     protected String getRealSourceURI() {
         String path = this.sourceUri.substring(LENYA_PROTOCOL.length());

Modified: lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/components/Indexer.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/components/Indexer.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/components/Indexer.java (original)
+++ lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/components/Indexer.java Mon Nov 27 06:02:13 2006
@@ -31,12 +31,10 @@
     public static final String DOCUMENT_UID_FIELD = "uid";
 
     /**
-     * Index document (update or add if
-     * 
-     * @link #clearIndex() is called before)
+     * Index document (update or add if {@link #clearIndex()} is called before)
      * @param doc
      *            Document
-     * @throws IndeException
+     * @throws IndexException
      */
     public void index(Document doc) throws IndexException;
 
@@ -93,7 +91,6 @@
      * 
      * @param directory
      *            the index directory
-     * @throws Exception
      */
     public void setIndex(Directory directory) throws IndexException;
 

Modified: lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/components/impl/IndexManagerImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/components/impl/IndexManagerImpl.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/components/impl/IndexManagerImpl.java (original)
+++ lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/components/impl/IndexManagerImpl.java Mon Nov 27 06:02:13 2006
@@ -120,6 +120,9 @@
      */
     public static final String DATEFORMAT_ATTRIBUTE = "dateformat";
 
+    /**
+     * The name of the index configuration file.
+     */
     public static final String INDEX_CONF_FILE = "lucene_index.xconf";
 
     /**
@@ -153,9 +156,6 @@
 
     private String indexerRole = null;
 
-    public IndexManagerImpl() {
-    }
-
     /*
      * (non-Javadoc)
      * 
@@ -268,7 +268,6 @@
     /**
      * Adds indexes from the given configuration file to the index manager.
      * @param confSource
-     * @throws ConfigurationException
      */
     public void addIndexes(Source confSource) {
         try {
@@ -373,6 +372,10 @@
         }
     }
 
+    /**
+     * @return The servlet context path.
+     * @throws Exception if an error occurs.
+     */
     public String getServletContextPath() throws Exception {
         SourceResolver resolver = null;
         Source source = null;

Modified: lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/fieldmodel/DateFieldDefinition.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/fieldmodel/DateFieldDefinition.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/fieldmodel/DateFieldDefinition.java (original)
+++ lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/fieldmodel/DateFieldDefinition.java Mon Nov 27 06:02:13 2006
@@ -62,8 +62,7 @@
      * 
      * @param dateString
      *            String date in string format
-     * @throws ParseException
-     * @return
+     * @return A field.
      * @see org.apache.lucene.document.Field
      * 
      */
@@ -83,8 +82,7 @@
      * 
      * @param date
      *            the date
-     * @throws ParseException
-     * @return
+     * @return A field.
      * @see org.apache.lucene.document.Field
      * 
      */

Modified: lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/fieldmodel/FieldDefinition.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/fieldmodel/FieldDefinition.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/fieldmodel/FieldDefinition.java (original)
+++ lenya/trunk/src/modules/lucene/java/src/org/apache/cocoon/components/search/fieldmodel/FieldDefinition.java Mon Nov 27 06:02:13 2006
@@ -195,7 +195,6 @@
      * 
      * @param typename
      *            String
-     * @throws Exception
      * @return int
      */
     static final public int stringTotype(String typename)

Modified: lenya/trunk/src/modules/lucene/java/src/org/apache/lenya/cms/lucene/IndexUpdaterImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/java/src/org/apache/lenya/cms/lucene/IndexUpdaterImpl.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules/lucene/java/src/org/apache/lenya/cms/lucene/IndexUpdaterImpl.java (original)
+++ lenya/trunk/src/modules/lucene/java/src/org/apache/lenya/cms/lucene/IndexUpdaterImpl.java Mon Nov 27 06:02:13 2006
@@ -27,8 +27,8 @@
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.components.search.IndexException;
 import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.apache.lenya.cms.observation.DocumentEvent;
 import org.apache.lenya.cms.observation.ObservationRegistry;
-import org.apache.lenya.cms.observation.RepositoryEvent;
 import org.apache.lenya.cms.publication.ResourceType;
 
 /**
@@ -37,7 +37,7 @@
 public class IndexUpdaterImpl extends AbstractLogEnabled implements IndexUpdater, Startable,
         Serviceable, ThreadSafe {
 
-    public void documentChanged(RepositoryEvent event) {
+    public void documentChanged(DocumentEvent event) {
         try {
             index(event.getResourceType(),
                     event.getPublicationId(),
@@ -49,7 +49,7 @@
         }
     }
 
-    public void documentRemoved(RepositoryEvent event) {
+    public void documentRemoved(DocumentEvent event) {
         try {
             delete(event.getResourceType(),
                     event.getPublicationId(),

Modified: lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/RepoNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/RepoNode.java?view=diff&rev=479620&r1=479619&r2=479620
==============================================================================
--- lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/RepoNode.java (original)
+++ lenya/trunk/src/modules/repository/java/src/org/apache/lenya/cms/repo/adapter/RepoNode.java Mon Nov 27 06:02:13 2006
@@ -28,6 +28,7 @@
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.lenya.cms.metadata.MetaData;
 import org.apache.lenya.cms.metadata.MetaDataException;
+import org.apache.lenya.cms.observation.RepositoryEvent;
 import org.apache.lenya.cms.rc.RCML;
 import org.apache.lenya.cms.repo.Translation;
 import org.apache.lenya.cms.repository.History;
@@ -208,6 +209,11 @@
     }
 
     public History getHistory() {
+        return null;
+    }
+
+    public RepositoryEvent getEvent() {
+        // TODO Auto-generated method stub
         return null;
     }
 

Added: lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/ContentSourceWrapper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/ContentSourceWrapper.java?view=auto&rev=479620
==============================================================================
--- lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/ContentSourceWrapper.java (added)
+++ lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/ContentSourceWrapper.java Mon Nov 27 06:02:13 2006
@@ -0,0 +1,39 @@
+/*
+ * 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.repository;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceManager;
+
+/**
+ * Content source wrapper.
+ */
+public class ContentSourceWrapper extends SourceWrapper {
+
+    /**
+     * Ctor.
+     * @param node
+     * @param sourceURI
+     * @param manager
+     * @param logger
+     */
+    public ContentSourceWrapper(SourceNode node, String sourceURI, ServiceManager manager, Logger logger) {
+        super(node, sourceURI, manager, logger);
+    }
+
+}

Added: lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/MetaSourceWrapper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/MetaSourceWrapper.java?view=auto&rev=479620
==============================================================================
--- lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/MetaSourceWrapper.java (added)
+++ lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/MetaSourceWrapper.java Mon Nov 27 06:02:13 2006
@@ -0,0 +1,61 @@
+/*
+ * 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.repository;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.lenya.cms.metadata.MetaDataException;
+import org.apache.lenya.cms.metadata.MetaDataOwner;
+
+/**
+ * Provides access to a meta data source.
+ */
+public class MetaSourceWrapper extends SourceWrapper {
+
+    protected static final String LENYA_META_SUFFIX = "meta";
+
+    /**
+     * Ctor.
+     * @param node
+     * @param sourceURI
+     * @param manager
+     * @param logger
+     */
+    public MetaSourceWrapper(SourceNode node, String sourceURI, ServiceManager manager, Logger logger) {
+        super(node, sourceURI + "." + LENYA_META_SUFFIX, manager, logger);
+    }
+
+    private SourceNodeMetaDataHandler metaDataHandler = null;
+    
+    protected SourceNodeMetaDataHandler getMetaDataHandler() {
+        if (this.metaDataHandler == null) {
+            this.metaDataHandler = new SourceNodeMetaDataHandler(this.manager, getRealSourceUri());
+        }
+        return this.metaDataHandler;
+    }
+
+    /**
+     * @return All supported meta data namespace URIs.
+     * @throws MetaDataException if an error occurs.
+     * @see MetaDataOwner#getMetaDataNamespaceUris()
+     */
+    public String[] getMetaDataNamespaceUris() throws MetaDataException {
+        return getMetaDataHandler().getMetaDataNamespaceUris();
+    }
+    
+}



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