geonode.geoserver.manager ========================= .. py:module:: geonode.geoserver.manager Attributes ---------- .. autoapisummary:: geonode.geoserver.manager.logger Classes ------- .. autoapisummary:: geonode.geoserver.manager.GeoServerImporterSessionInfo geonode.geoserver.manager.GeoServerResourceManager Module Contents --------------- .. py:data:: logger .. py:class:: GeoServerImporterSessionInfo .. py:attribute:: upload_session :type: geonode.upload.models.Upload .. py:attribute:: import_session :type: gsimporter.api.Session .. py:attribute:: spatial_files_type :type: geonode.geoserver.helpers.SpatialFilesLayerType .. py:attribute:: dataset_name :type: AnyStr .. py:attribute:: workspace :type: AnyStr .. py:attribute:: target_store :type: AnyStr .. py:class:: GeoServerResourceManager Bases: :py:obj:`geonode.resource.manager.ResourceManagerInterface` .. py:method:: search(filter: dict, /, resource_type: Optional[object]) -> django.db.models.query.QuerySet 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 .. py:method:: exists(uuid: str, /, instance: geonode.base.models.ResourceBase = None) -> bool 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 .. py:method:: delete(uuid: str, /, instance: geonode.base.models.ResourceBase = None) -> int Removes the layer from GeoServer .. py:method:: create(uuid: str, /, resource_type: Optional[object] = None, defaults: dict = {}) -> geonode.base.models.ResourceBase 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 .. py:method:: 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 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 .. py:method:: ingest(files: List[str], /, uuid: str = None, resource_type: Optional[object] = None, defaults: dict = {}, **kwargs) -> geonode.base.models.ResourceBase 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}) .. py:method:: copy(instance: geonode.base.models.ResourceBase, /, uuid: str = None, owner: django.conf.settings.AUTH_USER_MODEL = None, defaults: dict = {}) -> geonode.base.models.ResourceBase 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 .. py:method:: append(instance: geonode.base.models.ResourceBase, vals: dict = {}, *args, **kwargs) -> geonode.base.models.ResourceBase The method appends data to an existing resource. - It assumes any GIS backend resource (e.g. layers on GeoServer) already exist. .. py:method:: replace(instance: geonode.base.models.ResourceBase, vals: dict = {}, *args, **kwargs) -> geonode.base.models.ResourceBase The method replaces data of an existing resource. - It assumes any GIS backend resource (e.g. layers on GeoServer) already exist. .. py:method:: import_dataset(method: str, uuid: str, /, instance: geonode.base.models.ResourceBase = None, **kwargs) -> geonode.base.models.ResourceBase .. py:method:: _execute_resource_import(instance, files: list, user, action_type: str, importer_session_opts: Optional[Dict] = None) .. py:method:: remove_permissions(uuid: str, /, instance: geonode.base.models.ResourceBase = None) -> bool Completely cleans the permissions of a resource, resetting it to the default state (owner only) .. py:method:: 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 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) .. py:method:: set_thumbnail(uuid: str, /, instance: geonode.base.models.ResourceBase = None, overwrite: bool = True, check_bbox: bool = True) -> bool Allows to generate or re-generate the Thumbnail of a Resource. .. py:method:: exec(method: str, uuid: str, /, instance: geonode.base.models.ResourceBase = None, **kwargs) -> geonode.base.models.ResourceBase :abstractmethod: 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. .. py:method:: set_style(method: str, uuid: str, instance: geonode.base.models.ResourceBase = None, **kwargs) -> geonode.base.models.ResourceBase .. py:method:: set_time_info(method: str, uuid: str, /, instance: geonode.base.models.ResourceBase = None, **kwargs) -> geonode.base.models.ResourceBase