Salome HOME
PR : merge branch V1_2c dans branche principale pour V1_3_0_b1
[modules/kernel.git] / doc / html / INPUT / sources / static / examples_Life_cycle.html
diff --git a/doc/html/INPUT/sources/static/examples_Life_cycle.html b/doc/html/INPUT/sources/static/examples_Life_cycle.html
new file mode 100755 (executable)
index 0000000..8d36282
--- /dev/null
@@ -0,0 +1,116 @@
+<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">\r
+<html>\r
+<head>\r
+    \r
+  <meta http-equiv="Content-Type"\r
+ content="text/html; charset=iso-8859-1">\r
+    \r
+  <meta name="GENERATOR"\r
+ content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">\r
+  <title>Main Page</title>\r
+     \r
+  <link href="doxygen.css" rel="stylesheet" type="text/css">\r
+</head>\r
+  <body>\r
+ &nbsp; \r
+<center>\r
+<table width="96%">\r
+ <tbody>\r
+    <tr>\r
+ <td><a href="http://www.opencascade.com"><img\r
+ src="sources/logocorp.gif" border="0" height="46" width="122">\r
+      </a></td>\r
+   <td> \r
+      <div align="right"><a href="http://www.opencascade.org/SALOME/"><img\r
+ src="sources/application.gif" border="0" height="46" width="108">\r
+      </a></div>\r
+ </td>\r
+ </tr>\r
\r
+  </tbody>\r
+</table>\r
+</center>\r
+   \r
+<h1><a name="page2">Examples</a> </h1>\r
+   <font color="#3333ff">//There is a CXX example of LifeCycleCORBA using<br>\r
+</font><br>\r
+#include CORBA_CLIENT_HEADER(TestComponent)<br>\r
+#include "SALOME_NamingService.hxx"<br>\r
+#include "SALOME_LifeCycleCORBA.hxx"<br>\r
+<br>\r
+int main (int argc, char * argv[]){<br>\r
+&nbsp; try {<br>\r
+<font color="#3333ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Initializing omniORB<br>\r
+</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::ORB_var orb = CORBA::ORB_init(argc,\r
+argv);<br>\r
+&nbsp;&nbsp;&nbsp; <br>\r
+<font color="#3333ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Obtain a reference\r
+to the root POA<br>\r
+</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::Object_var obj = orb-&gt;resolve_initial_references("RootPOA")\r
+;<br>\r
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PortableServer::POA_var poa = PortableServer::POA::_narrow(obj)\r
+;<br>\r
+&nbsp;&nbsp;&nbsp; <br>\r
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SALOME_NamingService _NS(orb) ;<br>\r
+<br>\r
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SALOME_LifeCycleCORBA _LCC(&amp;_NS) ;<br>\r
+<br>\r
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Engines::Component_var myComponent = _LCC.FindOrLoad_Component("FactoryServerPy","TestComponentPy");<br>\r
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; if(!CORBA::is_nil(myComponent)){<br>\r
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Engines::TestComponent_var\r
+myConcreateComponent = TestComponent::_narrow(myComponent);<br>\r
+<font color="#3333ff">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; //do something\r
+what you like with the interface<br>\r
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br>\r
+</font>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; return 0;<br>\r
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; }<br>\r
+&nbsp;&nbsp;&nbsp; }<br>\r
+&nbsp; catch(CORBA::COMM_FAILURE&amp; ex){<br>\r
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout&lt;&lt;"Caught system exception COMM_FAILURE\r
+-- unable to contact the object.\n";<br>\r
+&nbsp; }catch(CORBA::SystemException&amp;){<br>\r
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout&lt;&lt;"Caught a CORBA::SystemException.\n";<br>\r
+&nbsp; }catch(CORBA::Exception&amp;){<br>\r
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout&lt;&lt;"Caught CORBA::Exception.\n";<br>\r
+&nbsp; }catch(...){<br>\r
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout&lt;&lt;"Caught unknown exception.\n";<br>\r
+&nbsp; }<br>\r
+&nbsp; return 1;<br>\r
+}<br>\r
+<br>\r
+<font color="#3333ff">#The example may be rewritten on Python like this:<br>\r
+</font><br>\r
+from omniORB import CORBA<br>\r
+from SALOME_TestComponent import *<br>\r
+from SALOME_NamingServicePy import *<br>\r
+from LifeCycleCORBA import *<br>\r
+<br>\r
+try:<br>\r
+&nbsp;&nbsp;&nbsp; orb = CORBA.ORB_init(sys.argv,CORBA.ORB_ID)<br>\r
+&nbsp;&nbsp;&nbsp; _NS = SALOME_NamingService(orb)<br>\r
+&nbsp;&nbsp;&nbsp; _LCC = SALOME_LifeCycleCORBA(orb)<br>\r
+<br>\r
+&nbsp;&nbsp;&nbsp;&nbsp; myComponent = _LCC.FindOrLoadComponent("FactoryServerPy","TestComponentPy");<br>\r
+&nbsp;&nbsp;&nbsp; &nbsp;myConcreatComponent = myComponent._narrow(TestComponent)<br>\r
+&nbsp;&nbsp;&nbsp; if myConcreatComponent is not None :<font\r
+ color="#3333ff"><br>\r
+&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //do something what you like with the\r
+interface<br>\r
+ &nbsp; &nbsp; &nbsp; &nbsp; ...<br>\r
+ </font>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return 0<br>\r
+&nbsp;&nbsp;&nbsp; }<br>\r
+except CosNaming.NamingContext.NotFound, e :<br>\r
+&nbsp;&nbsp;&nbsp; print "Caught exception: Naming Service can't found Logger"<br>\r
+except CORBA.COMM_FAILURE, e:<br>\r
+&nbsp;&nbsp;&nbsp; print "Caught CORBA::SystemException CommFailure"<br>\r
+except CORBA.SystemException, e:<br>\r
+&nbsp;&nbsp;&nbsp; print "Caught CORBA::SystemException."<br>\r
+except CORBA.Exception, e:<br>\r
+&nbsp;&nbsp;&nbsp; print "Caught CORBA::Exception."<br>\r
+except Exception, e:<br>\r
+&nbsp;&nbsp;&nbsp; print "Caught unknown exception."<br>\r
+&nbsp;&nbsp; <br>\r
+<br>\r
+<br>\r
+</body>\r
+</html>\r