Salome HOME
Fix a long-standing problem with passing wrong values to the --standalone or --embedd...
[modules/kernel.git] / src / DSC / DSC_Basic / SALOME_ConnectionManagerServer.cxx
1 //  Copyright (C) 2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
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. 
8 // 
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. 
13 // 
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 
17 // 
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //
21 //
22 //  File   : SALOME_ConnectionManagerServer.cxx
23 //  Author : AndrĂ© RIBES (EDF)
24 //  Module : KERNEL
25
26 #include "ConnectionManager_i.hxx"
27 #include "utilities.h"
28 #include <iostream>
29
30 using namespace std;
31
32 int main(int argc, char* argv[])
33 {
34   PortableServer::POA_var root_poa;
35   PortableServer::POAManager_var pman;
36   CORBA::Object_var obj;
37   CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
38   try{
39     obj = orb->resolve_initial_references("RootPOA");
40     if(!CORBA::is_nil(obj))
41       root_poa = PortableServer::POA::_narrow(obj);
42     if(!CORBA::is_nil(root_poa))
43       pman = root_poa->the_POAManager();
44
45     // We create a ConnectionManager.
46     // It is automatically added to the RootPOA into its constructor.
47     new ConnectionManager_i(orb);
48
49     pman->activate();
50     orb->run();
51   }catch(CORBA::SystemException&){
52     MESSAGE("Caught CORBA::SystemException.");
53   }catch(PortableServer::POA::WrongPolicy&){
54     MESSAGE("Caught CORBA::WrongPolicyException.");
55   }catch(PortableServer::POA::ServantAlreadyActive&){
56     MESSAGE("Caught CORBA::ServantAlreadyActiveException");
57   }catch(CORBA::Exception&){
58     MESSAGE("Caught CORBA::Exception.");
59   }catch(std::exception& exc){
60     MESSAGE("Caught std::exception - "<<exc.what()); 
61   }catch(...){
62     MESSAGE("Caught unknown exception.");
63   }
64   END_OF(argv[0]);
65 }
66