Hi,

Am Samstag, den 01.03.2008, 22:55 +0100 schrieb Gert Vanthienen:
> L.S.,
> 
> 
> Ever since I first read about Sling on the Incubator website, it seemed 
> to have a lot of potential so I was eager to try it out.  This post is 
> actually just a 'reality check' to make sure I'm getting what the 
> project is really about and that I'm using it in a 'right' way (if such 
> a thing would exist) ...

I tend to agree with the saying "there is always more than one way to do
it" but with a grain of salt as in "... but there are better and not so
good ways"....

> Over the last few days, I have been trying to build a small demo 
> application with the Launchpad.  The application is a very lightweight 
> portal like solution, where pages consist of several blocks of related 
> information.  I modeled the pages as nodes in the repository and all the 
> 'portlets' on it as children of the page node.  The page renders a 
> layout page with placeholders and some JavaScript will load the 
> 'portlets' into their appropriate positions afterwards.  It seems to be 
> very easy to develop this with Sling taking care of the presentation of 
> a single block and the possibility to store any kind of information in 
> the 'portlet' nodes.  Is it a reasonable Sling use case though?

Sure. This is more or less how we envisioned Sling would be used.

> But now, I would like to add some dynamic content in there.  One piece 
> of dynamic content is an RSS feed.  At first, I was thinking of storing 
> the RSS url in the 'portlet' node and use JRuby or something to get the 
> data from the URL and transform it, but perhaps there is a better way to 
> make this kind of data available (e.g. to make every item in the RSS 
> feed a node of it's own) -- importing or mapping the data somehow.

I assume the RSS feed is foreign to your site, that is some third party
such as a news service providing the actual data. In this case, I also
think that you should not import the data into your site without an
actual need. Having the RSS url in your node and have the rendering
script (JRuby, JavaScript, whatever) access the URL and present the
results is probably not a bad idea.

<warning cause="I don't know the internals of RSS">
You might consider creating child nodes of your RSS nodes on the fly
representing the RSS items as URLs and then have the RSS items render
the item content by accessing it on the third party system. You might
then create some background task, which regularly updates the item
lists ...
</warning>

> 
> Secondly, my solution is fine for serving a lot of content in an easy to 
> maintain way for most of the site (which is the same for all the users), 
> but I would also need some of the content to be available based on the 
> user role.  There is no mention of authentication and authorisation on 
> the website and somewhere on the mailing list I read it is orthogonal to 
> Sling.  Does this mean I'll have to make a simple web application to do 
> the authentication and embed Sling in there somewhere for the more 
> content-based aspects of the site? 

Sling itself has no built in means of implementing access control. Sling
expects the JCR repository to enforce access control by implementing
appropriate mechanisms. Sling provides authentication support in that
Sling has a mechanism to extract credential details from an HTTP request
(such as HTTP BASIC authentication) and log into the JCR repository and
thus authenticate the request.

So, if the repository implements role-based access control, the Sling
application will be able to "support" it.

> 
> Finally, something completely different...  I'm spending some of my time 
> working on the Apache ServiceMix project and I also have a few customers 
> that I'm using it for.  ServiceMix is an ESB solution, but it doesn't 
> have a good message archiving console (yet?).  I was thinking to use 
> Sling for that as well.  It should be possible to archive the message 
> exchanges (just an XML body and some header properties) in a JCR 
> repository and use ESPs of JRuby scripts to transform the message into 
> HTML for the end users to interact with.  Given the fact that ServiceMix 
> is moving to OSGi as well for it's next major release (e.g. the 
> ServiceMix Kernel project), this seems like a very good match.  Any 
> thoughts or suggestions on this use case?

Certainly, this would be a very interesting match and - with my Apache
Felix hat on - I think this is a superb use case of proving how OSGi
enables the simple integration of basically different application into a
new use !

By storing your archived messages in appropriate structures using JCR
node types and/or setting the Sling resource type appropriately you can
easily combine your archive with a presentation of the archived data.
You may even integrate with the Sling OCM (object content mapping)
support (based on Jackrabbit OCM) to represent the messages as Java
objects in memory.


I hope, this helps and would be glad to hear about your experiences ! 

Regards
Felix

Reply via email to