Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 97153 invoked from network); 15 Oct 2004 07:33:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 15 Oct 2004 07:33:55 -0000 Received: (qmail 90306 invoked by uid 500); 15 Oct 2004 07:33:54 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 90231 invoked by uid 500); 15 Oct 2004 07:33:52 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 90207 invoked by uid 99); 15 Oct 2004 07:33:52 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 15 Oct 2004 00:33:50 -0700 Received: (qmail 97086 invoked by uid 65534); 15 Oct 2004 07:33:49 -0000 Date: 15 Oct 2004 07:33:49 -0000 Message-ID: <20041015073349.97074.qmail@minotaur.apache.org> From: cziegeler@apache.org To: cvs@cocoon.apache.org Subject: svn commit: rev 54830 - in cocoon/branches/BRANCH_2_1_X: lib src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes src/blocks/tour/samples/bean-editor/docs src/blocks/tour/samples/flow src/blocks/tour/samples/flow/docs src/blocks/tour/samples/flow/java-shapes src/blocks/tour/samples/flow/number-guess src/blocks/tour/samples/intro/docs src/blocks/tour/samples/intro/presentation src/blocks/webdav/java/org/apache/cocoon/components/source/impl src/blocks/webdav/lib src/blocks/webdav/test/org/apache/cocoon/components/source/impl X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: cziegeler Date: Fri Oct 15 00:33:47 2004 New Revision: 54830 Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Circle.java cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Rectangular.java cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Shape.java cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Square.java cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/java-shapes.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/circle.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/java-shapes.js cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/rectangular.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/results.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/select.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/square.xml cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/lib/jakarta-slide-webdavlib-2.0.jar (contents, props changed) Removed: cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/lib/jakarta-slide-webdavlib-2.0rc1.jar Modified: cocoon/branches/BRANCH_2_1_X/lib/jars.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/forms.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/index.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/javabeans.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/tasklist.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/index.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/multi-page.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/number-guess.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/number-guess/guess.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/sitemap.xmap cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/bizlayer.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/facts.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/toc.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/use-cases.xml cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/presentation/tour.css cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/test/org/apache/cocoon/components/source/impl/WebDAVSourceTestCase.java Log: Sync tour and webdav block with 2.2 Modified: cocoon/branches/BRANCH_2_1_X/lib/jars.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/lib/jars.xml (original) +++ cocoon/branches/BRANCH_2_1_X/lib/jars.xml Fri Oct 15 00:33:47 2004 @@ -804,7 +804,7 @@ Slide WebDAV Client library The Jakarta Slide WebDAV client library. WebDAV block - webdav/lib/jakarta-slide-webdavlib-2.0rc1.jar + webdav/lib/jakarta-slide-webdavlib-2.0.jar http://jakarta.apache.org/slide/ Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Circle.java ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Circle.java Fri Oct 15 00:33:47 2004 @@ -0,0 +1,42 @@ +/* + * 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. + */ + +package org.apache.cocoon.samples.tour.shapes; + +/** + * Circle Shape for tour block java-shapes sample + */ +public class Circle implements Shape{ + double _r; + + public String getName() { + return "Circle"; + } + + /** Creates a new instance of Circle */ + public Circle(double r) { + _r = r; + } + + public double area() { + return 3.14 * _r * _r; + } + + public double perimeter() { + return 2 * 3.14 * _r; + } + +} Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Rectangular.java ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Rectangular.java Fri Oct 15 00:33:47 2004 @@ -0,0 +1,43 @@ +/* + * 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. + */ + +package org.apache.cocoon.samples.tour.shapes; + +/** + * Rectangular Shape for tour block java-shapes sample + */ +public class Rectangular implements Shape{ + double _h; + double _b; + /** Creates a new instance of StrCount */ + public Rectangular(double h, double b) { + _h = h; + _b = b; + } + + public String getName() { + return "Rectangular"; + } + + public double area(){ + return _h * _b; + } + + public double perimeter(){ + return (_h + _b) * 2; + } + +} Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Shape.java ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Shape.java Fri Oct 15 00:33:47 2004 @@ -0,0 +1,26 @@ +/* + * 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. + */ + +package org.apache.cocoon.samples.tour.shapes; + +/** + * Shape interface for tour block java-shapes sample + */ +public interface Shape { + String getName(); + abstract double area(); + abstract double perimeter(); +} Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Square.java ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/java/org/apache/cocoon/samples/tour/shapes/Square.java Fri Oct 15 00:33:47 2004 @@ -0,0 +1,41 @@ +/* + * 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. + */ + +package org.apache.cocoon.samples.tour.shapes; + +/** + * Square Shape for tour block java-shapes sample + */ +public class Square implements Shape { + float _b; + /** Creates a new instance of Square */ + public Square(float b) { + _b = b; + } + + public String getName() { + return "Square"; + } + + public double area() { + return _b*_b; + } + + public double perimeter() { + return 4*_b; + } + +} Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/forms.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/forms.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/forms.xml Fri Oct 15 00:33:47 2004 @@ -124,7 +124,7 @@

This model is independent from the way the form is going to look in HTML (or WML, or XUL, or whatever), and - also independent of the internal structure of our java beans. + also independent of the internal structure of our Java beans.

Here we use constants for the widget labels (field names), @@ -137,7 +137,7 @@

Here's the binding definition, which allows the Forms subsystem to automatically move data from our Form's internal model - to our java beans. + to our Java beans.

This looks simple enough: for example, we tell the Forms @@ -180,7 +180,7 @@

Another important feature of the Cocoon Forms subsystem is its extensibility: - a clean design makes it fairly easy to add custom java classes for custom formatting, + a clean design makes it fairly easy to add custom Java classes for custom formatting, validation and bindings.

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/index.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/index.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/index.xml Fri Oct 15 00:33:47 2004 @@ -34,7 +34,7 @@

Our Java beans are trivial and uninteresting: what we're looking for is an understanding of - how Cocoon Pipelines, Forms and Flow play together with java code, and for this a very simple + how Cocoon Pipelines, Forms and Flow play together with Java code, and for this a very simple application is certainly good.

@@ -60,7 +60,7 @@

Running the application

- To run the bean editor application, Cocoon must be able to load the required java classes. + To run the bean editor application, Cocoon must be able to load the required Java classes.

If you're running this tutorial from the standard Cocoon distribution this should be Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/javabeans.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/javabeans.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/javabeans.xml Fri Oct 15 00:33:47 2004 @@ -26,7 +26,7 @@

Interfaces

Here's the interface of the DatabaseFacade class, which is used by our - Flowscript code to "talk" to the java beans: + Flowscript code to "talk" to the Java beans:

 /** access the Database */
 public static DatabaseFacade getInstance();
@@ -72,7 +72,7 @@
 
         

Access from Flowscript

- Here's a code excerpt showing how Flowscript code can access java classes. + Here's a code excerpt showing how Flowscript code can access Java classes.

 var db = Packages.org.apache.cocoon.samples.tour.beans.DatabaseFacade.getInstance();
@@ -80,7 +80,7 @@
 list = db.getTasks();
         

- Simple enough. The "official" way of accessing java components in a Cocoon + Simple enough. The "official" way of accessing Java components in a Cocoon application would be to use the Avalon lookup mechanisms, but this wouldn't add much to our example so we took the easy way here.

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/tasklist.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/tasklist.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/bean-editor/docs/tasklist.xml Fri Oct 15 00:33:47 2004 @@ -78,7 +78,7 @@

We're not using continuations here (there's no sendPageAndWait), Flowscript serves only as a thin layer of glue - between our java objects and our JXTemplate view page. + between our Java objects and our JXTemplate view page.

JXTemplate page

@@ -98,12 +98,12 @@
  1. A request for view/allTasks comes in
  2. - The query_allTasks() Flowscript function is called and uses the java DatabaseFacade - to retrieve a java List of TaskBean objects. + The query_allTasks() Flowscript function is called and uses the Java DatabaseFacade + to retrieve a Java List of TaskBean objects.
  3. Flowscript uses the cocoon.sendPage() function to trigger the execution of a sitemap - pipeline, passing to it some data as javascript variables. + pipeline, passing to it some data as JavaScript variables.
  4. The pipeline uses the JXTemplate generator to dynamically insert data in an XML template Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/index.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/index.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/index.xml Fri Oct 15 00:33:47 2004 @@ -25,7 +25,7 @@

    A continuation saves the state of execution of the currently - running flowscript, and allows this state to be "resurrected" later on, + running Flowscript, and allows this state to be "resurrected" later on, typically when the user submits an HTML form that was sent with the cocoon.sendPageAndWait instruction.

    @@ -36,10 +36,10 @@ show how little code is used to manage typical interactions.

    - Having to use javascript to write the Flow scripts might seem strange + Having to use JavaScript to write the Flow scripts might seem strange at first, but in practice only a few lines of Flow code will be required for a typical application, so this doesn't matter much. The reason is that - javascript (through a modified version of the mozilla Rhino interpreter) + JavaScript (through a modified version of the mozilla Rhino interpreter) is currently the only continuations-enabled language that can be distributed with Cocoon.

    Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/java-shapes.xml ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/java-shapes.xml Fri Oct 15 00:33:47 2004 @@ -0,0 +1,74 @@ + + + + + + +

    + In this example, java classes are used to calculate the area and perimeter of shapes. + Various Java classes are instantiated and used from Flow. +

    +

    + Start the example here. +

    +

    The sitemap

    +

    + There's nothing new in the sitemap, our use of + variables allows the exact same sitemap to be reused for + both our Flow examples. +

    +

    + The only specific thing is the importing of the java-shapes.js + flowscript, but this was already present for the previous + example: + +

    + +

    Java code

    +

    + The java code (interface Shape, classes Rectangular, Square, Circle) is fairly trivial, + and the computations could easily be done in javascript for such a simple case. +

    +

    + However, our goal is to show interactions between Flow and java classes, so you shouldn't pay + too much attention to the java code, except to note that it has no knowledge of Avalon - our java + objects are just POJOs: Plain Old Java Objects. +

    + +

    Flowscript code

    +

    + Here's the Flowscript which has three steps. +

      +
    1. Get the selected shape from user and prepare the next page.
    2. +
    3. Get shape's informations (width, height or radius) and instantiate the correct java class for the selected shape.
    4. +
    5. Use java class to calculate area and perimeter and display the results
    6. +
    + +

    + +

    JXTemplate view

    +

    + Shape selection +

    + +

    + Here the user can select a shape. +

    +
    +
    Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/multi-page.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/multi-page.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/multi-page.xml Fri Oct 15 00:33:47 2004 @@ -35,7 +35,7 @@ working on a tiny mobile device for a minute.

    - We won't use Cocoon Forms here, but simply bind a javascript object + We won't use Cocoon Forms here, but simply bind a JavaScript object to our form manually.

    @@ -51,7 +51,7 @@

    The only specific thing is the importing of the multi-page.js - flowscript, but this was already present for the previous + Flowscript, but this was already present for the previous example:

    Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/number-guess.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/number-guess.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/docs/number-guess.xml Fri Oct 15 00:33:47 2004 @@ -35,7 +35,7 @@

    At the sitemap level, Flowscript applications need four things:

      -
    • The flowscript code must be made available to the sitemap
    • +
    • The Flowscript code must be made available to the sitemap
    • A map:call function instruction must start the Flowscript function when the "application start" @@ -46,14 +46,14 @@ continuations when their IDs are received in requests
    • - A "view" pipeline must use the (flowscript-aware) JXTemplate generator + A "view" pipeline must use the (Flowscript-aware) JXTemplate generator to insert data provided by Flowscript into pages.
    The corresponding excerpts of our sitemap are shown below.

    Flowscript declaration

    -

    Note that this already contains the declaration of the next example's flowscript.

    +

    Note that this already contains the declaration of the next example's Flowscript.

    map:call function

    @@ -77,7 +77,7 @@

    View pipeline using JXTemplageGenerator

    To be able to include data provided by Flowscript in our forms and views, we - use the flowscript-aware JXTemplateGenerator + use the Flowscript-aware JXTemplateGenerator

    Here's the pipeline

    @@ -104,14 +104,14 @@

    Here's the page definition for our number-guessing form. - JXTemplate codes like ${continuation.id}, will by replaced - by values provided in the FlowScript sendPageAndWait function call. + JXTemplate codes like ${cocoon.continuation.id}, will by replaced + by values provided in the Flowscript sendPageAndWait function call.

    That's it!

    - We have now seen the complete code of our flowscript application: + We have now seen the complete code of our Flowscript application:

    • A few sitemap declarations, which will be very similar for other Flowscript-based applications
    • A JXTemplate-based view, a "normal" page with some substitution codes
    • Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/circle.xml ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/circle.xml Fri Oct 15 00:33:47 2004 @@ -0,0 +1,37 @@ + + + + + Flow example: Circle shape (id=${shapeId}) + +

      Please enter circle radius

      +
      + r: +
      +
      + +
      + +
      +
      Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/java-shapes.js ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/java-shapes.js Fri Oct 15 00:33:47 2004 @@ -0,0 +1,53 @@ +/* + * 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. + */ + +// Shape's area and perimeter calculation example. + +var calculator = Packages.org.apache.cocoon.samples.supersonic.shapes.Shape; + +function public_startShape() { + var hint = "Calculate shape's area and perimeter using logic in java. "; + + // let user select shape + cocoon.sendPageAndWait("java-shapes/views/select", {"hint" : hint}); + var shapeId = cocoon.request.get("shape"); + + // send shape-specific view + cocoon.sendPageAndWait("java-shapes/views/" + shapeId, {"shapeId" : shapeId}); + + // instantiate appropriate calculator + switch (shapeId){ + case "square": + var b = parseInt( cocoon.request.get("b") ); + calculator = new Packages.org.apache.cocoon.samples.tour.shapes.Square(b); + break; + case "rectangular": + var h = parseInt( cocoon.request.get("h") ); + var b = parseInt( cocoon.request.get("b") ); + calculator = new Packages.org.apache.cocoon.samples.tour.shapes.Rectangular(b,h); + break; + case "circle": + var r = parseInt( cocoon.request.get("r") ); + calculator = new Packages.org.apache.cocoon.samples.tour.shapes.Circle(r); + break; + } + + // compute results + var a = calculator.area(); + var p = calculator.perimeter(); + + cocoon.sendPage("java-shapes/views/results", {"area" : a, "perimeter" : p, "shape" : shapeId} ); +} \ No newline at end of file Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/rectangular.xml ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/rectangular.xml Fri Oct 15 00:33:47 2004 @@ -0,0 +1,39 @@ + + + + + Flow example: Rectangular shape (id=${shapeId}) + +

      Please enter rectangle dimensions

      +
      + width: +
      + height: +
      +
      + +
      + +
      +
      Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/results.xml ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/results.xml Fri Oct 15 00:33:47 2004 @@ -0,0 +1,39 @@ + + + + + Flow example: Shapes + +

      Results!

      +

      + Area and perimeter of selected shape: ${shape}

      +

      + area: ${area}
      + perimeter: ${perimeter}
      +

      + +
      +
      Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/select.xml ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/select.xml Fri Oct 15 00:33:47 2004 @@ -0,0 +1,42 @@ + + + + + Flow example: Shapes + +

      ${hint}

      +
      +

      Select shape

      + + +
      + +
      +
      Added: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/square.xml ============================================================================== --- (empty file) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/java-shapes/square.xml Fri Oct 15 00:33:47 2004 @@ -0,0 +1,37 @@ + + + + + Flow example: Square shape (id=${shapeId}) + +

      Please enter the side-length of the square

      +
      + side-length: +
      +
      + +
      + +
      +
      Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/number-guess/guess.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/number-guess/guess.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/number-guess/guess.xml Fri Oct 15 00:33:47 2004 @@ -29,7 +29,7 @@

      ${hint}

      -
      +
      Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/sitemap.xmap ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/sitemap.xmap (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/flow/sitemap.xmap Fri Oct 15 00:33:47 2004 @@ -31,6 +31,7 @@ + Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/bizlayer.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/bizlayer.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/bizlayer.xml Fri Oct 15 00:33:47 2004 @@ -20,7 +20,7 @@

      A question which often comes when starting with Cocoon - is how to implement my business layer. + is, "How do I implement my business layer?"

      The short answer: it is up to you ;-) @@ -31,6 +31,12 @@ business processes or apply business rules.

      + Similarly, people often ask about "best practices" with Cocoon -- + that is, "What's the best way to implement X or Y?" While we + generally don't have a set list of best practices, we can provide + some simple guidance to help you along your way. +

      +

      Here's a brief discussion of possible options. Some are real today and some are still - as we like to say here - in the pipeline. @@ -46,9 +52,9 @@ and its design and future evolution will stay targeted to small glue modules.

      -

      Independent java code

      +

      Independent Java code

      - As we'll see in our example, it is very easy to access java + As we'll see in our example, it is very easy to access Java objects from Flowscript code. Such objects do not necessarily need to know about Cocoon or Avalon classes, which means that legacy code could be easily integrated, @@ -64,7 +70,7 @@ and Cocoon.

      -

      Avalon-based java code

      +

      Avalon-based Java code

      The next step would be to write first-class Cocoon components based on the Avalon framework, allowing your components to use all of the Avalon Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/facts.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/facts.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/facts.xml Fri Oct 15 00:33:47 2004 @@ -20,7 +20,7 @@

      Architecture

      - Cocoon is written in java and based on the + Cocoon is written in Java and based on the Apache Avalon components framework.

      Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/toc.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/toc.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/toc.xml Fri Oct 15 00:33:47 2004 @@ -25,7 +25,7 @@ - + @@ -48,6 +48,7 @@ + @@ -59,4 +60,4 @@ - \ No newline at end of file + Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/use-cases.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/use-cases.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/docs/use-cases.xml Fri Oct 15 00:33:47 2004 @@ -37,7 +37,7 @@

    • Build a multi-language website using XML dictionaries to translate menus and messages
    • Build web portals using the latest JSR-168 standard
    • Write web applications with little code and no state management code using the Flow subsystem
    • -
    • Allow java objects to be edited from a WAP device
    • +
    • Allow Java objects to be edited from a WAP device
    The combination of components available in Cocoon applies to widely varied types of applications. This explains why more and more companies are making Cocoon Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/presentation/tour.css ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/presentation/tour.css (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/tour/samples/intro/presentation/tour.css Fri Oct 15 00:33:47 2004 @@ -17,13 +17,18 @@ /** simple CSS stylesheet for supersonic tour example app */ body { - font-family: Georgia, Verdana, Arial, SansSerif; + font-family: Georgia, Verdana, Arial, sans-serif; } .note { font-size: 80%; } +a:hover { + background-color: #ffff99; + text-decoration: none; +} + td.navigation { font-size: 80%; } @@ -32,6 +37,7 @@ background: #FFCC00; font-size: 80%; padding: 0.5em; + font-family: verdana, helvetica, arial, sans-serif; } #navigation a { Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSource.java Fri Oct 15 00:33:47 2004 @@ -85,7 +85,7 @@ * *

    * - * @version $Id: WebDAVSource.java,v 1.28 2004/04/13 17:13:29 stephan Exp $ + * @version $Id$ */ public class WebDAVSource extends AbstractLogEnabled implements Source, TraversableSource, ModifiableSource, ModifiableTraversableSource, InspectableSource, MoveableSource { @@ -602,8 +602,13 @@ * @see org.apache.excalibur.source.TraversableSource#getParent() */ public Source getParent() throws SourceException { - String path = isCollection()?"..":"."; - + String path; + if (this.url.getEscapedPath().endsWith("/")) { + path = ".."; + } + else { + path = "."; + } try { HttpURL parentURL; if (url instanceof HttpsURL) { @@ -749,8 +754,19 @@ try { if (!this.resource.mkcolMethod()) { int status = this.resource.getStatusCode(); + if (status == 409) { + // parent does not exist, create it and try again + ((ModifiableTraversableSource) getParent()).makeCollection(); + makeCollection(); + } + else if (status == 404) { + // apparently mod_dav_svn wrongly returns 404 + // on MKCOL when parent does not exist + ((ModifiableTraversableSource) getParent()).makeCollection(); + makeCollection(); + } // Ignore status 405 - Not allowed: collection already exists - if (status != 405) { + else if (status != 405) { final String msg = "Unable to create collection " + getSecureURI() + ". Server responded " + this.resource.getStatusCode() @@ -938,7 +954,9 @@ */ public void moveTo(Source source) throws SourceException { if (source instanceof WebDAVSource) { + initResource(WebdavResource.NOACTION, DepthSupport.DEPTH_0); WebDAVSource destination = (WebDAVSource)source; + destination.initResource(WebdavResource.BASIC, DepthSupport.DEPTH_0); try { this.resource.moveMethod(destination.resource.getHttpURL().getPath()); } catch (HttpException e) { @@ -960,7 +978,9 @@ */ public void copyTo(Source source) throws SourceException { if (source instanceof WebDAVSource) { + initResource(WebdavResource.BASIC, DepthSupport.DEPTH_0); WebDAVSource destination = (WebDAVSource)source; + destination.initResource(WebdavResource.NOACTION, DepthSupport.DEPTH_0); try { this.resource.copyMethod(destination.resource.getHttpURL().getPath()); } catch (HttpException e) { Added: cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/lib/jakarta-slide-webdavlib-2.0.jar ============================================================================== Binary file. No diff available. Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/test/org/apache/cocoon/components/source/impl/WebDAVSourceTestCase.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/test/org/apache/cocoon/components/source/impl/WebDAVSourceTestCase.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/test/org/apache/cocoon/components/source/impl/WebDAVSourceTestCase.java Fri Oct 15 00:33:47 2004 @@ -21,13 +21,14 @@ import org.apache.avalon.excalibur.testcase.ExcaliburTestCase; import org.apache.cocoon.components.source.impl.WebDAVSource; +import org.apache.commons.httpclient.HttpURL; import org.apache.excalibur.source.ModifiableTraversableSource; import org.apache.excalibur.source.SourceResolver; import org.apache.excalibur.source.TraversableSource; import org.apache.webdav.lib.WebdavResource; /** - * @version $Id: WebDAVSourceTestCase.java,v 1.3 2004/03/27 17:40:11 unico Exp $ + * @version $Id$ */ public class WebDAVSourceTestCase extends ExcaliburTestCase { @@ -36,10 +37,9 @@ private String m_authority = "localhost:8888"; private String m_path = "/webdav/"; private String m_name = "files"; - private String m_qs = "?foo=bar"; - private String m_location = m_scheme + "://" + m_credentials + "@" + m_authority + m_path + m_name + m_qs; - private String m_secure = m_scheme + "://" + m_authority + m_path + m_name + m_qs; - private String m_options = "&cocoon:webdav-action=" + WebdavResource.NOACTION + "&cocoon:webdav-depth=0"; + private String m_location = m_scheme + "://" + m_credentials + "@" + m_authority + m_path + m_name; + private String m_secure = m_scheme + "://" + m_authority + m_path + m_name; + private String m_options = "?cocoon:webdav-action=" + WebdavResource.NOACTION + "&cocoon:webdav-depth=0"; public WebDAVSourceTestCase(String name) { @@ -73,26 +73,22 @@ // assertTrue(parent.isCollection()); // resolver.release(child); // } +// +// TraversableSource child = (TraversableSource) source.getChild("childcollection"); +// assertEquals(child.getURI(), m_location + "/childcollection"); +// +// TraversableSource parent = (TraversableSource) child.getParent(); +// assertEquals(m_name, parent.getName()); +// // resolver.release(source); } public void testModification() throws Exception { // SourceResolver resolver = (SourceResolver) lookup(SourceResolver.ROLE); // String uri = m_location + m_options; -// ModifiableTraversableSource source = (ModifiableTraversableSource) resolver.resolveURI(uri); -// ModifiableTraversableSource child = (ModifiableTraversableSource) source.getChild("newcol"); -// -// assertTrue(!child.exists()); -// child.makeCollection(); -// assertTrue(child.exists()); -// child.delete(); -// assertTrue(!child.exists()); -// -// resolver.release(child); -// resolver.release(source); // -// source = (ModifiableTraversableSource) resolver.resolveURI(uri); -// child = (ModifiableTraversableSource) source.getChild("newdoc.txt"); +// ModifiableTraversableSource source = (ModifiableTraversableSource) resolver.resolveURI(uri); +// ModifiableTraversableSource child = (ModifiableTraversableSource) source.getChild("newdoc.txt"); // assertTrue(!child.exists()); // // // create document @@ -116,5 +112,25 @@ // // resolver.release(source); // resolver.release(child); + } + + public void testMakeCollection() throws Exception { +// SourceResolver resolver = (SourceResolver) lookup(SourceResolver.ROLE); +// String uri = m_location + m_options; +// ModifiableTraversableSource source = (ModifiableTraversableSource) resolver.resolveURI(uri); +// ModifiableTraversableSource child = (ModifiableTraversableSource) source.getChild("child"); +// ModifiableTraversableSource descendant = (ModifiableTraversableSource) source.getChild("child/decendant"); +// +// assertTrue(!child.exists()); +// descendant.makeCollection(); +// assertTrue(child.exists()); +// assertTrue(descendant.exists()); +// child.delete(); +// assertTrue(!child.exists()); +// descendant.refresh(); +// assertTrue(!descendant.exists()); +// +// resolver.release(child); +// resolver.release(source); } }