svn commit: r747080 - in /lenya/trunk: org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/ org.apache.lenya.core.acusecases/ org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/ org.apache.lenya.core.api/ o...

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Mon Feb 23 16:53:54 2009
New Revision: 747080

URL: http://svn.apache.org/viewvc?rev=747080&view=rev
Log:
Don't use full view URIs in usecase sitemap request, use bean map for modules.

Added:
    lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/Module.java
    lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/ModuleImpl.java
    lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/properties/
    lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/properties/lenya.properties
Removed:
    lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/ModuleManager.java
    lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/module/
    lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/impl/UsecaseProxy.java
Modified:
    lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/DelegatingAuthorizerAction.java
    lenya/trunk/org.apache.lenya.core.acusecases/pom.xml
    lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-blockServlet.xml
    lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml
    lenya/trunk/org.apache.lenya.core.api/pom.xml
    lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java
    lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java
    lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/spring/lenya-core-api-components.xml
    lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/spring/lenya-core-api-sourceFactories.xml
    lenya/trunk/org.apache.lenya.core.impl.tests/pom.xml
    lenya/trunk/org.apache.lenya.core.impl/pom.xml
    lenya/trunk/org.apache.lenya.core.impl/src/main/resources/META-INF/cocoon/spring/lenya-core-impl-components.xml
    lenya/trunk/org.apache.lenya.core.properties/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/PropertiesModule.java
    lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/AbstractUsecase.java
    lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/Usecase.java
    lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/COB-INF/sitemap.xmap
    lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/COB-INF/usecases.js
    lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/META-INF/cocoon/spring/lenya-core-usecase-blockServlet.xml
    lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/META-INF/cocoon/spring/lenya-core-usecase.xml
    lenya/trunk/org.apache.lenya.core.workflow/src/test/resources/test-components.xml
    lenya/trunk/org.apache.lenya.webapp.welcome/src/main/resources/COB-INF/sitemap.xmap
    lenya/trunk/org.apache.lenya.webapp.welcome/src/main/resources/META-INF/cocoon/spring/lenya-welcome-blockServlet.xml

Modified: lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/DelegatingAuthorizerAction.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/DelegatingAuthorizerAction.java?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/DelegatingAuthorizerAction.java (original)
+++ lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/DelegatingAuthorizerAction.java Mon Feb 23 16:53:54 2009
@@ -80,7 +80,8 @@
      * <code>HISTORY</code> Name of the session attribute that holds the history
      */
     public static final String HISTORY =
-        DelegatingAuthorizerAction.class.getPackage().getName() + ".History";
+        "org.apache.lenya.cms.cocoon.acting.History";
+//        DelegatingAuthorizerAction.class.getPackage().getName() + ".History";
 
     /**
      * Adds the current URL to the history.

Modified: lenya/trunk/org.apache.lenya.core.acusecases/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.acusecases/pom.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.acusecases/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.acusecases/pom.xml Mon Feb 23 16:53:54 2009
@@ -21,6 +21,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.lenya</groupId>
+      <artifactId>lenya-core-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.lenya</groupId>
       <artifactId>lenya-core-usecase</artifactId>
     </dependency>
     <dependency>

Modified: lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-blockServlet.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-blockServlet.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-blockServlet.xml (original)
+++ lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-blockServlet.xml Mon Feb 23 16:53:54 2009
@@ -25,6 +25,10 @@
                            http://cocoon.apache.org/schema/servlet http://cocoon.apache.org/schema/servlet/cocoon-servlet-1.0.xsd">
 
   <bean name="org.apache.lenya.core.acusecases.block" class="org.apache.cocoon.sitemap.SitemapServlet">
-    <servlet:context mount-path="/acusecases" context-path="blockcontext:/lenya-core-acusecases-2.2.0-SNAPSHOT/"/>
+    <servlet:context mount-path="/acusecases" context-path="blockcontext:/lenya-core-acusecases-2.2.0-SNAPSHOT/">
+      <servlet:connections>
+        <entry key="usecase" value-ref="org.apache.lenya.core.usecase.block"/>
+      </servlet:connections>
+    </servlet:context>
   </bean>
 </beans>

Modified: lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml (original)
+++ lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml Mon Feb 23 16:53:54 2009
@@ -15,21 +15,28 @@
   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">
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:configurator="http://cocoon.apache.org/schema/configurator"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://cocoon.apache.org/schema/configurator http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd">
+  
+  <bean name="org.apache.lenya.cms.module.Module/acusecases"
+    class="org.apache.lenya.cms.module.ModuleImpl">
+    <property name="baseUri" value="file://${lenya.home}/org.apache.lenya.core.acusecases/target/classes/COB-INF"/>
+  </bean>
   
   <bean name="org.apache.lenya.cms.usecase.Usecase/ac.login"
     class="org.apache.lenya.cms.ac.usecases.Login" scope="prototype" init-method="initialize">
     <property name="repository" ref="org.apache.lenya.cms.publication.Repository"/>
     <property name="accessControllerResolver" ref="org.apache.lenya.ac.AccessControllerResolver"/>
-    <property name="view" ref="loginView">
+    <property name="view">
+      <bean class="org.apache.lenya.cms.usecase.UsecaseView">
+        <property name="guiManager" ref="org.apache.lenya.cms.usecase.gui.GUIManager"/>
+        <property name="uri" value="fallback://lenya/modules/acusecases/jx/login.jx"/>
+      </bean>
     </property>
   </bean>
 
-  <bean name="loginView" class="org.apache.lenya.cms.usecase.UsecaseView">
-    <property name="guiManager" ref="org.apache.lenya.cms.usecase.gui.GUIManager"/>
-  </bean>
   
 </beans>

Modified: lenya/trunk/org.apache.lenya.core.api/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/pom.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.api/pom.xml Mon Feb 23 16:53:54 2009
@@ -50,8 +50,28 @@
         </configuration>
       </plugin>
     </plugins>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>false</filtering>
+        <excludes>
+          <exclude>META-INF/cocoon/properties/lenya.properties</exclude>
+        </excludes>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+        <includes>
+          <include>META-INF/cocoon/properties/lenya.properties</include>
+        </includes>
+      </resource>
+    </resources>
   </build>
   
+  <properties>
+    <lenya.home>${basedir}/..</lenya.home>
+  </properties>
+  
   <dependencies>
     <dependency>
       <groupId>javax.servlet</groupId>

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java Mon Feb 23 16:53:54 2009
@@ -30,6 +30,7 @@
 import org.apache.cocoon.spring.configurator.WebAppContextUtils;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.store.impl.MRUMemoryStore;
+import org.apache.lenya.cms.module.Module;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.Session;
 import org.apache.lenya.cms.publication.URLInformation;
@@ -128,10 +129,10 @@
             String contextSourceUri = null;
             if (path.startsWith("lenya/modules/")) {
                 final String moduleShortcut = path.split("/")[2];
-                String baseUri = getModuleManager().getBaseURI(moduleShortcut);
+                Module module = (Module) getModules().get(moduleShortcut);
                 final String modulePath = path.substring(("lenya/modules/" + moduleShortcut)
                         .length());
-                contextSourceUri = baseUri + modulePath;
+                contextSourceUri = module.getBaseUri() + modulePath;
             } else {
                 contextSourceUri = "context://" + path;
             }

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java Mon Feb 23 16:53:54 2009
@@ -33,7 +33,7 @@
 import org.apache.excalibur.source.SourceUtil;
 import org.apache.excalibur.source.URIAbsolutizer;
 import org.apache.excalibur.store.impl.MRUMemoryStore;
-import org.apache.lenya.cms.module.ModuleManager;
+import org.apache.lenya.cms.module.Module;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.Repository;
 import org.apache.lenya.cms.publication.Session;
@@ -62,7 +62,7 @@
     private SourceResolver resolver;
     private Repository repository;
     private PublicationTemplateManager templateManager;
-    private ModuleManager moduleManager;
+    private Map modules;
 
     /**
      * Configure the spring bean accordingly if you want to use a store.
@@ -97,12 +97,12 @@
         return this.templateManager;
     }
 
-    public void setModuleManager(ModuleManager mgr) {
-        this.moduleManager = mgr;
+    public void setModules(Map modules) {
+        this.modules = modules;
     }
 
-    protected ModuleManager getModuleManager() {
-        return this.moduleManager;
+    protected Map getModules() {
+        return this.modules;
     }
 
     /**
@@ -205,7 +205,11 @@
             if (source == null) {
                 if (path.startsWith("lenya/modules/")) {
                     final String moduleShortcut = path.split("/")[2];
-                    String baseUri = this.moduleManager.getBaseURI(moduleShortcut);
+                    if (!this.modules.containsKey(moduleShortcut)) {
+                        throw new RuntimeException("The module '" + moduleShortcut + "' is not registered.");
+                    }
+                    Module module = (Module) this.modules.get(moduleShortcut);
+                    String baseUri = module.getBaseUri();
                     final String modulePath = path.substring(("lenya/modules/" + moduleShortcut)
                             .length());
                     source = this.resolver.resolveURI(baseUri + modulePath);

Added: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/Module.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/Module.java?rev=747080&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/Module.java (added)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/Module.java Mon Feb 23 16:53:54 2009
@@ -0,0 +1,30 @@
+/*
+ * 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.module;
+
+/**
+ * A Lenya module.
+ */
+public interface Module {
+    
+    /**
+     * @return The base URI to resolve resources.
+     */
+    String getBaseUri();
+
+}

Added: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/ModuleImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/ModuleImpl.java?rev=747080&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/ModuleImpl.java (added)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/module/ModuleImpl.java Mon Feb 23 16:53:54 2009
@@ -0,0 +1,32 @@
+/*
+ * 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.module;
+
+public class ModuleImpl implements Module {
+
+    private String baseUri;
+
+    public String getBaseUri() {
+        return this.baseUri;
+    }
+    
+    public void setBaseUri(String baseUri) {
+        this.baseUri = baseUri;
+    }
+
+}

Added: lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/properties/lenya.properties
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/properties/lenya.properties?rev=747080&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/properties/lenya.properties (added)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/properties/lenya.properties Mon Feb 23 16:53:54 2009
@@ -0,0 +1 @@
+lenya.home=${lenya.home}
\ No newline at end of file

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/spring/lenya-core-api-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/spring/lenya-core-api-components.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/spring/lenya-core-api-components.xml (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/spring/lenya-core-api-components.xml Mon Feb 23 16:53:54 2009
@@ -18,11 +18,16 @@
 
 <beans xmlns="http://www.springframework.org/schema/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.5.xsd">
+  xmlns:configurator="http://cocoon.apache.org/schema/configurator"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+  http://cocoon.apache.org/schema/configurator http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd">
   
   <bean name="org.apache.lenya.cms.cocoon.flow.FlowHelper"
     class="org.apache.lenya.cms.cocoon.flow.FlowHelperImpl">
     <property name="repository" ref="org.apache.lenya.cms.publication.Repository"/>
   </bean>
   
+  <configurator:bean-map name="org.apache.lenya.cms.module.Modules"
+    type="org.apache.lenya.cms.module.Module" strip-prefix="true"/>
+  
 </beans>

Modified: lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/spring/lenya-core-api-sourceFactories.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/spring/lenya-core-api-sourceFactories.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/spring/lenya-core-api-sourceFactories.xml (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/spring/lenya-core-api-sourceFactories.xml Mon Feb 23 16:53:54 2009
@@ -19,18 +19,21 @@
 <beans xmlns="http://www.springframework.org/schema/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.5.xsd">
+  
   <bean name="org.apache.excalibur.source.SourceFactory/fallback"
     class="org.apache.lenya.cms.cocoon.source.FallbackSourceFactory">
-    <property name="moduleManager" ref="org.apache.lenya.cms.module.ModuleManager"/>
+    <property name="modules" ref="org.apache.lenya.cms.module.Modules"/>
     <property name="repository" ref="org.apache.lenya.cms.publication.Repository"/>
     <property name="templateManager" ref="org.apache.lenya.cms.publication.templating.PublicationTemplateManager"/>
     <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
   </bean>
+  
   <bean name="org.apache.excalibur.source.SourceFactory/aggregate-fallback"
     class="org.apache.lenya.cms.cocoon.source.AggregatingFallbackSourceFactory">
-    <property name="moduleManager" ref="org.apache.lenya.cms.module.ModuleManager"/>
+    <property name="modules" ref="org.apache.lenya.cms.module.Modules"/>
     <property name="repository" ref="org.apache.lenya.cms.publication.Repository"/>
     <property name="templateManager" ref="org.apache.lenya.cms.publication.templating.PublicationTemplateManager"/>
     <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
   </bean>
+  
 </beans>

Modified: lenya/trunk/org.apache.lenya.core.impl.tests/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl.tests/pom.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl.tests/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.impl.tests/pom.xml Mon Feb 23 16:53:54 2009
@@ -51,10 +51,6 @@
       </plugin>
     </plugins>
   </build>
-  
-  <properties>
-    <lenya.home>${basedir}/..</lenya.home>
-  </properties>
       
   <dependencies>
     

Modified: lenya/trunk/org.apache.lenya.core.impl/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/pom.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.impl/pom.xml Mon Feb 23 16:53:54 2009
@@ -15,29 +15,6 @@
   <packaging>jar</packaging>
   <name>Apache Lenya Core Implementation</name>
   
-  <build>
-    <resources>
-      <resource>
-        <directory>src/main/resources</directory>
-        <filtering>false</filtering>
-        <excludes>
-          <exclude>**/lenya-core-impl-components.xml</exclude>
-        </excludes>
-      </resource>
-      <resource>
-        <directory>src/main/resources</directory>
-        <filtering>true</filtering>
-        <includes>
-          <include>**/lenya-core-impl-components.xml</include>
-        </includes>
-      </resource>
-    </resources>
-  </build>
-  
-  <properties>
-    <lenya.home>${basedir}/..</lenya.home>
-  </properties>
-      
   <dependencies>
     <dependency>
       <groupId>javax.servlet</groupId>

Modified: lenya/trunk/org.apache.lenya.core.impl/src/main/resources/META-INF/cocoon/spring/lenya-core-impl-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/main/resources/META-INF/cocoon/spring/lenya-core-impl-components.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/main/resources/META-INF/cocoon/spring/lenya-core-impl-components.xml (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/main/resources/META-INF/cocoon/spring/lenya-core-impl-components.xml Mon Feb 23 16:53:54 2009
@@ -15,11 +15,12 @@
   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">
-
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:configurator="http://cocoon.apache.org/schema/configurator"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://cocoon.apache.org/schema/configurator http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd">
+  
   <bean name="org.apache.lenya.cms.publication.Repository"
     class="org.apache.lenya.cms.publication.RepositoryImpl">
     <property name="repositoryManager" ref="org.apache.lenya.cms.repository.RepositoryManager"/>
@@ -70,9 +71,6 @@
     <property name="uuidGenerator" ref="org.apache.lenya.cms.repository.UUIDGenerator"/>
   </bean>
 
-  <bean name="org.apache.lenya.cms.module.ModuleManager"
-    class="org.apache.lenya.cms.module.ModuleManagerImpl"/>
-
   <bean name="org.apache.lenya.cms.repository.SharedItemStore"
     class="org.apache.lenya.cms.repository.SharedItemStoreImpl">
     <property name="repositoryManager" ref="org.apache.lenya.cms.repository.RepositoryManager"/>

Modified: lenya/trunk/org.apache.lenya.core.properties/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/PropertiesModule.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.properties/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/PropertiesModule.java?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.properties/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/PropertiesModule.java (original)
+++ lenya/trunk/org.apache.lenya.core.properties/src/main/java/org/apache/lenya/cms/cocoon/components/modules/input/PropertiesModule.java Mon Feb 23 16:53:54 2009
@@ -18,9 +18,11 @@
 
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
@@ -37,7 +39,7 @@
 import org.apache.commons.configuration.Configuration;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.cms.module.ModuleManager;
+import org.apache.lenya.cms.module.Module;
 import org.apache.lenya.cms.publication.Publication;
 import org.apache.lenya.cms.publication.Repository;
 import org.apache.lenya.cms.publication.Session;
@@ -65,7 +67,7 @@
 	// FIXME Use commons-configuration
     private Configuration globalProperties;
     private SourceResolver sourceResolver;
-    private ModuleManager moduleManager;
+    private Map modules;
 
     protected Repository repository;
 
@@ -165,10 +167,10 @@
         merge(this.globalProperties, lenyaProperties);
         
         // get the values from all modules
-        String[] module2src = this.moduleManager.getModuleIds();
-        for (int i = 0; i < module2src.length; i++) {
-            String moduleName = module2src[i];
-            String moduleBaseUri = this.moduleManager.getBaseURI(moduleName);
+        Collection modules = this.modules.values();
+        for (Iterator i = modules.iterator(); i.hasNext(); ) {
+            Module module = (Module) i.next();
+            String moduleBaseUri = module.getBaseUri();
             if (moduleBaseUri != null) {
                 String modulePropsUri = moduleBaseUri + "/" + PROPERTY_FILE_NAME;
                 Configuration moduleProperties = loadXMLPropertiesFromURI(modulePropsUri);
@@ -312,8 +314,8 @@
         this.sourceResolver = sourceResolver;
     }
 
-    public void setModuleManager(ModuleManager moduleManager) {
-        this.moduleManager = moduleManager;
+    public void setModules(Map modules) {
+        this.modules = modules;
     }
 
 }

Modified: lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/AbstractUsecase.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/AbstractUsecase.java?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/AbstractUsecase.java (original)
+++ lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/AbstractUsecase.java Mon Feb 23 16:53:54 2009
@@ -18,6 +18,7 @@
 package org.apache.lenya.cms.usecase;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -78,6 +79,10 @@
 
     protected static final String PARAMETERS_INITIALIZED = "private.parametersInitialized";
 
+    protected static final String[] TRANSACTION_POLICIES = { TRANSACTION_POLICY_OPTIMISTIC,
+            TRANSACTION_POLICY_PESSIMISTIC, TRANSACTION_POLICY_READONLY };
+    protected static final String DEFAULT_TRANSACTION_POLICY = TRANSACTION_POLICY_READONLY;
+
     private Repository repository;
     private UsecaseView view;
 
@@ -651,14 +656,10 @@
     protected static final String ELEMENT_EXIT = "exit";
     protected static final String ATTRIBUTE_USECASE = "usecase";
 
-    private boolean isOptimistic = true;
+    private String transactionPolicy = DEFAULT_TRANSACTION_POLICY;
 
-    /**
-     * @return <code>true</code> if the transaction policy is optimistic offline lock,
-     *         <code>false</code> if it is pessimistic offline lock.
-     */
-    public boolean isOptimistic() {
-        return this.isOptimistic;
+    public String getTransactionPolicy() {
+        return this.transactionPolicy;
     }
 
     public void setView(UsecaseView view) {
@@ -697,7 +698,7 @@
      * @throws RepositoryException if an error occurs.
      */
     protected void startTransaction() {
-        if (this.commitEnabled) {
+        if (this.commitEnabled && !this.getTransactionPolicy().equals(TRANSACTION_POLICY_READONLY)) {
             setSession(this.repository.startSession(getSession().getIdentity(), true));
         }
     }
@@ -721,7 +722,7 @@
                 if (!objects[i].isLocked()) {
                     objects[i].lock();
                 }
-                if (!isOptimistic()
+                if (!getTransactionPolicy().equals(TRANSACTION_POLICY_OPTIMISTIC)
                         && !objects[i].isCheckedOutBySession(getSession().getId(), getSession()
                                 .getIdentity().getUser().getId())) {
                     objects[i].checkout(checkoutRestrictedToSession());
@@ -829,8 +830,13 @@
         this.parameters = params;
     }
 
-    public void setIsOptimistic(boolean optimistic) {
-        this.isOptimistic = optimistic;
+    public void setTransactionPolicy(String policy) {
+        if (!Arrays.asList(TRANSACTION_POLICIES).contains(policy)) {
+            throw new IllegalArgumentException("Invalid transaction policy '" + policy
+                    + ", must be one of " + TRANSACTION_POLICY_OPTIMISTIC + ", "
+                    + TRANSACTION_POLICY_PESSIMISTIC + ", " + TRANSACTION_POLICY_READONLY);
+        }
+        this.transactionPolicy = policy;
     }
 
     protected String getExitUsecaseName() {

Modified: lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/Usecase.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/Usecase.java?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/Usecase.java (original)
+++ lenya/trunk/org.apache.lenya.core.usecase/src/main/java/org/apache/lenya/cms/usecase/Usecase.java Mon Feb 23 16:53:54 2009
@@ -30,17 +30,32 @@
 public interface Usecase {
 
     /**
+     * Optimistic offline lock.
+     */
+    String TRANSACTION_POLICY_OPTIMISTIC = "optimistic";
+
+    /**
+     * Pessimistic offline lock.
+     */
+    String TRANSACTION_POLICY_PESSIMISTIC = "pessimistic";
+
+    /**
+     * A read-only usecase.
+     */
+    String TRANSACTION_POLICY_READONLY = "readonly";
+
+    /**
      * The <code>Usecase</code> role.
      */
     String ROLE = Usecase.class.getName();
-    
+
     /**
-     * The <em>itemState</em> parameter is used to ask the usecase if the corresponding menu item
-     * is checked. The parameter value is supposed to be a {@link java.lang.Boolean} object. If the
+     * The <em>itemState</em> parameter is used to ask the usecase if the corresponding menu item is
+     * checked. The parameter value is supposed to be a {@link java.lang.Boolean} object. If the
      * value is null, the <em>checked</em> attribute is not added.
      */
     public static final String PARAMETER_ITEM_STATE = "itemState";
-    
+
     /**
      * @param url The URL the usecase is invoked on.
      */
@@ -74,15 +89,14 @@
      * @return A string or <code>null</code> if the parameter was not set.
      */
     String getParameterAsString(String name);
-    
+
     /**
      * @return The parameter names.
      */
     String[] getParameterNames();
 
     /**
-     * Sets a parameter from the form. This method is called for parts in
-     * multipart requests.
+     * Sets a parameter from the form. This method is called for parts in multipart requests.
      * @param name The parameter name.
      * @param value The parameter value.
      */
@@ -96,33 +110,29 @@
     Part getPart(String name);
 
     /**
-     * Advances the usecase to the next step. This method is called when all
-     * parameters are set.
+     * Advances the usecase to the next step. This method is called when all parameters are set.
      * @throws UsecaseException if an error occurs.
      */
     void advance() throws UsecaseException;
 
     /**
      * Checks the conditions before a form is displayed.
-     * @throws UsecaseException if an error occurs that causes an unstable
-     *             system.
+     * @throws UsecaseException if an error occurs that causes an unstable system.
      */
     void checkPreconditions() throws UsecaseException;
 
     /**
      * Checks the conditions after the usecase was executed.
-     * @throws UsecaseException if an error occurs that causes an unstable
-     *             system.
+     * @throws UsecaseException if an error occurs that causes an unstable system.
      */
     void checkPostconditions() throws UsecaseException;
 
     /**
      * Checks the conditions right before the operation is executed.
-     * @throws UsecaseException if an error occurs that causes an unstable
-     *             system.
+     * @throws UsecaseException if an error occurs that causes an unstable system.
      */
     void checkExecutionConditions() throws UsecaseException;
-    
+
     /**
      * Locks all objects that are involved in the transaction.
      * @throws UsecaseException if an error occurs.
@@ -130,56 +140,54 @@
     void lockInvolvedObjects() throws UsecaseException;
 
     /**
-     * Returns the error messages from the previous operation. Error messages
-     * prevent the operation from being executed.
+     * Returns the error messages from the previous operation. Error messages prevent the operation
+     * from being executed.
      * @return A list of {@link UsecaseMessage} objects.
      */
     List getErrorMessages();
 
     /**
-     * Returns the info messages from the previous operation. Info messages do
-     * not prevent the operation from being executed.
+     * Returns the info messages from the previous operation. Info messages do not prevent the
+     * operation from being executed.
      * @return A list of {@link UsecaseMessage} objects.
      */
     List getInfoMessages();
 
     /**
-     * Determine if the usecase has error messages.
-     * Provides a way of checking for errors without actually retrieving them.
+     * Determine if the usecase has error messages. Provides a way of checking for errors without
+     * actually retrieving them.
      * @return true if the usecase resulted in error messages.
      */
     public boolean hasErrors();
 
     /**
-     * Determine if the usecase has info messages.
-     * Provides a way of checking for info messages without actually retrieving them.
+     * Determine if the usecase has info messages. Provides a way of checking for info messages
+     * without actually retrieving them.
      * @return true if the usecase resulted in info messages being generated.
      */
     public boolean hasInfoMessages();
 
     /**
-     * Executes the usecase. During this method error and info messages are
-     * filled in. If getErrorMessages() returns an empty array, the operation
-     * succeeded. Otherwise, the operation failed.
-     * @throws UsecaseException if an error occured that causes an unstable
-     *             system.
+     * Executes the usecase. During this method error and info messages are filled in. If
+     * getErrorMessages() returns an empty array, the operation succeeded. Otherwise, the operation
+     * failed.
+     * @throws UsecaseException if an error occured that causes an unstable system.
      */
     void execute() throws UsecaseException;
-    
+
     /**
      * Cancels the usecase.
      * @throws UsecaseException if an error occurs.
      */
     void cancel() throws UsecaseException;
-    
+
     /**
      * @return The web application URL the usecase was invoked on.
      */
     String getSourceURL();
 
     /**
-     * Returns the webapp URL which should be redirected to after the usecase is
-     * completed.
+     * Returns the webapp URL which should be redirected to after the usecase is completed.
      * @param success If the usecase was completed successfully.
      * @return A web application URL.
      */
@@ -189,12 +197,12 @@
      * @param name The name of this usecase.
      */
     void setName(String name);
-    
+
     /**
      * @return The name of this usecase.
      */
     String getName();
-    
+
     /**
      * @return The view of the usecase.
      */
@@ -204,20 +212,21 @@
      * @return The repository session.
      */
     Session getSession();
-    
+
     /**
-     * If you invoke this method, the usecase won't use its own isolated session,
-     * but the passed test session. The session will not be committed when the usecase
-     * is invoked, so you can check it for modifications without modifying the repository.
+     * If you invoke this method, the usecase won't use its own isolated session, but the passed
+     * test session. The session will not be committed when the usecase is invoked, so you can check
+     * it for modifications without modifying the repository.
      * @param session The test session.
      */
     void setTestSession(Session session);
-    
+
     /**
-     * @return if the usecase uses optimistic offline lock.
+     * @return The transaction policy, one of {@link #TRANSACTION_POLICY_OPTIMISTIC},
+     *         {@link #TRANSACTION_POLICY_PESSIMISTIC}, {@link #TRANSACTION_POLICY_READONLY}.
      */
-    boolean isOptimistic();
-    
+    String getTransactionPolicy();
+
     /**
      * Initialize the view.
      * @throws UsecaseException if an error occurs.

Modified: lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/COB-INF/sitemap.xmap?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/COB-INF/sitemap.xmap (original)
+++ lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/COB-INF/sitemap.xmap Mon Feb 23 16:53:54 2009
@@ -27,10 +27,6 @@
   <map:components>
     <map:transformers default="xslt">    
       <map:transformer name="browser-update" src="org.apache.cocoon.ajax.BrowserUpdateTransformer"/>
-      <map:transformer name="usecase-proxy" logger="lenya.sitemap.transformer.proxy"
-        src="org.apache.lenya.cms.cocoon.transformation.ProxyTransformer">
-        <transform namespace="http://apache.org/lenya/proxy/1.0" element="url" attribute="href"/>
-      </map:transformer>
     </map:transformers>
     <map:selectors>
       <map:selector name="ajax-request" src="org.apache.cocoon.ajax.AjaxRequestSelector"/>
@@ -53,14 +49,18 @@
         executeUsecase() flowscript has completed and issued a redirect,
         which is matched here.
       -->
-      <map:match pattern="usecases-view/*/**">
+      <map:match pattern="usecases-view/*">
+        
+        <map:generate type="jx" src="{flow-attr:usecase/view/viewURI}"/>
+        <map:serialize type="servletService">
+          <map:parameter name="service" value="servlet:gui:/service/style-cms-page"/>
+        </map:serialize>
         
-        <map:generate type="jx" src="fallback://lenya/{2}"/>
         <map:transform type="browser-update"/>
         <map:transform type="cinclude"/>
         <map:transform type="forms" />
         
-        <map:transform type="usecase-proxy"/>
+        <map:transform type="proxy-usecase"/>
         <map:transform src="xslt/proxyUrl2text.xsl"/>
         
         <map:transform src="cocoon://lenya-screen.xsl"/>
@@ -116,6 +116,14 @@
       
     </map:pipeline>
     
+    <map:handle-errors>
+      <map:generate type="exception"/>
+      <map:transform src="servlet:style:/stylesheets/system/exception2html.xslt">
+        <map:parameter name="realPath" value="{realpath:}"/>
+      </map:transform>
+      <map:serialize type="xml" status-code="200"/>
+    </map:handle-errors>
+    
   </map:pipelines>
   
 </map:sitemap>

Modified: lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/COB-INF/usecases.js
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/COB-INF/usecases.js?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/COB-INF/usecases.js (original)
+++ lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/COB-INF/usecases.js Mon Feb 23 16:53:54 2009
@@ -18,6 +18,7 @@
 /* $Id$ */
  
 cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
+importClass(org.apache.lenya.cms.usecase.Usecase);
 
 //placeholders for custom flow code:
 var customLoopFlow = undefined;
@@ -35,7 +36,6 @@
     var sourceUrl;
     var usecaseResolver;
     var usecase;
-    try {
         flowHelper = cocoon.getComponent("org.apache.lenya.cms.cocoon.flow.FlowHelper");
         request = flowHelper.getRequest(cocoon);
         sourceUrl = Packages.org.apache.lenya.util.ServletHelper.getWebappURI(request);
@@ -43,6 +43,7 @@
         usecase = usecaseResolver.resolve(sourceUrl, usecaseName);
         usecase.setSourceURL(sourceUrl);
         usecase.setName(usecaseName);
+    try {
     } catch (exception) {
         log("error", "Error in getUsecase(): " + exception);
         log("debug", "usecaseName = " + usecaseName);
@@ -84,6 +85,7 @@
  */
 function passRequestParameters(usecase) {
     var flowHelper = cocoon.getComponent("org.apache.lenya.cms.cocoon.flow.FlowHelper");
+    var request = flowHelper.getRequest(cocoon);
     var names = cocoon.request.getParameterNames();
     while (names.hasMoreElements()) {
         var name = names.nextElement();
@@ -97,7 +99,7 @@
             var vector = new Packages.java.util.Vector();
             if (string.getClass().isInstance(value) || vector.getClass().isInstance(value)) {
                 // use getParameters() to avoid character encoding problems
-                var values = flowHelper.getRequest(cocoon).getParameterValues(name);
+                var values = request.getParameterValues(name);
                 if (values.length < 2) {
                     usecase.setParameter(name, values[0]);
                 } else {
@@ -171,24 +173,21 @@
 
 /**
  * The Loop stage of the flow, in which a view is displayed. 
- * <em>Note:</em> All Avalon components should be released before calling
- * this function! This means that you cannot hold a usecase object,
- * hence the proxy.
  * 
  * @param view, a org.apache.lenya.cms.usecase.UsecaseView object
- * @param proxy, a org.apache.lenya.cms.usecase.UsecaseProxy object
+ * @param usecase, a org.apache.lenya.cms.usecase.Usecase object
  * @param generic, a generic Javascript object for custom flow code to preserve state information (currently not used by the default code)
  * @return A WebContinuation object or null if no continuation was created.
  *
  * This function invokes customLoopFlow if it exists.
  * Otherwise it falls back to defaultLoopFlow.
  */
-function loopFlow(view, proxy, generic) {
+function loopFlow(view, usecase, generic) {
     if (customLoopFlow != undefined) {
-        log("info", "Using customLoopFlow function", proxy.getName());
-        return customLoopFlow(view, proxy, generic);
+        log("info", "Using customLoopFlow function", usecase.getName());
+        return customLoopFlow(view, usecase, generic);
     } else{
-        return defaultLoopFlow(view, proxy);
+        return defaultLoopFlow(view, usecase);
     }
 }
 
@@ -217,7 +216,7 @@
 /**
  * @see loopFlow.
  */
-function defaultLoopFlow(view, proxy) {
+function defaultLoopFlow(view, usecase) {
     var viewUri = view.getViewURI();
     // we used to allow a cocoon:/ and cocoon:// prefix (which sendPageXXX does not handle),
     // but it is now deprecated!
@@ -229,16 +228,14 @@
     if (! viewUri.startsWith("/")) {
         // a local URI must be handled by usecase.xmap, which assumes a prefix "usecases-view/[menu|nomenu]/
         // that determines whether the menu is to be displayed. this mechanism is used by most lenya core usecases.
-        viewUri = "usecases-view/" 
-            + (view.showMenu() ? "menu" : "nomenu")
-            + "/" + viewUri;
+        viewUri = "usecases-view/" + (view.showMenu() ? "menu" : "nomenu");
     }
     if (view.createContinuation()) {
         log("debug", "Creating view and continuation, calling Cocoon with viewUri = [" + viewUri + "]");
-        return cocoon.sendPageAndWait(viewUri, { "usecase" : proxy });
+        return cocoon.sendPageAndWait(viewUri, { "usecase" : usecase });
     } else {
         log("debug", "Creating view without continuation (!), calling Cocoon with viewUri = [" + viewUri + "]");
-        cocoon.sendPage(viewUri, { "usecase" : proxy});
+        cocoon.sendPage(viewUri, { "usecase" : usecase});
         cocoon.exit(); // we're done.
         return null;
     }
@@ -250,12 +247,12 @@
 function defaultSubmitFlow(usecase) {
     var preconditionsOk = true;
     if (cocoon.request.getParameter("submit")||cocoon.request.getParameter("lenya.submit")=="ok") {
-        if (usecase.isOptimistic()) {
+        if (usecase.getTransactionPolicy().equals(Usecase.TRANSACTION_POLICY_OPTIMISTIC)) {
             usecase.checkPreconditions();
             preconditionsOk = !usecase.hasErrors();
         }
         if (preconditionsOk) {
-            if (usecase.isOptimistic()) {
+            if (usecase.getTransactionPolicy().equals(Usecase.TRANSACTION_POLICY_OPTIMISTIC)) {
                 usecase.lockInvolvedObjects();
             }
             usecase.checkExecutionConditions();
@@ -333,16 +330,11 @@
  * Uses request parameter "lenya.usecase" to determine what
  * usecase to execute.
  * 
- * Since "usecase" and "flowHelper" are avalon components, 
- * they must be released before a continuation is created.
- * In order to preserve state information, a "proxy" object
- * is used.
  */
 function executeUsecase() {
 
     var usecaseName;
     var usecase; // the Usecase object
-    var proxy; // a UsecaseProxy to make the usecase state persistent across continuations
     var view; // the UsecaseView object that belongs to our usecase.
     var state; // the state of the usecase ("continue"|"success"|"cancel");
     var targetUrl; // URL to redirect to after completion.
@@ -355,15 +347,13 @@
         passRequestParameters(usecase);
         usecase.checkPreconditions();
         preconditionsOK = !usecase.hasErrors();
-        if (preconditionsOK && !usecase.isOptimistic()) {
+        if (preconditionsOK && !usecase.getTransactionPolicy().equals(Usecase.TRANSACTION_POLICY_OPTIMISTIC)) {
             usecase.lockInvolvedObjects();
         }
-        // create proxy object to save usecase state
         view = usecase.getView();
         if (view) {
             usecase.setupView();
         }
-        proxy = new Packages.org.apache.lenya.cms.usecase.impl.UsecaseProxy(usecase);
         log("debug", "Successfully prepared usecase.", usecaseName);
     try {
     } catch (exception) {
@@ -381,14 +371,13 @@
         var continuation = null;
         do {
             // show the view:
+                continuation = loopFlow(view, usecase, generic); //usecase must be released here!
             try {
-                continuation = loopFlow(view, proxy, generic); //usecase must be released here!
             } catch (exception) {
                 // if something went wrong, try and rollback the usecase:
                 log("error", "Exception during loopFlow(): " + exception, usecaseName);
                 try {
                     usecase = getUsecase(usecaseName);
-                    proxy.setup(usecase);
                     usecase.cancel();
                     throw exception;
                 } finally {
@@ -399,12 +388,8 @@
                 log("debug", "Advancing in usecase.", usecaseName);
                 // restore the usecase state and handle the user input:
                 usecase = getUsecase(usecaseName);
-                proxy.setup(usecase);
                 passRequestParameters(usecase);
                 state = submitFlow(usecase, generic);
-                // create a new proxy with the updated usecase state
-                proxy = new Packages.org.apache.lenya.cms.usecase.impl.UsecaseProxy(usecase);
-                releaseUsecase(usecase);
             }
         } while (state == "continue");
         if (continuation != null) {
@@ -414,16 +399,15 @@
     // executeFlow().
     } else {
         usecase = getUsecase(usecaseName);
-        proxy.setup(usecase);
         passRequestParameters(usecase);
         
-        if (usecase.isOptimistic()) {
+        if (usecase.getTransactionPolicy().equals(Usecase.TRANSACTION_POLICY_OPTIMISTIC)) {
             usecase.checkPreconditions();
             preconditionsOK = !usecase.hasErrors();
         }
         
         if (preconditionsOK) {
-            if (usecase.isOptimistic()) {
+            if (usecase.getTransactionPolicy().equals(Usecase.TRANSACTION_POLICY_OPTIMISTIC)) {
                 usecase.lockInvolvedObjects();
             }
             usecase.checkExecutionConditions();
@@ -435,8 +419,7 @@
         }
         releaseUsecase(usecase);
         if (hasErrors) {
-            proxy = new Packages.org.apache.lenya.cms.usecase.impl.UsecaseProxy(usecase);
-            cocoon.sendPage("usecases-view/nomenu/modules/usecase/templates/error.jx", { "usecase" : proxy});
+            cocoon.sendPage("usecases-view/nomenu/modules/usecase/templates/error.jx", { "usecase" : usecase });
             return;
         }
     }

Modified: lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/META-INF/cocoon/spring/lenya-core-usecase-blockServlet.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/META-INF/cocoon/spring/lenya-core-usecase-blockServlet.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/META-INF/cocoon/spring/lenya-core-usecase-blockServlet.xml (original)
+++ lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/META-INF/cocoon/spring/lenya-core-usecase-blockServlet.xml Mon Feb 23 16:53:54 2009
@@ -25,6 +25,11 @@
                            http://cocoon.apache.org/schema/servlet http://cocoon.apache.org/schema/servlet/cocoon-servlet-1.0.xsd">
 
   <bean name="org.apache.lenya.core.usecase.block" class="org.apache.cocoon.sitemap.SitemapServlet">
-    <servlet:context mount-path="/usecase" context-path="blockcontext:/lenya-core-usecase-2.2.0-SNAPSHOT/"/>
+    <servlet:context mount-path="/usecase" context-path="blockcontext:/lenya-core-usecase-2.2.0-SNAPSHOT/">
+      <servlet:connections>
+        <entry key="gui" value-ref="org.apache.lenya.core.gui.block"/>
+        <entry key="style" value-ref="org.apache.cocoon.samples.style.default.servlet"/>
+      </servlet:connections>
+    </servlet:context>
   </bean>
 </beans>

Modified: lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/META-INF/cocoon/spring/lenya-core-usecase.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/META-INF/cocoon/spring/lenya-core-usecase.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/META-INF/cocoon/spring/lenya-core-usecase.xml (original)
+++ lenya/trunk/org.apache.lenya.core.usecase/src/main/resources/META-INF/cocoon/spring/lenya-core-usecase.xml Mon Feb 23 16:53:54 2009
@@ -16,10 +16,16 @@
   limitations under the License.
 -->
 <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:p="http://www.springframework.org/schema/p"
   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.module.Module/usecase"
+    class="org.apache.lenya.cms.module.ModuleImpl">
+    <property name="baseUri" value="file://${lenya.home}/org.apache.lenya.core.usecase/target/classes/COB-INF"/>
+  </bean>
+  
   <bean name="org.apache.lenya.ac.Authorizer/usecase"
     class="org.apache.lenya.cms.ac.usecase.impl.UsecaseAuthorizerImpl">
     <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
@@ -38,4 +44,21 @@
     <property name="usecaseResolver" ref="org.apache.lenya.cms.usecase.UsecaseResolver"/>
   </bean>
   
+  <!-- Transformers -->
+  <bean name="org.apache.cocoon.transformation.Transformer/proxy-usecase"
+    class="org.apache.lenya.cms.cocoon.transformation.ProxyTransformer"
+    scope="prototype">
+    <property name="repository" ref="org.apache.lenya.cms.publication.Repository"/>
+    <property name="attributes">
+      <bean class="org.apache.lenya.cms.linking.impl.LinkRewriteAttributesImpl">
+        <property name="attributes">
+          <list>
+            <bean class="org.apache.lenya.cms.linking.impl.LinkRewriteAttributeImpl"
+              p:namespace="http://apache.org/lenya/proxy/1.0" p:element="url" p:attribute="href"/>
+          </list>
+        </property>
+      </bean>
+    </property>
+  </bean>
+  
 </beans>

Modified: lenya/trunk/org.apache.lenya.core.workflow/src/test/resources/test-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.workflow/src/test/resources/test-components.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.workflow/src/test/resources/test-components.xml (original)
+++ lenya/trunk/org.apache.lenya.core.workflow/src/test/resources/test-components.xml Mon Feb 23 16:53:54 2009
@@ -21,6 +21,7 @@
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
   
   <import resource="classpath:META-INF/cocoon/spring/lenya-core-ac-components.xml"/>
+  <import resource="classpath:META-INF/cocoon/spring/lenya-core-api-components.xml"/>
   <import resource="classpath:META-INF/cocoon/spring/lenya-core-api-sourceFactories.xml"/>
   <import resource="classpath:META-INF/cocoon/spring/lenya-core-cache-components.xml"/>
   <import resource="classpath:META-INF/cocoon/spring/lenya-core-impl-components.xml"/>

Modified: lenya/trunk/org.apache.lenya.webapp.welcome/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.webapp.welcome/src/main/resources/COB-INF/sitemap.xmap?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.webapp.welcome/src/main/resources/COB-INF/sitemap.xmap (original)
+++ lenya/trunk/org.apache.lenya.webapp.welcome/src/main/resources/COB-INF/sitemap.xmap Mon Feb 23 16:53:54 2009
@@ -18,17 +18,6 @@
     
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
   
-  <map:resources>
-    <map:resource name="style-cms-page">
-      <map:transform type="i18n">      
-        <map:parameter name="locale" value="{request:locale}"/>
-      </map:transform>    
-      <map:transform src="fallback://lenya/xslt/util/page2xhtml.xsl"/>
-      <map:transform type="proxy-xhtml"/>
-      <map:transform src="context://lenya/xslt/util/strip_namespaces.xsl"/>
-    </map:resource>
-  </map:resources>
-  
   <map:pipelines>
     
     <map:pipeline internal-only="true">
@@ -49,7 +38,7 @@
       
       <map:match pattern="ac.login" type="usecase">
         <map:generate src="servlet:usecase:/service/usecase/ac.login"/>
-        <map:serialize type="xhtml"/>
+        <map:serialize type="html"/>
       </map:match>
       <map:match pattern="ac.logout" type="usecase">
         <map:mount check-reload="yes" reload-method="synchron" src="{fallback:lenya/modules/usecase/usecase.xmap}" uri-prefix=""/>

Modified: lenya/trunk/org.apache.lenya.webapp.welcome/src/main/resources/META-INF/cocoon/spring/lenya-welcome-blockServlet.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.webapp.welcome/src/main/resources/META-INF/cocoon/spring/lenya-welcome-blockServlet.xml?rev=747080&r1=747079&r2=747080&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.webapp.welcome/src/main/resources/META-INF/cocoon/spring/lenya-welcome-blockServlet.xml (original)
+++ lenya/trunk/org.apache.lenya.webapp.welcome/src/main/resources/META-INF/cocoon/spring/lenya-welcome-blockServlet.xml Mon Feb 23 16:53:54 2009
@@ -27,7 +27,9 @@
   <bean name="org.apache.lenya.webapp.welcome.block" class="org.apache.cocoon.sitemap.SitemapServlet">
     <servlet:context mount-path="/" context-path="blockcontext:/lenya-welcome-2.2.0-SNAPSHOT/">
       <servlet:connections>
+        <entry key="acusecases" value-ref="org.apache.lenya.core.acusecases.block"/>
         <entry key="gui" value-ref="org.apache.lenya.core.gui.block"/>
+        <entry key="style" value-ref="org.apache.cocoon.samples.style.default.servlet"/>
         <entry key="usecase" value-ref="org.apache.lenya.core.usecase.block"/>
       </servlet:connections>
     </servlet:context>
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.