incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling > Using Scala with Sling
Date Tue, 02 Feb 2010 13:55:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=SLING&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="http://cwiki.apache.org/confluence/display/SLING/Using+Scala+with+Sling">Using
Scala with Sling</a></h2>
    <h4>Page  <b>added</b> by             <a href="http://cwiki.apache.org/confluence/display/~mduerig@day.com">Michael
Dürig</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h1><a name="UsingScalawithSling-UsingScalawithSling"></a>Using
Scala with Sling</h1>

<p>Sling supports the <a href="http://www.scala-lang.org/" rel="nofollow">Scala</a>
programming language version 2.7.7 through optional modules located in <tt>/contrib/scripting/scala</tt>.</p>


<h2><a name="UsingScalawithSling-Installation"></a>Installation</h2>

<p>The following bundles are required for Scala support: scala-library, scala-compiler,
Scala Script Engine, Apache Sling Scala Scripting Configuration.</p>

<ul>
	<li>Start Sling</li>
</ul>


<ul>
	<li>Download the <a href="http://scala-tools.org/repo-releases/org/scala-lang-osgi/scala-library/2.7.7/scala-library-2.7.7.jar"
rel="nofollow">scala-library bundle</a> and the <a href="http://scala-tools.org/repo-releases/org/scala-lang-osgi/scala-compiler/2.7.7/scala-compiler-2.7.7.jar"
rel="nofollow">scala-compiler bundle</a> and install them using for example the <a
href="http://localhost:8080/system/console/bundles" rel="nofollow">Apache Felix Web Management
Console</a>.</li>
</ul>


<ul>
	<li>Install the Scala Script Engine bundle. Goto <tt>/contrib/scripting/scala/script</tt>
and type <tt>mvn org.apache.sling:maven-sling-plugin:install</tt>.</li>
</ul>


<ul>
	<li>Install the Apache Sling Scala Scripting Configuration bundle. Goto <tt>/contrib/scripting/scala/config</tt>
and type <tt>mvn org.apache.sling:maven-sling-plugin:install</tt>.</li>
</ul>



<h2><a name="UsingScalawithSling-ExamplesApplications"></a>Examples Applications</h2>

<p>There are two example applications available in <tt>/contrib/scripting/scala/samples</tt>:
A simple Hello World programm and a more advanced Forum application. The examples require
the Apache Sling Sample Path Based Resource Type Provider bundle. So lets install this bundle
first:</p>

<ul>
	<li>Goto <tt>/samples/path-based-rtp</tt> and type <tt>mvn org.apache.sling:maven-sling-plugin:install</tt>.</li>
</ul>


<p>Now the examples themselves:</p>

<ul>
	<li>Install the Scala for Sling Demo Application - Hello World bundle. Goto <tt>/contrib/scripting/scala/samples/hello-world</tt>
and type <tt>mvn org.apache.sling:maven-sling-plugin:install</tt>. The hello world
application is then available at <a href="http://localhost:8080/content/helloworld.html"
rel="nofollow">http://localhost:8080/content/helloworld.html</a></li>
</ul>


<ul>
	<li>Install the Scala for Sling Demo Application - Forum bundle. Goto <tt>/contrib/scripting/scala/samples/forum</tt>
and type <tt>mvn org.apache.sling:maven-sling-plugin:install</tt>. The form application
is the available at <a href="http://localhost:8080/content/forum.html?sling:authRequestLogin=true"
rel="nofollow">http://localhost:8080/content/forum.html?sling:authRequestLogin=true</a>.
When prompted for credentials use admin/admin.</li>
</ul>



<h2><a name="UsingScalawithSling-Configuration"></a>Configuration</h2>

<p>The Scala scripting bundle is configurable through the <a href="http://localhost:8080/system/console/configMgr"
rel="nofollow">Apache Felix Web Management Console</a> (PID: org.apache.sling.scripting.scala.config.SlingSettingsProvider).</p>

<ul>
	<li>Scala compiler options. Scala compiler settings as documented by <a href="http://www.scala-lang.org/docu/files/tools/scalac.html"
rel="nofollow"><tt>scalac &#45;help</tt></a>. Default is blank.</li>
</ul>


<ul>
	<li>Compiler output directory. Output directory for files generated by the Scala compiler.
Default is <tt>/var/classes</tt>.</li>
</ul>



<h2><a name="UsingScalawithSling-FurtherInformation"></a>Further Information</h2>

<p>See these <a href="http://people.apache.org/~mduerig/scala4sling/scala4sling.pdf"
rel="nofollow">session slides</a> for some further information.</p>
    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="http://cwiki.apache.org/confluence/display/SLING/Using+Scala+with+Sling">View
Online</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/SLING/Using+Scala+with+Sling?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message