Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose behind building of Apache Sling, Felix, Jackrabbit projects

I am asking a very basic question here.

Question is

I am using Apache Sling , Apache Jackrabbit, Apache Felix in my project as said by my instructor. I am trying to understand why these software is developed by Apache. I tried a lot on the internet,, but I didn't find any blog or wordpress blog, or any useful youtube video that explain all these projects. Can you explain me about these projects.

Why these projects developed?  What they do ?  and more questions like this 

Previously I found the same doubt with Apache Hadoop, but all the material that I found on net is sufficient for me to get a feel of this project. This time I am struggling with Sling, Felix, Jackrabbit.

I will be very thankful for you. Waiting for your kind response.

like image 678
devsda Avatar asked Jun 10 '13 06:06

devsda


People also ask

What is Apache Sling used for?

Apache Sling™ is a framework for RESTful web-applications based on an extensible content tree. In a nutshell, Sling maps HTTP request URLs to content resources based on the request's path, extension and selectors.

What is Apache Sling in AEM?

Apache Sling is an open source Web framework for the Java platform designed to create content-centric applications on top of a JSR-170-compliant (a.k.a. JCR) content repository such as Apache Jackrabbit.

Is Apache Felix a JCR implementation?

Apache Jackrabbit is the reference implementation of the JCR API. The JCR API is to manage content repositories; to manage, for example, web content.


2 Answers

The combination of Apache Jackrabbit, Apache Sling, and Apache Felix allows you to build web application.

Apache Jackrabbit is the reference implementation of the JCR API. The JCR API is to manage content repositories; to manage, for example, web content. A content repository is a mix between file system and a database.

The JCR API is specially made to deal with web content. Why use the JCR API, and why not use a relational database API? URLs are hierarchical, as in a file system. Relational databases don't easily support hierarchical access. Why not use a file system API? Because the JCR supports transactions, versioning, and a lot of other features that file system APIs don't support.

Apache Sling is a web framework based on the JCR API, and taking advantage of the features provided by the JCR API (15 Minute introduction).

Apache Felix is an OSGi container. It allows to seamlessly start, stop, and replace components of a web application (jar files, in a sense), while the web server is running. That means it allows you to change the application without having to restart the server.

like image 95
Thomas Mueller Avatar answered Sep 21 '22 12:09

Thomas Mueller


Sling in very simple terms could be described as a REST API for JCR. you can use http requests to manage content inside the repository.

Additionally, Sling provides a mechanism to render that content in different ways for web consumption. you can use scripts (JSP for example) and the java code (servlets, pojos, etc) in the Felix container to process requests and deliver a request.

When a request is made for a particular node, Sling looks up for a property called sling:resourceType, this is a lookup key for rendering scripts. Then the appropiate script is executed using the node as input.

You could write different kinds for renderers and then use it to display your content in different ways.

For example, you could write two scripts full.json.jsp and short.json.jsp and then use them to render the same node in two different ways:

/content/app/node.full.json  

OR

/content/app/node.short.json. 

Sling basically matches tokens in the request URL to select an appropriate script.

They have a really nice cheat sheet that explains how request resolution and rendering works

it is a bit more complex than this, since everything is organized in resources and components. you want to check their site for more info

like image 23
santiagozky Avatar answered Sep 18 '22 12:09

santiagozky