:py:mod:`magpie.adapter.magpieservice` ====================================== .. py:module:: magpie.adapter.magpieservice .. autoapi-nested-parse:: Store adapters to read data from magpie. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: magpie.adapter.magpieservice.ServiceStoreInterface magpie.adapter.magpieservice.MagpieServiceStore Attributes ~~~~~~~~~~ .. autoapisummary:: magpie.adapter.magpieservice.LOGGER .. py:class:: ServiceStoreInterface(request) Bases: :py:obj:`object` .. py:data:: LOGGER .. py:class:: MagpieServiceStore(request: pyramid.request.Request) Bases: :py:obj:`twitcher.store.ServiceStoreInterface` Registry for OWS services. Uses magpie to fetch service url and attributes. .. py:method:: save_service(name: magpie.typedefs.Str, url: magpie.typedefs.Str, *args: Any, **kwargs: Any) -> NoReturn Store is read-only, use `Magpie` :term:`API` to add services. .. note:: Multiple redundant parameters are applied to support different `Twitcher` versions. - ``Twitcher <=0.5.x`` uses ``(service, *args, **kwargs)`` - ``Twitcher >=0.6.x`` uses ``(name, url, *args, **kwargs)`` - Some alternate interfaces also provided extra parameters at some point. .. py:method:: delete_service(name: magpie.typedefs.Str, *args: Any, **kwargs: Any) -> NoReturn Store is read-only, use :mod:`Magpie` :term:`API` to delete services. .. py:method:: list_services() -> List[twitcher.models.Service] Lists all services registered in `Magpie`. .. py:method:: _fetch_by_name_cached(service_name: magpie.typedefs.Str) -> twitcher.models.Service Cache this method with :py:mod:`beaker` based on the provided caching key parameters. If the cache is not hit (expired timeout or new key entry), calls :meth:`fetch_by_name` to retrieve the actual :class:`twitcher.datatype.Service` definition. Otherwise, returns the cached item to avoid SQL queries. .. note:: Function arguments are required to generate caching keys by which cached elements will be retrieved. .. note:: Method :meth:`fetch_by_name` gets triggered by :meth:`twitcher.owsproxy.owsproxy_view` after successful validation of granted access for :term:`Logged User` to the service / resources following call to :meth:`magpie.adapter.magpieowssecurity.MagpieOWSSecurity.check_request` in order to send and retrieve the actual response of that proxied service and forward it back to the requesting user. Caching helps greatly reduce recurrent SQL queries to convert `Twitcher` to `Magpie` service. .. seealso:: - :meth:`magpie.adapter.magpieowssecurity.MagpieOWSSecurity.get_service` - :meth:`magpie.adapter.magpieservice.MagpieServiceStore.fetch_by_name` .. py:method:: fetch_by_name(name: magpie.typedefs.Str) -> twitcher.models.Service Gets :class:`twitcher.datatype.Service` corresponding to :class:`magpie.models.Service` by ``name``. .. py:method:: fetch_by_url(url: magpie.typedefs.Str) -> twitcher.models.Service Gets service for given ``url`` from mongodb storage. .. py:method:: clear_services() -> NoReturn :abstractmethod: Magpie store is read-only, use magpie api to delete services.