X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fhtml%2FINPUT%2Fsources%2Fstatic%2Fexamples_Life_cycle.html;fp=doc%2Fhtml%2FINPUT%2Fsources%2Fstatic%2Fexamples_Life_cycle.html;h=8d36282f6f12ea6d34edee37eb6cf6bb2fd35984;hb=b9114b43aa01d06f55dcf3f0a62df984e0cfc556;hp=0000000000000000000000000000000000000000;hpb=bb45d9b1d38134dde4b343d12b26c78dffa10c9d;p=modules%2Fkernel.git
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
index 000000000..8d36282f6
--- /dev/null
+++ b/doc/html/INPUT/sources/static/examples_Life_cycle.html
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+ Main Page
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+ //There is a CXX example of LifeCycleCORBA using
+
+#include CORBA_CLIENT_HEADER(TestComponent)
+#include "SALOME_NamingService.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+
+int main (int argc, char * argv[]){
+ try {
+ // Initializing omniORB
+ CORBA::ORB_var orb = CORBA::ORB_init(argc,
+argv);
+
+ // Obtain a reference
+to the root POA
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA")
+;
+ PortableServer::POA_var poa = PortableServer::POA::_narrow(obj)
+;
+
+ SALOME_NamingService _NS(orb) ;
+
+ SALOME_LifeCycleCORBA _LCC(&_NS) ;
+
+ Engines::Component_var myComponent = _LCC.FindOrLoad_Component("FactoryServerPy","TestComponentPy");
+ if(!CORBA::is_nil(myComponent)){
+ Engines::TestComponent_var
+myConcreateComponent = TestComponent::_narrow(myComponent);
+ //do something
+what you like with the interface
+ ...
+ return 0;
+ }
+ }
+ catch(CORBA::COMM_FAILURE& ex){
+ cout<<"Caught system exception COMM_FAILURE
+-- unable to contact the object.\n";
+ }catch(CORBA::SystemException&){
+ cout<<"Caught a CORBA::SystemException.\n";
+ }catch(CORBA::Exception&){
+ cout<<"Caught CORBA::Exception.\n";
+ }catch(...){
+ cout<<"Caught unknown exception.\n";
+ }
+ return 1;
+}
+
+#The example may be rewritten on Python like this:
+
+from omniORB import CORBA
+from SALOME_TestComponent import *
+from SALOME_NamingServicePy import *
+from LifeCycleCORBA import *
+
+try:
+ orb = CORBA.ORB_init(sys.argv,CORBA.ORB_ID)
+ _NS = SALOME_NamingService(orb)
+ _LCC = SALOME_LifeCycleCORBA(orb)
+
+ myComponent = _LCC.FindOrLoadComponent("FactoryServerPy","TestComponentPy");
+ myConcreatComponent = myComponent._narrow(TestComponent)
+ if myConcreatComponent is not None :
+ //do something what you like with the
+interface
+ ...
+ return 0
+ }
+except CosNaming.NamingContext.NotFound, e :
+ print "Caught exception: Naming Service can't found Logger"
+except CORBA.COMM_FAILURE, e:
+ print "Caught CORBA::SystemException CommFailure"
+except CORBA.SystemException, e:
+ print "Caught CORBA::SystemException."
+except CORBA.Exception, e:
+ print "Caught CORBA::Exception."
+except Exception, e:
+ print "Caught unknown exception."
+
+
+
+
+