Salome HOME
PR: container lifecycle, new design, first part
[modules/kernel.git] / src / Container / SALOME_ContainerManagerServer.cxx
1 #include "SALOME_ContainerManager.hxx"
2 #include "utilities.h"
3
4 int main(int argc, char* argv[])
5 {
6   PortableServer::POA_var root_poa;
7   PortableServer::POAManager_var pman;
8   CORBA::Object_var obj;
9
10   CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
11   try{ 
12         obj = orb->resolve_initial_references("RootPOA");
13         if(!CORBA::is_nil(obj))
14           root_poa = PortableServer::POA::_narrow(obj);
15         if(!CORBA::is_nil(root_poa))
16           pman = root_poa->the_POAManager();
17       }
18   catch(CORBA::COMM_FAILURE&){
19     MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
20   }
21   try{
22     SALOME_ContainerManager *cmServ=new SALOME_ContainerManager(orb);
23     pman->activate();
24     orb->run();
25   }catch(CORBA::SystemException&){
26     MESSAGE("Caught CORBA::SystemException.");
27   }catch(PortableServer::POA::WrongPolicy&){
28     MESSAGE("Caught CORBA::WrongPolicyException.");
29   }catch(PortableServer::POA::ServantAlreadyActive&){
30     MESSAGE("Caught CORBA::ServantAlreadyActiveException");
31   }catch(CORBA::Exception&){
32     MESSAGE("Caught CORBA::Exception.");
33   }catch(std::exception& exc){
34     MESSAGE("Caught std::exception - "<<exc.what()); 
35   }catch(...){
36     MESSAGE("Caught unknown exception.");
37   }
38 }
39