This class defines functionalities to handle remote CSE/CSR registrations.
| Method | __init__ |
Class constructor. |
| Method | check |
Force the connection monitor to check the connections now. |
| Method | config |
Callback for the configUpdate event. |
| Method | configure |
Read the configuration for the registrar and populate the configuration object. |
| Method | connection |
The background worker that checks periodically whether the connection to the registrar and registree CSEs is still valid. |
| Method | get |
Return all local <CSR> resources. This includes the <CSR> of the registrar CSE. This function builds the list from a temporary internal list, but not from the database. |
| Method | get |
Try to get a CSR even from a longer path (only the first 2 path elements are relevant). |
| Method | get |
Get the SP-relative /csi/ri resource ID of a remote CSE from its CSI. The searched for remote CSE must be registered either directly, or be a descendant CSE. |
| Method | handle |
Event handler for an updates of a registree or registrar CSR. |
| Method | handle |
Event handler for removing the registrar CSE/CSR CSI from the list of registered csi. |
| Method | handle |
Event handler for adding a registrar CSE/CSR CSI to the list of registered csi. |
| Method | handle |
Event handler for removals of registree's CSE/CSR CSI from the list of registered descendant CSE. |
| Method | handle |
Event handler for adding a registree's CSE's <CSR> to the list of registered descendant CSE. |
| Method | is |
Check whether this CSE is registered to its registrar CSE. |
| Method | restart |
Restart the remote service monitor. |
| Method | retrieve |
Retrieve a remote resource from one of the interconnected CSEs. |
| Method | start |
Start the RemoteCSEManager. |
| Method | start |
Start the remote monitor as a background worker. |
| Method | stop |
Stop the RemoteCSEManager. |
| Method | stop |
Stop the connection monitor. Also delete the CSR resources on both sides, if possible. |
| Method | update |
Update all the remote CSR of the descendant CSEs. |
| Method | validate |
Validate the configuration for the registrar and perform some additional initialization. |
| Class Variable | __slots__ |
Slots for RemoteCSEManager class. |
| Class Variable | dispatcher |
Injected Dispatcher instance. |
| Class Variable | factory |
Injected Factory instance. |
| Class Variable | registration |
Injected Registration manager instance. |
| Class Variable | request |
Injected RequestManager instance. |
| Class Variable | security |
Injected SecurityManager instance. |
| Instance Variable | connection |
The background worker that periodically checks the connections to the registrar and registree CSEs. It is started when the CSE starts and stopped when the CSE stops. |
| Instance Variable | descendant |
csi -> (CSR, registeredATcsi). |
| Instance Variable | registrar |
The local registrar configuration entry. This is stored internally for simplicity. |
| Instance Variable | sp |
A dictionary of all SP registrar configurations except the own one. |
| Method | _assign |
Store relevant configuration values in the manager. |
| Method | _check |
Check the connection for this CSE to the registrar CSE. |
| Method | _check |
Check the liveliness of all registree CSEss that are connected to this CSE. This is done by trying to retrieve the own remote <CSR> from the remote CSE. If it cannot be retrieved then the related local CSR is removed. |
| Method | _copy |
Copy the relevant attributes from a <CSEBase> to a <CSR> resource. |
| Method | _create |
Create the own <CSR> resource on the registrar CSE. |
| Method | _create |
Create a local <CSR> resource for the given registrar configuration. |
| Method | _delete |
Delete the own <CSR> resource from the registrar CSE. |
| Method | _delete |
Delete a local registree <CSR> resource. Unregister it first. |
| Method | _retrieve |
Retrieve the local <CSR> resources. |
| Method | _retrieve |
Retrieve the own <CSR> resource from the registrar CSE. |
| Method | _retrieve |
Retrieve the remote registrar CSEBase resource. |
| Method | _update |
Update the local CSEBase resource with information from the registrar CSE's CSR. |
| Method | _update |
Update the own <CSR> resource on the registrar CSE. |
Force the connection monitor to check the connections now.
This is useful for testing purposes or when the CSE is started and the connection monitor should be run immediately.
Callback for the configUpdate event.
| Parameters | |
eventEventData | The event data, containing the name of the updated configuration setting and its new value. |
Read the configuration for the registrar and populate the configuration object.
| Parameters | |
config:Configuration | The configuration object to populate. |
The background worker that checks periodically whether the connection to the registrar and registree CSEs is still valid.
| Returns | |
bool | Always True to keep the worker running. |
Return all local <CSR> resources. This includes the <CSR> of the registrar CSE. This function builds the list from a temporary internal list, but not from the database.
| Returns | |
list[ | List of <CSR> resources. |
Try to get a CSR even from a longer path (only the first 2 path elements are relevant).
If no direct CSR could be found then that CSR is returned where the addressed csi is a descendant.
| Parameters | |
id:str | CSE-ID to search for |
| Returns | |
tuple[ | A tuple (csr resource, list of path elements), or (None, None) in case of an error). |
Get the SP-relative /csi/ri resource ID of a remote CSE from its CSI. The searched for remote CSE must be registered either directly, or be a descendant CSE.
| Parameters | |
csi:str | The CSI of the remote CSE. |
| Returns | |
str | None | The SP-relative /csi/ri resource ID of the remote CSE, or None if not found. |
Event handler for an updates of a registree or registrar CSR.
Only the local registrar configuration is involved here.
| Parameters | |
eventEventData | The event data containing the updated CSR and the update dictionary. |
EventData):
¶
Event handler for removing the registrar CSE/CSR CSI from the list of registered csi.
| Parameters | |
eventEventData | The event data containing the registrar configuration and the registrar CSE resource that is de-registered. |
EventData):
¶
Event handler for adding a registrar CSE/CSR CSI to the list of registered csi.
| Parameters | |
eventEventData | The event data containing the registrar configuration, the registrar CSE resource, the own CSR on the registrar CSE and the local CSR representing the registrar CSE. |
EventData):
¶
Event handler for removals of registree's CSE/CSR CSI from the list of registered descendant CSE.
Only the local registrar configuration is involved here.
| Parameters | |
eventEventData | The event data containing the registree CSR resource that is de-registered. The CSR resource must contain the csi of the deregistering CSE. |
EventData):
¶
Event handler for adding a registree's CSE's <CSR> to the list of registered descendant CSE.
Only the local registrar configuration is involved here.
| Parameters | |
eventEventData | The event data containing the registree CSR resource that is registered. |
Check whether this CSE is registered to its registrar CSE.
| Returns | |
bool | True if registered, False otherwise. |
Retrieve a remote resource from one of the interconnected CSEs.
| Parameters | |
id:str | The resource ID. It must be at least in SP-relative format. |
originator:str | None | Optional request originator. If None is given then the CSE's CSE-ID is used. |
| Returns | |
Resource | Result object with the status and, if successful, the resource object in the resource attribute. |
Start the remote monitor as a background worker.
| Parameters | |
eventEventData | The event data. Not used in this handler. |
Update all the remote CSR of the descendant CSEs.
This happens in the background.
| Parameters | |
data:JSON | The content to update the descendant CSR with. This should be a dictionary with the attributes to update and their new values. |
target:list[ | Optional list of CSR IDs to update. If None then all descendant CSRs are updated. |
Validate the configuration for the registrar and perform some additional initialization.
| Parameters | |
config:Configuration | The configuration object to validate and initialize. |
The background worker that periodically checks the connections to the registrar and registree CSEs. It is started when the CSE starts and stopped when the CSE stops.
Check the liveliness of all registree CSEss that are connected to this CSE. This is done by trying to retrieve the own remote <CSR> from the remote CSE. If it cannot be retrieved then the related local CSR is removed.
| Parameters | |
registrarCSERegistrar | The registrar configuration to use for the search. |
CSERegistrar, target: Resource, source: Resource, isUpdate: bool | None = False, targetCsi: str = None, forOwnCSR: bool | None = False):
¶
Copy the relevant attributes from a <CSEBase> to a <CSR> resource.
| Parameters | |
registrarCSERegistrar | The registrar configuration to use for the copy operation. |
target:Resource | The target <CSEBase> resource. |
source:Resource | The source <CSR> resource. |
isbool | None | Indicator that the copy operation is for an UPDATE request. |
targetstr | Optional target CSE-ID to use for the copy operation. |
forbool | None | If True then the copy is for the own CSR, otherwise it is for a remote CSR. |
Create the own <CSR> resource on the registrar CSE.
| Parameters | |
registrarCSERegistrar | The registrar configuration to use for the creation. |
| Returns | |
Resource | Remote <CSR> resource |
Create a local <CSR> resource for the given registrar configuration.
The CSR is created based on the local CSEBase and the remote CSEBase of the registrar.
| Parameters | |
registrarCSERegistrar | The registrar configuration to use for the creation. |
| Returns | |
Resource | Local <CSR> resource |
Delete the own <CSR> resource from the registrar CSE.
| Parameters | |
registrarCSERegistrar | The registrar configuration to use for the deletion. |
Delete a local registree <CSR> resource. Unregister it first.
| Parameters | |
registreeResource | The <CSR> resource to de-register and delete. |
CSERegistrar, includeRegistrarCSR: bool | None = False, includeRegistreeCSR: bool | None = False) -> list[ Resource]:
¶
Retrieve the local <CSR> resources.
| Parameters | |
registrarCSERegistrar | The registrar configuration to use for the search. |
includebool | None | If True then include the CSR to the registrar CSE in the result. |
includebool | None | if True then include the CSR(s) to the registree CSE(s) in the result. |
| Returns | |
list[ | A list of found CSR resources. |
Retrieve the remote registrar CSEBase resource.
The actual request uses a direct URL as a fallback because the RETRIEVE request happens when the actual registration may not yet have happened, and the registrars <CSR> resource with the actual POA is not available at that time.
| Returns | |
Resource | The registrar's <CSE> resource. |
Update the local CSEBase resource with information from the registrar CSE's CSR.
| Parameters | |
localResource | The local <CSR> resource for the registrar CSE. This resource is provided during a registration or update event. |
| Returns | |
JSON | Dictionary with the updated attributes. If no attributes have been updated then an empty dictionary is returned. |
CSERegistrar, hostingCSE: Resource | None = None) -> Resource:
¶
Update the own <CSR> resource on the registrar CSE.
| Parameters | |
registrarCSERegistrar | The registrar configuration to use for the update. |
hostingResource | None | Optional CSE resource to use for the update. If None, the hosting <CSEBase> resource will be used. |
| Returns | |
Resource | Resource |