-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
GNIP 100 - Assets
Overview
We need a way to identify files (local, remote, in the cloud...) per se.
There's no way at the moment to identify data files by themselves, which are only referenced by the field `ResourceBase.files'.
Also, the StorageManager is pluggable, but only allows for a single storage backend at once.
By having different subclasses of Asset (e.g. LocalAsset, S3Asset, ...) we may have a GeoNode instance handling datafiles on different data store backends.
Proposed By
- @etj - Emanuele Tajariol
Assigned to Release
This proposal is for GeoNode 4.3 (?)
State
- Under Discussion
- In Progress
- Completed
- Rejected
- Deferred
Motivation
- Data may be stored on different backends
- Data is not coupled with a single ResourceBase
- May simplify the handling of basic data (images, etc) in GeoStories, which at the moment use full featured (and heavy) ResourceBases metadata also for simple files.
- Allows the possibility to link a single
ResourceBasewith multiple data files (think for instance about a Document having multiple PDF files for different languages). - Allows the definition of a directory hierarchy as a single data asset, making it possible to publish complex data.
- Simplifies/improves handling of authorization for data access.
Proposal
We introduce the concept of Asset as generic data, that may be linked to a ResourceBase.
A LocalAsset represents data stored in the filesystem (either a single file or a directory tree).
The Asset class will replace and augment the information stored at the moment in the ResourceBase.files field.
An Asset is associated with a Resource through a Link, which also tells the URL through which the Asset will be available to the GeoNode users.
- For a LocalAsset, the URL may be a service that checks for authorization before returning the data.
- For a RemoteAsset (we're not discussing its implementation in this proposal), it could be a replication of the RemoteAsset URL, or also a GeoNode local endpoint that proxies a remote content, maybe providing some authentication to the remote service -- this is just an example, we don't have any real use case at the moment.
Other usages for assets
Since the Asset object is quite simple, we could use it for other purposes as well; for instance, at the moment we use "unadvertised" ResourceBase instances for providing simple data to GeoStories (images, PDFs, ...). Instead of using such a heavy object, we could just use LocalAssets for this purpose.
Also, more Assets may be associated with an existing ResourceBase; this behavior replicates what GeoNetwork is already doing, that is having multiple data resources pointed by a single metadata record.
Permissions
In the future there could be different permissions for a Resource and its linked Assets, anyway for the sake of simplicity, as a first step we may grant on the asset the very same permissions of the linked ResourceBases.
In the case we want to associate an Asset to more than one Resource, the Asset will be available if the user has download privileges on at least one of the associated Resources.
Implementation
Model:
- Add
Assetclass, and its subclassLocalAsset - Refact
ResourceBaseandLinkclasses
Logic:
- Replace the usage of
fileswithAssetinstances
DB migration:
- Documents:
- migration is straightforward, since there's a single file
- Datasets:
- Single file --> Asset
- Shapefile (shp+dbf+shx+prj?) or other multifile formats--> ?
- Multiple options according to Asset type:
- create a zipfile ?
- publish as the root entry of a directory? (There are cases where we want an Asset to be a directory with subdir)
- Every Assethandler should be able to create its own Asset content and related link url
- shp file should create a zip file, since such data is only used for download
- What if there is a SLD (or any other satellite file)? is it a separate Asset?
- Multiple options according to Asset type:
API:
- Make sure existing API still returns file info as before
Authorization
A user has access to an Asset data iff such Asset is associated with at least one ResourceBase for which the user has download permissions.
Backwards Compatibility
- API: old
filesarray can be preserved in output
Future evolution
Decoupled uploads
A user may upload an Asset without having to associate it to a Resource.
Unassociated Assets may be used to automatically create ResourceBases and attach the asset to them.
Deprecate Documents
Once Assets gain their characterization, the Document object will not have much of a meaning, also considering that users upload as a Document any object that is not published as a Layer.
This means that we will be able to remove the Document class, and convert its instances into ResourceBases with an Asset handling the former document's data.
Cleanup uploaded files
Some old installations have the uploaded data into /data.
The recent importer stores the uploaded data into .../STATIC_ROOT/uploaded, and GeoServer publishes the geotiff from that directory
The final migration to Assets will store the files in .../STATIC_ROOT/assets, and GeoServer shall publish the files from there.
In order to clean up such obsolete setups, a migration script could be done that:
- moves the files from
uploaded/toassets/ - updates the
LocalAsset.locationfield - updates the GeoServer config to point to the new path
Such a migration script should only be run by hand since we do not know if such files are also used for other purposes outside GeoNode, so the admin can choose to run it or not.
Feedback
Update this section with relevant feedbacks, if any.
Voting
Project Steering Committee:
- Alessio Fabiani:
- Francesco Bartoli:
- Giovanni Allegri: +1
- Toni Schoenbuchner: +1
- Florian Hoedt:
Links
Remove unused links below.
