Plugins 2.0: The Overview

1,915 views

Published on

Talk given at Atlassian Summit 2009 discussing the Atlassian Plugins 2 framework and how to build plugins using it.

Published in: Technology, Art & Photos
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,915
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
35
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Plugins 2.0: The Overview

  1. 1. Don Brown, Atlassian Plugins 2.0: The overview
  2. 2. Confluence Team Hosted
  3. 3. JIRA Studio
  4. 4. Why do we need a new plugin framework?
  5. 5. One feature * five products = Dashboard
  6. 6. Multiple teams across the globe Gda ń sk, Poland San Francisco, USA Kuala Lumpur, Malaysia Sydney, Australia
  7. 7. Plugin development slow <ul><li>Write plugin code </li></ul><ul><li>Build plugin </li></ul><ul><li>Copy plugin to WEB-INF/lib </li></ul><ul><li>Start app </li></ul><ul><li>Discover bug </li></ul><ul><li>Wash, rinse, repeat </li></ul>
  8. 8. Inconsistency between products . . . Constructor injection? Setter injection? Pico? Spring?
  9. 9. Plugins break on product upgrade <ul><li>Plugins have unrestricted access to application classes, objects, and configuration </li></ul><ul><li>Broken plugins after a product upgrade make us look bad </li></ul>
  10. 10. Plugins 2 gives you. . . <ul><li>Ability for plugins to depend on each other </li></ul><ul><li>Ability for plugins to define their own extension points </li></ul><ul><li>Consistent plugin development platform across products </li></ul><ul><li>Better insulation of plugins from product changes </li></ul>
  11. 11. Backwards compatibility <ul><li>Version 1 plugins - 100% compatible </li></ul><ul><ul><li>WEB-INF/lib </li></ul></ul><ul><ul><li>Confluence’s dynamic plugins </li></ul></ul><ul><li>Version 2 (OSGi-based) plugins </li></ul><ul><ul><li>Compatibility varies by product </li></ul></ul>
  12. 12. Which products? <ul><li>Crowd 1.5  </li></ul><ul><li>FishEye 1.5  </li></ul><ul><li>Crucible 1.5  </li></ul><ul><li>Confluence 2.10  </li></ul><ul><li>JIRA 4.0 </li></ul><ul><li>Bamboo 2.3 </li></ul>
  13. 13. OSGi in one slide <ul><li>Bundles contain code, configuration, manifest metadata </li></ul><ul><li>Runtime dependencies at Java package, service, and bundle levels </li></ul><ul><li>Supports multiple versions of code </li></ul><ul><li>Can share dynamic service objects </li></ul><ul><li>Lifecycle: install, resolve, active, uninstall </li></ul>
  14. 14. Goal - Minimal OSGi required <ul><li>Can we scale the learning curve to keep the easy plugins easy? </li></ul>
  15. 15. Each team can “own” a bundle <ul><li>Only JAX-RS exposed </li></ul><ul><li>Complete freedom to switch to another JAX-RS implementation </li></ul><ul><li>Can run multiple versions of the bundle side-by-side </li></ul>
  16. 16. Features written once <ul><li>Example: OpenSocial-based dashboard as an OSGi plugin </li></ul><ul><li>Written and owned by San Francisco team </li></ul><ul><li>Contains UI, Shindig, internal services, SPI, and API </li></ul>
  17. 17. Dynamic deployment = faster dev cycle <ul><li>Without OSGi </li></ul><ul><ul><li>Code </li></ul></ul><ul><ul><li>Compile </li></ul></ul><ul><ul><li>Copy to WEB-INF/lib </li></ul></ul><ul><ul><li>Restart application </li></ul></ul><ul><ul><li>Test in browser </li></ul></ul><ul><li>With OSGi </li></ul><ul><ul><li>Code </li></ul></ul><ul><ul><li>Build and push to running web application </li></ul></ul><ul><ul><li>Test in browser </li></ul></ul>. . . from code to browser in one or two seconds
  18. 18. Standard plugin modules <ul><li>Servlet </li></ul><ul><ul><li>servlet </li></ul></ul><ul><ul><li>servlet-filter </li></ul></ul><ul><ul><li>servlet-listener </li></ul></ul><ul><ul><li>servlet-context-param </li></ul></ul><ul><li>Component </li></ul><ul><ul><li>component </li></ul></ul><ul><ul><li>component-import </li></ul></ul><ul><li>Web Items </li></ul><ul><ul><li>web-item </li></ul></ul><ul><ul><li>web-section </li></ul></ul><ul><li>Misc </li></ul><ul><ul><li>module-type </li></ul></ul><ul><ul><li>web-resource </li></ul></ul>
  19. 19. Sandboxed plugins
  20. 20. DEMO: Using Atlassian Plugins
  21. 21. Plugins architecture
  22. 22. Plugin descriptor <ul><li>atlassian-plugin.xml </li></ul>< atlassian-plugin key = &quot;com.xyz.example&quot; name = &quot;Example Plugin ” plugins-version = “2” > < plugin-info > < description > A sample plugin </ description > < version > 1.0 </ version > </ plugin-info > < servlet key = ”test &quot; name = ”Test Servlet &quot; class = &quot;com.xyz.TestServlet&quot; > < description > An example servlet </ description > </ servlet > </ atlassian-plugin >
  23. 23. Plugin descriptor - Hidden OSGi <ul><li>atlassian-plugin.xml </li></ul><atlassian-plugin key= &quot;com.xyz.example&quot; name= &quot;Example Plugin” plugins-version= “2” > … < component key = ”myComponent &quot; class = &quot;com.xyz.MyComponent” public = “true” > < interface > com.xyz.Component </ interface > < / component > < component-import key = ”otherComponent &quot; interface = &quot;com.abc.OtherComponent” /> </atlassian-plugin>
  24. 24. Plugin descriptor - Hidden OSGi <ul><li>Generates atlassian-plugin-spring.xml </li></ul>< beans … > < bean id = “myComponent class = “com.xyz.MyComponent” /> < osgi:service id = “myComponent_service” ref = “myComponent” interface = “com.xyz.Component” /> < osgi:reference id = “otherComponent &quot; interface = &quot;com.abc.OtherComponent” /> </ beans >
  25. 25. Plugin to bundle process <ul><li>Goal: Allow simple plugins with no OSGi knowledge </li></ul><ul><li>Three types of plugins: </li></ul><ul><ul><li>Simple - no OSGi </li></ul></ul><ul><ul><li>Moderate - OSGi via plugin descriptor </li></ul></ul><ul><ul><li>Complex - OSGi via Spring XML directly </li></ul></ul>
  26. 26. Plugins 2 showcase
  27. 27. Atlassian Gadgets
  28. 28. Shared Access Layer (SAL) <ul><li>Plugin upgrade framework </li></ul><ul><li>Plugin settings </li></ul><ul><li>Job scheduling </li></ul><ul><li>i18n </li></ul><ul><li>Search </li></ul><ul><li>HTTP calls </li></ul><ul><li>. . . and much more </li></ul>
  29. 29. Atlassian REST Module Type <ul><li>Implemented as a dynamic module type </li></ul><ul><li>Uses JAX-RS </li></ul><ul><li>Can be extended by other plugins to add new data mappers </li></ul><ul><li>GET rest/name/1.0/bob </li></ul><ul><li>{ </li></ul><ul><li>&quot;firstName&quot;:”Bob&quot;, </li></ul><ul><li>&quot;lastName&quot;:&quot;Smith&quot; </li></ul><ul><li>} </li></ul>
  30. 30. Plugin Exchange Client <ul><li>Uses REST plugin type for JSON, XML, and HTML </li></ul>
  31. 31. Confluence Widget Connector <ul><li>Widget types extendable via plugins </li></ul>
  32. 32. And many more. . . <ul><li>Applinks 2 </li></ul><ul><li>Streams 2 </li></ul><ul><li>Confluence Repository Client </li></ul><ul><li>Template renderer </li></ul><ul><li>Team Hosted plugins </li></ul><ul><li>Studio plugins </li></ul><ul><li>All Crucible and FishEye plugins </li></ul><ul><li>All OSGi bundles </li></ul>
  33. 33. Join the fun!
  34. 34. Questions

×