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