You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2010/10/28 10:45:38 UTC

svn commit: r1028221 - in /sling/trunk/contrib: launchpad/testing/src/main/bundles/ scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/ scripting/scala/samples/forum/src/main/resources/content/apps/forum/ scripting/scala/scrip...

Author: cziegeler
Date: Thu Oct 28 08:45:37 2010
New Revision: 1028221

URL: http://svn.apache.org/viewvc?rev=1028221&view=rev
Log:
SLING-1856 : Scala Scripting: Upgrade to Scala 2.8. Apply patch from Michael Dürig

Removed:
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaClasspath.scala
Modified:
    sling/trunk/contrib/launchpad/testing/src/main/bundles/list.xml
    sling/trunk/contrib/scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/SlingScriptInfo.java
    sling/trunk/contrib/scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/SlingSettingsProvider.java
    sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/POST.scala
    sling/trunk/contrib/scripting/scala/script/pom.xml
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/AbstractScriptInfo.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/AbstractSettingsProvider.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/BacklogReporter.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/BundleFS.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/JcrFS.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/LogReporter.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngine.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngineFactory.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScriptInfo.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/SettingsProvider.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/Utils.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaCompiler.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaInterpreter.scala
    sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaSettings.scala
    sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/JcrFSTest.scala
    sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.scala
    sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterHelper.scala
    sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterTest.scala
    sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/Tests.scala

Modified: sling/trunk/contrib/launchpad/testing/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/testing/src/main/bundles/list.xml?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/launchpad/testing/src/main/bundles/list.xml (original)
+++ sling/trunk/contrib/launchpad/testing/src/main/bundles/list.xml Thu Oct 28 08:45:37 2010
@@ -40,14 +40,14 @@
             <version>0.9.0-SNAPSHOT</version>
         </bundle>
         <bundle>
-            <groupId>org.scala-lang-osgi</groupId>
+            <groupId>com.weiglewilczek.scala-lang-osgi</groupId>
             <artifactId>scala-library</artifactId>
-            <version>2.7.7</version>
+            <version>2.8.0</version>
         </bundle>
         <bundle>
-            <groupId>org.scala-lang-osgi</groupId>
+            <groupId>com.weiglewilczek.scala-lang-osgi</groupId>
             <artifactId>scala-compiler</artifactId>
-            <version>2.7.7</version>
+            <version>2.8.0</version>
         </bundle>
         <bundle>
             <groupId>org.apache.sling</groupId>

Modified: sling/trunk/contrib/scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/SlingScriptInfo.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/SlingScriptInfo.java?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/SlingScriptInfo.java (original)
+++ sling/trunk/contrib/scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/SlingScriptInfo.java Thu Oct 28 08:45:37 2010
@@ -29,7 +29,7 @@ import org.apache.sling.scripting.scala.
 
 /**
  * This {@link ScriptInfo} implementation provides the script class name
- * by retreiving it from the <code>ScriptContext</code>.
+ * by retrieving it from the <code>ScriptContext</code>.
  *
  * @scr.component
  * @scr.service

Modified: sling/trunk/contrib/scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/SlingSettingsProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/SlingSettingsProvider.java?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/SlingSettingsProvider.java (original)
+++ sling/trunk/contrib/scripting/scala/config/src/main/java/org/apache/sling/scripting/scala/config/SlingSettingsProvider.java Thu Oct 28 08:45:37 2010
@@ -23,6 +23,7 @@ import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Dictionary;
+import java.util.List;
 
 import javax.jcr.Item;
 import javax.jcr.Node;
@@ -43,6 +44,7 @@ import org.slf4j.LoggerFactory;
 
 import scala.tools.nsc.Settings;
 import scala.tools.nsc.io.AbstractFile;
+import scala.tools.nsc.io.Path;
 import scala.tools.nsc.io.PlainFile;
 
 /**
@@ -83,7 +85,7 @@ public class SlingSettingsProvider exten
     private Session session;
 
     @Override
-    public Settings getSettings() {
+    public Settings getSettings() throws ScriptException {
         ScalaSettings settings = new ScalaSettings();
         settings.parse(this.settings);
         Bundle[] bundles = context.getBundleContext().getBundles();
@@ -97,13 +99,14 @@ public class SlingSettingsProvider exten
             }
         }
         settings.classpath().v_$eq(bootPath.toString());
+        settings.outputDirs().setSingleOutput(getOutDir());
         return settings;
     }
 
     @Override
     public AbstractFile[] getClasspathX() {
         Bundle[] bundles = context.getBundleContext().getBundles();
-        AbstractFile[] bundleFs = new AbstractFile[bundles.length];
+        List<AbstractFile> bundleFs = new ArrayList<AbstractFile>();
         for (int k = 0; k < bundles.length; k++) {
             URL url = bundles[k].getResource("/");
             if (url == null) {
@@ -113,7 +116,7 @@ public class SlingSettingsProvider exten
             if (url != null) {
                 if ("file".equals(url.getProtocol())) {
                     try {
-                        bundleFs[k] = new PlainFile(new File(url.toURI()));
+                        bundleFs.add(new PlainFile(new Path(new File(url.toURI()))));
                     }
                     catch (URISyntaxException e) {
                         throw (IllegalArgumentException) new IllegalArgumentException(
@@ -121,32 +124,14 @@ public class SlingSettingsProvider exten
                     }
                 }
                 else {
-                    bundleFs[k] = BundleFS.create(bundles[k]);
+                    bundleFs.add(BundleFS.create(bundles[k]));
                 }
             }
             else {
                 log.warn("Cannot retreive resources from Bundle {}. Skipping.", bundles[k].getSymbolicName());
             }
         }
-        return bundleFs;
-    }
-
-    // todo use ClassLoaderWriter instead of JcrFs
-    @Override
-    public AbstractFile getOutDir() throws ScriptException {
-        try {
-            if (session == null) {
-                session = repository.loginAdministrative(null);
-            }
-            Node node = deepCreateNode(outDir, session, "sling:Folder");
-            if (node == null) {
-                throw new ScriptException("Unable to create node " + outDir);
-            }
-            return JcrFS.create(node);
-        }
-        catch (RepositoryException e) {
-            throw (ScriptException) new ScriptException("Unable to create node " + outDir).initCause(e);
-        }
+        return bundleFs.toArray(new AbstractFile[bundleFs.size()]);
     }
 
     // -----------------------------------------------------< SCR integration >---
@@ -167,6 +152,23 @@ public class SlingSettingsProvider exten
 
     // -----------------------------------------------------< private >---
 
+    // todo use ClassLoaderWriter instead of JcrFs
+    private AbstractFile getOutDir() throws ScriptException {
+        try {
+            if (session == null) {
+                session = repository.loginAdministrative(null);
+            }
+            Node node = deepCreateNode(outDir, session, "sling:Folder");
+            if (node == null) {
+                throw new ScriptException("Unable to create node " + outDir);
+            }
+            return JcrFS.create(node);
+        }
+        catch (RepositoryException e) {
+            throw (ScriptException) new ScriptException("Unable to create node " + outDir).initCause(e);
+        }
+    }
+
     private static URL[] getBootUrls(Bundle bundle) {
         ArrayList<URL> urls = new ArrayList<URL>();
         ClassLoader classLoader = bundle.getClass().getClassLoader();

Modified: 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=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/POST.scala (original)
+++ sling/trunk/contrib/scripting/scala/samples/forum/src/main/resources/content/apps/forum/POST.scala Thu Oct 28 08:45:37 2010
@@ -58,14 +58,14 @@ class POST(args: POSTArgs) {
   val session = request.getResourceResolver.adaptTo(classOf[Session])
   val path = resource.getPath
   
-  val newPath = {
+  val newPath: List[String] = {
     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
+    List(parentPath.split("/"):_*).filter(_ != "") ::: List(nodeName.mkString)
   }
   
   val node = 

Modified: sling/trunk/contrib/scripting/scala/script/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/pom.xml?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/pom.xml (original)
+++ sling/trunk/contrib/scripting/scala/script/pom.xml Thu Oct 28 08:45:37 2010
@@ -52,7 +52,7 @@
                     </execution>
                 </executions>
                 <configuration>
-                    <scalaVersion>2.7.7</scalaVersion>
+                    <scalaVersion>2.8.0</scalaVersion>
                 </configuration>
             </plugin>
 
@@ -128,13 +128,13 @@
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-library</artifactId>
-            <version>2.7.7</version>
+            <version>2.8.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.scala-lang</groupId>
             <artifactId>scala-compiler</artifactId>
-            <version>2.7.7</version>
+            <version>2.8.0</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/AbstractScriptInfo.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/AbstractScriptInfo.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/AbstractScriptInfo.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/AbstractScriptInfo.scala Thu Oct 28 08:45:37 2010
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import javax.script.{ScriptContext, ScriptException}
+package org.apache.sling.scripting.scala
 
-package org.apache.sling.scripting.scala {
+import javax.script.{ScriptContext, ScriptException}
 
 object AbstractScriptInfo {
   val SCALA_SCRIPT_CLASS = "scala.script.class"
@@ -52,5 +52,3 @@ abstract class AbstractScriptInfo(protec
   }
                  
 }
-
-}
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/AbstractSettingsProvider.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/AbstractSettingsProvider.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/AbstractSettingsProvider.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/AbstractSettingsProvider.scala Thu Oct 28 08:45:37 2010
@@ -14,17 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import javax.script.ScriptException;
+package org.apache.sling.scripting.scala 
 
+import javax.script.ScriptException;
 import org.apache.sling.scripting.scala.interpreter.ScalaInterpreter
 import org.slf4j.LoggerFactory
-
 import scala.tools.nsc.Settings
 import scala.tools.nsc.io.AbstractFile
 import scala.tools.nsc.reporters.Reporter
 
-package org.apache.sling.scripting.scala {
-
 /**
  * Abstract base implementation of a {@link SettingsProvider}. 
  */  
@@ -32,8 +30,7 @@ abstract class AbstractSettingsProvider 
   protected var settings: Settings = new Settings
   protected var reporter: Reporter = createReporter(settings)
   protected var classpathX: Array[AbstractFile] = null
-  protected var outDir: AbstractFile = null
-  
+
   @throws(classOf[ScriptException])
   def setScalaSettings(settings: Settings): Boolean = {
     if (settings == null) {
@@ -79,21 +76,7 @@ abstract class AbstractSettingsProvider 
   @throws(classOf[ScriptException])
   def getClasspathX: Array[AbstractFile] = classpathX
 
-  @throws(classOf[ScriptException])
-  def setOutDir(outDir: AbstractFile): Boolean = {
-    if (this.outDir != outDir) {
-      this.outDir = outDir
-      true
-    }
-    else false
-  }
-  
-  @throws(classOf[ScriptException])
-  def getOutDir: AbstractFile = outDir
-
   protected def createReporter(settings: Settings) = 
     new LogReporter(LoggerFactory.getLogger(classOf[ScalaInterpreter]), settings);
   
-}
-
 }
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/BacklogReporter.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/BacklogReporter.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/BacklogReporter.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/BacklogReporter.scala Thu Oct 28 08:45:37 2010
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.sling.scripting.scala
+
 import scala.tools.nsc.Settings;
 import scala.tools.nsc.reporters.AbstractReporter;
 import scala.tools.nsc.util.Position;
 
-package org.apache.sling.scripting.scala {
-  
 object BacklogReporter {
   val DEFAULT_SIZE = 50
 }
@@ -62,14 +62,18 @@ class BacklogReporter(val settings: Sett
         case _ => "ERROR " 
       }
       
-      val source = pos.source match {
-        case Some(s) => s + " "
-        case _ => ""
+      val source = try {
+        pos.source + " "
+      }
+      catch {
+        case _: UnsupportedOperationException => ""
       } 
       
-      val line = pos.line match {
-        case Some(l) => "line " + l + " "
-        case _ => ""
+      val line = try {
+        "line " + pos.line + " "
+      }
+      catch {
+        case _: UnsupportedOperationException => ""
       }
       
       level + source + line + ": " + msg
@@ -78,5 +82,3 @@ class BacklogReporter(val settings: Sett
   }
 
 }
-
-}
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/BundleFS.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/BundleFS.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/BundleFS.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/BundleFS.scala Thu Oct 28 08:45:37 2010
@@ -14,17 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.sling.scripting.scala
+
 import java.net.URL
 import java.io.{File, IOException, InputStream}
-
 import org.apache.sling.scripting.scala.Utils.{valueOrElse, nullOrElse}
-
 import org.osgi.framework.Bundle
-
 import scala.tools.nsc.io.AbstractFile
 
-package org.apache.sling.scripting.scala {
-
 /**
  * Implementation of {@link AbstractFile} on top of a {@link org.osgi.framework.Bundle}
  */
@@ -48,6 +45,8 @@ object BundleFS {
        */
       def file: File = null
 
+      def absolute = this
+
       /**
        * @return last modification time or 0 if not known
        */
@@ -71,6 +70,15 @@ object BundleFS {
       @throws(classOf[IOException])
       def output = throw new IOException("not supported: output")
 
+      def create { unsupported }
+      def delete { unsupported }
+
+      def lookupNameUnchecked(name: String, directory: Boolean) = {
+        val file = lookupName(name, directory)
+        if (file == null) NonExistingFile
+        else file
+      }
+      
       private def getPathAndName(url: URL): (String, String) = {
         val u = url.getPath
         var k = u.length
@@ -94,7 +102,7 @@ object BundleFS {
        */
       def isDirectory: Boolean = true
 
-      def elements: Iterator[AbstractFile] = {
+      def iterator: Iterator[AbstractFile] = {
         new Iterator[AbstractFile]() {
           val dirs = bundle.getEntryPaths(fullName)
           
@@ -172,13 +180,11 @@ object BundleFS {
        */
       def isDirectory: Boolean = false
       override def sizeOption: Option[Int] = Some(bundle.getEntry(fullName).openConnection().getContentLength())
-      def elements: Iterator[AbstractFile] = Iterator.empty
+      def iterator: Iterator[AbstractFile] = Iterator.empty
       def lookupName(name: String, directory: Boolean): AbstractFile = null
     }
 
     new DirEntry(bundle.getResource("/"), null)
   }
 
-}
-
 }
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/JcrFS.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/JcrFS.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/JcrFS.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/JcrFS.scala Thu Oct 28 08:45:37 2010
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import scala.tools.nsc.io.AbstractFile
+package org.apache.sling.scripting.scala
+
 import java.io.{File, InputStream, OutputStream, IOException, ByteArrayOutputStream, ByteArrayInputStream}
 import javax.jcr.{Session, Node, Property}
 import org.apache.sling.scripting.scala.Utils.{nullOrElse, valueOrElse}
-
-package org.apache.sling.scripting.scala {
+import tools.nsc.io.AbstractFile
 
 /**
  * Implementation of {@link AbstractFile} on top of the {@link javax.jcr.Node}s
@@ -78,13 +78,15 @@ object JcrFS {
      */
     def path: String = node.getPath
 
-    def container: JcrNode = create(node.getParent)
+    def container: JcrNode = JcrFS.create(node.getParent)
 
     /**
      * @returns  null
      */
     def file: File = null
 
+    def absolute = this
+
     /**
      * @returns  the value of the jcr:lastModified property of either the jcr:content node
      *   beneath this node or from this node itself otherwise or 0 if this node does not
@@ -96,7 +98,6 @@ object JcrFS {
         if (node.hasProperty("jcr:lastModified")) node.getProperty("jcr:lastModified").getLong
         else 0
       }
-
     override def equals(other: Any): Boolean =
       other match {
         case that: JcrNode => this.path == that.path
@@ -104,6 +105,15 @@ object JcrFS {
       }
 
     override def hashCode: Int = path.hashCode
+
+    def create { unsupported }
+    def delete { unsupported }
+
+    def lookupNameUnchecked(name: String, directory: Boolean) = {
+      val file = lookupName(name, directory)
+      if (file == null) NonExistingFile
+      else file
+    }
   }
 
   case class JcrFolder(node: Node) extends JcrNode(node) {
@@ -128,7 +138,7 @@ object JcrFS {
     /**
      * @returns  the child nodes of this nodes which are either nt:file or nt:folder
      */
-    def elements: Iterator[JcrNode] =
+    def iterator: Iterator[JcrNode] =
       new Iterator[Node] {
         val childs = node.getNodes
         def hasNext = childs.hasNext
@@ -137,7 +147,7 @@ object JcrFS {
       .filter((node: Node) =>
         "nt:file" == node.getPrimaryNodeType.getName ||
         "nt:folder" == node.getPrimaryNodeType.getName)
-      .map((node: Node) => create(node))
+      .map((node: Node) => JcrFS.create(node))
 
     /**
      * Considers only child nodes which are wither nt:file or nt:folder
@@ -147,7 +157,7 @@ object JcrFS {
         val n = node.getNode(name)
         if (directory && "nt:folder" == n.getPrimaryNodeType.getName ||
            !directory && "nt:file" == n.getPrimaryNodeType.getName)
-          create(n)
+          JcrFS.create(n)
         else
           null
       }
@@ -168,7 +178,7 @@ object JcrFS {
         content.setProperty("jcr:data", emptyInputStream)
         content.setProperty("jcr:lastModified", System.currentTimeMillis)
         node.save()
-        create(file)
+        JcrFS.create(file)
       }
     }
 
@@ -181,7 +191,7 @@ object JcrFS {
       valueOrElse(lookupName(name, true)) {
         val dir = node.addNode(name, "nt:folder")
         node.save()
-        create(dir)
+        JcrFS.create(dir)
       }
     }
   }
@@ -245,10 +255,8 @@ object JcrFS {
       else Some(p.getLength.toInt)
     }
 
-    def elements: Iterator[AbstractFile] = Iterator.empty
+    def iterator: Iterator[AbstractFile] = Iterator.empty
     def lookupName(name: String, directory: Boolean): AbstractFile = null
   }
 
-}
-
-}
+}
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/LogReporter.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/LogReporter.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/LogReporter.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/LogReporter.scala Thu Oct 28 08:45:37 2010
@@ -14,13 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import org.slf4j.Logger
+package org.apache.sling.scripting.scala
 
+import org.slf4j.Logger
 import scala.tools.nsc.Settings
 import scala.tools.nsc.util.Position
 
-package org.apache.sling.scripting.scala {
-  
 class LogReporter(logger: Logger, settings: Settings) extends BacklogReporter(settings) {
 
   override def display(pos: Position, msg: String, severity: Severity) {
@@ -33,6 +32,4 @@ class LogReporter(logger: Logger, settin
     }
   }
   
-}
-
 }
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngine.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngine.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngine.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngine.scala Thu Oct 28 08:45:37 2010
@@ -14,21 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.sling.scripting.scala
+
 import java.io.{BufferedReader, Reader, IOException, OutputStream, InputStream}
 import java.util.concurrent.locks.{ReadWriteLock, ReentrantReadWriteLock}
-
-import javax.script.{AbstractScriptEngine, Bindings, SimpleBindings, ScriptEngineFactory,
-  ScriptException, ScriptContext}
-
+import javax.script.{AbstractScriptEngine, Bindings, SimpleBindings, ScriptEngineFactory, ScriptException, ScriptContext}
 import org.apache.sling.scripting.scala.interpreter.{Bindings => ScalaBindings}
 import org.apache.sling.scripting.scala.Utils.makeIdentifier
-
 import org.slf4j.LoggerFactory
-
 import scala.tools.nsc.reporters.Reporter
 
-package org.apache.sling.scripting.scala {
-
 object ScalaScriptEngine {
   private val log = LoggerFactory.getLogger(classOf[ScalaScriptEngine]);
   private val NL = System.getProperty("line.separator");
@@ -100,7 +95,7 @@ class ScalaScriptEngine(factory: ScalaSc
       val bindings = context.getBindings(ScriptContext.ENGINE_SCOPE)
       val scalaBindings = ScalaBindings()
 
-      import _root_.scala.collection.jcl.Conversions._
+      import scala.collection.JavaConversions.asSet
       for (val key <- bindings.keySet) {
         val value = bindings.get(key)
         if (value == null) log.debug("{} has null value. skipping", key)
@@ -109,9 +104,9 @@ class ScalaScriptEngine(factory: ScalaSc
 
       val scriptClass = scriptInfo.getScriptClass(script, context)
 
-      // xxx: Scripts need to be compiled everytime.
+      // xxx: Scripts need to be compiled every time.
       // The preamble for injecting the bindings into the script
-      // dependes on the actual types of the bindings. So effectively
+      // depends on the actual types of the bindings. So effectively
       // there is a specific script generated for each type of bindings.
       val interpreter = factory.getScalaInterpreter(context)
       var result: Reporter = writeLocked(rwLock) {
@@ -147,8 +142,10 @@ class ScalaScriptEngine(factory: ScalaSc
         outputStream.flush()
         result
       }
-      if (result.hasErrors) 
+      if (result.hasErrors)
         throw new ScriptException(result.toString)
+      else
+        result
     }
     catch {
       case e: ScriptException => throw e
@@ -179,5 +176,3 @@ class ScalaScriptEngine(factory: ScalaSc
   }    
       
 }
-
-}

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngineFactory.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngineFactory.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngineFactory.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScalaScriptEngineFactory.scala Thu Oct 28 08:45:37 2010
@@ -14,20 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.sling.scripting.scala
+
 import java.util.Collections
 import java.util.List
-
 import javax.script.{ScriptException, ScriptEngine, ScriptEngineFactory, ScriptContext}
-
 import org.apache.sling.scripting.scala.interpreter.ScalaInterpreter
 import org.slf4j.LoggerFactory
-
 import scala.tools.nsc.Settings
 import scala.tools.nsc.io.AbstractFile
 import scala.tools.nsc.reporters.Reporter
 
-package org.apache.sling.scripting.scala {
-
 object ScalaScriptEngineFactory {
   private val log = LoggerFactory.getLogger(classOf[ScalaScriptEngineFactory]);
   private val NL = System.getProperty("line.separator");
@@ -35,10 +32,9 @@ object ScalaScriptEngineFactory {
   val SCALA_SETTINGS = "scala.settings"
   val SCALA_REPORTER = "scala.reporter"
   val SCALA_CLASSPATH_X = "scala.classpath.x"
-  val SCALA_CLASS_DIR = "scala.classdir"
 
   val ENGINE_NAME = "Scala Scripting Engine"
-  val LANGUAGE_VERSION = "2.7.7"
+  val LANGUAGE_VERSION = "2.8.0"
   val ENGINE_VERSION = "0.9/scala " + LANGUAGE_VERSION
   val EXTENSIONS = Collections.singletonList("scala")
   val LANGUAGE_NAME = "Scala"
@@ -175,26 +171,16 @@ class ScalaScriptEngineFactory extends S
       case x => if (x != null) log.warn("Invalid classpathx: {}", x);
     }
     
-    context.getAttribute(SCALA_CLASS_DIR) match {
-      case outDir: AbstractFile => 
-        if (settingsProvider.setOutDir(outDir)) scalaInterpreter = null
-        
-      case x => if (x != null) log.warn("Invalid output directory: {}", x);
-    }
-    
     if (scalaInterpreter == null) {
       log.debug("Creating Scala script engine from settings {}", settingsProvider);
 
         scalaInterpreter = new ScalaInterpreter(
             settingsProvider.getSettings,
             settingsProvider.getReporter,
-            settingsProvider.getClasspathX,
-            settingsProvider.getOutDir);
+            settingsProvider.getClasspathX);
     }
 
     return scalaInterpreter;
   }
   
-}
-
 }
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScriptInfo.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScriptInfo.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScriptInfo.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/ScriptInfo.scala Thu Oct 28 08:45:37 2010
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import javax.script.{ScriptException, ScriptContext}
+package org.apache.sling.scripting.scala
 
-package org.apache.sling.scripting.scala {
+import javax.script.{ScriptException, ScriptContext}
 
 /**
  * A ScriptInfo instance provides information about Scala scripts.
@@ -34,5 +34,3 @@ trait ScriptInfo {
   @throws(classOf[ScriptException])
   def getScriptClass(script: String, context: ScriptContext): String
 }
-
-}
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/SettingsProvider.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/SettingsProvider.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/SettingsProvider.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/SettingsProvider.scala Thu Oct 28 08:45:37 2010
@@ -14,21 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import javax.script.ScriptException
+package org.apache.sling.scripting.scala
 
+import javax.script.ScriptException
 import scala.tools.nsc.Settings
 import scala.tools.nsc.io.AbstractFile
 import scala.tools.nsc.reporters.Reporter
 
-package org.apache.sling.scripting.scala {
-
 /**
  * Provides compiler settings to the {@link ScalaScriptEngineFactory}. 
  */  
 trait SettingsProvider {
   
   /**
-   * @return true if the passed value differes from the current value
+   * @return true if the passed value differs from the current value
    */
   @throws(classOf[ScriptException])
   def setScalaSettings(value: Settings): Boolean
@@ -37,7 +36,7 @@ trait SettingsProvider {
   def getSettings: Settings
   
   /**
-   * @return true if the passed value differes from the current value
+   * @return true if the passed value differs from the current value
    */
   @throws(classOf[ScriptException])
   def setReporter(reporter: Reporter): Boolean
@@ -46,22 +45,11 @@ trait SettingsProvider {
   def getReporter: Reporter
   
   /**
-   * @return true if the passed value differes from the current value
+   * @return true if the passed value differs from the current value
    */
   @throws(classOf[ScriptException])
   def setClasspathX(classpath: Array[AbstractFile]): Boolean
   
   @throws(classOf[ScriptException])
   def getClasspathX: Array[AbstractFile]
-  
-  /**
-   * @return true if the passed value differes from the current value
-   */
-  @throws(classOf[ScriptException])
-  def setOutDir(outDir: AbstractFile): Boolean
-  
-  @throws(classOf[ScriptException])
-  def getOutDir: AbstractFile
-}
-
 }
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/Utils.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/Utils.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/Utils.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/Utils.scala Thu Oct 28 08:45:37 2010
@@ -14,7 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.scripting.scala {
+package org.apache.sling.scripting.scala
+
+import tools.nsc.io.AbstractFile
+import java.io.{OutputStream, InputStream}
 
 /**
  * General purpose utility functions
@@ -103,4 +106,20 @@ object Utils {
   
 }
 
-}
\ No newline at end of file
+object NonExistingFile extends AbstractFile {
+  def name = null
+  def path = null
+  def absolute = this
+  def container = null
+  def file = null
+  def create { unsupported }
+  def delete { unsupported }
+  def isDirectory = false
+  def lastModified = 0
+  def input: InputStream = null
+  def output: OutputStream = null
+  def iterator: Iterator[AbstractFile] = Iterator.empty
+  def lookupName(name: String, directory: Boolean) = null
+  def lookupNameUnchecked(name: String, directory: Boolean) = this
+  override def exists = false
+}

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/Bindings.scala Thu Oct 28 08:45:37 2010
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import scala.collection._
+package org.apache.sling.scripting.scala.interpreter
 
-package org.apache.sling.scripting.scala.interpreter {
+import scala.collection._
 
 /**
  * Bindings of names to Values
@@ -95,27 +95,28 @@ trait Bindings extends Map[String, AnyRe
  * Default implementation of {@link Bindings} backed by a mutable Map
  */
 private class BindingsWrapper(map: mutable.Map[String, AnyRef]) extends Bindings {
-  def size: Int = map.size
-  def get(name: String) = map.get(name)
-  def elements: Iterator[(String, AnyRef)] = map.elements
+  def + [B >: AnyRef] (kv: (String, B)) = map + kv
+  def - (key: String) = map - key
   
-  def putValue(name: String, value: AnyRef) = 
+  override def size = map.size
+  override def get(name: String) = map.get(name)
+  override def iterator: Iterator[(String, AnyRef)] = map.elements
+
+  def putValue(name: String, value: AnyRef) =
     map.put(name, value) match {
       case Some(a) => a
       case None => null
     }
-  
 }
 
 object Bindings {
-  import _root_.scala.collection.jcl.Conversions.convertMap
-  
+  import scala.collection.JavaConversions.asMap
+
   def apply(): Bindings = new BindingsWrapper(new mutable.HashMap)
   def apply(map: mutable.Map[String, AnyRef]): Bindings = new BindingsWrapper(map)
   def apply(map: java.util.Map[String, AnyRef]): Bindings = new BindingsWrapper(map)
 }
 
-}
 
 
 

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaCompiler.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaCompiler.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaCompiler.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaCompiler.scala Thu Oct 28 08:45:37 2010
@@ -14,28 +14,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.sling.scripting.scala.interpreter
+
 import scala.tools.nsc.{Settings, Global}
 import scala.tools.nsc.io.AbstractFile
 import scala.tools.nsc.reporters.Reporter
-
-package org.apache.sling.scripting.scala.interpreter {
+import scala.tools.nsc.util.{ClassPath, MergedClassPath, DirectoryClassPath}
+import tools.nsc.backend.JavaPlatform
 
 /**
- * Extendend Scala compiler which supports a class path with {@link AbstractFile} entries.
+ * Extended Scala compiler which supports a class path with {@link AbstractFile} entries.
  * Note: this implementation does not support MSIL (.NET).
  */
 class ScalaCompiler(settings: Settings, reporter: Reporter, classes: Array[AbstractFile])
   extends Global(settings, reporter) {
 
-  override lazy val classPath0 = new ScalaClasspath(false && onlyPresentation)
-
-  override lazy val classPath = {
-    require(!forMSIL, "MSIL not supported")
-    new classPath0.BuildClasspath(settings.classpath.value, settings.sourcepath.value,
-      settings.outdir.value, settings.bootclasspath.value, settings.extdirs.value,
-      settings.Xcodebase.value, classes)
+  override lazy val classPath: ClassPath[AbstractFile] = {
+    val classPathOrig = platform match {
+      case p: JavaPlatform => p.classPath
+      case _ =>  throw new InterpreterException("Only JVM target supported")
     }
 
-}
+    val classPathNew = classes.map(c => new DirectoryClassPath(c, classPathOrig.context))
+    new MergedClassPath[AbstractFile](classPathOrig :: classPathNew.toList, classPathOrig.context)
+  }
 
-}
\ No newline at end of file
+  override def rootLoader: LazyType = new loaders.JavaPackageLoader(classPath)
+}

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaInterpreter.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaInterpreter.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaInterpreter.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaInterpreter.scala Thu Oct 28 08:45:37 2010
@@ -14,16 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import scala.tools.nsc.{Settings, Global}
+package org.apache.sling.scripting.scala.interpreter
+
 import scala.tools.nsc.interpreter.AbstractFileClassLoader
 import scala.tools.nsc.io.AbstractFile
 import scala.tools.nsc.reporters.Reporter
 import scala.tools.nsc.util.{SourceFile, BatchSourceFile}
-import java.net.URLClassLoader
-import java.io.{File, InputStream, OutputStream}
-import org.apache.sling.scripting.scala.Utils.{option}
-
-package org.apache.sling.scripting.scala.interpreter {
+import scala.tools.nsc.{FatalError, Settings, Global}
+import java.io.{InputStream, OutputStream}
+import org.apache.sling.scripting.scala.Utils.option
 
 /**
  * An interpreter for Scala scripts. Interpretation of scripts proceeds in the following steps:
@@ -36,39 +35,17 @@ package org.apache.sling.scripting.scala
  * @param settings  compiler settings
  * @param reporter  reporter for compilation
  * @param classes  additional classes for the classpath
- * @param outDir  ourput directory for the compiler
  */
-class ScalaInterpreter(settings: Settings, reporter: Reporter, classes: Array[AbstractFile],
-                       outDir: AbstractFile) {
-
-  /**
-   * Same as <code>ScalaInterpreter(settings, reporter, classes, null)</code>.
-   * @param settings
-   * @param reporter
-   * @param classes
-   * @return
-   */
-  def this(settings: Settings, reporter: Reporter, classes: Array[AbstractFile]) =
-    this(settings, reporter, classes, null)
+class ScalaInterpreter(settings: Settings, reporter: Reporter, classes: Array[AbstractFile]) {
 
   /**
    * Same as <code>ScalaInterpreter(settings, reporter, null, outDir)</code>.
    * @param settings
    * @param reporter
-   * @param outDir
-   * @return
-   */
-  def this(settings: Settings, reporter: Reporter, outDir: AbstractFile) =
-    this(settings, reporter, null, outDir)
-
-  /**
-   * Same as <code>ScalaInterpreter(settings, reporter, null, null)</code>.
-   * @param settings
-   * @param reporter
    * @return
    */
   def this(settings: Settings, reporter: Reporter) =
-    this(settings, reporter, null, null)
+    this(settings, reporter, Array.empty)
 
   /**
    * The parent class loader used for execution
@@ -78,11 +55,7 @@ class ScalaInterpreter(settings: Setting
   /**
    * The Scala compiler used for compilation
    */
-  protected val compiler: Global = {
-    val c = new ScalaCompiler(settings, reporter, classes)
-    if (outDir != null) c.genJVM.outputDir = outDir
-    c
-  }
+  protected val compiler: Global = new ScalaCompiler(settings, reporter, classes)
 
   /**
    * Generates a wrapper which contains variables declarations and implicit conversions
@@ -296,23 +269,6 @@ class ScalaInterpreter(settings: Setting
     interprete(name, source, bindings, option(in), option(out))
 
   /**
-   * Looks up the class file for a compiled script
-   * @param  name  script name
-   * @return  the class file or null if not found
-   */
-  def getClassFile(name: String): AbstractFile = {
-    var file: AbstractFile = compiler.genJVM.outputDir
-    val pathParts = name.split("[./]").toList
-    for (dirPart <- pathParts.init) {
-      file = file.lookupName(dirPart, true)
-      if (file == null) {
-        return null
-      }
-    }
-    file.lookupName(pathParts.last + ".class", false)
-  }
-
-  /**
    * Executes a compiled script
    * @param name  name of the script
    * @param bindings  variable bindings to pass to the script
@@ -324,7 +280,7 @@ class ScalaInterpreter(settings: Setting
   @throws(classOf[InterpreterException])
   def execute(name: String, bindings: Bindings, in: Option[InputStream], out: Option[OutputStream]): Reporter = {
     try {
-      val classLoader = new AbstractFileClassLoader(compiler.genJVM.outputDir, parentClassLoader)
+      val classLoader = new AbstractFileClassLoader(outputDir, parentClassLoader)
       val script = Class.forName(name + "Runner", true, classLoader)
       val initMethod = (script
         .getDeclaredMethods
@@ -368,7 +324,11 @@ class ScalaInterpreter(settings: Setting
   def execute(name: String, bindings: Bindings, in: InputStream, out: OutputStream): Reporter =
     execute(name, bindings, option(in), option(out))
 
-}
-
+  def outputDir = try {
+      settings.outputDirs.outputDirFor(null);
+    }
+    catch {
+      case e: FatalError => throw new InterpreterException(e) 
+    }
 
 }
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaSettings.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaSettings.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaSettings.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/main/scala/org/apache/sling/scripting/scala/interpreter/ScalaSettings.scala Thu Oct 28 08:45:37 2010
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import scala.tools.nsc.Settings
+package org.apache.sling.scripting.scala.interpreter
 
-package org.apache.sling.scripting.scala.interpreter {
+import scala.tools.nsc.Settings
 
 /**
  * Utility to parse Scala compiler settings from a string. This class
@@ -26,12 +26,6 @@ package org.apache.sling.scripting.scala
  */  
 class ScalaSettings(error: String => Unit) extends Settings(error) {
   def this() = this(Console.println)
-  
-  def parse(line: String) = {
-    def error(s: String): Nothing = throw new InterpreterException(s)
-    parseParams(line, error)
-  }
-  
+  def parse(line: String) = parseParams(splitParams(line))
 }
 
-}

Modified: sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/JcrFSTest.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/JcrFSTest.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/JcrFSTest.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/JcrFSTest.scala Thu Oct 28 08:45:37 2010
@@ -14,6 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.sling.scripting.scala
+
 import java.io.{PrintWriter, InputStreamReader}
 import javax.jcr.{Session, Repository, Node, SimpleCredentials}
 import junit.framework.TestCase
@@ -21,8 +23,6 @@ import junit.framework.Assert.{assertEqu
 import org.apache.sling.scripting.scala.JcrFS.{JcrNode, JcrFile, JcrFolder}
 import org.apache.jackrabbit.core.{TransientRepository}
 
-package org.apache.sling.scripting.scala {
-
 class JcrFSTest extends TestCase {
   var session: Session = null
   var repository: Repository = null
@@ -133,11 +133,9 @@ class JcrFSTest extends TestCase {
     assertEquals(11, file.sizeOption.get)
 
     val reader = new InputStreamReader(file.input)
-    val c = new Array[char](32)
+    val c = new Array[Char](32)
     reader.read(c)
     assertEquals("Hello world", new String(c, 0, 11))
   }
 
-}
-
-}
+}
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/ScalaScriptEngineFactoryTest.scala Thu Oct 28 08:45:37 2010
@@ -14,15 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import javax.script.{
-  ScriptEngine,
-  ScriptEngineFactory}
+package org.apache.sling.scripting.scala
 
 import junit.framework.TestCase
 import junit.framework.Assert._
 
-package org.apache.sling.scripting.scala {
-
 class ScalaScriptEngineFactoryTest extends TestCase {
 
   def testScriptEngineFactoryInit() {
@@ -47,9 +43,7 @@ class ScalaScriptEngineFactoryTest exten
 
   def testScriptEngineFactoryLanguageVersion() {
     val version = (new ScalaScriptEngineFactory).getLanguageVersion()
-    assertEquals("2.7.7", version)
+    assertEquals("2.8.0", version)
   }
   
-}
-
 }
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterHelper.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterHelper.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterHelper.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterHelper.scala Thu Oct 28 08:45:37 2010
@@ -14,18 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import java.io.{ByteArrayOutputStream, IOException, BufferedReader, FileReader, File}
-import java.net.URISyntaxException
+package org.apache.sling.scripting.scala.interpreter
 
+import java.io.ByteArrayOutputStream
 import javax.script.ScriptException
-
-import org.apache.sling.scripting.scala.interpreter.{ScalaInterpreter, Bindings}
-
 import scala.tools.nsc.Settings
 import scala.tools.nsc.io.AbstractFile
 import scala.tools.nsc.reporters.Reporter
-
-package org.apache.sling.scripting.scala.interpreter {
+import org.apache.sling.scripting.scala.BacklogReporter
 
 /**
  * Helper class for evaluating Scala scripts. 
@@ -73,9 +69,8 @@ class InterpreterHelper(val srcDir: Abst
   protected def createInterpreter: ScalaInterpreter = {
     val settings = getSettings
     settings.classpath.value = getClasspath
-    new ScalaInterpreter(settings, getReporter(settings), outDir)
+    settings.outputDirs.setSingleOutput(outDir)
+    new ScalaInterpreter(settings, getReporter(settings))
   }
 
-}
-
 }
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterTest.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterTest.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterTest.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/InterpreterTest.scala Thu Oct 28 08:45:37 2010
@@ -14,16 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import java.io.File
+package org.apache.sling.scripting.scala.interpreter
 
+import java.io.File
 import junit.framework.TestCase
-
 import org.apache.sling.scripting.scala.Utils.valueOrElse
-
 import scala.tools.nsc.io.PlainFile
 
-package org.apache.sling.scripting.scala.interpreter {
-
 /**
  * Standard test cases where files are read/written to/from the file system.
  */  
@@ -50,6 +47,4 @@ class InterpreterTest extends TestCase w
     interpreterHelper = null
   }
 
-}
-
 }
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/Tests.scala
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/Tests.scala?rev=1028221&r1=1028220&r2=1028221&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/Tests.scala (original)
+++ sling/trunk/contrib/scripting/scala/script/src/test/scala/org/apache/sling/scripting/scala/interpreter/Tests.scala Thu Oct 28 08:45:37 2010
@@ -14,14 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import junit.framework.Assert.{assertEquals, assertFalse, fail}
+package org.apache.sling.scripting.scala.interpreter
 
+import junit.framework.Assert.{assertEquals, assertFalse, fail}
 import java.io.PrintWriter
-
 import javax.script.ScriptException
 
-package org.apache.sling.scripting.scala.interpreter {
-
 /**
  * Generic test cases. Implementors inject an InterpreterHelper instance.  
  */  
@@ -93,6 +91,4 @@ trait Tests {
     assertEquals("Hello world: " + time, out.toString)
   }
 
-}
-
 }
\ No newline at end of file