Salome HOME
Updated copyright comment
[samples/component.git] / src / SyrComponent / SyrComponent_Impl.cxx
index 669c6f5a676f374bd669ab734ed95a8c7e5015b9..aabc76d97c96ee9ac2cc6ebd81e6199a5df078ff 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -46,11 +46,11 @@ SyrComponent_Impl::SyrComponent_Impl( CORBA::ORB_ptr orb ,
                                      PortableServer::ObjectId * contId , 
                                      const char *instanceName ,
                                       const char *interfaceName ,
-                                      const bool kactivate ) :
-  Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) {
+                                      const bool kactivate , bool withRegistry ) :
+  Engines_Component_i(orb, poa, contId, instanceName, interfaceName,true/*notif is true here for message*/,withRegistry) {
   MESSAGE("SyrComponent_Impl::SyrComponent_Impl this " << hex << this << dec
           << "activate object instanceName("
-          << instanceName << ") interfaceName(" << interfaceName << ")" )
+          << instanceName << ") interfaceName(" << interfaceName << ")" );
   if ( kactivate ) {
     _thisObj = this ;
     _id = _poa->activate_object(_thisObj);
@@ -272,9 +272,20 @@ SuperVisionTest::ListOfSyr_ptr SyrComponent_Impl::C_LISTOFSYR() {
 #else
   Sleep(S*1000);
 #endif
-  ListOfSyr_Impl * aNewListOfSyr = new ListOfSyr_Impl( _orb , _poa, _contId,
+  ListOfSyr_Impl * aNewListOfSyr = nullptr;
+  Engines::Container_var cont = this->GetContainerRef();
+  if( cont->is_SSL_mode() )
+  {
+    aNewListOfSyr = new ListOfSyr_Impl_SSL( _orb , _poa, _contId,
                         instanceName() , interfaceName() ,
                         graphName() , nodeName() ) ;
+  }
+  else
+  {
+    aNewListOfSyr = new ListOfSyr_Impl_No_SSL( _orb , _poa, _contId,
+                        instanceName() , interfaceName() ,
+                        graphName() , nodeName() ) ;
+  }
   SuperVisionTest::ListOfSyr_var iobject = (SuperVisionTest::ListOfSyr_var ) NULL ;
   PortableServer::ObjectId * id = aNewListOfSyr->getId() ;
   CORBA::Object_var obj = _poa->id_to_reference(*id);
@@ -331,10 +342,19 @@ SuperVisionTest::Syr_ptr SyrComponent_Impl::Init( CORBA::Long anOddInteger ) {
 #else
   Sleep(S*1000);
 #endif
-  Syr_Impl * mySyr ;
-  mySyr = new Syr_Impl( _orb , _poa, _contId,
+  Syr_Impl * mySyr = nullptr;
+  if ( this->isSSLMode() )
+  {
+    mySyr = new Syr_Impl_SSL( _orb , _poa, _contId,
                         instanceName() , interfaceName() ,
                         graphName() , nodeName() , anOddInteger ) ;
+  }
+  else
+  {
+    mySyr = new Syr_Impl_No_SSL( _orb , _poa, _contId,
+                        instanceName() , interfaceName() ,
+                        graphName() , nodeName() , anOddInteger ) ;
+  }
   SuperVisionTest::Syr_var iobject = (SuperVisionTest::Syr_var ) NULL ;
   PortableServer::ObjectId * id = mySyr->getId() ;
   CORBA::Object_var obj = _poa->id_to_reference(*id);
@@ -349,12 +369,12 @@ ListOfSyr_Impl::ListOfSyr_Impl( CORBA::ORB_ptr orb ,
                    const char * instanceName ,
                     const char * interfaceName , 
                    const char * graphName ,
-                    const char * nodeName ) :
-  Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) {
+                    const char * nodeName, bool withRegistry) :
+  Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,withRegistry) {
   Names( graphName , nodeName ) ;
   MESSAGE("ListOfSyr_Impl::ListOfSyr_Impl activate object instanceName("
           << instanceName << ") interfaceName(" << interfaceName << ") --> "
-          << hex << (void *) this << dec )
+          << hex << (void *) this << dec );
   beginService( "ListOfSyr_Impl::ListOfSyr_Impl" );
   _thisObj = this ;
   _id = _poa->activate_object(_thisObj);
@@ -405,8 +425,17 @@ extern "C"
     MESSAGE("SyrComponentEngine_factory SyrComponentEngine ("
             << instanceName << "," << interfaceName << "," << _getpid() << ")");
 #endif
-    SyrComponent_Impl * mySyrComponent 
-      = new SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName);
+    SyrComponent_Impl * mySyrComponent = nullptr;
+    CORBA::Object_var o = poa->id_to_reference(*contId);
+    Engines::Container_var cont = Engines::Container::_narrow(o);
+    if(cont->is_SSL_mode())
+    {
+      mySyrComponent = new SyrComponent_Impl_SSL(orb, poa, contId, instanceName, interfaceName);
+    }
+    else
+    {
+      mySyrComponent = new SyrComponent_Impl_No_SSL(orb, poa, contId, instanceName, interfaceName);
+    }
     return mySyrComponent->getId() ;
   }
 }
@@ -418,12 +447,12 @@ Syr_Impl::Syr_Impl( CORBA::ORB_ptr orb ,
                     const char * interfaceName , 
                    const char * graphName ,
                     const char * nodeName ,
-                    const CORBA::Long anOddInteger ) :
-  SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName,false) {
+                    const CORBA::Long anOddInteger, bool withRegistry) :
+  SyrComponent_Impl(orb, poa, contId, instanceName, interfaceName,false,withRegistry) {
   Names( graphName , nodeName ) ;
   MESSAGE("Syr_Impl::Syr_Impl activate object instanceName("
           << instanceName << ") interfaceName(" << interfaceName << ") --> "
-          << hex << (void *) this << dec )
+          << hex << (void *) this << dec );
   beginService( "Syr_Impl::Syr_Impl" );
   _thisObj = this ;
   _id = _poa->activate_object(_thisObj);