3 # SALOME Container : implementation of container and engine for Kernel
5 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 # File : SALOME_Container.py
27 # Author : Paul RASCLE, EDF
34 from omniORB import CORBA, PortableServer
36 import Engines, Engines__POA
37 from SALOME_NamingServicePy import *
38 from SALOME_ComponentPy import *
40 from SALOME_utilities import *
41 from Utils_Identity import getShortHostName
42 from launchConfigureParser import verbose
44 #=============================================================================
46 #define an implementation of the container interface
48 class SALOME_Container_i:
52 _naming_service = None
54 #-------------------------------------------------------------------------
56 def __init__(self ,containerName, containerIORStr):
57 MESSAGE( "SALOME_Container_i::__init__" )
58 self._orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
59 self._poa = self._orb.resolve_initial_references("RootPOA")
60 self._containerName = containerName
61 if verbose(): print "SALOME_Container.SALOME_Container_i : _containerName ",self._containerName
62 #self._naming_service = SALOME_NamingServicePy_i(self._orb)
63 self._container = self._orb.string_to_object(containerIORStr)
65 #-------------------------------------------------------------------------
70 def import_component(self, componentName):
71 MESSAGE( "SALOME_Container_i::import_component" )
74 print "try import ",componentName
75 __import__(componentName)
76 print "import ",componentName," successful"
81 print "import ",componentName," not possible"
84 #-------------------------------------------------------------------------
86 def create_component_instance(self, componentName, instanceName, studyId):
87 MESSAGE( "SALOME_Container_i::create_component_instance" )
90 component=__import__(componentName)
91 factory=getattr(component,componentName)
92 comp_i=factory(self._orb,
99 MESSAGE( "SALOME_Container_i::create_component_instance : OK")
100 comp_o = comp_i._this()
101 comp_iors = self._orb.object_to_string(comp_o)
104 traceback.print_exc()
105 MESSAGE( "SALOME_Container_i::create_component_instance : NOT OK")