1 // SALOME RessourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOME_RessourcesCatalog_Client.cxx
31 #include "SALOME_NamingService.hxx"
32 #include <SALOMEconfig.h>
33 #include CORBA_SERVER_HEADER(SALOME_RessourcesCatalog)
35 #include "utilities.h"
37 int main(int argc,char **argv)
40 CosNaming::NamingContext_var _rootContext;
41 CORBA::Object_var objVar, objVarN;
46 orb = CORBA::ORB_init (argc, argv);
49 // Get CORBA reference of the catalog
50 SALOME_NamingService NS(orb);
51 CORBA::Object_var objVarN = NS.Resolve("/Kernel/RessourcesCatalog");
53 SALOME_RessourcesCatalog::RessourcesCatalog_var Catalogue = SALOME_RessourcesCatalog::RessourcesCatalog::_narrow(objVarN);
54 MESSAGE("Ressources distant catalog found");
56 //Get Computer list information
57 SALOME_RessourcesCatalog::ListOfComputer_var _list = Catalogue->GetComputerList();
58 for (unsigned int ind = 0; ind < _list->length();ind++)
60 MESSAGE("Ressources list : " << _list[ind]);
63 //Get container type list of computer eri
64 SALOME_RessourcesCatalog::ListOfContainerType_var list = Catalogue->GetContainerTypeList("eri");
65 for (unsigned int ind = 0; ind < list->length();ind++)
67 MESSAGE("Container type list of eri : " << list[ind]);
70 // Get processors information of eri
71 SALOME_RessourcesCatalog::computer_info_var computer = Catalogue->GetComputerInfo("eri");
72 MESSAGE("Ressource name : " << computer->name);
73 MESSAGE("Ressource OS : " << computer->OS);
74 MESSAGE("Ressource OS version : " << computer->OS_version);
75 for (unsigned int ind = 0; ind < computer->procs.length();ind++)
77 MESSAGE("Processor number : " << computer->procs[ind].number);
78 MESSAGE("Processor model name : " << computer->procs[ind].model_name);
79 MESSAGE("Processor cpu : " << computer->procs[ind].cpu_mhz);
80 MESSAGE("Processor cache : " << computer->procs[ind].cache_size);
84 catch(SALOME_RessourcesCatalog::NotFound &){
85 INFOS("SALOME_RessourcesCatalog::NotFound");
87 catch(CORBA::SystemException&) {
88 INFOS("Caught CORBA::SystemException.")
90 catch (CosNaming::NamingContext::CannotProceed &) {
91 INFOS("CosNaming::NamingContext::CannotProceed")
93 catch (CosNaming::NamingContext::NotFound &) {
94 INFOS("CosNaming::NamingContext::NotFound")
96 catch (CosNaming::NamingContext::InvalidName &) {
97 INFOS("CosNaming::NamingContext::InvalidName")
99 catch (CosNaming::NamingContext::AlreadyBound &) {
100 INFOS("CosNaming::NamingContext::AlreadyBound")
102 catch (CosNaming::NamingContext::NotEmpty &) {
103 INFOS("CosNaming::NamingContext::NotEmpty")
106 catch(CORBA::Exception &sysEx) {
107 INFOS("Caught CORBA::Exception.")