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

IDempiere Plug-In Development

Embed Size (px)

Citation preview

Page 1: IDempiere Plug-In Development

evenos Consulting GmbH 1

Consultingevenos

Plug-In Development

Jan Thielemann – evenos Consulting GmbH16. Mai 2013

Page 2: IDempiere Plug-In Development

evenos Consulting GmbH 2

Consultingevenos

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

Page 3: IDempiere Plug-In Development

evenos Consulting GmbH 3

Consultingevenos

Why should I use plug-ins?

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

Page 4: IDempiere Plug-In Development

evenos Consulting GmbH 4

Consultingevenos

Why should I use plug-ins?

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

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

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

Page 5: IDempiere Plug-In Development

evenos Consulting GmbH 5

Consultingevenos

Why should I use plug-ins?

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

Page 6: IDempiere Plug-In Development

evenos Consulting GmbH 6

Consultingevenos

What can I do with plug-ins?

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

Common tasks: Model Modelvalidator Processes Callout Document Form Editor Infowindow Lookup

Page 7: IDempiere Plug-In Development

evenos Consulting GmbH 7

Consultingevenos

How do I start developing my own plug-ins?

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

First steps:

Page 8: IDempiere Plug-In Development

evenos Consulting GmbH 8

Consultingevenos

How do I start developing my own plug-ins?

Best practice - create a new plug-in

Page 9: IDempiere Plug-In Development

evenos Consulting GmbH 9

Consultingevenos

How do I start developing my own plug-ins?

Page 10: IDempiere Plug-In Development

evenos Consulting GmbH 10

Consultingevenos

How do I start developing my own plug-ins?

Page 11: IDempiere Plug-In Development

evenos Consulting GmbH 11

Consultingevenos

How do I start developing my own plug-ins?

Page 12: IDempiere Plug-In Development

evenos Consulting GmbH 12

Consultingevenos

How do I start developing my own plug-ins?

Page 13: IDempiere Plug-In Development

evenos Consulting GmbH 13

Consultingevenos

How do I start developing my own plug-ins?

Page 14: IDempiere Plug-In Development

evenos Consulting GmbH 14

Consultingevenos

How do I start developing my own plug-ins?

Page 15: IDempiere Plug-In Development

evenos Consulting GmbH 15

Consultingevenos

How do I start developing my own plug-ins?

Best practice - configure the manifest

Page 16: IDempiere Plug-In Development

evenos Consulting GmbH 16

Consultingevenos

How do I start developing my own plug-ins?

Page 17: IDempiere Plug-In Development

evenos Consulting GmbH 17

Consultingevenos

How do I start developing my own plug-ins?

Page 18: IDempiere Plug-In Development

evenos Consulting GmbH 18

Consultingevenos

How do I start developing my own plug-ins?

Page 19: IDempiere Plug-In Development

evenos Consulting GmbH 19

Consultingevenos

How do I start developing my own plug-ins?

Page 20: IDempiere Plug-In Development

evenos Consulting GmbH 20

Consultingevenos

How do I start developing my own plug-ins?

Page 21: IDempiere Plug-In Development

evenos Consulting GmbH 21

Consultingevenos

How do I start developing my own plug-ins?

Page 22: IDempiere Plug-In Development

evenos Consulting GmbH 22

Consultingevenos

How do I start developing my own plug-ins?

Page 23: IDempiere Plug-In Development

evenos Consulting GmbH 23

Consultingevenos

How do I start developing my own plug-ins?

Best practice - 2Pack

Page 24: IDempiere Plug-In Development

evenos Consulting GmbH 24

Consultingevenos

How do I start developing my own plug-ins?

Page 25: IDempiere Plug-In Development

evenos Consulting GmbH 25

Consultingevenos

How do I start developing my own plug-ins?

Page 26: IDempiere Plug-In Development

evenos Consulting GmbH 26

Consultingevenos

How do I start developing my own plug-ins?

Page 27: IDempiere Plug-In Development

evenos Consulting GmbH 27

Consultingevenos

How do I start developing my own plug-ins?

Page 28: IDempiere Plug-In Development

evenos Consulting GmbH 28

Consultingevenos

How do I start developing my own plug-ins?

Page 29: IDempiere Plug-In Development

evenos Consulting GmbH 29

Consultingevenos

How do I start developing my own plug-ins?

Page 30: IDempiere Plug-In Development

evenos Consulting GmbH 30

Consultingevenos

How do I start developing my own plug-ins?

Best practice - RegisterBuddy, Extensions and Components

Page 31: IDempiere Plug-In Development

evenos Consulting GmbH 31

Consultingevenos

How do I start developing my own plug-ins?

RegisterBuddy

Page 32: IDempiere Plug-In Development

evenos Consulting GmbH 32

Consultingevenos

How do I start developing my own plug-ins?

RegisterBuddy

Page 33: IDempiere Plug-In Development

evenos Consulting GmbH 33

Consultingevenos

How do I start developing my own plug-ins?

RegisterBuddy

Page 34: IDempiere Plug-In Development

evenos Consulting GmbH 34

Consultingevenos

How do I start developing my own plug-ins?

RegisterBuddy

Page 35: IDempiere Plug-In Development

evenos Consulting GmbH 35

Consultingevenos

How do I start developing my own plug-ins?

Extension

Page 36: IDempiere Plug-In Development

evenos Consulting GmbH 36

Consultingevenos

How do I start developing my own plug-ins?

Extension

Page 37: IDempiere Plug-In Development

evenos Consulting GmbH 37

Consultingevenos

How do I start developing my own plug-ins?

Component

Page 38: IDempiere Plug-In Development

evenos Consulting GmbH 38

Consultingevenos

How do I start developing my own plug-ins?

Component

Page 39: IDempiere Plug-In Development

evenos Consulting GmbH 39

Consultingevenos

How do I start developing my own plug-ins?

Component

Page 40: IDempiere Plug-In Development

evenos Consulting GmbH 40

Consultingevenos

How do I start developing my own plug-ins?

Component

Page 41: IDempiere Plug-In Development

evenos Consulting GmbH 41

Consultingevenos

How do I start developing my own plug-ins?

Component

Page 42: IDempiere Plug-In Development

evenos Consulting GmbH 42

Consultingevenos

How do I start developing my own plug-ins?

Component

Page 43: IDempiere Plug-In Development

evenos Consulting GmbH 43

Consultingevenos

How do I start developing my own plug-ins?

Component

Page 44: IDempiere Plug-In Development

evenos Consulting GmbH 44

Consultingevenos

How do I start developing my own plug-ins?

Component

Page 45: IDempiere Plug-In Development

evenos Consulting GmbH 45

Consultingevenos

How do I start developing my own plug-ins?

Best practice - compile plug-ins into the client

Page 46: IDempiere Plug-In Development

evenos Consulting GmbH 46

Consultingevenos

How do I start developing my own plug-ins?

Page 47: IDempiere Plug-In Development

evenos Consulting GmbH 47

Consultingevenos

How do I start developing my own plug-ins?

Page 48: IDempiere Plug-In Development

evenos Consulting GmbH 48

Consultingevenos

How do I start developing my own plug-ins?

Page 49: IDempiere Plug-In Development

evenos Consulting GmbH 49

Consultingevenos

How do I start developing my own plug-ins?

Page 50: IDempiere Plug-In Development

evenos Consulting GmbH 50

Consultingevenos

How do I start developing my own plug-ins?

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

Page 51: IDempiere Plug-In Development

evenos Consulting GmbH 51

Consultingevenos

How do I start developing my own plug-ins?

Page 52: IDempiere Plug-In Development

evenos Consulting GmbH 52

Consultingevenos

How do I start developing my own plug-ins?

Page 53: IDempiere Plug-In Development

evenos Consulting GmbH 53

Consultingevenos

How do I start developing my own plug-ins?

Page 54: IDempiere Plug-In Development

evenos Consulting GmbH 54

Consultingevenos

How do I start developing my own plug-ins?

Page 55: IDempiere Plug-In Development

evenos Consulting GmbH 55

Consultingevenos

How do I start developing my own plug-ins?

Page 56: IDempiere Plug-In Development

evenos Consulting GmbH 56

Consultingevenos

How do I start developing my own plug-ins?

Page 57: IDempiere Plug-In Development

evenos Consulting GmbH 57

Consultingevenos

How do I start developing my own plug-ins?

Page 58: IDempiere Plug-In Development

evenos Consulting GmbH 58

Consultingevenos

How can I distribute my plug-ins?

„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

p2 repositories:

Page 59: IDempiere Plug-In Development

evenos Consulting GmbH 59

Consultingevenos

How can I distribute my plug-ins?

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

Apache Felix Web Console

Page 60: IDempiere Plug-In Development

evenos Consulting GmbH 60

Consultingevenos

How can I distribute my plug-ins?

Page 61: IDempiere Plug-In Development

evenos Consulting GmbH 61

Consultingevenos

How can I distribute my plug-ins?

Page 62: IDempiere Plug-In Development

evenos Consulting GmbH 62

Consultingevenos

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

Page 63: IDempiere Plug-In Development

evenos Consulting GmbH 63

Consultingevenos

Tips and tricks

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

Page 64: IDempiere Plug-In Development

evenos Consulting GmbH 64

Consultingevenos

Conclusion

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

Page 65: IDempiere Plug-In Development

evenos Consulting GmbH 65

Consultingevenos

Thank you for your attention

Feel free to ask questions. You can contact me at [email protected]