Salome HOME
Updated copyright comment
[samples/component.git] / src / DataStreamComponent / DataStreamComponent_Impl.cxx
index 093cc46f535c390a5e6ede5046891b8171749d1a..5d2b8245c194dfdbf8d8f109e15a2272fece1d69 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  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
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -44,11 +44,11 @@ DataStreamFactory_Impl::DataStreamFactory_Impl( CORBA::ORB_ptr orb,
                                                PortableServer::POA_ptr poa,
                                                PortableServer::ObjectId * contId, 
                                                const char *instanceName,
-                                                const char *interfaceName) :
-  Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) {
+                                                const char *interfaceName, bool withRegistry) :
+  Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,withRegistry) {
   MESSAGE("DataStreamFactory_Impl::DataStreamFactory_Impl this " << hex << this << dec
           << "activate object instanceName("
-          << instanceName << ") interfaceName(" << interfaceName << ")" )
+          << instanceName << ") interfaceName(" << interfaceName << ")" );
   _thisObj = this ;
   _id = _poa->activate_object(_thisObj);
 }
@@ -94,10 +94,20 @@ void DataStreamFactory_Impl::Div( CORBA::Long x , CORBA::Long y , CORBA::Long &
 DataStreamComponent::DataStream_ptr DataStreamFactory_Impl::NewDataStream() {
   beginService( "DataStreamFactory_Impl::NewDataStream" );
   sendMessage(NOTIF_STEP, "DataStreamFactory_Impl creates DataStream_Impl");
-  DataStream_Impl * myDataStream ;
-  myDataStream = new DataStream_Impl( _orb , _poa, _contId,
+  DataStream_Impl * myDataStream = nullptr;
+  Engines::Container_var cont = this->GetContainerRef();
+  if( cont->is_SSL_mode() )
+  {
+    myDataStream = new DataStream_Impl_SSL( _orb , _poa, _contId,
+                                      instanceName() , interfaceName() ,
+                                      graphName() , nodeName() ) ;
+  }
+  else
+  {
+    myDataStream = new DataStream_Impl_No_SSL( _orb , _poa, _contId,
                                       instanceName() , interfaceName() ,
                                       graphName() , nodeName() ) ;
+  }
   DataStreamComponent::DataStream_var iobject ;
   PortableServer::ObjectId * id = myDataStream->getId() ;
   CORBA::Object_var obj = _poa->id_to_reference(*id);
@@ -122,8 +132,17 @@ extern "C"
     MESSAGE("DataStreamFactoryEngine_factory DataStreamFactoryEngine ("
             << instanceName << "," << interfaceName << "," << _getpid() << ")");
 #endif
-    DataStreamFactory_Impl * myDataStreamFactory 
-      = new DataStreamFactory_Impl(orb, poa, contId, instanceName, interfaceName);
+    DataStreamFactory_Impl * myDataStreamFactory = nullptr;
+    CORBA::Object_var o = poa->id_to_reference(*contId);
+    Engines::Container_var cont = Engines::Container::_narrow(o);    
+    if(cont->is_SSL_mode())
+    {
+      myDataStreamFactory = new DataStreamFactory_Impl_SSL(orb, poa, contId, instanceName, interfaceName);
+    }
+    else
+    {
+      myDataStreamFactory = new DataStreamFactory_Impl_No_SSL(orb, poa, contId, instanceName, interfaceName);
+    }
     return myDataStreamFactory->getId() ;
   }
 }
@@ -134,12 +153,12 @@ DataStream_Impl::DataStream_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("DataStream_Impl::DataStream_Impl activate object instanceName("
           << instanceName << ") interfaceName(" << interfaceName << ") --> "
-          << hex << (void *) this << dec )
+          << hex << (void *) this << dec );
   beginService( "DataStream_Impl::DataStream_Impl" );
   _thisObj = this ;
   _id = _poa->activate_object(_thisObj);