configurationengine/doc/api/public.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
Public API
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     2
**********
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     3
Cone public API is the main interface of Cone.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     4
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     5
.. image:: cone_public_api.png
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     6
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     7
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     8
.. module:: cone.public.api
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     9
   :platform: Unix, Windows
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    10
   :synopsis: Configuration interface.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    11
.. moduleauthor:: Teemu Rytkonen <teemu.rytkonen@nokia.com>
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    12
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    13
Classes
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    14
-------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    15
.. class:: ObjectContainer
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    16
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    17
	ObjectContainer is a base class for all Configuration related elements. It is container class for a tree structure, 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    18
	where it can contain other ObjectContainer objects. So basically you can create B-tree type of hiararchy with it. 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    19
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    20
	The main functionality of ObjectContainer is that **all children of an object container are accessible as members** 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    21
	of the container.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    22
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    23
	.. _example_member_access:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    24
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    25
	Example of ObjectContainer member access:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    26
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    27
	``objcontainer.configuration.get_name()``
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    28
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    29
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    30
	.. method:: _add(child)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    31
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    32
	Add a ObjectContainer instance to this object. Checks with internal function :meth:`__supported_type__` if the given 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    33
	child is a supported class for this object.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    34
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    35
	.. method:: _add_to_path(path,child)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    36
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    37
	Add a ObjectContainer instance to a specific node under this object. It creates any missing nodes between this object 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    38
	and the path. For example __add_to_path__("foo.fii", obj), would create two nodes (foo and under it fii) if they are 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    39
	missing (Uses internal :meth:`__default_class__` to retrieve the class which is created in this case). 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    40
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    41
	.. method:: _remove(path)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    42
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    43
	Remove a child from given path.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    44
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    45
	.. method:: _get(path)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    46
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    47
	get a child from given path.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    48
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    49
	.. method:: _list()
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    50
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    51
	Get a list of names of immediate children of this ObjectContainer instance.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    52
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    53
	.. method:: _objects()
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    54
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    55
	Get a list of immediate children objects of this ObjectContainer instance.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    56
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    57
	.. method:: _traverse(filters)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    58
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    59
	Get a list of children objects of this ObjectContainer instance, by filtering them with filters. This will cause a 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    60
	recursive _traverse method call to all children of the ObjectContainer.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    61
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    62
	.. method:: _path(toparent=None)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    63
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    64
	Return the path to this object up to the toparent object. When toparent=None this will 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    65
	return a full path to the object in the ObjectContainer hierarhcy.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    66
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    67
	.. method:: _supported_type(obj)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    68
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    69
	A method that is supposed to be overridden by the deriving classed if they need to change, which classes can be added 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    70
	under each class. 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    71
	Return True if the type of the obj is supported.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    72
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    73
	.. method:: _default_class(obj)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    74
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    75
	A method that is supposed to be overridden by the deriving classed if they need to change, what class is 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    76
	the default class that is created with __add_to_path__ when objects are missing.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    77
	Return a class.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    78
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    79
  
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    80
.. class:: Base
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    81
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    82
	Base class for all :class:`~cone.public.api.Configuration` and its child objects. 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    83
  
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    84
	.. method:: get_ref()
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    85
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    86
	return the ref of this object.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    87
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    88
	.. method:: get_namepace()
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    89
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    90
	return the namespace of this object.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    91
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    92
.. class:: Project
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    93
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    94
	Project is a container for Configuration's.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    95
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    96
.. class:: Configuration
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    97
  
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    98
	ConE Configuration is the main interface for all configuration related activities. It is the main interface of ConE 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    99
	itself as ConE is eventually a python interface to a configuration project. 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   100
	 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   101
Configuration as a Container
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   102
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   103
	    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   104
	The Configuration instance itself in ConE is actually just a container for a bunch of different elements. These elements can practically be any elements that exist in a 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   105
	Configuration Project. 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   106
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   107
	* :class:`~cone.public.api.Configuration` 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   108
	* :class:`~cone.public.api.View`
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   109
	* :class:`~cone.public.api.Feature` 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   110
	* :class:`~cone.public.api.Resource` 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   111
	* :class:`~cone.public.plugin.Relation` 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   112
	* :class:`~cone.public.api.Data` 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   113
  
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   114
.. class:: Feature
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   115
	    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   116
	Feature element is the base class for any Configurable item in a Configuration Project.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   117
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   118
.. class:: View
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   119
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   120
	A :class:`~cone.public.api.Configuration` can contain one or more View elements, which basically can define different type of tree structure of Feature elements that exist in the Configuration.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   121
	A View element can contain :class:`~cone.public.api.Group` and :class:`FeaturePoxy` elements.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   122
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   123
.. class:: Group
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   124
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   125
	Group element can be child element of a :class:`~View`. It can include other Groups and :class:`~FeaturePoxy` elements to define a View hierarhcy.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   126
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   127
.. class:: FeatureProxy
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   128
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   129
	FeatureProxy element is a linking object inside View that has its own ref, name, etc but it basically just 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   130
	points to an actual :class:`Feature` instance.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   131
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   132
.. class:: Data
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   133
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   134
	Data element defines a data value for a :class:`Feature` element. The Data elements can be defined in a 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   135
	:class:`Configuration` and single configurable :class:`Feature` can have multiple data definitions, in different 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   136
	configurations. The new definition always overrides the previous one. However the entire data definition hierarchy 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   137
	is stored and is available from the Cone API.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   138
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   139
.. class:: Storage
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   140
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   141
	Storage offers platform and persistence independent interface to store :class:`Resource` elements (data files, 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   142
	configuration files, etc).
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   143
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   144
.. class:: Resource
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   145
	
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   146
	Resource is an instance of single storable element. Basically on normal filesystem this would be same as one file.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   147