NetBeans Module Suite project that demonstrates how loosely coupled communication is supported via the NetBeans Platform's Lookups.forPath() registration/retrieval method.
After you install the module, go here in the New Project dialog to get the sample:
When you finish the dialog above, you will have a sample consisting of 4 modules:
The module "extensionpointinterface" exposes an interface providing a method called "getMessage()". This interface is implemented in "messageprovider1" and "messageprovider2". Both these modules register their implementations in their respective layer files. Finally, the "messagereader" module looks up the path to the folder where the implementations are registered. It then looks up all implementations of the interface. The "messagereader" module has no dependencies on the modules that provide the implementations, but only on the module that provides the interface. In this way the "messagereader" is loosely coupled to the implementations, which can be extended or removed without the "messagereader" being impacted in any way.
Thanks to Toni Epple for this sample.
[ You have to be logged in to be able to comment. ]