提供: iDempiere ja


iDempiereはOSGiバンドルに分けられています。 それぞれのバンドルはOSGiコンテナが起動する時にロードされるプラグインです。iDempiereは Eclipse EquinoxというOSGi コンテナを使用しています。OSGiコンソール(シェルやテレネットで使用) か Felix Console (Webブラウザ) を使用して、どのバンドルがロードされActiveなステータスになっている確認する事ができます。ランタイムで、新しいバンドルをロードする事もできます。


フラグメントは、他のバンドルの上で動作するバンドルです。 All its classes go into the namespace of the other bundle and can overwrite classes from this so-called "host"-bundle. Such a fragment can be used to change specific behaviour of the host classes. A fragment is no normal OSGi bundle so no other bundle can be dependent on a fragment. If you want to create a distribution with some bundles and fragments you have to create a "feature" to join them together.

Buddy Classloading

Buddy Classloading is an extension to the OSGi mechanisms from the Eclipse Equinox framework. It allows a normal (full-featured and dependency-enabled) bundle to share the classpath namespace with another "host"-bundle. This is a kind of "hack" and should not be needed if everything is clear written to the OSGi rules. But some old-fashioned libraries use reflection to find connected classes and depend on one single classloader for the library and the code that uses it.

Fragments / Buddy Classloading in iDempiere

How does this belong to iDempiere? There are some places where old Compiere/ADempiere APIs are still in use and the newer iDempiere Extensions do not fit your needs. For example the old Compiere Callouts are configurable via the database. Someone might want this so an an user can change the callouts without touching code. Another example are BankStatementMatchers. There is not (yet) an extension point for them.

In http://wiki.idempiere.org/en/Developing_Plug-Ins_-_Callout#Using_Java you see an example for Callouts via Buddy Classloading.

A good explanation of fragments and buddy classloading is here: http://www.wickedshell.net/blog/?p=76