Version: 8.3.0
YACS::ENGINE::SalomeNode Class Reference

Class for Salome component Service Node. More...

#include <CORBANode.hxx>

Inheritance diagram for YACS::ENGINE::SalomeNode:
Collaboration diagram for YACS::ENGINE::SalomeNode:

Public Member Functions

 SalomeNode (const SalomeNode &other, ComposedNode *father)
 
 SalomeNode (const std::string &name)
 SalomeNode constructor. More...
 
virtual ~SalomeNode ()
 
virtual void execute ()
 Execute the service on the component associated to the node. More...
 
virtual ServiceNodecreateNode (const std::string &name)
 Create a SalomeNode with the same component object and no input or output port. More...
 
virtual std::string getKind () const
 Return the service node kind. More...
 
virtual std::string typeName ()
 
virtual void shutdown (int level)
 Stop all pending activities of the node. More...
 
virtual std::string getContainerLog ()
 returns a string that contains the name of the container log file if it exists More...
 
- Public Member Functions inherited from YACS::ENGINE::ServiceNode
virtual void load ()
 Load the component associated to the node. More...
 
virtual bool isDeployable () const
 By definition of ServiceNode class. More...
 
virtual void setComponent (ComponentInstance *compo) throw (Exception)
 Associate an existing component instance to this service node AND check the consistency regarding the deployment from root node point of view. More...
 
virtual ComponentInstancegetComponent ()
 Return the associated component instance. More...
 
virtual const ComponentInstancegetComponent () const
 
virtual ContainergetContainer ()
 Return the associated container. More...
 
virtual void setRef (const std::string &ref)
 Associate a new component instance to this service node. More...
 
virtual std::string getRef ()
 
virtual void setMethod (const std::string &method)
 
virtual std::string getMethod ()
 
virtual ~ServiceNode ()
 
virtual void accept (Visitor *visitor)
 
- Public Member Functions inherited from YACS::ENGINE::ElementaryNode
virtual ~ElementaryNode ()
 
void exUpdateState ()
 Update the node state. More...
 
void init (bool start=true)
 
YACS::StatesForNode getState () const
 
void getReadyTasks (std::vector< Task * > &tasks)
 
void edRemovePort (Port *port) throw (Exception)
 
std::list< ElementaryNode * > getRecursiveConstituents () const
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
NodegetChildByName (const std::string &name) const throw (Exception)
 
virtual void checkBasicConsistency () const throw (Exception)
 
ComposedNodegetDynClonerIfExists (const ComposedNode *levelToStop) const
 
int getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
std::string getInPortName (const InPort *) const throw (Exception)
 
std::string getOutPortName (const OutPort *) const throw (Exception)
 
InputPortgetInputPort (const std::string &name) const throw (Exception)
 
OutputPortgetOutputPort (const std::string &name) const throw (Exception)
 
std::list< InputPort * > getSetOfInputPort () const
 
std::list< OutputPort * > getSetOfOutputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 
std::list< OutputPort * > getLocalOutputPorts () const
 
std::set< OutPort * > getAllOutPortsLeavingCurrentScope () const
 
std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope () const
 
virtual std::vector< std::pair
< OutPort *, InPort * > > 
getSetOfLinksLeavingCurrentScope () const
 
virtual std::vector< std::pair
< InPort *, OutPort * > > 
getSetOfLinksComingInCurrentScope () const
 
std::list< InputDataStreamPort * > getSetOfInputDataStreamPort () const
 
std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort () const
 
InputDataStreamPortgetInputDataStreamPort (const std::string &name) const throw (Exception)
 
OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const throw (Exception)
 
virtual InputPortcreateInputPort (const std::string &inputPortName, TypeCode *type)
 
virtual OutputPortcreateOutputPort (const std::string &outputPortName, TypeCode *type)
 
virtual InputDataStreamPortcreateInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type)
 
virtual OutputDataStreamPortcreateOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type)
 
virtual InputPortedAddInputPort (const std::string &inputPortName, TypeCode *type) throw (Exception)
 
virtual OutputPortedAddOutputPort (const std::string &outputPortName, TypeCode *type) throw (Exception)
 
virtual InputDataStreamPortedAddInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type) throw (Exception)
 
virtual OutputDataStreamPortedAddOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type) throw (Exception)
 
virtual void edOrderInputPorts (const std::list< InputPort * > &ports)
 
virtual void edOrderOutputPorts (const std::list< OutputPort * > &ports)
 
virtual void edUpdateState ()
 update the status of the node More...
 
virtual void ensureLoading ()
 Put this node into TOLOAD state when possible. More...
 
int getMaxLevelOfParallelism () const
 
void begin ()
 
bool isReady ()
 
void finished ()
 
void aborted ()
 
void loaded ()
 Notify this node that it is loaded. More...
 
void connected ()
 Notify this node that it is connected. More...
 
virtual std::string getErrorDetails ()
 Give a description of error when node status is ERROR. More...
 
virtual void initService ()
 
virtual void connectService ()
 
virtual void disconnectService ()
 
virtual void getCoupledTasks (std::set< Task * > &coupledSet)
 Calls getCoupledNodes for Task interface. More...
 
virtual void getCoupledNodes (std::set< Task * > &coupledSet)
 Put all nodes that are coupled to this node in coupledSet. More...
 
virtual void addDatastreamPortToInitMultiService (const std::string &port_name, int number)
 
template<class PORT >
void edRemovePortTypedFromSet (PORT *port, std::list< PORT * > &setOfPorts) throw (Exception)
 
template<class PORT >
bool isPortNameAlreadyExist (const std::string &portName, const std::list< PORT * > &setOfPorts)
 
- Public Member Functions inherited from YACS::ENGINE::Node
virtual ~Node ()
 
virtual void resetState (int level)
 Reset the node state depending on the parameter level. More...
 
Nodeclone (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
NodecloneWithoutCompAndContDeepCpy (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
void setState (YACS::StatesForNode theState)
 Sets the given state for node. More...
 
virtual YACS::StatesForNode getEffectiveState () const
 Return the node state in the context of its father. More...
 
virtual YACS::StatesForNode getEffectiveState (const Node *) const
 Return the effective state of a node in the context of this one (its father) More...
 
std::string getColorState (YACS::StatesForNode state) const
 Return the color associated to a state. More...
 
InGategetInGate ()
 
OutGategetOutGate ()
 
const std::string & getName () const
 
void setName (const std::string &name)
 Change the name of the node. More...
 
ComposedNodegetFather () const
 
const std::string getId () const
 
bool exIsControlReady () const
 
std::list< Node * > getOutNodes () const
 
virtual void writeDot (std::ostream &os) const
 Dump to the input stream a dot representation of the node. More...
 
virtual void exFailedState ()
 Notify this node that its execution has failed. More...
 
virtual void exDisabledState ()
 Notify this node that it has been disabled. More...
 
std::list< InPort * > getSetOfInPort () const
 
std::list< OutPort * > getSetOfOutPort () const
 
virtual std::set< InputPort * > edGetSetOfUnitializedInputPort () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
virtual bool edAreAllInputPortInitialized () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
InPortgetInPort (const std::string &name) const throw (Exception)
 
InPropertyPortgetInPropertyPort () const throw (Exception)
 
virtual OutPortgetOutPort (const std::string &name) const throw (Exception)
 
std::list< ComposedNode * > getAllAscendanceOf (ComposedNode *levelToStop=0) const
 
bool operator> (const Node &other) const
 
bool operator< (const Node &other) const
 
std::string getImplementation () const
 
virtual ComposedNodegetRootNode () const throw (Exception)
 
virtual void setProperty (const std::string &name, const std::string &value)
 
virtual std::string getProperty (const std::string &name)
 
std::map< std::string,
std::string > 
getProperties ()
 
std::map< std::string,
std::string > 
getPropertyMap ()
 
virtual void setProperties (std::map< std::string, std::string > properties)
 
virtual ProcgetProc ()
 
virtual const ProcgetProc () const
 
std::string getQualifiedName () const
 same as Node::getName() in most cases, but differs for children of switch More...
 
int getNumId ()
 return node instance identifiant, unique for each node instance More...
 
std::vector< std::pair
< std::string, int > > 
getDPLScopeInfo (ComposedNode *gfn)
 
virtual void applyDPLScope (ComposedNode *gfn)
 
virtual void sendEvent (const std::string &event)
 emit notification to all observers registered with the dispatcher More...
 
virtual void sendEvent2 (const std::string &event, void *something)
 emit notification to all observers registered with the dispatcher More...
 
virtual std::string getErrorDetails () const
 
virtual void setErrorDetails (const std::string &error)
 
virtual void modified ()
 Sets Node in modified state and its father if it exists. More...
 
virtual int isModified ()
 
virtual int isValid ()
 indicates if the node is valid (returns 1) or not (returns 0) More...
 
virtual std::string getErrorReport ()
 returns a string that contains an error report if the node is in error More...
 
virtual void cleanNodes ()
 Clean the node in case of not clean exit. More...
 
- Public Member Functions inherited from YACS::ENGINE::Task
virtual ~Task ()
 

Static Public Attributes

static const char KIND [] ="Salome"
 
- Static Public Attributes inherited from YACS::ENGINE::ServiceNode
static const char KIND [] =""
 

Protected Member Functions

NodesimpleClone (ComposedNode *father, bool editionOnly) const
 
- Protected Member Functions inherited from YACS::ENGINE::ServiceNode
 ServiceNode (const std::string &name)
 
 ServiceNode (const ServiceNode &other, ComposedNode *father)
 
void performDuplicationOfPlacement (const Node &other)
 performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute. More...
 
void performShallowDuplicationOfPlacement (const Node &other)
 performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning. More...
 
- Protected Member Functions inherited from YACS::ENGINE::ElementaryNode
 ElementaryNode (const std::string &name)
 
 ElementaryNode (const ElementaryNode &other, ComposedNode *father)
 
void initCommonPartWithoutStateManagement (bool start)
 
virtual void createMultiDatastreamPorts ()
 
void edDisconnectAllLinksWithMe ()
 
bool areAllInputPortsValid () const
 
template<class PORT >
PORT * getPort (const std::string &name, const std::list< PORT * > &setOfPorts) const throw (Exception)
 
template<class PORT , class ENUMTYPE >
PORT * edAddPort (const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type) throw (Exception)
 
template<class PORT , class ENUMTYPE >
bool edCheckAddPort (const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type) throw (Exception)
 
- Protected Member Functions inherited from YACS::ENGINE::Node
 Node (const std::string &name)
 
 Node (const Node &other, ComposedNode *father)
 
virtual void exForwardFailed ()
 
virtual void exForwardFinished ()
 

Private Attributes

YACS::BASES::Mutex _mutex
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::Node
static std::string getStateName (YACS::StatesForNode state)
 Return the name of a state. More...
 
- Public Attributes inherited from YACS::ENGINE::Node
YACS::Colour _colour
 
- Static Protected Member Functions inherited from YACS::ENGINE::ElementaryNode
template<class PORT >
static void edRemovePortTypedFromSet (PORT *port, std::list< PORT * > &setOfPorts) throw (Exception)
 
template<class PORT >
static bool isPortNameAlreadyExist (const std::string &portName, const std::list< PORT * > &setOfPorts)
 
- Protected Attributes inherited from YACS::ENGINE::ServiceNode
ComponentInstance_component
 
std::string _method
 
std::string _ref
 
- Static Protected Attributes inherited from YACS::ENGINE::Node
static const char SEP_CHAR_IN_PORT [] ="."
 
static int _total = 0
 

Detailed Description

Class for Salome component Service Node.

See Also
InputCorbaPort
OutputCorbaPort

Definition at line 67 of file CORBANode.hxx.

Constructor & Destructor Documentation

SalomeNode::SalomeNode ( const SalomeNode other,
ComposedNode father 
)

Definition at line 286 of file CORBANode.cxx.

References YACS::ENGINE::Node::_implementation, and YACS::ENGINE::CORBANode::IMPL_NAME.

Referenced by createNode(), and simpleClone().

286  :ServiceNode(other,father)
287 {
289 }
SalomeNode::SalomeNode ( const std::string &  name)

SalomeNode constructor.

Definition at line 281 of file CORBANode.cxx.

References YACS::ENGINE::Node::_implementation, and YACS::ENGINE::CORBANode::IMPL_NAME.

281  :ServiceNode(name)
282 {
284 }
SalomeNode::~SalomeNode ( )
virtual

Definition at line 291 of file CORBANode.cxx.

292 {
293 }

Member Function Documentation

ServiceNode * SalomeNode::createNode ( const std::string &  name)
virtual

Create a SalomeNode with the same component object and no input or output port.

Parameters
name: node name
Returns
a new SalomeNode node

Implements YACS::ENGINE::ServiceNode.

Definition at line 850 of file CORBANode.cxx.

References YACS::ENGINE::ServiceNode::_component, SalomeNode(), and YACS::ENGINE::ServiceNode::setComponent().

851 {
852  SalomeNode* node=new SalomeNode(name);
853  node->setComponent(_component);
854  return node;
855 }
void SalomeNode::execute ( )
virtual

Execute the service on the component associated to the node.

Implements YACS::ENGINE::Task.

Definition at line 524 of file CORBANode.cxx.

References YACS::ENGINE::ServiceNode::_component, YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::ServiceNode::_method, YACS::ENGINE::ServiceNode::_ref, YACS::ENGINE::ElementaryNode::_setOfInputPort, YACS::ENGINE::ElementaryNode::_setOfOutputPort, YACS::ENGINE::Runtime::_tc_file, DEBTRACE, CORBAEngineTest::dico, YACS::ENGINE::Double, YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::InputCorbaPort::getAny(), YACS::ENGINE::OutputCorbaPort::getAnyOut(), YACS::ENGINE::ElementaryNode::getErrorDetails(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Node::getProperties(), CORBAEngineTest::i, YACS::ENGINE::Int, YACS::ENGINE::TypeCode::isA(), YACS::ENGINE::TypeCode::kind(), YACS::ENGINE::Objref, p, YACS::ENGINE::OutputCorbaPort::put(), YACS::ENGINE::String, and YACSTRACE.

525 {
526  YACSTRACE(1,"+++++++++++++++++ SalomeNode::execute: " << getName() << " " << _method << " +++++++++++++++++" );
527  {
528  CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
529  Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
530 
531  // Set component properties
532  std::map<std::string,std::string> amap=getProperties();
533  if(amap.size() > 0)
534  {
535  Engines::FieldsDict_var dico = new Engines::FieldsDict;
536  dico->length(amap.size());
537  std::map<std::string,std::string>::const_iterator it;
538  int i=0;
539  for(it = amap.begin(); it != amap.end(); ++it)
540  {
541  dico[i].key=CORBA::string_dup(it->first.c_str());
542  dico[i].value <<=it->second.c_str();
543  i++;
544  }
545  compo->setProperties(dico);
546  }
547 
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
553  //
554  CORBA::Request_var req ;
555  try
556  {
557  req = objComponent->_request(_method.c_str());
558  }
559  catch(CORBA::SystemException& ex)
560  {
561  std::string msg="component '" +_ref+ "' has no service '" + _method+ "'";
562  _errorDetails=msg;
563  throw Exception(msg);
564  }
565  CORBA::NVList_ptr arguments = req->arguments() ;
566 
567  DEBTRACE( "+++++++++++++++++SalomeNode::inputs+++++++++++++++++" );
568  int in_param=0;
569  //in parameters
570  list<InputPort *>::iterator iter2;
571  for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
572  {
573  InputCorbaPort *p=(InputCorbaPort *)*iter2;
574  if(p->edGetType()->isA(Runtime::_tc_file))
575  continue;
576  DEBTRACE( "port name: " << p->getName() );
577  DEBTRACE( "port kind: " << p->edGetType()->kind() );
578  CORBA::Any* ob=p->getAny();
579 #ifdef _DEVDEBUG_
580  CORBA::TypeCode_var tc=ob->type();
581  switch(p->edGetType()->kind())
582  {
583  case Double:
584  CORBA::Double d;
585  *ob >>= d;
586  DEBTRACE( d )
587  break;
588  case Int:
589  CORBA::Long l;
590  *ob >>= l;
591  DEBTRACE( l )
592  break;
593  case String:
594  const char *s;
595  *ob >>= s;
596  DEBTRACE( s )
597  break;
598  case Objref:
599  DEBTRACE( tc->id() )
600  break;
601  default:
602  break;
603  }
604 #endif
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 ) ;
607  in_param=in_param+1;
608  }
609  //in files
610  int nfiles=0;
611  DEBTRACE("checkInputFilesToService: " << _method);
612  try
613  {
614  for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
615  {
616  InputCorbaPort *p=(InputCorbaPort *)*iter2;
617  if(!p->edGetType()->isA(Runtime::_tc_file))
618  continue;
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)
623  {
624  filename[debut]='.';
625  debut=filename.find_first_of(':',debut);
626  }
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();
632  *any >>= osf;
633  isf->connect(osf);
634  nfiles++;
635  }
636  if(nfiles)
637  compo->checkInputFilesToService(_method.c_str());
638  }
639  catch( const SALOME::SALOME_Exception& ex )
640  {
641  std::string text="Execution problem in checkInputFilesToService: ";
642  text += (const char*)ex.details.text;
643  _errorDetails=text;
644  throw Exception(text);
645  }
646  catch(CORBA::SystemException& ex)
647  {
648  std::string msg="Execution problem: component probably does not support files ??";
649  _errorDetails=msg;
650  throw Exception(msg);
651  }
652 
653  //out parameters
654  DEBTRACE( "+++++++++++++++++SalomeNode::outputs+++++++++++++++++" )
655  list<OutputPort *>::iterator iter;
656  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
657  {
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))
662  continue;
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 );
666  delete ob;
667  }
668 
669  //return value
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);
674  //user exceptions
675  req->exceptions()->add(SALOME::_tc_SALOME_Exception);
676 
677  DEBTRACE( "+++++++++++++++++SalomeNode::calculation+++++++++++++++++" << _method )
678  req->invoke();
679  CORBA::Exception *exc =req->env()->exception();
680  if( exc )
681  {
682  DEBTRACE( "An exception was thrown!" )
683  DEBTRACE( "The raised exception is of Type:" << exc->_name() )
684 
685  CORBA::SystemException* sysexc;
686  sysexc=CORBA::SystemException::_downcast(exc);
687  if(sysexc != NULL)
688  {
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")
695  {
696  text=text+"component '" +_ref+ "' has no service '" + _method+ "'";
697  }
698  else if(excname == "BAD_PARAM")
699  {
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();
702  }
703  else if(excname == "MARSHAL" && sysexc->minor() == omni::MARSHAL_PassEndOfMessage)
704  {
705  text=text+"probably an error in arguments of service '" + _method + "' from component '" +_ref+ "'";
706  }
707  else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalResults)
708  {
709  text=text+"probably an error in output arguments of service '" + _method + "' from component '" +_ref+ "'";
710  }
711  else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalArguments)
712  {
713  text=text+"probably an error in input arguments of service '" + _method + "' from component '" +_ref+ "'";
714  }
715  else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_WaitingForReply)
716  {
717  text=text+"probably an error in input arguments of service '" + _method + "' from component '" +_ref+ "'";
718  }
719  else
720  {
721  DEBTRACE(sysexc->NP_minorString() );
722  text=text+"System Exception "+ excname;
723  }
724  _errorDetails=text;
725  throw Exception(text);
726  }
727 
728  // Not a System Exception
729  CORBA::UnknownUserException* userexc;
730  userexc=CORBA::UnknownUserException::_downcast(exc);
731  if(userexc != NULL)
732  {
733  CORBA::Any anyExcept = userexc->exception();
734 
735  const SALOME::SALOME_Exception* salexc;
736  if(anyExcept >>= salexc)
737  {
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() );
742  }
743  std::string msg="Execution problem: User Exception occurred";
744  _errorDetails=msg;
745  throw Exception(msg);
746  }
747  std::string msg="Execution problem";
748  _errorDetails=msg;
749  throw Exception(msg);
750  }
751 
752  DEBTRACE( "++++++++++++SalomeNode::outputs++++++++++++" )
753  int out_param=in_param;
754  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
755  {
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))
761  continue;
762  CORBA::Any *ob=arguments->item(out_param)->value();
763 #ifdef _DEVDEBUG_
764  switch(p->edGetType()->kind())
765  {
766  case Double:
767  CORBA::Double d;
768  *ob >>= d;
769  DEBTRACE( d )
770  break;
771  case Int:
772  CORBA::Long l;
773  *ob >>= l;
774  DEBTRACE( l )
775  break;
776  case String:
777  const char *s;
778  *ob >>= s;
779  DEBTRACE( s )
780  break;
781  default:
782  break;
783  }
784 #endif
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.
788  p->put(ob);
789  out_param=out_param+1;
790  }
791 
792  //Out files
793  nfiles=0;
794  DEBTRACE("checkOutputFilesToService: " << _method);
795  try
796  {
797  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
798  {
799  OutputCorbaPort *p=(OutputCorbaPort *)*iter;
800  if(!p->edGetType()->isA(Runtime::_tc_file))
801  continue;
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)
807  {
808  filename[debut]='.';
809  debut=filename.find_first_of(':',debut);
810  }
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());
814  CORBA::Any any;
815  any <<= osf;
816  p->put(&any);
817  }
818  if(nfiles)
819  compo->checkOutputFilesToService(_method.c_str());
820  }
821  catch( const SALOME::SALOME_Exception& ex )
822  {
823  std::string text=(const char*)ex.details.text;
824  _errorDetails=text;
825  throw Exception("Execution problem in checkOutputFilesToService: " + text);
826  }
827  catch(CORBA::SystemException& ex)
828  {
829  std::string msg="Execution problem: component probably does not support files ?";
830  _errorDetails=msg;
831  throw Exception(msg);
832  }
833  }
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() << " +++++++++++++++++" )
838 }
std::string SalomeNode::getContainerLog ( )
virtual

returns a string that contains the name of the container log file if it exists

Do nothing here. To subclass

Reimplemented from YACS::ENGINE::Node.

Definition at line 857 of file CORBANode.cxx.

References YACS::ENGINE::ServiceNode::_component, DEBTRACE, gui.logview::log, and p.

858 {
859  std::string msg="Component is not loaded";
860  try
861  {
862  CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
863  Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
864  if( !CORBA::is_nil(compo) )
865  {
866  Engines::Container_var cont= compo->GetContainerRef();
867  CORBA::String_var logname = cont->logfilename();
868  DEBTRACE(logname);
869  msg=logname;
870  std::string::size_type pos = msg.find(":");
871  msg=msg.substr(pos+1);
872  }
873  }
874  catch(CORBA::COMM_FAILURE& ex)
875  {
876  msg = ":Component no longer reachable: Caught system exception COMM_FAILURE";
877  msg += " -- unable to contact the object.";
878  }
879  catch(CORBA::SystemException& ex)
880  {
881  msg = ":Component no longer reachable: Caught a CORBA::SystemException.\n";
882  CORBA::Any tmp;
883  tmp <<= ex;
884  CORBA::TypeCode_var tc = tmp.type();
885  const char *p = tc->name();
886  if ( *p != '\0' )
887  msg += p;
888  else
889  msg += tc->id();
890  }
891  catch(CORBA::Exception& ex)
892  {
893  msg = ":Component no longer reachable: Caught CORBA::Exception.\n";
894  CORBA::Any tmp;
895  tmp <<= ex;
896  CORBA::TypeCode_var tc = tmp.type();
897  const char *p = tc->name();
898  if ( *p != '\0' )
899  msg += p;
900  else
901  msg += tc->id();
902  }
903  catch(omniORB::fatalException& fe)
904  {
905  msg = ":Component no longer reachable: Caught omniORB::fatalException.\n";
906  stringstream log;
907  log << " file: " << fe.file() << endl;
908  log << " line: " << fe.line() << endl;
909  log << " mesg: " << fe.errmsg() << endl;
910  msg += log.str();
911  }
912  catch(...)
913  {
914  msg = ":Component no longer reachable: Caught unknown exception.";
915  }
916  return msg;
917 }
std::string SalomeNode::getKind ( ) const
virtual

Return the service node kind.

A runtime can provide several implementations of a service node. Each implementation has a different kind. A ComponentInstance can be associated to a ServiceNode with the same kind.

Reimplemented from YACS::ENGINE::ServiceNode.

Definition at line 275 of file CORBANode.cxx.

References KIND.

276 {
277  return KIND;
278 }
void SalomeNode::shutdown ( int  level)
virtual

Stop all pending activities of the node.

This method should be called when a Proc is finished and must be deleted from the YACS server

Reimplemented from YACS::ENGINE::Node.

Definition at line 919 of file CORBANode.cxx.

References YACS::ENGINE::ServiceNode::_component, DEBTRACE, and YACS::ENGINE::ComponentInstance::shutdown().

920 {
921  DEBTRACE("SalomeNode::shutdown " << level);
922  if(_component)
923  _component->shutdown(level);
924 }
Node * SalomeNode::simpleClone ( ComposedNode father,
bool  editionOnly 
) const
protectedvirtual

Implements YACS::ENGINE::Node.

Definition at line 840 of file CORBANode.cxx.

References SalomeNode().

841 {
842  return new SalomeNode(*this,father);
843 }
virtual std::string YACS::ENGINE::SalomeNode::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::ServiceNode.

Definition at line 79 of file CORBANode.hxx.

79 {return "YACS__ENGINE__SalomeNode";}

Member Data Documentation

YACS::BASES::Mutex YACS::ENGINE::SalomeNode::_mutex
private

Definition at line 93 of file CORBANode.hxx.

const char SalomeNode::KIND ="Salome"
static

Definition at line 78 of file CORBANode.hxx.

Referenced by getKind().


The documentation for this class was generated from the following files: