Back to index

salome-kernel  6.5.0
SALOME_ConnectionManagerServer.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : SALOME_ConnectionManagerServer.cxx
00024 //  Author : André RIBES (EDF)
00025 //  Module : KERNEL
00026 //
00027 #include "ConnectionManager_i.hxx"
00028 #include "utilities.h"
00029 #include <iostream>
00030 
00031 int main(int argc, char* argv[])
00032 {
00033   PortableServer::POA_var root_poa;
00034   PortableServer::POAManager_var pman;
00035   CORBA::Object_var obj;
00036   CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
00037   try{
00038     obj = orb->resolve_initial_references("RootPOA");
00039     if(!CORBA::is_nil(obj))
00040       root_poa = PortableServer::POA::_narrow(obj);
00041     if(!CORBA::is_nil(root_poa))
00042       pman = root_poa->the_POAManager();
00043 
00044     // We create a ConnectionManager.
00045     // It is automatically added to the RootPOA into its constructor.
00046     new ConnectionManager_i(orb);
00047 
00048     pman->activate();
00049     orb->run();
00050     orb->destroy();
00051   }catch(CORBA::SystemException&){
00052     MESSAGE("Caught CORBA::SystemException.");
00053   }catch(PortableServer::POA::WrongPolicy&){
00054     MESSAGE("Caught CORBA::WrongPolicyException.");
00055   }catch(PortableServer::POA::ServantAlreadyActive&){
00056     MESSAGE("Caught CORBA::ServantAlreadyActiveException");
00057   }catch(CORBA::Exception&){
00058     MESSAGE("Caught CORBA::Exception.");
00059   }catch(std::exception& exc){
00060     MESSAGE("Caught std::exception - "<<exc.what()); 
00061   }catch(...){
00062     MESSAGE("Caught unknown exception.");
00063   }
00064   END_OF(argv[0]);
00065 }
00066