Upload
carlcols
View
401
Download
51
Embed Size (px)
Citation preview
evenos Consulting GmbH 1
Consultingevenos
Plug-In Development
Jan Thielemann – evenos Consulting GmbH16. Mai 2013
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
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
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
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
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
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:
evenos Consulting GmbH 8
Consultingevenos
How do I start developing my own plug-ins?
Best practice - create a new plug-in
evenos Consulting GmbH 9
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 10
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 11
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 12
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 13
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 14
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 15
Consultingevenos
How do I start developing my own plug-ins?
Best practice - configure the manifest
evenos Consulting GmbH 16
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 17
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 18
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 19
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 20
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 21
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 22
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 23
Consultingevenos
How do I start developing my own plug-ins?
Best practice - 2Pack
evenos Consulting GmbH 24
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 25
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 26
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 27
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 28
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 29
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 30
Consultingevenos
How do I start developing my own plug-ins?
Best practice - RegisterBuddy, Extensions and Components
evenos Consulting GmbH 31
Consultingevenos
How do I start developing my own plug-ins?
RegisterBuddy
evenos Consulting GmbH 32
Consultingevenos
How do I start developing my own plug-ins?
RegisterBuddy
evenos Consulting GmbH 33
Consultingevenos
How do I start developing my own plug-ins?
RegisterBuddy
evenos Consulting GmbH 34
Consultingevenos
How do I start developing my own plug-ins?
RegisterBuddy
evenos Consulting GmbH 35
Consultingevenos
How do I start developing my own plug-ins?
Extension
evenos Consulting GmbH 36
Consultingevenos
How do I start developing my own plug-ins?
Extension
evenos Consulting GmbH 37
Consultingevenos
How do I start developing my own plug-ins?
Component
evenos Consulting GmbH 38
Consultingevenos
How do I start developing my own plug-ins?
Component
evenos Consulting GmbH 39
Consultingevenos
How do I start developing my own plug-ins?
Component
evenos Consulting GmbH 40
Consultingevenos
How do I start developing my own plug-ins?
Component
evenos Consulting GmbH 41
Consultingevenos
How do I start developing my own plug-ins?
Component
evenos Consulting GmbH 42
Consultingevenos
How do I start developing my own plug-ins?
Component
evenos Consulting GmbH 43
Consultingevenos
How do I start developing my own plug-ins?
Component
evenos Consulting GmbH 44
Consultingevenos
How do I start developing my own plug-ins?
Component
evenos Consulting GmbH 45
Consultingevenos
How do I start developing my own plug-ins?
Best practice - compile plug-ins into the client
evenos Consulting GmbH 46
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 47
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 48
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 49
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 50
Consultingevenos
How do I start developing my own plug-ins?
Best practice - export plug-ins as p2 repositories or jar
evenos Consulting GmbH 51
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 52
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 53
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 54
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 55
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 56
Consultingevenos
How do I start developing my own plug-ins?
evenos Consulting GmbH 57
Consultingevenos
How do I start developing my own plug-ins?
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:
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
evenos Consulting GmbH 60
Consultingevenos
How can I distribute my plug-ins?
evenos Consulting GmbH 61
Consultingevenos
How can I distribute my plug-ins?
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
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
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
evenos Consulting GmbH 65
Consultingevenos
Thank you for your attention
Feel free to ask questions. You can contact me at [email protected]