You are on page 1of 65

evenos

Consulting

Plug-In Development

Jan Thielemann – evenos Consulting GmbH


16. Mai 2013

evenos Consulting GmbH 1


evenos
Table of contents Consulting

 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 2


evenos
Why should I use plug-ins? 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 3


evenos
Why should I use plug-ins? 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 4
evenos
Why should I use plug-ins? 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 5


evenos
What can I do with plug-ins? 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 6
evenos
How do I start developing my own plug-ins? 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 7


evenos
How do I start developing my own plug-ins? Consulting

Best practice - create a new plug-in

evenos Consulting GmbH 8


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 9


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 10


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 11


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 12


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 13


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 14


evenos
How do I start developing my own plug-ins? Consulting

Best practice - configure the manifest

evenos Consulting GmbH 15


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 16


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 17


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 18


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 19


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 20


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 21


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 22


evenos
How do I start developing my own plug-ins? Consulting

Best practice - 2Pack

evenos Consulting GmbH 23


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 24


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 25


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 26


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 27


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 28


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 29


evenos
How do I start developing my own plug-ins? Consulting

Best practice - RegisterBuddy, Extensions and


Components

evenos Consulting GmbH 30


evenos
How do I start developing my own plug-ins? Consulting

RegisterBuddy

evenos Consulting GmbH 31


evenos
How do I start developing my own plug-ins? Consulting

RegisterBuddy

evenos Consulting GmbH 32


evenos
How do I start developing my own plug-ins? Consulting

RegisterBuddy

evenos Consulting GmbH 33


evenos
How do I start developing my own plug-ins? Consulting

RegisterBuddy

evenos Consulting GmbH 34


evenos
How do I start developing my own plug-ins? Consulting

Extension

evenos Consulting GmbH 35


evenos
How do I start developing my own plug-ins? Consulting

Extension

evenos Consulting GmbH 36


evenos
How do I start developing my own plug-ins? Consulting

Component

evenos Consulting GmbH 37


evenos
How do I start developing my own plug-ins? Consulting

Component

evenos Consulting GmbH 38


evenos
How do I start developing my own plug-ins? Consulting

Component

evenos Consulting GmbH 39


evenos
How do I start developing my own plug-ins? Consulting

Component

evenos Consulting GmbH 40


evenos
How do I start developing my own plug-ins? Consulting

Component

evenos Consulting GmbH 41


evenos
How do I start developing my own plug-ins? Consulting

Component

evenos Consulting GmbH 42


evenos
How do I start developing my own plug-ins? Consulting

Component

evenos Consulting GmbH 43


evenos
How do I start developing my own plug-ins? Consulting

Component

evenos Consulting GmbH 44


evenos
How do I start developing my own plug-ins? Consulting

Best practice - compile plug-ins into the client

evenos Consulting GmbH 45


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 46


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 47


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 48


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 49


evenos
How do I start developing my own plug-ins? Consulting

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

evenos Consulting GmbH 50


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 51


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 52


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 53


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 54


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 55


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 56


evenos
How do I start developing my own plug-ins? Consulting

evenos Consulting GmbH 57


evenos
How can I distribute my plug-ins? 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


evenos
How can I distribute my plug-ins? 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


evenos
How can I distribute my plug-ins? Consulting

evenos Consulting GmbH 60


evenos
How can I distribute my plug-ins? Consulting

evenos Consulting GmbH 61


evenos
Tips and tricks Consulting

 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 62


evenos
Tips and tricks 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


evenos
Conclusion 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