My guess is that they were manually created from the most recent one, and then added what had changed.
@wyclif and @raff can correct me because they have ever done it.
These predated our move to GitHub. I agree that it would make sense to manage them within openmrs-core (they’d still need to be hosted at resources.openmrs.org/doctypes).
If we can identify the differences from 1.5 to 1.6 in config.xml, I can create the DTD if needed.
BTW… the existing DTDs appear to have undeclared elements (for example, in 1.4 and I think 1.5 is the same, I see these as undeclared: class, point, mappingFiles, allow, init, signatures, filter-class, filter-name, servlet-name, url-pattern, defaultValue, description, property, param-name, param-value, file, lang, activator, author, id, name, package, require_database_version, require_version, updateURL, version, servlet-class). We also have a pretty ugly history of naming conventions combining under_score, hyphen-ated, and camelCase.
Supports multiple version ranges for version e.g. “1.8.5 - 1.9, 1.9.8”
not sure if this is enough/if we can be certain that that’s the only thing that changed. What do you think?
yes, thats true I also noticed that our DTDs are actually not valid.
My (longer term) plan is:
test ModuleFileParser (done and merged )
refactor to make it unit testable (I am almost done , and will propose the changes before merging)
put the DTDs under version control somewhere to improve the upgrade process of the config xml DTD versions
(maybe, if wanted) let the ModuleFileParser use the DTD to validate the config.xml, this should reduce our code in the ModuleFileParser and give module devs better output of whats wrong.
I have a proposal for refactoring of the ModuleFileParser at [TRUNK-5388] - OpenMRS Issues
with my rational and a pull request so anyone can review what I have in mind.
In the bigger picture, I believe that @burke has always wanted us to refactor/redesign such that we have a proper “Module Service”. How would your proposed refactoring play into this?
I have to hear the specifics from @burke on what this service would exactly do, and am open to work on it
But I am sure the ModuleFileParser could easily be used by the service after this refactoring, since my goal is that it doesnt hold on to any file and has explicit (mock’able) dependencies.
One aspect I could use your input is the parse(InputStream), which uses the implementation that was already in place. It copies the given InputStream to a tmp folder using javas File.createTempFile("moduleUpgrade", ".omod"). Can you clarify why we dont store it somewhere more permanent?
I never looked at that code even when it was being written, so this is wild speculation on my part due to the variable name: maybe it’s because this code comes from when a file is being uploaded to the server via the admin UI’s upload a module, and we need to verify that it can be parsed and is valid, before actually copying it to the modules folder.
I am interested and will gather some ideas as I wanted to move my way up the stack from parsing, loading a module anyway And am a fan of removing static methods
I believe my current refactoring is in support of this bigger picture.
makes sense!
Do you think I should get more input from some other devs on this refactoring (before merging)? If so could you please cc them here.