class documentation

class AnnouncementManager(object):

View In Hierarchy

This class implements announcement functionalities.

Method announceResource Announce a single resource to its announcement target(s).
Method announceResourceToCSI Announce a resource to a specific registered remote CSE.
Method announceResourceViaDirectURL Announce a resource via a direct URL, nit via a csi.
Method announceUpdatedResource (Newly) announce an updated resource to a remote CSE.
Method checkResourcesForAnnouncement Check all resources in the resource tree and announce them if necessary.
Method checkResourcesForUnAnnouncement Check whether resources need announcements, and initiate announcement if they do.
Method configure Configure the announcement manager.
Method deAnnounceResource De-announce a single resource from its announcement target(s).
Method deAnnounceResourceFromCSI De-Announce a resource from a specific CSR.CSR.
Method handleRegisteredToRegistrarCSE Handle registrations to a registrar CSE.
Method handleRegistreeCSEHasRegistered Handle registrations when a registree CSE has registered.
Method searchAnnounceableResourcesForCSI Search and retrieve all resources that have the provided CSI in their at attribute.
Method start Initialization of the announcement manager.
Method stop Stop the announcement manager.
Method updateResourceOnCSI Update an announced resource on a specific remote CSE.
Method validate Validate the announcement manager configuration.
Class Variable dispatcher Injected Dispatcher instance.
Class Variable remoteCSEManager Injected RemoteCSEManager instance.
Class Variable requestManager Injected RequestManager instance.
Class Variable storage Injected Storage instance.
Method _announcedInfos Return the matching tuple for the given csi of a resource announcement, or None if none is set.
Method _isResourceAnnouncedTo Check whether a resource is announced to a specific remote CSE.
Method _removeAnnouncementFromResource Remove announcement details from a resource.
def announceResource(self, resource: AnnounceableResource):

Announce a single resource to its announcement target(s).

Parameters
resource:AnnounceableResourceThe resource to announce.
Returns
Result object indicating the success of the operation.
def announceResourceToCSI(self, resource: AnnounceableResource, announceTo: str):

Announce a resource to a specific registered remote CSE.

TODO

  • Support announcement to direct URL
Parameters
resource:AnnounceableResourceThe resource to announce.
announceTo:strCSE-ID of the remote CSE.
Returns
Result object indicating the success of the operation.
def announceResourceViaDirectURL(self, resource: Resource, at: str) -> bool:

Announce a resource via a direct URL, nit via a csi.

Attention

Not supported yet.

Parameters
resource:ResourceThe announceable resource to announce.
at:strThe direct URL of the remote CSE to where to announce the resource.
Returns
boolBoolean indicating the result.
def announceUpdatedResource(self, resource: AnnounceableResource, originator: str):

(Newly) announce an updated resource to a remote CSE.

Parameters
resource:AnnounceableResourceThe announceable resource that has been updated.
originator:strThe original UPDATE request's originator.
def checkResourcesForAnnouncement(self, remoteCSR: Resource):

Check all resources in the resource tree and announce them if necessary.

Parameters
remoteCSR:ResourceThe registree or registrar CSE's CSR.CSR resource.
def checkResourcesForUnAnnouncement(self, remoteCSR: Resource):

Check whether resources need announcements, and initiate announcement if they do.

See Also

  • searchAnnounceableResourcesForCSI
Parameters
remoteCSR:ResourceThe CSR.CSR remote resource.
def configure(self, config: Configuration):

Configure the announcement manager.

Parameters
config:ConfigurationThe configuration to apply.
def deAnnounceResource(self, resource: AnnounceableResource):

De-announce a single resource from its announcement target(s).

See Also

  • deAnnounceResourceFromCSI
Parameters
resource:AnnounceableResourceThe announceable resource to de-announce.
def deAnnounceResourceFromCSI(self, resource: AnnounceableResource, csi: str, remoteRI: str):

De-Announce a resource from a specific CSR.CSR.

Parameters
resource:AnnounceableResourceThe announceable resource to de-announce.
csi:strThe CSE-ID of the CSE from which the resource is to be de-announced.
remoteRI:strThe resource ID of the remote announced resource.
@onEvent(eventManager.registeredToRegistrarCSE)
def handleRegisteredToRegistrarCSE(self, eventData: EventData):

Handle registrations to a registrar CSE.

Parameters
eventData:EventDataThe event data containing the registrar configuration and the registrar CSE resource that is registered. The CSR resource must contain the csi of the registering CSE.
@onEvent(eventManager.registreeCSEHasRegistered)
def handleRegistreeCSEHasRegistered(self, eventData: EventData):

Handle registrations when a registree CSE has registered.

Parameters
eventData:EventDataThe event data containing the registree CSR resource that is registered. The CSR resource must contain the csi of the registering CSE.
def searchAnnounceableResourcesForCSI(self, csi: str, isAnnounced: bool) -> list[AnnounceableResource]:

Search and retrieve all resources that have the provided CSI in their at attribute.

Also distinguish between announced and not announced resources in the filter.

Parameters
csi:strThe CSE-ID of the CSE for which the announced resource are searched.
isAnnounced:boolBoolean indicating whether announced or non-announced resources are searched for.
Returns
list[AnnounceableResource]List of AnnounceableResource resources that have been found.
def start(self):

Initialization of the announcement manager.

def stop(self):

Stop the announcement manager.

Returns
Always True.
def updateResourceOnCSI(self, resource: AnnounceableResource, csi: str, remoteRI: str):

Update an announced resource on a specific remote CSE.

Parameters
resource:AnnounceableResourceThe announceable resource to update.
csi:strThe CSE-ID of the CSE where the announced resource is hosted.
remoteRI:strThe resource ID of the remote announced resource.
def validate(self, config: Configuration):

Validate the announcement manager configuration.

Parameters
config:ConfigurationThe configuration to validate.
dispatcher: Dispatcher =

Injected Dispatcher instance.

remoteCSEManager: RemoteCSEManager | None =

Injected RemoteCSEManager instance.

requestManager: RequestManager =

Injected RequestManager instance.

storage: Storage =

Injected Storage instance.

def _announcedInfos(self, resource: Resource, announceTo: str) -> tuple[str, str] | None:

Return the matching tuple for the given csi of a resource announcement, or None if none is set.

Parameters
resource:ResourceThe announceable resource to check.
announceTo:strThe CSE-ID of the CSE where the announced resource is supposed to be hosted. This could be an Absolute or SP-relative CSE-ID.
Returns
tuple[str, str] | NoneUndocumented
def _isResourceAnnouncedTo(self, resource: Resource, csi: str) -> bool:

Check whether a resource is announced to a specific remote CSE.

This is done by looking at the entries in the internal __announcedTo__ attribute, ie. whether they will contain the csi of the remote CSE.

Parameters
resource:ResourceThe announceable resource to check.
csi:strThe CSE-ID of the CSE where the announced resource is supposed to be hosted.
Returns
boolBoolean indicating the announced status.
def _removeAnnouncementFromResource(self, resource: Resource, csi: str):

Remove announcement details from a resource.

Modify the internal __announcedTo__ attribute as well the at attribute to remove the reference to the remote CSE from announced resource.

Parameters
resource:ResourceThe announceable resource to remove.
csi:strThe CSE-ID of the CSE where the announced resource is hosted.