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, 04 Jan 2011 13:16:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLING&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/SLING/Using+Scala+with+Sling">Using
Scala with Sling</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~mduerig@day.com">Michael
Dürig</a>
    </h4>
        <br/>
                         <h4>Changes (4)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-unchanged" >h1. Using Scala with Sling <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >Sling supports the [Scala|http://www.scala-lang.org/]
programming language version <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">2.7.7</span>
<span class="diff-added-words"style="background-color: #dfd;">2.8.1</span> through
optional modules located in {{/contrib/scripting/scala}}. <br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >* Start Sling <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >* Download the [scala-library
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">bundle|http://scala-tools.org/repo-releases/org/scala-lang-osgi/scala-library/2.7.7/scala-library-2.7.7.jar]</span>
<span class="diff-added-words"style="background-color: #dfd;">bundle|http://scala-tools.org/repo-releases/com/weiglewilczek/scala-lang-osgi/scala-library/2.8.1/scala-library-2.8.1.jar]</span>
and the [scala-compiler <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">bundle|http://scala-tools.org/repo-releases/org/scala-lang-osgi/scala-compiler/2.7.7/scala-compiler-2.7.7.jar]</span>
<span class="diff-added-words"style="background-color: #dfd;">bundle|http://scala-tools.org/repo-releases/com/weiglewilczek/scala-lang-osgi/scala-compiler/2.8.1/scala-compiler-2.8.1.jar]</span>
and install them using for example the [Apache Felix Web Management Console|http://localhost:8080/system/console/bundles].
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>* Install the Scala Script
Engine bundle. Goto {{/contrib/scripting/scala/script}} and type {{mvn org.apache.sling:maven-sling-plugin:install}}.
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h2. Further Information <br>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">See
these [session slides|http://people.apache.org/~mduerig/scala4sling/scala4sling.pdf] for some
further information. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">See
these session slides for further information: <br> <br>* [Jazoon 2009 | http://jazoon.com/portals/0/Content/ArchivWebsite/jazoon.com/jazoon09/en.html]:
[Scala for Sling | http://www.slideshare.net/michid/scala-sling] <br>* [Scala Days 2010
| http://days2010.scala-lang.org/]: [Scala for Scripting | http://www.slideshare.net/michid/scala-for-scriptinh]
<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <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/" class="external-link"
rel="nofollow">Scala</a> programming language version 2.8.1 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. <em>Note</em>:
In order to see the Scala scripting engine in action you can also use the Launchpad Contrib
Testing module which comes with all necessary bundles (including the examples) pre-installed.
See below.</p>

<h3><a name="UsingScalawithSling-Manualinstallation"></a>Manual installation</h3>
<ul>
	<li>Start Sling</li>
</ul>


<ul>
	<li>Download the <a href="http://scala-tools.org/repo-releases/com/weiglewilczek/scala-lang-osgi/scala-library/2.8.1/scala-library-2.8.1.jar"
class="external-link" rel="nofollow">scala-library bundle</a> and the <a href="http://scala-tools.org/repo-releases/com/weiglewilczek/scala-lang-osgi/scala-compiler/2.8.1/scala-compiler-2.8.1.jar"
class="external-link" rel="nofollow">scala-compiler bundle</a> and install them using
for example the <a href="http://localhost:8080/system/console/bundles" class="external-link"
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>


<h3><a name="UsingScalawithSling-UsingLaunchpadContribTesting"></a>Using
Launchpad Contrib Testing</h3>
<ul>
	<li>Goto <tt>/contrib/launchpad/testing</tt> and type <tt>mvn jetty:run
-Pjcrinstall-tests</tt> to start Sling.</li>
</ul>


<ul>
	<li>Sling is now running at <a href="http://localhost:8888/" class="external-link"
rel="nofollow">http://localhost:8888/</a>. All required bundles and examples are
pre-installed. See next section on how to access the examples. Remember to substitute the
port number with 8888!</li>
</ul>


<ul>
	<li>See <tt>/contrib/launchpad/testing/README.txt</tt> for details.</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"
class="external-link" 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"
class="external-link" 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"
class="external-link" 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"
class="external-link" 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 session slides for further information:</p>

<ul>
	<li><a href="http://jazoon.com/portals/0/Content/ArchivWebsite/jazoon.com/jazoon09/en.html"
class="external-link" rel="nofollow">Jazoon 2009 </a>: <a href="http://www.slideshare.net/michid/scala-sling"
class="external-link" rel="nofollow">Scala for Sling </a></li>
	<li><a href="http://days2010.scala-lang.org/" class="external-link" rel="nofollow">Scala
Days 2010 </a>: <a href="http://www.slideshare.net/michid/scala-for-scriptinh" class="external-link"
rel="nofollow">Scala for Scripting </a></li>
</ul>



    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/SLING/Using+Scala+with+Sling">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=12845530&revisedVersion=3&originalVersion=2">View
Changes</a>
                |
        <a href="https://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