eoxserver.backends package¶
Submodules¶
eoxserver.backends.access module¶
eoxserver.backends.cache module¶
-
class
eoxserver.backends.cache.
CacheContext
(retention_time=None, cache_directory=None, managed=False)¶ Bases:
object
Context 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.
-
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:
eoxserver.core.component.Component
This
Component
provides extension points and helpers to easily retrive Package and Storage components by their type names.-
connected_storages
¶ List of components that implement
eoxserver.backends.interfaces.ConnectedStorageInterface
-
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.ConnectedStorageInterface
with 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.FileStorageInterface
with 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.PackageInterface
with 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.FileStorageInterface
oreoxserver.backends.interfaces.ConnectedStorageInterface
with the desiredstorage_type
.Parameters: storage_type – the desired storage type Returns: the desired storage component or None
-
packages
¶ List of components that implement
eoxserver.backends.interfaces.PackageInterface
-
storages
¶ Helper to retrieve components for all storage interfaces.
-
eoxserver.backends.config module¶
-
class
eoxserver.backends.config.
CacheConfigReader
(config)¶ Bases:
eoxserver.core.decoders.config.Reader
-
directory
¶
-
retention_time
¶
-
section
= 'backends'¶
-
eoxserver.backends.interfaces module¶
-
class
eoxserver.backends.interfaces.
AbstractStorageInterface
¶ Bases:
object
-
name
¶ Name of the storage implementation.
-
validate
(url)¶ Validates the given storage locator and raises a
django.core.exceptions.ValidationError
if errors occurred.
-
-
class
eoxserver.backends.interfaces.
ConnectedStorageInterface
¶ Bases:
eoxserver.backends.interfaces.AbstractStorageInterface
Interface 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:
eoxserver.backends.interfaces.AbstractStorageInterface
Interface 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
location
from the package to the givenpath
specification.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
-
name
¶ Name of the package implementation.
-
eoxserver.backends.middleware module¶
-
class
eoxserver.backends.middleware.
BackendsCacheMiddleware
¶ Bases:
object
A 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¶
eoxserver.backends.testbase module¶
-
eoxserver.backends.testbase.
withFTPServer
(port=2121, directory=None)¶