Salome HOME
NRI : Check if a component-username is already associated with a component-name.
[modules/kernel.git] / src / DataTypeCatalog / SALOME_DataTypeCatalog_Server.cxx
1 using namespace std;
2 // File: SALOME_DataTypeCatalog_Server.cxx
3 // Created: Mon Aug 08 2001
4 // Author: Estelle Deville
5 // Project: SALOME
6 // Copyright : CEA/DEN/DMSS/LGLS
7 // $Header$
8 #include <iostream.h>
9 #include "SALOME_NamingService.hxx"
10 #include "SALOME_DataTypeCatalog_impl.hxx"
11 #include "utilities.h"
12
13 int main(int argc,char **argv)
14 {
15   try {
16   CosNaming::NamingContext_var _rootContext, catalogContext;
17
18   // initialize the ORB
19
20   CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
21
22   // initialize POA
23
24   CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA");
25
26   PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj);
27   PortableServer::POAManager_var mgr = poa->the_POAManager(); 
28
29   // Active catalog
30
31   SALOME_DataTypeCatalogImpl* Catalogue_i = new SALOME_DataTypeCatalogImpl(argc, argv);
32   poa->activate_object (Catalogue_i);
33
34   mgr->activate();
35
36   
37   CORBA::Object_ptr myCata = Catalogue_i->_this();
38
39   // initialise Naming Service
40   SALOME_NamingService *_NS;
41   _NS = new SALOME_NamingService(orb);
42   // register Catalog in Naming Service
43   _NS->Register(myCata ,"/Kernel/DataTypeCatalog");
44
45   MESSAGE("Running DataType Catalog Server.")
46
47   orb->run();
48  
49   poa->destroy(1,1);
50  
51   }
52     catch(CORBA::SystemException&) {
53     INFOS("Caught CORBA::SystemException.")
54   }
55     catch(CORBA::Exception&) {
56     INFOS("Caught CORBA::Exception.")
57   }
58
59   return 0;
60 }