atlascamp 2014: a p2 plugin and a saas platform walk into a bar

63
June 3-5, 2014 | Berlin, Germany

Upload: atlassian

Post on 27-Jan-2015

133 views

Category:

Technology


0 download

DESCRIPTION

In order to build Atlassian Connect, we had to work around all the legacy code and architecture that made it impossible to scale P2 plugins in our hosted OnDemand platform in the first place. Learn how the Connect team jumped through flaming hoops, juggled sharp objects, and used non-existent technology not only to build Atlassian Connect, but new also tools and techniques useful to any plugin developer.

TRANSCRIPT

Page 1: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

June 3-5, 2014 | Berlin, Germany

Page 2: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

A P2 Plugin and a SaaS Platform Walk

Into a Bar…Jonathan Doklovic, Principal Developer, Atlassian

Page 3: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Stuff That Came out of Developing Atlassian Connect That Can Help

Make Writing P2 Plugins and Even Plain Old Java Projects Easier And

More Efficient

Jonathan Doklovic, Principal Developer, Atlassian

Page 4: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Nomenclature

Page 5: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 6: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

P2

Page 7: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

P2Connect Addons

Page 8: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 9: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 10: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 11: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

P2

Page 12: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

P2

Page 13: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

P2

Page 14: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Building Made Easy

Page 15: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Git Flow

Page 16: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Git Flow vs.

Page 17: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

GIT Flow + MavenK I S S Y O U R S A N I T Y G O O D B Y E

I want to merge A LOT

without conflicts!

Screw conflicts, I

want to change poms !

A LOT!

I want SNAPSHOTS!

I want to add files to your

working folder

I want to assume you only have one

master branch and commit to source control

myself!

Page 18: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Maven JGIT Flow Plugin

• No need to install git-flow!

• No maven-release-plugin!

• Smartly manages version changes between branches!

• Full GIT Flow lifecycle / merge strategy!

• Extra “goodies” for dealing with CI

K I S S T H E M A V E N R E L E A S E P L U G I N G O O D B Y E

bitbucket.org/atlassian/jgit-flow

Page 19: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Transformers Are Evil

Page 20: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}" /> ! <bundle-instructions> <Export-Package> com.atlassian.upm.api.util*;version="${upm.version}" </Export-Package> </bundle-instructions> </plugin-info> ! <component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" /> ! <component key="someComponent" class="com.atlassian.example.SomeComponentClass" /> !</atlassian-plugin>

atlassian-plugin.xml

Page 21: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 22: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 23: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 24: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 25: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 26: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan base-package="org.example"/> </beans>

Page 27: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan base-package="org.example"/> </beans>

@Component @Autowired

Page 28: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<atlassian-scanner:scan-indexes/> </beans>

Page 29: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

@Named@Inject@JiraComponent@ConfluenceComponent@ClasspathComponent

@ComponentImport

@ConfluenceImport@JiraImport

@ExportAsService@ExportAsDevService

Page 30: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Atlassian Spring Scanner

• No jar transforms!

• No runtime classpath scanning!

• Moves all component related things into java!

• Makes OSGi BND actually work!

• Compile time scanning == super fast plugin loads

K I S S T R A N S F O R M S A N D C L A S S PAT H S C A N N I N G G O O D B Y E

bitbucket.org/atlassian/atlassian-spring-scanner

Page 31: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

How Do You Install Nothing?

Page 32: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

P2 ==

Page 33: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 34: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 35: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 36: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 37: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 38: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 39: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 40: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 41: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 42: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 43: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 44: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Dynamic Plugin Modulesbitbucket.org/atlassian/atlassian-pocketknife

• Modules are registered as OSGi Services!

• Complete control over module lifecycle!

• Super fast startup!

• No longer confined to what’s in atlassian-plugin.xml!

M A G I C A L M O D U L E S A P P E A R A N D D I S A P P E A R

Page 45: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Live, Breathe and Eat Code; Spit Out Docs

Page 46: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 47: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

XSD

Page 48: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

XSD

Page 49: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 50: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

+

Page 51: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 52: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

json-schema Generator

• Generate json-schema from JAVA POJOs!

• Easy to use annotations!

• Schema can be validated with ANY json-schema validator!

• Plain Ol’ JAVA library can be embedded in anything

Page 53: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 54: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

json-schema + Maven

• Generate json-schema from JAVA POJOs!

• Easy to use annotations!

• Schema can be validated with ANY json-schema validator!

• Now embedded in a Maven plugin!

• Adds javadocs as schema descriptions!

• Compile time generation

Page 55: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 56: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 57: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 58: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 59: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 60: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar
Page 61: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

json-schemagen

bitbucket.org/atlassian/json-schemagen

• json-schema from JAVA POJO’s!

• Runs as a Maven plugin!

• Javadocs included in schema!

• Easily generate example code!

• Keep you docs in your DVCS!

• Never let your docs get out of date!

W R I T E C O D E N O T D O C S

Page 62: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

bitbucket.org/atlassian/jgit-f low

bitbucket.org/atlassian/atlassian-spring-scanner

bitbucket.org/atlassian/json-schemagen

bitbucket.org/atlassian/atlassian-pocketknife

Resources

Page 63: AtlasCamp 2014: A P2 Plugin and a SaaS Platform Walk Into a Bar

Get In TouchHere At AtlasCamp

[email protected]

@sysbliss