1 // Copyright (C) 2003 CEA/DEN, EDF R&D
5 // File : SALOME_Session_loader.cxx
6 // Author : Paul RASCLE, EDF
11 /*! \file SALOME_Session_loader.cxx
14 #include <SALOMEconfig.h>
15 #include CORBA_CLIENT_HEADER(SALOME_Session)
16 #include CORBA_CLIENT_HEADER(Logger)
18 #include "Utils_ORB_INIT.hxx"
19 #include "Utils_SINGLETON.hxx"
20 #include "SALOME_NamingService.hxx"
21 #include "utilities.h"
23 //! CORBA client for SALOME Session server : launch GUI
25 * SALOME_Session Loader launches a SALOME GUI on the SALOME session servant process
28 #include <qapplication.h>
29 #include "InquireServersQThread.h"
31 void MessageOutput( QtMsgType type, const char *msg )
35 MESSAGE( "Debug: " << msg );
38 MESSAGE( "Warning: " << msg );
41 MESSAGE( "Fatal: " << msg );
46 int main(int argc, char **argv)
48 qInstallMsgHandler( MessageOutput );
49 //VRV: T2.4 - Trace management improvement
50 QApplication myQApp(argc, argv) ;
51 InquireServersGUI myIS;
52 myQApp.setMainWidget(&myIS);
53 ASSERT(QObject::connect(&myQApp, SIGNAL(lastWindowClosed()), &myQApp, SLOT(quit()) ) );
57 if (myIS.getExitStatus())
59 //VRV: T2.4 - Trace management improvement
63 CORBA::ORB_ptr orb = CORBA::ORB_init(argc,argv) ;
65 SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
66 ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
69 CORBA::Object_var obj = NS.Resolve("/Kernel/Session");
71 SALOME::Session_var session = SALOME::Session::_narrow(obj) ;
72 ASSERT(! CORBA::is_nil(session));
73 MESSAGE("SALOME::Session::_narrow(obj)");
74 INFOS("Corba initialisation, Distant server");
76 // -------------------------------------------------------------
78 session->GetInterface() ;
80 // -------------------------------------------------------------
84 catch (ServiceUnreachable&)
86 INFOS("Caught exception: Naming Service Unreachable");
88 catch (CORBA::COMM_FAILURE&)
90 INFOS("Caught CORBA::SystemException CommFailure.");
92 catch (CORBA::SystemException&)
94 INFOS("Caught CORBA::SystemException.");
96 catch (CORBA::Exception&)
98 INFOS("Caught CORBA::Exception.");
102 INFOS("Caught unknown exception.");