xentara-plugin v1.2.1
The Xentara Plugin Framework
Loading...
Searching...
No Matches
Plugin Entities

Common interface shared by all plugin element classes. More...

Classes

class  FallbackConfigHandler
 Called by the framework to resolve an attribute with a specific name. More...
 

Public Member Functions

auto  name() const -> std::string_view
 Gets the name of the element. More...
 
auto  primaryKey() const -> std::string_view
 Gets the primary key of the element. More...
 
auto  uuid() const -> xentara::utils::core::Uuid
 Gets the UUID of the element. More...
 
virtual auto  resolveAttribute (std::string_view name) -> const xentara::model::Attribute *
 Called by the framework to resolve an attribute with a specific name. More...
 
virtual auto  resolveTask (std::string_view name) -> std::shared_ptr< xentara::process::Task >
 Called by the framework to resolve a task with a specific name. More...
 
virtual auto  resolveEvent (std::string_view name) -> std::shared_ptr< xentara::process::Event >
 Called by the framework to resolve an event with a specific name. More...
 
virtual auto  readHandle (const xentara::model::Attribute &attribute) const noexcept -> xentara::data::ReadHandle
 Called by the framework to get a read handle for a specific attribute. More...
 
virtual auto  writeHandle (const xentara::model::Attribute &attribute) const noexcept -> xentara::data::WriteHandle
 Called by the framework to get a write handle for a specific attribute. More...
 

Protected Types

using  ConfigIntializer = xentara::memory::Initializer<xentara::memory::Array>
 Type alias for an initializer for the configuration. More...
 

Protected Member Functions

virtual auto  loadConfig (const ConfigIntializer &initializer, xentara::utils::json::decoder::Object &jsonObject, xentara::config::Resolver &resolver, const FallbackConfigHandler &fallbackHandler) -> void
 Called by the framework to load the element's configuration from a JSON object. More...
 
virtual auto  realize () -> void
 Called by the framework once all references have been resolved. More...
 
virtual auto  prepare () -> void
 Called by the framework to prepare the element for operation. More...
 
virtual auto  cleanup () -> void
 Called by the framework to cleanup the element after operation. More...
 
auto  configBlock () const noexcept -> const xentara::memory::ArrayBlock &
 Gets the memory block that the configuration is stored in. More...
 

Detailed Description

Common interface shared by all plugin element classes.

This documentation describes the common interface shared by all plugin element classes. See the individual classes for more detailed information.

Versions
xentara::io::Component
xentara::io::Io
xentara::io::IoBatch
xentara::process::Microservice

Member Typedef Documentation

◆  ConfigIntializer

Member Function Documentation

◆  configBlock()

auto Element::configBlock ( ) const -> const xentara::memory::ArrayBlock &
protectednoexcept

◆  loadConfig()

virtual auto Element::loadConfig ( const ConfigIntializerinitializer,
xentara::utils::json::decoder::ObjectjsonObject,
xentara::config::Resolverresolver,
const FallbackConfigHandlerfallbackHandler 
) -> void
protectedvirtual

Called by the framework to load the element's configuration from a JSON object.

Parameters
initializerAn initializer object for the memory block that contains the configuration. Use this object to access the storage for any configuration attributes you added to the config() array in the element class.
jsonObjectThe JSON object
resolverAn object that allows you to resolve cross references
fallbackHandlerAn object that handles config parameters unknown to the sub class. You should call the function call operator of this object for any config parameters you do not recognize.
Exceptions
std::runtime_errorThe function must throw this exception (or a suitable subclass) if an error occurs
Versions
xentara::io::Component::loadConfig()
xentara::io::Io::loadConfig()
xentara::io::IoBatch::loadConfig()
xentara::process::Microservice::loadConfig()
See also
Loading Element Configs
Examples
LoadingElementConfig.cpp

◆  name()

auto Element::name ( ) const -> std::string

Gets the name of the element.

Note
The name is only known once the configuration of the element has been loaded.
Returns
The name of the element, in UTF-8 encoding.
Versions
xentara::io::Component::name()
xentara::io::Io::name()
xentara::io::IoBatch::name()
xentara::process::Microservice::name()

◆  prepare()

virtual auto Element::prepare ( ) -> void
protectedvirtual

Called by the framework to prepare the element for operation.

This method is called by the framework after all objects have been realized, but before any processing is done. It allows you to prepare the object for operation. This is the place where read and write handles for attributes should be fetched, for example.

Exceptions
std::runtime_errorThe function must throw this exception (or a suitable subclass) if an error occurs
Versions
xentara::io::Component::prepare()
xentara::io::Io::prepare()
xentara::io::IoBatch::prepare()
xentara::process::Microservice::prepare()
See also
Loading Element Configs
Examples
LoadingElementConfig.cpp

◆  cleanup()

virtual auto Element::cleanup ( ) -> void
protectedvirtual

Called by the framework to cleanup the element after operation

This method is called by the framework after Xentara has completely shut down.

Versions
xentara::io::Component::cleanup()
xentara::io::Io::cleanup()
xentara::io::IoBatch::cleanup()
xentara::process::Microservice::cleanup()
See also
Loading Element Configs
Examples
LoadingElementConfig.cpp

◆  primaryKey()

auto Element::primaryKey ( ) const -> std::string

Gets the primary key of the element.

Note
The primary key is only fully known once the entire configuration has been loaded.
Returns
The primary key of the element, in UTF-8 encoding.
Versions
xentara::io::Component::primaryKey()
xentara::io::Io::primaryKey()
xentara::io::IoBatch::primaryKey()
xentara::process::Microservice::primaryKey()

◆  readHandle()

virtual auto Element::readHandle ( const xentara::model::Attribute> &  attribute ) const -> xentara::data::ReadHandle
virtualnoexcept

Called by the framework to get a read handle for a specific attribute.

The implementation for this method must return a read handle for the given attribute's value.

Parameters
attributeThe desired attribute. This will never be one of the standard configuration attributes, as these are handled automatically by the framework.
Returns
A read handle for the attribute, or an error handle with an appropriate error code on error
Versions
xentara::io::Component::readHandle()
xentara::io::Io::readHandle()
xentara::io::IoBatch::readHandle()
xentara::process::Microservice::readHandle()
See also
Publishing Attributes
Examples
PublishingConfigAttributes.cpp

◆  writeHandle()

virtual auto Element::writeHandle ( const xentara::model::Attribute> &  attribute ) const -> xentara::data::WriteHandle
virtualnoexcept

Called by the framework to get a write handle for a specific attribute.

The implementation for this method must return a write handle for the given attribute's value.

Parameters
attributeThe desired attribute. This will never be one of the standard configuration attributes, as these are handled automatically by the framework.
Returns
A write handle for the attribute, or an error handle with an appropriate error code on error
Versions
xentara::io::Component::writeHandle()
xentara::io::Io::writeHandle()
xentara::io::IoBatch::writeHandle()
xentara::process::Microservice::writeHandle()
See also
Publishing Attributes

◆  realize()

virtual auto Element::realize ( ) -> void
protectedvirtual

Called by the framework once all references have been resolved.

This method is called by the framework after the configuration has been completely loaded and all references have been resolved, but before the objects are prepared for processing. Use this function to perform initialization that requires access to the objects you submitted to the resolver in loadConfig().

Exceptions
std::runtime_errorThe function must throw this exception (or a suitable subclass) if an error occurs
Versions
xentara::io::Component::realize()
xentara::io::Io::realize()
xentara::io::IoBatch::realize()
xentara::process::Microservice::realize()
See also
Loading Element Configs
Examples
LoadingElementConfig.cpp

◆  resolveAttribute()

virtual auto Element::resolveAttribute ( std::string_view  name ) -> const xentara::model::Attribute *
virtual

Called by the framework to resolve an attribute with a specific name

The implementation for this method must return a reference to the attribute with the given name, if the element supports it.

Attributes are always resolved after Xentara model elements. This means that when this function is called, all references to Xentara model elements you submitted in loadConfig() have already been resolved.

Parameters
nameThe name of the desired attribute, in UTF-8 encoding. This will never be one of the standard configuration attributes, as these are resolved automatically by the framework.
Returns
A pointer to the attribute description, or nullptr if the element does not provide an attribute with the given name
Exceptions
std::runtime_errorThe function must throw this exception (or a suitable subclass) if an error occurs
Versions
xentara::io::Component::resolveAttribute()
xentara::io::Io::resolveAttribute()
xentara::io::IoBatch::resolveAttribute()
xentara::process::Microservice::resolveAttribute()
See also
Publishing Attributes

◆  resolveEvent()

virtual auto Element::resolveEvent ( std::string_view  name ) -> std::shared_ptr< xentara::process::Event >
virtual

Called by the framework to resolve an event with a specific name.

The implementation for this method must return a pointer to the event with the given name. You can either create the event on demand from within this function, or return a pointer to an existing event.

If the event you which to return is not a shared object itself, but a regular member of the element, you can derive your element class from xentara::plugin::EnableSharedFromThis and use the aliasing constructor (8) of std::shared_ptr together with sharedFromThis():

return std::shared_ptr(sharedFromThis(), &_myEvent);

Events are always resolved after Xentara model elements. This means that when this function is called, all references to Xentara model elements you submitted in loadConfig() have already been resolved.

Parameters
nameThe name of the desired event, in UTF-8 encoding
Returns
A pointer to the event, or nullptr if the element does not provide an event with the given name
Exceptions
std::runtime_errorThe function must throw this exception (or a suitable subclass) if an error occurs
Versions
xentara::io::Component::resolveEvent()
xentara::io::Io::resolveEvent()
xentara::io::IoBatch::resolveEvent()
xentara::process::Microservice::resolveEvent()
See also
Publishing Events

◆  resolveTask()

virtual auto Element::resolveTask ( std::string_view  name ) -> std::shared_ptr< xentara::process::Task >
virtual

Called by the framework to resolve a task with a specific name.

The implementation for this method must return a pointer to the task with the given name. You can either create the task on demand from within this function, or return a pointer to an existing task.

If the task you which to return is not a shared object itself, but a regular member of the element, you can derive your element class from xentara::plugin::EnableSharedFromThis and use the aliasing constructor (8) of std::shared_ptr together with sharedFromThis():

return std::shared_ptr(sharedFromThis(), &_myTask);

Events are always resolved after Xentara model elements. This means that when this function is called, all references to Xentara model elements you submitted in loadConfig() have already been resolved.

Parameters
nameThe name of the desired task, in UTF-8 encoding
Returns
A pointer to the task, or nullptr if the element does not provide a task with the given name
Exceptions
std::runtime_errorThe function must throw this exception (or a suitable subclass) if an error occurs
Versions
xentara::io::Component::resolveTask()
xentara::io::Io::resolveTask()
xentara::io::IoBatch::resolveTask()
xentara::process::Microservice::resolveTask()
See also
Publishing Tasks

◆  uuid()

auto Element::uuid ( ) const -> xentara::utils::core::Uuid

Gets the uuid of the element.

Note
The UUID is only known once the configuration of the element has been loaded.
Versions
xentara::io::Component::uuid()
xentara::io::Io::uuid()
xentara::io::IoBatch::uuid()
xentara::process::Microservice::uuid()