Salome HOME
This commit was generated by cvs2git to create tag 'V1_4_0b2'.
[modules/kernel.git] / src / Loader / SALOME_Session_Loader.cxx
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : SALOME_Session_loader.cxx
6 //  Author : Paul RASCLE, EDF
7 //  Module : SALOME
8 //  $Header$
9
10 using namespace std;
11 /*! \file SALOME_Session_loader.cxx
12  */
13
14 #include <SALOMEconfig.h>
15 #include CORBA_CLIENT_HEADER(SALOME_Session)
16 #include CORBA_CLIENT_HEADER(Logger)
17
18 #include "Utils_ORB_INIT.hxx"
19 #include "Utils_SINGLETON.hxx"
20 #include "SALOME_NamingService.hxx"
21 #include "utilities.h"
22
23 //! CORBA client for SALOME Session server : launch GUI
24 /*!
25  *  SALOME_Session Loader launches a SALOME GUI on the SALOME session servant process
26  */
27
28 #include <qapplication.h>
29 #include "InquireServersQThread.h"
30
31 int main(int argc, char **argv)
32 {
33 //VRV: T2.4 - Trace management improvement
34   QApplication myQApp(argc, argv) ;
35   InquireServersGUI myIS;
36   myQApp.setMainWidget(&myIS);
37   ASSERT(QObject::connect(&myQApp, SIGNAL(lastWindowClosed()), &myQApp, SLOT(quit()) ) );
38   myIS.show();
39   myQApp.exec();
40
41   if (myIS.getExitStatus())
42     exit(1);
43 //VRV: T2.4 - Trace management improvement
44   if (myIS.withGUI()) {
45     try
46       {
47         CORBA::ORB_ptr orb = CORBA::ORB_init(argc,argv) ;
48         
49         SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
50         ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
51         NS.init_orb( orb ) ;
52         
53         CORBA::Object_var obj = NS.Resolve("/Kernel/Session");
54         
55         SALOME::Session_var session = SALOME::Session::_narrow(obj) ;
56         ASSERT(! CORBA::is_nil(session));
57         MESSAGE("SALOME::Session::_narrow(obj)");
58         INFOS("Corba initialisation, Distant server");
59         
60         // -------------------------------------------------------------
61         
62         session->GetInterface() ;
63
64         // -------------------------------------------------------------
65         
66         orb->destroy() ;
67       }
68     catch (ServiceUnreachable&)
69       {
70         INFOS("Caught exception: Naming Service Unreachable");
71       }
72     catch (CORBA::COMM_FAILURE&)
73       {
74         INFOS("Caught CORBA::SystemException CommFailure.");
75       }
76     catch (CORBA::SystemException&)
77       {
78         INFOS("Caught CORBA::SystemException.");
79       }
80     catch (CORBA::Exception&)
81       {
82         INFOS("Caught CORBA::Exception.");
83       }
84     catch (...)
85       {
86         INFOS("Caught unknown exception.");
87       }
88     return 0 ;
89   }
90 }
91
92