incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r739973 [1/3] - in /incubator/sling/trunk/scripting/scala: ./ engine/ engine/src/ engine/src/main/ engine/src/main/java/ engine/src/main/java/org/ engine/src/main/java/org/apache/ engine/src/main/java/org/apache/sling/ engine/src/main/java/...
Date Mon, 02 Feb 2009 12:22:21 GMT
Author: fmeschbe
Date: Mon Feb  2 12:22:19 2009
New Revision: 739973

URL: http://svn.apache.org/viewvc?rev=739973&view=rev
Log:
SLING-549 Apply modified patch by Michael Dürig (thanks)

Added:
    incubator/sling/trunk/scripting/scala/
    incubator/sling/trunk/scripting/scala/engine/   (with props)
    incubator/sling/trunk/scripting/scala/engine/LICENSE
    incubator/sling/trunk/scripting/scala/engine/NOTICE
    incubator/sling/trunk/scripting/scala/engine/README.txt   (with props)
    incubator/sling/trunk/scripting/scala/engine/pom.xml   (with props)
    incubator/sling/trunk/scripting/scala/engine/src/
    incubator/sling/trunk/scripting/scala/engine/src/main/
    incubator/sling/trunk/scripting/scala/engine/src/main/java/
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/BacklogReporter.java   (with props)
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ExceptionHelper.java   (with props)
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/LogReporter.java   (with props)
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngine.java   (with props)
    incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngineFactory.java   (with props)
    incubator/sling/trunk/scripting/scala/engine/src/main/resources/
    incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/
    incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/DISCLAIMER
    incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/LICENSE
    incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/LICENSE.scala
    incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/NOTICE
    incubator/sling/trunk/scripting/scala/engine/src/test/
    incubator/sling/trunk/scripting/scala/engine/src/test/java/
    incubator/sling/trunk/scripting/scala/engine/src/test/java/org/
    incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/
    incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/
    incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/
    incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/
    incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.java   (with props)
    incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineTest.java   (with props)
    incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaTestBase.java   (with props)
    incubator/sling/trunk/scripting/scala/engine/src/test/resources/
    incubator/sling/trunk/scripting/scala/engine/src/test/resources/scripts/
    incubator/sling/trunk/scripting/scala/engine/src/test/resources/scripts/simple.scs
    incubator/sling/trunk/scripting/scala/engine/src/test/test-config/
    incubator/sling/trunk/scripting/scala/engine/src/test/test-config/jackrabbit-test-config.xml   (with props)
    incubator/sling/trunk/scripting/scala/interpreter/   (with props)
    incubator/sling/trunk/scripting/scala/interpreter/LICENSE
    incubator/sling/trunk/scripting/scala/interpreter/NOTICE
    incubator/sling/trunk/scripting/scala/interpreter/README.txt   (with props)
    incubator/sling/trunk/scripting/scala/interpreter/pom.xml   (with props)
    incubator/sling/trunk/scripting/scala/interpreter/src/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/resources/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/resources/META-INF/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/resources/META-INF/DISCLAIMER
    incubator/sling/trunk/scripting/scala/interpreter/src/main/resources/META-INF/LICENSE
    incubator/sling/trunk/scripting/scala/interpreter/src/main/resources/META-INF/NOTICE
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/scala/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/scala/Utils.scala
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/scala/interpreter/
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/scala/interpreter/BundleFS.scala
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/scala/interpreter/InterpreterException.scala
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/scala/interpreter/JcrFS.scala
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaClasspath.scala
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaCompiler.scala
    incubator/sling/trunk/scripting/scala/interpreter/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaInterpreter.scala
    incubator/sling/trunk/scripting/scala/interpreter/src/test/
    incubator/sling/trunk/scripting/scala/interpreter/src/test/scala/
    incubator/sling/trunk/scripting/scala/interpreter/src/test/scala/org/
    incubator/sling/trunk/scripting/scala/interpreter/src/test/scala/org/apache/
    incubator/sling/trunk/scripting/scala/interpreter/src/test/scala/org/apache/sling/
    incubator/sling/trunk/scripting/scala/interpreter/src/test/scala/org/apache/sling/scripting/
    incubator/sling/trunk/scripting/scala/interpreter/src/test/scala/org/apache/sling/scripting/scala/
    incubator/sling/trunk/scripting/scala/interpreter/src/test/scala/org/apache/sling/scripting/scala/interpreter/
    incubator/sling/trunk/scripting/scala/interpreter/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterTest.scala
    incubator/sling/trunk/scripting/scala/interpreter/src/test/scala/org/apache/sling/scripting/scala/interpreter/JcrFSTest.scala
    incubator/sling/trunk/scripting/scala/pom.xml   (with props)

Propchange: incubator/sling/trunk/scripting/scala/engine/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb  2 12:22:19 2009
@@ -0,0 +1,4 @@
+.classpath
+.project
+target
+.settings

Added: incubator/sling/trunk/scripting/scala/engine/LICENSE
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/LICENSE?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/LICENSE (added)
+++ incubator/sling/trunk/scripting/scala/engine/LICENSE Mon Feb  2 12:22:19 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.

Added: incubator/sling/trunk/scripting/scala/engine/NOTICE
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/NOTICE?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/NOTICE (added)
+++ incubator/sling/trunk/scripting/scala/engine/NOTICE Mon Feb  2 12:22:19 2009
@@ -0,0 +1,8 @@
+Apache Sling Scripting Scala Support
+Copyright 2009 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software developed at
+EPFL, Lausanne, Copyright 2002-2009 (http://www.scala-lang.org/).

Added: incubator/sling/trunk/scripting/scala/engine/README.txt
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/README.txt?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/README.txt (added)
+++ incubator/sling/trunk/scripting/scala/engine/README.txt Mon Feb  2 12:22:19 2009
@@ -0,0 +1,35 @@
+Apache Sling Scripting Scala Support
+
+Disclaimer
+==========
+Apache Sling is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Jackrabbit PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other
+successful ASF projects. While incubation status is not necessarily a reflection of
+the completeness or stability of the code, it does indicate that the project has yet
+to be fully endorsed by the ASF.
+
+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.0.7 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
+
+See the Maven 2 documentation for other build features.
+
+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/incubator/sling/trunk/scripting/velocity
+
+See the Subversion documentation for other source control features.
+

Propchange: incubator/sling/trunk/scripting/scala/engine/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/scripting/scala/engine/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/pom.xml?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/pom.xml (added)
+++ incubator/sling/trunk/scripting/scala/engine/pom.xml Mon Feb  2 12:22:19 2009
@@ -0,0 +1,177 @@
+<?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>5-incubator-SNAPSHOT</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>org.apache.sling.scripting.scala</artifactId>
+    <version>0.9.0-incubator-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Apache Sling Scripting Scala Support</name>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-eclipse-plugin</artifactId>
+                <configuration>
+                    <downloadSources>true</downloadSources>
+                    <classpathContainers>
+                        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
+                    </classpathContainers>
+                </configuration>
+            </plugin>     
+
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>                          
+            
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <ScriptEngine-Name>${pom.name}</ScriptEngine-Name>
+                        <ScriptEngine-Version>${pom.version}</ScriptEngine-Version>
+
+                        <Private-Package>
+                            org.apache.sling.scripting.scala.engine.*
+                        </Private-Package>         
+                        <Import-Package>
+                            !javax.swing.*,
+                            !jline.*,
+                            *
+                        </Import-Package>
+                        <DynamicImport-Package>*</DynamicImport-Package>
+
+                        <Embed-Dependency>
+                            org.apache.sling.scripting.scala.interpreter;inline=true,
+                            scala-library;inline=true,
+                            scala-compiler;inline=scala/tools/nsc/**|scala/tools/util/**|ch/**
+                        </Embed-Dependency>
+                    </instructions>                   
+                </configuration>
+            </plugin>  
+            
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.4.2</version>
+                <configuration>
+                    <systemProperties>
+                        <property>
+                            <name>derby.stream.error.file</name>
+                            <value>target/derby.log</value>
+                        </property>
+                    </systemProperties>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.scripting.scala.interpreter</artifactId>
+            <version>0.9.0-incubator-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.0.2-incubator</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.scripting.api</artifactId>
+            <version>2.0.2-incubator</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.jcr.api</artifactId>
+            <version>2.0.2-incubator</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.scala-lang</groupId>
+            <artifactId>scala-library</artifactId>
+            <version>2.7.3</version> 
+            <scope>provided</scope>
+        </dependency>         
+        <dependency>
+            <groupId>org.scala-lang</groupId>
+            <artifactId>scala-compiler</artifactId> 
+            <version>2.7.3</version> 
+            <scope>provided</scope>
+        </dependency>        
+        <dependency>
+            <groupId>org.apache.felix</groupId> 
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId> 
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+        </dependency>
+        
+        <!-- Testing -->       
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.testing</artifactId>
+            <version>2.0.3-incubator-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <repositories>
+        <repository>
+        <id>scala-tools.org</id>
+        <name>Scala-Tools Maven2 Repository</name>
+        <url>http://scala-tools.org/repo-releases</url>
+        </repository>           
+    </repositories>
+        
+    <pluginRepositories>
+        <pluginRepository>
+        <id>scala-tools.org</id>
+        <name>Scala-Tools Maven2 Repository</name>
+        <url>http://scala-tools.org/repo-releases</url>
+        </pluginRepository>
+    </pluginRepositories>
+  
+</project>

Propchange: incubator/sling/trunk/scripting/scala/engine/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/BacklogReporter.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/BacklogReporter.java?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/BacklogReporter.java (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/BacklogReporter.java Mon Feb  2 12:22:19 2009
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.scripting.scala.engine;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.LinkedList;
+import java.util.List;
+
+import scala.tools.nsc.Settings;
+import scala.tools.nsc.reporters.AbstractReporter;
+import scala.tools.nsc.util.Position;
+
+public class BacklogReporter extends AbstractReporter {
+    public static final int DEFAULT_SIZE = 50;
+
+    private final List<Info> backLog = new LinkedList<Info>();
+    private final Settings settings;
+    private final int size;
+
+    public BacklogReporter(Settings settings) {
+        this(settings, DEFAULT_SIZE);
+    }
+
+    public BacklogReporter(Settings settings, int size) {
+        super();
+        this.settings = settings;
+        this.size = size;
+    }
+
+    @Override
+    public void reset() {
+        super.reset();
+        backLog.clear();
+    }
+
+    @Override
+    public void display(Position pos, String msg, Severity severity) {
+        severity.count_$eq(severity.count() + 1);
+        if (size > 0) {
+            backLog.add(new Info(pos, msg, severity));
+            if (backLog.size() > size) {
+                backLog.remove(0);
+            }
+        }
+    }
+
+    @Override
+    public void displayPrompt() {
+        // empty
+    }
+
+    @Override
+    public Settings settings() {
+        return settings;
+    }
+
+    @Override
+    public String toString() {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        for (Info info : backLog) {
+            pw.println(info.toString());
+        }
+        return sw.toString();
+    }
+
+    private class Info {
+        private final Position pos;
+        private final String msg;
+        private final Severity severity;
+
+        public Info(Position pos, String msg, Severity severity) {
+            this.pos = pos;
+            this.msg = msg;
+            this.severity = severity;
+        }
+
+        @Override
+        public String toString() {
+            StringWriter sw = new StringWriter();
+            PrintWriter pw = new PrintWriter(sw);
+            print(pw, severity);
+            pw.print(" ");
+            print(pw, pos);
+            pw.print(": ");
+            pw.print(msg);
+            return sw.toString();
+        }
+
+        private void print(PrintWriter pw, Position pos) {
+            if (pos.source().isDefined()) {
+                pw.print(pos.source().get());
+                pw.print(" ");
+            }
+            if (pos.line().isDefined()) {
+                pw.print("line ");
+                pw.print(pos.line().get());
+            }
+        }
+
+        private void print(PrintWriter pw, Severity severity) {
+            if (INFO().equals(severity)) {
+                pw.print("INFO");
+            }
+            else if (WARNING().equals(severity)) {
+                pw.print("WARNING");
+            }
+            else if (ERROR().equals(severity)) {
+                pw.print("ERROR");
+            }
+            else {
+                throw new IllegalArgumentException("Severtiy out of range");
+            }
+        }
+
+    }
+
+}

Propchange: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/BacklogReporter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/BacklogReporter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ExceptionHelper.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ExceptionHelper.java?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ExceptionHelper.java (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ExceptionHelper.java Mon Feb  2 12:22:19 2009
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.scripting.scala.engine;
+
+public final class ExceptionHelper {
+
+    private ExceptionHelper() {
+        super();
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T extends Throwable> T initCause(T throwable, Throwable cause) {
+        return (T) throwable.initCause(cause);
+    }
+
+}

Propchange: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ExceptionHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ExceptionHelper.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/LogReporter.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/LogReporter.java?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/LogReporter.java (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/LogReporter.java Mon Feb  2 12:22:19 2009
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.scripting.scala.engine;
+
+import org.slf4j.Logger;
+
+import scala.tools.nsc.Settings;
+import scala.tools.nsc.util.Position;
+
+public class LogReporter extends BacklogReporter {
+    private final Logger logger;
+
+    public LogReporter(Logger logger, Settings settings) {
+        super(settings);
+        this.logger = logger;
+    }
+
+    @Override
+    public void display(Position pos, String msg, Severity severity) {
+        super.display(pos, msg, severity);
+        if (INFO().equals(severity)) {
+            logger.info("{}: {}", msg, pos);
+        }
+        else if (WARNING().equals(severity)) {
+            logger.warn("{}: {}", msg, pos);
+        }
+        else if (ERROR().equals(severity)) {
+            logger.error("{}: {}", msg, pos);
+        }
+        else {
+            throw new IllegalArgumentException("Severtiy out of range");
+        }
+    }
+
+}

Propchange: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/LogReporter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/LogReporter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngine.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngine.java?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngine.java (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngine.java Mon Feb  2 12:22:19 2009
@@ -0,0 +1,362 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.scripting.scala.engine;
+
+import static org.apache.sling.scripting.scala.engine.ExceptionHelper.initCause;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import javax.jcr.Node;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptException;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.scripting.SlingBindings;
+import org.apache.sling.api.scripting.SlingScript;
+import org.apache.sling.api.scripting.SlingScriptHelper;
+import org.apache.sling.scripting.api.AbstractSlingScriptEngine;
+import org.apache.sling.scripting.scala.interpreter.JcrFS;
+import org.apache.sling.scripting.scala.interpreter.ScalaBindings;
+import org.apache.sling.scripting.scala.interpreter.ScalaInterpreter;
+import org.apache.sling.scripting.scala.interpreter.JcrFS.JcrNode;
+import org.slf4j.Logger;
+
+import scala.tools.nsc.io.AbstractFile;
+import scala.tools.nsc.reporters.Reporter;
+
+public class ScalaScriptEngine extends AbstractSlingScriptEngine {
+    public static final String NL = System.getProperty("line.separator");
+
+    private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
+    private final ScalaInterpreter interpreter;
+
+    public ScalaScriptEngine(ScalaInterpreter interpreter, ScriptEngineFactory scriptEngineFactory) {
+        super(scriptEngineFactory);
+        this.interpreter = interpreter;
+    }
+
+    public Object eval(Reader scriptReader, final ScriptContext context) throws ScriptException {
+        try {
+            SlingBindings bindings = getBindings(context);
+            SlingScriptHelper scriptHelper = bindings.getSling();
+            if (scriptHelper == null) {
+                throw new IllegalArgumentException("Bindings does not contain script helper object");
+            }
+
+            TypeHints typeHints = new TypeHints(bindings);
+            final ScalaBindings scalaBindings = new ScalaBindings();
+            for (Object name : bindings.keySet()) {
+                scalaBindings.put((String) name, bindings.get(name), typeHints.get(name));
+            }
+
+            final JcrNode script = getScriptSource(scriptHelper);
+            final long scriptMod = script.lastModified();
+            final String scriptName = getScriptName(scriptHelper);
+
+            Boolean outDated = readLocked(new Callable<Boolean>() {
+                public Boolean call() throws Exception {
+                    return isOutDated(scriptMod, scriptName);
+                }
+            });
+
+            if (outDated) {
+                Reporter result = writeLocked(new Callable<Reporter>() {
+                    public Reporter call() throws Exception {
+                        return isOutDated(scriptMod, scriptName)
+                            ? interpreter.compile(scriptName, script, scalaBindings)
+                            : null;
+                    }
+                });
+
+                if (result != null && result.hasErrors()) {
+                    throw new ScriptException(result.toString());
+                }
+            }
+
+            Reporter result = readLocked(new Callable<Reporter>() {
+                public Reporter call() throws Exception {
+                    OutputStream outputStream = getOutputStream(context);
+                    Reporter result = interpreter.execute(scriptName, scalaBindings, getInputStream(context),
+                            outputStream);
+                    outputStream.flush();
+                    return result;
+                }
+            });
+            if (result.hasErrors()) {
+                throw new ScriptException(result.toString());
+            }
+        }
+        catch (Exception e) {
+            if (e instanceof ScriptException) {
+                throw (ScriptException)e;
+            }
+            else {
+                throw initCause(new ScriptException("Error executing script"), e);
+            }
+        }
+        return null;
+    }
+
+    // -----------------------------------------------------< private >---
+
+    private boolean isOutDated(long scriptMod, String scriptName) {
+        if (scriptMod == 0) {
+            return true;
+        }
+
+        AbstractFile clazz = interpreter.getClassFile(scriptName);
+        if (clazz == null) {
+            return true;
+        }
+
+        long clazzMod = clazz.lastModified();
+        if (clazzMod == 0) {
+            return true;
+        }
+
+        return scriptMod > clazzMod;
+    }
+
+    private <T> T readLocked(Callable<T> thunk) throws Exception {
+        rwLock.readLock().lock();
+        try {
+            return thunk.call();
+        }
+        finally {
+            rwLock.readLock().unlock();
+        }
+    }
+
+    private <T> T writeLocked(Callable<T> thunk) throws Exception {
+        rwLock.writeLock().lock();
+        try {
+            return thunk.call();
+        }
+        finally {
+            rwLock.writeLock().unlock();
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private static SlingBindings getBindings(ScriptContext context) {
+        SlingBindings bindings = new SlingBindings();
+        bindings.putAll(context.getBindings(ScriptContext.ENGINE_SCOPE));
+        return bindings;
+    }
+
+    private static JcrNode getScriptSource(SlingScriptHelper scriptHelper) {
+        SlingScript script = scriptHelper.getScript();
+        Node scriptNode = script.getScriptResource().adaptTo(Node.class);
+        return JcrFS.create(scriptNode);
+    }
+
+    private static String getScriptName(SlingScriptHelper scriptHelper) {
+        String path = scriptHelper.getScript().getScriptResource().getPath();
+        if (path.endsWith(".scala")) {
+            path = path.substring(0, path.length() - 6);
+        }
+        if (path.startsWith("/")) {
+            path = path.substring(1);
+        }
+
+        String[] parts = path.split("/");
+        StringBuilder scriptName = new StringBuilder();
+        scriptName.append(makeIdentifier(parts[0]));
+        for (int k = 1; k < parts.length; k++) {
+            scriptName.append('.').append(makeIdentifier(parts[k]));
+        }
+
+        return scriptName.toString();
+    }
+
+    /**
+     * Converts the given identifier to a legal Java/Scala identifier
+     * @param identifier Identifier to convert
+     * @return Legal Java/Scala identifier corresponding to the given identifier
+     */
+    private static final String makeIdentifier(String identifier) {
+        StringBuffer id = new StringBuffer(identifier.length());
+        if (!Character.isJavaIdentifierStart(identifier.charAt(0))) {
+            id.append('_');
+        }
+        for (int i = 0; i < identifier.length(); i++) {
+            char ch = identifier.charAt(i);
+            if (Character.isJavaIdentifierPart(ch) && ch != '_') {
+                id.append(ch);
+            }
+            else if (ch == '.') {
+                id.append('_');
+            }
+            else {
+                id.append(mangleChar(ch));
+            }
+        }
+        if (isKeyword(id.toString())) {
+            id.append('_');
+        }
+        return id.toString();
+    }
+
+    /**
+     * Mangle the specified character to create a legal Java/Scala class name.
+     */
+    private static final String mangleChar(char ch) {
+        char[] result = new char[5];
+        result[0] = '_';
+        result[1] = Character.forDigit((ch >> 12) & 0xf, 16);
+        result[2] = Character.forDigit((ch >> 8) & 0xf, 16);
+        result[3] = Character.forDigit((ch >> 4) & 0xf, 16);
+        result[4] = Character.forDigit(ch & 0xf, 16);
+        return new String(result);
+    }
+
+    @SuppressWarnings("serial")
+    private static final Set<String> KEYWORDS = new HashSet<String>() {{
+        add("abstract"); add("assert"); add("boolean"); add("break"); add("byte"); add("case"); add("catch");
+        add("char"); add("class"); add("const"); add("continue"); add("default"); add("do"); add("double");
+        add("else"); add("enum"); add("extends"); add("final"); add("finally"); add("float"); add("for");
+        add("goto"); add("if"); add("implements"); add("import"); add("instanceof"); add("int");
+        add("interface"); add("long"); add("native"); add("new"); add("package"); add("private");
+        add("protected"); add("public"); add("return"); add("short"); add("static"); add("strictfp");
+        add("super"); add("switch"); add("synchronized"); add("this"); add("throws"); add("transient");
+        add("try"); add("void"); add("volatile"); add("while"); add("true"); add("false"); add("null");
+        add("forSome"); add("type"); add("var"); add("val"); add("def"); add("with"); add("yield");
+        add("match"); add("implicit"); add("lazy"); add("override"); add("sealed"); add("trait");
+        add("object");
+    }};
+
+    /**
+     * Test whether the argument is a Java keyword
+     */
+    private static boolean isKeyword(String token) {
+        return KEYWORDS.contains(token);
+    }
+
+    private static InputStream getInputStream(final ScriptContext context) {
+        return new InputStream() {
+            private final Reader reader = context.getReader();
+
+            @Override
+            public int read() throws IOException {
+                return reader.read();
+            }
+        };
+    }
+
+    private static OutputStream getOutputStream(final ScriptContext context) {
+        return new OutputStream() {
+            private final Writer writer = context.getWriter();
+
+            @Override
+            public void write(int b) throws IOException {
+                writer.write(b);
+            }
+        };
+    }
+
+    // todo fix: redirect stdErr when Scala supports it
+    @SuppressWarnings("unused")
+    private static OutputStream getErrorStream(final ScriptContext context) {
+        return new OutputStream() {
+            private final Writer writer = context.getErrorWriter();
+
+            @Override
+            public void write(int b) throws IOException {
+                writer.write(b);
+            }
+        };
+    }
+
+    @SuppressWarnings("serial")
+    private static class TypeHints extends HashMap<String, Class<?>> {
+        public static final Class<SlingHttpServletRequest> REQUEST_TYPE = SlingHttpServletRequest.class;
+        public static final Class<SlingHttpServletResponse> RESPONSE_TYPE = SlingHttpServletResponse.class;
+        public static final Class<Reader> READER_TYPE = Reader.class;
+        public static final Class<SlingScriptHelper> SLING_TYPE = SlingScriptHelper.class;
+        public static final Class<Resource> RESOURCE_TYPE = Resource.class;
+        public static final Class<PrintWriter> OUT_TYPE = PrintWriter.class;
+        public static final Class<Boolean> FLUSH_TYPE = Boolean.class;
+        public static final Class<Logger> LOG_TYPE = Logger.class;
+        public static final Class<Node> NODE_TYPE = Node.class;
+
+        private static final java.util.Map<String, Class<?>> TYPES = new HashMap<String, Class<?>>() {{
+            put(SlingBindings.REQUEST, REQUEST_TYPE);
+            put(SlingBindings.RESPONSE, RESPONSE_TYPE);
+            put(SlingBindings.READER, READER_TYPE);
+            put(SlingBindings.SLING, SLING_TYPE);
+            put(SlingBindings.RESOURCE, RESOURCE_TYPE);
+            put(SlingBindings.OUT, OUT_TYPE);
+            put(SlingBindings.FLUSH, FLUSH_TYPE);
+            put(SlingBindings.LOG, LOG_TYPE);
+            put("currentNode", NODE_TYPE);
+        }};
+
+        public TypeHints(SlingBindings bindings) {
+            super();
+            for (Object name : bindings.keySet()) {
+                setType((String) name, TYPES.get(name));
+            }
+        }
+
+        public void setType(String name, Class<?> type) {
+            if (type != null) {
+                put(name, type);
+            }
+        }
+
+        public Class<?> getType(String name) {
+            Class<?> c = get(name);
+            return c == null ? Object.class : c;
+        }
+
+        /**
+         * Compile time assertion enforcing type safety
+         */
+        @SuppressWarnings("unused")
+        private static class CompileTimeAssertion {
+            static {
+                SlingBindings b = new SlingBindings();
+                b.setRequest(REQUEST_TYPE.cast(null));
+                b.setResponse(RESPONSE_TYPE.cast(null));
+                b.setReader(READER_TYPE.cast(null));
+                b.setSling(SLING_TYPE.cast(null));
+                b.setResource(RESOURCE_TYPE.cast(null));
+                b.setOut(OUT_TYPE.cast(null));
+                b.setFlush(FLUSH_TYPE.cast(null));
+                b.setLog(LOG_TYPE.cast(null));
+            }
+        }
+
+    }
+
+}
+
+

Propchange: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngine.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngineFactory.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngineFactory.java?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngineFactory.java (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngineFactory.java Mon Feb  2 12:22:19 2009
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.scripting.scala.engine;
+
+import static org.apache.sling.scripting.scala.engine.ExceptionHelper.initCause;
+
+import java.io.File;
+import java.io.Reader;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+
+import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.scripting.api.AbstractScriptEngineFactory;
+import org.apache.sling.scripting.api.AbstractSlingScriptEngine;
+import org.apache.sling.scripting.scala.interpreter.BundleFS;
+import org.apache.sling.scripting.scala.interpreter.JcrFS;
+import org.apache.sling.scripting.scala.interpreter.ScalaInterpreter;
+import org.osgi.framework.Bundle;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.LoggerFactory;
+
+import scala.tools.nsc.Settings;
+import scala.tools.nsc.io.AbstractFile;
+import scala.tools.nsc.io.PlainFile;
+
+/**
+ * @scr.component
+ *   label="Apache Sling Scala Script Handler"
+ *   description="Adds Scala scripting support for rendering response content."
+ *
+ * @scr.service
+ */
+public class ScalaScriptEngineFactory extends AbstractScriptEngineFactory {
+    private static final String PATH_SEPARATOR = System.getProperty("path.separator");
+
+    public final static String[] SCALA_SCRIPT_EXTENSIONS = {"scala", "scs"};
+    public final static String SCALA_MIME_TYPE = "application/x-scala";
+    public final static String SHORT_NAME = "scala";
+    public final static String VERSION = "2.7.3";
+
+    /**
+     * @scr.property
+     *   value="/var/classes"
+     *   label="Compiler output directory"
+     *   description="Output directory for files generated by the Scala compiler. Defaults to /var/classes."
+     */
+    public static final String OUT_DIR = "scala.compiler.outdir";
+    private String outDir;
+
+    /** @scr.reference */
+    private SlingRepository repository;
+
+    private ComponentContext context;
+    private ScalaScriptEngine scriptEngine;
+
+    public ScalaScriptEngineFactory() {
+        super();
+        setExtensions(SCALA_SCRIPT_EXTENSIONS);
+        setMimeTypes(SCALA_MIME_TYPE);
+        setNames(SHORT_NAME);
+    }
+
+    protected void activate(ComponentContext context) {
+        this.context = context;
+        outDir = (String) context.getProperties().get(OUT_DIR);
+    }
+
+    protected void deactivate(ComponentContext context) {
+        scriptEngine = null;
+        this.context = null;
+    }
+
+    public ScriptEngine getScriptEngine(){
+        if (context == null) {
+            throw new IllegalStateException("Bundle not activated");
+        }
+
+        if (scriptEngine == null) {
+            final String path = getOutDir();
+            try {
+                Bundle[] bundles = context.getBundleContext().getBundles();
+                Settings settings = createSettings(bundles);
+                scriptEngine = new ScalaScriptEngine(
+                        new ScalaInterpreter(
+                            settings,
+                            new LogReporter(
+                                    LoggerFactory.getLogger(ScalaInterpreter.class),
+                                    settings),
+                            createClassPath(bundles),
+                            createFolder(path)),
+                        this);
+            }
+            catch (final RepositoryException e) {
+                return new AbstractSlingScriptEngine(this) {
+                    public Object eval(Reader reader, ScriptContext context) throws ScriptException {
+                        throw initCause(new ScriptException("Cannot access output directory: " + path), e);
+                    }
+                };
+            }
+        }
+        return scriptEngine;
+    }
+
+    public String getLanguageName(){
+        return SHORT_NAME;
+    }
+
+    public String getLanguageVersion(){
+        return VERSION;
+    }
+
+    public String getOutDir() {
+        return outDir;
+    }
+
+    // -----------------------------------------------------< private >---
+
+    private static Settings createSettings(Bundle[] bundles) {
+        Settings settings = new Settings();
+        URL[] bootUrls = getBootUrls(bundles[0]);
+        StringBuilder bootPath = new StringBuilder(settings.classpath().v());
+        for (int k = 0; k < bootUrls.length; k++) {
+            bootPath.append(PATH_SEPARATOR).append(bootUrls[k].getPath());
+        }
+
+        settings.classpath().v_$eq(bootPath.toString());
+        return settings;
+    }
+
+    private static AbstractFile[] createClassPath(Bundle[] bundles) {
+        AbstractFile[] bundleFs = new AbstractFile[bundles.length];
+        for (int k = 0; k < bundles.length; k++) {
+            URL url = bundles[k].getResource("/");
+            if ("file".equals(url.getProtocol())) {
+                try {
+                    bundleFs[k] = new PlainFile(new File(url.toURI()));
+                }
+                catch (URISyntaxException e) {
+                    throw initCause(new IllegalArgumentException("Can't determine url of bundle " + k), e);
+                }
+            }
+            else {
+                bundleFs[k] = BundleFS.create(bundles[k]);
+            }
+        }
+        return bundleFs;
+    }
+
+    private AbstractFile createFolder(String path) throws RepositoryException {
+        Session session = repository.loginAdministrative(null);
+        Node node = (Node) session.getItem(path);
+        return JcrFS.create(node);
+    }
+
+    private static URL[] getBootUrls(Bundle bundle) {
+        ArrayList<URL> urls = new ArrayList<URL>();
+        ClassLoader classLoader = bundle.getClass().getClassLoader();
+        while (classLoader != null) {
+            if (classLoader instanceof URLClassLoader) {
+                urls.addAll(Arrays.asList(((URLClassLoader) classLoader).getURLs()));
+            }
+            classLoader = classLoader.getParent();
+        }
+
+        return urls.toArray(new URL[urls.size()]);
+    }
+
+}
+
+

Propchange: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngineFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/scripting/scala/engine/src/main/java/org/apache/sling/scripting/scala/engine/ScalaScriptEngineFactory.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/DISCLAIMER?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/DISCLAIMER (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/DISCLAIMER Mon Feb  2 12:22:19 2009
@@ -0,0 +1,7 @@
+Apache Sling is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Jackrabbit PMC. Incubation is required of all newly accepted
+projects until a further review indicates that the infrastructure, communications,
+and decision making process have stabilized in a manner consistent with other
+successful ASF projects. While incubation status is not necessarily a reflection of
+the completeness or stability of the code, it does indicate that the project has yet
+to be fully endorsed by the ASF.
\ No newline at end of file

Added: incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/LICENSE?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/LICENSE (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/LICENSE Mon Feb  2 12:22:19 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.

Added: incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/LICENSE.scala
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/LICENSE.scala?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/LICENSE.scala (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/LICENSE.scala Mon Feb  2 12:22:19 2009
@@ -0,0 +1,35 @@
+SCALA LICENSE
+
+Copyright (c) 2002-2008 EPFL, Lausanne, unless otherwise specified.
+All rights reserved.
+
+This software was developed by the Programming Methods Laboratory of the
+Swiss Federal Institute of Technology (EPFL), Lausanne, Switzerland.
+
+Permission to use, copy, modify, and distribute this software in source
+or binary form for any purpose with or without fee is hereby granted,
+provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+   3. Neither the name of the EPFL nor the names of its contributors
+      may be used to endorse or promote products derived from this
+      software without specific prior written permission.
+
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.

Added: incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/NOTICE?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/NOTICE (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/main/resources/META-INF/NOTICE Mon Feb  2 12:22:19 2009
@@ -0,0 +1,8 @@
+Apache Sling Scripting Scala Support
+Copyright 2009 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software developed at
+EPFL, Lausanne, Copyright 2002-2009 (http://www.scala-lang.org/).

Added: incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.java?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.java (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.java Mon Feb  2 12:22:19 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.scripting.scala;
+
+import javax.script.ScriptEngineFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.sling.scripting.scala.engine.ScalaScriptEngineFactory;
+
+public class ScalaScriptEngineFactoryTest extends TestCase {
+
+    public void testScriptEngineFactoryInit() {
+        ScriptEngineFactory scalaEngineFactory = new ScalaScriptEngineFactory();
+        assertNotNull(scalaEngineFactory);
+    }
+
+    public void testScriptEngineFactoryEngine() {
+        try {
+            new ScalaScriptEngineFactory().getScriptEngine();
+            assertTrue("Expecting IllegalStateException", false);
+        }
+        catch (IllegalStateException e) {
+            // expected
+        }
+    }
+
+    public void testScriptEngineFactoryLanguage() {
+        String language = new ScalaScriptEngineFactory().getLanguageName();
+        assertEquals("scala", language);
+    }
+
+    public void testScriptEngineFactoryLanguageVersion() {
+        String version = new ScalaScriptEngineFactory().getLanguageVersion();
+        assertEquals("2.7.3", version);
+    }
+
+}

Propchange: incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineTest.java?rev=739973&view=auto
==============================================================================
--- incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineTest.java (added)
+++ incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineTest.java Mon Feb  2 12:22:19 2009
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.scripting.scala;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.naming.NamingException;
+import javax.script.ScriptException;
+
+import org.apache.sling.scripting.scala.interpreter.InterpreterException;
+import org.apache.sling.scripting.scala.interpreter.JcrFS;
+import org.apache.sling.scripting.scala.interpreter.ScalaBindings;
+import org.apache.sling.scripting.scala.interpreter.JcrFS.JcrNode;
+
+import scala.tools.nsc.io.AbstractFile;
+
+public class ScalaScriptEngineTest extends ScalaTestBase {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    public void testEvalString() throws ScriptException, InvocationTargetException {
+        String code = "print(1 + 2)";
+        assertEquals("3", evalScala(code));
+    }
+
+    public void testEvalError() throws InvocationTargetException {
+        String code = "syntax error";
+        try {
+            evalScala(code);
+            assertTrue("Expecting ScriptException", false);
+        }
+        catch (ScriptException e) {
+            // expected
+        }
+    }
+
+    public void testError() {
+        String err = "Some error here";
+        String code = "throw new Error(\"" + err + "\")";
+        try {
+            evalScala(code);
+            assertTrue("Expecting InvocationTargetException", false);
+        }
+        catch (ScriptException e) {
+            Throwable inner = e.getCause();
+            assertEquals("Inner exception is InterpreterException", InterpreterException.class, inner.getClass());
+            inner = inner.getCause();
+            assertEquals("Inner inner exception is java.lang.Error", Error.class, inner.getClass());
+            assertEquals("Inner inner exception message is \"" + err + "\"", err, inner.getMessage());
+        }
+    }
+
+    public void testEvalScript() throws URISyntaxException, IOException, ScriptException,
+            InvocationTargetException {
+
+        assertEquals("3", evalScalaScript("simple.scs"));
+    }
+
+    public void testNodeAccess() throws RepositoryException, NamingException, ScriptException, InvocationTargetException {
+        Node n = getTestRootNode();
+        String code = "print(n.getPath)";
+        ScalaBindings bindings = new ScalaBindings();
+        bindings.put("n", n, Node.class);
+        assertEquals(n.getPath(), evalScala(code, bindings));
+    }
+
+    public void testEvalJcr() throws RepositoryException, NamingException, ScriptException {
+        JcrNode appDir = JcrFS.create(getAppNode());
+        AbstractFile srcDir = appDir.subdirectoryNamed("srcdir");
+
+        ScalaBindings bindings = new ScalaBindings();
+        Date time = Calendar.getInstance().getTime();
+        bindings.put("msg", "Hello world", String.class);
+        bindings.put("time", time, Date.class);
+
+        AbstractFile src = srcDir.fileNamed("Testi");
+        PrintWriter writer = new PrintWriter(src.output());
+        writer.print("print(msg + \": \" + time)");
+        writer.close();
+
+        for(String name : new String[]{"org.apache.sling.scripting.scala.interpreter.Testi", "Testi"}) {
+            evalScala(name, src, bindings);
+        }
+    }
+
+}

Propchange: incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/scripting/scala/engine/src/test/java/org/apache/sling/scripting/scala/ScalaScriptEngineTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url



Mime
View raw message