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