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.

OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)

19 views

Published on

OSGi Community Event 2018 Presentation by David Bosschaert (Adobe)

Abstract: OSGi lends itself well to develop extensible applications assembled from reusable modules, where a set of bundles together with a set of configurations deployed to a provisioned OSGi framework is the application.

While this works very well for the originally intended use-cases, maintaining and building large applications developed by multiple teams often requires to assemble multiple larger components for which there is limited support in OSGi as of today. This is especially true in cases where multiple groups of bundles, configuration, metadata, and other artifacts need to be combined.

In this talk we will introduce you to OSGi RFP-188, named OSGi Features, which defines the requirements on providing a solution. We'll establish a shared understanding of the problem space and how it relates to already available mechanisms in OSGi (like e.g. subsystems, deploymentadmin, startlevels, etc.) and will subsequently, review it in the context of some of the current (open source) solutions like Apache Karaf Features and Apache Sling Features and Bnd.

Published in: Technology
  • Be the first to comment

OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)

  1. 1. Feature Model, Where Art Thou? David Bosschaert & Karl Pauls – Adobe
  2. 2. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. David Bosschaert § Senior Computer Scientist @ Adobe § Member of the Apache Software Foundation § OSGi Enterprise Expert Group co-chair D
  3. 3. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Karl Pauls § Computer Scientist @ Adobe § Member of the Apache Software Foundation § PMC Member of Apache Felix and Sling (VP Apache Felix) § Co-Author OSGi in Action D
  4. 4. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Agenda § Requirements § Model § Building Blocks § Demo § Outlook § Q & A D
  5. 5. Requirements
  6. 6. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Why the Feature Model § Provisioning model, but then better § Focus on the Architect, Designer § Requirements at Sling § Prototype maturing § …Karaf, Eclipse, Subsystems, Bnd… D
  7. 7. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Requirements § Easily authorable via text file § 1:1 mapping of File ⇠⇢ Feature § Declarative Requirements and Capabilities § Inheritance § API Whitelisting § Extensible format § Compose an application [1] https://github.com/apache/sling-org-apache-sling-feature/blob/master/requirements.md D
  8. 8. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Feature Files § JSON § ID § Variables § Bundles § Configurations § Capabilities, Requirements § Custom Content § Can be published in Maven § Tooling and Runtime support in Sling, others can support too D7
  9. 9. Model
  10. 10. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Features 10 { "#": "A key that starts with a hash is a comment", "id": "org.apache.sling:my.app:feature:optional:1.0", "variables": { "cfgvar": "somedefault", "xyz-ver": "1.2.3" }, "framework-properties": { "foo": 1, "org.osgi.framework.storage": "${tempdir}", "org.apache.felix.scr.directory": "launchpad/scr" },
  11. 11. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Features (cont.) 11 "configurations": { "my.pid": { "foo": 5, "bar": "${cfgvar}", "# The tempdir variable is not specified at the variables section.": "# It needs to be provided at launch, otherwise the launch will stop.", "tempdir": "${tempdir}", "number:Integer": 7 }, "my.factory.pid~name": { "a.value":"yeah" } }
  12. 12. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Feartures (cont.) 12 "bundles": [ { "id": "org.apache.sling:security-server:2.2.0", "#": "This is the relative start order inside the feature", "start-order": 5 }, { "id": "org.apache.sling:another-bundle:2.1.0", "#": "OSGi start level is also supported", "start-level": 20, "configurations": { "#": "This configuration only gets applied when this bundle is resolved", "org.apache.sling.somepid": { "dbuser": "${dbuser}", "dbpass": "${dbpass}" } } } ],
  13. 13. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Features (cont.) 13 "includes": { "id": "org.apache.sling:sling:9", "removals": { "configurations": [], "bundles": [], "framework-properties": [] } }
  14. 14. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Features (cont.) 14 "requirements": [ { "namespace": "osgi.contract", "directives": { "filter": "(&(osgi.contract=JavaServlet)(version=3.1))" } } ], "capabilities": [ { "namespace": "osgi.implementation", "attributes": { "osgi.implementation": "osgi.http", "version:Version": "1.1" }, "directives": { "uses": "javax.servlet,javax.servlet.http,org.osgi.service.http.context" } } ],
  15. 15. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. OSGi Framework API Whitelisting with Regions Bundle Bundle Bundle Product User Bundle Global Region Product Exported Packages: com.product.api org.apache.sling.api Internal Product Region Packages: com.product.commons exports imports D2 Product Exported Packages: com.product.api com.product.commons org.apache.sling.api
  16. 16. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Custom Metadata § Features can contain custom metadata § Text, JSON, or Artifact (IDs) § Processed by plugins on feature merge and execution § Default provided for repoinit and content-packages D1 "repoinit:JSON|true":[ "create path (sling:Folder) /libs", "create path (sling:Folder) /apps” ] , "content-packages:ARTIFACTS|true":[ ”org.apache.sling:org.foo.bar:zip:0.0.34” ]
  17. 17. Building Blocks
  18. 18. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Develop and publish feature models Feature Models Analyser slingfeature -maven- plugin Maven Repository D1
  19. 19. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Create a Running System Feature Models Maven Plugin Final system feature Launcher Running system Maven Repo/Cache Resolver D2
  20. 20. Building Blocks Applied
  21. 21. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Sling Feature Maven Plugin § Attach features in src/main/features as “.slingosgifeature” § org.apache.sling:slingfeature-maven-plugin:0.2.0-SNAPSHOT § New packaging type slingosgifeature § When <extensions>true</extensions> § attach-features § Attach feature files found in the project to the projects produced artifacts. This includes features found in src/main/features as well as features produce with the aggregate-features goal. § aggregate-features § Produce an aggregated feature from a list of features (a.k.a composition) § repository § Produce a local maven-structure cache with all artifacts referenced in specified features Documentation at https://github.com/apache/sling-slingfeature-maven-plugin
  22. 22. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Launcher Usage: .... -D <arg> Set framework properties -dao <arg> Only download required artifacts into directory -f <arg> Set feature files -fv <arg> Set felix framework version -p <arg> Set home dir -u <arg> Set repository url -V <arg> Set variable value > java -jar org.apache.sling.feature.launcher-0.1.0-SNAPSHOT.jar –f mvn:org.apache.sling/my.feature/1.0.0 Handlers for extension merging as well as extension execution as ServiceLoader services via classpath 23
  23. 23. Demo code at: https://github.com/bosschaert/example-featuremodel
  24. 24. Outlook + Summary
  25. 25. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Outlook § API Whitelisting § Resolver § Minimal Docker Containers § OSGi Specification process, Enterprise Expert Group RFP 188 (https://github.com/osgi/design) D3 Images licensed from Adobe Stock (https://stock.adobe.com)
  26. 26. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Evaluate the Sessions -1 0 +1 Sign in and vote at eclipsecon.org 27
  27. 27. Q&A
  28. 28. © 2018 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Acknowledgements § Why the feature model picture by shootforalivi35 licensed from Adobe Stock https://stock.adobe.com § Outlook background picture by volgariver licensed from Adobe Stock https://stock.adobe.com 29

×