Hi Vidar,

On Feb 6, 2008 5:35 PM, Vidar Ramdal <[EMAIL PROTECTED]> wrote:
> ...what we need from Sling is a way of mapping URLs to JCR
> nodes, and different ways of rendering/styling the content....

Sling will definitely help you here, taking care of the URL to node
mapping (called "resolving the resource" in slingspeak), and selection
and execution of scripts or servlets for rendering and styling.

>... Our system
> will also feature other functionality than just content management,
> like webshop, feedback forms etc., so we cannot depend on the JCR to
> store all of our application's data....

Ok - many of us JCR people believe that you can store most everything
in JCR, given the right content models. Yet, if you really need
something else, Sling's use of OSGi allows you to do whatever.

> ...Examples of how to build an application upon the Sling framework would
> be of great help to us....

We don't have any serious examples at the moment, this is definitely
next on our list once Sling and the Launchpad stabilize (which is
happening quickly as we speak), but nothing serious here and now
unfortunately.

> ...This page at http://incubator.apache.org/sling/site/sling-api.html
> leaves a lot to our imagination...

Agreed, a solid example would help a lot in understanding the
concepts, and some parts of that page ("Content and Component" in
particular) are obsolete.

> ...The term "Sling" seems to mean at least 3 different things. Sling and
> microsling in the Apache Sling project are implementations of the
> Sling API, thus making them Sling frameworks? Huh?...

Not anymore - microsling has been merged into Sling. What we have now
is Sling (the applications framework, implemented as a set of OSGi
modules, "bundles"), and the Sling Launchpad [1], which is a
ready-to-run assembly of such modules. We'll have examples for the
Launchpad...hopefully soon.

[1] http://incubator.apache.org/sling/site/discover-sling-in-15-minutes.html

> ...Should we:
> a) Build our application directly on top of Sling, extending Sling's
> interfaces and classes (would this make our application a "Sling
> framework"?) ;...

Part of your app will probably be implemented like this, but the more
you can use Sling components out of the box the easier it will be,
IMHO. And we're open to contributions for things that wouldn't match
your requirements, assuming the required changes are of general
interest.

> ...b) Run Sling as a standalone application, and let our application
> access Sling via RMI/JSON calls or whatever remote interfaces are
> available;...

Not recommended, and probably not needed.

> ...c) Build our functionality as an OSGi bundle, and run it side-by-side
> with the Sling bundles (although the concept of OSGi seems to be a bit
> overkill for our application);...

> ...d) Build our functionality as scripts that are stored in the
> repository (not really an option)...

A combination of c) and d) is how we envision Sling being used in most
cases: start by creating scripts to experiment and prototype, and
where needed moved to Servlets and other Java-based components,
provide as OSGi bundles.

Creating OSGi bundles is really easy with the Felix SCR plugin [2]: a
few annotations in classes that are OSGi services (like the Servlets
that Sling uses), setup the maven-scr-plugin in the module's Maven pom
and you're in business.

[2] http://felix.apache.org/site/maven-scr-plugin.html

For example, to make a plain Servlet usable by Sling, you'll only have
to add something like this in the class comments:

/**
 *  Minimal Sling Servlet example
 *
 *  Our servlet must be an SCR component:
 *  @scr.component
 *      immediate="true"
 *      metatype="false"
 *
 *  Our servlet must also be an SCR service:
 *  @scr.service
 *      interface="javax.servlet.Servlet"
 *
 *  And we tell Sling which Resource types we handle:
 *  @scr.property
 *      name="sling.servlet.resourceTypes"
 *      value="scr/test"
 */

This, and the Maven pom settings described in [2], are sufficient to
create an OSGi bundle that Sling can use to process and render content
for JCR nodes which have sling:resourceType=scr/test .

And Sling provides all the infrastructure to load, configure and
manage the modules, so you won't need to learn much about OSGi to be
able to plugin your Servlets and component into Sling.

Hope this helps - Sling is still a young project, so we don't have as
much examples and up to date documentation as we'd like, but if you're
willing to invest some time in playing with it, I'm sure the people on
this list would be happy to help.

-Bertrand

Reply via email to