-
-//=============================================================================
-/*!
- * CORBA method: get or create a fileRef object associated to a local file
- * (a file on the computer on which runs the container server), which stores
- * a list of (machine, localFileName) corresponding to copies already done.
- *
- * \param origFileName absolute path for a local file to copy on other
- * computers
- * \return a fileRef object associated to the file.
- */
-//=============================================================================
-
-Engines::fileRef_ptr
-Engines_Parallel_Container_i::createFileRef(const char* origFileName)
-{
- string origName(origFileName);
- Engines::fileRef_var theFileRef = Engines::fileRef::_nil();
-
- if (origName[0] != '/')
- {
- INFOS("path of file to copy must be an absolute path begining with '/'");
- return Engines::fileRef::_nil();
- }
-
- if (CORBA::is_nil(_fileRef_map[origName]))
- {
- CORBA::Object_var obj=_poa->id_to_reference(*_id);
- Engines::Container_var pCont = Engines::Container::_narrow(obj);
- fileRef_i* aFileRef = new fileRef_i(pCont, origFileName);
- theFileRef = Engines::fileRef::_narrow(aFileRef->_this());
- _numInstanceMutex.lock() ; // lock to be alone (stl container write)
- _fileRef_map[origName] = theFileRef;
- _numInstanceMutex.unlock() ;
- }
-
- theFileRef = Engines::fileRef::_duplicate(_fileRef_map[origName]);
- ASSERT(! CORBA::is_nil(theFileRef));
- return theFileRef._retn();
-}
-
-//=============================================================================
-/*!
- * CORBA method:
- * \return a reference to the fileTransfer object
- */
-//=============================================================================
-
-Engines::fileTransfer_ptr
-Engines_Parallel_Container_i::getFileTransfer()
-{
- Engines::fileTransfer_var aFileTransfer
- = Engines::fileTransfer::_duplicate(_fileTransfer);
- return aFileTransfer._retn();
-}
-
-
-Engines::Salome_file_ptr
-Engines_Parallel_Container_i::createSalome_file(const char* origFileName)
-{
- string origName(origFileName);
- if (CORBA::is_nil(_Salome_file_map[origName]))
- {
- Salome_file_i* aSalome_file = new Salome_file_i();
- try
- {
- aSalome_file->setLocalFile(origFileName);
- aSalome_file->recvFiles();
- }
- catch (const SALOME::SALOME_Exception& e)
- {
- return Engines::Salome_file::_nil();
- }
-
- Engines::Salome_file_var theSalome_file = Engines::Salome_file::_nil();
- theSalome_file = Engines::Salome_file::_narrow(aSalome_file->_this());
- _numInstanceMutex.lock() ; // lock to be alone (stl container write)
- _Salome_file_map[origName] = theSalome_file;
- _numInstanceMutex.unlock() ;
- }
-
- Engines::Salome_file_ptr theSalome_file =
- Engines::Salome_file::_duplicate(_Salome_file_map[origName]);
- ASSERT(!CORBA::is_nil(theSalome_file));
- return theSalome_file;
-}
-
-//=============================================================================
-/*!
- * CORBA attribute: Container working directory
- */
-//=============================================================================
-
-char*
-Engines_Parallel_Container_i::workingdir()
-{
- char wd[256];
- getcwd (wd,256);
- return CORBA::string_dup(wd) ;
-}
-
-//=============================================================================
-/*!
- * CORBA attribute: Container log file name
- */
-//=============================================================================
-
-char*
-Engines_Parallel_Container_i::logfilename()
-{
- return CORBA::string_dup(_logfilename.c_str()) ;
-}
-
-void
-Engines_Parallel_Container_i::logfilename(const char* name)
-{
- _logfilename=name;
-}