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"
25 #include <libxml/parser.h>
32 if(getenv ("DEBUGGER"))
34 std::stringstream exec;
35 exec << "$DEBUGGER SALOME_LauncherServer " << getpid() << "&";
36 MESSAGE ( exec.str() );
37 system(exec.str().c_str());
43 void terminateHandler(void)
45 MESSAGE ( "Terminate: not managed exception !" );
49 void unexpectedHandler(void)
51 MESSAGE ( "Unexpected: unexpected exception !" );
56 int main(int argc, char* argv[])
58 if(getenv ("DEBUGGER"))
60 // setsig(SIGSEGV,&Handler);
61 set_terminate(&terminateHandler);
62 set_unexpected(&unexpectedHandler);
65 * To avoid memory leak, need to call xmlInitParser in the main thread
66 * and not call xmlCleanupParser later (cause implicit reinitialization in thread)
70 PortableServer::POA_var root_poa;
71 PortableServer::POAManager_var pman;
72 CORBA::Object_var obj;
74 CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
75 // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
79 obj = orb->resolve_initial_references("RootPOA");
80 if(!CORBA::is_nil(obj))
81 root_poa = PortableServer::POA::_narrow(obj);
82 if(!CORBA::is_nil(root_poa))
83 pman = root_poa->the_POAManager();
85 catch(CORBA::COMM_FAILURE&){
86 MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
89 SALOME_Launcher *lServ=new SALOME_Launcher(orb,root_poa);
94 }catch(CORBA::SystemException&){
95 MESSAGE("Caught CORBA::SystemException.");
96 }catch(PortableServer::POA::WrongPolicy&){
97 MESSAGE("Caught CORBA::WrongPolicyException.");
98 }catch(PortableServer::POA::ServantAlreadyActive&){
99 MESSAGE("Caught CORBA::ServantAlreadyActiveException");
100 }catch(CORBA::Exception&){
101 MESSAGE("Caught CORBA::Exception.");
102 }catch(std::exception& exc){
103 MESSAGE("Caught std::exception - "<<exc.what());
105 MESSAGE("Caught unknown exception.");
108 // delete myThreadTrace;