Pet Project Plugin
Submitted by Ben_Charlton on Thu, 28/03/2019 - 15:07
Hey Tim
Pet project of mine to enable notifications to 3rd party platforms for various events in Open via a plugin.
My initial plan was to implement messaging notices -
I assume the expected way would be to implement an IArchetypeListener and add it too the IArchetype service directly OR is it better to utilize the new plugin interface IMObjectListener ?
Sort of replicating the MessageMonitor but allowing notices to be sent to a 3rd party service.
I noticed the only time your using that IMObjectListener currently is to reload the plugin in the configuration is changed, but I assume it could be used to monitor any object type for changes.
Re: Pet Project Plugin
The IMObjectListener is the correct interface. Just be aware that you won't get any updates when your plugin isn't registered.
Re: Pet Project Plugin
By registered I assume you meant the class needs to register with the Archetype service?
Re: Pet Project Plugin
No. You need to implement the IMObjectListener interface, and add the annotation:
@Component(service = IMObjectListener.class, immediate = true)
There's a few more requirements to make it an OSGi bundle, so I've put together a small sample here:
https://bitbucket.org/OpenVPMS/openvpms/src/1b7f0c8801e7/openvpms-plugin...
Re: Pet Project Plugin
Tim I was going to suggest that you may also need to add the ability of a plugin to insert a configuration archetype easily...some thing generic like `entity.insuranceService*` covers for the insurance plugins.
Otherwise I am unsure how any plugin other than an insurance service would utilize the ConfigurableService interface -
its easy enough to insert the archetype with the archetype installer
but I wasnt sure the system would add it to the organization page drop down.
The configuration archetype should appear in the Administration - Organization drop down I would have thought.
Re: Pet Project Plugin
If you use the latest code from master, you can define an entity.plugin* archetype and it will be configurable in Administration -> Organisation. E.g.: