Remoto - VFS
|
The interface class for dynamically loaded plugins. More...
#include <VFS_node_interface.h>
Public Member Functions | |
virtual | ~VFS_node_interface () |
virtual QString | arguments (QString type) |
Describe the arguments needed to create a node. More... | |
virtual QString | code (QString nodename, QString libname, QString &error) |
Request code or other resource from a plugin bundle. More... | |
virtual VFS_node * | create (QString type, QVariantMap env, QDomElement child) |
Create a new node instance. More... | |
QString | describe () |
Describe all the nodes in a plugin. More... | |
virtual QString | description (QString type) |
Descriptive text about an individual node. More... | |
virtual bool | initialize () |
The plugin initializer. More... | |
bool | isRemote () |
If a plugin represents a remote resource, this value will be true. More... | |
virtual bool | licensed (QString type) |
A licensing mechanism for node creation. More... | |
virtual QStringList | provides () |
A string list of node names that this plugin is prepared to create. More... | |
VFS_node * | remoteNode () |
Return the node needed to satisfy a remote request. More... | |
Protected Member Functions | |
VFS_node_interface (VFS_node *remoteNode=nullptr) | |
VFS_node_interface::VFS_node_interface. More... | |
QString | argumentString (QMetaObject s) |
Format a constructor string based on a node's metadata object. More... | |
Protected Attributes | |
bool | _remote |
Does this plugin exist on another resource? More... | |
VFS_node * | _remoteNode |
The node responding to requests for remote resources. More... | |
The interface class for dynamically loaded plugins.
VFS_node_interface is a pure virtual class used to bundle nodes for plugin distribution.
Plugins are loaded from the plugin folders provided on the command line. All identified plugins are loaded immediately, and their initialize() method is called.
Definition at line 9 of file VFS_node_interface.h.
|
explicitprotected |
VFS_node_interface::VFS_node_interface.
remoteNode | If this is a remote reference, this is a pointer to the node that will resolve a code request. |
Definition at line 88 of file VFS_node_interface.cpp.
|
virtual |
Definition at line 94 of file VFS_node_interface.cpp.
|
virtual |
Describe the arguments needed to create a node.
type | The node name |
The implementation of this pure method will look something like:
Reimplemented in adminPlugin, google_oauth2Plugin, VFS_mongoPlugin, pamPlugin, and VFS_stdlib.
Definition at line 146 of file VFS_node_interface.cpp.
|
protected |
Format a constructor string based on a node's metadata object.
s | A node's metadata object |
A node must flag its constructor(s) using Q_INVOKABLE for the signature data to be available.
Definition at line 297 of file VFS_node_interface.cpp.
|
virtual |
Request code or other resource from a plugin bundle.
nodename | The node providing the code |
libname | The library requested |
error | A reference to an error string, for writing errors back to the caller |
This will generally result in javascript code for a user interface, but could return anything, including base64-encoded images, css, xml, json, etc.
When code is requested, the request is routed to a plugin by nodename. A plugin can service the request itself, or pass it on to a node's static code function. Larger plugins with many nodes will probably want to bundle all their resources together.
It is highly reccommended that if a library is not found, it will call VFS_node::code() for error handling.
Reimplemented in adminPlugin, VFS_mongoPlugin, and VFS_stdlib.
Definition at line 283 of file VFS_node_interface.cpp.
|
virtual |
Create a new node instance.
Base implementation that does nothing.
Plugins bundle groups of node definitions together. This is the factory function for creating new nodes.
For example:
Please note the entries for a config file:
As a pure virtual function, this must be implemented in all plugins.
type | The node type, as listed in provides() and referenced in a config.xml |
env | The constructor environment |
child | The config DOM element |
Subclasses must implement this for a plugin to be useful. This base implementation is present so that a minimal plugin can implement initialize() without providing any nodes.
Reimplemented in adminPlugin, google_oauth2Plugin, VFS_mongoPlugin, pamPlugin, VFS_stdlib, and VFS_tcp_mount_directory.
Definition at line 255 of file VFS_node_interface.cpp.
QString VFS_node_interface::describe | ( | ) |
Describe all the nodes in a plugin.
Definition at line 194 of file VFS_node_interface.cpp.
|
virtual |
Descriptive text about an individual node.
type | The node name |
The implementation of this pure method will look something like:
Reimplemented in adminPlugin, google_oauth2Plugin, VFS_mongoPlugin, pamPlugin, and VFS_stdlib.
Definition at line 120 of file VFS_node_interface.cpp.
|
virtual |
The plugin initializer.
This is an opportunity to register filetypes, log data, or perform any other prep work needed.
For instance:
If a plugin fails to initialize, it can return false
here and will not be added to the plugin registry.
This may also be used to create a (network or other) license check for this node group so future licensed() requests don't have to do network validation. In practice nodes should be licensed per use, not globally when the application starts, and should be checked at some interval for validity.
Reimplemented in adminPlugin, google_oauth2Plugin, pamPlugin, and VFS_stdlib.
Definition at line 184 of file VFS_node_interface.cpp.
bool VFS_node_interface::isRemote | ( | ) |
If a plugin represents a remote resource, this value will be true.
Definition at line 342 of file VFS_node_interface.cpp.
|
virtual |
A licensing mechanism for node creation.
type | The node type being queried |
By default, all nodes are licensed for use. A plugin can choose to license on a group level or individual node level. It can use network functions or read the filesystem or whatever it needs to do to determine state.
Reimplemented in VFS_stdlib.
Definition at line 224 of file VFS_node_interface.cpp.
|
virtual |
A string list of node names that this plugin is prepared to create.
Base implementation that returns an empty list.
Plugins bundle groups of node definitions together. This is the list of nodes.
For example:
As a pure virtual function, this must be implemented in all plugins.
Subclasses must implement this for a plugin to be useful. This base implementation is present so that a minimal plugin can implement initialize() without providing any nodes.
Reimplemented in adminPlugin, google_oauth2Plugin, VFS_mongoPlugin, pamPlugin, VFS_stdlib, and VFS_tcp_mount_directory.
Definition at line 239 of file VFS_node_interface.cpp.
VFS_node * VFS_node_interface::remoteNode | ( | ) |
Return the node needed to satisfy a remote request.
By default, this is a nullptr.
Definition at line 354 of file VFS_node_interface.cpp.
|
protected |
Does this plugin exist on another resource?
Definition at line 50 of file VFS_node_interface.h.
|
protected |
The node responding to requests for remote resources.
Definition at line 51 of file VFS_node_interface.h.