@reubenv anyway when I upload the module, It will be checked by the moduleFactory. if it’s not compatible with the core version, then moduleFactory will throw the error.
Then I can catch it from the OWA to indicate the user about the problem.
Now, I am able to update and download modules from Bintary.com using the Server Side download calls
Implemented new Action Called “UPDATE” with field “downloadUrls” in the REST Web services ModuleActionResource1_8 to achieve the module update
Unfortunately, OpenMRS Core (ModuleFactory Class) doesn’t have any methods to download the module directly from URL. So I wanted to implement that method to achieve the task.
Anyway, If I implement this method in OpenMRS Core, then definitely SysAdmin OWA will require the newer version of the OpenMRS Core.
To avoid that problem, I implemented that simple logic in the REST Web services ModuleFactoryWrapper it self and created Action called “LOADFROMURL” to perform this action.
the OpenMRS server should query https://modules.openmrs.org/modules/download/xforms/update.rdf, which returns a list of module versions, each also describing the requireOpenMRSVersion
the server decides on the highest supported module version for their openmrs-core version
the server downloads it
the server installs it, restarts the spring context, etc.
I’m not actually suggesting that you rewrite everything now. But FYI (and also FYI @dkayiwa and @burke) there was some previous design (a module declaring its updateURL) that we are no longer respecting in the new Manage Modules OWA.
There are no functions in Core (ModuleFactory or ModuleUtil) to find the update for single Modules. There was a function to check update for all modules.
This ModuleUtil - CheckForModuleUpdates function will check the updates for all modules and set download URL value to the modules which have the updates and set null to download URL to modules which haven’t the updates.
Then I want to call the update function from ModuleFactory to download the module update (one call for each module update)
So I wanted to perform this actions from the OWA level (I can’t change core for this purpose),
Call the ModuleUtil - CheckForModuleUpdates function via the rest(It will set the download URL to the modules which have updates)
Iterate all the modules in the OWA level and check for the module download URL (If the download URL contains value then show that modules in the update list).
If user click the update button, then call the ModuleFactory - Update function via the REST to update the module
Then Call again ModuleUtil - CheckForModuleUpdates function to set the download URL as null (I can’t set the module URL as null)
Blocker: Using this way, I can’t check update for one Module.
That’s why I tried to set the module download URL and achieve the updates (here I can use the AddOns URL for all modules)
Personally I would not try to do this without changing OpenMRS core.
Instead we would use this as an opportunity to refactor core so that it has
a better module management API.
I should also point out that reloading the spring context (which happens
each time we do a module management operation) is expensive, and if you do
it too many times you run out of memory. (Actually, maybe this is fixed in
Java 8: do we know this?) If I were designing with that in mind I would
have the UI flow be: 1. Check for available updates to all modules, 2.
Present a list of available updates with checkboxes or similar, 3. User
indicates which updates to apply, 4. Download all of them, load them in one
go (and restart the spring context one time only).