Inspecting options supported by plugins


Lionel filed a new bug about adding a way of knowing what are the
options suppported by plugins:

So far, plugins themselves don't register what are the options they
expect from clients to be able to instantiate the sources. Instead, they
just receive one or more GrlConfig from clients, which internally
contains options and the values. The plugins just take those GrlConfigs,
and check if the options they need are set or not.

How do the clients know what are the options plugins need or support?
The idea were that each plugin would provide documentation about his
purpose, and among other useful information, it would provide the list
of keys plugin support.

Thus plugins would not provide a way to inspect what are the options
they handle from a programmatically point of view.

If we want to add API so clients can inspect the options a plugin is
able to handle or even need, how the plugins should inform about them?
Right now, it comes to my mind several options:

1) Plugins provide grl_metadata_source_supported_options() that provides
a list of the options supported by plugins.

2) Options are provided inside the XML file, with a brief description
and probably some attributes telling if option is compulsory or not, or
the expected type. Roughly speaking, something like:

  <key type=string compulsory>
    <description>User password</description>

Core would provide a set of functions to inspect that information.

3) Using the future GrlOperationOptions and GrlOperationCaps to do it.
Honestly, I'm not sure about this option.

>From all the options, the one that I like the most is the second one:
plugins can easily list there the supported keys, no need to write a
single line of code for this, any developer can also read the XML in a
easily way, and even if for some reason we go with third option,
GrlOperationCaps could get the information from the XML file.

The drawback is that we would be making the XML file something more
mandatory than it is right now.

So, what are your opinion on this?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]