]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
fix problem with opening study by salome.openStudy(hdf) method
authormpa <mpa@opencascade.com>
Fri, 16 Dec 2016 06:48:15 +0000 (09:48 +0300)
committermpa <mpa@opencascade.com>
Fri, 16 Dec 2016 06:48:15 +0000 (09:48 +0300)
src/KERNEL_PY/PyInterp.py
src/KERNEL_PY/batchmode_salome.py
src/KERNEL_PY/salome_study.py
src/SALOMEDS/SALOMEDS_Client.cxx
src/SALOMEDS/SALOMEDS_Server.cxx
src/SALOMEDS/SALOMEDS_Study.cxx
src/SALOMEDS/SALOMEDS_Study_i.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx

index 3c0787e4ca410374f49d1a069f1d483aec7a9f7a..c14efb15247b9e381c8486990aba34ba45153d5d 100755 (executable)
@@ -95,5 +95,5 @@ myStudyName = sg.getStudyName()
 print myStudyName
 
 # get Study reference
-obj = naming_service.Resolve('Study')
+obj = naming_service.Resolve('/Study')
 myStudy = obj._narrow(SALOMEDS.Study)
index 8d60ebadff184cd381bdcd883b9282eab4adf11d..4e52b1fe4d35accb1c5f33fb08c1048e5a1bd026 100755 (executable)
@@ -276,7 +276,7 @@ step = 0
 sleeping_time = 0.01
 sleeping_time_max = 1.0
 while 1:
-    obj = naming_service.Resolve('Study')
+    obj = naming_service.Resolve('/Study')
     if obj is not None:break
     step = step + 1
     if step > 100: break
index f249057f9397132f08aa98b55b976bbf89fa52a5..efd41940bc04059b3973c8dec3d13aafb9e685cc 100755 (executable)
@@ -52,7 +52,7 @@ def DumpComponent(SO, Builder,offset):
     if find:
       a=a+":"+RefSO.GetID()
     print a
-    DumpComponent(Study, CSO, Builder,offset+2)
+    DumpComponent(CSO, Builder,offset+2)
     it.Next()
 
 #--------------------------------------------------------------------------
@@ -272,8 +272,9 @@ def FindFileInDataDir(filename):
 
 def openStudy(theStudyPath):
     print "openStudy"
-    global myStudy
+    global myStudy, myStudyName
     myStudy.Open(theStudyPath)
+    myStudyName = myStudy._get_Name()
     print theStudyPath, myStudy._get_Name()
 
     #--------------------------------------------------------------------------
@@ -295,7 +296,7 @@ def salome_study_init(theStudyPath=None):
 
         # get Study reference
         if verbose(): print "looking for study..."
-        obj = naming_service.Resolve('Study')
+        obj = naming_service.Resolve('/Study')
         myStudy = obj._narrow(SALOMEDS.Study)
         if verbose(): print "Study found"
         pass
index fd365b9109e65a4748a81fa88bb681e0fc90d017..db409bbf53681e4aabd41fa7baccadf0fe6e9467 100644 (file)
@@ -270,7 +270,7 @@ int main(int argc, char** argv)
     SALOME_NamingService * salomens = new SALOME_NamingService(orb);
 
     MESSAGE("Find Study ");
-    CORBA::Object_ptr obj2 = salomens->Resolve("Study");
+    CORBA::Object_ptr obj2 = salomens->Resolve("/Study");
     SALOMEDS::Study_var myStudy = SALOMEDS::Study::_narrow(obj2);
 
     // Obtain a POAManager, and tell the POA to start accepting
index a1e9a1af18d3ce17c064f16416a0fd56f9cc8d42..21db9a8c0552935939fca27d686f80ea3f1122bf 100644 (file)
@@ -59,7 +59,7 @@ int main(int argc, char** argv)
 #else
       CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" );
 #endif
-      SALOME_NamingService NS;
+      SALOME_NamingService* NS;
       // Obtain a reference to the root POA.
       long TIMESleep = 500000000;
       int NumberOfTries = 40;
@@ -109,8 +109,8 @@ int main(int argc, char** argv)
                     if(EnvL==1)
                       {
                         CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
-                        NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
-                        NS.init_orb( orb1 ) ;
+                        NS = SINGLETON_<SALOME_NamingService>::Instance() ;
+                        NS->init_orb( orb1 ) ;
                         for(int j=1; j<=NumberOfTries; j++)
                           {
                             if (j!=1) 
@@ -161,7 +161,12 @@ int main(int argc, char** argv)
       // ready to accept requests.
       PortableServer::ObjectId_var myStudy_iid = poa->activate_object(myStudy_i);
       SALOMEDS::Study_var Study = myStudy_i->_this();
-      NS.Register(Study.in(), "/Study");
+      if (!NS)
+      {
+        NS = SINGLETON_<SALOME_NamingService>::Instance();
+        NS->init_orb( orb );
+      }
+      NS->Register(Study.in(), "/Study");
 
       // Assign the value of the IOR in the study->root
       CORBA::String_var IORStudy = orb->object_to_string(Study);
index a8bcfbd845c0ecb73346922837d4d0d22fd1279f..8b14dd00386865ae1820d84d8a2864fa627550c4 100644 (file)
@@ -70,7 +70,7 @@ SALOMEDS_Study::SALOMEDS_Study(SALOMEDSImpl_Study* theStudy)
   _isLocal = true;
   _local_impl = theStudy;
   _corba_impl = SALOMEDS::Study::_nil();
-  Init();
+  InitORB();
 }
 
 SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy)
@@ -100,7 +100,7 @@ SALOMEDS_Study::~SALOMEDS_Study()
 
 void SALOMEDS_Study::InitORB()
 {
-  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
   ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
   _orb = init(0 , 0 ) ;
 }
index 08fc42dcb9f707004f23a5b422ecf5b7e485fff7..23cc0c031f4388ca461950596152797fd1d327b6 100644 (file)
@@ -379,6 +379,9 @@ void SALOMEDS_Study_i::Clear()
 bool SALOMEDS_Study_i::Open(const char* aUrl)
   throw(SALOME::SALOME_Exception)
 {
+  if (!_closed)
+    Clear();
+  Init();
   SALOMEDS::Locker lock;
 
   Unexpect aCatch(SalomeException);
index dd39cc41a8bc87b694fc2375f52771af05568ca8..6e1e77792a3c13d5db00689f0efad5bb2ec5ac76 100644 (file)
@@ -142,7 +142,7 @@ void SALOMEDSImpl_Study::Init()
   sstrm << ++_id;
   _name = "Study" + std::string(sstrm.str());
   _doc = _appli->NewDocument("SALOME_STUDY");
-  _Saved = false ;
+  _Saved = false;
   _URL = "";
   _autoFill = false;
   _errorCode = "";
@@ -175,6 +175,7 @@ void SALOMEDSImpl_Study::Clear()
   delete _builder;
   delete _cb;
   delete _useCaseBuilder;
+  URL("");
   _appli->Close(_doc);
   _doc = NULL;
   _mapOfSO.clear();
@@ -188,8 +189,6 @@ void SALOMEDSImpl_Study::Clear()
 //============================================================================
 bool SALOMEDSImpl_Study::Open(const std::string& aUrl)
 {
-  Clear();
-  Init();
   // Set "C" locale temporarily to avoid possible localization problems
   Kernel_Utils::Localizer loc;
 
index f3e53011249236c44c56f3af48f99cefe94cbaf1..3a685369382c01359d753b9e7d8a3e72c84f6278 100644 (file)
@@ -52,11 +52,11 @@ static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* dr
 //============================================================================
 SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner)
 {
-   _errorCode = "";
+  _errorCode = "";
   _callbackOnAdd=NULL;
   _callbackOnRemove = NULL;
-   _study = (SALOMEDSImpl_Study*)theOwner;
-   _doc = _study->GetDocument();
+  _study = (SALOMEDSImpl_Study*)theOwner;
+  _doc = _study->GetDocument();
 }
 
 //============================================================================