1 // Copyright (C) 2006-2014 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"
40 #include "SALOME_NamingService.hxx"
41 #include "SALOME_LifeCycleCORBA.hxx"
42 #include "SALOME_Exception.hh"
45 #include <omniORB4/CORBA.h>
46 #include <omniORB4/minorCode.h>
52 #include "YacsTrace.hxx"
54 using namespace YACS::ENGINE;
57 const char CORBANode::IMPL_NAME[]="CORBA";
58 const char CORBANode::KIND[]="CORBA";
60 std::string CORBANode::getKind() const
65 //! CORBANode constructor
66 CORBANode::CORBANode(const std::string& name): ServiceNode(name)
68 _implementation=IMPL_NAME;
71 CORBANode::CORBANode(const CORBANode& other,ComposedNode *father):ServiceNode(other,father)
73 _implementation=IMPL_NAME;
76 //! Execute the service on the component associated to the node
77 void CORBANode::execute()
79 YACSTRACE(1, "+++++++++++++ CorbaNode::execute: " << getName() << " +++++++++++++++" );
81 //DII request building :
82 // a service gets all its in parameters first
83 // then all its out parameters
84 // no inout parameters
85 // the return value (if any) is the first out parameter
86 // not yet user exception (only CORBA exception)
88 CORBA::Object_var objComponent=((CORBAComponent*)_component)->getCompoPtr();
89 CORBA::Request_var req = objComponent->_request(_method.c_str());
90 CORBA::NVList_ptr arguments = req->arguments() ;
92 DEBTRACE( "+++++++++++++++++CorbaNode::inputs+++++++++++++++++" )
95 list<InputPort *>::iterator iter2;
96 for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
98 InputCorbaPort *p=(InputCorbaPort *)*iter2;
99 DEBTRACE( "port name: " << p->getName() )
100 DEBTRACE( "port kind: " << p->edGetType()->kind() )
101 CORBA::Any* ob=p->getAny();
103 CORBA::TypeCode_var typcod= ob->type();
104 switch(p->edGetType()->kind())
123 if(*ob >>= CORBA::Any::to_boolean(b))
126 DEBTRACE( "not a boolean" )
129 DEBTRACE( typcod->id() )
135 //add_value makes a copy of any (*ob). This copy will be deleted with the request
136 arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_IN ) ;
141 DEBTRACE( "+++++++++++++++++CorbaNode::outputs+++++++++++++++++" )
142 list<OutputPort *>::iterator iter;
143 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
145 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
146 DEBTRACE( "port name: " << p->getName() )
147 DEBTRACE( "port kind: " << p->edGetType()->kind() )
148 CORBA::Any* ob=p->getAnyOut();
150 DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
152 //add_value makes a copy of any. Copy will be deleted with request
153 arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_OUT );
155 DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
161 req->set_return_type(CORBA::_tc_void);
163 DEBTRACE( "+++++++++++++++++CorbaNode::calculation+++++++++++++++++" << _method )
165 CORBA::Exception *exc =req->env()->exception();
168 DEBTRACE( "An exception was thrown!" )
169 DEBTRACE( "The raised exception is of Type:" << exc->_name() )
171 std::cerr << "The raised exception is of Type:" << exc->_name() << std::endl;
173 if(strcmp(exc->_name(),"MARSHAL") == 0)
175 const char* ms = ((CORBA::MARSHAL*)exc)->NP_minorString();
177 std::cerr << "(CORBA::MARSHAL: minor = " << ms << ")" << std::endl;
179 std::cerr << "(CORBA::MARSHAL: minor = " << ((CORBA::MARSHAL*)exc)->minor() << ")" << std::endl;
182 _errorDetails="Execution problem: the raised exception is of Type:";
183 _errorDetails += exc->_name();
184 throw Exception("Execution problem");
187 DEBTRACE( "++++++++++++CorbaNode::outputs++++++++++++" )
188 int out_param=in_param;
189 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
191 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
192 DEBTRACE( "port name: " << p->getName() )
193 DEBTRACE( "port kind: " << p->edGetType()->kind() )
194 DEBTRACE( "port number: " << out_param )
195 CORBA::Any *ob=arguments->item(out_param)->value();
197 DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
200 CORBA::TypeCode_var tc=ob->type();
201 switch(p->edGetType()->kind())
225 //OutputPort must copy the input Any(ob).
226 //This Any will be deleted with the request.
227 //Copy is made by the method put.
229 out_param=out_param+1;
231 DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
234 DEBTRACE( "++++++++++++++++++++++++++++++++++++++++++" )
236 //Request has been deleted (_var )
237 //All anys given to the request are deleted : don't forget to copy them
238 //if you want to keep them
240 list<OutputPort *>::const_iterator iter;
241 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
243 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
244 CORBA::Any *ob=p->getAny();
245 DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
248 DEBTRACE( "+++++++++++++++++ End CorbaNode::execute: " << getName() << " +++++++++++++++++" )
251 //! Clone the node : must also clone the component instance ?
252 Node *CORBANode::simpleClone(ComposedNode *father, bool editionOnly) const
254 return new CORBANode(*this,father);
257 //! Create a CORBANode with the same component object and no input or output port
259 * \param name : node name
260 * \return a new CORBANode node
262 ServiceNode* CORBANode::createNode(const std::string& name)
265 CORBANode* node= new CORBANode(name);
266 node->setComponent(_component);
272 const char SalomeNode::KIND[]="Salome";
274 std::string SalomeNode::getKind() const
279 //! SalomeNode constructor
280 SalomeNode::SalomeNode(const std::string& name):ServiceNode(name)
282 _implementation=CORBANode::IMPL_NAME;
285 SalomeNode::SalomeNode(const SalomeNode& other,ComposedNode *father):ServiceNode(other,father)
287 _implementation=CORBANode::IMPL_NAME;
290 SalomeNode::~SalomeNode()
295 //! Init the datastream ports of the component associated to the node
296 void SalomeNode::initService()
298 DEBTRACE( "SalomeNode::initService: "<<getName())
299 if(_setOfInputDataStreamPort.size() == 0 && _setOfOutputDataStreamPort.size() == 0)return;
301 CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
302 Engines::Superv_Component_var compo=Engines::Superv_Component::_narrow(objComponent);
303 if( CORBA::is_nil(compo) )
305 std::string msg="Can't get reference to DSC object (or it was nil).";
307 throw Exception(msg);
311 if (!_multi_port_node)
313 CORBA::Boolean ret=compo->init_service(_method.c_str());
316 _errorDetails="Problem with component '"+_ref+"' in init_service of service '"+ _method + "'";
317 throw Exception(_errorDetails);
319 //Should check that component port types are the same as those declared in the xml file
323 CORBA::Boolean ret=compo->init_service_with_multiple(_method.c_str(), _param);
326 _errorDetails="Problem with component '"+_ref+"' in init_service_with_multiple of service '"+ _method + "'";
327 throw Exception(_errorDetails);
333 _errorDetails="Problem with component '"+_ref+"' in init_service of service '"+ _method + "'";
339 SalomeNode::addDatastreamPortToInitMultiService(const std::string & port_name, int number)
341 int index = _param.length();
342 _param.length(index + 1);
343 _param[index].name = CORBA::string_dup(port_name.c_str());
344 _param[index].number = number;
347 //! Connect the datastream ports of the component associated to the node
348 void SalomeNode::connectService()
350 DEBTRACE( "SalomeNode::connectService: "<<getName());
351 if(_setOfOutputDataStreamPort.size() == 0)return;
353 CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
354 SALOME_NamingService NS(getSALOMERuntime()->getOrb()) ;
355 SALOME_LifeCycleCORBA LCC(&NS) ;
356 CORBA::Object_var obj = NS.Resolve("/ConnectionManager");
357 Engines::ConnectionManager_var manager=Engines::ConnectionManager::_narrow(obj);
358 Engines::Superv_Component_var me=Engines::Superv_Component::_narrow(objComponent);
359 if( CORBA::is_nil(me) )
361 std::string msg="Can't get reference to Engines::Superv_Component: "+getName();
363 throw Exception(msg);
365 std::list<OutputDataStreamPort *>::iterator iter;
366 Engines::ConnectionManager::connectionId id;
367 for(iter = _setOfOutputDataStreamPort.begin(); iter != _setOfOutputDataStreamPort.end(); iter++)
369 OutputDataStreamPort *port=(OutputDataStreamPort *)*iter;
370 std::set<InPort *> ports=port->edSetInPort();
371 std::set<InPort *>::iterator iterout;
372 for(iterout=ports.begin();iterout != ports.end(); iterout++)
374 //It's only possible to connect 2 SalomeNode : try to get a SalomeNode
375 SalomeNode* snode= dynamic_cast<SalomeNode*>((*iterout)->getNode());
376 if(snode == 0) //don't connect, it's not a SalomeNode
378 std::string msg="Can't connect : not a SalomeNode";
380 throw Exception(msg);
383 CORBA::Object_var comp=((SalomeComponent*)snode->getComponent())->getCompoPtr();
384 if( CORBA::is_nil(comp))
386 std::string msg="Problem in connectService: " + snode->getName();
387 msg=msg+" Component is probably not launched. Modify your YACS file";
389 throw Exception(msg);
392 Engines::Superv_Component_var other=Engines::Superv_Component::_narrow(comp);
393 if( CORBA::is_nil(other))
395 std::string msg="Can't connect to nil Engines::Superv_Component: " + snode->getName();
397 throw Exception(msg);
401 id=manager->connect(me,port->getName().c_str(),other,(*iterout)->getName().c_str());
403 catch(Engines::DSC::PortNotDefined& ex)
405 std::string msg="Problem in connectService. Unknown port: "+port->getName()+" or "+(*iterout)->getName();
407 throw Exception(msg);
409 catch(Engines::DSC::BadPortType& ex)
411 std::string msg="Problem in connectService. Type of provides port is bad. Expected: ";
412 msg=msg + ex.expected.in();
413 msg=msg + "Received: "+ex.received.in();
415 throw Exception(msg);
417 catch(Engines::DSC::NilPort& ex)
419 std::string msg="Problem in connectService. Port is nil: "+port->getName()+" or "+(*iterout)->getName();
421 throw Exception(msg);
423 catch( const SALOME::SALOME_Exception& ex )
425 std::string msg="Problem in connectService. ";
426 msg += ex.details.text.in();
427 msg=msg+getName()+" " + port->getName() + " " + snode->getName() + " " + (*iterout)->getName();
429 throw Exception(msg);
431 catch(CORBA::SystemException& ex)
433 DEBTRACE( "minor code: " << ex.minor() );
434 DEBTRACE( "completion code: " << ex.completed() );
435 std::string msg="Problem in connectService. CORBA System exception ";
436 std::string excname=ex._name();
437 msg=msg+excname + " " +getName()+" " + port->getName() + " " + snode->getName() + " " + (*iterout)->getName();
439 throw Exception(msg);
443 std::string msg="Problem in connectService. Unknown exception";
444 msg=msg+getName()+" " + port->getName() + " " + snode->getName() + " " + (*iterout)->getName();
446 throw Exception(msg);
448 DEBTRACE("Connected: " <<id<<" "<<getName()<<" "<<port->getName()<<" "<<snode->getName()<<" "<<(*iterout)->getName());
453 //Init component port properties
454 for(iter = _setOfOutputDataStreamPort.begin(); iter != _setOfOutputDataStreamPort.end(); iter++)
456 (*iter)->initPortProperties();
458 std::list<InputDataStreamPort *>::iterator iterin;
459 for(iterin = _setOfInputDataStreamPort.begin(); iterin != _setOfInputDataStreamPort.end(); iterin++)
461 (*iterin)->initPortProperties();
465 //! Disconnect the datastream ports of the component associated to the node
466 void SalomeNode::disconnectService()
468 DEBTRACE( "SalomeNode::disconnectService: "<<getName());
469 // in some rare cases, disconnectService can be called from 2 different threads
470 YACS::BASES::Lock lock(&_mutex);
475 SALOME_NamingService NS(getSALOMERuntime()->getOrb()) ;
476 SALOME_LifeCycleCORBA LCC(&NS) ;
477 CORBA::Object_var obj = NS.Resolve("/ConnectionManager");
478 Engines::ConnectionManager_var manager=Engines::ConnectionManager::_narrow(obj);
479 std::list<Engines::ConnectionManager::connectionId>::iterator iter;
480 for(iter = ids.begin(); iter != ids.end(); iter++)
482 DEBTRACE("Trying to disconnect: " << *iter );
485 manager->disconnect(*iter,Engines::DSC::RemovingConnection);
487 catch(Engines::ConnectionManager::BadId& ex)
489 DEBTRACE( "Problem in disconnect: " << *iter );
491 catch(Engines::DSC::PortNotDefined& ex)
493 DEBTRACE( "Problem in disconnect: " << *iter );
495 catch(Engines::DSC::PortNotConnected& ex)
497 DEBTRACE( "Problem in disconnect: " << *iter );
499 catch(Engines::DSC::BadPortReference& ex)
501 DEBTRACE( "Problem in disconnect (Engines::DSC::BadPortReference): " << *iter );
503 catch(CORBA::SystemException& ex)
505 DEBTRACE( "Problem in disconnect (CORBA::SystemException): " << *iter );
509 DEBTRACE( "Problem in disconnect: " << *iter );
515 void SalomeNode::cleanNodes()
522 //! Execute the service on the component associated to the node
523 void SalomeNode::execute()
525 YACSTRACE(1,"+++++++++++++++++ SalomeNode::execute: " << getName() << " " << _method << " +++++++++++++++++" );
527 CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
528 Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
530 // Set component properties
531 std::map<std::string,std::string> amap=getProperties();
534 Engines::FieldsDict_var dico = new Engines::FieldsDict;
535 dico->length(amap.size());
536 std::map<std::string,std::string>::const_iterator it;
538 for(it = amap.begin(); it != amap.end(); ++it)
540 dico[i].key=CORBA::string_dup(it->first.c_str());
541 dico[i].value <<=it->second.c_str();
544 compo->setProperties(dico);
547 //DII request building :
548 // a service gets all its in parameters first
549 // then all its out parameters
550 // no inout parameters
551 // the return value (if any) is the first out parameter
553 CORBA::Request_var req ;
556 req = objComponent->_request(_method.c_str());
558 catch(CORBA::SystemException& ex)
560 std::string msg="component '" +_ref+ "' has no service '" + _method+ "'";
562 throw Exception(msg);
564 CORBA::NVList_ptr arguments = req->arguments() ;
566 DEBTRACE( "+++++++++++++++++SalomeNode::inputs+++++++++++++++++" );
569 list<InputPort *>::iterator iter2;
570 for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
572 InputCorbaPort *p=(InputCorbaPort *)*iter2;
573 if(p->edGetType()->isA(Runtime::_tc_file))
575 DEBTRACE( "port name: " << p->getName() );
576 DEBTRACE( "port kind: " << p->edGetType()->kind() );
577 CORBA::Any* ob=p->getAny();
579 CORBA::TypeCode_var tc=ob->type();
580 switch(p->edGetType()->kind())
604 //add_value makes a copy of any. Copy will be deleted with request
605 arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_IN ) ;
610 DEBTRACE("checkInputFilesToService: " << _method);
613 for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
615 InputCorbaPort *p=(InputCorbaPort *)*iter2;
616 if(!p->edGetType()->isA(Runtime::_tc_file))
618 std::string filename=p->getName();
619 // replace ':' by '.'. Needed because port name can not contain '.'
620 string::size_type debut =filename.find_first_of(':',0);
621 while(debut != std::string::npos)
624 debut=filename.find_first_of(':',debut);
626 DEBTRACE( "inport with file: " << filename );
627 Engines::Salome_file_var isf=compo->setInputFileToService(_method.c_str(),p->getName().c_str());
628 isf->setDistributedFile(filename.c_str());
629 Engines::Salome_file_ptr osf;
630 CORBA::Any* any=p->getAny();
636 compo->checkInputFilesToService(_method.c_str());
638 catch( const SALOME::SALOME_Exception& ex )
640 std::string text="Execution problem in checkInputFilesToService: ";
641 text += (const char*)ex.details.text;
643 throw Exception(text);
645 catch(CORBA::SystemException& ex)
647 std::string msg="Execution problem: component probably does not support files ??";
649 throw Exception(msg);
653 DEBTRACE( "+++++++++++++++++SalomeNode::outputs+++++++++++++++++" )
654 list<OutputPort *>::iterator iter;
655 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
657 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
658 DEBTRACE( "port name: " << p->getName() )
659 DEBTRACE( "port kind: " << p->edGetType()->kind() )
660 if(p->edGetType()->isA(Runtime::_tc_file))
662 CORBA::Any* ob=p->getAnyOut();
663 //add_value makes a copy of any. Copy will be deleted with request
664 arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_OUT );
669 //if return type is set to void (not mandatory, it's set by default)
670 //the return value will not be marshalled as a return value but
671 //as the first out argument (don't forget to add it as the first output argument)
672 req->set_return_type(CORBA::_tc_void);
674 req->exceptions()->add(SALOME::_tc_SALOME_Exception);
676 DEBTRACE( "+++++++++++++++++SalomeNode::calculation+++++++++++++++++" << _method )
678 CORBA::Exception *exc =req->env()->exception();
681 DEBTRACE( "An exception was thrown!" )
682 DEBTRACE( "The raised exception is of Type:" << exc->_name() )
684 CORBA::SystemException* sysexc;
685 sysexc=CORBA::SystemException::_downcast(exc);
688 // It's a SystemException
689 DEBTRACE( "minor code: " << sysexc->minor() );
690 DEBTRACE( "completion code: " << sysexc->completed() );
691 std::string text="Execution problem: ";
692 std::string excname=sysexc->_name();
693 if(excname == "BAD_OPERATION")
695 text=text+"component '" +_ref+ "' has no service '" + _method+ "'";
697 else if(excname == "BAD_PARAM")
699 text=text+"A parameter (input or output) passed to the call is out of range or otherwise considered illegal.\n";
700 text=text+"Minor code: "+sysexc->NP_minorString();
702 else if(excname == "MARSHAL" && sysexc->minor() == omni::MARSHAL_PassEndOfMessage)
704 text=text+"probably an error in arguments of service '" + _method + "' from component '" +_ref+ "'";
706 else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalResults)
708 text=text+"probably an error in output arguments of service '" + _method + "' from component '" +_ref+ "'";
710 else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalArguments)
712 text=text+"probably an error in input arguments of service '" + _method + "' from component '" +_ref+ "'";
714 else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_WaitingForReply)
716 text=text+"probably an error in input arguments of service '" + _method + "' from component '" +_ref+ "'";
720 DEBTRACE(sysexc->NP_minorString() );
721 text=text+"System Exception "+ excname;
724 throw Exception(text);
727 // Not a System Exception
728 CORBA::UnknownUserException* userexc;
729 userexc=CORBA::UnknownUserException::_downcast(exc);
732 CORBA::Any anyExcept = userexc->exception();
734 const SALOME::SALOME_Exception* salexc;
735 if(anyExcept >>= salexc)
737 DEBTRACE("SALOME_Exception: "<< salexc->details.sourceFile);
738 DEBTRACE("SALOME_Exception: "<<salexc->details.lineNumber);
739 _errorDetails=salexc->details.text;
740 throw Exception("Execution problem: Salome Exception occurred" + getErrorDetails() );
742 std::string msg="Execution problem: User Exception occurred";
744 throw Exception(msg);
746 std::string msg="Execution problem";
748 throw Exception(msg);
751 DEBTRACE( "++++++++++++SalomeNode::outputs++++++++++++" )
752 int out_param=in_param;
753 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
755 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
756 DEBTRACE( "port name: " << p->getName() );
757 DEBTRACE( "port kind: " << p->edGetType()->kind() );
758 DEBTRACE( "port number: " << out_param );
759 if(p->edGetType()->isA(Runtime::_tc_file))
761 CORBA::Any *ob=arguments->item(out_param)->value();
763 switch(p->edGetType()->kind())
784 //OutputPort must copy the input Any(ob).
785 //This Any will be deleted with the request.
786 //Copy is made by the method put.
788 out_param=out_param+1;
793 DEBTRACE("checkOutputFilesToService: " << _method);
796 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
798 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
799 if(!p->edGetType()->isA(Runtime::_tc_file))
801 // The output port has a file object : special treatment
802 std::string filename=p->getName();
803 // replace ':' by '.'. Needed because port name can not contain '.'
804 string::size_type debut =filename.find_first_of(':',0);
805 while(debut != std::string::npos)
808 debut=filename.find_first_of(':',debut);
810 DEBTRACE( "outport with file: " << filename );
811 Engines::Salome_file_var osf=compo->setOutputFileToService(_method.c_str(),p->getName().c_str());
812 osf->setLocalFile(filename.c_str());
818 compo->checkOutputFilesToService(_method.c_str());
820 catch( const SALOME::SALOME_Exception& ex )
822 std::string text=(const char*)ex.details.text;
824 throw Exception("Execution problem in checkOutputFilesToService: " + text);
826 catch(CORBA::SystemException& ex)
828 std::string msg="Execution problem: component probably does not support files ?";
830 throw Exception(msg);
833 //Request has been deleted (_var )
834 //All anys given to the request are deleted : don't forget to copy them
835 //if you want to keep them
836 DEBTRACE( "+++++++++++++++++ End SalomeNode::execute: " << getName() << " +++++++++++++++++" )
839 Node *SalomeNode::simpleClone(ComposedNode *father, bool editionOnly) const
841 return new SalomeNode(*this,father);
844 //! Create a SalomeNode with the same component object and no input or output port
846 * \param name : node name
847 * \return a new SalomeNode node
849 ServiceNode* SalomeNode::createNode(const std::string& name)
851 SalomeNode* node=new SalomeNode(name);
852 node->setComponent(_component);
856 std::string SalomeNode::getContainerLog()
858 std::string msg="Component is not loaded";
861 CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
862 Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
863 if( !CORBA::is_nil(compo) )
865 Engines::Container_var cont= compo->GetContainerRef();
866 CORBA::String_var logname = cont->logfilename();
869 std::string::size_type pos = msg.find(":");
870 msg=msg.substr(pos+1);
873 catch(CORBA::COMM_FAILURE& ex)
875 msg = ":Component no longer reachable: Caught system exception COMM_FAILURE";
876 msg += " -- unable to contact the object.";
878 catch(CORBA::SystemException& ex)
880 msg = ":Component no longer reachable: Caught a CORBA::SystemException.\n";
883 CORBA::TypeCode_var tc = tmp.type();
884 const char *p = tc->name();
890 catch(CORBA::Exception& ex)
892 msg = ":Component no longer reachable: Caught CORBA::Exception.\n";
895 CORBA::TypeCode_var tc = tmp.type();
896 const char *p = tc->name();
902 catch(omniORB::fatalException& fe)
904 msg = ":Component no longer reachable: Caught omniORB::fatalException.\n";
906 log << " file: " << fe.file() << endl;
907 log << " line: " << fe.line() << endl;
908 log << " mesg: " << fe.errmsg() << endl;
913 msg = ":Component no longer reachable: Caught unknown exception.";
918 void SalomeNode::shutdown(int level)
920 DEBTRACE("SalomeNode::shutdown " << level);
922 _component->shutdown(level);