| Trees | Indices | Help |
|---|
|
|
1 #============================================================================
2 #Name : iqrf.py
3 #Part of : Helium
4
5 #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
6 #All rights reserved.
7 #This component and the accompanying materials are made available
8 #under the terms of the License "Eclipse Public License v1.0"
9 #which accompanies this distribution, and is available
10 #at the URL "http://www.eclipse.org/legal/epl-v10.html".
11 #
12 #Initial Contributors:
13 #Nokia Corporation - initial contribution.
14 #
15 #Contributors:
16 #
17 #Description:
18 #===============================================================================
19
20 """
21 Implements iQRF model.
22
23 How to use it:
24 import imaker.iqrf
25 root = imaker.iqrf.load(filename)
26 root.result
27 """
28 import amara
29 import logging
30 from imaker.ecore import ContainerBase, Reference
31
32 logging.basicConfig()
33 logger = logging.getLogger("iqrf.model")
34 #logger.setLevel(logging.DEBUG)
35
36
49
50
52 """ Result container. """
54 ContainerBase.__init__(self, parent)
55 self.interfaces = []
56 self.configurations = []
57 self.targets = []
58
60 """ Load data from XML node. """
61 logger.debug("Loading Result")
62 for elem in node.interfaces:
63 interface = Interface(self)
64 interface.load(elem)
65 self.interfaces.append(interface)
66 for elem in node.configurations:
67 configuration = Configuration(self)
68 configuration.load(elem)
69 self.configurations.append(configuration)
70 for elem in node.targets:
71 target = Target(self)
72 target.load(elem)
73 self.targets.append(target)
74
76 """ Configuration container. """
77
79 ContainerBase.__init__(self, parent)
80 self.name = None
81 self.settings = []
82 self.filePath = None
83 self.targetrefs = []
84
86 """ Load data from XML node. """
87 logger.debug("Loading Configuration")
88 self.name = node.name
89 self.filePath = node.filePath
90 for elem in node.xml_xpath('./settings'):
91 setting = Setting(self)
92 setting.load(elem)
93 self.settings.append(setting)
94
95 for ref in node.targetrefs.split(" "):
96 self.targetrefs.append(Reference(self, ref))
97
99
101 ContainerBase.__init__(self, parent)
102 self.name = None
103 self.value = None
104 self.ref = None
105
107 logger.debug("Loading Setting")
108 self.name = node.name
109 self.value = node.value
110 self.ref = Reference(node.ref)
111
112
128
130 """ ConfigurationElement container. """
132 ContainerBase.__init__(self, parent)
133 self.name = None
134 self.description = None
135 self.values = None
136
138 """ Load data from XML node. """
139 logger.debug("Loading ConfigurationElement")
140 self.name = node.name
141 self.description = node.description
142 self.values = node.values
143
145 """ Target container. """
146
151
153 """ Load data from XML node. """
154 logger.debug("Loading Target")
155 self.name = node.name
156 self.description = node.description
157
158
159
160
167
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Wed Sep 09 13:44:24 2009 | http://epydoc.sourceforge.net |