Salome HOME
Join modifications from branch BR_JR_from_V3_2_0b1: rename a .py file because of...
[modules/kernel.git] / src / ModuleCatalog / TestModuleCatalog.py
1 # Copyright (C) 2005  OPEN CASCADE, CEA, EDF R&D, LEG
2 #           PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either 
6 # version 2.1 of the License.
7
8 # This library is distributed in the hope that it will be useful 
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 # Lesser General Public License for more details.
12
13 # You should have received a copy of the GNU Lesser General Public  
14 # License along with this library; if not, write to the Free Software 
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18
19 import batchmode_salome
20 import SALOME_ModuleCatalog
21
22 print
23 print "======================================================================"
24 print "           XML Catalog file generation from idl file"
25 print "======================================================================"
26
27 import os
28 os.system('runIDLparser -Wbcatalog=x \
29                  ${KERNEL_ROOT_DIR}/idl/salome/SALOME_TestModuleCatalog.idl')
30
31 print "======================================================================"
32 print "           Get Catalog "
33 print "======================================================================"
34 obj = batchmode_salome.naming_service.Resolve('Kernel/ModulCatalog')
35 catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
36 catalog.GetComponentList()
37
38 print 
39 print "======================================================================"
40 print "           Import xml file "
41 print "======================================================================"
42 catalog.ImportXmlCatalogFile("x.xml")
43
44 name = "AddComponent"
45 print 
46 print "======================================================================"
47 print "           Dump component <", name, "> "
48 print "======================================================================"
49 C = catalog.GetComponent(name)
50
51 print "name       : ", C._get_componentname()
52 print "username   : ", C._get_componentusername()
53 print "type       : ", C._get_component_type()
54 print "constraint : ", C._get_constraint()
55 print "icon       : ", C._get_component_icone()
56
57 for iL in C.GetInterfaceList():
58     I = C.GetInterface(iL)
59     print "interface  : ", I.interfacename
60     for S in I.interfaceservicelist:
61         print "  service : ", S.ServiceName
62         print "    ", len(S.ServiceinParameter), "in params : "
63         for iP in S.ServiceinParameter:
64             print '      ' + iP.Parametername + '(' + iP.Parametertype + ')'
65             pass
66         print "    ", len(S.ServiceoutParameter), "out params : "
67         for iP in S.ServiceoutParameter:
68             print '      ' + iP.Parametername + '(' + iP.Parametertype + ')'
69             pass
70         print "    ", len(S.ServiceinDataStreamParameter), "in datastream params : "
71         for iP in S.ServiceinDataStreamParameter:
72             print '      ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \
73                   str(iP.Parameterdependency) + ')'
74             pass
75         print "    ", len(S.ServiceoutDataStreamParameter), "out datastream params : "
76         for iP in S.ServiceoutDataStreamParameter:
77             print '      ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \
78                   str(iP.Parameterdependency) + ')'
79             pass
80         pass
81     pass
82