1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #define private public
24 #define protected public
25 #include <omniORB4/CORBA.h>
26 #include <omniORB4/internal/typecode.h>
29 #include "RuntimeSALOME.hxx"
30 #include "CORBANode.hxx"
31 #include "CORBAComponent.hxx"
32 #include "SalomeComponent.hxx"
33 #include "CORBAPorts.hxx"
34 #include "OutputDataStreamPort.hxx"
35 #include "CalStreamPort.hxx"
37 #include "TypeCode.hxx"
38 #include "AutoLocker.hxx"
41 #include "SALOME_NamingService.hxx"
42 #include "SALOME_LifeCycleCORBA.hxx"
43 #include "SALOME_Exception.hh"
46 #include <omniORB4/CORBA.h>
47 #include <omniORB4/minorCode.h>
53 #include "YacsTrace.hxx"
55 using namespace YACS::ENGINE;
58 const char CORBANode::IMPL_NAME[]="CORBA";
59 const char CORBANode::KIND[]="CORBA";
61 std::string CORBANode::getKind() const
66 //! CORBANode constructor
67 CORBANode::CORBANode(const std::string& name): ServiceNode(name)
69 _implementation=IMPL_NAME;
72 CORBANode::CORBANode(const CORBANode& other,ComposedNode *father):ServiceNode(other,father)
74 _implementation=IMPL_NAME;
77 //! Execute the service on the component associated to the node
78 void CORBANode::execute()
80 YACSTRACE(1, "+++++++++++++ CorbaNode::execute: " << getName() << " +++++++++++++++" );
82 //DII request building :
83 // a service gets all its in parameters first
84 // then all its out parameters
85 // no inout parameters
86 // the return value (if any) is the first out parameter
87 // not yet user exception (only CORBA exception)
89 CORBA::Object_var objComponent=((CORBAComponent*)_component)->getCompoPtr();
90 CORBA::Request_var req = objComponent->_request(_method.c_str());
91 CORBA::NVList_ptr arguments = req->arguments() ;
93 DEBTRACE( "+++++++++++++++++CorbaNode::inputs+++++++++++++++++" )
96 list<InputPort *>::iterator iter2;
97 for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
99 InputCorbaPort *p=(InputCorbaPort *)*iter2;
100 DEBTRACE( "port name: " << p->getName() )
101 DEBTRACE( "port kind: " << p->edGetType()->kind() )
102 CORBA::Any* ob=p->getAny();
104 CORBA::TypeCode_var typcod= ob->type();
105 switch(p->edGetType()->kind())
124 if(*ob >>= CORBA::Any::to_boolean(b))
127 DEBTRACE( "not a boolean" )
130 DEBTRACE( typcod->id() )
136 //add_value makes a copy of any (*ob). This copy will be deleted with the request
137 arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_IN ) ;
142 DEBTRACE( "+++++++++++++++++CorbaNode::outputs+++++++++++++++++" )
143 list<OutputPort *>::iterator iter;
144 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
146 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
147 DEBTRACE( "port name: " << p->getName() )
148 DEBTRACE( "port kind: " << p->edGetType()->kind() )
149 CORBA::Any* ob=p->getAnyOut();
151 DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
153 //add_value makes a copy of any. Copy will be deleted with request
154 arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_OUT );
156 DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
162 req->set_return_type(CORBA::_tc_void);
164 DEBTRACE( "+++++++++++++++++CorbaNode::calculation+++++++++++++++++" << _method )
166 CORBA::Exception *exc =req->env()->exception();
169 DEBTRACE( "An exception was thrown!" )
170 DEBTRACE( "The raised exception is of Type:" << exc->_name() )
172 std::cerr << "The raised exception is of Type:" << exc->_name() << std::endl;
174 if(strcmp(exc->_name(),"MARSHAL") == 0)
176 const char* ms = ((CORBA::MARSHAL*)exc)->NP_minorString();
178 std::cerr << "(CORBA::MARSHAL: minor = " << ms << ")" << std::endl;
180 std::cerr << "(CORBA::MARSHAL: minor = " << ((CORBA::MARSHAL*)exc)->minor() << ")" << std::endl;
183 _errorDetails="Execution problem: the raised exception is of Type:";
184 _errorDetails += exc->_name();
185 throw Exception("Execution problem");
188 DEBTRACE( "++++++++++++CorbaNode::outputs++++++++++++" )
189 int out_param=in_param;
190 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
192 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
193 DEBTRACE( "port name: " << p->getName() )
194 DEBTRACE( "port kind: " << p->edGetType()->kind() )
195 DEBTRACE( "port number: " << out_param )
196 CORBA::Any *ob=arguments->item(out_param)->value();
198 DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
201 CORBA::TypeCode_var tc=ob->type();
202 switch(p->edGetType()->kind())
226 //OutputPort must copy the input Any(ob).
227 //This Any will be deleted with the request.
228 //Copy is made by the method put.
230 out_param=out_param+1;
232 DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
235 DEBTRACE( "++++++++++++++++++++++++++++++++++++++++++" )
237 //Request has been deleted (_var )
238 //All anys given to the request are deleted : don't forget to copy them
239 //if you want to keep them
241 list<OutputPort *>::const_iterator iter;
242 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
244 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
245 CORBA::Any *ob=p->getAny();
246 DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
249 DEBTRACE( "+++++++++++++++++ End CorbaNode::execute: " << getName() << " +++++++++++++++++" )
252 //! Clone the node : must also clone the component instance ?
253 Node *CORBANode::simpleClone(ComposedNode *father, bool editionOnly) const
255 return new CORBANode(*this,father);
258 //! Create a CORBANode with the same component object and no input or output port
260 * \param name : node name
261 * \return a new CORBANode node
263 ServiceNode* CORBANode::createNode(const std::string& name)
266 CORBANode* node= new CORBANode(name);
267 node->setComponent(_component);
273 const char SalomeNode::KIND[]="Salome";
275 std::string SalomeNode::getKind() const
280 //! SalomeNode constructor
281 SalomeNode::SalomeNode(const std::string& name):ServiceNode(name)
283 _implementation=CORBANode::IMPL_NAME;
286 SalomeNode::SalomeNode(const SalomeNode& other,ComposedNode *father):ServiceNode(other,father)
288 _implementation=CORBANode::IMPL_NAME;
291 SalomeNode::~SalomeNode()
296 //! Init the datastream ports of the component associated to the node
297 void SalomeNode::initService()
299 DEBTRACE( "SalomeNode::initService: "<<getName())
300 if(_setOfInputDataStreamPort.size() == 0 && _setOfOutputDataStreamPort.size() == 0)return;
302 CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
303 Engines::Superv_Component_var compo=Engines::Superv_Component::_narrow(objComponent);
304 if( CORBA::is_nil(compo) )
306 std::string msg="Can't get reference to DSC object (or it was nil).";
308 throw Exception(msg);
312 if (!_multi_port_node)
314 CORBA::Boolean ret=compo->init_service(_method.c_str());
317 _errorDetails="Problem with component '"+_ref+"' in init_service of service '"+ _method + "'";
318 throw Exception(_errorDetails);
320 //Should check that component port types are the same as those declared in the xml file
324 CORBA::Boolean ret=compo->init_service_with_multiple(_method.c_str(), _param);
327 _errorDetails="Problem with component '"+_ref+"' in init_service_with_multiple of service '"+ _method + "'";
328 throw Exception(_errorDetails);
334 _errorDetails="Problem with component '"+_ref+"' in init_service of service '"+ _method + "'";
340 SalomeNode::addDatastreamPortToInitMultiService(const std::string & port_name, int number)
342 int index = _param.length();
343 _param.length(index + 1);
344 _param[index].name = CORBA::string_dup(port_name.c_str());
345 _param[index].number = number;
348 //! Connect the datastream ports of the component associated to the node
349 void SalomeNode::connectService()
351 DEBTRACE( "SalomeNode::connectService: "<<getName());
352 if(_setOfOutputDataStreamPort.size() == 0)return;
354 CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
355 SALOME_NamingService NS(getSALOMERuntime()->getOrb()) ;
356 SALOME_LifeCycleCORBA LCC(&NS) ;
357 CORBA::Object_var obj = NS.Resolve("/ConnectionManager");
358 Engines::ConnectionManager_var manager=Engines::ConnectionManager::_narrow(obj);
359 Engines::Superv_Component_var me=Engines::Superv_Component::_narrow(objComponent);
360 if( CORBA::is_nil(me) )
362 std::string msg="Can't get reference to Engines::Superv_Component: "+getName();
364 throw Exception(msg);
366 std::list<OutputDataStreamPort *>::iterator iter;
367 Engines::ConnectionManager::connectionId id;
368 for(iter = _setOfOutputDataStreamPort.begin(); iter != _setOfOutputDataStreamPort.end(); iter++)
370 OutputDataStreamPort *port=(OutputDataStreamPort *)*iter;
371 std::set<InPort *> ports=port->edSetInPort();
372 std::set<InPort *>::iterator iterout;
373 for(iterout=ports.begin();iterout != ports.end(); iterout++)
375 //It's only possible to connect 2 SalomeNode : try to get a SalomeNode
376 SalomeNode* snode= dynamic_cast<SalomeNode*>((*iterout)->getNode());
377 if(snode == 0) //don't connect, it's not a SalomeNode
379 std::string msg="Can't connect : not a SalomeNode";
381 throw Exception(msg);
384 CORBA::Object_var comp=((SalomeComponent*)snode->getComponent())->getCompoPtr();
385 if( CORBA::is_nil(comp))
387 std::string msg="Problem in connectService: " + snode->getName();
388 msg=msg+" Component is probably not launched. Modify your YACS file";
390 throw Exception(msg);
393 Engines::Superv_Component_var other=Engines::Superv_Component::_narrow(comp);
394 if( CORBA::is_nil(other))
396 std::string msg="Can't connect to nil Engines::Superv_Component: " + snode->getName();
398 throw Exception(msg);
402 id=manager->connect(me,port->getName().c_str(),other,(*iterout)->getName().c_str());
404 catch(Engines::DSC::PortNotDefined& ex)
406 std::string msg="Problem in connectService. Unknown port: "+port->getName()+" or "+(*iterout)->getName();
408 throw Exception(msg);
410 catch(Engines::DSC::BadPortType& ex)
412 std::string msg="Problem in connectService. Type of provides port is bad. Expected: ";
413 msg=msg + ex.expected.in();
414 msg=msg + "Received: "+ex.received.in();
416 throw Exception(msg);
418 catch(Engines::DSC::NilPort& ex)
420 std::string msg="Problem in connectService. Port is nil: "+port->getName()+" or "+(*iterout)->getName();
422 throw Exception(msg);
424 catch( const SALOME::SALOME_Exception& ex )
426 std::string msg="Problem in connectService. ";
427 msg += ex.details.text.in();
428 msg=msg+getName()+" " + port->getName() + " " + snode->getName() + " " + (*iterout)->getName();
430 throw Exception(msg);
432 catch(CORBA::SystemException& ex)
434 DEBTRACE( "minor code: " << ex.minor() );
435 DEBTRACE( "completion code: " << ex.completed() );
436 std::string msg="Problem in connectService. CORBA System exception ";
437 std::string excname=ex._name();
438 msg=msg+excname + " " +getName()+" " + port->getName() + " " + snode->getName() + " " + (*iterout)->getName();
440 throw Exception(msg);
444 std::string msg="Problem in connectService. Unknown exception";
445 msg=msg+getName()+" " + port->getName() + " " + snode->getName() + " " + (*iterout)->getName();
447 throw Exception(msg);
449 DEBTRACE("Connected: " <<id<<" "<<getName()<<" "<<port->getName()<<" "<<snode->getName()<<" "<<(*iterout)->getName());
454 //Init component port properties
455 for(iter = _setOfOutputDataStreamPort.begin(); iter != _setOfOutputDataStreamPort.end(); iter++)
457 (*iter)->initPortProperties();
459 std::list<InputDataStreamPort *>::iterator iterin;
460 for(iterin = _setOfInputDataStreamPort.begin(); iterin != _setOfInputDataStreamPort.end(); iterin++)
462 (*iterin)->initPortProperties();
466 //! Disconnect the datastream ports of the component associated to the node
467 void SalomeNode::disconnectService()
469 DEBTRACE( "SalomeNode::disconnectService: "<<getName());
470 // in some rare cases, disconnectService can be called from 2 different threads
471 YACS::BASES::AutoLocker<YACS::BASES::Mutex> lock(&_mutex);
476 SALOME_NamingService NS(getSALOMERuntime()->getOrb()) ;
477 SALOME_LifeCycleCORBA LCC(&NS) ;
478 CORBA::Object_var obj = NS.Resolve("/ConnectionManager");
479 Engines::ConnectionManager_var manager=Engines::ConnectionManager::_narrow(obj);
480 std::list<Engines::ConnectionManager::connectionId>::iterator iter;
481 for(iter = ids.begin(); iter != ids.end(); iter++)
483 DEBTRACE("Trying to disconnect: " << *iter );
486 manager->disconnect(*iter,Engines::DSC::RemovingConnection);
488 catch(Engines::ConnectionManager::BadId& ex)
490 DEBTRACE( "Problem in disconnect: " << *iter );
492 catch(Engines::DSC::PortNotDefined& ex)
494 DEBTRACE( "Problem in disconnect: " << *iter );
496 catch(Engines::DSC::PortNotConnected& ex)
498 DEBTRACE( "Problem in disconnect: " << *iter );
500 catch(Engines::DSC::BadPortReference& ex)
502 DEBTRACE( "Problem in disconnect (Engines::DSC::BadPortReference): " << *iter );
504 catch(CORBA::SystemException& ex)
506 DEBTRACE( "Problem in disconnect (CORBA::SystemException): " << *iter );
510 DEBTRACE( "Problem in disconnect: " << *iter );
516 void SalomeNode::cleanNodes()
523 //! Execute the service on the component associated to the node
524 void SalomeNode::execute()
526 YACSTRACE(1,"+++++++++++++++++ SalomeNode::execute: " << getName() << " " << _method << " +++++++++++++++++" );
528 CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
529 Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
531 // Set component properties
532 std::map<std::string,std::string> amap=getProperties();
535 Engines::FieldsDict_var dico = new Engines::FieldsDict;
536 dico->length(amap.size());
537 std::map<std::string,std::string>::const_iterator it;
539 for(it = amap.begin(); it != amap.end(); ++it)
541 dico[i].key=CORBA::string_dup(it->first.c_str());
542 dico[i].value <<=it->second.c_str();
545 compo->setProperties(dico);
548 //DII request building :
549 // a service gets all its in parameters first
550 // then all its out parameters
551 // no inout parameters
552 // the return value (if any) is the first out parameter
554 CORBA::Request_var req ;
557 req = objComponent->_request(_method.c_str());
559 catch(CORBA::SystemException& ex)
561 std::string msg="component '" +_ref+ "' has no service '" + _method+ "'";
563 throw Exception(msg);
565 CORBA::NVList_ptr arguments = req->arguments() ;
567 DEBTRACE( "+++++++++++++++++SalomeNode::inputs+++++++++++++++++" );
570 list<InputPort *>::iterator iter2;
571 for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
573 InputCorbaPort *p=(InputCorbaPort *)*iter2;
574 if(p->edGetType()->isA(Runtime::_tc_file))
576 DEBTRACE( "port name: " << p->getName() );
577 DEBTRACE( "port kind: " << p->edGetType()->kind() );
578 CORBA::Any* ob=p->getAny();
580 CORBA::TypeCode_var tc=ob->type();
581 switch(p->edGetType()->kind())
605 //add_value makes a copy of any. Copy will be deleted with request
606 arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_IN ) ;
611 DEBTRACE("checkInputFilesToService: " << _method);
614 for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
616 InputCorbaPort *p=(InputCorbaPort *)*iter2;
617 if(!p->edGetType()->isA(Runtime::_tc_file))
619 std::string filename=p->getName();
620 // replace ':' by '.'. Needed because port name can not contain '.'
621 string::size_type debut =filename.find_first_of(':',0);
622 while(debut != std::string::npos)
625 debut=filename.find_first_of(':',debut);
627 DEBTRACE( "inport with file: " << filename );
628 Engines::Salome_file_var isf=compo->setInputFileToService(_method.c_str(),p->getName().c_str());
629 isf->setDistributedFile(filename.c_str());
630 Engines::Salome_file_ptr osf;
631 CORBA::Any* any=p->getAny();
637 compo->checkInputFilesToService(_method.c_str());
639 catch( const SALOME::SALOME_Exception& ex )
641 std::string text="Execution problem in checkInputFilesToService: ";
642 text += (const char*)ex.details.text;
644 throw Exception(text);
646 catch(CORBA::SystemException& ex)
648 std::string msg="Execution problem: component probably does not support files ??";
650 throw Exception(msg);
654 DEBTRACE( "+++++++++++++++++SalomeNode::outputs+++++++++++++++++" )
655 list<OutputPort *>::iterator iter;
656 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
658 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
659 DEBTRACE( "port name: " << p->getName() )
660 DEBTRACE( "port kind: " << p->edGetType()->kind() )
661 if(p->edGetType()->isA(Runtime::_tc_file))
663 CORBA::Any* ob=p->getAnyOut();
664 //add_value makes a copy of any. Copy will be deleted with request
665 arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_OUT );
670 //if return type is set to void (not mandatory, it's set by default)
671 //the return value will not be marshalled as a return value but
672 //as the first out argument (don't forget to add it as the first output argument)
673 req->set_return_type(CORBA::_tc_void);
675 req->exceptions()->add(SALOME::_tc_SALOME_Exception);
677 DEBTRACE( "+++++++++++++++++SalomeNode::calculation+++++++++++++++++" << _method )
679 CORBA::Exception *exc =req->env()->exception();
682 DEBTRACE( "An exception was thrown!" )
683 DEBTRACE( "The raised exception is of Type:" << exc->_name() )
685 CORBA::SystemException* sysexc;
686 sysexc=CORBA::SystemException::_downcast(exc);
689 // It's a SystemException
690 DEBTRACE( "minor code: " << sysexc->minor() );
691 DEBTRACE( "completion code: " << sysexc->completed() );
692 std::string text="Execution problem: ";
693 std::string excname=sysexc->_name();
694 if(excname == "BAD_OPERATION")
696 text=text+"component '" +_ref+ "' has no service '" + _method+ "'";
698 else if(excname == "BAD_PARAM")
700 text=text+"A parameter (input or output) passed to the call is out of range or otherwise considered illegal.\n";
701 text=text+"Minor code: "+sysexc->NP_minorString();
703 else if(excname == "MARSHAL" && sysexc->minor() == omni::MARSHAL_PassEndOfMessage)
705 text=text+"probably an error in arguments of service '" + _method + "' from component '" +_ref+ "'";
707 else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalResults)
709 text=text+"probably an error in output arguments of service '" + _method + "' from component '" +_ref+ "'";
711 else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalArguments)
713 text=text+"probably an error in input arguments of service '" + _method + "' from component '" +_ref+ "'";
715 else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_WaitingForReply)
717 text=text+"probably an error in input arguments of service '" + _method + "' from component '" +_ref+ "'";
721 DEBTRACE(sysexc->NP_minorString() );
722 text=text+"System Exception "+ excname;
725 throw Exception(text);
728 // Not a System Exception
729 CORBA::UnknownUserException* userexc;
730 userexc=CORBA::UnknownUserException::_downcast(exc);
733 CORBA::Any anyExcept = userexc->exception();
735 const SALOME::SALOME_Exception* salexc;
736 if(anyExcept >>= salexc)
738 DEBTRACE("SALOME_Exception: "<< salexc->details.sourceFile);
739 DEBTRACE("SALOME_Exception: "<<salexc->details.lineNumber);
740 _errorDetails=salexc->details.text;
741 throw Exception("Execution problem: Salome Exception occurred" + getErrorDetails() );
743 std::string msg="Execution problem: User Exception occurred";
745 throw Exception(msg);
747 std::string msg="Execution problem";
749 throw Exception(msg);
752 DEBTRACE( "++++++++++++SalomeNode::outputs++++++++++++" )
753 int out_param=in_param;
754 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
756 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
757 DEBTRACE( "port name: " << p->getName() );
758 DEBTRACE( "port kind: " << p->edGetType()->kind() );
759 DEBTRACE( "port number: " << out_param );
760 if(p->edGetType()->isA(Runtime::_tc_file))
762 CORBA::Any *ob=arguments->item(out_param)->value();
764 switch(p->edGetType()->kind())
785 //OutputPort must copy the input Any(ob).
786 //This Any will be deleted with the request.
787 //Copy is made by the method put.
789 out_param=out_param+1;
794 DEBTRACE("checkOutputFilesToService: " << _method);
797 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
799 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
800 if(!p->edGetType()->isA(Runtime::_tc_file))
802 // The output port has a file object : special treatment
803 std::string filename=p->getName();
804 // replace ':' by '.'. Needed because port name can not contain '.'
805 string::size_type debut =filename.find_first_of(':',0);
806 while(debut != std::string::npos)
809 debut=filename.find_first_of(':',debut);
811 DEBTRACE( "outport with file: " << filename );
812 Engines::Salome_file_var osf=compo->setOutputFileToService(_method.c_str(),p->getName().c_str());
813 osf->setLocalFile(filename.c_str());
819 compo->checkOutputFilesToService(_method.c_str());
821 catch( const SALOME::SALOME_Exception& ex )
823 std::string text=(const char*)ex.details.text;
825 throw Exception("Execution problem in checkOutputFilesToService: " + text);
827 catch(CORBA::SystemException& ex)
829 std::string msg="Execution problem: component probably does not support files ?";
831 throw Exception(msg);
834 //Request has been deleted (_var )
835 //All anys given to the request are deleted : don't forget to copy them
836 //if you want to keep them
837 DEBTRACE( "+++++++++++++++++ End SalomeNode::execute: " << getName() << " +++++++++++++++++" )
840 Node *SalomeNode::simpleClone(ComposedNode *father, bool editionOnly) const
842 return new SalomeNode(*this,father);
845 //! Create a SalomeNode with the same component object and no input or output port
847 * \param name : node name
848 * \return a new SalomeNode node
850 ServiceNode* SalomeNode::createNode(const std::string& name)
852 SalomeNode* node=new SalomeNode(name);
853 node->setComponent(_component);
857 std::string SalomeNode::getContainerLog()
859 std::string msg="Component is not loaded";
862 CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
863 Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
864 if( !CORBA::is_nil(compo) )
866 Engines::Container_var cont= compo->GetContainerRef();
867 CORBA::String_var logname = cont->logfilename();
870 std::string::size_type pos = msg.find(":");
871 msg=msg.substr(pos+1);
874 catch(CORBA::COMM_FAILURE& ex)
876 msg = ":Component no longer reachable: Caught system exception COMM_FAILURE";
877 msg += " -- unable to contact the object.";
879 catch(CORBA::SystemException& ex)
881 msg = ":Component no longer reachable: Caught a CORBA::SystemException.\n";
884 CORBA::TypeCode_var tc = tmp.type();
885 const char *p = tc->name();
891 catch(CORBA::Exception& ex)
893 msg = ":Component no longer reachable: Caught CORBA::Exception.\n";
896 CORBA::TypeCode_var tc = tmp.type();
897 const char *p = tc->name();
903 catch(omniORB::fatalException& fe)
905 msg = ":Component no longer reachable: Caught omniORB::fatalException.\n";
907 log << " file: " << fe.file() << endl;
908 log << " line: " << fe.line() << endl;
909 log << " mesg: " << fe.errmsg() << endl;
914 msg = ":Component no longer reachable: Caught unknown exception.";
919 void SalomeNode::shutdown(int level)
921 DEBTRACE("SalomeNode::shutdown " << level);
923 _component->shutdown(level);