Ignore:
Timestamp:
2000-04-06T23:11:40+12:00 (24 years ago)
Author:
cs025
Message:

Corba improvements; tidied client initialisation in corbaproto and also
added a number of changes to the main trunk which somehow had not made
it into the corba branch via update before its instantiation.

Also the dated use of the GSDL_GSDLHOME macro was removed, at the expense
of some particularly poor code in corbaserver where log file creation is
now nowhere near so elegant.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/corba/gsdl/src/colservr/corbaServer.mpp

    r1068 r1074  
    1010// library headers
    1111#include "fileutil.h"
    12 #include "gsdlhome.h"
     12//#include "gsdlhome.h"
    1313
    1414// greenstone headers
     
    2525void corbaresponse_resultDocInfoToCorba(ResultDocInfo_tarray docinfo, corbaResultDocInfo_array &corbainfo);
    2626
    27 void corbaresponse_termInfoToCorba(TermInfo_tarray terminfo, corbaTermInfo_array &corbainfo)
    28 {
     27void corbaresponse_termInfoToCorba(TermInfo_tarray terminfo, corbaTermInfo_array &corbainfo) {
    2928  TermInfo_tarray::iterator here = terminfo.begin();
    3029  TermInfo_tarray::iterator end  = terminfo.end();
    3130  unsigned int i;
    32 
     31   
    3332  i = 0;
    3433
    35   while (here != end)
     34  while (here != end) 
    3635    {
    3736      corbainfo.length(i+1);
     
    6867  text_tarray collections;
    6968  recptproto *protocol;
     69  text_t      gsdlhome;
    7070public:
    71   corbaServer(recptproto *protocol)
    72   {
    73     cout << GSDL_GSDLHOME << endl;
    74     if (!read_dir (GSDL_GSDLHOME "/collect", collections)) exit (1);
     71  corbaServer(recptproto *protocol, text_t home)
     72  {
     73    text_t dirname;
     74    char * cdirname;
     75    this->gsdlhome = home;
     76    cout << gsdlhome.getcstr() << endl;
     77    dirname = filename_cat(gsdlhome, "/collect");
     78    cdirname = dirname.getcstr();
     79    if (!read_dir (cdirname, collections)) exit (1);
     80    delete cdirname;
     81
    7582    cout << "Constructing set list server" << endl;
    7683    this->protocol = protocol;
    7784  }
    7885
    79   CORBA::Boolean init()
    80     {
    81       ofstream    logout(GSDL_GSDLHOME "/etc/corbaout.txt");
     86  CORBA::Boolean init()
     87  {
     88      char *cfname;
     89      text_t fname;
     90      fname = filename_cat(gsdlhome, "/etc/corbaout.txt");
     91      cfname = fname.getcstr();
     92      ofstream    logout(cfname);
     93      delete cfname;
     94
    8295      int         reply;
    8396
     
    104117    bool    _has;
    105118    comerror_t err;
    106     ofstream    logout(GSDL_GSDLHOME "/etc/corbaout.txt");
     119
     120    char *   cfname;
     121    text_t   fname;
     122    fname  = filename_cat(gsdlhome, "/etc/corbaout.txt");
     123    cfname = fname.getcstr();
     124    ofstream logout(cfname);
     125    delete   cfname;
    107126
    108127    cct = new corbaconv_text_t(corbaCollect);
     
    129148
    130149  CORBA::Boolean ping(const struct corbatext_t &corbaCollect, corbaComError &corbaError)
    131     {
    132       text_t collection;
    133       bool   success;
    134       comerror_t error;
    135       ofstream    logout(GSDL_GSDLHOME "/etc/corbaout.txt");
    136 
    137 
    138       corbaconv_text_t::setCorbatext(collection,corbaCollect);
    139       protocol->ping(collection, success, error, logout);
    140 
    141       corbaError = (corbaComError) error;
    142       logout.close();
    143 
    144       return success;
    145     }
     150  {
     151    text_t collection;
     152    bool   success;
     153    comerror_t error;
     154
     155    char *   cfname;
     156    text_t   fname;
     157    fname  = filename_cat(gsdlhome, "/etc/corbaout.txt");
     158    cfname = fname.getcstr();
     159    ofstream logout(cfname);
     160    delete   cfname;
     161
     162    corbaconv_text_t::setCorbatext(collection,corbaCollect);
     163    protocol->ping(collection, success, error, logout);
     164
     165    corbaError = (corbaComError) error;
     166    logout.close();
     167
     168    return success;
     169  }
    146170
    147171  void filter(const struct corbatext_t &corbaCollect,
     
    155179    comerror_t       error = noError;
    156180    text_t           collection;
    157     ofstream    logout(GSDL_GSDLHOME "/etc/corbaout.txt");
     181
     182    char *   cfname;
     183    text_t   fname;
     184    fname  = filename_cat(gsdlhome, "/etc/corbaout.txt");
     185    cfname = fname.getcstr();
     186    ofstream logout(cfname);
     187    delete   cfname;
    158188
    159189    // copy collection id
     
    191221    comerror_t       error;
    192222    text_t           collection;
    193     ofstream    logout(GSDL_GSDLHOME "/etc/corbaout.txt");
     223
     224    char *   cfname;
     225    text_t   fname;
     226    fname  = filename_cat(gsdlhome, "/etc/corbaout.txt");
     227    cfname = fname.getcstr();
     228    ofstream logout(cfname);
     229    delete   cfname;
    194230
    195231    corbaconv_text_t::setCorbatext(collection,corbaCollect);
     
    200236    corbaResponse.buildDate = response.buildDate;
    201237    corbatext_arrayToCorbaArray(response.languages, &corbaResponse.languages);
     238    corbatext_arrayToCorbaArray(response.ccsCols, &corbaResponse.ccsCols);
    202239    corbaResponse.numDocs  = response.numDocs;
    203240    corbaResponse.numBytes  = response.numWords;
     
    222259    InfoFilterOptionsResponse_t response;
    223260    comerror_t error;
    224     ofstream    logout(GSDL_GSDLHOME "/etc/corbaout.txt");
    225261    unsigned int i;
     262
     263    char *   cfname;
     264    text_t   fname;
     265    fname  = filename_cat(gsdlhome, "/etc/corbaout.txt");
     266    cfname = fname.getcstr();
     267    ofstream logout(cfname);
     268    delete   cfname;
    226269
    227270    corbaconv_text_t::setCorbatext(collection,corbaCollect);
     
    265308    text_t collection;   
    266309    InfoFiltersResponse_t response;
    267     ofstream    logout(GSDL_GSDLHOME "/etc/corbaout.txt");
     310
     311    char *   cfname;
     312    text_t   fname;
     313    fname  = filename_cat(gsdlhome, "/etc/corbaout.txt");
     314    cfname = fname.getcstr();
     315    ofstream logout(cfname);
     316    delete   cfname;
    268317
    269318    corbaconv_text_t::setCorbatext(collection,corbaCollect);
     
    283332    comerror_t         error = noError;
    284333    text_t             collection;
    285     ofstream           logout(GSDL_GSDLHOME "/etc/corbaout.txt");
     334
     335    char *   cfname;
     336    text_t   fname;
     337    fname  = filename_cat(gsdlhome, "/etc/corbaout.txt");
     338    cfname = fname.getcstr();
     339    ofstream logout(cfname);
     340    delete   cfname;
    286341
    287342    // set up request
     
    309364    text_tarray collist;
    310365    comerror_t  err;
    311     ofstream    logout(GSDL_GSDLHOME "/etc/corbaout.txt");
     366
     367    char *   cfname;
     368    text_t   fname;
     369    fname  = filename_cat(gsdlhome, "/etc/corbaout.txt");
     370    cfname = fname.getcstr();
     371    ofstream logout(cfname);
     372    delete   cfname;
    312373
    313374    protocol->get_collection_list(collist, err, logout);
     
    353414  cout << "Initialised ORB and BOA" << endl;
    354415
    355   corbaServer* server = new corbaServer(&protocol);
     416  corbaServer* server = new corbaServer(&protocol, gsdlhome);
    356417  CORBA::String_var ref = orb->object_to_string( server );
    357418
     
    362423  out << ref << endl;
    363424  out.close ();
     425
     426  cout << "Corba string is " << ref << endl;
    364427
    365428  // indicate readiness and run
Note: See TracChangeset for help on using the changeset viewer.