1 // Copyright (C) 2003 CEA/DEN, EDF R&D
5 // File : SALOME_Session_loader.cxx
6 // Author : Paul RASCLE, EDF
10 /*! \file SALOME_Session_loader.cxx
13 #include <SALOMEconfig.h>
14 #include CORBA_CLIENT_HEADER(SALOME_Session)
15 #include CORBA_CLIENT_HEADER(Logger)
17 #include "Utils_ORB_INIT.hxx"
18 #include "Utils_SINGLETON.hxx"
19 #include "SALOME_NamingService.hxx"
20 #include "utilities.h"
21 #include "SALOMETraceCollector.hxx"
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"
32 void MessageOutput( QtMsgType type, const char *msg )
36 MESSAGE( "Debug: " << msg );
39 MESSAGE( "Warning: " << msg );
42 MESSAGE( "Fatal: " << msg );
47 int main(int argc, char **argv)
49 CORBA::ORB_ptr orb = CORBA::ORB_init(argc,argv) ;
50 SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
51 qInstallMsgHandler( MessageOutput );
52 //VRV: T2.4 - Trace management improvement
53 QApplication myQApp(argc, argv) ;
54 InquireServersGUI myIS;
55 myQApp.setMainWidget(&myIS);
56 ASSERT(QObject::connect(&myQApp, SIGNAL(lastWindowClosed()), &myQApp, SLOT(quit()) ) );
60 if (myIS.getExitStatus())
62 //VRV: T2.4 - Trace management improvement
66 SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
67 ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
70 CORBA::Object_var obj = NS.Resolve("/Kernel/Session");
72 SALOME::Session_var session = SALOME::Session::_narrow(obj) ;
73 ASSERT(! CORBA::is_nil(session));
74 MESSAGE("SALOME::Session::_narrow(obj)");
75 INFOS("Corba initialisation, Distant server");
77 // -------------------------------------------------------------
79 session->GetInterface() ;
81 // -------------------------------------------------------------
85 catch (ServiceUnreachable&)
87 INFOS("Caught exception: Naming Service Unreachable");
89 catch (CORBA::COMM_FAILURE&)
91 INFOS("Caught CORBA::SystemException CommFailure.");
93 catch (CORBA::SystemException&)
95 INFOS("Caught CORBA::SystemException.");
97 catch (CORBA::Exception&)
99 INFOS("Caught CORBA::Exception.");
103 INFOS("Caught unknown exception.");
107 INFOS("Normal Exit"); // without this trace, Splash remains on screen !
108 delete myThreadTrace;