eoxserver.backends package¶
Subpackages¶
- eoxserver.backends.packages package
- eoxserver.backends.storages package
- Submodules
- eoxserver.backends.storages.ftp module
- eoxserver.backends.storages.http module
- eoxserver.backends.storages.local module
- eoxserver.backends.storages.rasdaman module
- Module contents
Submodules¶
eoxserver.backends.access module¶
- eoxserver.backends.access.gdal_open(data_item, shared=True)¶
Opens a
eoxserver.backends.models.DataItemas aeoxserver.contrib.gdal.Dataset. Usesget_vsi_path()internally to get the path.- Parameters:
data_item (
eoxserver.backends.models.DataItem) – the data item to open as a dataset.- Return type:
eoxserver.contrib.gdal.Dataset
- eoxserver.backends.access.get_vsi_env(storage)¶
- eoxserver.backends.access.get_vsi_path(data_item)¶
Get the VSI path to the given
eoxserver.backends.models.DataItem- Parameters:
data_item (
eoxserver.backends.models.DataItem) – the data item to get the path to- Returns:
the VSI file path which is can be used with GDAL-related APIs
- Return type:
- eoxserver.backends.access.get_vsi_storage_path(storage, location=None)¶
- eoxserver.backends.access.open(data_item, cache=None)¶
Returns a file object pointing to the given location. This function works like the builtin function
open()but on aDataItemand performs aretrieve()first.- Parameters:
data_item – the
DataItemto opencache – an instance of
CacheContextorNoneif the caching shall be handled internally
- eoxserver.backends.access.retrieve(data_item, cache=None)¶
Retrieves the
eoxserver.backends.models.DataItemand makes the file locally available if necessary. When the data item is not associated with a storage, then the data items location will be returned. Otherwise, the storage handlersretrievemethod will be called to make the data item locally available.- Parameters:
data_item (
eoxserver.backends.models.DataItem) – data item to retrievecache (eoxserver.backends.cache.CacheContext) – the optional cache context
- Returns:
the path to the localized file
- Return type:
- eoxserver.backends.access.vsi_list_storage(storage, location=None, pattern=None)¶
- eoxserver.backends.access.vsi_open(data_item)¶
Opens a
eoxserver.backends.models.DataItemas aeoxserver.contrib.vsi.VSIFile. Usesget_vsi_path()internally to get the path.- Parameters:
data_item (
eoxserver.backends.models.DataItem) – the data item to open as a VSI file- Return type:
eoxserver.backends.cache module¶
- class eoxserver.backends.cache.CacheContext(retention_time=None, cache_directory=None, managed=False)¶
Bases:
objectContext manager to manage cached files.
- add_mapping(path, item)¶
Add an external file to this context. Those files will be treated as if they are “within” the caches directory, but will not be clead up afterwards.
- add_path(cache_path)¶
Add a path to this cache context. Also creates necessary sub-directories.
- property cache_directory¶
Returns the configured cache directory.
- cleanup()¶
Perform cache cleanup.
- contains(cache_path)¶
Check whether or not the path is contained in this cache.
- relative_path(cache_path)¶
Returns a path relative to the cache directory.
- eoxserver.backends.cache.get_cache_context()¶
Get the thread local cache context for this session. Raises an exception if the session was not initialized.
- eoxserver.backends.cache.set_cache_context(cache_context)¶
Sets the cache context for this session. Raises an exception if there was already a cache context associated.
- eoxserver.backends.cache.setup_cache_session(config=None)¶
Initialize the cache context for this session. If a cache context was already present, an exception is raised.
- eoxserver.backends.cache.shutdown_cache_session()¶
Shutdown the cache context for this session and trigger any pending cleanup actions required.
eoxserver.backends.component module¶
- class eoxserver.backends.component.BackendComponent(*args)¶
Bases:
ComponentThis
Componentprovides extension points and helpers to easily retrive Package and Storage components by their type names.- property connected_storages¶
List of components that implement
eoxserver.backends.interfaces.ConnectedStorageInterface
- property file_storages¶
List of components that implement
eoxserver.backends.interfaces.FileStorageInterface
- get_connected_storage_component(storage_type)¶
Retrieve a component implementing the
eoxserver.backends.interfaces.ConnectedStorageInterfacewith the desiredstorage_type.- Parameters:
storage_type – the desired storage type
- Returns:
the desired storage component or
None
- get_file_storage_component(storage_type)¶
Retrieve a component implementing the
eoxserver.backends.interfaces.FileStorageInterfacewith the desiredstorage_type.- Parameters:
storage_type – the desired storage type
- Returns:
the desired storage component or
None
- get_package_component(format)¶
Retrieve a component implementing the
eoxserver.backends.interfaces.PackageInterfacewith the desiredformat.- Parameters:
format – the desired package format
- Returns:
the desired package component or
None
- get_storage_component(storage_type)¶
Retrieve a component implementing the
eoxserver.backends.interfaces.FileStorageInterfaceoreoxserver.backends.interfaces.ConnectedStorageInterfacewith the desiredstorage_type.- Parameters:
storage_type – the desired storage type
- Returns:
the desired storage component or
None
- property packages¶
List of components that implement
eoxserver.backends.interfaces.PackageInterface
- property storages¶
Helper to retrieve components for all storage interfaces.
eoxserver.backends.config module¶
eoxserver.backends.interfaces module¶
- class eoxserver.backends.interfaces.AbstractStorageInterface¶
Bases:
object- property name¶
Name of the storage implementation.
- validate(url)¶
Validates the given storage locator and raises a
django.core.exceptions.ValidationErrorif errors occurred.
- class eoxserver.backends.interfaces.ConnectedStorageInterface¶
Bases:
AbstractStorageInterfaceInterface for storages that do not store “files” but provide access to data in a different fashion.
- connect(url, location)¶
Return a connection string for a remote dataset residing on a storage specified by the given url and location.
- Parameters:
url – the URL denoting the storage itself
location – the location of the file to retrieve on the storage
- Returns:
a connection string to open the stream to actually retrieve data
- class eoxserver.backends.interfaces.FileStorageInterface¶
Bases:
AbstractStorageInterfaceInterface for storages that provide access to files and allow the retrieval of those.
- list_files(url, location)¶
Return a list of retrievable files available on the storage located at the specified URL and given location.
- Parameters:
url – the URL denoting the storage itself
location – a template to find items on the storage
- Returns:
an iterable of the storage contents under the specified
location
- retrieve(url, location, path)¶
Retrieve a remote file from the storage specified by the given url and location and store it to the given path. Storages that don’t need to actually retrieve and store files, just need to return a path to a local file instead of storing it under path.
- Parameters:
url – the URL denoting the storage itself
location – the location of the file to retrieve on the storage
path – a local path where the file should be saved under; this is used as a hint
- Returns:
the actual path where the file was stored; in some cases this can be different than the passed
path
- class eoxserver.backends.interfaces.PackageInterface¶
Bases:
object- extract(package_filename, location, path)¶
Extract a file specified by the
locationfrom the package to the givenpathspecification.- Parameters:
package_filename – the local filename of the package
location – a location within the package to be extracted
path – a local path where the file should be saved under; this is used as a hint
- Returns:
the actual path where the file was stored; in some cases this can be different than the passed
path
- list_contents(package_filename, location_regex=None)¶
Return a list of item locations under the specified location in the given package.
- Parameters:
package_filename – the local filename of the package
location_regex – a template to find items within the package
- Returns:
an iterable of the package contents under the specified
location
- property name¶
Name of the package implementation.
eoxserver.backends.middleware module¶
- class eoxserver.backends.middleware.BackendsCacheMiddleware¶
Bases:
objectA Django Request Middleware to manage cache setup and teardown when a request is beeing processed.
- process_exception(request, exception)¶
- process_request(request)¶
- process_response(request, response)¶
- process_template_response(request, response)¶
eoxserver.backends.models module¶
- class eoxserver.backends.models.DataItem(*args, **kwargs)¶
Bases:
ModelAbstract model for locateable data items contributing to a dataset.
- format¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- location¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- storage¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- storage_id¶
- class eoxserver.backends.models.Storage(*args, **kwargs)¶
Bases:
ModelModel to symbolize storages that provide file or other types of access to data items.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- arraydataitem_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- browse_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- clean()¶
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- mask_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- metadataitem_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- parent¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- parent_id¶
- product¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurantis aReverseOneToOneDescriptorinstance.
- productdataitem_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- storage_auth¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- storage_auth_id¶
- storage_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- storage_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- streaming¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- url¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class eoxserver.backends.models.StorageAuth(*args, **kwargs)¶
Bases:
ModelModel to symbolize authorization for storages.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- auth_parameters¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- clean()¶
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- storage_auth_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- storage_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- url¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- eoxserver.backends.models.validate_storage(storage)¶
- eoxserver.backends.models.validate_storage_auth(storage_auth)¶
eoxserver.backends.testbase module¶
- eoxserver.backends.testbase.withFTPServer(port=2121, directory=None)¶