OSGi Community Event 2015
Apache Sling is an innovative web framework built on top of the Java Content Repository (JCR), that uses OSGi for its component model and fosters RESTful application design.</p>
Apache Sling is designed as a set of loosely coupled OSGi bundles aggregated into a single jar or war launcher. Extensibility is internally achieved by using OSGi services. Even though Sling was initially designed for JSR-283 content repositories, building on top of the OSGi service registry allows plugging in multiple data sources - resource providers in Sling parlance.
In this talk we will showcase the usage of OSGi extension points in Apache Sling which allows usage of multiple resource providers, from simple filesystem-based providers to complex ones like MongoDB or Cassandra. Running all providers at the same time allows Apache Sling to be used as a REST-based middleware for multiple data sources.
This talk will present how this extensibility allows plugging in multiple data sources.
Apache Sling as an OSGi-powered REST middleware - Robert Munteau
1. http://robert.muntea.nu @rombert
Apache Sling as a RESTful API gateway for your NoSQL datastores
Apache Sling as a RESTful API gateway
for your NoSQL datastores
Robert Munteanu, Adobe Systems
EclipseCon Europe 2015
2. http://robert.muntea.nu @rombert
Who I am
$DAYJOB
Adobe Experience
Manager
Apache Sling
Apache Jackrabbit
Apache Felix
FOSS
Apache Sling
MantisBT
Mylyn Connector for
MantisBT
Mylyn Connector for Review
Board
16. http://robert.muntea.nu @rombert
How do I get to handle a Resource?
1 GET /content/blog/posts/hello_world.json
2 ResourceResolver.resolve(...)
3 ServletResolver.resolveServlet(...)3
4 servlet.doGet(...)
17. http://robert.muntea.nu @rombert
What do clients see out of this?
Resource res = request.getResource();
// 1. reading ...
ValueMap properties = ↵
res.getValueMap();
String title = properties.get(“jcr:title”,↵
“Missing”);
Post post = res.adaptTo(Post.class);
title = post.getTitle();
19. http://robert.muntea.nu @rombert
What do clients see out of this?
Resource res = request.getResource();
// 2. writing ...
ValueMap properties = ↵
res.adaptTo(ValueMap.class);
String title = properties.put(“jcr:title”,↵
“Hello, world”);
Post post = res.adaptTo(Post.class);
post.setTitle(“Hello, world”);
res.getResourceResolver().commit();
22. http://robert.muntea.nu @rombert
More features
●
Eventing, Thread Pooling, Job Management,
Caching
●
Scripting: Groovy, Scala, JSP, Sightly, Java, Ruby,
Thymeleaf
●
Flexible resource rendering with resource types
●
Very extensible due to being internally powered
by OSGi – most extension points available to clients