Poco::OSP::JS

class ModuleExtensionPoint

File Information

Library: OSP/JS
Package: Module
Header: Poco/OSP/JS/ModuleExtensionPoint.h

Description

ModuleExtensionPoint is used to add native (C++) JavaScript Modules to the JavaScript environment.

To register a native JavaScript Module:

<extension point="com.appinf.osp.js.module"
           module="<module>"
           class="<factory class>"
           library="<library name>"/>

Note that the extension points are automatically removed if a bundle is stopped.

The following attributes can be specified for the extension point:

  • module: the name of the module (e.g., "net"), as passed as argument to the JavaScript require() function.
  • class: the class name of the ModuleFactory (see the ModuleFactory and Poco::JS::Module classes).
  • library: the name of the shared library containing the ModuleFactory.

Inheritance

Direct Base Classes: Poco::OSP::ExtensionPoint

All Base Classes: Poco::OSP::ExtensionPoint, Poco::RefCountedObject

Member Summary

Member Functions: handleExtension, handleModule, moduleRegistry, onBundleStopped

Inherited Functions: duplicate, handleExtension, referenceCount, release, removeExtension

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < ModuleExtensionPoint >;

Constructors

ModuleExtensionPoint

ModuleExtensionPoint(
    Poco::OSP::BundleContext::Ptr pContext
);

Creates the ModuleExtensionPoint, using the given bundle context.

Destructor

~ModuleExtensionPoint virtual

~ModuleExtensionPoint();

Destroys the ModuleExtensionPoint.

Member Functions

handleExtension virtual

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

moduleRegistry inline

Poco::JS::Core::ModuleRegistry::Ptr moduleRegistry() const;

Returns the ModuleRegistry.

handleModule protected

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

Handle the Module extension point.

onBundleStopped protected

void onBundleStopped(
    const void * pSender,
    Poco::OSP::BundleEvent & ev
);

When a bundle is stopped, all of its Modules are automatically disabled.

Variables

EXTPOINT static

static const std::string EXTPOINT;

ATTR_CLASS protected static

static const std::string ATTR_CLASS;

ATTR_LIBRARY protected static

static const std::string ATTR_LIBRARY;

ATTR_MODULE protected static

static const std::string ATTR_MODULE;

MANIFEST_NAME protected static

static const std::string MANIFEST_NAME;

Securely control IoT edge devices from anywhere   Connect a Device