Remoto - VFS: adminPlugin Class Reference
Remoto - VFS
adminPlugin Class Reference

The plugin wrapper for creating an admin application entry. More...

#include <adminPlugin.h>

Inheritance diagram for adminPlugin:
VFS_node_interface

Public Member Functions

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_nodecreate (QString type, QVariantMap env, QDomElement child)
 Create a new node instance. More...
 
virtual QString description (QString type)
 Descriptive text about an individual node. More...
 
virtual bool initialize ()
 adminPlugin::initialize More...
 
virtual QStringList provides ()
 A string list of node names that this plugin is prepared to create. More...
 
- Public Member Functions inherited from VFS_node_interface
virtual ~VFS_node_interface ()
 
QString describe ()
 Describe all the nodes in a plugin. 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...
 
VFS_noderemoteNode ()
 Return the node needed to satisfy a remote request. More...
 

Additional Inherited Members

- Protected Member Functions inherited from VFS_node_interface
 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 inherited from VFS_node_interface
bool _remote
 Does this plugin exist on another resource? More...
 
VFS_node_remoteNode
 The node responding to requests for remote resources. More...
 

Detailed Description

The plugin wrapper for creating an admin application entry.

Definition at line 7 of file adminPlugin.h.

Member Function Documentation

◆ arguments()

QString adminPlugin::arguments ( QString  type)
virtual

Describe the arguments needed to create a node.

Parameters
typeThe node name
Returns
The argument string.

The implementation of this pure method will look something like:

QString skeletonPlugin::arguments(QString type)
{
if (type == "skeleton")
return argumentString( skeleton::staticMetaObject );
}
QString argumentString(QMetaObject s)
Format a constructor string based on a node's metadata object.
virtual QString arguments(QString type)
Describe the arguments needed to create a node.
See also
The Skeleton Plugin

Reimplemented from VFS_node_interface.

Definition at line 95 of file adminPlugin.cpp.

◆ code()

QString adminPlugin::code ( QString  nodename,
QString  libname,
QString &  error 
)
virtual

Request code or other resource from a plugin bundle.

Parameters
nodenameThe node providing the code
libnameThe library requested
errorA reference to an error string, for writing errors back to the caller
Returns
The raw source code or resource requested

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.

See also
VFS_creator::code

Reimplemented from VFS_node_interface.

Definition at line 115 of file adminPlugin.cpp.

◆ create()

VFS_node * adminPlugin::create ( QString  type,
QVariantMap  env,
QDomElement  child 
)
virtual

Create a new node instance.

Base implementation that does nothing.

Returns
The new VFS_node, or 0 (null) if it was unable to create it.

Plugins bundle groups of node definitions together. This is the factory function for creating new nodes.

For example:

VFS_node *myFancyPlugin::create(QString type, QVariantMap env, QDomElement child)
{
if (type == "myFancyNode")
{
int a = VFS_creator::configAttribute(env,child,"alpha").toInt();
QString b = VFS_creator::configAttribute(env,child,"beta",false,"beta string");
return new myFancyNode(a,b);
}
if (type == "myMagicNode")
{
QString magicPath = VFS_creator::configPathAttribute(env,child,"magicPath");
return new myMagicNode(magicPath);
}
return 0;
}
static QString configAttribute(QVariantMap env, QDomElement e, QString attr, bool req=true, QString def="")
Fetch an XML node attribute value and resolve it against an environment.
static QString configPathAttribute(QVariantMap env, QDomElement e, QString attr, bool req=true, QString def="")
Fetch an XML node attribute value and resolve it against an environment, ensuring it is a cleaned pat...
VFS_node is the base class from which all other VFS_node classes derive.
Definition: VFS_node.h:143

Please note the entries for a config file:

<myFancyNode name='fancy1' alpha='10' beta='gamma' />
<myMagicNode name='magic_thing' magicPath='/mnt/magic' />

As a pure virtual function, this must be implemented in all plugins.

See also
The Skeleton Plugin
Parameters
typeThe node type, as listed in provides() and referenced in a config.xml
envThe constructor environment
childThe config DOM element
Returns
Always returns a nullptr

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 from VFS_node_interface.

Definition at line 39 of file adminPlugin.cpp.

◆ description()

QString adminPlugin::description ( QString  type)
virtual

Descriptive text about an individual node.

Parameters
typeThe node name
Returns
The description string.

The implementation of this pure method will look something like:

QString skeletonPlugin::description(QString type)
{
if (type == "skeleton")
return "A node provided as an example for the documentation. It does nothing.";
}
virtual QString description(QString type)
Descriptive text about an individual node.
See also
The Skeleton Plugin

Reimplemented from VFS_node_interface.

Definition at line 75 of file adminPlugin.cpp.

◆ initialize()

bool adminPlugin::initialize ( )
virtual

adminPlugin::initialize

Returns
True

Reimplemented from VFS_node_interface.

Definition at line 16 of file adminPlugin.cpp.

◆ provides()

QStringList adminPlugin::provides ( )
virtual

A string list of node names that this plugin is prepared to create.

Base implementation that returns an empty list.

Returns
The list of nodes

Plugins bundle groups of node definitions together. This is the list of nodes.

For example:

QStringList myFancyPlugin::provides()
{
QStringList p;
p << "myFancyNode";
p << "myMagicNode";
return p;
}

As a pure virtual function, this must be implemented in all plugins.

See also
The Skeleton Plugin
Returns
An empty list

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 from VFS_node_interface.

Definition at line 26 of file adminPlugin.cpp.


The documentation for this class was generated from the following files: