1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "SALOME_Launcher.hxx"
21 #include "utilities.h"
29 if(getenv ("DEBUGGER"))
31 std::stringstream exec;
32 exec << "$DEBUGGER SALOME_LauncherServer " << getpid() << "&";
33 std::cerr << exec.str() << std::endl;
34 system(exec.str().c_str());
39 void terminateHandler(void)
41 std::cerr << "Terminate: not managed exception !" << std::endl;
45 void unexpectedHandler(void)
47 std::cerr << "Unexpected: unexpected exception !" << std::endl;
52 int main(int argc, char* argv[])
54 if(getenv ("DEBUGGER"))
56 // setsig(SIGSEGV,&Handler);
57 set_terminate(&terminateHandler);
58 set_unexpected(&unexpectedHandler);
60 PortableServer::POA_var root_poa;
61 PortableServer::POAManager_var pman;
62 CORBA::Object_var obj;
64 CORBA::ORB_ptr orb = CORBA::ORB_init( argc , argv ) ;
65 // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
69 obj = orb->resolve_initial_references("RootPOA");
70 if(!CORBA::is_nil(obj))
71 root_poa = PortableServer::POA::_narrow(obj);
72 if(!CORBA::is_nil(root_poa))
73 pman = root_poa->the_POAManager();
75 catch(CORBA::COMM_FAILURE&){
76 MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
79 SALOME_Launcher *lServ=new SALOME_Launcher(orb,root_poa);
82 }catch(CORBA::SystemException&){
83 MESSAGE("Caught CORBA::SystemException.");
84 }catch(PortableServer::POA::WrongPolicy&){
85 MESSAGE("Caught CORBA::WrongPolicyException.");
86 }catch(PortableServer::POA::ServantAlreadyActive&){
87 MESSAGE("Caught CORBA::ServantAlreadyActiveException");
88 }catch(CORBA::Exception&){
89 MESSAGE("Caught CORBA::Exception.");
90 }catch(std::exception& exc){
91 MESSAGE("Caught std::exception - "<<exc.what());
93 MESSAGE("Caught unknown exception.");
96 // delete myThreadTrace;