class AnnounceableResource(Resource):
Known subclasses: acme.resources.ACP.ACP, acme.resources.ACTR.ACTR, acme.resources.AE.AE, acme.resources.CIN.CIN, acme.resources.ContainerResource.ContainerResource, acme.resources.CSEBase.CSEBase, acme.resources.CSR.CSR, acme.resources.DEPR.DEPR, acme.resources.FCI.FCI, acme.resources.GRP.GRP, acme.resources.LCP.LCP, acme.resources.MgmtObj.MgmtObj, acme.resources.NOD.NOD, acme.resources.PRMR.PRMR, acme.resources.PRP.PRP, acme.resources.SCH.SCH, acme.resources.SMD.SMD, acme.resources.STTE.STTE, acme.resources.TGR.TGR, acme.resources.TSB.TSB, acme.resources.TSI.TSI
Constructor: AnnounceableResource(dct, create)
Base class for all announceable resources.
| Method | __init__ |
Initialization of a Resource instance. |
| Method | activate |
This method is called to activate a resource, usually in a CREATE request. |
| Method | add |
Add anouncement information to the resource. These are a list of tuples of the csi to which the resource is registered and the CSE-relative ri of the resource on the remote CSE. Also, add the reference in the at attribute. |
| Method | create |
Create the dict stub for the announced resource. |
| Method | deactivate |
Deactivate an active resource. |
| Method | get |
Return the internal announcedTo list attribute of a resource. |
| Method | remove |
Remove anouncement information from the resource. These are a list of tuples of the csi to which the resource is registered and the CSE-relative ri of the resource on the remote CSE. Also, remove the reference from the at attribute. |
| Method | set |
Set the internal announcedTo list attribute of a resource. |
| Method | update |
Update, add or remove resource attributes. |
| Method | validate |
Validate a resource. |
| Method | validate |
Possibility to add or modify the announced Dict. This can be implemented in the child classes. |
| Class Variable | announcement |
Injected AnnouncementManager instance. |
| Class Variable | validator |
Injected Validator instance. |
| Method | _create |
Actually create the resource dict. |
| Method | _get |
Return a list of mandatory and optional announced attributes. The function only returns those attributes that are also present in the resource! |
| Instance Variable | _orig |
Store the original announceableAttributes for later use in the update so that we can check whether they are removed. |
| Instance Variable | _orig |
Store the original at attribute for later use in the update so that we can check whether it is removed. |
Inherited from Resource:
| Method | __contains__ |
Implementation of the membership test operator. |
| Method | __delitem__ |
Implementation of the self[key| operation for deleting attributes. |
| Method | __eq__ |
Test for equality of the resource to another resource. |
| Method | __getattr__ |
Map the normal object attribute access to the internal resource attribute dictionary. |
| Method | __getitem__ |
Implementation of the self[key| operation for retrieving attributes. |
| Method | __repr__ |
Object representation as string. |
| Method | __setitem__ |
Implementation of the self[key] operation for assigning to attributes. |
| Method | __str__ |
String representation of the resource's attributes. |
| Method | as |
Get the JSON resource representation. |
| Method | attribute |
Return the value of an attribute. |
| Method | can |
Check whether resource is a valild child resource for this resource. |
| Method | child |
Called after a child resource was added to the resource. |
| Method | child |
Called when a child resource of the resource was removed. |
| Method | child |
Called when a child resource was updated. |
| Method | child |
Called before a child will be added to a resource. |
| Method | create |
Create a child resource from a JSON dictionary. |
| Method | db |
Add the resource to the database. |
| Method | db |
Delete the resource from the database. |
| Method | db |
Load a new copy of the same resource from the database. |
| Method | db |
Reload the resource instance from the database. |
| Method | db |
Update the resource in the database. |
| Method | decrement |
Decrement the subscription counter for the resource. |
| Method | del |
Delete the attribute 'key' from the resource. |
| Method | get |
Get all attributes of the resource. |
| Method | get |
Retrieve the current originator. This could be different from the originator / creator of the resource in case of the custodian attribute is set. |
| Method | get |
Determine and return the final value of an attribute during an update. |
| Method | get |
Retrieve a resource's location coordinates (internal attribute). |
| Method | get |
Retrieve a resource's originator. |
| Method | get |
Retrieve a resource's release version indicator. |
| Method | get |
Retrieve a resource's full structured resource name. |
| Method | get |
Retrieve the subscription counter for the resource. |
| Method | handle |
Process a CREATE request that is directed to a virtual resource. |
| Method | handle |
Process a DELETE request that is directed to a virtual resource. |
| Method | handle |
Process a notification request that is directed to a resource. |
| Method | handle |
Process a RETRIEVE request that is directed to a virtual resource. |
| Method | handle |
Process a UPDATE request that is directed to a virtual resource. |
| Method | has |
Check whether an attribute exists for the resource. |
| Method | has |
Test whether a resource supports the specified attribute. This method may be overwritten in sub-classes, for example for virtual resources. |
| Method | increment |
Increment the subscription counter for the resource. |
| Method | initialize |
This method is called when a new resource is created and before written to the database. |
| Method | is |
Test whether a the resource's type is an announced type. |
| Method | is |
Test whether a resource has been created for another resource. |
| Method | is |
Test whether this resource has been modified after another resource. |
| Method | is |
Test whether the resource is a virtual resource. |
| Method | retrieve |
Retrieve the parent resource of this resouce. |
| Method | retrieve |
Retrieve the raw (!) parent resource of this resouce. |
| Method | select |
Determine the selected attributes for a partial retrieve of a resource. |
| Method | set |
Assign a value to a resource attribute. |
| Method | set |
Save the resource ID for which this resource was created for. |
| Method | set |
Set a resource's location coordinates (internal attribute). |
| Method | set |
Set a resource's originator. |
| Method | set |
Set the resource ID for the resource if not already set. |
| Method | set |
Set the resource name. |
| Method | set |
Assign the release version for a resource. |
| Method | set |
Set a resource's full structured resource name. |
| Method | structured |
Determine the structured path of a resource. |
| Method | type |
Return the resource type as a string. If the resource is a flex container, the specialization is added. |
| Method | updated |
Signal to a resource that is was successfully updated. |
| Method | will |
This method is called before a resource will be deactivated. |
| Method | will |
This method is called before a resource will be send back in a RETRIEVE response. |
| Method | will |
This method is called before a resource will be updated and before calling the update() method. |
| Class Variable | __slots__ |
Slots for the class. |
| Class Variable | dispatcher |
Injected Dispatcher instance. |
| Class Variable | factory |
Injected Factory instance. |
| Class Variable | importer |
Injected Importer instance. |
| Class Variable | notification |
Injected NotificationManager instance. |
| Class Variable | request |
Injected RequestManager instance. |
| Class Variable | storage |
Injected Storage instance. |
| Instance Variable | dict |
Dictionary for public and internal resource attributes. |
| Method | _check |
Check whether a referenced ACP resoure exists, and if yes, change the ID in the list to CSE relative unstructured format. |
| Method | _normalize |
Normalize the URLs in the given attribute. |
| Class Variable | _exclude |
Resource attributes that are excluded when updating the resource |
| Instance Variable | _original |
Original dictionary as it was created. This is used for validation in activate() later. |
Initialization of a Resource instance.
| Parameters | |
dct:JSON | None | Mandatory resource attributes. |
create:bool | None | Undocumented |
acme.resources.ACP.ACP, acme.resources.ACTR.ACTR, acme.resources.AE.AE, acme.resources.CIN.CIN, acme.resources.CNT.CNT, acme.resources.CSEBase.CSEBase, acme.resources.DEPR.DEPR, acme.resources.FCNT.FCNT, acme.resources.GRP.GRP, acme.resources.LCP.LCP, acme.resources.PRMR.PRMR, acme.resources.PRP.PRP, acme.resources.SCH.SCH, acme.resources.SMD.SMD, acme.resources.STTE.STTE, acme.resources.TGR.TGR, acme.resources.TS.TS, acme.resources.TSB.TSBThis method is called to activate a resource, usually in a CREATE request.
This is not always the case, e.g. when a resource object is just used temporarly. NO notification on activation/creation happens in this method!
This method is implemented in sub-classes as well.
| Parameters | |
parentResource | The resource's parent resource. |
originator:str | The request's originator. |
| Raises | |
BAD_REQUEST | In case of an invalid attribute. |
Add anouncement information to the resource. These are a list of tuples of the csi to which the resource is registered and the CSE-relative ri of the resource on the remote CSE. Also, add the reference in the at attribute.
| Parameters | |
csi:str | csi of the remote CSE |
remotestr | ri of the announced resource on the remote CSE |
bool | None = False, announceTo: str | None = None) -> JSON:
¶
Create the dict stub for the announced resource.
acme.resources.ACP.ACP, acme.resources.ACTR.ACTR, acme.resources.AE.AE, acme.resources.LCP.LCP, acme.resources.NOD.NOD, acme.resources.SCH.SCH, acme.resources.SMD.SMD, acme.resources.TGR.TGR, acme.resources.TS.TS, acme.resources.TSB.TSBDeactivate an active resource.
This usually happens when creating the resource via a request. A subscription check for deletion is performed.
This method is implemented in sub-classes as well.
| Parameters | |
originator:str | The requests originator that let to the deletion of the resource. |
parentResource | The resource's parent resource. |
Return the internal announcedTo list attribute of a resource.
| Returns | |
list[ | The internal list of announcedTo tupples (csi, remote resource ID) for this resource. |
Remove anouncement information from the resource. These are a list of tuples of the csi to which the resource is registered and the CSE-relative ri of the resource on the remote CSE. Also, remove the reference from the at attribute.
| Parameters | |
csi:str | csi of the remote CSE |
| Returns | |
str | None | Undocumented |
Set the internal announcedTo list attribute of a resource.
| Parameters | |
announcedlist[ | The list of announcedTo tupples (csi, remote resource ID) to assign to a resource. |
JSON = None, originator: str | None = None, doValidateAttributes: bool | None = True):
¶
acme.resources.Resource.Resource.updateacme.resources.ACTR.ACTR, acme.resources.CIN.CIN, acme.resources.CNT.CNT, acme.resources.DEPR.DEPR, acme.resources.FCI.FCI, acme.resources.FCNT.FCNT, acme.resources.PRMR.PRMR, acme.resources.SCH.SCH, acme.resources.SMD.SMD, acme.resources.STTE.STTE, acme.resources.TGR.TGR, acme.resources.TS.TS, acme.resources.TSB.TSB, acme.resources.TSI.TSIUpdate, add or remove resource attributes.
A subscription check for update is performed.
This method is implemented in sub-classes as well.
Note
This method updates the resource in the database. It should be called only after all other checks where performed.
| Parameters | |
dct:JSON | An optional JSON dictionary with the attributes to be updated. |
originator:str | None | The optional requests originator that let to the update of the resource. |
dobool | None | If True optionally call the resource's validate() method. |
| Raises | |
CONTENTS_UNACCEPTABLE | In case of a resource mismatch. |
BAD_REQUEST | In case of an invalid attribute. |
INTERNAL_SERVER_ERROR | In case the parent resource coudln't be retrieved. |
str | None = None, dct: JSON | None = None, parentResource: Resource | None = None):
¶
acme.resources.ACP.ACP, acme.resources.AE.AE, acme.resources.CIN.CIN, acme.resources.CNT.CNT, acme.resources.CSEBase.CSEBase, acme.resources.CSR.CSR, acme.resources.GRP.GRP, acme.resources.LCP.LCP, acme.resources.SCH.SCH, acme.resources.SMD.SMD, acme.resources.TS.TS, acme.resources.TSB.TSBValidate a resource.
Usually called within activate() or update() methods.
This method is implemented in some sub-classes.
- Raises
BAD_REQUEST: In case of a validation error.
| Parameters | |
originator:str | None | Optional request originator |
dct:JSON | None | Updated attributes to validate |
parentResource | None | The parent resource |
acme.resources.ACP.ACPPossibility to add or modify the announced Dict. This can be implemented in the child classes.
acme.resources.ACTR.ACTR, acme.resources.CIN.CIN, acme.resources.FCNT.FCNT, acme.resources.PRP.PRP, acme.resources.TS.TSInjected Validator instance.
AttributePolicyDict, isCreate: bool, isRemoteSP: bool) -> JSON:
¶
Actually create the resource dict.
Return a list of mandatory and optional announced attributes. The function only returns those attributes that are also present in the resource!
Store the original announceableAttributes for later use in the update so that we can check whether they are removed.
Store the original at attribute for later use in the update so that we can check whether it is removed.