34
Don Brown, Atlassian Plugins 2.0: The overview

Plugins 2.0: The Overview

Embed Size (px)

DESCRIPTION

Plugins have evolved in the past year, and the new plugin architecture will be incorporated in all products in 2009. This session dives into the detail of the new plugins system, guides developers on the best techniques and approaches and explores how the architecture will evolve further.Atlassian Speaker: Don BrownKey Takeaways: * In-depth look at plugins 2 * How-tos and code samples

Citation preview

Page 1: Plugins 2.0: The Overview

Don Brown, Atlassian

Plugins 2.0: The overview

Page 2: Plugins 2.0: The Overview

Confluence Team Hosted

Page 3: Plugins 2.0: The Overview

JIRA Studio

Page 4: Plugins 2.0: The Overview

Why do we need a new plugin framework?

Page 5: Plugins 2.0: The Overview

One feature * five products =

Dashboard

Page 6: Plugins 2.0: The Overview

Multiple teams across the globe

Gdańsk, Poland San Francisco, USA

Kuala Lumpur, Malaysia Sydney, Australia

Page 7: Plugins 2.0: The Overview

Plugin development slow

  Write plugin code   Build plugin   Copy plugin to

WEB-INF/lib   Start app   Discover bug   Wash, rinse, repeat

Page 8: Plugins 2.0: The Overview

Inconsistency between products

. . . Constructor injection? Setter injection? Pico? Spring?

Page 9: Plugins 2.0: The Overview

Plugins break on product upgrade

  Plugins have unrestricted access to application classes, objects, and configuration

  Broken plugins after a product upgrade make us look bad

Page 10: Plugins 2.0: The Overview

Plugins 2 gives you. . .

  Ability for plugins to depend on each other

  Ability for plugins to define their own extension points

  Consistent plugin development platform across products

  Better insulation of plugins from product changes

Page 11: Plugins 2.0: The Overview

Backwards compatibility

  Version 1 plugins - 100% compatible o WEB-INF/lib o Confluenceʼs dynamic plugins

  Version 2 (OSGi-based) plugins o Compatibility varies by product

Page 12: Plugins 2.0: The Overview

Which products?

  Crowd 1.5 ✔   FishEye 1.5 ✔   Crucible 1.5 ✔   Confluence 2.10 ✔   JIRA 4.0   Bamboo 2.3

Page 13: Plugins 2.0: The Overview

OSGi in one slide  Bundles contain code,

configuration, manifest metadata

 Runtime dependencies at Java package, service, and bundle levels

 Supports multiple versions of code

 Can share dynamic service objects

  Lifecycle: install, resolve, active, uninstall

Page 14: Plugins 2.0: The Overview

Goal - Minimal OSGi required

  Can we scale the learning curve to keep the easy plugins easy?

Page 15: Plugins 2.0: The Overview

Each team can “own” a bundle   Only JAX-RS exposed

  Complete freedom to switch to another JAX-RS implementation

  Can run multiple versions of the bundle side-by-side

Page 16: Plugins 2.0: The Overview

Features written once   Example: OpenSocial-

based dashboard as an OSGi plugin

  Written and owned by San Francisco team

  Contains UI, Shindig, internal services, SPI, and API

Page 17: Plugins 2.0: The Overview

Dynamic deployment = faster dev cycle   Without OSGi

1.  Code 2.  Compile 3.  Copy to WEB-INF/lib 4.  Restart application 5.  Test in browser

  With OSGi 1.  Code 2.  Build and push to

running web application

3.  Test in browser

. . . from code to browser in one or two seconds

Page 18: Plugins 2.0: The Overview

Standard plugin modules

  Servlet o  servlet o  servlet-filter o  servlet-listener o  servlet-context-

param

  Component o  component o  component-import

  Web Items o web-item o web-section

  Misc o module-type o web-resource

Page 19: Plugins 2.0: The Overview

Sandboxed plugins

Page 20: Plugins 2.0: The Overview

DEMO: Using Atlassian Plugins

Page 21: Plugins 2.0: The Overview

Plugins architecture

Page 22: Plugins 2.0: The Overview

Plugin descriptor  atlassian-plugin.xml <atlassian-plugin key="com.xyz.example" name="Example Plugin” plugins-version=“2”> <plugin-info> <description>A sample plugin</description> <version>1.0</version> </plugin-info> <servlet key=”test" name=”Test Servlet" class="com.xyz.TestServlet"> <description>An example servlet</description> </servlet></atlassian-plugin>

Page 23: Plugins 2.0: The Overview

Plugin descriptor - Hidden OSGi  atlassian-plugin.xml

<atlassian-plugin key="com.xyz.example" name="Example Plugin” plugins-version=“2”> … <component key=”myComponent" class="com.xyz.MyComponent” public=“true”> <interface>com.xyz.Component</interface> </component>

<component-import key=”otherComponent" interface="com.abc.OtherComponent” />

</atlassian-plugin>

Page 24: Plugins 2.0: The Overview

Plugin descriptor - Hidden OSGi  Generates atlassian-plugin-spring.xml

<beans …> <bean id=“myComponent class=“com.xyz.MyComponent” />

<osgi:service id=“myComponent_service” ref=“myComponent” interface=“com.xyz.Component” />

<osgi:reference id=“otherComponent" interface="com.abc.OtherComponent” /></beans>

Page 25: Plugins 2.0: The Overview

Plugin to bundle process   Goal: Allow simple

plugins with no OSGi knowledge

  Three types of plugins: o Simple - no OSGi o Moderate - OSGi

via plugin descriptor o Complex - OSGi

via Spring XML directly

Page 26: Plugins 2.0: The Overview

Plugins 2 showcase

Page 27: Plugins 2.0: The Overview

Atlassian Gadgets

Page 28: Plugins 2.0: The Overview

Shared Access Layer (SAL)

  Plugin upgrade framework

  Plugin settings   Job scheduling   i18n   Search   HTTP calls . . . and much more

Page 29: Plugins 2.0: The Overview

Atlassian REST Module Type

  Implemented as a dynamic module type

  Uses JAX-RS   Can be extended

by other plugins to add new data mappers

GET rest/name/1.0/bob

{ "firstName":”Bob", "lastName":"Smith" }

Page 30: Plugins 2.0: The Overview

Plugin Exchange Client

Uses REST plugin type for JSON, XML, and HTML

Page 31: Plugins 2.0: The Overview

Confluence Widget Connector

Widget types extendable via plugins

Page 32: Plugins 2.0: The Overview

And many more. . .   Applinks 2   Streams 2   Confluence Repository

Client   Template renderer   Team Hosted plugins   Studio plugins   All Crucible and

FishEye plugins   All OSGi bundles

Page 33: Plugins 2.0: The Overview

Join the fun!

Page 34: Plugins 2.0: The Overview

Questions