is there any way to user sling whithout OSGi

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

is there any way to user sling whithout OSGi

tunggad
Hi cool Day Software developers,

With sling-lauchpad i have learn the first lessions about sling. i understand the concept of sling, how it ease the working with JCR.
But my question is now: how to use sling whithout OSGi (without Felix). Only request processing, script selection and scripting engine suffice for most
web apps. I think, the most developers, who would like to use sling, will integrate it into their own web app but do't use sling alone, whithout a server-side web framwork. For a normal web app is sling with Felix too heavy and complex.

To sum up all what i want to know:

- is there a version of sling-lauchpad without Felix?

and a tep better

- is there a version of sling-lauchpad whithout Felix and can be configured whit a existing repository. (dont use the buildin repository)


Thanks you all very much!



     

Reply | Threaded
Open this post in threaded view
|

Re: is there any way to user sling whithout OSGi

Torgeir Veimo

On 6 Sep 2008, at 08:55, tung vu duc wrote:

> Hi cool Day Software developers,

Am answering as a mere user, not related to Day..

> how to use sling whithout OSGi (without Felix).

This will be hard. I'd figure it would be easier to leave felix in,  
it's not too large.

> I think, the most developers, who would like to use sling, will  
> integrate it into their own web app but do't use sling alone,  
> whithout a server-side web framwork. For a normal web app is sling  
> with Felix too heavy and complex.

It's certainly possible to integrate into an existing webapp. You can  
extract the guts of the war file and embed into yours. The issue I  
think it to get a resource provider set up that can serve resources  
from the webapp, in addition to the sling repository, this would allow  
JSP files to reside in their usual places in your legacy applications  
WAR file.

A file system resource provider has already been implemented and is in  
the samples directory of the sling source. I believe this can be  
modified to use the servlet context getResource() method instead of  
using the filesystem directly. Search the mailing list for SLING-583  
to see some discussion on this topic and how to set up.

Secondly, sling can be set up to use an existing repository, there was  
some hints provided on the mailing list, but I don't remember the  
subject lines. Searching the mailing list should give some pointers.

--
Torgeir Veimo
[hidden email]





Reply | Threaded
Open this post in threaded view
|

Re: is there any way to user sling whithout OSGi

Bertrand Delacretaz
Hi,

On Sat, Sep 6, 2008 at 2:24 AM, Torgeir Veimo <[hidden email]> wrote:
> On 6 Sep 2008, at 08:55, tung vu duc wrote:

>>... how to use sling whithout OSGi (without Felix).
>
> This will be hard. I'd figure it would be easier to leave felix in, it's not
> too large...

Sure, and I don't think the Sling community is willing to support
non-OSGi setups at this time. We like it too much ;-)

Reusing specific parts of Sling outside of the OSGi world, however, is
certainly possible. But in general, you need OSGi to use Sling, and
that's where our focus is, as a community.

>> ...I think, the most developers, who would like to use sling, will integrate
>> it into their own web app but do't use sling alone, whithout a server-side
>> web framwork. For a normal web app is sling with Felix too heavy and
>> complex....

Depends on what a "normal" webapp is. Lots of Sling use cases don't
require any OSGi knowledge, you can go a long way just with scripting
in the repository. What kind of server-side web framework would you
use with Sling? You don't need any, unless I misunderstand the term.

And quite frankly, creating pluggable Sling servlets or components is
not that hard using the supplied Maven plugins. And there are other
ways that are not hard if you don't want to use Maven.

> ...Secondly, sling can be set up to use an existing repository, there was some
> hints provided on the mailing list, but I don't remember the subject lines.
> Searching the mailing list should give some pointers....

Replacing the jacrkabbit-server bundle by the jackrabbit-client one,
and configuring that with the repository access parameters, should be
enough for that.

-Bertrand

Reply | Threaded
Open this post in threaded view
|

Re: is there any way to user sling whithout OSGi

Torgeir Veimo

On 6 Sep 2008, at 16:19, Bertrand Delacretaz wrote:

> Replacing the jacrkabbit-server bundle by the jackrabbit-client one,
> and configuring that with the repository access parameters, should be
> enough for that.


Does that imply RMI?

--
Torgeir Veimo
[hidden email]





Reply | Threaded
Open this post in threaded view
|

Re: is there any way to user sling whithout OSGi

Bertrand Delacretaz
On Sat, Sep 6, 2008 at 9:40 AM, Torgeir Veimo <[hidden email]> wrote:
>
> On 6 Sep 2008, at 16:19, Bertrand Delacretaz wrote:
>
>> Replacing the jacrkabbit-server bundle by the jackrabbit-client one,
>> and configuring that with the repository access parameters, should be
>> enough for that.
>
> Does that imply RMI?

Yes, both RMI and JNDI are supported. If the repository name starts
with "rmi://", RMI is tried, otherwise it's assumed to be a JNDI name.

Details can be found in the RepositoryAccessor class, getRepository()
method [1].

-Bertrand

[1] http://svn.eu.apache.org/repos/asf/incubator/sling/trunk/jcr/base/src/main/java/org/apache/sling/jcr/base/util/RepositoryAccessor.java

Reply | Threaded
Open this post in threaded view
|

Re: is there any way to user sling whithout OSGi

tunggad
In reply to this post by tunggad

>Depends on what a "normal" webapp is. Lots of Sling use cases don't
>require any OSGi knowledge, you can go a long way just with scripting
>in the repository. What kind of server-side web framework would you
>use with Sling? You don't need any, unless I misunderstand the term.

>And quite frankly, creating pluggable Sling servlets or components is
>not that hard using the supplied Maven plugins. And there are other
>ways that are not hard if you don't want to use Maven.

Ok, i use Grails for my webapp, Grails internal uses Spring MVC. Grails supports other technologies via it's plugin mechanism.
Plugin in Grails means defining the servlets, servlet-filters and so of other Technology in the web.xml of Grails webapp.

So, which module of whole sling should i build now ? which servlets, filters and so of sling should be defined in Grails web.xml
(only org.apache.sling.launcher.webapp.SlingServlet? ). The dependencies .jars of Sling are bundled as OSGi-bundles, that means,
that Felix muss be started with when i launch my webapp. is there somethings to note?



     

Reply | Threaded
Open this post in threaded view
|

Re: is there any way to user sling whithout OSGi

Felix Meschberger-2
In reply to this post by Bertrand Delacretaz
Hi,

Bertrand Delacretaz schrieb:

> On Sat, Sep 6, 2008 at 9:40 AM, Torgeir Veimo <[hidden email]> wrote:
>> On 6 Sep 2008, at 16:19, Bertrand Delacretaz wrote:
>>
>>> Replacing the jacrkabbit-server bundle by the jackrabbit-client one,
>>> and configuring that with the repository access parameters, should be
>>> enough for that.
>> Does that imply RMI?
>
> Yes, both RMI and JNDI are supported. If the repository name starts
> with "rmi://", RMI is tried, otherwise it's assumed to be a JNDI name.

This should read "No, both RMI and JNDI are supported. ...." ;-)

Regards
Felix


>
> Details can be found in the RepositoryAccessor class, getRepository()
> method [1].
>
> -Bertrand
>
> [1] http://svn.eu.apache.org/repos/asf/incubator/sling/trunk/jcr/base/src/main/java/org/apache/sling/jcr/base/util/RepositoryAccessor.java
>

Reply | Threaded
Open this post in threaded view
|

Re: is there any way to user sling whithout OSGi

Felix Meschberger-2
In reply to this post by tunggad
Hi,

tung vu duc schrieb:

>> Depends on what a "normal" webapp is. Lots of Sling use cases don't
>> require any OSGi knowledge, you can go a long way just with scripting
>> in the repository. What kind of server-side web framework would you
>> use with Sling? You don't need any, unless I misunderstand the term.
>
>> And quite frankly, creating pluggable Sling servlets or components is
>> not that hard using the supplied Maven plugins. And there are other
>> ways that are not hard if you don't want to use Maven.
>
> Ok, i use Grails for my webapp, Grails internal uses Spring MVC. Grails supports other technologies via it's plugin mechanism.
> Plugin in Grails means defining the servlets, servlet-filters and so of other Technology in the web.xml of Grails webapp.
>
> So, which module of whole sling should i build now ? which servlets, filters and so of sling should be defined in Grails web.xml
> (only org.apache.sling.launcher.webapp.SlingServlet? ). The dependencies .jars of Sling are bundled as OSGi-bundles, that means,
> that Felix muss be started with when i launch my webapp. is there somethings to note?

As you may not the Felix Launchpad Web Application, is in effect just a
single Servlet, the SlingServlet. This is default to handle all requests
and does the following:

  * init(): Launches The Felix framework and installs all Sling
       Bundles into the framework (if launching the first time)
  * service(): Forwards to the SlingMainServlet, which is part
       of the Sling Engine bundle and which then uses the rest
       of Sling to select a script/servlet to handle the request
  * destroy(): Shuts down the Felix framework

So to integrate this into your web application, you just add the
SlingServlet (and its accompanying classes) and register the servlet in
the web application.

It may be possible to register the SlingServlet (and its required other
parts) into a Spring MVC. But we didn't test this (yet).

If you happen to succeed in this, we would be very gratefull for
documentation on the steps you did to achieve this !

Regards
Felix