Ontopia IO refactoring - part 1

7 views
Skip to first unread message

Quintin Siebers

unread,
May 13, 2017, 1:57:12 PM5/13/17
to Ontopia Mailing List
Dear Ontopia users,

I’ve opened a new Github project on Ontopia aimed at fixing some long running issues regarding IO/File handling and Locator implementation issues. These two parts of Ontopia are closely related as Ontopia uses locators to reference to IO resources such as files and classpath resources. In order to improve locators in Ontopia, I first had to remove all use of locators that was not related to actual TopicMap locators. I’ve committed this work in the feature/io-refactor branch [1] and created a pull request for it [2].

I hereby want to give you all a chance to view these changes before we merge them into the main Ontopia code, which will make them applicable for the next Ontopia release. I’ll describe each of the major changes that are included in the pull request:

TopicmapImporterIF interface has been merged into TopicMapReaderIF
All TopicMap readers implemented both, so I merged them into TopicMapReaderIF. This clears up several utility methods that were duplicated just to suit both interfaces.

All TopicMapWriterIF implementations can now be constructed based on File, OutputStream and Writer
The different TopicMap writers differed in the possible constructors, I’ve aligned them all to be equal.

All TopicMapReaderIF implementations can now be constructed based on URL, File, Reader and InputStream
Just like with the writers, the readers’s constructors are aligned. The XML TopicMap readers can also be constructed based on InputSource.

Use of string based resource resolving has been minimised
The String based constructors for readers has been removed to avoid duplication and different implementations in the readers. The only places where String based resource resolving is still present is in utility classes or classes that must be String based (such as path based TopicMap sources)

The classpath: pseudo protocol is now only implemented by StreamUtils
There used to be several locations where this was implemented (and differently). They have been merged into StreamUtils. 

URIUtils has been cleaned up, removing obsolete and antiquated code
As this class served to use locators for IO resolving, most of the code has become obsolete and has been removed.

Test cases have been updated to use the refactored IO
Of course all these changes have been applied to the test suite in order to keep Ontopia stable. New test cases have been added for the new functionality.

There is still some work to be done in the external-topicmap resolving (ie: mergemap in LTM) as this still uses locators where an URL might be preferable. 

Please let us know if you have any questions, comments or objections regarding these changes. I would like to get a go-ahead on these changes before the next part of this project is presented to you.


With regards,

Quintin Siebers

--
(+31) (0)6 - 11 06 16 27


Morpheus Kennistechnologie BV
<URL: http://www.mssm.nl >
postbus 69
3500 CD Utrecht
KVK 30 26 04 30

Reply all
Reply to author
Forward
0 new messages