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 2009/02/10 19:25:57 UTC

svn commit: r743042 [2/2] - in /lenya/trunk: org.apache.lenya.core.ac/src/main/java/org/apache/lenya/ac/cifs/ org.apache.lenya.core.ac/src/main/java/org/apache/lenya/ac/file/ org.apache.lenya.core.ac/src/main/java/org/apache/lenya/ac/impl/ org.apache.l...

Added: lenya/trunk/org.apache.lenya.core.repository/src/main/java/org/apache/lenya/cms/repository/metadata/MetaDataRegistryImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.repository/src/main/java/org/apache/lenya/cms/repository/metadata/MetaDataRegistryImpl.java?rev=743042&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.repository/src/main/java/org/apache/lenya/cms/repository/metadata/MetaDataRegistryImpl.java (added)
+++ lenya/trunk/org.apache.lenya.core.repository/src/main/java/org/apache/lenya/cms/repository/metadata/MetaDataRegistryImpl.java Tue Feb 10 18:25:55 2009
@@ -0,0 +1,56 @@
+/*
+ * 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.metadata;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Meta data registry implementation.
+ */
+public class MetaDataRegistryImpl implements MetaDataRegistry {
+
+    public ElementSet getElementSet(String namespaceUri) throws MetaDataException {
+        if (!isRegistered(namespaceUri)) {
+            throw new MetaDataException("The namespace URI [" + namespaceUri
+                    + "] is not registered.");
+        }
+        return (ElementSet) this.namespace2set.get(namespaceUri);
+    }
+
+    public boolean isRegistered(String namespaceUri) throws MetaDataException {
+        return this.namespace2set.containsKey(namespaceUri);
+    }
+
+    private Map namespace2set = new HashMap();
+
+    public void register(String namespaceUri, ElementSet elementSet) throws MetaDataException {
+        if (this.namespace2set.containsKey(namespaceUri)) {
+            throw new MetaDataException("The namespace [" + namespaceUri
+                    + "] is already registered.");
+        }
+        this.namespace2set.put(namespaceUri, elementSet);
+    }
+
+    public String[] getNamespaceUris() throws MetaDataException {
+        Set keys = this.namespace2set.keySet();
+        return (String[]) keys.toArray(new String[keys.size()]);
+    }
+
+}

Added: lenya/trunk/org.apache.lenya.core.repository/src/main/resources/META-INF/cocoon/spring/lenya-core-repository-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.repository/src/main/resources/META-INF/cocoon/spring/lenya-core-repository-components.xml?rev=743042&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.repository/src/main/resources/META-INF/cocoon/spring/lenya-core-repository-components.xml (added)
+++ lenya/trunk/org.apache.lenya.core.repository/src/main/resources/META-INF/cocoon/spring/lenya-core-repository-components.xml Tue Feb 10 18:25:55 2009
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
+  xmlns="http://www.springframework.org/schema/beans">
+  
+  <bean name="org.apache.lenya.cms.repository.metadata.MetaDataRegistry"
+    class="org.apache.lenya.cms.repository.metadata.MetaDataRegistryImpl"/>
+  
+</beans>

Modified: lenya/trunk/org.apache.lenya.core.templating/src/main/java/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.templating/src/main/java/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.templating/src/main/java/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java (original)
+++ lenya/trunk/org.apache.lenya.core.templating/src/main/java/org/apache/lenya/cms/publication/templating/PublicationTemplateManagerImpl.java Tue Feb 10 18:25:55 2009
@@ -83,7 +83,7 @@
             uris.add(getBaseURI(publications[i]));
         }
 
-        String coreBaseURI = publication.getServletContext().getAbsolutePath() + "/";
+        String coreBaseURI = publication.getPubBaseUri() + "/";
         uris.add(coreBaseURI);
 
         return (String[]) uris.toArray(new String[uris.size()]);

Modified: lenya/trunk/org.apache.lenya.core.usecase/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.usecase/pom.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.usecase/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.usecase/pom.xml Tue Feb 10 18:25:55 2009
@@ -79,17 +79,6 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.lenya</groupId>
-      <artifactId>lenya-core-impl</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.lenya</groupId>
-      <artifactId>lenya-core-api</artifactId>
-      <scope>test</scope>
-    </dependency>
     <!-- FIXME: This dependency is transitive and should be obtained automatically
       see http://jira.codehaus.org/browse/MNG-1378 -->
     <dependency>
@@ -98,6 +87,12 @@
       <scope>test</scope>
       <type>test-jar</type>
     </dependency>
+    <dependency>
+      <groupId>org.apache.lenya</groupId>
+      <artifactId>lenya-core-api</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
     
   </dependencies>
 </project>

Modified: lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.usecase/src/test/java/org/apache/lenya/cms/usecase/AbstractUsecaseTest.java Tue Feb 10 18:25:55 2009
@@ -22,7 +22,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
+import org.apache.lenya.cms.AbstractAccessControlTest;
 import org.apache.lenya.cms.publication.Session;
 import org.apache.lenya.cms.usecase.impl.TestUsecaseInvoker;
 

Modified: lenya/trunk/org.apache.lenya.core.workflow/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.workflow/pom.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.workflow/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.workflow/pom.xml Tue Feb 10 18:25:55 2009
@@ -46,10 +46,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.lenya</groupId>
-      <artifactId>lenya-core-impl</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-repository</artifactId>
     </dependency>
 

Modified: lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Publish.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Publish.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Publish.java (original)
+++ lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Publish.java Tue Feb 10 18:25:55 2009
@@ -42,7 +42,6 @@
 import org.apache.lenya.cms.linking.LinkTarget;
 import org.apache.lenya.cms.metadata.dublincore.DublinCoreHelper;
 import org.apache.lenya.cms.observation.RepositoryEvent;
-import org.apache.lenya.cms.observation.RepositoryEventFactory;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentException;
 import org.apache.lenya.cms.publication.DocumentLocator;
@@ -382,7 +381,7 @@
 
         NotificationEventDescriptor descriptor = new NotificationEventDescriptor(message);
         org.apache.lenya.cms.repository.Session repoSession = (Session) getSession();
-        RepositoryEvent event = RepositoryEventFactory.createEvent(repoSession, getLogger());
+        RepositoryEvent event = new RepositoryEvent(repoSession, getLogger());
         repoSession.enqueueEvent(event);
     }
 

Modified: lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Reject.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Reject.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Reject.java (original)
+++ lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Reject.java Tue Feb 10 18:25:55 2009
@@ -26,7 +26,6 @@
 import org.apache.lenya.ac.User;
 import org.apache.lenya.cms.ac.PolicyUtil;
 import org.apache.lenya.cms.observation.RepositoryEvent;
-import org.apache.lenya.cms.observation.RepositoryEventFactory;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentException;
 import org.apache.lenya.cms.publication.Proxy;
@@ -118,7 +117,7 @@
 
             NotificationEventDescriptor descriptor = new NotificationEventDescriptor(message);
             org.apache.lenya.cms.repository.Session repoSession = (Session) getSession();
-            RepositoryEvent event = RepositoryEventFactory.createEvent(repoSession, descriptor);
+            RepositoryEvent event = new RepositoryEvent(repoSession, descriptor);
             repoSession.enqueueEvent(event);
         }
     }

Modified: lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Submit.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Submit.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Submit.java (original)
+++ lenya/trunk/org.apache.lenya.core.workflow/src/main/java/org/apache/lenya/cms/workflow/usecases/Submit.java Tue Feb 10 18:25:55 2009
@@ -23,7 +23,6 @@
 import org.apache.lenya.ac.User;
 import org.apache.lenya.cms.ac.PolicyUtil;
 import org.apache.lenya.cms.observation.RepositoryEvent;
-import org.apache.lenya.cms.observation.RepositoryEventFactory;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentException;
 import org.apache.lenya.cms.publication.Proxy;
@@ -102,7 +101,7 @@
 
         NotificationEventDescriptor descriptor = new NotificationEventDescriptor(message);
         org.apache.lenya.cms.repository.Session repoSession = (Session) getSession();
-        RepositoryEvent event = RepositoryEventFactory.createEvent(repoSession, descriptor);
+        RepositoryEvent event = new RepositoryEvent(repoSession, descriptor);
         repoSession.enqueueEvent(event);
     }
 }

Modified: lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/WorkflowTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/WorkflowTest.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/WorkflowTest.java (original)
+++ lenya/trunk/org.apache.lenya.core.workflow/src/test/java/org/apache/lenya/cms/workflow/WorkflowTest.java Tue Feb 10 18:25:55 2009
@@ -20,7 +20,7 @@
 
 package org.apache.lenya.cms.workflow;
 
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
+import org.apache.lenya.cms.AbstractAccessControlTest;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.Session;

Modified: lenya/trunk/org.apache.lenya.module.lenyadoc/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.lenyadoc/pom.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.lenyadoc/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.module.lenyadoc/pom.xml Tue Feb 10 18:25:55 2009
@@ -33,10 +33,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.lenya</groupId>
-      <artifactId>lenya-core-impl</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-repository</artifactId>
     </dependency>
   </dependencies>

Modified: lenya/trunk/org.apache.lenya.module.lucene/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.lucene/pom.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.lucene/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.module.lucene/pom.xml Tue Feb 10 18:25:55 2009
@@ -46,10 +46,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.lenya</groupId>
-      <artifactId>lenya-core-impl</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-repository</artifactId>
     </dependency>
     <dependency>

Modified: lenya/trunk/org.apache.lenya.module.notification/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.notification/pom.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.notification/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.module.notification/pom.xml Tue Feb 10 18:25:55 2009
@@ -31,10 +31,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.lenya</groupId>
-      <artifactId>lenya-core-impl</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-repository</artifactId>
     </dependency>
     <dependency>

Modified: lenya/trunk/org.apache.lenya.module.simplesite/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.simplesite/pom.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.simplesite/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.module.simplesite/pom.xml Tue Feb 10 18:25:55 2009
@@ -27,11 +27,6 @@
     <!-- TODO: remove after refactoring -->
     <dependency>
       <groupId>org.apache.lenya</groupId>
-      <artifactId>lenya-core-impl</artifactId>
-    </dependency>
-    <!-- TODO: remove after refactoring -->
-    <dependency>
-      <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-repository</artifactId>
     </dependency>
     <dependency>
@@ -51,17 +46,6 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.lenya</groupId>
-      <artifactId>lenya-core-impl</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.lenya</groupId>
-      <artifactId>lenya-core-api</artifactId>
-      <scope>test</scope>
-    </dependency>
     <!-- FIXME: This dependency is transitive and should be obtained automatically
       see http://jira.codehaus.org/browse/MNG-1378 -->
     <dependency>

Modified: lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStore.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStore.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStore.java (original)
+++ lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStore.java Tue Feb 10 18:25:55 2009
@@ -31,11 +31,9 @@
 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.DocumentImpl;
 import org.apache.lenya.cms.publication.LockException;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.RepositoryException;
-import org.apache.lenya.cms.repository.Node;
 import org.apache.lenya.cms.repository.RepositoryItem;
 import org.apache.lenya.cms.repository.Session;
 import org.apache.lenya.cms.site.Link;
@@ -130,10 +128,6 @@
         }
     }
 
-    public Node getRepositoryNode() {
-        return ((DocumentImpl) getDelegate()).getRepositoryNode();
-    }
-
     public boolean contains(String path) {
         return doc2path().values().contains(path);
     }
@@ -303,7 +297,7 @@
     }
 
     public Session getRepositorySession() {
-        return getRepositoryNode().getRepositorySession();
+        throw new UnsupportedOperationException();
     }
 
     public void checkin() throws RepositoryException {

Modified: lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/simple/SimpleSiteManagerTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/simple/SimpleSiteManagerTest.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/simple/SimpleSiteManagerTest.java (original)
+++ lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/simple/SimpleSiteManagerTest.java Tue Feb 10 18:25:55 2009
@@ -18,7 +18,7 @@
 package org.apache.lenya.cms.site.simple;
 
 import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.lenya.ac.impl.AbstractAccessControlTest;
+import org.apache.lenya.cms.AbstractAccessControlTest;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentManager;
 import org.apache.lenya.cms.publication.Publication;

Modified: lenya/trunk/org.apache.lenya.module.sitetree/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/pom.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/pom.xml Tue Feb 10 18:25:55 2009
@@ -16,6 +16,19 @@
   <name>Apache Lenya Module Sitetree</name>
   <dependencies>
     <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-xml-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-xml-impl</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
       <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-api</artifactId>
     </dependency>
@@ -31,9 +44,5 @@
       <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-usecase</artifactId>
     </dependency>
-    <dependency>
-      <groupId>javax.servlet</groupId>
-      <artifactId>servlet-api</artifactId>
-    </dependency>
   </dependencies>
 </project>

Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/RootNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/RootNode.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/RootNode.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/RootNode.java Tue Feb 10 18:25:55 2009
@@ -33,10 +33,9 @@
 
     /**
      * @param tree The tree.
-     * @param logger The logger.
      */
-    public RootNode(SiteTreeImpl tree, Log logger) {
-        super(null, "", false, logger);
+    public RootNode(SiteTreeImpl tree) {
+        super(null, "", false);
         this.tree = tree;
     }
 

Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SaxTreeBuilder.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SaxTreeBuilder.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SaxTreeBuilder.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SaxTreeBuilder.java Tue Feb 10 18:25:55 2009
@@ -1,8 +1,5 @@
 package org.apache.lenya.cms.site.tree2;
 
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
 import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.excalibur.xml.sax.SAXParser;
 import org.apache.lenya.cms.repository.Node;
@@ -13,8 +10,7 @@
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 
-public class SaxTreeBuilder extends AbstractLogEnabled implements TreeBuilder, Serviceable,
-        ContentHandler {
+public class SaxTreeBuilder extends AbstractLogEnabled implements TreeBuilder, ContentHandler {
 
     protected static final String ATTR_XML_LANG = "xml:lang";
     protected static final String ELEM_SITE = "site";
@@ -25,32 +21,21 @@
     protected static final String ATTR_VISIBLE_IN_NAV = "visibleinnav";
     protected static final String ATTR_REVISION = "revision";
 
-    private ServiceManager manager;
     private TreeNodeImpl currentNode;
     private StringBuffer text = new StringBuffer();
     private Link currentLink;
+    private SAXParser parser;
 
     public void buildTree(SiteTreeImpl tree) throws Exception {
         SAXParser parser = null;
-        try {
-            this.currentNode = tree.getRoot();
-            Node node = tree.getRepositoryNode();
+        this.currentNode = tree.getRoot();
+        Node node = tree.getRepositoryNode();
 
-            if (node.exists() && node.getContentLength() > 0) {
-                parser = (SAXParser) this.manager.lookup(SAXParser.ROLE);
-                parser.parse(new InputSource(node.getInputStream()), this);
-            }
-        } finally {
-            if (parser != null) {
-                this.manager.release(parser);
-            }
+        if (node.exists() && node.getContentLength() > 0) {
+            this.parser.parse(new InputSource(node.getInputStream()), this);
         }
     }
 
-    public void service(ServiceManager manager) throws ServiceException {
-        this.manager = manager;
-    }
-
     public void characters(char[] chars, int start, int length) throws SAXException {
         this.text.append(chars, start, length);
     }
@@ -132,4 +117,8 @@
     public void startPrefixMapping(String arg0, String arg1) throws SAXException {
     }
 
+    public void setParser(SAXParser parser) {
+        this.parser = parser;
+    }
+
 }

Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeFactory.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeFactory.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeFactory.java Tue Feb 10 18:25:55 2009
@@ -19,6 +19,7 @@
 
 import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.lenya.cms.publication.Area;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.repository.RepositoryException;
@@ -33,30 +34,26 @@
  * 
  * @version $Id: SiteTreeFactory.java 179568 2005-06-02 09:27:26Z jwkaltz $
  */
-public class SiteTreeFactory extends AbstractLogEnabled implements RepositoryItemFactory {
-    
-    private SharedItemStore sharedItemStore;
+public class SiteTreeFactory implements RepositoryItemFactory {
 
-    /**
-     * Ctor.
-     * @param logger The logger.
-     */
-    public SiteTreeFactory(Log logger) {
-        setLogger(logger);
-    }
+    private static final Log logger = LogFactory.getLog(SiteTreeFactory.class);
+
+    private SharedItemStore sharedItemStore;
+    private TreeBuilder treeBuilder;
 
     public RepositoryItem buildItem(Session session, String key) throws RepositoryException {
         String[] snippets = key.split(":");
         String publicationId = snippets[0];
         String areaName = snippets[1];
         try {
-            org.apache.lenya.cms.publication.Session pubSession = (org.apache.lenya.cms.publication.Session) session;
+            org.apache.lenya.cms.publication.Session pubSession = (org.apache.lenya.cms.publication.Session) session
+                    .getHolder();
             Publication publication = pubSession.getPublication(publicationId);
             Area area = publication.getArea(areaName);
 
-            Session storeSession = getSharedItemStore().getSession();
+            Session storeSession = this.sharedItemStore.getSession();
             if (session.isModifiable() || session == storeSession) {
-                return new SiteTreeImpl(area, getLogger());
+                return new SiteTreeImpl(this.treeBuilder, area);
             } else {
                 return new DelegatingSiteTree(area, this, storeSession, key);
             }
@@ -69,15 +66,12 @@
         return SiteTree.IDENTIFIABLE_TYPE;
     }
 
-    /**
-     * TODO: Bean wiring
-     */
     public void setSharedItemStore(SharedItemStore sharedItemStore) {
         this.sharedItemStore = sharedItemStore;
     }
 
-    public SharedItemStore getSharedItemStore() {
-        return sharedItemStore;
+    public void setTreeBuilder(TreeBuilder treeBuilder) {
+        this.treeBuilder = treeBuilder;
     }
 
 }
\ No newline at end of file

Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeImpl.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeImpl.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/SiteTreeImpl.java Tue Feb 10 18:25:55 2009
@@ -35,6 +35,7 @@
 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.repository.SessionHolder;
 import org.apache.lenya.cms.site.Link;
 import org.apache.lenya.cms.site.SiteException;
 import org.apache.lenya.cms.site.SiteNode;
@@ -44,25 +45,25 @@
 /**
  * Simple site tree implementation.
  */
-public class SiteTreeImpl extends AbstractLogEnabled implements SiteStructure, SiteTree,
-        Persistable, RepositoryItem {
-
+public class SiteTreeImpl implements SiteStructure, SiteTree, Persistable, RepositoryItem {
+    
     private Area area;
     private RootNode root;
     private int revision;
+    private TreeBuilder builder;
 
     /**
      * @param area The area.
      * @param logger The logger.
      */
-    public SiteTreeImpl(Area area, Log logger) {
-        setLogger(logger);
+    public SiteTreeImpl(TreeBuilder builder, Area area) {
         this.area = area;
+        this.builder = builder;
         initRoot();
     }
 
     protected void initRoot() {
-        this.root = new RootNode(this, getLogger());
+        this.root = new RootNode(this);
         nodeAdded(root);
     }
 
@@ -110,6 +111,7 @@
             }
             this.loaded = true;
             if (!repoNode.exists()) {
+                if (true) throw new RuntimeException("node doesn't exist: " + repoNode);
                 reset();
             }
         } catch (Exception e) {
@@ -134,7 +136,8 @@
         }
         TreeWriter writer = null;
         try {
-            writer = (TreeWriter) WebAppContextUtils.getCurrentWebApplicationContext().getBean(TreeWriter.ROLE);
+            writer = (TreeWriter) WebAppContextUtils.getCurrentWebApplicationContext().getBean(
+                    TreeWriter.ROLE);
             int revision = getRevision(getRepositoryNode()) + 1;
             writer.writeTree(this);
         } catch (RuntimeException e) {
@@ -310,7 +313,8 @@
     }
 
     public Session getRepositorySession() {
-        return (Session) this.area.getPublication().getSession();
+        SessionHolder holder = (SessionHolder) this.area.getPublication().getSession();
+        return holder.getRepositorySession();
     }
 
     private NodeFactory nodeFactory;
@@ -326,7 +330,8 @@
 
     public Node getRepositoryNode() {
         try {
-            return (Node) getRepositorySession().getRepositoryItem(getNodeFactory(), getSourceUri());
+            return (Node) getRepositorySession()
+                    .getRepositoryItem(getNodeFactory(), getSourceUri());
         } catch (RepositoryException e) {
             throw new RuntimeException("Creating repository node failed: ", e);
         }

Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeNodeImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeNodeImpl.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeNodeImpl.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeNodeImpl.java Tue Feb 10 18:25:55 2009
@@ -38,7 +38,7 @@
 /**
  * Site tree node.
  */
-public class TreeNodeImpl extends AbstractLogEnabled implements TreeNode {
+public class TreeNodeImpl implements TreeNode {
 
     private TreeNode parent;
     private String name;
@@ -49,9 +49,8 @@
      * @param parent The parent.
      * @param name The name.
      * @param visible The navigation visibility.
-     * @param logger The logger.
      */
-    public TreeNodeImpl(TreeNode parent, String name, boolean visible, Log logger) {
+    public TreeNodeImpl(TreeNode parent, String name, boolean visible) {
         Validate.notNull(name);
         this.name = name;
         this.parent = parent;
@@ -293,7 +292,7 @@
             throw new RuntimeException("The child [" + name + "] is already contained.");
         }
 
-        SiteNode node = new TreeNodeImpl(this, name, visible, getLogger());
+        SiteNode node = new TreeNodeImpl(this, name, visible);
         this.children.add(pos, node);
         this.name2child.put(name, node);
         getTree().nodeAdded(node);

Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeSiteManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeSiteManager.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeSiteManager.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree2/TreeSiteManager.java Tue Feb 10 18:25:55 2009
@@ -28,6 +28,7 @@
 import org.apache.lenya.cms.publication.PublicationException;
 import org.apache.lenya.cms.publication.Session;
 import org.apache.lenya.cms.repository.RepositoryItemFactory;
+import org.apache.lenya.cms.repository.SessionHolder;
 import org.apache.lenya.cms.site.AbstractSiteManager;
 import org.apache.lenya.cms.site.Link;
 import org.apache.lenya.cms.site.NodeSet;
@@ -42,6 +43,8 @@
  */
 public class TreeSiteManager extends AbstractSiteManager {
 
+    private SiteTreeFactory siteTreeFactory;
+
     /**
      * Returns the sitetree for a specific area of this publication. Sitetrees are created on demand
      * and are cached.
@@ -54,11 +57,10 @@
 
         String key = getKey(area);
         SiteTree sitetree;
-        RepositoryItemFactory factory = new SiteTreeFactory(getLogger());
         try {
-            org.apache.lenya.cms.repository.Session session = (org.apache.lenya.cms.repository.Session) area
-                    .getPublication().getSession();
-            sitetree = (SiteTree) session.getRepositoryItem(factory, key);
+            SessionHolder sessionHolder = (SessionHolder) area.getPublication().getSession();
+            sitetree = (SiteTree) sessionHolder.getRepositorySession().getRepositoryItem(
+                    this.siteTreeFactory, key);
         } catch (Exception e) {
             throw new SiteException(e);
         }
@@ -280,4 +282,8 @@
         }
     }
 
+    public void setSiteTreeFactory(SiteTreeFactory siteTreeFactory) {
+        this.siteTreeFactory = siteTreeFactory;
+    }
+
 }

Added: lenya/trunk/org.apache.lenya.module.sitetree/src/main/resources/META-INF/cocoon/spring/lenya-module-sitetree-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/resources/META-INF/cocoon/spring/lenya-module-sitetree-components.xml?rev=743042&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/resources/META-INF/cocoon/spring/lenya-module-sitetree-components.xml (added)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/resources/META-INF/cocoon/spring/lenya-module-sitetree-components.xml Tue Feb 10 18:25:55 2009
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
+  xmlns="http://www.springframework.org/schema/beans">
+  
+  <bean name="org.apache.lenya.cms.site.SiteManager/tree"
+    class="org.apache.lenya.cms.site.tree2.TreeSiteManager">
+    <property name="siteTreeFactory" ref="org.apache.lenya.cms.site.tree2.SiteTreeFactory"/>
+  </bean>
+  
+  <bean name="org.apache.excalibur.xml.sax.SAXParser"
+    class="org.apache.cocoon.core.xml.avalon.DefaultSAXParser">
+    <property name="parser" ref="org.apache.cocoon.core.xml.SAXParser"/>
+  </bean>
+  
+  <bean name="org.apache.lenya.cms.site.tree2.TreeBuilder"
+    class="org.apache.lenya.cms.site.tree2.SaxTreeBuilder">
+    <property name="parser" ref="org.apache.excalibur.xml.sax.SAXParser"/>
+  </bean>
+  
+  <bean name="org.apache.lenya.cms.site.tree2.SiteTreeFactory"
+    class="org.apache.lenya.cms.site.tree2.SiteTreeFactory">
+    <property name="sharedItemStore" ref="org.apache.lenya.cms.repository.SharedItemStore"/>
+    <property name="treeBuilder" ref="org.apache.lenya.cms.site.tree2.TreeBuilder"/>
+  </bean>
+  
+</beans>

Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/pom.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/pom.xml Tue Feb 10 18:25:55 2009
@@ -23,5 +23,10 @@
       <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-repository</artifactId>
     </dependency>
+    <!-- FIXME: only necessary because of XML handling helper classes -->
+    <dependency>
+      <groupId>org.apache.lenya</groupId>
+      <artifactId>lenya-core-api</artifactId>
+    </dependency>
   </dependencies>
 </project>

Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNode.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNode.java Tue Feb 10 18:25:55 2009
@@ -48,17 +48,19 @@
     private MetaSourceWrapper metaSource;
     private NodeFactory nodeFactory;
     private SourceResolver sourceResolver;
+    private SourceNodeRcmlFactory rcmlFactory;
 
     /**
      * Ctor.
+     * @param sourceNodeRepository
      * 
      * @param session
      * @param sourceUri
      * @param logger
      */
     public SourceNode(Session session, String sourceUri, SourceResolver resolver, Log logger) {
-        this.session = session;
 
+        this.session = session;
         this.contentSource = new ContentSourceWrapper(this, sourceUri, resolver, logger);
         this.metaSource = new MetaSourceWrapper(this, sourceUri, resolver, logger);
     }
@@ -271,7 +273,7 @@
      * @see java.lang.Object#toString()
      */
     public String toString() {
-        return "node " + getSourceURI();
+        return "node " + getSourceURI() + " (" + getContentSource().getRealSourceUri() + ")";
     }
 
     /**
@@ -287,8 +289,10 @@
             java.util.Vector newChildren = new java.util.Vector();
             while (iterator.hasNext()) {
                 TraversableSource child = (TraversableSource) iterator.next();
-                newChildren.add(new SourceNode(getRepositorySession(), getSourceURI() + "/"
-                        + child.getName(), getSourceResolver(), getLogger()));
+                SourceNode node = new SourceNode(getRepositorySession(), getSourceURI() + "/"
+                        + child.getName(), getSourceResolver(), getLogger());
+                node.setRcmlFactory(this.rcmlFactory);
+                newChildren.add(node);
             }
             return newChildren;
         } catch (Exception e) {
@@ -356,8 +360,7 @@
 
     protected synchronized RCML getRcml() {
         if (this.rcml == null) {
-            SourceNodeRcmlFactory factory = SourceNodeRcmlFactory.getInstance();
-            this.rcml = factory.getRcml(this);
+            this.rcml = this.rcmlFactory.getRcml(this);
         }
         return this.rcml;
     }
@@ -516,4 +519,8 @@
         this.sourceResolver = sourceResolver;
     }
 
+    public void setRcmlFactory(SourceNodeRcmlFactory rcmlFactory) {
+        this.rcmlFactory = rcmlFactory;
+    }
+
 }

Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeFactory.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeFactory.java (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeFactory.java Tue Feb 10 18:25:55 2009
@@ -26,8 +26,9 @@
  * @version $Id$
  */
 public class SourceNodeFactory extends AbstractLogEnabled implements NodeFactory {
-    
+
     private SourceResolver sourceResolver;
+    private SourceNodeRcmlFactory rcmlFactory;
 
     /**
      * Ctor.
@@ -36,7 +37,9 @@
     }
 
     public RepositoryItem buildItem(Session session, String key) throws RepositoryException {
-        return new SourceNode(session, key, getSourceResolver(), getLogger());
+        SourceNode node = new SourceNode(session, key, getSourceResolver(), getLogger());
+        node.setRcmlFactory(this.rcmlFactory);
+        return node;
     }
 
     public String getItemType() {
@@ -51,4 +54,8 @@
         this.sourceResolver = sourceResolver;
     }
 
+    public void setRcmlFactory(SourceNodeRcmlFactory rcmlFactory) {
+        this.rcmlFactory = rcmlFactory;
+    }
+
 }

Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRCML.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRCML.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRCML.java (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRCML.java Tue Feb 10 18:25:55 2009
@@ -85,6 +85,7 @@
      * @param manager The service manager.
      */
     public SourceNodeRCML(String contentSourceUri, String metaSourceUri, SourceResolver resolver) {
+        Validate.notNull(resolver, "source resolver");
         this.maximalNumberOfEntries = 200;
         this.maximalNumberOfEntries = (2 * this.maximalNumberOfEntries) + 1;
         this.contentSourceUri = contentSourceUri;

Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRcmlFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRcmlFactory.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRcmlFactory.java (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceNodeRcmlFactory.java Tue Feb 10 18:25:55 2009
@@ -28,16 +28,8 @@
  */
 public class SourceNodeRcmlFactory {
 
-    private static SourceNodeRcmlFactory instance = new SourceNodeRcmlFactory();
     private SourceResolver sourceResolver;
 
-    /**
-     * @return The singleton instance.
-     */
-    public static SourceNodeRcmlFactory getInstance() {
-        return instance;
-    }
-
     private Map uri2rcml = new HashMap();
 
     /**

Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceWrapper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceWrapper.java?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceWrapper.java (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/java/org/apache/lenya/cms/repository/SourceWrapper.java Tue Feb 10 18:25:55 2009
@@ -19,7 +19,6 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -32,6 +31,7 @@
 import org.apache.commons.lang.Validate;
 import org.apache.commons.logging.Log;
 import org.apache.excalibur.source.ModifiableSource;
+import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 import org.apache.excalibur.source.TraversableSource;
 import org.apache.lenya.cms.cocoon.source.SourceUtil;
@@ -52,8 +52,7 @@
      * @param sourceUri
      * @param logger
      */
-    public SourceWrapper(SourceNode node, String sourceUri, SourceResolver resolver, Log logger)
-    {
+    public SourceWrapper(SourceNode node, String sourceUri, SourceResolver resolver, Log logger) {
         Validate.notNull(node);
         Validate.notNull(sourceUri);
         Validate.notNull(resolver);
@@ -78,26 +77,28 @@
      */
     protected String getRealSourceUri() {
         if (this.realSourceUri == null) {
-            this.realSourceUri = computeRealSourceUri(getSourceResolver(), getNode().getRepositorySession(),
-                    this.sourceUri, getLogger());
+            this.realSourceUri = computeRealSourceUri(getSourceResolver(), getNode()
+                    .getRepositorySession(), this.sourceUri, getLogger());
         }
         return this.realSourceUri;
     }
 
     protected static final String computeRealSourceUri(SourceResolver sourceResolver,
             Session session, String sourceUri, Log logger) {
-        String contentDir = null;
+        String pubContentUri = null;
         String publicationId = null;
         try {
-            String pubBase = Node.LENYA_PROTOCOL + Publication.PUBLICATION_PREFIX_URI + "/";
+            final String pubBase = Node.LENYA_PROTOCOL + "/";
             String publicationsPath = sourceUri.substring(pubBase.length());
+
             int firstSlashIndex = publicationsPath.indexOf("/");
             publicationId = publicationsPath.substring(0, firstSlashIndex);
-            org.apache.lenya.cms.publication.Session pubSession = (org.apache.lenya.cms.publication.Session) session;
+            org.apache.lenya.cms.publication.Session pubSession = (org.apache.lenya.cms.publication.Session) session
+                    .getHolder();
             Publication pub = pubSession.getPublication(publicationId);
-            contentDir = pub.getContentDir();
+            pubContentUri = pub.getContentDir();
         } catch (Exception e) {
-            throw new RuntimeException(e);
+            throw new RuntimeException("Could not compute real URI of " + sourceUri, e);
         }
 
         String contentBaseUri = null;
@@ -108,16 +109,13 @@
         String tempString = urlID.substring(filePrefix.length() + 1);
         String fileMiddle = tempString.substring(0, tempString.indexOf("/"));
         String fileSuffix = tempString.substring(fileMiddle.length() + 1, tempString.length());
-        String uriSuffix;
-        if (new File(contentDir).isAbsolute()) {
-            // Absolute
-            contentBaseUri = FILE_PREFIX + contentDir;
-            uriSuffix = File.separator + fileSuffix;
-        } else {
-            // Relative
-            contentBaseUri = CONTEXT_PREFIX + contentDir;
-            uriSuffix = "/" + fileSuffix;
-        }
+        String uriSuffix = "/" + fileSuffix;
+        contentBaseUri = pubContentUri;
+        /*
+         * if (new File(pubContentUri).isAbsolute()) { // Absolute contentBaseUri =
+         * repo.getBaseUri() + pubContentUri; uriSuffix = File.separator + fileSuffix; } else { //
+         * Relative contentBaseUri = CONTEXT_PREFIX + pubContentUri; uriSuffix = "/" + fileSuffix; }
+         */
 
         String realSourceUri = contentBaseUri + uriSuffix;
 
@@ -212,11 +210,13 @@
 
         ByteArrayOutputStream out = null;
         InputStream in = null;
-        TraversableSource source = null;
+        Source source = null;
         try {
-            source = (TraversableSource) getSourceResolver().resolveURI(getRealSourceUri());
+            source = getSourceResolver().resolveURI(getRealSourceUri());
 
-            if (source.exists() && !source.isCollection()) {
+            if (source.exists()
+                    && !(source instanceof TraversableSource && ((TraversableSource) source)
+                            .isCollection())) {
                 byte[] buf = new byte[4096];
                 out = new ByteArrayOutputStream();
                 in = source.getInputStream();

Modified: lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/resources/META-INF/cocoon/spring/lenya-module-sourcerepository-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/resources/META-INF/cocoon/spring/lenya-module-sourcerepository-components.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/resources/META-INF/cocoon/spring/lenya-module-sourcerepository-components.xml (original)
+++ lenya/trunk/org.apache.lenya.module.sourcerepository/src/main/resources/META-INF/cocoon/spring/lenya-module-sourcerepository-components.xml Tue Feb 10 18:25:55 2009
@@ -19,8 +19,16 @@
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
   xmlns="http://www.springframework.org/schema/beans">
+  
+  <bean name="org.apache.lenya.cms.repository.SourceNodeRcmlFactory"
+    class="org.apache.lenya.cms.repository.SourceNodeRcmlFactory">
+    <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
+  </bean>
+  
   <bean name="org.apache.lenya.cms.repository.NodeFactory"
     class="org.apache.lenya.cms.repository.SourceNodeFactory">
     <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
+    <property name="rcmlFactory" ref="org.apache.lenya.cms.repository.SourceNodeRcmlFactory"/>
   </bean>
+  
 </beans>

Modified: lenya/trunk/org.apache.lenya.parent/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.parent/pom.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.parent/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.parent/pom.xml Tue Feb 10 18:25:55 2009
@@ -436,6 +436,16 @@
       </dependency>
       <dependency>
         <groupId>org.apache.cocoon</groupId>
+        <artifactId>cocoon-xml-api</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.cocoon</groupId>
+        <artifactId>cocoon-xml-impl</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.cocoon</groupId>
         <artifactId>cocoon-block-deployment</artifactId>
         <version>1.1.0-SNAPSHOT</version>
       </dependency>
@@ -512,6 +522,12 @@
       </dependency>
       <dependency>
         <groupId>org.apache.lenya</groupId>
+        <artifactId>lenya-core-api</artifactId>
+        <version>${project.version}</version>
+        <type>test-jar</type>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.lenya</groupId>
         <artifactId>lenya-core-cache</artifactId>
         <version>${project.version}</version>
       </dependency>

Modified: lenya/trunk/org.apache.lenya.webapp.welcome/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.webapp.welcome/pom.xml?rev=743042&r1=743041&r2=743042&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.webapp.welcome/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.webapp.welcome/pom.xml Tue Feb 10 18:25:55 2009
@@ -82,6 +82,7 @@
     <dependency>
       <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-impl</artifactId>
+      <scope>runtime</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.lenya</groupId>



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