cowbird.handlers

Subpackages

Submodules

Package Contents

Classes

Handler

Helper class that provides a standard way to create an ABC using

HandlerFactory

Create handler instance using handler name.

Functions

get_handlers(→ List[handler.Handler])

Obtains the handlers managed by the application.

Attributes

AnySettingsContainer

class cowbird.handlers.Handler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

Parameters:
  • settings – Cowbird settings for convenience

  • name – Handler name

  • kwargs – The base class handle, but doesn’t require the following variables:

  • url – Location of the web service represented by the cowbird handler

  • workspace_dir – Workspace directory

  • priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.

abstract property required_params: List[AnyHandlerParameter]
__slots__

Handler interface used to notify implemented handlers of users/permissions changes.

Todo

At some point we will need a consistency function that goes through all Magpie users and make sure that handlers are up-to-date.

json() cowbird.typedefs.JSON[source]
_user_workspace_dir(user_name: str) str[source]
abstract get_resource_id(resource_full_name: str) int[source]

Each handler must provide this implementation required by the permission synchronizer.

The function needs to find the resource id in Magpie from the resource full name using its knowledge of the service. If the resource doesn’t already exist, the function needs to create it, again using its knowledge of resource type and parent resource type if required.

abstract user_created(user_name: str) None[source]
abstract user_deleted(user_name: str) None[source]
abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None[source]
class cowbird.handlers.HandlerFactory[source]

Create handler instance using handler name.

create_handler(name: Literal[Catalog]) cowbird.handlers.impl.catalog.Catalog[source]
create_handler(name: Literal[FileSystem]) cowbird.handlers.impl.filesystem.FileSystem
create_handler(name: Literal[Geoserver]) cowbird.handlers.impl.geoserver.Geoserver
create_handler(name: Literal[Magpie]) cowbird.handlers.impl.magpie.Magpie
create_handler(name: Literal[Nginx]) cowbird.handlers.impl.nginx.Nginx
create_handler(name: Literal[Thredds]) cowbird.handlers.impl.thredds.Thredds
create_handler(name: str) cowbird.handlers.handler.Handler | None

Instantiates a new Handler implementation using its name, overwriting an existing instance if required.

get_handler(name: Literal[Catalog]) cowbird.handlers.impl.catalog.Catalog[source]
get_handler(name: Literal[FileSystem]) cowbird.handlers.impl.filesystem.FileSystem
get_handler(name: Literal[Geoserver]) cowbird.handlers.impl.geoserver.Geoserver
get_handler(name: Literal[Magpie]) cowbird.handlers.impl.magpie.Magpie
get_handler(name: Literal[Nginx]) cowbird.handlers.impl.nginx.Nginx
get_handler(name: Literal[Thredds]) cowbird.handlers.impl.thredds.Thredds
get_handler(name: str) cowbird.handlers.handler.Handler | None

Instantiates a Handler implementation using its name if it doesn’t exist or else returns the existing one from cache.

get_active_handlers() List[cowbird.handlers.handler.Handler][source]

Return a sorted list by priority of Handler implementation activated in the config.

cowbird.handlers.AnySettingsContainer[source]
cowbird.handlers.get_handlers(container: cowbird.typedefs.AnySettingsContainer | None = None) List[handler.Handler][source]

Obtains the handlers managed by the application.