import os
import sys
+import string
import time
from omniORB import CORBA, PortableServer
import Engines, Engines__POA
MESSAGE( "SALOME_ComponentPy_i::__init__" + " " + str (containerName) + " " + str(instanceName) + " " + str(interfaceName) )
self._orb = orb
self._poa = poa
+ self._contId = self._poa.reference_to_id( contID )
self._instanceName = instanceName
self._interfaceName = interfaceName
self._containerName = containerName
+ self._Id = None
self._notif = notif
self._myConnexionToRegistry = 0
self._graphName = ''
self._Executed = 0
naming_service = SALOME_NamingServicePy_i(self._orb)
- Component_path = "/Containers/" + os.getenv( "HOSTNAME" ) + "/" + self._containerName + "/" + self._interfaceName
+ self.naming_service = naming_service
+ #Component_path = "/Containers/" + os.getenv( "HOSTNAME" ) + "/" + self._containerName + "/" + self._interfaceName
+ HostName = os.getenv( "HOST" )
+ myMachine = string.split( HostName , '.' )
+ Component_path = "/Containers/" + myMachine[0] + "/" + self._containerName + "/" + self._interfaceName
MESSAGE( 'SALOME_ComponentPy_i Register' + str( Component_path ) )
naming_service.Register(self._this(), Component_path)
+ self.Component_path = Component_path
# Add componentinstance to registry
obj = naming_service.Resolve('/Registry')
#-------------------------------------------------------------------------
+ def _get_interfaceName(self):
+ MESSAGE( "SALOME_ComponentPy_i::_get_interfaceName" )
+ return self._interfaceName
+
+ #-------------------------------------------------------------------------
+
def ping(self):
MESSAGE( "SALOME_ComponentPy_i::ping" )
def destroy(self):
MESSAGE( "SALOME_ComponentPy_i::destroy" )
- poa.deactivate_object(self)
- CORBA.release(_poa)
+ self.naming_service.Destroy_Name( self.Component_path )
+ self._poa.deactivate_object(self._Id)
+ MESSAGE( "SALOME_ComponentPy_i::destroy _poa.deactivate_object done" )
#-------------------------------------------------------------------------
def GetContainerRef(self):
MESSAGE( "SALOME_ComponentPy_i::GetContainerRef" )
+ theContainer = None
+ try :
+ obj = self._poa.id_to_reference( self._contId )
+ try :
+ theContainer = obj._narrow( Engines.Container )
+ except :
+ print "SALOME_ComponentPy_i::GetContainerRef _narrow( Engines.Container ) exception"
+ except :
+ print "SALOME_ComponentPy_i::GetContainerRef _poa.id_to_reference( _contId ) exception"
+ return theContainer
#-------------------------------------------------------------------------