print myStudyName
# get Study reference
-obj = naming_service.Resolve('Study')
+obj = naming_service.Resolve('/Study')
myStudy = obj._narrow(SALOMEDS.Study)
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
if find:
a=a+":"+RefSO.GetID()
print a
- DumpComponent(Study, CSO, Builder,offset+2)
+ DumpComponent(CSO, Builder,offset+2)
it.Next()
#--------------------------------------------------------------------------
def openStudy(theStudyPath):
print "openStudy"
- global myStudy
+ global myStudy, myStudyName
myStudy.Open(theStudyPath)
+ myStudyName = myStudy._get_Name()
print theStudyPath, myStudy._get_Name()
#--------------------------------------------------------------------------
# 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
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
#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;
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)
// 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);
_isLocal = true;
_local_impl = theStudy;
_corba_impl = SALOMEDS::Study::_nil();
- Init();
+ InitORB();
}
SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy)
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 ) ;
}
bool SALOMEDS_Study_i::Open(const char* aUrl)
throw(SALOME::SALOME_Exception)
{
+ if (!_closed)
+ Clear();
+ Init();
SALOMEDS::Locker lock;
Unexpect aCatch(SalomeException);
sstrm << ++_id;
_name = "Study" + std::string(sstrm.str());
_doc = _appli->NewDocument("SALOME_STUDY");
- _Saved = false ;
+ _Saved = false;
_URL = "";
_autoFill = false;
_errorCode = "";
delete _builder;
delete _cb;
delete _useCaseBuilder;
+ URL("");
_appli->Close(_doc);
_doc = NULL;
_mapOfSO.clear();
//============================================================================
bool SALOMEDSImpl_Study::Open(const std::string& aUrl)
{
- Clear();
- Init();
// Set "C" locale temporarily to avoid possible localization problems
Kernel_Utils::Localizer loc;
//============================================================================
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();
}
//============================================================================