#include "VISU_Engine_i.hh"
#include "utilities.h"
-#include CORBA_SERVER_HEADER(SALOME_Session)
#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
#include "SALOME_NamingService.hxx"
VISUEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId,
const char *instanceName, const char *interfaceName)
{
- if(MYDEBUG) MESSAGE("VisuEngine_factory : "<<interfaceName);
- VISU::VISU_Gen_i * pVISU_Gen = new VISU::VISU_Gen_i(orb, poa, contId, instanceName, interfaceName);
+ MESSAGE("VisuEngine_factory : "<<interfaceName);
+ // Check session: MZN: 24.11.2006 PAL 13948
+ SALOME_NamingService aNamingService(orb);
+ CORBA::Object_ptr anObject = aNamingService.Resolve("/Kernel/Session");
+ SALOME::Session_var aSession = SALOME::Session::_narrow(anObject);
+ if (CORBA::is_nil(aSession))
+ return NULL;
+
+ VISU::VISU_Gen_i * pVISU_Gen = new VISU::VISU_Gen_i(aSession, orb, poa, contId, instanceName, interfaceName);
return pVISU_Gen->getId() ;
}
}
namespace VISU{
//===========================================================================
- VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr orb,
+ VISU_Gen_i::VISU_Gen_i(SALOME::Session_ptr session,
+ CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
const char *instanceName,
{
_thisObj = this ;
_id = _poa->activate_object(_thisObj);
- SALOME_NamingService aNamingService(orb);
- CORBA::Object_ptr anObject = aNamingService.Resolve("/Kernel/Session");
- SALOME::Session_var aSession = SALOME::Session::_narrow(anObject);
- //aSession->GetInterface();
- Engines::Component_var aComponent = aSession->GetComponent("libVISUEngineImpl.so");
+
+ Engines::Component_var aComponent = session->GetComponent("libVISUEngineImpl.so");
myVisuGen = VISU::VISU_Gen::_narrow(aComponent);
}
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(VISU_Gen)
#include CORBA_SERVER_HEADER(MED)
+#include CORBA_SERVER_HEADER(SALOME_Session)
#include CORBA_SERVER_HEADER(SALOMEDS)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
VISU_Gen_i();
VISU_Gen_i(const VISU::VISU_Gen_i &);
public:
- VISU_Gen_i(CORBA::ORB_ptr orb,
+ VISU_Gen_i(SALOME::Session_ptr session,
+ CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
const char *instanceName,