geonode.geoserver.manager

Attributes

logger

Classes

GeoServerImporterSessionInfo

GeoServerResourceManager

Module Contents

geonode.geoserver.manager.logger[source]
class geonode.geoserver.manager.GeoServerImporterSessionInfo[source]
upload_session: geonode.upload.models.Upload[source]
import_session: gsimporter.api.Session[source]
spatial_files_type: geonode.geoserver.helpers.SpatialFilesLayerType[source]
dataset_name: AnyStr[source]
workspace: AnyStr[source]
target_store: AnyStr[source]
class geonode.geoserver.manager.GeoServerResourceManager[source]

Bases: geonode.resource.manager.ResourceManagerInterface

search(filter: dict, /, resource_type: object | None) django.db.models.query.QuerySet[source]

Returns a QuerySet of the filtered resources into the DB.

  • The ‘filter’ parameter should be an dictionary with the filtering criteria; - ‘filter’ = None won’t return any result - ‘filter’ = {} will return the whole set

  • The ‘resource_type’ parameter allows to specify the concrete resource model (e.g. Dataset, Document, Map, …) - ‘resource_type’ must be a class - ‘resource_type’ = Dataset will return a set of the only available Layers

exists(uuid: str, /, instance: geonode.base.models.ResourceBase = None) bool[source]

Returns ‘True’ or ‘False’ if the resource exists or not.

  • If ‘instance’ is provided, it will take precedence on ‘uuid’

  • The existance criteria might be subject to the ‘concrete resource manager’ one, dependent on the resource type e.g.: a local Dataset existance check will be constrained by the existance of the layer on the GIS backend

delete(uuid: str, /, instance: geonode.base.models.ResourceBase = None) int[source]

Removes the layer from GeoServer

create(uuid: str, /, resource_type: object | None = None, defaults: dict = {}) geonode.base.models.ResourceBase[source]

The method will just create a new ‘resource_type’ on the DB model and invoke the ‘post save’ triggers.

  • It assumes any GIS backend resource (e.g. layers on GeoServer) already exist.

  • It is possible to pass initial default values, like the ‘files’ from the ‘storage_manager’ trhgouh the ‘defaults’ dictionary

update(uuid: str, /, instance: geonode.base.models.ResourceBase = None, xml_file: str = None, metadata_uploaded: bool = False, vals: dict = {}, regions: dict = {}, keywords: dict = {}, custom: dict = {}, notify: bool = True, **kwargs) geonode.base.models.ResourceBase[source]

The method will update an existing ‘resource_type’ on the DB model and invoke the ‘post save’ triggers.

  • It assumes any GIS backend resource (e.g. layers on GeoServer) already exist.

  • It is possible to pass initial default values, like the ‘files’ from the ‘storage_manager’ trhgouh the ‘vals’ dictionary

  • The ‘xml_file’ parameter allows to fetch metadata values from a file

  • The ‘notify’ parameter allows to notify the members that the resource has been updated

ingest(files: List[str], /, uuid: str = None, resource_type: object | None = None, defaults: dict = {}, **kwargs) geonode.base.models.ResourceBase[source]

The method allows to create a resource by providing the list of files.

e.g.:

In [1]: from geonode.resource.manager import resource_manager

In [2]: from geonode.layers.models import Dataset

In [3]: from django.contrib.auth import get_user_model

In [4]: admin = get_user_model().objects.get(username=’admin’)

In [5]: files = [“/…/san_andres_y_providencia_administrative.dbf”, “/…/san_andres_y_providencia_administrative.prj”, …: “/…/san_andres_y_providencia_administrative.shx”, “/…/san_andres_y_providencia_administrative.sld”, “/…/san_andres_y_providencia_administrative.shp”]

In [6]: resource_manager.ingest(files, resource_type=Dataset, defaults={‘owner’: admin})

copy(instance: geonode.base.models.ResourceBase, /, uuid: str = None, owner: django.conf.settings.AUTH_USER_MODEL = None, defaults: dict = {}) geonode.base.models.ResourceBase[source]

The method makes a copy of the existing resource.

  • It makes a copy of the files

  • It creates a new layer on the GIS backend in the case the ResourceType is a Dataset

append(instance: geonode.base.models.ResourceBase, vals: dict = {}, *args, **kwargs) geonode.base.models.ResourceBase[source]

The method appends data to an existing resource.

  • It assumes any GIS backend resource (e.g. layers on GeoServer) already exist.

replace(instance: geonode.base.models.ResourceBase, vals: dict = {}, *args, **kwargs) geonode.base.models.ResourceBase[source]

The method replaces data of an existing resource.

  • It assumes any GIS backend resource (e.g. layers on GeoServer) already exist.

import_dataset(method: str, uuid: str, /, instance: geonode.base.models.ResourceBase = None, **kwargs) geonode.base.models.ResourceBase[source]
_execute_resource_import(instance, files: list, user, action_type: str, importer_session_opts: Dict | None = None)[source]
remove_permissions(uuid: str, /, instance: geonode.base.models.ResourceBase = None) bool[source]

Completely cleans the permissions of a resource, resetting it to the default state (owner only)

set_permissions(uuid: str, /, instance: geonode.base.models.ResourceBase = None, owner: django.conf.settings.AUTH_USER_MODEL = None, permissions: dict = {}, created: bool = False, approval_status_changed: bool = False, group_status_changed: bool = False) bool[source]

Sets the permissions of a resource.

  • It optionally gets a JSON ‘perm_spec’ through the ‘permissions’ parameter

  • If no ‘perm_spec’ is provided, it will set the default permissions (owner only)

set_thumbnail(uuid: str, /, instance: geonode.base.models.ResourceBase = None, overwrite: bool = True, check_bbox: bool = True) bool[source]

Allows to generate or re-generate the Thumbnail of a Resource.

abstract exec(method: str, uuid: str, /, instance: geonode.base.models.ResourceBase = None, **kwargs) geonode.base.models.ResourceBase[source]

A generic ‘exec’ method allowing to invoke specific methods of the concrete resource manager not exposed by the interface.

  • The parameter ‘method’ represents the actual name of the concrete method to invoke.

set_style(method: str, uuid: str, instance: geonode.base.models.ResourceBase = None, **kwargs) geonode.base.models.ResourceBase[source]
set_time_info(method: str, uuid: str, /, instance: geonode.base.models.ResourceBase = None, **kwargs) geonode.base.models.ResourceBase[source]