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