Server Side OSGi with Apache Sling Felix Meschberger | Sr. Computer Scientist, Adobe Systems
About Felix Meschberger <ul><li>Senior Computer Scientist
fmeschbe@adobe.com
http://blog.meschberger.ch
OSGi Implementations @ Apache Felix </li><ul><li>Declarative Services
Configuration Admin
Metatype Services </li></ul><li>VP Apache Sling
OSGi Alliance Supporter </li></ul>
Agenda <ul><ul><li>Apache Sling
Why OSGi ?
What parts of OSGi ?
Advantages and Problems </li></ul></ul>
Apache Sling <ul><ul><li>REST based web framework
Content-driven (JCR, JSR-170/283)
Powered by OSGi
Scripting inside (Java Scripting, JSR-223)
Apache Open Source Projekt (http://sling.apache.org) </li></ul></ul>
Sling Architecture OSGi Framework Felix Web Console WebDAV Server browser filesystem debugger HTTP JSR-170/283 API JCR rep...
Sling is RESTful <ul><ul><li>URLs map to Resources </li><ul><li>Items in the JCR Repository
Files in the Filesystem
Content of Bundles </li></ul><li>HTTP Methods map to Script Names </li><ul><li>e.g. cars/POST.jsp
GET for reading only
Dilution: POST allowed for any changes (Create, Update, Delete) </li></ul><li>Content Negotiation </li><ul><li>Request URL...
Accept request header currently ignored </li></ul></ul></ul>
Sling URL Decomposition /content/cars/audi/s4.details.html
Sling is Object Oriented Web <ul><ul><li>Resources are the Object
Resources maintained in Resource Tree
Resources accessed by path in the Resource Tree
Request Method, Extension and Selectors define „Method“ to call
Resources are typed: </li><ul><li>Resource Type
Upcoming SlideShare
Loading in …5
×

Server-side OSGi with Apache Sling (OSGiDevCon 2011)

4,042 views
3,944 views

Published on

Apache Sling is an innovative REST based Web Framework which has been developped from the ground up as an OSGi based server side application. After a short introduction to Sling itself I will also show why OSGi has been chosen as the basis for the application.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,042
On SlideShare
0
From Embeds
0
Number of Embeds
171
Actions
Shares
0
Downloads
157
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Server-side OSGi with Apache Sling (OSGiDevCon 2011)

  1. 1. Server Side OSGi with Apache Sling Felix Meschberger | Sr. Computer Scientist, Adobe Systems
  2. 2. About Felix Meschberger <ul><li>Senior Computer Scientist
  3. 3. fmeschbe@adobe.com
  4. 4. http://blog.meschberger.ch
  5. 5. OSGi Implementations @ Apache Felix </li><ul><li>Declarative Services
  6. 6. Configuration Admin
  7. 7. Metatype Services </li></ul><li>VP Apache Sling
  8. 8. OSGi Alliance Supporter </li></ul>
  9. 9. Agenda <ul><ul><li>Apache Sling
  10. 10. Why OSGi ?
  11. 11. What parts of OSGi ?
  12. 12. Advantages and Problems </li></ul></ul>
  13. 13. Apache Sling <ul><ul><li>REST based web framework
  14. 14. Content-driven (JCR, JSR-170/283)
  15. 15. Powered by OSGi
  16. 16. Scripting inside (Java Scripting, JSR-223)
  17. 17. Apache Open Source Projekt (http://sling.apache.org) </li></ul></ul>
  18. 18. Sling Architecture OSGi Framework Felix Web Console WebDAV Server browser filesystem debugger HTTP JSR-170/283 API JCR repository resource resolution servlet resolution standard servlets custom servlets JSR223 Scripting JSP javascript etc.
  19. 19. Sling is RESTful <ul><ul><li>URLs map to Resources </li><ul><li>Items in the JCR Repository
  20. 20. Files in the Filesystem
  21. 21. Content of Bundles </li></ul><li>HTTP Methods map to Script Names </li><ul><li>e.g. cars/POST.jsp
  22. 22. GET for reading only
  23. 23. Dilution: POST allowed for any changes (Create, Update, Delete) </li></ul><li>Content Negotiation </li><ul><li>Request URL extension
  24. 24. Accept request header currently ignored </li></ul></ul></ul>
  25. 25. Sling URL Decomposition /content/cars/audi/s4.details.html
  26. 26. Sling is Object Oriented Web <ul><ul><li>Resources are the Object
  27. 27. Resources maintained in Resource Tree
  28. 28. Resources accessed by path in the Resource Tree
  29. 29. Request Method, Extension and Selectors define „Method“ to call
  30. 30. Resources are typed: </li><ul><li>Resource Type
  31. 31. Resource Super Type
  32. 32. „Root Type“: sling/servlet/default </li></ul></ul></ul>
  33. 33. Functionality Out-Of-the-Box <ul><ul><li>Default Implementations for GET </li><ul><li>Plain Text
  34. 34. JSON
  35. 35. XML </li></ul><li>Default Implementation for POST </li><ul><li>Create, Update, Modify content
  36. 36. Extensible </li></ul></ul></ul>
  37. 37. Sling in Action <ul><ul><li>Day Communiqué 5 (http://www.day.com/cq5)
  38. 38. Sakai 3 (http://www.sakaiproject.org)
  39. 39. Tuberculosis Project
  40. 40. Idium Web (http://www.idium.no/no/idium_web)
  41. 41. http://cwiki.apache.org/SLING/who-is-using-sling-.html </li></ul></ul>
  42. 42. Agenda <ul><ul><li>Apache Sling
  43. 43. Why OSGi ?
  44. 44. What parts of OSGi ?
  45. 45. Advantages and Problems </li></ul></ul>
  46. 46. Requirements for Sling <ul><ul><li>Modular and Extensible System
  47. 47. Declared Dependencies
  48. 48. Intermodule Communication
  49. 49. Lightweight Framework </li></ul></ul>
  50. 50. Variants <ul><ul><li>Do It Yourself </li><ul><li>Well, don't we have other problems to solve ? ;-) </li></ul><li>Spring (before Spring DM) </li><ul><li>First Favourite due to declarative nature
  51. 51. Systems not really dynamic
  52. 52. Static application descriptor </li></ul><li>OSGi </li><ul><li>Perfect match to all requirements </li></ul></ul></ul>
  53. 53. Agenda <ul><ul><li>Apache Sling
  54. 54. Why OSGi ?
  55. 55. What parts of OSGi ?
  56. 56. Advantages and Problems </li></ul></ul>
  57. 57. OSGi Elements Used <ul><ul><li>Framework
  58. 58. Configuration Admin Service
  59. 59. Meta Type Service
  60. 60. Declarative Services
  61. 61. Event Admin Service
  62. 62. Log Service
  63. 63. HTTP Service </li></ul></ul>
  64. 64. Launching Sling <ul><ul><li>Standalone or Web Application
  65. 65. Small Footprint Launcher (~30K)
  66. 66. Framework in its own ClassLoader
  67. 67. Restart of Framework
  68. 68. Update of Framework
  69. 69. Application is Container Agnostic </li><ul><li>Interaction only within the OSGi Framework
  70. 70. Http Service implementation is the key </li></ul></ul></ul>
  71. 71. Configuration Admin Service <ul><ul><li>Provides an API to manage Configurations
  72. 72. Provides functionality to pass configuration to consumers
  73. 73. Hides persistance problems
  74. 74. Uses in Sling </li><ul><li>Web Console configuration editor
  75. 75. JCR Install updates through repository </li></ul></ul></ul>
  76. 76. Metatype Service <ul><ul><li>Descriptor to generate GUI for Configuration Management
  77. 77. Use in Sling </li><ul><li>Descriptor generated by Maven SCR Plugin
  78. 78. Configuration Admin GUI in Web Console supports Metatype Service descriptors </li></ul></ul></ul>
  79. 79. Declarative Services <ul><ul><li>Replace boiler-plate code by descriptors </li><ul><li>Service Registration
  80. 80. Configuration support
  81. 81. Service Access </li></ul><li>Dependency Injection
  82. 82. One of many OSGi Core Extensions: </li><ul><li>Apache Felix Dependency Manager (Predecessor)
  83. 83. Apache Felix iPOJO (Successor)
  84. 84. Blueprint (OSGi Compendium Specification R 4.2)
  85. 85. Peaberry </li></ul></ul></ul>
  86. 86. Event Admin Service <ul><ul><li>Whiteboard Pattern oriented eventing
  87. 87. Support for synchronous and asynchronous events
  88. 88. Uses in Sling </li><ul><li>Base Mechnism to implement Job Scheduling
  89. 89. Extended to allow for event distribution in Cluster </li></ul></ul></ul>
  90. 90. Log Service <ul><ul><li>Sling's own implementation
  91. 91. Based on SLF4J API
  92. 92. Provides </li><ul><li>OSGi LogService
  93. 93. SLF4J Logging
  94. 94. Commons Logging
  95. 95. Log4J Logging </li></ul><li>Dynamically Configurable (by Configuration Admin Service)
  96. 96. Log Levels and Log Format per Logger
  97. 97. Multiple Log Files with size and time rotation </li></ul></ul>
  98. 98. Http Service <ul><ul><li>Registering Servlets (and Resources) dynamically
  99. 99. Real Implementation </li><ul><li>Includes Servlet Container </li></ul><li>Bridged Implementation </li><ul><li>Used for Web Application Launcher
  100. 100. Bridges Servlet Container to OSGi </li></ul><li>Implementation transparent to registered Servlets </li></ul></ul>
  101. 101. Extensions <ul><ul><li>Apache Felix Web Console </li><ul><li>Extensible Web Based Management
  102. 102. JQuery UI Based (as of Version 3.0) </li></ul><li>Maven SCR Plugin (Apache Felix) </li><ul><li>Generates </li><ul><li>Declarative Services Descriptors
  103. 103. Metatype Service Descriptors </li></ul><li>Supports </li><ul><li>JavaDoc Tags (@scr.component, etc.)
  104. 104. Java 5 Annotations (@Component, etc.) </li></ul></ul><li>JCR Install (Apache Sling) </li><ul><li>Deploy Bundles via JCR Repository
  105. 105. Deploy Configuration Admin configurations via JCR Repository </li></ul></ul></ul>
  106. 106. Agenda <ul><ul><li>Apache Sling
  107. 107. Why OSGi ?
  108. 108. What parts of OSGi ?
  109. 109. Advantages and Problems </li></ul></ul>
  110. 110. Advantages <ul><ul><li>Declared Dependencies
  111. 111. Better Isolation through explicit exports and private classes
  112. 112. Classloader Isolation
  113. 113. Extensibility built-in, not built-ontop
  114. 114. Dynamism </li></ul></ul>
  115. 115. Problems <ul><ul><li>Steep Learning Curve </li><ul><li>OSGi Specifications Themselves
  116. 116. Modularization vs. Monolithic </li></ul><li>Uptime vs. Startup Time
  117. 117. Legacy Specs and ClassLoader </li><ul><li>JDBC, XML, etc. </li></ul><li>Scripting und ClassLoader </li><ul><li>BundleClassLoaderProxy approach </li></ul><li>Application Packaging </li><ul><li>CRX Content Packages (Adobe proprietary)
  118. 118. Karaf features (Sling provides feature.xml) </li></ul></ul></ul>
  119. 119. Links <ul><ul><li>Apache Sling The JCR (Web) Application Framework
  120. 120. http://sling.apache.org
  121. 121. Apache Felix OSGi Framework and Compendium Service implementations
  122. 122. http://felix.apache.org
  123. 123. Apache Jackrabbit The JCR (JSR-170/283) Reference Implementation
  124. 124. http://jackrabbit.apache.org
  125. 125. Day Developer's Home
  126. 126. http://dev.day.com </li></ul></ul>
  127. 127. Questions
  128. 128. Thank you very much !

×