incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r887969 [1/2] - in /sling/trunk/contrib: ./ scripting/scala/samples/ scripting/scala/samples/forum/ scripting/scala/samples/forum/src/ scripting/scala/samples/forum/src/main/ scripting/scala/samples/forum/src/main/resources/ scripting/scala...
Date Mon, 07 Dec 2009 16:13:47 GMT
Author: cziegeler
Date: Mon Dec  7 16:13:42 2009
New Revision: 887969

URL: http://svn.apache.org/viewvc?rev=887969&view=rev
Log:
SLING-1215 : Scala scripting: add sample applications. Apply patch from Michael Dürig.

Added:
    sling/trunk/contrib/scripting/scala/samples/
    sling/trunk/contrib/scripting/scala/samples/forum/
    sling/trunk/contrib/scripting/scala/samples/forum/LICENSE   (with props)
    sling/trunk/contrib/scripting/scala/samples/forum/README.txt   (with props)
    sling/trunk/contrib/scripting/scala/samples/forum/pom.xml   (with props)
    sling/trunk/contrib/scripting/scala/samples/forum/src/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/POST.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/html.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/search.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/static/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/static/blue.css   (with props)
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/thread.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum.json   (with props)
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala.json   (with props)
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala4sling.json   (with props)
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/sling.json   (with props)
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/MockBindings.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/POSTVars.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/Test.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/htmlVars.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/searchVars.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/threadVars.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockHttpServletRequest.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockItem.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockNode.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockServletRequest.scala
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockSlingHttpServletRequest.scala
    sling/trunk/contrib/scripting/scala/samples/hello-world/
    sling/trunk/contrib/scripting/scala/samples/hello-world/LICENSE   (with props)
    sling/trunk/contrib/scripting/scala/samples/hello-world/README.txt   (with props)
    sling/trunk/contrib/scripting/scala/samples/hello-world/pom.xml   (with props)
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/resources/
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/resources/content/
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/resources/content/apps/
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/resources/content/apps/helloworld/
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/resources/content/apps/helloworld/html.scala
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/resources/content/content/
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/resources/content/content/helloworld.json   (with props)
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/scala/
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/scala/helloworld/
    sling/trunk/contrib/scripting/scala/samples/hello-world/src/main/scala/helloworld/htmlVars.scala
Modified:
    sling/trunk/contrib/pom.xml

Modified: sling/trunk/contrib/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/pom.xml?rev=887969&r1=887968&r2=887969&view=diff
==============================================================================
--- sling/trunk/contrib/pom.xml (original)
+++ sling/trunk/contrib/pom.xml Mon Dec  7 16:13:42 2009
@@ -102,6 +102,8 @@
           <module>scripting/ruby</module>
           <module>scripting/scala/engine</module>
           <module>scripting/scala/interpreter</module>
+          <module>scripting/scala/samples/hello-world</module>
+          <module>scripting/scala/samples/forum</module>
           <module>scripting/velocity</module>
           <module>scripting/xproc</module>
           <module>launchpad/jcrapp</module>
@@ -117,7 +119,7 @@
                 <activeByDefault>true</activeByDefault>
             </activation>
             <modules>
-                <module>launchpad/testing</module>
+                <module>launchpad/testing</module> 
             </modules>
         </profile>
     </profiles>

Added: sling/trunk/contrib/scripting/scala/samples/forum/LICENSE
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/LICENSE?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/LICENSE (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/LICENSE Mon Dec  7 16:13:42 2009
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/LICENSE
------------------------------------------------------------------------------
    svn:eol-style = native

Added: sling/trunk/contrib/scripting/scala/samples/forum/README.txt
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/README.txt?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/README.txt (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/README.txt Mon Dec  7 16:13:42 2009
@@ -0,0 +1,44 @@
+Scala for Sling Demo Application - Forum
+
+
+Getting Started
+===============
+
+This component uses a Maven 2 (http://maven.apache.org/) build
+environment. It requires a Java 5 JDK (or higher) and Maven 
+(http://maven.apache.org/) 2.2.1 or later. We recommend to use 
+the latest Maven version.
+
+If you have Maven 2 installed, you can compile and
+package the jar using the following command:
+
+    mvn package
+    
+To Install the package in a running Sling instance use:
+
+    mvn sling:install
+
+See the Maven 2 documentation for other build features.
+
+Before running the example make sure to install the path-based-rtp 
+bundle from the samples directory of the Sling distribution. 
+
+After installing the package and the path-based-rtp the forum application
+is available at the following URL:
+
+    http://localhost:8080/content/forum.html?sling:authRequestLogin=true
+    
+For more information on Scala for Sling see:
+
+    http://people.apache.org/~mduerig/scala4sling/    
+    
+
+The latest source code for this component is available in the
+Subversion (http://subversion.tigris.org/) source repository of
+the Apache Software Foundation. If you have Subversion installed,
+you can checkout the latest source using the following command:
+
+    svn checkout http://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/scala/
+
+See the Subversion documentation for other source control features.
+

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/README.txt
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/README.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/contrib/scripting/scala/samples/forum/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/pom.xml?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/pom.xml (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/pom.xml Mon Dec  7 16:13:42 2009
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>8</version>
+    </parent>
+
+    <artifactId>org.apache.sling.scripting.scala.forum</artifactId>
+    <version>0.9.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+  
+    <name>Scala for Sling Demo Application - Forum</name>
+  
+    <build>
+        <sourceDirectory>src/main/scala</sourceDirectory>
+  
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package />
+                        <Sling-Initial-Content>
+                            content/content;path:=/content,
+                            content/apps/forum;path:=/apps/forum;overwrite:=true
+                        </Sling-Initial-Content>
+                    </instructions>
+                </configuration>
+            </plugin>
+      
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>maven-sling-plugin</artifactId>
+            </plugin>
+      
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-eclipse-plugin</artifactId>
+                <configuration>
+                    <downloadSources>true</downloadSources>
+                    <downloadJavadocs>true</downloadJavadocs>
+                    <buildcommands>
+                        <buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand>
+                    </buildcommands>
+                    <projectnatures>
+                        <java.lang.String>ch.epfl.lamp.sdt.core.scalanature</java.lang.String>
+                        <java.lang.String>org.eclipse.jdt.core.javanature</java.lang.String>
+                    </projectnatures>
+                    <classpathContainers>
+                        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
+                        <classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</classpathContainer>
+                    </classpathContainers>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+  
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.0.8</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+        </dependency>
+  </dependencies>
+  
+</project>
\ No newline at end of file

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/POST.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/POST.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/POST.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/POST.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package forum { 
+
+class POST(vars: POSTVars) {
+  import java.util.Date
+  import java.io.ByteArrayInputStream
+  import java.util.Calendar
+  import javax.jcr.Session
+  import javax.jcr.Node
+  import org.apache.sling.api.resource.ResourceUtil
+  import utils.RichJCR._
+  import vars._
+  
+  /**
+   * Add a child node inclusive all intermediate nodes to a node
+   * @param parent  Parent node where the child node will be added 
+   * @param path  Path to the child node as list of strings. 
+   */
+  def addNodes(parent: Node, path: List[String]): Node = path match {
+    case name::names => 
+      if (parent.hasNode(name)) addNodes(parent.getNode(name), names)
+      else {
+        if (parent.isNodeType("mix:versionable")) {
+          parent.checkout()
+          val n = addNodes(parent.addNode(name), names) 
+          n.addMixin("mix:referenceable")
+          n.addMixin("mix:versionable")
+          parent.save()
+          parent.checkin()
+          n
+        }
+        else {
+          val n = addNodes(parent.addNode(name), names) 
+          n.addMixin("mix:referenceable")
+          n.addMixin("mix:versionable")
+          parent.save()
+          n
+        }
+      }
+    case Nil => parent
+  }
+  
+  val session = request.getResourceResolver.adaptTo(classOf[Session])
+  val path = resource.getPath
+  
+  val newPath = {
+    def validJcrChar(c: Char)  = 
+      if ("abcdefghijklmnopqrstuvwxyz0123456789_ ".contains(c)) c
+      else '_' 
+    
+    val nodeName = request("subject").toLowerCase map validJcrChar 
+    val parentPath = ResourceUtil.getParent(path)  
+    List(parentPath.split("/"):_*).filter(_ != "") + nodeName.mkString
+  }
+  
+  val node = 
+    if(ResourceUtil.isStarResource(resource)) { 
+      val node = addNodes(session.root, newPath)
+      
+      if (request("logo") != "") {
+        node.checkout()
+        val logoNode = node.addNode("logo", "nt:file")
+        val contentNode = logoNode.addNode("jcr:content", "nt:resource")
+        val logo = request.getRequestParameter("logo")
+        contentNode.setProperty("jcr:data", logo.getInputStream)
+        contentNode.setProperty("jcr:lastModified", Calendar.getInstance)    
+        contentNode.setProperty("jcr:mimeType", logo.getContentType)
+        node.save()
+        node.checkin()
+      }   
+      node
+    }
+    else {
+      session.getNode(path)
+    }
+
+  node.checkout
+  node.setProperty("body", request("body"))
+  node.setProperty("subject", request("subject"))
+
+  session.save
+  node.checkin
+  
+  response.sendRedirect(request(":redirect"))
+}
+
+}
\ No newline at end of file

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/html.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/html.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/html.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/html.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package forum {
+  
+object utils {
+  import scala.xml.NodeSeq
+  import scala.xml.NodeSeq.Empty
+  
+  /**
+   * @param condition  a condition which determines whether the following block
+   *     will execute
+   * @param block  a block returning a <code>NodeSeq</codew>
+   * @return  the <code>NodeSeq</code> returned by <code>block</code> if 
+   *     <code>condition</code> is true. <code>Empty</code> otherwise.
+   */
+  def emptyUnless(condition: Boolean)(block: => NodeSeq)  = 
+    if (condition) block
+    else Empty
+
+  /**
+   * Rich wrappers. These would normally go into separate support libraries. 
+   * To keep things simple they are included directly here.   
+   */
+  object RichJCR {
+    import javax.jcr.Session
+    import javax.jcr.Node
+    import javax.jcr.NodeIterator
+    import javax.jcr.Property
+    import javax.jcr.PropertyIterator
+    import javax.jcr.ItemNotFoundException
+    import javax.jcr.version.Version
+    import javax.jcr.version.VersionIterator
+    import javax.servlet.http.HttpServletRequest
+  
+    implicit def iterator(it: NodeIterator): Iterator[Node] = {
+      new Iterator[Node] {
+        def hasNext = it.hasNext
+        def next() = it.next.asInstanceOf[Node]
+      }
+    }
+  
+    implicit def iterator(it: PropertyIterator): Iterator[Property] = {
+      new Iterator[Property] {
+        def hasNext = it.hasNext
+        def next() = it.next.asInstanceOf[Property]
+      }
+    }
+
+    implicit def iterator(it: VersionIterator): Iterator[Version] = {
+      new Iterator[Version] {
+        def hasNext = it.hasNext
+        def next() = it.next.asInstanceOf[Version]
+      }
+    }
+  
+    implicit def rich(node: Node) = new {
+      def apply(name: String) =
+        if (node.hasProperty(name)) node.getProperty(name).getString
+        else "" 
+
+      def path = node.getPath
+      def nodes = iterator(node.getNodes)
+      def properties = iterator(node.getProperties)
+      def uuid = node.getUUID
+      def session = node.getSession
+      def versions = node.getVersionHistory.getAllVersions
+      def baseVersion = node.getBaseVersion
+    }
+    
+    implicit def rich(request: HttpServletRequest) = new {
+      def apply(name: String) =  
+        if(request.getParameter(name) == null) "" 
+        else request.getParameter(name)
+   }
+    
+    implicit def rich(version: Version) = new {
+      def predecessors = version.getPredecessors
+      def successors = version.getSuccessors
+      def frozenNode = version.getNode("jcr:frozenNode")
+      def created = version.getCreated.getTime
+    }
+    
+    implicit def rich(session: Session) = new {
+      def root = session.getRootNode
+      def getNode(absPath: String) = {
+        val item = session.getItem(absPath)
+        if (!item.isNode) throw new ItemNotFoundException("Node: " + absPath)
+        item.asInstanceOf[Node]
+      }
+    }
+  }
+
+}
+
+/**
+ * Search box component 
+ */
+object SearchBox {
+  import javax.jcr.Session
+  import javax.jcr.query.Query
+  import org.apache.sling.api.SlingHttpServletRequest
+  import utils.RichJCR._
+  
+  /** 
+   * Name of the request parameter containing the query text
+   */
+  val QUERY_PARAM = "query"
+
+  /**
+   * Render the search box component to HTML. Uses <code>QUERY_PARAM</code> to 
+   * extract the query text from the request. 
+   * @param request  The <code>SlingHttpServletRequest</code> which renders the
+   *     search box.  
+   * @return  <code>NodeSeq</code> of the rendered search box.
+   */
+  def render(request: SlingHttpServletRequest) = {
+    <div id="Menu">
+      <p>search all threads:
+        <form action="/content/forum.search.html" method="GET" enctype="multipart/form-data">
+          <input type="text" name={ QUERY_PARAM } size="10" value={ request(QUERY_PARAM) } />
+          <input type="submit" value="search" />
+        </form>
+      </p>
+    </div>
+  }
+  
+  /**
+   * Execute a query. Uses <code>QUERY_PARAM</code> to extract the query text from the request.
+   * @param session  The JCR session against which to execute the query
+   * @param request  The <code>SlingHttpServletRequest</code> which executes the query.
+   * @return  <code>NodeIterator</code> containg the nodes resulting from the query
+   */
+  def query(session: Session, request: SlingHttpServletRequest) = {
+    val queryString = "/jcr:root/content/forum//*[jcr:contains(., '" + request(QUERY_PARAM)+"')]"
+    val query = session.getWorkspace.getQueryManager.createQuery(queryString, Query.XPATH)
+    query.execute.getNodes
+  }
+}
+
+/**
+ * New thread form component
+ */
+object ThreadNewForm {
+  
+  /**
+   * Render the new thread form component to HTML.
+   */
+  def render = {
+    <h1>start a new thread</h1>
+    <span id="inp">
+      <form action="/content/forum/*" method="POST" enctype="multipart/form-data">
+        <p>subject</p>
+        <p><input type="text" name="subject" /></p>
+        <p><textarea name="body"></textarea></p>
+        <p>logo</p>
+        <p><input type="file" name="logo" /></p>
+        <p><input type="submit" value="save" /></p>
+        <input name=":redirect" value="/content/forum.html" type="hidden" />
+      </form>
+    </span>
+  }
+}
+
+/**
+ * Thread overview component
+ */
+object ThreadOverview {
+  import javax.jcr.Node
+  import utils._
+  import utils.RichJCR._
+  
+  /**
+   * Render the thread overview component
+   */
+  def render(node: Node) = 
+    emptyUnless(node.hasNodes) {
+      <h1>threads</h1>
+      <ul>{ node.nodes map toListItem }</ul>
+    }
+  
+  private def toListItem(node: Node) = { 
+    <li><p>
+      {
+        emptyUnless(node.hasNode("logo")) {
+          <img src={ node.getNode("logo").path + "/jcr:content" } />
+        }
+      }
+      { node("subject") } 
+      (<a href={ node.path + ".thread.html"}>show thread</a>)
+    </p></li>    
+  }
+  
+}
+
+class html(vars: htmlVars) {
+  import java.util.Calendar
+  import vars._
+  import utils.RichJCR._
+    
+  println {
+    <html>
+      <head>
+        <link rel="stylesheet" href="/apps/forum/static/blue.css" />
+      </head>
+      <body>
+        <div id="Header">
+          Welcome to the { currentNode("name") } forum  
+          &mdash; { Calendar.getInstance.getTime } 
+        </div>
+        { SearchBox.render(request) }
+        <div id="Content">
+          { ThreadNewForm.render }
+          { ThreadOverview.render(currentNode) }
+        </div>
+      </body>
+    </html>  
+  }
+
+}
+
+}

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/search.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/search.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/search.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/search.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package forum {
+  
+class search(vars: searchVars) {
+  import javax.jcr.Node
+  import utils.RichJCR._
+  import vars._
+  
+  def javascript(function: String, args: String*) = 
+    args.mkString("javascript:" + function + "('", "', '", "')")
+  
+  def searchDetail(node: Node) = {
+    val threadPath = node.path.split("/").take(4).mkString("/")
+    val threadUUID = node.session.getNode(threadPath).uuid
+    
+    <li><p>
+      { node("subject") } 
+      <a href={ threadPath + ".thread.html#" + node.uuid }> (open thread)</a> 
+      <span id={ threadUUID + node.uuid + "link" }>
+        <a href={ javascript("expand", threadUUID + node.uuid, threadPath, node.uuid) }>(quick show)</a>
+      </span>
+      <div id={ threadUUID + node.uuid + "content" }></div>
+    </p></li>
+  }
+
+  println {
+    <html>
+      <head>
+        <link rel="stylesheet" href="/apps/forum/static/blue.css" />
+      </head>
+      <body>
+        <div id="Header">
+          <a href="/content/forum.html">&lt; back to thread overview</a>
+        </div>
+        { SearchBox.render(request) } 
+        <script type="text/javascript"><!--
+            var xmlHttp = null;
+            // Mozilla, Opera, Safari, Internet Explorer 7
+            if (typeof XMLHttpRequest != 'undefined') {
+                xmlHttp = new XMLHttpRequest();
+            }
+            if (!xmlHttp) {
+                // Internet Explorer 6
+                try {
+                    xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
+                } catch(e) {
+                    try {
+                        xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
+                    } catch(e) {
+                        xmlHttp  = null;
+                    }
+                }
+            }
+
+            function nodePrinter(nodes, hilight) {
+                var ret = "<ul>";
+                if(nodes["jcr:uuid"] == hilight) {
+                    ret += '<li><p><span style="background-color: #FFFF00">' + nodes["subject"] + "</span></p></li>";
+                } else {
+                    ret += '<li><p>' + nodes["subject"] + "</p></li>";
+                }
+                for (var a in nodes) {
+                    if(nodes[a]["jcr:primaryType"] == "nt:unstructured") {
+                        ret += nodePrinter(nodes[a], hilight);
+                    }
+                }
+                ret += "</ul>";
+                return ret;
+            }
+
+            function expand(id, path, hilight) {
+                document.getElementById(id + "link").style.display = 'none';
+                document.getElementById(id + "content").innerHTML = 'loading...';
+                
+                // now some ajax
+                // the selector and extension '.-1.json' will return the complete thread in json format
+                xmlHttp.open("GET", path + '.-1.json', true);
+                xmlHttp.onreadystatechange = function(){            
+                    switch(xmlHttp.readyState) {
+                        case 4:
+                            if(xmlHttp.status!=200) {
+                                alert("error:"+xmlHttp.status); 
+                            }else{    
+                                document.getElementById(id + "content").innerHTML = nodePrinter(eval('(' +xmlHttp.responseText + ')'), hilight);
+                            }
+                            break;
+                    
+                        default:
+                            return false;
+                            break;     
+                    }
+                };
+                xmlHttp.send(null);
+            }
+        --></script>
+
+       <div id="Content">
+       {
+         val result = SearchBox.query(currentNode.session, request)
+         <h1>search results for query { request.getParameter("qt") }, hits: { result.getSize() } </h1>
+         <ul>
+         { result map searchDetail }
+         </ul>
+       }
+       </div>
+     </body>
+    </html>
+  }
+}
+
+}
\ No newline at end of file

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/static/blue.css
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/static/blue.css?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/static/blue.css (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/static/blue.css Mon Dec  7 16:13:42 2009
@@ -0,0 +1,125 @@
+/* 
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+  
+        http://www.apache.org/licenses/LICENSE-2.0
+  
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+
+/*
+ this css file is taken from bluerobot.com 
+ see: http://bluerobot.com/web/layouts/layout2.html
+ slightly adapted
+ */
+
+body {
+	margin:0px;
+	padding:0px;
+	font-family:verdana, arial, helvetica, sans-serif;
+	color:#333;
+	background-color:white;
+	}
+h1 {
+	margin:0px 0px 15px 0px;
+	padding:0px;
+	font-size:28px;
+	line-height:28px;
+	font-weight:900;
+	color:#ccc;
+	}
+p {
+	font:11px/20px verdana, arial, helvetica, sans-serif;
+	margin:0px;
+	padding:0px;
+    clear:right;
+	}
+#Content>p {margin:0px;}
+
+li img {
+  vertical-align:top;
+  float:right;
+  height:10%;
+}
+
+a {
+	color:#09c;
+	font-size:11px;
+	text-decoration:none;
+	font-weight:600;
+	font-family:verdana, arial, helvetica, sans-serif;
+	}
+a:link {color:#09c;}
+a:visited {color:#07a;}
+a:hover {background-color:#eee;}
+
+#Header {
+	margin:50px 0px 10px 0px;
+	padding:17px 0px 0px 20px;
+	/* For IE5/Win's benefit height = [correct height] + [top padding] + [top and bottom border widths] */
+	height:33px; /* 14px + 17px + 2px = 33px */
+	border-style:solid;
+	border-color:black;
+	border-width:1px 0px; /* top and bottom borders: 1px; left and right borders: 0px */
+	line-height:11px;
+	background-color:#eee;
+
+/* Here is the ugly brilliant hack that protects IE5/Win from its own stupidity. 
+Thanks to Tantek Celik for the hack and to Eric Costello for publicizing it. 
+IE5/Win incorrectly parses the "\"}"" value, prematurely closing the style 
+declaration. The incorrect IE5/Win value is above, while the correct value is 
+below. See http://glish.com/css/hacks.asp for details. */
+	voice-family: "\"}\"";
+	voice-family:inherit;
+	height:14px; /* the correct height */
+	}
+/* I've heard this called the "be nice to Opera 5" rule. Basically, it feeds correct 
+length values to user agents that exhibit the parsing error exploited above yet get 
+the CSS box model right and understand the CSS2 parent-child selector. ALWAYS include
+a "be nice to Opera 5" rule every time you use the Tantek Celik hack (above). */
+body>#Header {height:14px;}
+
+#Content {
+	margin:0px 210px 50px 10px;
+	padding:10px;
+	}
+
+#Menu {
+	position:absolute;
+	top:100px;
+	right:20px;
+	width:172px;
+	padding:10px;
+	background-color:#eee;
+	border:1px dashed #999;
+	line-height:17px;
+/* Again, the ugly brilliant hack. */
+	voice-family: "\"}\"";
+	voice-family:inherit;
+	width:150px;
+	}
+/* Again, "be nice to Opera 5". */
+body>#Menu {width:150px;}
+
+
+input[type="text"] { width:100%; }
+
+textarea {
+	width: 100%;
+}
+
+textarea:focus,input:focus {
+	border: 2px solid #990000;
+}
+
+hr {
+	border: dashed 1px;
+}
\ No newline at end of file

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/static/blue.css
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/static/blue.css
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/static/blue.css
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/thread.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/thread.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/thread.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/thread.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package forum {
+
+class thread(vars: threadVars) {
+  import scala.xml.NodeSeq  
+  import scala.xml.NodeSeq.Empty
+  import javax.jcr.Node
+  import utils._
+  import utils.RichJCR._
+  import vars._
+
+  def javascript(function: String, args: String*) = 
+    args.mkString("javascript:" + function + "('", "', '", "')")
+  
+  def versions(node: Node) = {
+    <span id={ node.uuid + "showversionlink" }>
+      <a href={ javascript("showVersions", node.uuid) }>old versions</a>
+   </span>
+   
+   <span style="display:none" id={ node.uuid + "hideversionlink" }><p>
+     <a href={ javascript("hideVersions", node.uuid) }>hide versions</a>
+   </p></span>
+   
+   <div style="display:none" id={ node.uuid + "versions" }>
+     
+   {
+     for (version <- node.versions; 
+          if version.predecessors.length > 0; 
+          if version.successors.length > 0) yield {
+       
+       <hr />
+       <p>version created at: { version.created }</p>
+       <p> { version.frozenNode("subject") } </p> 
+       <p> { version.frozenNode("body") } </p> 
+     }
+   }
+   
+   <hr />
+   </div>
+  }
+  
+  def detail(node: Node): NodeSeq = {
+    val threadPath = node.path.split("/").take(4).mkString("/")
+    
+    <p>
+      {
+        emptyUnless(node.hasNode("logo")) {
+          <img src={ node.getNode("logo").path + "/jcr:content" } />
+        }
+      }
+    </p>
+    <p>
+      <span id={ node.uuid + "body" }>
+        <a name={ node.uuid } /> 
+        <p> { node("subject") } </p>
+        <p> { node("body") } </p>
+      </span>
+    </p>
+      
+    <p>
+      <span id={ node.uuid + "showeditlink" }>
+        <a href={ javascript("showEdit", node.uuid) }> edit</a>
+      </span>
+      
+      <span style="display:none" id={ node.uuid + "editform" }>
+        <form action={ node.path } method="POST">
+          <p><input type="text" name="subject" value={ node("subject") } /></p>
+          <textarea rows="3" name="body">{ node("body") }</textarea>
+          <p>
+            <input type="submit" value="update" /> 
+            <a href={ javascript("cancelEdit", node.uuid) }>cancel</a>
+          </p>
+          <input name=":redirect" value={ threadPath + ".thread.html#" + node.uuid } type="hidden" />    
+        </form>
+      </span>
+    </p>
+    
+    <p>created: { node.baseVersion.created }</p>
+    
+    <div>
+    {
+      emptyUnless(node.versions.getSize > 2) {
+        <p> { versions(node) } </p>
+      }
+    }
+    </div>
+    
+    <p><span id={ node.uuid + "showformlink" }>
+      <a href={ javascript("showComment", node.uuid) }>add comment</a>
+    </span></p>
+    
+    <div style="display:none" id={ node.uuid + "form" }>
+      <form action={{ node.path } + "/*" } method="POST">
+        <p><input type="text" name="subject" /></p>
+        <textarea rows="2" name="body"></textarea>
+        <p>
+          <input type="submit" value="submit comment" /> 
+          <a href={ javascript("cancelComment", node.uuid) }>cancel</a>
+        </p>
+        <input name=":redirect" value={ threadPath + ".thread.html#" + node.uuid } type="hidden" />    
+      </form>
+    </div>
+    
+    <ul>
+    {
+      node.nodes.filter(_.getPrimaryNodeType.getName != "nt:file") map {node => { 
+        <li> { detail(node) } </li>} 
+      } 
+    }
+    </ul>
+  }
+
+  println {
+    <html>
+      <head>
+        <link rel="stylesheet" href="/apps/forum/static/blue.css" />
+        <script type="text/javascript"><!--
+            function showComment(id) {
+                document.getElementById(id + "showformlink").style.display = 'none';
+                document.getElementById(id + "form").style.display = 'block';
+            }
+
+            function cancelComment(id) {
+                document.getElementById(id + "showformlink").style.display = 'block';
+                document.getElementById(id + "form").style.display = 'none';
+            }
+    
+            function showEdit(id) {
+                document.getElementById(id + "showeditlink").style.display = 'none';
+                document.getElementById(id + "body").style.display = 'none';
+                document.getElementById(id + "editform").style.display = 'block';
+            }
+    
+            function cancelEdit(id)  {
+                document.getElementById(id + "showeditlink").style.display = 'block';
+                document.getElementById(id + "body").style.display = 'block';
+                document.getElementById(id + "editform").style.display = 'none';
+            }
+    
+            function showVersions(id) {
+                document.getElementById(id + "showversionlink").style.display = 'none';
+                document.getElementById(id + "hideversionlink").style.display = 'block';
+                document.getElementById(id + "versions").style.display = 'block';
+            }
+    
+            function hideVersions(id) {
+                document.getElementById(id + "showversionlink").style.display = 'block';
+                document.getElementById(id + "hideversionlink").style.display = 'none';
+                document.getElementById(id + "versions").style.display = 'none';
+            }
+        --></script>
+      </head>
+      
+      <body>
+        <div id="Header">
+          <a href="/content/forum.html">&lt; back to thread overview</a>
+        </div>
+        { SearchBox.render(request) } 
+        <div id="Content">
+        { detail(currentNode) }
+        </div>
+      </body>
+    </html>
+  }
+  
+}
+
+}
\ No newline at end of file

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum.json?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum.json (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum.json Mon Dec  7 16:13:42 2009
@@ -0,0 +1 @@
+{"jcr:primaryType":"nt:unstructured","name":"Scala for Sling"}
\ No newline at end of file

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum.json
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum.json
------------------------------------------------------------------------------
    svn:keywords = Id

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala.json?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala.json (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala.json Mon Dec  7 16:13:42 2009
@@ -0,0 +1 @@
+{"jcr:isCheckedOut":false,"subject":"Scala","body":"Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive. Code sizes are typically reduced by a factor of two to three when compared to an equivalent Java application.","jcr:primaryType":"nt:unstructured","jcr:mixinTypes":["mix:referenceable","mix:versionable"],"jcr:uuid":"42f7ca5d-290c-48c6-9ad5-d8307c9d08a8"}
\ No newline at end of file

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala.json
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala.json
------------------------------------------------------------------------------
    svn:keywords = Id

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala4sling.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala4sling.json?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala4sling.json (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala4sling.json Mon Dec  7 16:13:42 2009
@@ -0,0 +1 @@
+{"jcr:isCheckedOut":false,"subject":"Scala4Sling","body":"In our session, we show how to take advantage of Scala to create RESTful web applications with Sling. We use its DSL capability and support for XML literals to create type safe web site templates. In contrast to conventional web site template mechanisms (e.g. JSP), we do not rely on a preprocessor but rather use pure Scala code.","jcr:primaryType":"nt:unstructured","jcr:mixinTypes":["mix:referenceable","mix:versionable"],"jcr:uuid":"9ecfb74e-5797-440d-8fa8-46ead6b09187"}
\ No newline at end of file

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala4sling.json
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/scala4sling.json
------------------------------------------------------------------------------
    svn:keywords = Id

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/sling.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/sling.json?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/sling.json (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/sling.json Mon Dec  7 16:13:42 2009
@@ -0,0 +1 @@
+{"jcr:isCheckedOut":false,"subject":"Sling","body":"Apache Sling is an innovative web framework that is intended to bring back the fun to web development. It uses all those nice cool and new technologies that make up a state-of-the-art framework.","jcr:primaryType":"nt:unstructured","jcr:mixinTypes":["mix:referenceable","mix:versionable"],"jcr:uuid":"693bd618-6531-422a-bcde-803bebc10c76"}
\ No newline at end of file

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/sling.json
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/content/forum/sling.json
------------------------------------------------------------------------------
    svn:keywords = Id

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/MockBindings.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/MockBindings.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/MockBindings.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/MockBindings.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package forum
+
+import java.io.PrintWriter
+import java.io.Reader
+
+import javax.jcr.Node
+
+import org.slf4j.Logger
+
+import org.apache.sling.api.scripting.SlingScriptHelper
+import org.apache.sling.api.resource.Resource
+import org.apache.sling.api.{SlingHttpServletRequest, SlingHttpServletResponse}
+
+trait MockBindings {
+  def log: Logger = null
+  def out: PrintWriter = new PrintWriter(Console.out)
+  def sling: SlingScriptHelper = null
+  def currentNode: Node = null
+  def reader: Reader = Console.in
+  def resource: Resource = null
+  def request: SlingHttpServletRequest = null
+  def response: SlingHttpServletResponse = null
+}

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/POSTVars.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/POSTVars.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/POSTVars.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/POSTVars.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package forum 
+
+class POSTVars extends MockBindings 

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/Test.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/Test.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/Test.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/Test.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package forum
+
+object Test extends Application {
+  new forum.html(new htmlVars)
+}

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/htmlVars.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/htmlVars.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/htmlVars.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/htmlVars.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package forum 
+
+import slingscala.jcr.{MockNode, MockItem, MockSlingHttpServletRequest, 
+                       MockHttpServletRequest, MockServletRequest}
+
+class htmlVars extends MockBindings {
+  override def currentNode = new MockNode with MockItem
+  override def request = new MockSlingHttpServletRequest with MockHttpServletRequest with MockServletRequest
+}

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/searchVars.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/searchVars.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/searchVars.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/searchVars.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package forum 
+
+class searchVars extends MockBindings
\ No newline at end of file

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/threadVars.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/threadVars.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/threadVars.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/forum/threadVars.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package forum 
+
+class threadVars extends MockBindings

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockHttpServletRequest.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockHttpServletRequest.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockHttpServletRequest.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockHttpServletRequest.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package slingscala.jcr
+
+import java.security.Principal
+import javax.servlet.http.{HttpServletRequest, HttpSession, Cookie}
+
+trait MockHttpServletRequest extends HttpServletRequest {
+  def getAuthType: String = null
+  def getCookies: Array[Cookie] = null
+  def getDateHeader(name: String): Long = 0
+  def getHeader(name :String): String = null
+  def getHeaders(name: String): java.util.Enumeration[_] = null
+  def getHeaderNames: java.util.Enumeration[_] = null
+  def getIntHeader(name: String): Int = 0
+  def getMethod: String = null
+  def getPathInfo: String = null
+  def getPathTranslated: String = null
+  def getContextPath: String = null
+  def getQueryString: String = null
+  def getRemoteUser: String = null
+  def isUserInRole(role: String): Boolean = false
+  def getUserPrincipal: Principal = null
+  def getRequestedSessionId: String = null
+  def getRequestURI: String = null
+  def getRequestURL: StringBuffer = null
+  def getServletPath: String = null
+  def getSession(create: Boolean): HttpSession = null
+  def getSession: HttpSession = null
+  def isRequestedSessionIdValid: Boolean = false
+  def isRequestedSessionIdFromCookie: Boolean = false
+  def isRequestedSessionIdFromURL: Boolean = false
+  def isRequestedSessionIdFromUrl: Boolean = false
+}

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockItem.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockItem.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockItem.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockItem.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package slingscala.jcr
+
+import javax.jcr.{Item, ItemVisitor, Node, Session}
+
+trait MockItem extends Item {
+  def getPath: String = null
+  def getName: String = null
+  def getAncestor(depth: Int): Item = null
+  def getParent: Node = null
+  def getDepth: Int = 0
+  def getSession: Session = null
+  def isNode: Boolean = false
+  def isNew: Boolean = false
+  def isModified: Boolean = false
+  def isSame(otherItem: Item): Boolean = false
+  def accept(visitor: ItemVisitor) {}
+  def save {}
+  def refresh(keepChanges: Boolean) {}
+  def remove {}
+}

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockNode.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockNode.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockNode.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockNode.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package slingscala.jcr
+
+import java.io.InputStream
+import java.util.Calendar
+import javax.jcr.{Item, Node, Value, Property, NodeIterator, PropertyIterator}
+import javax.jcr.version.{Version, VersionHistory}
+import javax.jcr.lock.Lock
+import javax.jcr.nodetype.{NodeType, NodeDefinition}
+
+trait MockNode extends Node {
+  def addNode(relPath: String): Node = null
+  def addNode(relPath: String, primaryNodeTypeName: String): Node = null  
+  def orderBefore(srcChildRelPath: String, destChildRelPath: String) {}
+  def setProperty(name: String, value: Value): Property = null
+  def setProperty(name: String, value: Value, tyqe: Int): Property = null
+  def setProperty(name: String, values: Array[Value]): Property = null
+  def setProperty(name: String, values: Array[Value], tyqe: Int): Property = null
+  def setProperty(name: String, values: Array[String]): Property = null
+  def setProperty(name: String, values: Array[String], tyqe: Int): Property = null
+  def setProperty(name: String, value: String): Property = null
+  def setProperty(name: String, value: String, tyqe: Int): Property = null
+  def setProperty(name: String, value: InputStream): Property = null
+  def setProperty(name: String, value: Boolean): Property = null
+  def setProperty(name: String, value: Double): Property = null
+  def setProperty(name: String, value: Long): Property= null
+  def setProperty(name: String, value: Calendar): Property = null
+  def setProperty(name: String, value: Node): Property = null
+  def getNode(relPath: String): Node = null
+  def getNodes: NodeIterator = null
+  def getNodes(namePattern: String): NodeIterator = null
+  def getProperty(relPath: String): Property = null
+  def getProperties: PropertyIterator = null
+  def getProperties(namePattern: String): PropertyIterator = null
+  def getPrimaryItem: Item = null
+  def getUUID: String = null
+  def getIndex: Int = 0
+  def getReferences: PropertyIterator = null
+  def hasNode(relPath: String): Boolean = false
+  def hasProperty(relPath: String): Boolean = false
+  def hasNodes: Boolean = false
+  def hasProperties: Boolean = false
+  def getPrimaryNodeType: NodeType = null
+  def getMixinNodeTypes: Array[NodeType] = null
+  def isNodeType(nodeTypeName: String): Boolean = false
+  def addMixin(mixinName: String) {}
+  def removeMixin(mixinName: String) {}
+  def canAddMixin(mixinName: String): Boolean = false
+  def getDefinition: NodeDefinition = null
+  def checkin: Version = null
+  def checkout {}
+  def doneMerge(version: Version) {}
+  def cancelMerge(version: Version) {}
+  def update(srcWorkspaceName: String) {}
+  def merge(srcWorkspace: String, bestEffort: Boolean): NodeIterator = null
+  def getCorrespondingNodePath(workspaceName: String): String = null
+  def isCheckedOut: Boolean = false
+  def restore(versionName: String, removeExisting: Boolean) {}
+  def restore(version: Version, removeExisting: Boolean) {}
+  def restore(version: Version, relPath: String, removeExisting: Boolean) {}
+  def restoreByLabel(versionLabel: String, removeExisting: Boolean) {}
+  def getVersionHistory: VersionHistory = null
+  def getBaseVersion: Version  = null
+  def lock(isDeep: Boolean, isSessionScoped: Boolean): Lock = null
+  def getLock: Lock = null
+  def unlock {}
+  def holdsLock: Boolean = false
+  def isLocked: Boolean = false
+}

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockServletRequest.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockServletRequest.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockServletRequest.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockServletRequest.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package slingscala.jcr
+
+import java.util.Locale
+import java.io.BufferedReader
+import javax.servlet.{ServletRequest, ServletInputStream, RequestDispatcher}
+
+trait MockServletRequest extends ServletRequest {
+  def getAttribute(name: String): Object = null
+  def getAttributeNames: java.util.Enumeration[_] = null 
+  def getCharacterEncoding: String = null
+  def setCharacterEncoding(env: String) {}
+  def getContentLength: Int = 0
+  def getContentType: String = null
+  def getInputStream: ServletInputStream = null
+  def getParameter(name: String): String = null
+  def getParameterNames: java.util.Enumeration[_] = null
+  def getParameterValues(name: String): Array[String] = null
+  def getParameterMap: java.util.Map[_,_] = null
+  def getProtocol: String = null
+  def getScheme: String = null
+  def getServerName: String = null
+  def getServerPort: Int = 0
+  def getReader: BufferedReader = null
+  def getRemoteAddr: String = null
+  def getRemoteHost: String = null
+  def setAttribute(name: String, o: Object) {} 
+  def removeAttribute(name: String) {}
+  def getLocale: Locale = null
+  def getLocales: java.util.Enumeration[_] = null
+  def isSecure: Boolean = false
+  def getRequestDispatcher(path: String): RequestDispatcher = null
+  def getRealPath(path: String): String = null
+  def getRemotePort: Int = 0
+  def getLocalName: String = null
+  def getLocalAddr: String = null
+  def getLocalPort: Int = 0
+}

Added: sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockSlingHttpServletRequest.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockSlingHttpServletRequest.scala?rev=887969&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockSlingHttpServletRequest.scala (added)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/scala/slingscala/jcr/MockSlingHttpServletRequest.scala Mon Dec  7 16:13:42 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package slingscala.jcr
+
+import java.util.{Locale, ResourceBundle}
+import javax.servlet.RequestDispatcher
+import javax.servlet.http.Cookie
+import org.apache.sling.api.SlingHttpServletRequest
+import org.apache.sling.api.resource.{Resource, ResourceResolver}
+import org.apache.sling.api.request.{RequestPathInfo, RequestParameter, RequestParameterMap, 
+                                     RequestDispatcherOptions, RequestProgressTracker}
+
+trait MockSlingHttpServletRequest extends SlingHttpServletRequest {
+  def getResource: Resource = null
+  def getResourceResolver: ResourceResolver = null
+  def getRequestPathInfo: RequestPathInfo = null
+  def getRequestParameter(name: String): RequestParameter = null
+  def getRequestParameters(name: String): Array[RequestParameter] = null
+  def getRequestParameterMap: RequestParameterMap = null
+  def getRequestDispatcher(path: String, options: RequestDispatcherOptions): RequestDispatcher = null
+  def getRequestDispatcher(resource: Resource, options: RequestDispatcherOptions): RequestDispatcher = null
+  def getRequestDispatcher(resource: Resource): RequestDispatcher = null
+  def getCookie(name: String): Cookie = null
+  def getResponseContentType: String = null
+  def getResponseContentTypes: java.util.Enumeration[String] = null
+  def getResourceBundle(locale: Locale): ResourceBundle = null
+  def getResourceBundle(baseName: String, locale: Locale): ResourceBundle = null
+  def getRequestProgressTracker: RequestProgressTracker = null
+  def adaptTo[T](t: Class[T]): T = null.asInstanceOf[T]
+}



Mime
View raw message