Poco::OSP

class ExtensionPoint

File Information

Library: OSP
Package: ExtensionPointService
Header: Poco/OSP/ExtensionPoint.h

Description

An extension point allows a bundle to provide "hooks" that other bundles can hook into to extend a bundle's functionality.

A bundle registers one or more instances of subclasses of ExtensionPoint with the ExtensionPointService. The ExtensionPointService then looks for an "extensions.xml" file in every bundle that is started and calls the handleExtension() member function for every extension element targetted at the extension point.

When a bundle defining an extension is stopped, the ExtensionPoint's removeExtension() member function is invoked.

Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Known Derived Classes: Poco::OSP::JS::ModuleExtensionPoint, Poco::OSP::Web::WebServerExtensionPoint, Poco::OSP::JS::JSExtensionPoint, Poco::OSP::Web::WebFilterExtensionPoint

Member Summary

Member Functions: handleExtension, removeExtension

Inherited Functions: duplicate, referenceCount, release

Types Aliases

ConstPtr

using ConstPtr = const Ptr;

Ptr

using Ptr = Poco::AutoPtr < ExtensionPoint >;

Constructors

ExtensionPoint protected

ExtensionPoint();

Creates the ExtensionPoint.

Destructor

~ExtensionPoint protected virtual

~ExtensionPoint();

Destroys the ExtensionPoint.

Member Functions

handleExtension virtual

virtual void handleExtension(
    Bundle::ConstPtr pBundle,
    Poco::XML::Element * pExtensionElem
) = 0;

Handles the "extension" element in a bundle's "extensions.xml" configuration file. Must be overridden by subclasses.

The ExtensionPoint facility entirely leaves it to the ExtensionPoint subclass to define the content (child elements and attributes) of the extension element. The only required attribute on the "extension" element is the "point" attribute identifying the extension point (and thus the ExtensionPoint object handling the "extension" element.

removeExtension virtual

virtual void removeExtension(
    Bundle::ConstPtr pBundle,
    Poco::XML::Element * pExtensionElem
);

Removes an extension from the extension point.

Usually this includes reverting actions, performed in handleExtension().

To keep compatibility with existing extension points, this member function is not pure virtual.

Securely control IoT edge devices from anywhere   Connect a Device