Table of Contents

TTMSMCPResources Class

The set of resources a server publishes, holding both fixed-address entries and templates.

API unit family: TMS.MCP.Resources Inherits from: TOwnedCollection

Syntax

TTMSMCPResources = class(TOwnedCollection)

Remarks

The collection owns its entries and frees them, so an entry obtained from it must never be freed by the caller; the registration methods likewise copy what they are given instead of adopting it. Adding or removing an entry raises the change event, which a server uses to tell connected clients that the list moved — but only when it advertises resource list-change notifications; with that switch off the notification is a silent no-op. Editing a property of an entry that is already in the collection raises that entry's own change event instead, and does not mark the collection as changed.

Properties

Name Description
Items Entries in the collection, addressed by their position.
Lock Guards this collection's own registration and removal methods (Add, AddResource, RegisterDirectResource, RegisterTemplateResource, UnregisterResource) against a concurrent read of the collection, for example while resources/list is being served on another thread.

Methods

Name Description
Add Appends an empty entry and returns it so its properties can be filled in.
AddResource Validates an entry and appends a copy of it to the collection.
FindByURI Looks up the entry published at one exact address.
FindMatchingTemplate Looks up the first template entry whose pattern covers an address.
RegisterDirectResource Publishes a resource at one fixed address in a single call.
RegisterTemplateResource Publishes a resource covering a family of addresses in a single call.
UnregisterResource Removes the entry published at one fixed address, when one is registered.

Events

Name Description
OnChanged Occurs when the set of entries changes, so anything derived from the list can be refreshed.

Used by