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 2007/11/16 16:12:50 UTC
svn commit: r595691 [17/28] - in /lenya/sandbox/pubs/docu: config/
content/authoring/ content/authoring/0033e320-8731-11dc-ae46-9e7b5d14892d/
content/authoring/018a9980-8731-11dc-ae46-9e7b5d14892d/
content/authoring/02f9e0f0-8731-11dc-ae46-9e7b5d14892d...
Added: lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221900626.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221900626.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221900626.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221900626.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Prerequisites</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=595691&r1=595690&r2=595691&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 16 07:11:58 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221900626" version="3"/>
+<CheckOut identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221890717"/>
<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910776505" version="2"/>
<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910762445"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781618035" version="1"/>
Added: lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.1195221901827.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.1195221901827.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.1195221901827.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.1195221901827.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<!-- $Id: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Implementing a Usecase, Part 2: The Usecase</title>
+ </header>
+ <body>
+
+ <section>
+ <title>Declaring the Usecase</title>
+ <p>
+ Now we're ready to start working on the actual usecase. First, we tell Lenya about
+ the usecase. The usecase declaration is a patch file for <code>cocoon.xconf</code>.
+ It is located at <code>$MODULE_HOME/config/cocoon-xconf/usecase-addKnownPerson.xconf</code>.
+ It adds the <em>person.addKnownUsecase</em> usecase component instance if it doesn't
+ exist yet (determined by the <code>unless</code> attribute):
+ </p>
+ <source xml:space="preserve"><![CDATA[<xconf xpath="/cocoon/usecases"
+ unless="/cocoon/usecases/component-instance[@name = 'person.addKnownPerson']">
+
+ <component-instance name="person.addKnownPerson" logger="lenya.modules.person"
+ class="org.apache.lenya.modules.person.usecases.AddKnownPerson">
+ <view template="modules/person/usecases/addKnownPerson.jx"/>
+ </component-instance>
+
+</xconf>
+]]></source>
+ <p>
+ This usecase declaration specifies the usecase handler class (in our case
+ <code>AddKnownPerson</code>) and the JX template which acts as the view for
+ the usecase (<code>addKnownPerson.jx</code>). For a complete list of the generic
+ usecase configuration options, refer to the <a href="lenya-document:a1297160-8730-11dc-ae46-9e7b5d14892d">AbstractUsecase</a>
+ documentation.
+ </p>
+ </section>
+
+ <section>
+ <title>Implementing the Usecase Handler Class</title>
+ <p>
+ The usecase handler object receives user input and manipulates the business objects,
+ in our case the <code>Person</code> objects, accordingly. It has the following
+ responsibilities:
+ </p>
+ <ul>
+ <li>Prepare data to be displayed on the view,</li>
+ <li>Validate user input and generate appropriate error messages, and</li>
+ <li>Manipulate the business objects.</li>
+ </ul>
+ <p>
+ If you want to follow a strictly object-oriented approach, the usecase handler class
+ itself shouldn't contain any knowledge about the business logic. It belongs to the
+ controller part of the <acronym title="Model-View-Controller">MVC</acronym> pattern
+ (the other parts of the controller are the usecase sitemap and the flowscript).
+ </p>
+ <p>
+ The following code snippet shows the usecase handler class.
+ At this point, we implement only the two most important methods:
+ </p>
+ <ul>
+ <li>
+ <code>initParameters()</code> initializes the usecase parameters which are
+ used to communicate between the usecase handler and the view. In our case, it
+ compiles a list of <code>Person</code> objects, one for each document with the resource type
+ <em>person</em>.
+ </li>
+ <li>
+ <code>doExecute()</code> gets the <em>uuid</em> parameter from the view and adds
+ the corresponding <code>Person</code> object to the list of known people.
+ </li>
+ </ul>
+ <source xml:space="preserve"><![CDATA[public class AddKnownPerson extends DocumentUsecase {
+
+ protected void initParameters() {
+ super.initParameters();
+
+ Document doc = getSourceDocument();
+ Document[] allDocs = doc.area().getDocuments();
+
+ try {
+ Set peopleDocs = new HashSet();
+ for (int i = 0; i < allDocs.length; i++) {
+ if (allDocs[i].getResourceType().getName().equals("person")) {
+ Person person = new Person(allDocs[i]);
+ peopleDocs.add(person);
+ }
+ }
+ setParameter("people", peopleDocs);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void doExecute() throws Exception {
+ super.doExecute();
+
+ String uuid = getParameterAsString("uuid");
+ Document doc = getSourceDocument();
+ Person person = new Person(doc);
+
+ Document knownDoc = doc.area().getDocument(uuid, doc.getLanguage());
+ Person knownPerson = new Person(knownDoc);
+
+ person.addKnownPerson(knownPerson);
+ }
+
+}]]></source>
+ </section>
+
+ <section>
+ <title>Implementing the View</title>
+ <p>
+ We're using a JX template to implement the view. It allows us to generate XHTML
+ code using properties of Java objects which are passed as parameters from the usecase
+ handler object.
+ </p>
+ <p>
+ The page contains a form, passing the <em>lenya.usecase</em> and <em>lenya.continuation</em>
+ parameters as hidden input fields. We choose POST as the form method because we want
+ to manipulate data on the server, avoiding that the user submits the form multiple times.
+ We generate a drop-down list containing an option for each person,
+ using the UUID as the <code>value</code> attribute of the <code>option</code> element.
+ Remember that the <em>people</em> parameter was set in the <code>initParameters()</code>
+ method of the usecase handler class.
+ </p>
+ <source xml:space="preserve"><![CDATA[<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+ xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
+
+ <page:title>
+ <i18n:text>Add Known Person</i18n:text>
+ </page:title>
+ <page:body>
+
+ <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
+
+ <form method="POST">
+ <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
+ <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
+
+ <p>
+ <i18n:text>Select a person you know:</i18n:text>
+ </p>
+ <p>
+ <select name="uuid">
+ <jx:forEach var="person" items="${usecase.getParameter('people')}">
+ <option value="${person.getDocument().getUUID()}">
+ <jx:out value="${person.getName()}"/>
+ </option>
+ </jx:forEach>
+ </select>
+ </p>
+
+ <p>
+ <input i18n:attr="value" name="submit" type="submit" value="Submit"/>
+ <i18n:text> </i18n:text>
+ <input i18n:attr="value" name="cancel" type="submit" value="Cancel"/>
+ </p>
+
+ </form>
+ </page:body>
+</page:page>]]></source>
+ </section>
+
+ <section>
+ <title>Adding the Menu Item</title>
+ <p>
+ To be able to trigger the usecase, we have to add the corresponding menu item
+ to the menu of the person module, which is located at
+ <code>$MODULE_HOME/config/menu.xsp</code>. We add a menu block which shall be
+ visible only in the authoring area, right below the block containing the
+ editor menu items. The value of the <code>uc:usecase</code> attribute of the
+ <code><![CDATA[<item/>]]></code> element is the name of the usecase as specified
+ in the usecase declaration.
+ </p>
+ <source xml:space="preserve"><![CDATA[<menu i18n:attr="name" name="Edit">
+ <xsp:logic>
+ try {
+ Object doc = <input:get-attribute module="page-envelope"
+ as="object" name="document"/>;
+ if (doc instanceof Document && ((Document) doc).exists()) {
+ String doctype = <input:get-attribute module="page-envelope"
+ as="string" name="document-type"/>;
+ if ("person".equals(doctype)) {
+ <block areas="authoring">
+ <item uc:usecase="bxe.edit" href="?">
+ <i18n:text>With BXE</i18n:text>
+ </item>
+ <item uc:usecase="editors.oneform" href="?">
+ <i18n:text>With one Form</i18n:text>
+ </item>
+ </block>
+ <block areas="authoring">
+ <item uc:usecase="person.addKnownPerson" href="?">
+ <i18n:text>Add Known Person</i18n:text>
+ </item>
+ </block>
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException("Error during menu generation: ", e);
+ }
+ </xsp:logic>
+</menu>]]></source>
+ </section>
+
+ <section>
+ <title>Setting the Usecase Permissions</title>
+ <p>
+ Finally we have to specify who shall be able to execute the usecase.
+ To accomplish this, we have to add an entry to the usecase policies file of the
+ publication(s) which will use the person module. The file is located at
+ <code>$PUB_HOME/config/access-control/usecase-policies.xml</code>.
+ We allow everyone with the <em>admin</em> or <em>editor</em> role to
+ execute the usecase:
+ </p>
+ <source xml:space="preserve"><![CDATA[<usecase id="person.addKnownPerson">
+ <role id="admin" method="grant"/>
+ <role id="edit" method="grant"/>
+</usecase>]]></source>
+ <p>
+ Now you can deploy the changes by running the build process and restarting the
+ servlet engine. After that you should be able to connect people using the
+ "knows" relation.
+ </p>
+ <figure alt="Screenshot: Add Known Person usecase" src="lenya-document:688de830-8731-11dc-ae46-9e7b5d14892d"/>
+ </section>
+
+ <section>
+ <title>What's Next?</title>
+ <p>
+ There are some important steps which are missing from the example:
+ </p>
+ <ul>
+ <li>
+ In <code>initParameters()</code>, you should exclude the person itself and
+ all people which she or he already knows.
+ </li>
+ <li>
+ If you set the relation from person A to person B, it probably makes sense
+ to set the relation from B to A at the same time.
+ </li>
+ <li>
+ To avoid sending stack traces to the user, you should validate the <em>uuid</em>
+ parameter: Is it provided? Does it refer to an existing person document?
+ You can do this kind of validation in the <code>doCheckExecutionConditions()</code>
+ method - just call <code>addErrorMessage()</code> for each validation error.
+ </li>
+ </ul>
+ </section>
+
+ </body>
+</document>
Added: lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221901827.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221901827.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221901827.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221901827.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>The Usecase</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=595691&r1=595690&r2=595691&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 16 07:11:58 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221901827" version="3"/>
+<CheckOut identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221880613"/>
<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910781898" version="2"/>
<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910767086"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781619273" version="1"/>
Added: lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.1195221895215.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.1195221895215.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.1195221895215.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.1195221895215.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<!-- $Id: index.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Setting up Your Development Environment</title>
+ </header>
+ <body>
+ <p>
+ To ensure a good productivity when building Lenya applications, it is essential
+ that you have a well-configured development environment.
+ </p>
+ <p>
+ The following steps guide you through the process of setting up the Eclipse IDE for Lenya.
+ The paths apply to a Unix-like operating system, for Windows you have to change
+ the paths accordingly and replace all shell script names with the names of the corresponding
+ batch files.
+ </p>
+ <ul>
+ <li>
+ <p>
+ Check out the Lenya trunk and the Cocoon branch 2.1 from the Subversion
+ repository (see <a href="lenya-document:82081520-8730-11dc-ae46-9e7b5d14892d">Installation Instructions</a>).
+ I suggest to use the following directory layout:
+ </p>
+<source xml:space="preserve"><![CDATA[src/
+ apache/
+ lenya/
+ trunk/ -> LENYA_HOME
+ cocoon/
+ branches/
+ BRANCH_2_1_X/ -> COCOON_HOME
+]]></source>
+ <p>
+ You don't need to set these environment variables, I only use them in
+ this tutorial.
+ </p>
+ <p>
+ Note that we don't use the Cocoon version which ships with Lenya, but
+ a separate working copy of Cocoon. This is necessary because Eclipse
+ doesn't support nested projects.
+ </p>
+ <p>
+ The <code>apache</code> directory will come in handy when you start serious
+ development, because you're likely to peek into the source code of other
+ ASF projects like Excalibur or Xalan.
+ </p>
+ </li>
+ <li>
+ Edit <code>$LENYA_HOME/local.build.properties</code> and set the property
+ <code>cocoon.src.dir</code> to the path of your <code>$COCOON_HOME</code>
+ directory. When you use the suggested directory structure, this would be
+ <code>../../cocoon/branches/BRANCH_2_1_X</code>.
+ </li>
+ <li>
+ Go to the <code>$COCOON_HOME</code> directory and execute
+ <source xml:space="preserve">./build.sh eclipse-project</source>
+ This creates the Cocoon project files for Eclipse.
+ </li>
+ <li>
+ Go to the <code>$LENYA_HOME</code> directory and execute
+ <source xml:space="preserve">./build.sh eclipse-project</source>
+ This creates the Lenya project files for Eclipse.
+ </li>
+ <li>
+ You can now import both projects in Eclipse.
+ </li>
+ <li>
+ If your Lenya project complains that various packages are not
+ found, it is probably necessary to edit the <em>Java Build Path</em> properties
+ of your Cocoon project and select all libraries on the <em>Order and Export</em> tab.
+ </li>
+ <li>
+ In the <em>Preferences</em> pane, you have to configure the Java compiler to
+ use the 1.4 compliance level.
+ </li>
+ <li>
+ Eclipse stores the class files in <code>$LENYA_HOME/build/eclipse</code> by default.
+ Whenever you execute <code>./build.sh clean</code>, it gets confused. To avoid this,
+ set the default output folder in <em>Project properties > Build path > Source</em>
+ to a different directory (e.g. <code>$LENYA_HOME/eclipse</code>).
+ </li>
+ <li>
+ A decent XML and XSLT editor is recommended, you can for instance install the
+ web tools platform from the Eclipse project.
+ </li>
+ <li>
+ Have fun!
+ </li>
+ </ul>
+ </body>
+</document>
Added: lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221895215.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221895215.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221895215.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221895215.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Setting up Eclipse</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=595691&r1=595690&r2=595691&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 16 07:11:58 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221895215" version="3"/>
+<CheckOut identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221882334"/>
<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910790640" version="2"/>
<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910764034"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781619581" version="1"/>
Added: lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.1195221908874.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.1195221908874.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.1195221908874.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.1195221908874.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<!-- $Id: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Running Lenya Behind Apache with mod_proxy</title>
+ </header>
+ <body>
+
+ <section>
+ <title>Introduction</title>
+
+ <p>
+ This tutorial aims at getting you started with a proxy environment.
+ We're using Apache HTTPD 2.2 with the <em>mod_proxy</em> module. You'll find
+ a lot of documentation on the web how to set up the web server on your
+ machine.
+ </p>
+ <p>
+ Our goal is to run two virtual servers on your local machine:
+ </p>
+ <ul>
+ <li>
+<em>cms.example.com</em> - the authoring environment of your publication</li>
+ <li>
+<em>www.example.com</em> - the actual live site</li>
+ </ul>
+ <p>
+ Your administrators, editors etc. will use the URL <em>http://cms.example.com</em>
+ to connect to the authoring environment. We'll require an SSL connection for the
+ login usecase. Once you have established an SSL connection, your connection will
+ stay encrypted.
+ </p>
+ <p>
+ The live area is mapped directly to the root of the <em>www.example.com</em> host.
+ Since the authoring environment comprises different areas (for instance authoring,
+ archive, trash), the publication root is mapped to the root of <em>cms.example.com</em>:
+ </p>
+ <source xml:space="preserve"><![CDATA[/pub/authoring <-> cms.example.com/authoring
+/pub/archive <-> cms.example.com/archive
+/pub/trash <-> cms.example.com/trash
+/pub/live <-> www.example.com]]></source>
+ </section>
+
+ <section>
+ <title>Declaring the Hosts</title>
+ <p>
+ To tell your system that the <em>example.com</em> domains run on your local machine,
+ open your <code>hosts</code> file, usually located at <code>/etc/hosts</code>,
+ and add the following lines:
+ </p>
+ <source xml:space="preserve"><![CDATA[127.0.0.1 cms.example.com
+127.0.0.1 www.example.com]]></source>
+ </section>
+
+ <section>
+ <title>Configuring the Apache Web Server</title>
+ <p>
+ There are multiple options to connect the Apache web server, which acts as the
+ reverse proxy, to the Tomcat servlet container. The two most common ways are
+ </p>
+ <ul>
+ <li>
+<a href="lenya-document:910f47f0-8730-11dc-ae46-9e7b5d14892d">mod_proxy</a>
+</li>
+ <li>
+<a href="lenya-document:923ca460-8730-11dc-ae46-9e7b5d14892d">mod_proxy_ajp</a>
+</li>
+ <li>mod_jk</li>
+ </ul>
+ <p>
+ mod_proxy is the classic, proven approach. The AJP protocol
+ is newer, easier to set up and provides seamless SSL integration. For more information
+ on which connector to choose, refer to the
+ <a href="http://tomcat.apache.org/faq/connectors.html">Tomcat connectors FAQ</a>.
+ </p>
+ <p>
+ After configuring the Apache web server, you can restart it using
+ </p>
+ <source xml:space="preserve">$ sudo apachectl restart</source>
+ </section>
+
+ <section>
+ <title>Configuring Tomcat's Cookie Path</title>
+ <note>
+ You'll certainly run into cookie problems when using a non-empty context path
+ (like <em>lenya14</em> in the example above) instead of running Lenya in the root context.
+ This causes errors like "The session doesn't contain the identity.".
+ To avoid these problems, edit <code>$TOMCAT_HOME/conf/server.xml</code> and set the
+ <em>emptySessionPath</em> attribute of the Tomcat connector configuration to <em>true</em>.
+ You find more information in the <a href="http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html">Apache
+ Tomcat configuration reference</a>.
+ </note>
+ </section>
+
+ <section>
+ <title>Configuring the Publication for Proxying</title>
+ <p>
+ When you use a proxy, Lenya has to convert all internal links accordingly.
+ Therefore you have to tell the publication about the proxy configuration.
+ Open the file <code>$PUBLICATION_HOME/config/publication.xml</code> and uncomment
+ and modify the <code><![CDATA[<proxy/>]]></code> elements:
+ </p>
+ <source xml:space="preserve"><![CDATA[<proxies>
+ <proxy area="authoring" ssl="true" url="https://cms.example.com/authoring"/>
+ <proxy area="authoring" ssl="false" url="http://cms.example.com/authoring"/>
+ <proxy area="trash" ssl="true" url="https://cms.example.com/trash"/>
+ <proxy area="trash" ssl="false" url="http://cms.example.com/trash"/>
+ <proxy area="archive" ssl="true" url="https://cms.example.com/archive"/>
+ <proxy area="archive" ssl="false" url="http://cms.example.com/archive"/>
+ <proxy area="live" ssl="true" url="https://www.example.com"/>
+ <proxy area="live" ssl="false" url="http://www.example.com"/>
+</proxies>]]></source>
+ </section>
+
+ <section>
+ <title>Configuring the Global Proxies</title>
+ <p>
+ The application-wide (publication independent) proxies are configured in
+ <code>WEB-INF/cocoon.xconf</code>. Look for the declaration of the <code>GlobalProxies</code>
+ service and update this entry:
+ </p>
+ <source xml:space="preserve"><![CDATA[<component logger="lenya.proxy"
+ role="org.apache.lenya.cms.linking.GlobalProxies"
+ class="org.apache.lenya.cms.linking.impl.GlobalProxiesImpl">
+ <proxy ssl="false" url="http://cms.host.com"/>
+ <proxy ssl="true" url="https://cms.host.com"/>
+</component>]]></source>
+ </section>
+
+ <section>
+ <title>Testing the Settings</title>
+ <p>
+ After re-deploying the publication and restarting your servlet container,
+ you should be able to access the
+ authoring environment of the default publication at the URL
+ <a href="http://cms.example.com/">http://cms.example.com/</a>.
+ </p>
+ </section>
+
+ </body>
+</document>
Added: lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221908874.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221908874.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221908874.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221908874.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Proxying</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=595691&r1=595690&r2=595691&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 16 07:11:58 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221908874" version="3"/>
+<CheckOut identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221888544"/>
<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910791871" version="2"/>
<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910764988"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781627628" version="1"/>
Added: lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.1195221895563.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.1195221895563.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.1195221895563.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.1195221895563.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<!-- $Id: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Running Lenya Behind Apache with mod_proxy</title>
+ </header>
+ <body>
+
+ <section>
+ <title>Configuring the Apache Web Server</title>
+ <p>
+ First we'll declare the virtual hosts for the Apache web server. This is done in
+ a file called <code>httpd-vhosts.conf</code>. On Mac OS X, it is located in the directory
+ <code>/opt/local/apache2/conf/extra</code>. If you're using Jetty on port 8888, the
+ contents of the file should look like this:
+ </p>
+ <source xml:space="preserve"><![CDATA[NameVirtualHost *:80
+NameVirtualHost *:443
+
+# This is the non-SSL host for the authoring environment.
+<VirtualHost *:80>
+ ServerAdmin webmaster@cms.example.com
+ ServerName cms.example.com
+ ServerAlias cms
+
+ # Turn proxy requests off for security reasons
+ ProxyRequests Off
+
+ RewriteEngine On
+ RewriteLog /home/john/src/www/logs/cms.example.com-rewrite_log
+ RewriteLogLevel 4
+
+ # First we match everything which is not mapped to /default/{area}
+ RewriteRule ^/lenya/(.*) http://cms.example.com:8888/lenya/$1 [P,L]
+ RewriteRule ^/modules/(.*) http://cms.example.com.com:8888/modules/$1 [P,L]
+ RewriteRule ^/default/modules/(.*) http://cms.example.com:8888/default/modules/$1 [P,L]
+
+ # Redirect the login usecase to https
+ RewriteCond %{QUERY_STRING} (.*)lenya\.usecase=ac\.login(.*)
+ RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
+
+ # Forward the areas to the proxy
+ RewriteRule ^/(.*) http://cms.example.com:8888/default/$1 [P,L]
+ ProxyPassReverse / http://cms.example.com:8888/default/
+
+ ErrorLog /home/john/src/www/logs/cms.example.com-error_log
+ CustomLog /home/john/src/www/logs/cms.example.com-access_log common
+</VirtualHost>
+
+# This is the SSL host for the authoring environment.
+<VirtualHost *:443>
+ ServerAdmin webmaster@cms.example.com
+ ServerName cms.example.com
+ ServerAlias cms
+
+ SSLEngine On
+ SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
+ SSLCertificateFile /home/john/pki/server.crt
+ SSLCertificateKeyFile /home/john/pki/server.key
+
+ ProxyRequests Off
+ RewriteEngine On
+ RewriteLog /home/john/src/www/logs/cms.example.com-rewrite_log
+ RewriteLogLevel 4
+
+ RewriteRule ^/lenya/(.*) http://cms.example.com:8888/lenya/$1 [P,L]
+ RewriteRule ^/modules/(.*) http://cms.example.com.com:8888/modules/$1 [P,L]
+ RewriteRule ^/default/modules/(.*) http://cms.example.com:8888/default/modules/$1 [P,L]
+
+ RewriteRule ^/(.*) http://cms.example.com:8888/default/$1 [P,L]
+ ProxyPassReverse / http://cms.example.com:8888/default/
+
+ ErrorLog /home/john/src/www/logs/cms.example.com-error_log
+ CustomLog /home/john/src/www/logs/cms.example.com-access_log common
+</VirtualHost>
+
+# This is the non-SSL host for the live area.
+<VirtualHost *:80>
+ ServerAdmin webmaster@www.example.com
+ ServerName www.example.com
+ ServerAlias lenya
+
+ ProxyRequests Off
+ RewriteEngine On
+ RewriteLog /Users/john/src/www/logs/www.example.com-rewrite_log
+ RewriteLogLevel 4
+
+ RewriteRule ^/([^/\.]+)$ $1/ [R]
+ RewriteRule ^/(.*) http://www.example.com:8888/default/live/$1 [P,L]
+ ProxyPassReverse / http://www.example.com:8888/default/live/
+
+ ErrorLog /Users/john/src/www/logs/www.example.com-error_log
+ CustomLog /Users/john/src/www/logs/www.example.com-access_log common
+</VirtualHost>]]></source>
+
+ <p>
+ If you're using Tomcat on port 8080 with Lenya in the context path <em>lenya14</em>,
+ you have to change the port and add the context path accordingly:
+ </p>
+ <source xml:space="preserve"><![CDATA[ RewriteRule ^/(.*) http://cms.example.com:8080/lenya14/default/authoring/$1 [P,L]
+ ProxyPassReverse / http://cms.example.com:8080/lenya14/default/authoring/]]></source>
+ <note>
+ With this setup, your browser might show error messages like "You have requested an
+ encrypted page that contains some unencrypted information" when accessing a page
+ with the <code>https</code> protocol. This is because Apache always connects to Lenya
+ with the <code>http</code> protocol, so Lenya doesn't know that it should use <code>https</code>
+ links to include images etc. on this page. This problem won't occur if you use the
+ <a href="lenya-document:923ca460-8730-11dc-ae46-9e7b5d14892d">mod_proxy_ajp</a> approach.
+ </note>
+ </section>
+
+ </body>
+</document>
Added: lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221895563.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221895563.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221895563.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221895563.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>mod_proxy</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=595691&r1=595690&r2=595691&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/910f47f0-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 16 07:11:58 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221895563" version="3"/>
+<CheckOut identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221883009"/>
<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910775893" version="2"/>
<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910761640"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781628116" version="1"/>
Added: lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.1195221904251.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.1195221904251.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.1195221904251.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.1195221904251.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<!-- $Id: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Running Lenya Behind Apache with mod_proxy_ajp</title>
+ </header>
+ <body>
+
+ <section>
+ <title>Configuring the AJP Connector in Tomcat</title>
+ <p>
+ The file <code>$TOMCAT_HOME/conf/server.xml</code> contains an AJP 1.3 connector on
+ port 8009 by default:
+ </p>
+ <source xml:space="preserve"><![CDATA[<Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3"/>]]></source>
+ <p>
+ If the connector is not present, you have to add it.
+ </p>
+ </section>
+
+ <section>
+ <title>Configuring the Apache Web Server</title>
+ <p>
+ Now we'll declare the virtual hosts for the Apache web server. This is done in
+ a file called <code>httpd-vhosts.conf</code>. On Mac OS X, it is located in the directory
+ <code>/opt/local/apache2/conf/extra</code>. The contents of the file should
+ look like this:
+ </p>
+ <source xml:space="preserve"><![CDATA[NameVirtualHost *:80
+NameVirtualHost *:443
+
+# This is the non-SSL host for the authoring environment.
+<VirtualHost *:80>
+ ServerAdmin webmaster@cms.example.com
+ ServerName cms.example.com
+ ServerAlias cms
+
+ ProxyRequests Off
+
+ RewriteEngine On
+ RewriteLog /home/john/src/www/logs/cms.example.com-rewrite_log
+ RewriteLogLevel 4
+
+ # Redirect the login usecase to https
+ RewriteCond %{QUERY_STRING} (.*)lenya\.usecase=ac\.login(.*)
+ RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
+
+ <Location /lenya/>
+ ProxyPass ajp://localhost:8009/lenya/
+ ProxyPassReverse http://cms.example.com/lenya/
+ </Location>
+
+ <Location /modules/>
+ ProxyPass ajp://localhost:8009/modules/
+ ProxyPassReverse http://cms.example.com/modules/
+ </Location>
+
+ <Location /default/modules/>
+ ProxyPass ajp://localhost:8009/default/modules/
+ ProxyPassReverse http://cms.example.com/default/modules/
+ </Location>
+
+ <Location />
+ ProxyPass ajp://localhost:8009/default/
+ ProxyPassReverse http://cms.example.com/default/
+ </Location>
+
+ ErrorLog /home/john/src/www/logs/cms.example.com-error_log
+ CustomLog /home/john/src/www/logs/cms.example.com-access_log common
+</VirtualHost>
+
+# This is the SSL host for the authoring environment.
+<VirtualHost *:443>
+ ServerName cms.example.com
+ ServerAlias cms
+
+ ProxyRequests Off
+
+ SSLEngine On
+ SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
+ SSLCertificateFile /home/john/pki/server.crt
+ SSLCertificateKeyFile /home/john/pki/server.key
+
+ <Location /lenya/>
+ ProxyPass ajp://localhost:8009/lenya/
+ ProxyPassReverse https://cms.example.com/lenya/
+ </Location>
+
+ <Location /modules/>
+ ProxyPass ajp://localhost:8009/modules/
+ ProxyPassReverse https://cms.example.com/modules/
+ </Location>
+
+ <Location /default/modules/>
+ ProxyPass ajp://localhost:8009/default/modules/
+ ProxyPassReverse https://cms.example.com/default/modules/
+ </Location>
+
+ <Location />
+ ProxyPass ajp://localhost:8009/default/
+ ProxyPassReverse https://cms.example.com/default/
+ </Location>
+
+ ErrorLog /home/john/src/www/logs/ssl.cms.example.com-error_log
+ CustomLog /home/john/src/www/logs/ssl.cms.example.com-access_log common
+
+</VirtualHost>
+
+# This is the non-SSL host for the live area.
+<VirtualHost *:80>
+ ServerAdmin webmaster@www.example.com
+ ServerName www.example.com
+ ServerAlias www
+
+ ProxyRequests Off
+
+ <Location />
+ ProxyPass ajp://localhost:8009/default/live/
+ ProxyPassReverse http://www.example.com/default/live/
+ </Location>
+
+ ErrorLog /home/john/src/www/logs/www.example.com-error_log
+ CustomLog /home/john/src/www/logs/www.example.com-access_log common
+</VirtualHost>]]></source>
+ </section>
+
+ </body>
+</document>
Added: lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221904251.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221904251.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221904251.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221904251.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>mod_proxy_ajp</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=595691&r1=595690&r2=595691&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/923ca460-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 16 07:11:58 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221904251" version="3"/>
+<CheckOut identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221883656"/>
<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910794126" version="2"/>
<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910766438"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781621793" version="1"/>
Added: lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.1195221900900.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.1195221900900.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.1195221900900.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.1195221900900.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<!-- $Id: index.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Best Practises when Developing with Lenya 2.0</title>
+ </header>
+ <body>
+ <section>
+ <title>Speeding Up Development</title>
+ <p>
+ Following these tips can increase your development productivity:
+ </p>
+ <ul>
+ <li>
+ Set up your development environment correctly. The time you invest in this will
+ pay off very quickly.
+ </li>
+ <li>
+ Practise <a href="http://en.wikipedia.org/wiki/Test_driven_development">test-driven
+ development</a>. Since you can execute the tests with a single click in Eclipse,
+ you don't need to build and restart the application to check if something works.
+ </li>
+ <li>
+ During development, set <code>modules.copy=false</code> in <code>local.build.properties</code>.
+ This way, you don't have to execute the build process when you change something in a module
+ (except Java files and patches for <code>cocoon.xconf</code>).
+ </li>
+ <li>
+ Put all your non-Java files - XSLTs, CSS files, JX templates and complex sitemaps - in modules.
+ This allows you to change them without rebuilding (see preceding tip).
+ Using modules for anything which is not specific for a publication is a
+ good practise anyway - it encourages generic design and reuse.
+ </li>
+ </ul>
+ </section>
+ <section>
+ <title>Building Maintainable Applications</title>
+ <p>
+ To ensure the simplicity and maintainability of your Lenya-based applications,
+ try the following tips:
+ </p>
+ <ul>
+ <li>
+ Use resource types sparingly. A new resource type adds complexity to your
+ application. It requires to patch <code>cocoon.xconf</code> and is therefore
+ a static element of your application. Most differences between pages can be
+ implemented by using different XSLTs or templates in the presentation layer,
+ or even using distinct samples to provide a starting point for a certain type of
+ page.
+ </li>
+ <li>
+ Make extensive use of resource type formats. This way, you create orthogonality -
+ if you implement a certain format in each of your resource types, it is very
+ easy to include arbitrary resources in different locations. Typical examples
+ of formats are print views, teasers, summaries, icons, and RSS feeds.
+ </li>
+ <li>
+ Modularize your application. You can put each resource type in a separate
+ module. Service implementations are good module candidates as well - by
+ adding or removing them from your build path you can easily switch between
+ several implementions. A complex application is likely to feature a
+ <code>shared</code> module which contains utility XSLTs and other resources
+ which are used across multiple modules.
+ </li>
+ <li>
+ Use templates instead of XSLTs for layout purposes. This is an example of the
+ <a href="http://en.wikipedia.org/wiki/Separation_of_concerns">Separation of Concerns</a>
+ paradigm. XHTML templates can be edited without XSLT skills and without influencing
+ your presentation logic. For more information, check out the article
+ <a href="http://www.cocooncenter.org/articles/stylefree.html">Style-free Stylesheets with Cocoon</a>
+ on cocooncenter.org.
+ </li>
+ <li>
+ Keep your sitemaps simple. It is very hard to write tests for sitemaps, and complex ones
+ are difficult to read. Instead of building huge nested pipelines (e.g. for error handling),
+ it often makes sense to implement a specific selector or action to handle the
+ complicated aspects of the page flow. As soon as the functionality is implemented
+ in Java, it can be tested using unit tests and refactored using your favorite IDE.
+ </li>
+ <li>
+ Don't overload your usecase handler classes with view-specific details. The handler
+ is occupied with business logic, it shouldn't have to deal with the view as well.
+ If the JX templates become too complex, consider writing utility classes and
+ call them from the template. Modularizing JX templates is another promising approach
+ to reduce their complexity.
+ </li>
+ <li>
+ Document wrapper classes have proven useful to encapsulate the functionality of
+ objects which store their properties in Lenya documents, typically as XML. The wrapper
+ class exposes only business-level functionality. You can use an advanced object-to-XML
+ binding framework to persist the data, or you can just use the helper classes in the
+ <code>org.apache.lenya.xml</code> package.
+ </li>
+ </ul>
+ </section>
+ </body>
+</document>
Added: lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221900900.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221900900.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221900900.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221900900.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Best Practises</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=595691&r1=595690&r2=595691&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/93780a90-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 16 07:11:58 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221900900" version="3"/>
+<CheckOut identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221891072"/>
<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910788122" version="2"/>
<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910771875"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781620183" version="1"/>
Added: lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.1195221898619.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.1195221898619.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.1195221898619.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.1195221898619.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,253 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<!-- $Id: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Production Checklist</title>
+ </header>
+ <body>
+
+ <p>
+ Here's a list of points you should take care of when running Lenya
+ in a production environment. It covers only the most obvious aspects,
+ but it might prevent you from falling in the biggest traps in
+ first real-world project.
+ </p>
+
+ <section>
+ <title>General Deployment Recommendations</title>
+ <ul>
+ <li>
+ Seperate your web application from your data. This applies to
+ the content, access control, and work data (search index, cache).
+ </li>
+ <li>
+ When creating backups of your data, make sure you'll still know
+ which version of the application they're compatible with when you
+ need them again.
+ </li>
+ <li>
+ Always have two instances of Lenya ready, and make sure you can
+ switch between them immediately (e.g., by changing a symlink to
+ a proxy configuration file).
+ </li>
+ <li>
+ Consider using vendor branches for Lenya, Cocoon etc. This helps you to
+ stay flexible when you're faced with bugs, endorsed library issues etc.
+ </li>
+ <li>
+ When you deploy a version of your application, <strong>always</strong> create
+ a branch in your code versioning system. This way, you can merge essential
+ bugfixes from the trunk and re-deploy the application. <strong>Never</strong>
+ deploy an un-tagged development version.
+ </li>
+ </ul>
+ </section>
+
+ <section>
+ <title>During Development</title>
+ <ul>
+ <li>
+ Run sophisticated and thorough load tests early and often.
+ </li>
+ <li>
+ Run search engine crawlers on your site. Observe the performance behaviour
+ and session handling.
+ </li>
+ <li>
+ Test the site in various browsers, using various settings (disabling
+ JavaScript etc.), and preferrably using different bandwidths.
+ </li>
+ <li>
+ Make sure you don't create weak points for DoS attacks (e.g. by
+ expensive dynamic generation of non-cached pages based on request
+ parameters).
+ </li>
+ </ul>
+ </section>
+
+ <section>
+ <title>Preparation (Internal Pilot Phase)</title>
+ <p>
+ Set the log level to <em>ERROR</em> in
+ <code>externals/cocoon_2_1_x/src/webapp/WEB-INF/log4j.xconf</code>
+ (source, needs rebuild to become active) or
+ <code>build/lenya/webapp/WEB-INF/log4j.xconf</code> (deployed file):
+ </p>
+ <source xml:space="preserve"><![CDATA[
+ <root>
+ <priority value="error" />
+ <appender-ref ref="COCOON_DEFAULT" />
+ </root>
+]]></source>
+ <p>
+ Make sure that the logs stay clean. If exceptions occur, mercilessly
+ track them down and eliminate their causes. Even if you consider some
+ exceptions "normal" behaviour - they aren't.
+ </p>
+ <p>
+ At a later point in your testing process, disable the "DEBUG" setting for the Java compiler in
+ <code>src/targets/properties-build</code> to speed up your bytecode:
+ </p>
+ <source xml:space="preserve"><![CDATA[
+ <property name="debug" value="off"/>
+]]></source>
+
+ </section>
+
+ <section>
+ <title>Caching in Cocoon</title>
+ <p>
+ There's a <a href="http://wiki.apache.org/cocoon-data/attachments/GT2006Notes/attachments/10-caching.pdf">great
+ presentation</a> (PDF) about caching in Cocoon, held at the Cocoon Get-Together 2006.
+ </p>
+ <p>
+ Cocoon's default store implementation is an in-memory store backed by a disk
+ store (based on EHCache). You can configure this store using a file called
+ <code>ehcache.xml</code> which is located in <code>org/apache/cocoon/components/store/impl/ehcache.xml</code>.
+ The default entries of the <code>defaultCache</code> are as follows:
+ </p>
+ <source xml:space="preserve"><![CDATA[<defaultCache
+ maxElementsInMemory="10000"
+ eternal="true"
+ timeToIdleSeconds="0"
+ timeToLiveSeconds="0"
+ overflowToDisk="true"
+ diskPersistent="true"
+ diskExpiryThreadIntervalSeconds="120"
+ />]]></source>
+ <p>
+ So, when <code>overflow-to-disk</code> is set to true, <code>eternal</code> to true and
+ <code>timeToIdleSeconds=0</code>, then once a cachekey is in memory/disk, it will never
+ be removed which might lead to a cache file becoming very large
+ (see also thread: <a href="http://java2.5341.com/msg/170235.html">http://java2.5341.com/msg/170235.html</a>).
+ </p>
+ <p>
+ For production use these setting should be changed. A possible configuration might look like:
+ </p>
+ <source xml:space="preserve"><![CDATA[<defaultCache
+ maxElementsInMemory="10000"
+ eternal="false"
+ timeToIdleSeconds="1800"
+ timeToLiveSeconds="3600"
+ overflowToDisk="true"
+ diskPersistent="true"
+ diskExpiryThreadIntervalSeconds="120"
+ />]]></source>
+ <p>
+ This cache contains a maximum in memory of 10000 elements, and will expire an element
+ if it is idle for more than 30 minutes and lives for more than 60 minutes. If there are
+ more than 10000 elements it will overflow to the disk cache.
+ </p>
+ </section>
+
+ <section>
+ <title>Performance Tuning</title>
+ <p>
+ The following hints can be considered to improve the performance of your application:
+ </p>
+ <ul>
+ <li>Set XSLT caching (use-store) to true in <code>cocoon.xconf</code>.</li>
+ <li>Turn off reloading of sub-sitemaps.</li>
+ <li>
+ Enable client-side caching by changing the <code>pipeline-expiration</code> parameter
+ in <code>global-sitemap.xmap</code>, for instance:
+ <source xml:space="preserve"><![CDATA[<global-variables>
+ <pipeline-expiration>access plus 2 hours</pipeline-expiration>
+</global-variables>]]></source>
+ </li>
+ <li>
+ Configure the expiration time of your resource types. For more information, consult the
+ <a href="lenya-document:2d466e50-8731-11dc-ae46-9e7b5d14892d">resource types reference</a>.
+ </li>
+ <li>Tips about Cocoon performance tuning: <a href="http://wiki.apache.org/cocoon/CocoonPerformance">http://wiki.apache.org/cocoon/CocoonPerformance</a>
+</li>
+ <li>Tips about Tomcat performance tuning: <a href="http://marc.theaimsgroup.com/?t=103598885300001&r=1&w=2">http://marc.theaimsgroup.com/?t=103598885300001&r=1&w=2</a>
+</li>
+ </ul>
+ <p>
+ Doug Chestnut recommends to adapt the garbage collector to make use of all available CPU cores.
+ This can be done by adding the following to your JAVA options (for a machine with 4 cores):
+ </p>
+ <source xml:space="preserve">-XX:+UseParallelGC -XX:ParallelGCThreads=4</source>
+ <p>
+ You can also increase stack and heap size to make better use of available memory
+ (be careful not to starve other processes on the same machine, though):
+ </p>
+ <source xml:space="preserve">-Xms512m -Xmx1024m</source>
+ <p>
+ Lenya does XML prettyprinting by default, which comes with a performance penalty.
+ You might want to disable the transformation for maximum speed:
+ </p>
+ <source xml:space="preserve"><![CDATA[<map:transform src="fallback://lenya/modules/prettyprinting/xslt/xml2nicexml.xsl"/>]]></source>
+ </section>
+
+ <section>
+ <title>General Measures for Production</title>
+ <ul>
+ <li>
+ Double-check your access control settings.
+ </li>
+ <li>
+ Remove the example publications (default and blog). If you use them as templates,
+ don't forget to remove the example users or change their passwords.
+ </li>
+ <li>
+ Set the log level to <em>FATAL</em> or at least <em>ERROR</em>. This makes the code
+ faster and prevents the log files from growing very large while keeping them comprehensible.
+ The log level can be configured in <code>$COCOON_HOME/src/webapp/WEB-INF/log4j.xconf</code> or ultimately
+ in <code>$LENYA_HOME/build/lenya/webapp/WEB-INF/log4j.xconf</code>.
+ </li>
+ <li>
+ Set the <em>debug</em> property in <code>src/targets/properties-build.xml</code> to <em>off</em>.
+ This way, the generated byte code will run faster.
+ </li>
+ <li>
+ Disable all modules which accept request to dynamically generate images
+ to prevent DoS attacks.
+ </li>
+ <li>
+ Consider disabling image upload.
+ </li>
+ <li>
+ Set the session expiration time to the least acceptable value.
+ </li>
+ <li>
+ Prepare for maintenance (updates etc.), either by switching
+ the application or by showing a friendly information page.
+ </li>
+ <li>
+ Prepare for a worst-case scenario. For instance, have a statically
+ exported version of the site ready.
+ </li>
+ </ul>
+ </section>
+
+ <section>
+ <title>Cosmetics</title>
+ <p>
+ In order to hide the default publication from the welcome page
+ (if you're not going to delete it anyway), change <code>src/pubs/default/publication.xml</code> as follows:
+ </p>
+ <source xml:space="preserve"><![CDATA[--- lenya/ (revision 452350)
+ <publication xmlns="http://apache.org/cocoon/lenya/publication/1.1" lenya:show="false">
+]]></source>
+ </section>
+
+ </body>
+</document>
Added: lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221898619.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221898619.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221898619.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221898619.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Production Checklist</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=595691&r1=595690&r2=595691&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/94bd82e0-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 16 07:11:58 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221898619" version="3"/>
+<CheckOut identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221887942"/>
<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910780410" version="2"/>
<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910765855"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781618268" version="1"/>
Added: lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.1195221907394.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.1195221907394.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.1195221907394.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.1195221907394.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<!-- $Id: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Writing Tests</title>
+ </header>
+ <body>
+
+ <section>
+ <title>Introduction</title>
+
+ <p>To get an overview of the benefits and principles of unit testing, we recommend the following resources:</p>
+ <ul>
+ <li>
+<a href="http://www.junit.org">JUnit homepage</a>
+</li>
+ <li>
+<a href="http://junit.sourceforge.net/doc/cookbook/cookbook.htm">JUnit Cookbook</a> (Eric Gamma, Kent Beck)</li>
+ <li>
+<a href="http://junit.sourceforge.net/doc/cookstour/cookstour.htm">JUnit: A Cook's Tour</a> (Eric Gamma, Kent Beck)</li>
+ <li>
+<a href="http://junit.sourceforge.net/doc/testinfected/testing.htm">JUnitTest Infected: Programmers Love Writing Tests</a>
+</li>
+ </ul>
+
+ </section>
+
+ <section>
+ <title>Running the Tests</title>
+ <ul>
+ <li>
+<p>To run all tests:</p>
+ <code>./build.sh test</code>
+ <br/>
+<br/>
+ </li>
+ <li>
+<p>To run all module tests:</p>
+ <code>./build.sh modules.test</code>
+ <br/>
+<br/>
+ </li>
+ <li>
+<p>To run the tests of a single module:</p>
+ <code>./build.sh module.test -Dmodule=org.myproject.lenya.modules.MyModule</code>
+ <br/>
+<br/>
+ </li>
+ <li>
+ <p>To run a test in the Eclipse debugger:</p>
+ <ul>
+ <li>You have to run the tests once on the command line to generate the
+ <code>LenyaTestCase.xtest</code> configuration file.</li>
+ <li>To debug a single test, right-click on the test class in the package explorer and select <em>Debug as -> JUnit test</em>.</li>
+ </ul>
+ <note>Make sure you added all classes and libs from the build dir (
+ <code>build/lenya/webapp/WEB-INF/lib/</code>) to the junit classpath in
+ the eclipse debugger, otherwise you propably get a file not found exception.
+ Further if you are looking into a way to debug htmlunit test then see the article on
+ the <a href="http://www.baccoubonneville.com/blogs/index.php/eclipse/2005/12/04/htmlunit-tests-with-eclipse-and-ant">
+ Eclipse Blog - HtmlUnit tests with Eclipse and Ant</a> </note>
+ </li>
+ </ul>
+ </section>
+
+ <section>
+ <title>Adding Tests to Modules</title>
+ <p>
+ Adding unit tests to a module is very simple - you just have to put
+ a Java file in the <code>{yourmodule}/java/test</code>. The most
+ convenient way to get started is to extend <code>AbstractAccessControlTest</code>.
+ This class provides the infrastructure to create a session and invoke
+ operations on documents.
+ </p>
+ <p>
+ Here's an example:
+ </p>
+
+ <source xml:space="preserve"><![CDATA[mymodule/java/test/MyModuleTest.java]]></source>
+
+ <p>The source code:</p>
+
+ <source xml:space="preserve"><![CDATA[package org.myproject.lenya;
+
+import org.apache.lenya.ac.impl.AbstractAccessControlTest;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentUtil;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationUtil;
+import org.apache.lenya.cms.repository.RepositoryUtil;
+import org.apache.lenya.cms.repository.Session;
+
+public class MetaDataTest extends AbstractAccessControlTest {
+
+ /**
+ * Tests my module.
+ */
+ public void testMyModule() throws Exception {
+ Session session = RepositoryUtil.getSession(getManager(), getRequest());
+ DocumentFactory factory = DocumentUtil.createDocumentIdentityMap(getManager(), session);
+
+ Publication publication = PublicationUtil.getPublication(getManager(), "test");
+ Document doc = factory.get(publication, Publication.AUTHORING_AREA, "/index", "en");
+
+ assertNotNull(doc);
+ ...
+ }
+}]]></source>
+
+ </section>
+
+ <section>
+ <title>Testing Usecases</title>
+ <p>To implement a unit test for a usecase, you can extend the class
+ <code>AbstractUsecaseTest</code> and override the following methods:
+ </p>
+ <ul>
+ <li>
+<code>String getUsecaseName()</code> - return the name of the usecase to test</li>
+ <li>
+<code>void prepareUsecase()</code> - setup the initial envorionment</li>
+ <li>
+<code>Map getParameters()</code> - return a map containing the usecase parameters</li>
+ <li>
+<code>void checkPostconditions()</code> - check the post conditions after the usecase was executed</li>
+ </ul>
+ <p>
+ Here's an example:
+ </p>
+ <source xml:space="preserve"><![CDATA[package org.apache.lenya.cms.ac.usecases;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cocoon.environment.Session;
+import org.apache.lenya.ac.AccessControlException;
+import org.apache.lenya.ac.Identity;
+import org.apache.lenya.ac.User;
+import org.apache.lenya.cms.usecase.AbstractUsecaseTest;
+
+/**
+ * Login test.
+ */
+public class LoginTest extends AbstractUsecaseTest {
+
+ protected static final String USER_ID = "lenya";
+ protected static final String PASSWORD = "levi";
+
+ protected Map getRequestParameters() {
+ return getParameters();
+ }
+
+ protected Map getParameters() {
+ Map params = new HashMap();
+ params.put(Login.USERNAME, USER_ID);
+ params.put(Login.PASSWORD, PASSWORD);
+ return params;
+ }
+
+ protected String getUsecaseName() {
+ return "ac.login";
+ }
+
+ protected void checkPostconditions() {
+ Session session = getRequest().getSession();
+ Identity identity = (Identity) session.getAttribute(Identity.class.getName());
+ User user = identity.getUser();
+ assertNotNull(user);
+ assertEquals(user.getId(), USER_ID);
+ }
+
+ protected void login() throws AccessControlException {
+ getAccessController().setupIdentity(getRequest());
+ }
+
+}]]></source>
+ </section>
+
+ <section>
+ <title>Canoo WebTests</title>
+
+ <p>
+ <a href="http://webtest.canoo.com/webtest/manual/WebTestHome.html">Canoo WebTest</a>
+ is an open source tool for automated testing of web applications.
+ You can add web test files to modules. To run the web tests, follow these steps:
+ </p>
+
+ <ol>
+ <li>Download the Canoo WebTest binary distribution from their
+ <a href="http://webtest.canoo.com/webtest/manual/Downloads.html">download page</a>.</li>
+ <li>Configure your Canoo WebTest home directory in <code>local.build.properties</code>:
+<source xml:space="preserve"><![CDATA[
+#------------------------------------------------------------------------------------
+# Home directory of Canoo WebTest installation
+
+webtest.home=/usr/local/canoo-webtest
+]]></source>
+ </li>
+ <li>Run the tests:
+ <source xml:space="preserve"><![CDATA[> ./build.sh modules.test.canoo]]></source>
+ </li>
+ </ol>
+
+ </section>
+
+ </body>
+</document>
Added: lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221907394.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221907394.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221907394.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221907394.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Writing Tests</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=595691&r1=595690&r2=595691&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/95fa2190-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 16 07:11:58 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221907394" version="3"/>
+<CheckOut identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221886945"/>
<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910794331" version="2"/>
<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910766538"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781617202" version="1"/>
Added: lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.1195221898250.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.1195221898250.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.1195221898250.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.1195221898250.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2002-2004 The Apache Software Foundation
+
+ Licensed 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.
+--><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>A Publication in Lenya</title>
+ </header>
+ <body>
+
+ <section>
+ <title>What is a publication?</title>
+
+ <p>Though it's not entirely accurate, you can think of a Lenya publication as a website that
+ you are building, editing and maybe also serving through Lenya.</p>
+ <p>A publication typically consists of at least:</p>
+ <ul>
+ <li>Some original content (usually XML files and other resources such as images). The XML files
+ may be XHTML files, but they might be any other XML format as well.</li>
+ <li>One more more XSLT files.</li>
+ <li>A Cocoon sitemap that glues the pieces together and controls how the site will be rendered in Live mode</li>
+ </ul>
+ </section>
+
+ </body>
+</document>
Added: lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221898250.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221898250.bak?rev=595691&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221898250.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.meta.1195221898250.bak Fri Nov 16 07:11:58 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Publication</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=595691&r1=595690&r2=595691&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/97525e90-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 16 07:11:58 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221898250" version="3"/>
+<CheckOut identity="lenya" session="fde084c0-944b-11dc-8f2e-e6c0ff9903ab" time="1195221887244"/>
<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910797633" version="2"/>
<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910769014"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781626811" version="1"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org