]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
ScopeServer launching.
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 28 Oct 2014 16:30:34 +0000 (17:30 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 28 Oct 2014 16:30:34 +0000 (17:30 +0100)
14 files changed:
idl/SALOME_SDS.idl
src/Container/SALOME_ContainerManager.cxx
src/Container/SALOME_ContainerManager.hxx
src/Launcher/SALOME_Launcher.cxx
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/LifeCycleCORBA/TestContainerManager.cxx
src/SALOMESDS/CMakeLists.txt
src/SALOMESDS/SALOMESDS_AnyDataServer.cxx
src/SALOMESDS/SALOMESDS_BasicDataServer.cxx
src/SALOMESDS/SALOMESDS_BasicDataServer.hxx
src/SALOMESDS/SALOMESDS_DataServerManager.cxx
src/SALOMESDS/SALOMESDS_DataServerManager.hxx
src/SALOMESDS/SALOMESDS_StringDataServer.cxx
src/SALOMESDS/SALOME_DataScopeServer.cxx [new file with mode: 0644]

index 6bb48f433f50f3a8357446fdb3ad8e36e4445933..1fabdef1acd07bbd64f71e6ac0604976afe4fa01 100644 (file)
@@ -25,6 +25,8 @@ module SALOME
   interface BasicDataServer
   {
     string getVarName();
+    void setReadOnlyStatus();
+    void setRWStatus();
   };
 
   interface StringDataServer : BasicDataServer
index 8a33c0fec0ff6711f252c1480ebef3ead3b9976e..5004165e95fcaa9719f8d203260f2cca541f75d0 100644 (file)
@@ -21,6 +21,8 @@
 //
 
 #include "SALOME_ContainerManager.hxx"
+#include "SALOME_ResourcesManager.hxx"
+#include "SALOME_LoadRateManager.hxx"
 #include "SALOME_NamingService.hxx"
 #include "SALOME_ModuleCatalog.hh"
 #include "Basics_Utils.hxx"
@@ -48,7 +50,7 @@
 #include "PaCOPP.hxx"
 #endif
 
-#define TIME_OUT_TO_LAUNCH_CONT 60
+const int SALOME_ContainerManager::TIME_OUT_TO_LAUNCH_CONT=60;
 
 const char *SALOME_ContainerManager::_ContainerManagerNameInNS = 
   "/ContainerManager";
@@ -584,11 +586,7 @@ SALOME_ContainerManager::LaunchContainer(const Engines::ContainerParameters& par
     logFilename += tmp.str();
     logFilename += ".log" ;
     command += " > " + logFilename + " 2>&1";
-#ifdef WIN32
-    command = "%PYTHONBIN% -c \"import win32pm ; win32pm.spawnpid(r'" + command + "', '')\"";
-#else
-    command += " &";
-#endif
+    MakeTheCommandToBeLaunchedASync(command);
 
     // launch container with a system call
     status=SystemThreadSafe(command.c_str());
@@ -609,30 +607,14 @@ SALOME_ContainerManager::LaunchContainer(const Engines::ContainerParameters& par
   else
     {
       // Step 4: Wait for the container
-      int count = TIME_OUT_TO_LAUNCH_CONT;
-      if (GetenvThreadSafe("TIMEOUT_TO_LAUNCH_CONTAINER") != 0)
-        {
-          std::string new_count_str = GetenvThreadSafe("TIMEOUT_TO_LAUNCH_CONTAINER");
-          int new_count;
-          std::istringstream ss(new_count_str);
-          if (!(ss >> new_count))
-            {
-              INFOS("[LaunchContainer] TIMEOUT_TO_LAUNCH_CONTAINER should be an int");
-            }
-          else
-            count = new_count;
-        }
+      int count(GetTimeOutToLoaunchServer());
       INFOS("[GiveContainer] waiting " << count << " second steps container " << containerNameInNS);
       while (CORBA::is_nil(ret) && count)
         {
-#ifndef WIN32
-          sleep( 1 ) ;
-#else
-          Sleep(1000);
-#endif
+          SleepInSecond(1);
           count--;
           MESSAGE("[GiveContainer] step " << count << " Waiting for container on " << resource_selected);
-          CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
+          CORBA::Object_var obj(_NS->Resolve(containerNameInNS.c_str()));
           ret=Engines::Container::_narrow(obj);
         }
       if (CORBA::is_nil(ret))
@@ -979,9 +961,9 @@ void SALOME_ContainerManager::RmTmpFile(std::string& tmpFileName)
 
 void SALOME_ContainerManager::AddOmninamesParams(std::string& command) const
 {
-  CORBA::String_var iorstr = _NS->getIORaddr();
-  command += "ORBInitRef NameService=";
-  command += iorstr;
+  std::ostringstream oss;
+  AddOmninamesParams(oss);
+  command+=oss.str();
 }
 
 //=============================================================================
@@ -990,11 +972,9 @@ void SALOME_ContainerManager::AddOmninamesParams(std::string& command) const
  */ 
 //=============================================================================
 
-void SALOME_ContainerManager::AddOmninamesParams(std::ofstream& fileStream) const
+void SALOME_ContainerManager::AddOmninamesParams(std::ostream& fileStream) const
 {
-  CORBA::String_var iorstr = _NS->getIORaddr();
-  fileStream << "ORBInitRef NameService=";
-  fileStream << iorstr;
+  AddOmninamesParams(fileStream,_NS);
 }
 
 //=============================================================================
@@ -1003,11 +983,48 @@ void SALOME_ContainerManager::AddOmninamesParams(std::ofstream& fileStream) cons
  */ 
 //=============================================================================
 
-void SALOME_ContainerManager::AddOmninamesParams(std::ostringstream& oss) const
+void SALOME_ContainerManager::AddOmninamesParams(std::ostream& fileStream, SALOME_NamingService *ns)
+{
+  CORBA::String_var iorstr(ns->getIORaddr());
+  fileStream << "ORBInitRef NameService=";
+  fileStream << iorstr;
+}
+
+void SALOME_ContainerManager::MakeTheCommandToBeLaunchedASync(std::string& command)
 {
-  CORBA::String_var iorstr = _NS->getIORaddr();
-  oss << "ORBInitRef NameService=";
-  oss << iorstr;
+#ifdef WIN32
+    command = "%PYTHONBIN% -c \"import win32pm ; win32pm.spawnpid(r'" + command + "', '')\"";
+#else
+    command += " &";
+#endif
+}
+
+int SALOME_ContainerManager::GetTimeOutToLoaunchServer()
+{
+  int count(TIME_OUT_TO_LAUNCH_CONT);
+  if (GetenvThreadSafe("TIMEOUT_TO_LAUNCH_CONTAINER") != 0)
+    {
+      std::string new_count_str(GetenvThreadSafe("TIMEOUT_TO_LAUNCH_CONTAINER"));
+      int new_count;
+      std::istringstream ss(new_count_str);
+      if (!(ss >> new_count))
+        {
+          INFOS("[LaunchContainer] TIMEOUT_TO_LAUNCH_CONTAINER should be an int");
+        }
+      else
+        count = new_count;
+    }
+  return count;
+}
+
+void SALOME_ContainerManager::SleepInSecond(int ellapseTimeInSecond)
+{
+#ifndef WIN32
+  sleep( ellapseTimeInSecond ) ;
+#else
+  int timeInMS(1000*ellapseTimeInSecond);
+  Sleep(timeInMS);
+#endif
 }
 
 //=============================================================================
@@ -1851,7 +1868,7 @@ SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command,
     return container_proxy;
   }
 
-  int count = TIME_OUT_TO_LAUNCH_CONT;
+  int count(GetTimeOutToLoaunchServer());
   CORBA::Object_var obj = CORBA::Object::_nil();
   std::string containerNameInNS = _NS->BuildContainerNameForNS(params.container_name.in(), 
                                                                hostname.c_str());
@@ -1935,9 +1952,9 @@ SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command,
     std::string container_node_name = name + proc_number;
     std::string containerNameInNS = _NS->BuildContainerNameForNS((char*) container_node_name.c_str(), theMachine.c_str());
     INFOS("[LaunchPaCONodeContainer]  Waiting for Parallel Container node " << containerNameInNS << " on " << theMachine);
-    int count = TIME_OUT_TO_LAUNCH_CONT;
+    int count(GetTimeOutToLoaunchServer());
     while (CORBA::is_nil(obj) && count) {
-      sleep(1) ;
+      SleepInSecond(1);
       count-- ;
       obj = _NS->Resolve(containerNameInNS.c_str());
     }
index 3aa4b4a7e04c237e5c2fa8f4b55833b1ede9ec2c..3891af6e54709b0eb175d57570c98c02ecf1d443 100644 (file)
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOME_Component)
 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
-#include "SALOME_ResourcesManager.hxx"
-#include "SALOME_LoadRateManager.hxx"
-
+#include "SALOME_ResourcesCatalog_Parser.hxx"
+#include "Utils_SALOME_Exception.hxx"
 #include "Utils_Mutex.hxx"
 
 #include <string>
 #include <set>
 
 class SALOME_NamingService;
+class SALOME_ResourcesManager;
 
 class CONTAINER_EXPORT SALOME_ContainerManager : public POA_Engines::ContainerManager
 {
@@ -81,9 +81,7 @@ protected:
 
   void AddOmninamesParams(std::string& command) const;
 
-  void AddOmninamesParams(std::ostringstream& oss) const;
-
-  void AddOmninamesParams(std::ofstream& fileStream) const;
+  void AddOmninamesParams(std::ostream& fileStream) const;
 
   static std::string BuildTemporaryFileName();
 
@@ -161,7 +159,12 @@ protected:
 public:
   static char *GetenvThreadSafe(const char *name);
   static int SystemThreadSafe(const char *command);
-private:
+  static void AddOmninamesParams(std::ostream& fileStream, SALOME_NamingService *ns);
+  static void MakeTheCommandToBeLaunchedASync(std::string& command);
+  static int GetTimeOutToLoaunchServer();
+  static void SleepInSecond(int ellapseTimeInSecond);
+ private:
+  static const int TIME_OUT_TO_LAUNCH_CONT;
   static Utils_Mutex _getenvMutex;
   static Utils_Mutex _systemMutex;
 };
index 3c16fdf7a026ca21a57ab77c4544de17e4bd0a67..5ce7dcb0ae8b3bc666c9a42ba6fa3628a464ea5a 100644 (file)
 #include "BatchTest.hxx"
 #include "OpUtil.hxx"
 #include "SALOME_ContainerManager.hxx"
+#include "SALOME_NamingService.hxx"
+#include "SALOME_ResourcesManager.hxx"
 #include "Utils_CorbaException.hxx"
 
-
 #include "Launcher_Job_Command.hxx"
 #include "Launcher_Job_YACSFile.hxx"
 #include "Launcher_Job_PythonSALOME.hxx"
 
+#include "utilities.h"
+
 #ifdef WIN32
 # include <process.h>
 #else
index 41e294e025b75d11480fb38d1b34a7c95477e9bb..a63385a43b083915e71edc1bbe8fd998c3db2225 100644 (file)
@@ -42,6 +42,8 @@
 #include <ServiceUnreachable.hxx>
 
 #include "SALOME_LifeCycleCORBA.hxx"
+#include "SALOME_ResourcesManager.hxx"
+
 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
 #include CORBA_CLIENT_HEADER(SALOME_Session)
 #include CORBA_CLIENT_HEADER(DSC_Engines)
index 175ff62eb8d308e32e6ef4d3e95e9f079f7ffb7b..06440f0053fb011335633e77586b90db578a47ef 100644 (file)
@@ -32,6 +32,7 @@
 #include "SALOME_NamingService.hxx"
 #include "SALOME_ContainerManager.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
+#include "SALOME_ResourcesManager.hxx"
 #include "NamingService_WaitForServerReadiness.hxx"
 #include "OpUtil.hxx"
 #include "Utils_ORB_INIT.hxx"
index 96964389e9f3be8ad2bdc723cdea0e28ee4ca4b6..f136c6353d1ff24a7337d7b7e4c908a93efe8543 100644 (file)
@@ -16,7 +16,7 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# 
+# Author : Anthony GEAY (EDF R&D)
 
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
@@ -25,11 +25,13 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_BINARY_DIR}/salome_adm
   ${CMAKE_CURRENT_SOURCE_DIR}/../Utils
   ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService
+  ${CMAKE_CURRENT_SOURCE_DIR}/../Container
+  ${CMAKE_CURRENT_SOURCE_DIR}/../ResourcesManager
 )
 
 ADD_DEFINITIONS(${OMNIORB_DEFINITIONS})
 
-SET(COMMON_LIBS SalomeNS SalomeIDLKernel ${OMNIORB_LIBRARIES})
+SET(COMMON_LIBS SalomeNS SalomeContainer SalomeIDLKernel ${OMNIORB_LIBRARIES})
 
 SET(SalomeSDS_SOURCES
   SALOMESDS_Exception.cxx
@@ -45,6 +47,9 @@ ADD_LIBRARY(SalomeSDS ${SalomeSDS_SOURCES})
 TARGET_LINK_LIBRARIES(SalomeSDS ${COMMON_LIBS} ${PTHREAD_LIBRARIES})
 INSTALL(TARGETS SalomeSDS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
-FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
+ADD_EXECUTABLE(SALOME_DataScopeServer SALOME_DataScopeServer.cxx)
+TARGET_LINK_LIBRARIES(SALOME_DataScopeServer SalomeSDS)
+INSTALL(TARGETS SALOME_DataScopeServer DESTINATION ${SALOME_INSTALL_BINS})
 
+FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
 INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
index 0cc049f2e4ecb445e54a517b4969e4c450fb18f9..282828dedf43e08cec2ac39950260f8054d0dcbd 100644 (file)
@@ -19,6 +19,7 @@
 // Author : Anthony GEAY (EDF R&D)
 
 #include "SALOMESDS_AnyDataServer.hxx"
+#include "SALOMESDS_Exception.hxx"
 
 using namespace SALOMESDS;
 
@@ -31,6 +32,7 @@ AnyDataServer::AnyDataServer(const std::string& varName):BasicDataServer(varName
  */
 void AnyDataServer::setValueOf(const CORBA::Any& newValue)
 {
+  checkReadOnlyStatusRegardingConstness("StringDataServer::setValueOf : read only var !");
   delete _data;
   _data=new CORBA::Any(newValue);
 }
index 1477629f85bdb371c8010b2e57cc8372973ea387..6f8be87e398d3a896a61f49ded25c391dd360fe1 100644 (file)
 
 using namespace SALOMESDS;
 
-BasicDataServer::BasicDataServer(const std::string& varName):_var_name(varName)
+BasicDataServer::BasicDataServer(const std::string& varName):_is_read_only(false),_var_name(varName)
 {
 }
 
+/*!
+ * Called remotely -> to protect against throw
+ */
 char *BasicDataServer::getVarName()
 {
   return CORBA::string_dup(_var_name.c_str());
 }
+
+/*!
+ * Called remotely -> to protect against throw
+ */
+void BasicDataServer::setReadOnlyStatus()
+{
+  _is_read_only=true;
+}
+
+/*!
+ * Called remotely -> to protect against throw
+ */
+void BasicDataServer::setRWStatus()
+{
+  _is_read_only=false;
+}
+
+void BasicDataServer::checkReadOnlyStatusRegardingConstness(const char *sender) const
+{
+  if(isReadOnly())
+    throw Exception(sender);
+}
index 1a0b1ccff5f7c6c271b8293c4020bb8d13c6beab..ca90c4b9bce1a6f3eaf03e2bfcbb2959fbf7e6a4 100644 (file)
@@ -35,8 +35,15 @@ namespace SALOMESDS
   public:
     BasicDataServer(const std::string& varName);
     char *getVarName();
+    void setReadOnlyStatus();
+    void setRWStatus();
     std::string getVarNameCpp() const { return _var_name; }
+  protected:
+    void checkReadOnlyStatusRegardingConstness(const char *sender) const;
+    bool isReadOnly() const { return _is_read_only; }
   private:
+    //! false by default
+    bool _is_read_only;
     std::string _var_name;
   };
 }
index ac81e710f86085d13039a8878e76d118a7a432b1..69b5b35e785594eaa821b9d4f09f5f82ea8fb26f 100644 (file)
@@ -21,6 +21,7 @@
 #include "SALOMESDS_DataServerManager.hxx"
 #include "SALOMESDS_Exception.hxx"
 
+#include "SALOME_ContainerManager.hxx"
 #include "SALOME_NamingService.hxx"
 
 #include <sstream>
@@ -80,14 +81,50 @@ SALOME::DataScopeServer_ptr DataServerManager::getDefaultScope()
 
 SALOME::DataScopeServer_ptr DataServerManager::createDataScope(const char *scopeName)
 {
+  std::string scopeNameCpp(scopeName);
+  std::size_t sz(_scopes.size());
+  std::list< SALOME::DataScopeServer_var >::iterator it(_scopes.begin());
+  for(std::size_t i=0;i<sz;it++,i++)
+    {
+      CORBA::String_var zeName((*it)->getScopeName());
+      if(scopeNameCpp==(const char *)zeName)
+        {
+          std::ostringstream oss; oss << "DataServerManager::createDataScope : scope name \"" << scopeName << "\" already exists !";
+          throw Exception(oss.str());
+        }
+    }
+  //
+  SALOME_NamingService ns(_orb);
+  std::string fullScopeName(CreateAbsNameInNSFromScopeName(scopeName));
+  std::ostringstream oss; oss << "SALOME_DataScopeServer" << " " << scopeName;
+  SALOME_ContainerManager::AddOmninamesParams(oss,&ns);
+  std::string command(oss.str());
+  SALOME_ContainerManager::MakeTheCommandToBeLaunchedASync(command);
+  int status(SALOME_ContainerManager::SystemThreadSafe(command.c_str()));
+  int count(SALOME_ContainerManager::GetTimeOutToLoaunchServer());
+  SALOME::DataScopeServer_var ret(SALOME::DataScopeServer::_nil());
+  while (CORBA::is_nil(ret) && count)
+    {
+      CORBA::Object_var obj(ns.Resolve(fullScopeName.c_str()));
+      ret=SALOME::DataScopeServer::_narrow(obj);
+    }
+  if(!CORBA::is_nil(ret))
+    {
+      _scopes.push_back(ret);
+    }
+  return SALOME::DataScopeServer::_duplicate(ret);
 }
 
 SALOME::DataScopeServer_ptr DataServerManager::retriveDataScope(const char *scopeName)
 {
+  std::list< SALOME::DataScopeServer_var >::iterator it(getScopePtrGivenName(scopeName));
+  return SALOME::DataScopeServer::_duplicate(*it);
 }
 
 SALOME::DataScopeServer_ptr DataServerManager::removeDataScope(const char *scopeName)
 {
+  std::list< SALOME::DataScopeServer_var >::iterator it(getScopePtrGivenName(scopeName));
+  return SALOME::DataScopeServer::_duplicate(*it);
 }
 
 std::string DataServerManager::CreateAbsNameInNSFromScopeName(const std::string& scopeName)
@@ -95,3 +132,23 @@ std::string DataServerManager::CreateAbsNameInNSFromScopeName(const std::string&
   std::ostringstream oss; oss << NAME_IN_NS << "/" << scopeName;
   return oss.str();
 }
+
+std::list< SALOME::DataScopeServer_var >::iterator DataServerManager::getScopePtrGivenName(const std::string& scopeName)
+{
+  std::size_t sz(_scopes.size());
+  std::list< SALOME::DataScopeServer_var >::iterator it(_scopes.begin());
+  bool found(false);
+  for(std::size_t i=0;i<sz;it++,i++)
+    {
+      CORBA::String_var zeName((*it)->getScopeName());
+      found=(scopeName==(const char *)zeName);
+      if(found)
+        break;
+    }
+  if(!found)
+    {
+      std::ostringstream oss; oss << "DataServerManager::getScopePtrGivenName : scope name \"" << scopeName << "\" does not exist !";
+      throw Exception(oss.str());
+    }
+  return it;
+}
index 323ce0384750d2a7be1d84bf8806d048b4c70bac..61e01a1ae2f95e9ab7361810f0c3b64081dbb8f1 100644 (file)
@@ -47,6 +47,8 @@ namespace SALOMESDS
   public:
     static const char NAME_IN_NS[];
     static const char DFT_SCOPE_NAME_IN_NS[];
+  private:
+    std::list< SALOME::DataScopeServer_var >::iterator getScopePtrGivenName(const std::string& scopeName);
   private:
     AutoRefCountPtr<DataScopeServer> _dft_scope;
     SALOME::DataScopeServer_var _ptr_dft_scope;
index 9583d76772cb1f418c2538429b9bd3fc86efa5ab..28b8c3a8b9b8fec06f386bc6a7a68585d9dad0c3 100644 (file)
@@ -19,6 +19,7 @@
 // Author : Anthony GEAY (EDF R&D)
 
 #include "SALOMESDS_StringDataServer.hxx"
+#include "SALOMESDS_Exception.hxx"
 
 using namespace SALOMESDS;
 
@@ -31,6 +32,7 @@ StringDataServer::StringDataServer(const std::string& varName):BasicDataServer(v
  */
 void StringDataServer::setValueOf(const char *newValue)
 {
+  checkReadOnlyStatusRegardingConstness("StringDataServer::setValueOf : read only var !");
   _data=newValue;
 }
 
diff --git a/src/SALOMESDS/SALOME_DataScopeServer.cxx b/src/SALOMESDS/SALOME_DataScopeServer.cxx
new file mode 100644 (file)
index 0000000..1ffab0a
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony GEAY (EDF R&D)
+
+#include "SALOMESDS_DataScopeServer.hxx"
+#include "SALOMESDS_DataServerManager.hxx"
+#include "SALOMESDS_Exception.hxx"
+
+#include "SALOME_NamingService.hxx"
+
+#include <string>
+#include <sstream>
+
+int main(int argc, char* argv[])
+{
+  std::string scopeName;
+  if(argc<=1)
+    throw SALOMESDS::Exception("In the main of SALOME_DataScopeServer.cxx !");
+  scopeName=argv[1];
+  CORBA::ORB_var orb(CORBA::ORB_init(argc,argv));
+  CORBA::Object_var obj(orb->resolve_initial_references("RootPOA"));
+  PortableServer::POA_var poa(PortableServer::POA::_narrow(obj));
+  PortableServer::POAManager_var mgr(poa->the_POAManager());
+  mgr->activate();
+  SALOMESDS::DataScopeServer *server(new SALOMESDS::DataScopeServer(orb,scopeName));
+  //
+  CORBA::PolicyList policies;
+  policies.length(1);
+  PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
+  policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol);
+  PortableServer::POA_var poa2(poa->create_POA("SingleThPOA4SDS",mgr,policies));
+  threadPol->destroy();
+  PortableServer::ObjectId_var id(poa2->activate_object(server));
+  obj=poa2->id_to_reference(id);
+  SALOME::DataScopeServer_var serverPtr(SALOME::DataScopeServer::_narrow(obj));
+  //
+  std::ostringstream oss; oss << SALOMESDS::DataServerManager::NAME_IN_NS << "/" << scopeName;
+  std::string fullScopeName(oss.str());
+  SALOME_NamingService ns(orb);
+  ns.Register(serverPtr,fullScopeName.c_str());
+  //
+  orb->run();
+  server->decrRef();
+  return 0;
+}
+