svn commit: r743138 [2/2] - in /lenya/trunk: ./ org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/metadata/ org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/publication/ org.apache.lenya.core.impl/ org.apache.lenya.core.impl/src/...

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
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=743138&r1=743137&r2=743138&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 22:33:01 2009
@@ -21,10 +21,7 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.cocoon.spring.configurator.WebAppContextUtils;
-import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.commons.lang.Validate;
-import org.apache.commons.logging.Log;
 import org.apache.lenya.cms.publication.Area;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.LockException;
@@ -46,19 +43,21 @@
  * Simple site tree implementation.
  */
 public class SiteTreeImpl implements SiteStructure, SiteTree, Persistable, RepositoryItem {
-    
+
     private Area area;
     private RootNode root;
     private int revision;
     private TreeBuilder builder;
+    private TreeWriter writer;
+    private NodeFactory nodeFactory;
+    private boolean changed = false;
 
     /**
      * @param area The area.
      * @param logger The logger.
      */
-    public SiteTreeImpl(TreeBuilder builder, Area area) {
+    public SiteTreeImpl(Area area) {
         this.area = area;
-        this.builder = builder;
         initRoot();
     }
 
@@ -97,13 +96,10 @@
             repoNode.setPersistable(this);
 
             if (repoNode.exists()) {
-                TreeBuilder builder = null;
                 try {
                     this.loading = true;
-                    builder = (TreeBuilder) WebAppContextUtils.getCurrentWebApplicationContext()
-                            .getBean(TreeBuilder.ROLE);
                     reset();
-                    builder.buildTree(this);
+                    this.builder.buildTree(this);
                     assert getRevision() == getRevision(getRepositoryNode());
                 } finally {
                     this.loading = false;
@@ -111,7 +107,6 @@
             }
             this.loaded = true;
             if (!repoNode.exists()) {
-                if (true) throw new RuntimeException("node doesn't exist: " + repoNode);
                 reset();
             }
         } catch (Exception e) {
@@ -134,12 +129,8 @@
         if (loading || !changed) {
             return;
         }
-        TreeWriter writer = null;
         try {
-            writer = (TreeWriter) WebAppContextUtils.getCurrentWebApplicationContext().getBean(
-                    TreeWriter.ROLE);
-            int revision = getRevision(getRepositoryNode()) + 1;
-            writer.writeTree(this);
+            this.writer.writeTree(this);
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
@@ -317,21 +308,10 @@
         return holder.getRepositorySession();
     }
 
-    private NodeFactory nodeFactory;
-    private boolean changed = false;
-
-    protected NodeFactory getNodeFactory() {
-        if (this.nodeFactory == null) {
-            this.nodeFactory = (NodeFactory) WebAppContextUtils.getCurrentWebApplicationContext()
-                    .getBean(NodeFactory.ROLE);
-        }
-        return this.nodeFactory;
-    }
-
     public Node getRepositoryNode() {
         try {
             return (Node) getRepositorySession()
-                    .getRepositoryItem(getNodeFactory(), getSourceUri());
+                    .getRepositoryItem(this.nodeFactory, getSourceUri());
         } catch (RepositoryException e) {
             throw new RuntimeException("Creating repository node failed: ", e);
         }
@@ -525,4 +505,16 @@
         }
     }
 
+    public void setBuilder(TreeBuilder treeBuilder) {
+        this.builder = treeBuilder;
+    }
+
+    public void setNodeFactory(NodeFactory nodeFactory) {
+        this.nodeFactory = nodeFactory;
+    }
+
+    public void setWriter(TreeWriter treeWriter) {
+        this.writer = treeWriter;
+    }
+
 }

Modified: 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=743138&r1=743137&r2=743138&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/resources/META-INF/cocoon/spring/lenya-module-sitetree-components.xml (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/resources/META-INF/cocoon/spring/lenya-module-sitetree-components.xml Tue Feb 10 22:33:01 2009
@@ -35,10 +35,22 @@
     <property name="parser" ref="org.apache.excalibur.xml.sax.SAXParser"/>
   </bean>
   
+  <bean name="org.apache.lenya.cms.site.tree2.TreeWriterSerializer"
+    class="org.apache.cocoon.components.serializers.XMLSerializer">
+    <property name="encoding" value="UTF-8"/>
+  </bean>
+  
+  <bean name="org.apache.lenya.cms.site.tree2.TreeWriter"
+    class="org.apache.lenya.cms.site.tree2.SaxTreeWriter">
+    <property name="serializer" ref="org.apache.lenya.cms.site.tree2.TreeWriterSerializer"/>
+  </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"/>
+    <property name="treeWriter" ref="org.apache.lenya.cms.site.tree2.TreeWriter"/>
+    <property name="nodeFactory" ref="org.apache.lenya.cms.repository.NodeFactory"/>
   </bean>
   
 </beans>

Modified: lenya/trunk/org.apache.lenya.module.xhtml/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.xhtml/pom.xml?rev=743138&r1=743137&r2=743138&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.xhtml/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.module.xhtml/pom.xml Tue Feb 10 22:33:01 2009
@@ -15,5 +15,9 @@
   <packaging>jar</packaging>
   <name>Apache Lenya Module XHTML</name>
   <dependencies>
+    <dependency>
+      <groupId>org.apache.lenya</groupId>
+      <artifactId>lenya-core-resourcetype</artifactId>
+    </dependency>
   </dependencies>
 </project>

Added: lenya/trunk/org.apache.lenya.module.xhtml/src/main/resources/META-INF/cocoon/spring/lenya-module-xhtml-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.xhtml/src/main/resources/META-INF/cocoon/spring/lenya-module-xhtml-components.xml?rev=743138&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.module.xhtml/src/main/resources/META-INF/cocoon/spring/lenya-module-xhtml-components.xml (added)
+++ lenya/trunk/org.apache.lenya.module.xhtml/src/main/resources/META-INF/cocoon/spring/lenya-module-xhtml-components.xml Tue Feb 10 22:33:01 2009
@@ -0,0 +1,29 @@
+<?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.publication.ResourceType/xhtml"
+    factory-bean="org.apache.lenya.cms.publication.ResourceTypeFactory"
+    factory-method="createResourceType">
+    <constructor-arg value="resource://META-INF/lenya/resourcetypes/xhtml.xml"/>
+  </bean>
+  
+</beans>

Added: lenya/trunk/org.apache.lenya.module.xhtml/src/main/resources/META-INF/lenya/resourcetypes/xhtml.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.xhtml/src/main/resources/META-INF/lenya/resourcetypes/xhtml.xml?rev=743138&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.module.xhtml/src/main/resources/META-INF/lenya/resourcetypes/xhtml.xml (added)
+++ lenya/trunk/org.apache.lenya.module.xhtml/src/main/resources/META-INF/lenya/resourcetypes/xhtml.xml Tue Feb 10 22:33:01 2009
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<resource-type name="xhtml">
+  <schema namespace="http://relaxng.org/ns/structure/0.9"
+    uri="fallback://lenya/modules/xhtml/resources/schemas/xhtml.rng"/>
+
+  <!-- Default time in seconds until the resource-type has expired -->
+  <expires seconds="3600"/>
+
+  <samples uri="fallback://lenya/modules/xhtml/samples/samples.xml"/>
+
+  <link-attribute xpath="//*[namespace-uri() = 'http://www.w3.org/1999/xhtml']/@href"/>
+  <link-attribute xpath="//*[namespace-uri() = 'http://www.w3.org/1999/xhtml']/@data"/>
+  <link-attribute xpath="//*[namespace-uri() = 'http://www.w3.org/1999/xhtml']/@src"/>
+  <format name="xhtml" uri="cocoon://modules/xhtml/xhtml.xml"/>
+  <format name="webdavGET" uri="cocoon://modules/xhtml/davget.xml"/>
+  <format name="luceneIndex" uri="cocoon://modules/xhtml/lucene-index"/>
+  <!-- "xslt-clean" format is used by webDAV (and other editors?) to "clean" xml content before it is validated/saved -->
+  <format name="xslt-clean" uri="fallback://lenya/modules/xhtml/xslt/clean-xhtml.xsl"/>
+  <format name="icon" uri="cocoon://modules/xhtml/icon"/>
+
+</resource-type>

Modified: lenya/trunk/org.apache.lenya.parent/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.parent/pom.xml?rev=743138&r1=743137&r2=743138&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.parent/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.parent/pom.xml Tue Feb 10 22:33:01 2009
@@ -585,6 +585,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.lenya</groupId>
+        <artifactId>lenya-core-resourcetype</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.lenya</groupId>
         <artifactId>lenya-core-sitemanagement</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -607,16 +612,31 @@
       <!-- Modules -->
       <dependency>
         <groupId>org.apache.lenya</groupId>
+        <artifactId>lenya-module-cforms</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.lenya</groupId>
         <artifactId>lenya-module-collection</artifactId>
         <version>${project.version}</version>
       </dependency>
       <dependency>
         <groupId>org.apache.lenya</groupId>
+        <artifactId>lenya-module-links</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.lenya</groupId>
         <artifactId>lenya-module-notification</artifactId>
         <version>${project.version}</version>
       </dependency>
       <dependency>
         <groupId>org.apache.lenya</groupId>
+        <artifactId>lenya-module-opendocument</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.lenya</groupId>
         <artifactId>lenya-module-prettyprinting</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -642,9 +662,18 @@
       </dependency>
       <dependency>
         <groupId>org.apache.lenya</groupId>
+        <artifactId>lenya-module-xhtml</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      
+      <!-- Optional -->
+      <dependency>
+        <groupId>org.apache.lenya</groupId>
         <artifactId>lenya-optional-jcrsource</artifactId>
         <version>${project.version}</version>
       </dependency>
+      
+      <!-- Web Application -->
       <dependency>
         <groupId>org.apache.lenya</groupId>
         <artifactId>lenya-webapp</artifactId>

Modified: lenya/trunk/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/pom.xml?rev=743138&r1=743137&r2=743138&view=diff
==============================================================================
--- lenya/trunk/pom.xml (original)
+++ lenya/trunk/pom.xml Tue Feb 10 22:33:01 2009
@@ -50,6 +50,7 @@
     <module>org.apache.lenya.core.observation</module>
     <module>org.apache.lenya.core.properties</module>
     <module>org.apache.lenya.core.repository</module>
+    <module>org.apache.lenya.core.resourcetype</module>
     <module>org.apache.lenya.core.sitemanagement</module>
     <module>org.apache.lenya.core.templating</module>
     <module>org.apache.lenya.core.usecase</module>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.