1 // Copyright (C) 2006-2024 CEA, EDF
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_Wrapper.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 ConnectionManager& manager = getSALOMERuntime()->getConnectionManager();
356 Engines::Superv_Component_var me=Engines::Superv_Component::_narrow(objComponent);
357 if( CORBA::is_nil(me) )
359 std::string msg="Can't get reference to Engines::Superv_Component: "+getName();
361 throw Exception(msg);
363 std::list<OutputDataStreamPort *>::iterator iter;
364 Engines::ConnectionManager::connectionId id;
365 for(iter = _setOfOutputDataStreamPort.begin(); iter != _setOfOutputDataStreamPort.end(); iter++)
367 OutputDataStreamPort *port=(OutputDataStreamPort *)*iter;
368 std::set<InPort *> ports=port->edSetInPort();
369 std::set<InPort *>::iterator iterout;
370 for(iterout=ports.begin();iterout != ports.end(); iterout++)
372 //It's only possible to connect 2 SalomeNode : try to get a SalomeNode
373 SalomeNode* snode= dynamic_cast<SalomeNode*>((*iterout)->getNode());
374 if(snode == 0) //don't connect, it's not a SalomeNode
376 std::string msg="Can't connect : not a SalomeNode";
378 throw Exception(msg);
381 CORBA::Object_var comp=((SalomeComponent*)snode->getComponent())->getCompoPtr();
382 if( CORBA::is_nil(comp))
384 std::string msg="Problem in connectService: " + snode->getName();
385 msg=msg+" Component is probably not launched. Modify your YACS file";
387 throw Exception(msg);
390 Engines::Superv_Component_var other=Engines::Superv_Component::_narrow(comp);
391 if( CORBA::is_nil(other))
393 std::string msg="Can't connect to nil Engines::Superv_Component: " + snode->getName();
395 throw Exception(msg);
399 id=manager.connect(me,port->getName().c_str(),other,(*iterout)->getName().c_str());
401 catch(Engines::DSC::PortNotDefined& ex)
403 std::string msg="Problem in connectService. Unknown port: "+port->getName()+" or "+(*iterout)->getName();
405 throw Exception(msg);
407 catch(Engines::DSC::BadPortType& ex)
409 std::string msg="Problem in connectService. Type of provides port is bad. Expected: ";
410 msg=msg + ex.expected.in();
411 msg=msg + "Received: "+ex.received.in();
413 throw Exception(msg);
415 catch(Engines::DSC::NilPort& ex)
417 std::string msg="Problem in connectService. Port is nil: "+port->getName()+" or "+(*iterout)->getName();
419 throw Exception(msg);
421 catch( const SALOME::SALOME_Exception& ex )
423 std::string msg="Problem in connectService. ";
424 msg += ex.details.text.in();
425 msg=msg+getName()+" " + port->getName() + " " + snode->getName() + " " + (*iterout)->getName();
427 throw Exception(msg);
429 catch(CORBA::SystemException& ex)
431 DEBTRACE( "minor code: " << ex.minor() );
432 DEBTRACE( "completion code: " << ex.completed() );
433 std::string msg="Problem in connectService. CORBA System exception ";
434 std::string excname=ex._name();
435 msg=msg+excname + " " +getName()+" " + port->getName() + " " + snode->getName() + " " + (*iterout)->getName();
437 throw Exception(msg);
441 std::string msg="Problem in connectService. Unknown exception";
442 msg=msg+getName()+" " + port->getName() + " " + snode->getName() + " " + (*iterout)->getName();
444 throw Exception(msg);
446 DEBTRACE("Connected: " <<id<<" "<<getName()<<" "<<port->getName()<<" "<<snode->getName()<<" "<<(*iterout)->getName());
451 //Init component port properties
452 for(iter = _setOfOutputDataStreamPort.begin(); iter != _setOfOutputDataStreamPort.end(); iter++)
454 (*iter)->initPortProperties();
456 std::list<InputDataStreamPort *>::iterator iterin;
457 for(iterin = _setOfInputDataStreamPort.begin(); iterin != _setOfInputDataStreamPort.end(); iterin++)
459 (*iterin)->initPortProperties();
463 //! Disconnect the datastream ports of the component associated to the node
464 void SalomeNode::disconnectService()
466 DEBTRACE( "SalomeNode::disconnectService: "<<getName());
467 // in some rare cases, disconnectService can be called from 2 different threads
468 YACS::BASES::AutoLocker<YACS::BASES::Mutex> lock(&_mutex);
473 ConnectionManager& manager = getSALOMERuntime()->getConnectionManager();
474 std::list<Engines::ConnectionManager::connectionId>::iterator iter;
475 for(iter = ids.begin(); iter != ids.end(); iter++)
477 DEBTRACE("Trying to disconnect: " << *iter );
480 manager.disconnect(*iter,Engines::DSC::RemovingConnection);
482 catch(Engines::ConnectionManager::BadId& ex)
484 DEBTRACE( "Problem in disconnect: " << *iter );
486 catch(Engines::DSC::PortNotDefined& ex)
488 DEBTRACE( "Problem in disconnect: " << *iter );
490 catch(Engines::DSC::PortNotConnected& ex)
492 DEBTRACE( "Problem in disconnect: " << *iter );
494 catch(Engines::DSC::BadPortReference& ex)
496 DEBTRACE( "Problem in disconnect (Engines::DSC::BadPortReference): " << *iter );
498 catch(CORBA::SystemException& ex)
500 DEBTRACE( "Problem in disconnect (CORBA::SystemException): " << *iter );
504 DEBTRACE( "Problem in disconnect: " << *iter );
510 void SalomeNode::cleanNodes()
517 //! Execute the service on the component associated to the node
518 void SalomeNode::execute()
520 YACSTRACE(1,"+++++++++++++++++ SalomeNode::execute: " << getName() << " " << _method << " +++++++++++++++++" );
522 CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
523 Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
525 // Set component properties
526 std::map<std::string,std::string> amap=getProperties();
529 Engines::FieldsDict_var dico = new Engines::FieldsDict;
530 dico->length(amap.size());
531 std::map<std::string,std::string>::const_iterator it;
533 for(it = amap.begin(); it != amap.end(); ++it)
535 dico[i].key=CORBA::string_dup(it->first.c_str());
536 dico[i].value <<=it->second.c_str();
539 compo->setProperties(dico);
542 //DII request building :
543 // a service gets all its in parameters first
544 // then all its out parameters
545 // no inout parameters
546 // the return value (if any) is the first out parameter
548 CORBA::Request_var req ;
551 req = objComponent->_request(_method.c_str());
553 catch(CORBA::SystemException& ex)
555 std::string msg="component '" +_ref+ "' has no service '" + _method+ "'";
557 throw Exception(msg);
559 CORBA::NVList_ptr arguments = req->arguments() ;
561 DEBTRACE( "+++++++++++++++++SalomeNode::inputs+++++++++++++++++" );
564 list<InputPort *>::iterator iter2;
565 for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
567 InputCorbaPort *p=(InputCorbaPort *)*iter2;
568 if(p->edGetType()->isA(Runtime::_tc_file))
570 DEBTRACE( "port name: " << p->getName() );
571 DEBTRACE( "port kind: " << p->edGetType()->kind() );
572 CORBA::Any* ob=p->getAny();
574 CORBA::TypeCode_var tc=ob->type();
575 switch(p->edGetType()->kind())
599 //add_value makes a copy of any. Copy will be deleted with request
600 arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_IN ) ;
605 DEBTRACE("checkInputFilesToService: " << _method);
608 for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
610 InputCorbaPort *p=(InputCorbaPort *)*iter2;
611 if(!p->edGetType()->isA(Runtime::_tc_file))
613 std::string filename=p->getName();
614 // replace ':' by '.'. Needed because port name can not contain '.'
615 string::size_type debut =filename.find_first_of(':',0);
616 while(debut != std::string::npos)
619 debut=filename.find_first_of(':',debut);
621 DEBTRACE( "inport with file: " << filename );
622 Engines::Salome_file_var isf=compo->setInputFileToService(_method.c_str(),p->getName().c_str());
623 isf->setDistributedFile(filename.c_str());
624 Engines::Salome_file_ptr osf;
625 CORBA::Any* any=p->getAny();
631 compo->checkInputFilesToService(_method.c_str());
633 catch( const SALOME::SALOME_Exception& ex )
635 std::string text="Execution problem in checkInputFilesToService: ";
636 text += (const char*)ex.details.text;
638 throw Exception(text);
640 catch(CORBA::SystemException& ex)
642 std::string msg="Execution problem: component probably does not support files ??";
644 throw Exception(msg);
648 DEBTRACE( "+++++++++++++++++SalomeNode::outputs+++++++++++++++++" )
649 list<OutputPort *>::iterator iter;
650 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
652 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
653 DEBTRACE( "port name: " << p->getName() )
654 DEBTRACE( "port kind: " << p->edGetType()->kind() )
655 if(p->edGetType()->isA(Runtime::_tc_file))
657 CORBA::Any* ob=p->getAnyOut();
658 //add_value makes a copy of any. Copy will be deleted with request
659 arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_OUT );
664 //if return type is set to void (not mandatory, it's set by default)
665 //the return value will not be marshalled as a return value but
666 //as the first out argument (don't forget to add it as the first output argument)
667 req->set_return_type(CORBA::_tc_void);
669 req->exceptions()->add(SALOME::_tc_SALOME_Exception);
671 DEBTRACE( "+++++++++++++++++SalomeNode::calculation+++++++++++++++++" << _method )
673 CORBA::Exception *exc =req->env()->exception();
676 DEBTRACE( "An exception was thrown!" )
677 DEBTRACE( "The raised exception is of Type:" << exc->_name() )
679 CORBA::SystemException* sysexc;
680 sysexc=CORBA::SystemException::_downcast(exc);
683 // It's a SystemException
684 DEBTRACE( "minor code: " << sysexc->minor() );
685 DEBTRACE( "completion code: " << sysexc->completed() );
686 std::string text="Execution problem: ";
687 std::string excname=sysexc->_name();
688 if(excname == "BAD_OPERATION")
690 text=text+"component '" +_ref+ "' has no service '" + _method+ "'";
692 else if(excname == "BAD_PARAM")
694 text=text+"A parameter (input or output) passed to the call is out of range or otherwise considered illegal.\n";
695 text=text+"Minor code: "+sysexc->NP_minorString();
697 else if(excname == "MARSHAL" && sysexc->minor() == omni::MARSHAL_PassEndOfMessage)
699 text=text+"probably an error in arguments of service '" + _method + "' from component '" +_ref+ "'";
701 else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalResults)
703 text=text+"probably an error in output arguments of service '" + _method + "' from component '" +_ref+ "'";
705 else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalArguments)
707 text=text+"probably an error in input arguments of service '" + _method + "' from component '" +_ref+ "'";
709 else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_WaitingForReply)
711 text=text+"probably an error in input arguments of service '" + _method + "' from component '" +_ref+ "'";
715 DEBTRACE(sysexc->NP_minorString() );
716 text=text+"System Exception "+ excname;
719 throw Exception(text);
722 // Not a System Exception
723 CORBA::UnknownUserException* userexc;
724 userexc=CORBA::UnknownUserException::_downcast(exc);
727 CORBA::Any anyExcept = userexc->exception();
729 const SALOME::SALOME_Exception* salexc;
730 if(anyExcept >>= salexc)
732 DEBTRACE("SALOME_Exception: "<< salexc->details.sourceFile);
733 DEBTRACE("SALOME_Exception: "<<salexc->details.lineNumber);
734 _errorDetails=salexc->details.text;
735 throw Exception("Execution problem: Salome Exception occurred" + getErrorDetails() );
737 std::string msg="Execution problem: User Exception occurred";
739 throw Exception(msg);
741 std::string msg="Execution problem";
743 throw Exception(msg);
746 DEBTRACE( "++++++++++++SalomeNode::outputs++++++++++++" )
747 int out_param=in_param;
748 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
750 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
751 DEBTRACE( "port name: " << p->getName() );
752 DEBTRACE( "port kind: " << p->edGetType()->kind() );
753 DEBTRACE( "port number: " << out_param );
754 if(p->edGetType()->isA(Runtime::_tc_file))
756 CORBA::Any *ob=arguments->item(out_param)->value();
758 switch(p->edGetType()->kind())
779 //OutputPort must copy the input Any(ob).
780 //This Any will be deleted with the request.
781 //Copy is made by the method put.
783 out_param=out_param+1;
788 DEBTRACE("checkOutputFilesToService: " << _method);
791 for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
793 OutputCorbaPort *p=(OutputCorbaPort *)*iter;
794 if(!p->edGetType()->isA(Runtime::_tc_file))
796 // The output port has a file object : special treatment
797 std::string filename=p->getName();
798 // replace ':' by '.'. Needed because port name can not contain '.'
799 string::size_type debut =filename.find_first_of(':',0);
800 while(debut != std::string::npos)
803 debut=filename.find_first_of(':',debut);
805 DEBTRACE( "outport with file: " << filename );
806 Engines::Salome_file_var osf=compo->setOutputFileToService(_method.c_str(),p->getName().c_str());
807 osf->setLocalFile(filename.c_str());
813 compo->checkOutputFilesToService(_method.c_str());
815 catch( const SALOME::SALOME_Exception& ex )
817 std::string text=(const char*)ex.details.text;
819 throw Exception("Execution problem in checkOutputFilesToService: " + text);
821 catch(CORBA::SystemException& ex)
823 std::string msg="Execution problem: component probably does not support files ?";
825 throw Exception(msg);
828 //Request has been deleted (_var )
829 //All anys given to the request are deleted : don't forget to copy them
830 //if you want to keep them
831 DEBTRACE( "+++++++++++++++++ End SalomeNode::execute: " << getName() << " +++++++++++++++++" )
834 Node *SalomeNode::simpleClone(ComposedNode *father, bool editionOnly) const
836 return new SalomeNode(*this,father);
839 //! Create a SalomeNode with the same component object and no input or output port
841 * \param name : node name
842 * \return a new SalomeNode node
844 ServiceNode* SalomeNode::createNode(const std::string& name)
846 SalomeNode* node=new SalomeNode(name);
847 node->setComponent(_component);
851 std::string SalomeNode::getContainerLog()
853 std::string msg="Component is not loaded";
856 CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
857 Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
858 if( !CORBA::is_nil(compo) )
860 Engines::Container_var cont= compo->GetContainerRef();
861 CORBA::String_var logname = cont->logfilename();
864 std::string::size_type pos = msg.find(":");
865 msg=msg.substr(pos+1);
868 catch(CORBA::COMM_FAILURE& ex)
870 msg = ":Component no longer reachable: Caught system exception COMM_FAILURE";
871 msg += " -- unable to contact the object.";
873 catch(CORBA::SystemException& ex)
875 msg = ":Component no longer reachable: Caught a CORBA::SystemException.\n";
878 CORBA::TypeCode_var tc = tmp.type();
879 const char *p = tc->name();
885 catch(CORBA::Exception& ex)
887 msg = ":Component no longer reachable: Caught CORBA::Exception.\n";
890 CORBA::TypeCode_var tc = tmp.type();
891 const char *p = tc->name();
897 catch(omniORB::fatalException& fe)
899 msg = ":Component no longer reachable: Caught omniORB::fatalException.\n";
901 log << " file: " << fe.file() << endl;
902 log << " line: " << fe.line() << endl;
903 log << " mesg: " << fe.errmsg() << endl;
908 msg = ":Component no longer reachable: Caught unknown exception.";
913 void SalomeNode::shutdown(int level)
915 DEBTRACE("SalomeNode::shutdown " << level);
917 _component->shutdown(level);