2 //=============================================================================
3 // File : SALOME_Session_Server.cxx
4 // Created : mar jun 19 13:26:24 CEST 2001
5 // Author : Paul RASCLE, EDF
7 // Copyright : EDF 2001
9 //=============================================================================
11 /*! \file SALOME_Session_Server.cxx
15 # include "Utils_ORB_INIT.hxx"
16 # include "Utils_SINGLETON.hxx"
21 // #include <qapplication.h>
22 // #include "Qtappl_example.hxx"
24 #include <SALOMEconfig.h>
25 #include CORBA_SERVER_HEADER(SALOME_Session)
27 #include "utilities.h"
29 #include "SALOME_Session_i.hxx"
31 //! CORBA server for SALOME Session
33 * SALOME_Session Server launches a SALOME session servant.
34 * The servant registers to the Naming Service.
35 * See SALOME_Session.idl for interface specification.
37 * Main services offered by the servant are:
39 * - stop Session (must be idle)
43 int main(int argc, char **argv)
48 ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
49 ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
50 CORBA::ORB_var &orb = init( argc , argv ) ;
52 CORBA::Object_var obj =orb->resolve_initial_references("RootPOA") ;
53 //MESSAGE("orb->resolve_initial_references('Root_POA')")
54 PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) ;
55 //MESSAGE("POA::_narrow(obj)")
59 SALOME_Session_i * mySALOME_Session = new SALOME_Session_i(argc, argv, orb, poa) ;
60 PortableServer::ObjectId_var mySALOME_Sessionid = poa->activate_object(mySALOME_Session) ;
61 MESSAGE("poa->activate_object(mySALOME_Session)")
63 obj = mySALOME_Session->_this() ;
64 CORBA::String_var sior(orb->object_to_string(obj)) ;
65 // MESSAGE("sior(orb->object-to-string(obj))")
66 // cerr << "'" << (char*) sior << "'" << endl ;
68 mySALOME_Session->NSregister();
70 mySALOME_Session->_remove_ref() ;
71 //MESSAGE("mySALOME_Session->_remove_ref()")
73 PortableServer::POAManager_var pman = poa->the_POAManager() ;
75 MESSAGE("pman->activate()")
80 catch (CORBA::SystemException&)
82 INFOS("Caught CORBA::SystemException.")
84 catch (CORBA::Exception&)
86 INFOS("Caught CORBA::Exception.")
90 INFOS("Caught unknown exception.")