]> SALOME platform Git repositories - modules/kernel.git/blob - src/DSC/DSC_Basic/SALOME_ConnectionManagerServer.cxx
Salome HOME
Merge branch 'V9_11_BR'
[modules/kernel.git] / src / DSC / DSC_Basic / SALOME_ConnectionManagerServer.cxx
1 // Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  File   : SALOME_ConnectionManagerServer.cxx
24 //  Author : André RIBES (EDF)
25 //  Module : KERNEL
26 //
27 #include "ConnectionManager_i.hxx"
28 #include "ArgvKeeper.hxx"
29 #include "OpUtil.hxx"
30 #include "utilities.h"
31 #include <iostream>
32
33 int main(int argc, char* argv[])
34 {
35   PortableServer::POA_var root_poa;
36   PortableServer::POAManager_var pman;
37   CORBA::Object_var obj;
38   SetArgcArgv(argc, argv);
39   CORBA::ORB_var orb = KERNEL::GetRefToORB();
40
41   try{
42     obj = orb->resolve_initial_references("RootPOA");
43     if(!CORBA::is_nil(obj))
44       root_poa = PortableServer::POA::_narrow(obj);
45     if(!CORBA::is_nil(root_poa))
46       pman = root_poa->the_POAManager();
47
48     // We create a ConnectionManager.
49     // It is automatically added to the RootPOA into its constructor.
50     new ConnectionManager_i(orb);
51
52     pman->activate();
53     orb->run();
54     orb->destroy();
55   }catch(CORBA::SystemException&){
56     MESSAGE("Caught CORBA::SystemException.");
57   }catch(PortableServer::POA::WrongPolicy&){
58     MESSAGE("Caught CORBA::WrongPolicyException.");
59   }catch(PortableServer::POA::ServantAlreadyActive&){
60     MESSAGE("Caught CORBA::ServantAlreadyActiveException");
61   }catch(CORBA::Exception&){
62     MESSAGE("Caught CORBA::Exception.");
63   }catch(std::exception& exc){
64     MESSAGE("Caught std::exception - "<<exc.what()); 
65   }catch(...){
66     MESSAGE("Caught unknown exception.");
67   }
68   END_OF(argv[0]);
69 }
70