A2.7: resolve access to files on SystemFS
There is several usecases where SystemFS contains files and clients
want to access directly these files and not instances created from
these files. The Registry API does not support accessing files, it can
provide only instance.
Example of these files are:
- misc DTDs registered in /xml/entities and /DTDs folders
- parser databases in folder /ParserDB folder
- templates in /Templates folder
The typical usecase is:
- module defines a place on SystemFS where some kind of files is
expected to be stored, eg. editor module says that all parser databases
available to the system should be store in /ParserDB folder on
SystemFS. The module defining this contract then reads the content of
the folder and foreign modules can declaratively add some files to that
folder.
The solution is that everything will remain as is apart from one thing: instead of registering directly the files the
instances of URL class will be registered.
So the above usecase rewritten to new state is: editor module defines a
context on default registry (eg.: /ParserDB) where it will expect URL
instances pointing to parser database files. It will read the URLs to
get the parser databases. Foreign modules will register into the
context URLs pointing to parser database files their provide. The URL
in such a case will point directly to file in the module jar. The
module which creates a parser database in runtime can create the
database in some temporary folder below the userdir directory or to
some other place and bind the URL pointing to that file to the
/ParserDB context.
Issues remaining to resolve:
- what the URL to userdir folder will look like? Maybe define new userdir protocol?
- for
backward compatilibility can default Registry based on top of the
SystemFS return URLs for some files. The "some files" can be in
simplest case hardcoded in default Registry for all contracts provided
by OpenAPIs like Templates etc. Or there could be general mechanism
that would return URL for any file for which there is not convertor
registered.
During the discussions on nbdev two other proposals for this issue were mentioned: URL bridge, what to do with files.