Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Creating an all-purpose REST API for Cloud services using OSGi and Sling - C Ziegeler & D Bosschaert

547 views

Published on

OSGi Community Event 2014

Abstract:
Let's say you need to provide an internet service to your users. Chances are that your service should be available via REST. Let's say your service should both provide data to users as well as accept data posted by users, and possibly some logic. Now let's assume your service turns out to become incredibly popular, with lots and lots of users. Sounds like you need Sling and OSGi in the cloud.

In this talk Carsten and David will go through the OSGi and Sling architecture to achieve this. The talk outlines how the OSGi Cloud Ecosystems RFC is used in combination with Apache jclouds to achieve vendor independence. It also discusses how automatic scaling depending on measured load is achieved to ensure responsiveness. The resulting system is a dynamic cloud application handling any REST API, which can scale up and down depending on the need.

Speaker Bios:
David Bosschaert
David Bosschaert works for Adobe Research and Development. He spends the much of his time on technology relating to OSGi in Apache and other open source projects. He is also co-chair of the OSGi Enterprise Expert Group and an active participant in the OSGi Cloud efforts.

Before joining Adobe, David worked for Red Hat/JBoss and IONA Technologies in Dublin, Ireland.

Carsten Ziegeler
Carsten Ziegeler is senior developer at Adobe Research Switzerland and spends most of his time on architectural and infrastructure topics. Working for over 25 years in open source projects, Carsten is a member of the Apache Software Foundation and heavily participates in several Apache communities including Sling, Felix and ACE. He is a frequent speaker on technology and open source conferences and participates in the OSGi Core Platform and Enterprise expert groups.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Creating an all-purpose REST API for Cloud services using OSGi and Sling - C Ziegeler & D Bosschaert

  1. 1. Creating a REST API for Cloud services using OSGi and Sling Carsten Ziegeler and David Bosschaert © 2014 Adobe Systems Incorporated. All Rights Reserved. AAddoobbee CCoonnffddeennttiiaall..
  2. 2. Speakers ● David Bosschaert (davidb@apache.org) – R&D Adobe Research Dublin – Co-chair OSGi EEG – Open-source and cloud enthusiast ● Carsten Ziegeler (cziegeler@apache.org) – R&D Adobe Research Switzerland – OSGi Board, CPEG and EEG member – ASF member © 2014 Adobe Systems Incorporated. All Rights Reserved. AAddoobbee CCoonnffddeennttiiaall..
  3. 3. © 2014 Adobe Systems Incorporated. All Rights Reserved. AAddoobbee CCoonnffddeennttiiaall.. Agenda ●A REST site with Apache Sling ●Scale it up! with OSGi and jclouds
  4. 4. © 2014 Adobe Systems Incorporated. All Rights Reserved. AAddoobbee CCoonnffddeennttiiaall..
  5. 5. Te Next Great Application © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential.
  6. 6. ROA and REST ● htp://…/products.jsp?id=5643564 ● htp://…/slingshot/slingshot1/public/travel/pet.(html|json) © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential.
  7. 7. Resource Oriented Architecture ● Every piece of information is a resource ● User home, category, item, image, comment ● Descriptive URI ● Stateless web architecture (REST) ● Request contains all relevant information ● Targets the resource ● Leverage HTTP ● GET for rendering, POST/PUT/DELETE for operations © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential.
  8. 8. SlingShot Content Structure © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential. / slingshot1 slingshot2 public travel home pet images comments ratings pet.jpg
  9. 9. Resource-frst Request Processing ● Request: /slingshot1/public/travel/pet/comments.10.json ● Resource: /slingshot1/public/travel/pet/comments ● Extension: json ● Selector: 10 ● Method: GET ● Resource Type : slingshot/comments © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential.
  10. 10. Resource-frst Request processing 1. Resolve the resource 2. Resolve processing script 3. Build execution chain 4. Execute © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential.
  11. 11. Scripting Inside ● It’s your choice ● JSP, servlet, ESP, Scala, Sightly ● javax.script ● own script handlers ● Default servlets ● JSON, XML ● POST/update/create/delete handling ● Error handling © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential.
  12. 12. © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential. <sling:defineObjects/> <div class="comment"> <% final ValueMap attr = resource.getValueMap(); final String title = attr.get(PROPERTY_TITLE, resource.getName()); final String description = attr.get(PROPERTY_DESCRIPTION, ""); final String userId = attr.get(PROPERTY_USER, ""); %> <h4><%= ResponseUtil.escapeXml(userId) %> : <%= ResponseUtil.escapeXml(title) %></h4> <p><%= ResponseUtil.escapeXml(description) %></p> <p><%= ResponseUtil.escapeXml( attr.get(SlingshotConstants.PROPERTY_CREATED, "")) %></p> </div>
  13. 13. Resource Providers © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential. / slingshot1 public travel home pet images comments ratings pet.jpg MongoDB FS JCR Apache Jackrabbit
  14. 14. Scale UP! ● Efectively use the cloud ● Scale up/down based on need ● start small = cheap ● No downtime ● when moving to larger machines ● No cloud-provider specifcs © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential.
  15. 15. Sling OOSSGGii NNooddee © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential. 28/10/14 Sling in the cloud Load Balancer(s) OOSSGGii NNooddee Sling Director traffic
  16. 16. OOSSGGii NNooddee Sling © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential. Sling 28/10/14 Director OOSSGGii NNooddee Sling Director provision inspect discover OOSSGGii NNooddee Sling OOSSGGii NNooddee jclouds create destroy mmeettrriiccss OSGi Cloud Ecosystems (RFC 183) FrameworkNodeStatus Service
  17. 17. Sling OOSSGGii NNooddee Sling © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential. 28/10/14 Busy times Load Balancer(s) OOSSGGii NNooddee Sling Director traffic OOSSGGii NNooddee OOSSGGii NNooddee Sling
  18. 18. Sling © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential. 28/10/14 Quiet times Load Balancer(s) OOSSGGii NNooddee Director traffic
  19. 19. Sling Sling Sling Sling © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential. 28/10/14 Really Quiet times Load Balancer(s) OOSSGGii NNooddee Director Docker instances
  20. 20. Summary ● Use Sling to build your REST service ● Write your app using anything that can interact with REST ● Native app ● Javascript ● … ● Use OSGi Cloud Ecosystems, Apache jclouds and Docker to scale ● Be cloud-vendor independent! © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential.
  21. 21. Interested in OSGi and Cloud? ● Come to the OSGi Cloud Workshop Wednesday October 29 at 15:15 (Seminarräume 1-3) © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential.
  22. 22. Innovation at Adobe © 2014 Adobe Systems Incorporated. All Rights Reserved. Adobe Confdential. 22 Links ● Apache Sling – htp://sling.apache.org ● Apache jclouds – htp://jclouds.apache.org ● SlingShot Sample application – htp://svn.apache.org/repos/asf/sling/trunk/samples/slingshot ● OSGi Cloud Ecosystems RFC 183 – htps://github.com/osgi/design/tree/master/rfcs/rfc0183
  23. 23. © 2014 Adobe Systems Incorporated. All Rights Reserved. AAddoobbee CCoonnffddeennttiiaall..

×