-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Implement the ResourceHandler concept #12456
Comments
12 tasks
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Overview
In GeoNode we're getting more and more resources that need specific handling based on several traits (the underlying model, the subtype, the source, etc.). The current approach where the resource logic is coupled to the underlying Django model is falling short.
We want to delegate more to the
ResourceManager
through a newResourceHandler
concept, similar to the handlers already implemented inside the importer and for assets.Dispatching actions and requests to the ResourceHandler will be implemented using the same approach as the importer: an ordered list of ResourceHandlers will be iterated by the ResourceManager to elect the handler for the current resource. The first wins, so handlers must be ordered by decreasing specificity.
For example, a handler for a
Vector Dataset
must come first of the handler for a genericDataset
.The first use case for ResourceHandlers will be delegating the calculation of download URLs and processing the download response.
At the moment we have the following:
DownloadArrayLinkField
serializer obtains thedownload_url
either from theDocument.document_url
property, or theDatasetDownloadHandler.download_url
property. Problems:Document
,Dataset
, etc.).With ResourceHandlers
DownloadArrayLinkField
will ask theResourceManager
to provide the URL. This in turns will elect the right handler and dispatch the request to it. TheResourceHanlder
can delegate again to aDownloadHandler
(this is required at least for datasets, so we can maintain the current option to implement customDataset
download handlers)ResourceManager
again dispatch the response processing to the specific Resource handlersThe text was updated successfully, but these errors were encountered: