Felix,

Thank you for your reply!

Felix Meschberger wrote:
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"....
That's exactly why I posted the questions in the first place, so I could avoid the not so good ways from the start...
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>
The RSS feed is an internal feed that has been developed on a mainframe system to provide a list of new articles that become available, so importing them wouldn't be a real issue here. And well, now that I come to think of it, I have written a (very simple) JCR component for Apache Camel a few months ago, so it's probably just a matter of configuring it with an RSS poller component. It might even be a good test for my JCR component, which has only been used in unit tests up to now ;)
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.
So basically, I just create my own web application with a few pages for authentication and embed the SlingServlet in there (like in the launchpad webapp) and Sling will propagate the web application credentials to the JCR container. Add role-based content would boil down to securing some child 'portlet' nodes to hide them from Sling when it determines the the 'portlets' to show on a page. Right?
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 !
You'll probably going to be able to follow my experiences though the beginner questions you'll be receiving on the mailing list ;). Since Sling doesn't have a user mailing list yet, is it OK if I keep posting them to the dev list instead?


Regards,

Gert

Reply via email to