using atlassian ual and activeobjects for rapid plugin development - atlascamp 2011

50

Upload: atlassian

Post on 17-Nov-2014

1.581 views

Category:

Technology


5 download

DESCRIPTION

The Atlassian Platform is full of great technologies to make your life easier. Learn how to leverage UAL and ActiveObjects as well as FishEye/Crucible's public SPI, in order to develop awesome plugins such as the new FishEye/Crucible to Bamboo integration plugin.Jason Hinch, FishEye & Crucible Developer

TRANSCRIPT

Page 1: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011
Page 2: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Jason HinchDeveloper, Atlassian

Rapid Development with ActiveObjects

2

Page 3: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• FishEye/Crucible front-end team• Java, Python and JavaScript

• 18 months at Atlassian• Previously:

• Confluence Plugins

• Perl Development

About Me

3

Page 4: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Why ActiveObjects?• What is ActiveObjects?• Getting Started• Defining an Entity• CRUD with ActiveObjects• Upgrade tasks• Testing

Agenda

4

Page 5: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Bamboo data and actions from FishEye/Crucible• Commit Graph• Changeset• Review• Triggering Builds

The Idea

5

Page 6: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Quick Demo

6

Page 7: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Fetching data from Bamboo• Dependency on External System• Large amount of data, fast

• Cache data in FishEye• Storage• Backup & Restore

The First Problem

7

Page 8: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• In Memory Cache• Flat Files (Java/XML/JSON serialisation)• SAL property sets• Plugin managed database

Previous Solutions

8

Page 9: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

ActiveObjects

9

Page 10: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Can refer to two different projects• ActiveObjects Library

• Atlassian ActiveObjects Framework

ActiveObjects - What?

10

Page 11: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Lightweight ORM• Annotation based DDL

• Create/Read/Update/Delete (CRUD)

• Upgrades

• Built on JDK Technologies• Java Dynamic Proxies

• JDBC

ActiveObjects Library

11

Page 12: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Superset of ActiveObjects Library• Plugin data in the application database• Adds support for Atlassian application lifecycle

• Backup/Restore

• SAL Transactions

• Plugin lifecycle

ActiveObjects Framework

12

Page 13: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• ActiveObjects Library• net.java.ao*

• http://java.net/projects/activeobjects/pages/Home

• ActiveObjects Framework• com.atlassian.activeobjects*

• https://studio.atlassian.com/wiki/display/AO

AO Library vs Framework

13

Page 14: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• FishEye 2.7.0 and above

• Crucible 2.7.0 and above

• JIRA 4.4 and above

Supported Products

14

Page 15: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Implements Active Record Pattern• Class/Interface maps to a table

• Object instance maps to a row in the table

• Ruby on Rails, Django, CakePHP use this pattern

ActiveObjects Philosophy

15

Page 16: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Getting Started

16

Page 17: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

pom.xml

17

Page 18: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

atlassian-plugin.xml

18

Page 19: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Defining an Entity

19

Page 20: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Interface• Extends RawEntity (or subclass)

Defining an Entity

20

Page 21: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Entity interface

21

Page 22: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

RawEntity interface

22

Page 23: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Entity -> SQL Table

23

Page 24: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Entity -> SQL Table

24

Page 25: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

25

CRUD

Create

DeleteUpdate

Read

Page 26: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Create

26

Page 27: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Read

27

Page 28: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Read

28

Page 29: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Update

29

Page 30: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Delete

30

Page 31: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Transactions

31

Page 32: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Change Model between versions• Data Migration

• Upgrades already run

The Second Problem

32

Page 33: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Versioned• Schema Migrations• Data population / manipulation

Upgrade Tasks

33

Page 34: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

atlassian-plugin.xml

34

Page 35: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

ActiveObjectsUpgradeTask

35

Page 36: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Importing Data

36

Page 37: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Entity• Add / Remove from ao.migrate call

• Field• Add / Remove from Entity definition

Adding / Deleting

37

Page 38: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Renaming

38

Page 39: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Renaming

39

Page 40: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Renaming

40

Page 41: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Renaming

41

Page 42: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Renaming

42

Page 43: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Test the code• Multiple Databases• More Power & Trust -> More Responsibility

Third First Problem

43

Page 44: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

pom.xml

44

Page 45: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

ActiveObjectsJUnitRunner

45

Page 46: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Initialising Data

46

Page 47: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• May have specific requirements

• Target all supported Databases

• Set database via a Java property• -Dao.test.database=oracle

Targeting a Database

47

Page 48: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• Set up ActiveObjects in your plugin• Build & evolve complex data structures• Unit test it against specific databases

Takeaways

48

Page 49: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

• http://answers.atlassian.com• Tag with active-objects

• Twitter: @j_hinch• https://studio.atlassian.com/browse/AO

Contact Me

49

Page 50: Using Atlassian UAL and ActiveObjects for Rapid Plugin Development - AtlasCamp 2011

Thank you!