0
|
1 |
Plugin API
|
|
2 |
===============
|
|
3 |
|
|
4 |
.. module:: cone.public.plugin
|
|
5 |
:platform: Unix, Windows
|
|
6 |
:synopsis: Configuration interface.
|
|
7 |
.. moduleauthor:: Teemu Rytkonen <teemu.rytkonen@nokia.com>
|
|
8 |
|
|
9 |
The Plugin api is intended for extending the ConE functionality with plugins that can be for example
|
|
10 |
implementation or relation plugins. See :ref:`plugin-howto`
|
|
11 |
|
|
12 |
.. image:: cone_plugin_api.png
|
|
13 |
|
|
14 |
Classes
|
|
15 |
-------
|
|
16 |
|
|
17 |
.. class:: ImplBase(ref, configuration)
|
|
18 |
|
|
19 |
The ImplBase class is intended for deriving any implementation plugin in ConE. A single ImplBase
|
|
20 |
instance is created by ConE for each implml file inside a given Configuration.
|
|
21 |
|
|
22 |
See :ref:`plugin-howto`
|
|
23 |
|
|
24 |
.. method:: list_output_files()
|
|
25 |
|
|
26 |
The list_output_files should return a list of output files with path, with the current configuration.
|
|
27 |
This mechanism should enable listing of all output files before without actually generating them.
|
|
28 |
|
|
29 |
.. method:: generate()
|
|
30 |
|
|
31 |
The plugin instance is supposed to generate its output with the call of generate().
|
|
32 |
|
|
33 |
.. method:: has_ref(refs)
|
|
34 |
|
|
35 |
This method receives a list as an attribute and is supposed to return True|False. True if this
|
|
36 |
particular plugin instance has a reference to a Feature inside the given refs list. Otherwise False.
|
|
37 |
|
|
38 |
.. class:: ImplSet
|
|
39 |
|
|
40 |
The ImplSet is a sets.Set object for a set of ImplBase instances. The main purpose of ImplSet
|
|
41 |
is to allow operations to a set of ImplBase instances, such as generate, filter, etc.
|
|
42 |
|
|
43 |
.. class:: ImplFactory
|
|
44 |
|
|
45 |
ImplFactory is a constructor class for the plugin instances.
|
|
46 |
|
|
47 |
.. method:: get_impl_by_ext(cls, ext)
|
|
48 |
|
|
49 |
Get the class name by file extension.
|
|
50 |
|
|
51 |
|
|
52 |
.. method:: get_impl_by_filename(cls, ref, configuration)
|
|
53 |
|
|
54 |
Get the class name by filename.
|
|
55 |
|
|
56 |
.. class:: Relation(left, right)
|
|
57 |
|
|
58 |
.. method:: execute()
|
|
59 |
|
|
60 |
Executes the rule initiated for this Relation.
|
|
61 |
|
|
62 |
|
|
63 |
Relation is a base class for all Relation implementations. The purpose of a Relation instance is to offer a verb or an
|
|
64 |
action that can be used in a rule. A rule in this context means a textual relation between two or more :class:`Feature`'s.
|
|
65 |
For example a Depends class could be used to define dependencies between two :class:`Feature`
|
|
66 |
|
|
67 |
::
|
|
68 |
|
|
69 |
example rule
|
|
70 |
A depends B
|
|
71 |
|
|
72 |
Where A and B are :class:`Feature` references.
|
|
73 |
|
|
74 |
.. class:: RelationContainer
|
|
75 |
|
|
76 |
RelationContainer is a container object that derives Relation interface, but is meant for storing a set of :class:`Relation`
|
|
77 |
objects. It can be used to execute a set of rules read to the container.
|
|
78 |
|
|
79 |
.. class:: RelationFactory
|
|
80 |
|
|
81 |
.. method:: get_by_name(name)
|
|
82 |
|
|
83 |
returns a :class:`Relation` if the class that matches the name is found.
|
|
84 |
|
|
85 |
The RelationFactory is intended to be used when the rules are read from some persistent storage. When a rule is found from
|
|
86 |
:class:`Configuration` ConE will try to create a :class:`Relation` instance of the rule, by trying to get class
|
|
87 |
by :meth:`RelationFactory.get_by_name` and create an instance of that class.
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|