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