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 [Link] with the modified files
Stop the Server
Replace existing files or install the [Link] 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 [Link] 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 [Link]
Read the plug-in development tutorials in the idempiere wiki
– [Link]
Read the forum from Redhuan D. Oon - he has some great tutorials too
– [Link]
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 ([Link]) 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.“ - [Link]
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 -[Link]=false -[Link]=true -[Link]=director -jar
plugins/[Link].osgi_3.7.*.jar -application [Link] -consoleLog -profileProperties
[Link]=true -destination $DESTINATION -repository
[Link] -u [Link]
– java -[Link]=false -[Link]=true -[Link]=director -jar
plugins/[Link].osgi_3.7.*.jar -application [Link] -consoleLog -profileProperties
[Link]=true -destination $DESTINATION -repository
[Link] -i [Link]
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
– [Link]
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 [Link]
– remove the numbers after „-console“
– run [Link]
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: [Link]
– iDempiere wiki: [Link]
– Google group: [Link]
– Redhuan D. Oon forum: [Link]
– Global Quality System and Solutions wiki: [Link]
– Freenode irc: #idempiere
Found a bug?
– Check if the bug is also in the iDempeire demo system: [Link]
– Ask others about the bug in the irc channel
– File a bug in the ticket system: [Link]
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 [Link]@[Link]
evenos Consulting GmbH 65