You are on page 1of 65

evenos

Consulting

Plug-In Development
Jan Thielemann evenos Consulting GmbH
16. Mai 2013

evenos Consulting GmbH

Table of contents

Why should I use plug-ins?


ADempiere approach
iDempiere approach
Reasons to use plug-ins

What can I do with plug-ins?


Common tasks
Special tasks

How do I start developing my own plug-ins?


First steps
Best practice

How can i distribute my plug-ins?


p2 repositories
Install plug-ins from jar files via Apache Felix Web Console

Tips and tricks

Conclusion

evenos Consulting GmbH

evenos

Consulting

Why should I use plug-ins?

evenos

Consulting

ADempiere approach:

Check out ADempiere and configure your workspace


Create a new project for your customizations or modify the original sources
Re-compile the sources and create a customization.jar with the modified files
Stop the Server
Replace existing files or install the customization.jar via setup/silentsetup
Run additinal migration scrpits
Start the Server

Disadvantages:

Inconvenient for new developers


Error-prone
Server must be shut down
Ant build files must be modified to solve additional dependencies
Code from within the customization.jar must be placed in the right directory structure to work
No possibility to quickly enable/disable modifications

evenos Consulting GmbH

Why should I use plug-ins?

evenos

Consulting

iDempiere approach:

Check out iDempiere and configure your workspace


Create a new Plug-in Project
Use extension points or component definitions to provide functionality
Export the plug-in
Install and start the plug-in during runtime

Disadvantages:
Modification of core files is not possible
Today not everything can be done with plug-ins - but we are working on it

Advantages:

Modular architecture
Convenient and easier to understand for new developers
Server must not be shut down to install/activate/deactivate/remove plug-ins
No need to modify the core
Dependency management
Better/easier extensibility
Easily update the core without losing your customizations

evenos Consulting GmbH

Why should I use plug-ins?

evenos

Consulting

Reasons to use plug-ins:

You develop functionality for your personal use, but you still want to support the community with bug fixes

You want to make some quick and dirty tests and may want to rollback your changes without headache

You have several customers for who you develop but some of the functionality is only for some of the
customers and should not be available for everyone

You regulary update iDempiere to the latest available version

You develop functionality on your local system and want an easy way to export your changes to your
productive system

You are new to iDempiere development and have no understanding of the core yet

You developed a great feature which you want to sell without caring about the customers base system

evenos Consulting GmbH

What can I do with plug-ins?

evenos

Consulting

Common tasks:

Model
Modelvalidator
Processes
Callout
Document
Form
Editor
Infowindow
Lookup

Special tasks:

Payment Processor
Shipment Processor
Attachements
Pack In/Out
PIPO Element Handlers
Tabs
Menus

evenos Consulting GmbH

How do I start developing my own plug-ins?

evenos

Consulting

First steps:

Check out the iDempiere source code and configure your workspace
A good tutorial can be found at http://www.globalqss.com/wiki/index.php/IDempiere

Read the plug-in development tutorials in the idempiere wiki


http://wiki.idempiere.org/en/Category:Plug-In_Development

Read the forum from Redhuan D. Oon - he has some great tutorials too
http://red1.org/adempiere/index.php

Take a look at existing plug-ins


There are a lot of plug-ins and many of them makes use of extension points and component definitions

Read the wiki and use google

Join us on irc at #idempiere (irc.freenode.net) and aks for help

evenos Consulting GmbH

How do I start developing my own plug-ins?

evenos

Consulting

Best practice - create a new plug-in

evenos Consulting GmbH

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

10

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

11

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

12

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

13

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

14

How do I start developing my own plug-ins?

evenos

Consulting

Best practice - configure the manifest

evenos Consulting GmbH

15

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

16

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

17

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

18

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

19

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

20

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

21

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

22

How do I start developing my own plug-ins?

evenos

Consulting

Best practice - 2Pack

evenos Consulting GmbH

23

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

24

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

25

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

26

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

27

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

28

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

29

How do I start developing my own plug-ins?

evenos

Consulting

Best practice - RegisterBuddy, Extensions and


Components

evenos Consulting GmbH

30

How do I start developing my own plug-ins?

evenos

Consulting

RegisterBuddy

evenos Consulting GmbH

31

How do I start developing my own plug-ins?

evenos

Consulting

RegisterBuddy

evenos Consulting GmbH

32

How do I start developing my own plug-ins?

evenos

Consulting

RegisterBuddy

evenos Consulting GmbH

33

How do I start developing my own plug-ins?

evenos

Consulting

RegisterBuddy

evenos Consulting GmbH

34

How do I start developing my own plug-ins?

evenos

Consulting

Extension

evenos Consulting GmbH

35

How do I start developing my own plug-ins?

evenos

Consulting

Extension

evenos Consulting GmbH

36

How do I start developing my own plug-ins?

evenos

Consulting

Component

evenos Consulting GmbH

37

How do I start developing my own plug-ins?

evenos

Consulting

Component

evenos Consulting GmbH

38

How do I start developing my own plug-ins?

evenos

Consulting

Component

evenos Consulting GmbH

39

How do I start developing my own plug-ins?

evenos

Consulting

Component

evenos Consulting GmbH

40

How do I start developing my own plug-ins?

evenos

Consulting

Component

evenos Consulting GmbH

41

How do I start developing my own plug-ins?

evenos

Consulting

Component

evenos Consulting GmbH

42

How do I start developing my own plug-ins?

evenos

Consulting

Component

evenos Consulting GmbH

43

How do I start developing my own plug-ins?

evenos

Consulting

Component

evenos Consulting GmbH

44

How do I start developing my own plug-ins?

evenos

Consulting

Best practice - compile plug-ins into the client

evenos Consulting GmbH

45

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

46

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

47

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

48

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

49

How do I start developing my own plug-ins?

evenos

Consulting

Best practice - export plug-ins as p2 repositories or jar

evenos Consulting GmbH

50

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

51

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

52

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

53

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

54

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

55

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

56

How do I start developing my own plug-ins?

evenos Consulting GmbH

evenos

Consulting

57

How can I distribute my plug-ins?

evenos

Consulting

p2 repositories:

The p2 project is a sub-project of Equinox that focuses on provisioning technology for OSGi-based applications. Although p2 has
specific support for installing Eclipse and Equinox-based applications, it includes a general-purpose provisioning infrastructure that
can be used as the basis for provisioning solutions for a wide variety of software applications. - http://www.eclipse.org/equinox/p2/

Short: a powerful way to install and update iDempiere and its plug-ins over the internet

Host iDempiere and your plug-ins in a centralized repository

Host you plug-ins in the iDempiere marketplace (comming soon)

Update iDempiere via command line:


java -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=director -jar
plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.equinox.p2.director -consoleLog -profileProperties
org.eclipse.update.install.features=true -destination $DESTINATION -repository
http://downloads.sourceforge.net/project/red1/p2/idempiere-server/ -u org.adempiere.server.product
java -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=director -jar
plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.equinox.p2.director -consoleLog -profileProperties
org.eclipse.update.install.features=true -destination $DESTINATION -repository
http://downloads.sourceforge.net/project/red1/p2/idempiere-server/ -i org.adempiere.server.product

evenos Consulting GmbH

58

How can I distribute my plug-ins?

evenos

Consulting

Apache Felix Web Console

On the server, plug-ins can be installed via Apache Felix Web Console
http://host:8080/osgi/system/console/bundles

No need to stop or restart the server for installing/updating/removing plug-ins

No command line

Mostly self explanatory

evenos Consulting GmbH

59

How can I distribute my plug-ins?

evenos Consulting GmbH

evenos

Consulting

60

How can I distribute my plug-ins?

evenos Consulting GmbH

evenos

Consulting

61

Tips and tricks

Extending/overriding base models


Extend the base model and just create a new M class instead creating I, X and M classes
Provide your model via ModelFactory
This way, core classes can still cast your modified model to

Test plug-ins in Eclipse


Open Run Configurations and select the application you want to run
Switch to the Plug-ins tab and check the plug-ins you want to start
Start the application
Type ss on the console to see the state of each plugin
Start plug-ins with start <nr>
Stop plug-ins with stop <nr>
Remove plug-ins with uninstall <nr>

OSGi console when starting the server via command line


open idempiere-server.sh
remove the numbers after -console
run idempiere-server.sh

evenos Consulting GmbH

evenos

Consulting

62

Tips and tricks

evenos

Consulting

Where to get help?


iDempiere has nearly the same core as ADempiere so for getting startet these books are still a good starting
point to get a better understanding of what is happening behind the scenes:
ADempiere 3.6 Cookbook by Ajit Kumar
ADempiere 3.4 ERP Solutions by Bayu Cahya Pamungkas
ADempiere wiki: http://www.adempiere.com/ADempiere_ERP
iDempiere wiki: http://wiki.idempiere.org/wiki/Main_Page
Google group: https://groups.google.com/forum/?fromgroups#!forum/idempiere
Redhuan D. Oon forum: http://red1.org/adempiere/index.php
Global Quality System and Solutions wiki: http://www.globalqss.com/wiki/index.php/IDempiere
Freenode irc: #idempiere

Found a bug?
Check if the bug is also in the iDempeire demo system: https://demo.idempiere.com/
Ask others about the bug in the irc channel
File a bug in the ticket system: http://jira.idempiere.com

evenos Consulting GmbH

63

Conclusion

evenos

Consulting

iDempiere makes use of the Equinox OSGi Framework

iDempiere makes it easier to provide additional functionality via plug-ins

iDempiere is easier to maintain

iDempiere makes it easy to share data between different instances

iDempiere is beginner friendly

iDempiere makes it possible to provide additional functionality without the need to have the customers whole
source code

iDempiere is easy to learn for people who are already familiar with ADempiere

evenos Consulting GmbH

64

evenos

Consulting

Thank you for your attention


Feel free to ask questions. You can contact me at jan.thielemann@evenos-consulting.de

evenos Consulting GmbH

65

You might also like