Changeset 1509 for branches/corba


Ignore:
Timestamp:
2000-09-07T09:49:07+12:00 (24 years ago)
Author:
davidb
Message:

Improvements to corba implementation so images within a collection
are handled better and images in the remote site but not in the local
site are cached locally.

Location:
branches/corba/gsdl/src/recpt
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/corba/gsdl/src/recpt/comtypes.cpp

    r823 r1509  
    2828/*
    2929   $Log$
     30   Revision 1.22.2.1  2000/09/06 21:48:58  davidb
     31
     32   Improvements to corba implementation so images within a collection
     33   are handled better and images in the remote site but not in the local
     34   site are cached locally.
     35
    3036   Revision 1.22  1999/12/13 02:24:33  davidb
    3137   Data fields for cross collection searching (CCS)
     
    138144  format.erase(format.begin(), format.end());
    139145  building.erase(format.begin(), format.end());
     146  httpdomain.clear();
     147  httpprefix.clear();
    140148  receptionist.clear();
    141149}
  • branches/corba/gsdl/src/recpt/comtypes.h

    r871 r1509  
    9898  text_tmap format;
    9999  text_tmap building;
     100  text_t httpdomain;
     101  text_t httpprefix;
    100102  text_t receptionist;
    101103};
  • branches/corba/gsdl/src/recpt/corbaclient.mpp

    r1074 r1509  
    6262#include "recptconfig.h"
    6363
    64 int main () {
     64int main (int argc, char* argv[]) {
    6565  receptionist recpt;
    66   corbaproto   nproto;
     66  corbaproto*  cproto_array[argc];
    6767  text_t       gsdlhome;
     68  text_t       httpdomain;
     69  text_t       httpprefix;
    6870
    69   site_cfg_read(gsdlhome);
     71  cproto_array[0] = NULL; // unused
    7072
    71 //  cout << "GRB 0" << endl;
     73  if (argc==1)
     74  {
     75    cout << "Content-type: text/html" << endl << endl;
     76    cout << "Usage: " << argv[0] << "site1.objid [site2.objid ...]" << endl;
     77    return(0);
     78  }
    7279
    73   // add the protocol to the receptionist
    74   recpt.add_protocol (&nproto);
     80  // Strictly speaking httpdomain and httpprefix are not needed.
     81  // Need to modify site_cfg_read to eliminate this dependency. // ****
     82  site_cfg_read(gsdlhome,httpdomain,httpprefix);
    7583
    76 //  cout << "GRB 1" << endl;
     84  for (int i=1; i<argc; i++)
     85    {
     86      // add the protocol to the receptionist
     87      cproto_array[i] = new corbaproto(argv[i]);
     88      recpt.add_protocol (cproto_array[i]);
     89    }
    7790
    7891  // add other converters
     
    8699  gboutconvert.setmapfile (gsdlhome, "ugbk", 0xa1f5);
    87100  recpt.add_converter ("g", &gbinconvert, &gboutconvert);
    88 
    89 //  cout << "GRB 2" << endl;
    90101
    91102  // the list of actions. Note: these actions will become invalid
     
    114125
    115126  buildaction abuildaction;
     127  abuildaction.set_receptionist (&recpt);
    116128  recpt.add_action (&abuildaction);
    117129
     
    119131  aauthenaction.set_receptionist(&recpt);
    120132  recpt.add_action (&aauthenaction);
    121 
    122 //  cout << "GRB 3" << endl;
    123133
    124134  // list of browsers
     
    144154  cgiwrapper (recpt, "");
    145155
    146   //  cout << "TEST" << endl;
     156  for (int i=1; i<argc; i++)
     157    {
     158      delete cproto_array[i];
     159    }
     160
    147161  return 0;
    148162}
    149163
     164
     165
     166
     167
  • branches/corba/gsdl/src/recpt/corbaproto.h

    r1074 r1509  
    4242  CORBA::BOA_var        boa;
    4343  CORBA::Object_var     obj;
     44  text_t gsdlhome;
     45  text_t site_name;
     46
    4447 public:
    4548  virtual ~corbaproto() {}
    46   corbaproto();
     49  corbaproto(char* site_name);
    4750
    4851  // add_collectserver should be called for each collection server
     
    5659  // this init will init each of the collection servers
    5760  bool init (ostream &logout);
     61
     62  // used to check for icons and retrieve them from the collection
     63  // site if they are missing
     64  void  cache_missing_icons(text_tmap& format_map,
     65                text_t& httpdomain,
     66                text_t& httpprefix);
     67
     68  text_t get_site_name ();
    5869
    5970  text_t get_protocol_name ();
  • branches/corba/gsdl/src/recpt/corbaproto.mpp

    r1074 r1509  
    2929#include <fstream.h>
    3030
     31#include "fileutil.h"
     32
    3133// protocol headers for CORBA
    3234#include "corbaiface.h"
     
    275277}
    276278
    277 corbaproto::corbaproto()
     279corbaproto::corbaproto(char* _site_name)
    278280{ char *dummyv[1] = {""};
    279281  int   dummyc = 0;
    280   /*  // CORBA variables
    281   static CORBA::ORB_var orb = CORBA::ORB_init( dummyc , dummyv, "mico-local-orb" );
    282   static CORBA::BOA_var boa = orb->BOA_init( dummyc , dummyv, "mico-local-boa" );
     282  // CORBA variables
     283  /* static CORBA::ORB_var orb = CORBA::ORB_init( dummyc , dummyv, "mico-local-orb" );
     284     static CORBA::BOA_var boa = orb->BOA_init( dummyc , dummyv, "mico-local-boa" ); */
     285
     286  CORBA::ORB_var orb = CORBA::ORB_init( dummyc , dummyv, "mico-local-orb" );
     287  CORBA::BOA_var boa = orb->BOA_init( dummyc , dummyv, "mico-local-boa" );
     288
     289  char objid_filename[256];
     290  sprintf(objid_filename,"/tmp/%s.objid",_site_name);
    283291
    284292  // Get ref from "naming service"
    285   ifstream in ("/tmp/account.objid");
     293  ifstream in (objid_filename);
    286294  char ref[1000];
    287295  in >> ref;
     
    289297
    290298  // startup corba
    291   static CORBA::Object_var obj = orb->string_to_object (ref);
    292 
    293   client = corbaiface::_narrow( obj );*/
    294   client = NULL;
     299  // static CORBA::Object_var obj = orb->string_to_object (ref);
     300  CORBA::Object_var obj = orb->string_to_object (ref);
     301
     302  client = corbaiface::_narrow( obj );
     303  // client = NULL; // ****
     304
     305  gsdlhome.clear();
     306  site_name = _site_name;
    295307}
    296308
    297309corbaiface_var corbaproto::getCorbaClient()
    298310{
     311  // This function was written to help corba when ORB and BOA were
     312  // not working in "persistent" mode.
     313  // Now that persistent mode is working it is not longer needed/used.
     314
    299315  char *dummyv[1] = {""};
    300316  int   dummyc = 0;
    301317  // CORBA variables
    302   static CORBA::ORB_var orb = CORBA::ORB_init( dummyc , dummyv, "mico-local-orb" );
    303   static CORBA::BOA_var boa = orb->BOA_init( dummyc , dummyv, "mico-local-boa" );
     318//  static CORBA::ORB_var orb = CORBA::ORB_init( dummyc , dummyv, "mico-local-orb" );
     319//  static CORBA::BOA_var boa = orb->BOA_init( dummyc , dummyv, "mico-local-boa" );
     320
     321  // DB // Try this out!! // ****
     322  CORBA::ORB_var orb = CORBA::ORB_init( dummyc , dummyv, "mico-local-orb" );
     323  CORBA::BOA_var boa = orb->BOA_init( dummyc , dummyv, "mico-local-boa" );
     324
     325  /*  char* site_name_chars = site_name.getcstr();
     326  char objid_filename[256];
     327  sprintf(objid_filename,"/tmp/%s.objid",site_name_chars);
     328  // delete site_name_chars; */
     329
     330  text_t objid_filename = "/tmp/" + site_name + ".objid";
    304331
    305332  // Get ref from "naming service"
    306   ifstream in ("/tmp/account.objid");
     333  ifstream in (objid_filename.getcstr());
    307334  char ref[1000];
    308335  in >> ref;
     
    310337
    311338  // startup corba
    312   static CORBA::Object_var obj = orb->string_to_object (ref);
     339  // DB // Try this out!! // ****
     340  // static CORBA::Object_var obj = orb->string_to_object (ref);
     341  CORBA::Object_var obj = orb->string_to_object (ref);
    313342
    314343  return corbaiface::_narrow( obj );
     
    327356
    328357  // get the corba client reference
    329   corbaiface_var lclient = this->getCorbaClient();
     358  // corbaiface_var lclient = this->getCorbaClient(); // ****
     359  corbaiface_var lclient = client;
    330360
    331361  // convert all the requisite structures into their CORBA form
     
    335365  // execute the corba transaction
    336366  lclient->configure(corbaKey, corbaCfgline); 
     367
     368  if (key=="gsdlhome")
     369    {
     370      // store gsdlhome in corba prototype so it can be used later to
     371      // check if icons specified in format statements exist on the
     372      // recptionist's side
     373      gsdlhome = cfgline[0];
     374    }
    337375}
    338376
     
    342380
    343381  // get the corba client reference
    344   corbaiface_var lclient = this->getCorbaClient();
    345 
    346   // execute the corba transaction
    347   return lclient->init();
     382  // corbaiface_var lclient = this->getCorbaClient(); // ****
     383  corbaiface_var lclient = client;
     384
     385  // execute the corba transaction
     386  return lclient->initialise();
     387}
     388
     389void  corbaproto::cache_missing_icons(text_tmap& format_map,
     390                      text_t& httpdomain,
     391                      text_t& httpprefix)
     392{
     393  // consider making this a member function in the object?
     394
     395  text_tmap::iterator format_here = format_map.begin();
     396  text_tmap::iterator format_end = format_map.end();
     397  while (format_here!=format_end)
     398    {
     399      text_t format_line = format_here->second;
     400
     401      // cout << "*** format line = " << format_line << endl; // ****
     402
     403      text_t::iterator fl_begin = format_line.begin();
     404      text_t::iterator fl_end = format_line.end();
     405
     406      text_t::iterator httpimg_find = findword(fl_begin,fl_end,"_httpimg_");
     407      text_t::iterator http_find = httpimg_find;
     408
     409      while (httpimg_find!=fl_end)
     410    {
     411      http_find = httpimg_find+5;
     412      httpimg_find += 9;
     413
     414      // look for white space " or >
     415      text_t::iterator filename_end = httpimg_find;
     416      while (filename_end != fl_end)
     417        {
     418          if (*filename_end == ' ') break;
     419          if (*filename_end == '\t') break;
     420          if (*filename_end == '\"') break;
     421          if (*filename_end == '>') break;
     422          filename_end++;
     423        }
     424
     425      text_t img_filename = substr(httpimg_find,filename_end);
     426
     427      text_t site_img_filename = filename_cat(gsdlhome,"images",img_filename);
     428
     429      // look to see if img filename exists in images directory
     430      if (!file_exists(site_img_filename))
     431        {
     432          text_t cache_img_dir
     433        = filename_cat(gsdlhome,"images",".cache");
     434
     435          text_t remote_img_url = "http://" + httpdomain + httpprefix
     436        + "/images" + img_filename;
     437
     438          text_t wget_cmd = "wget -q -N --directory-prefix="+cache_img_dir
     439        + " " + remote_img_url;
     440
     441          char* wget_cmd_chars = wget_cmd.getcstr();
     442
     443          system(wget_cmd_chars);
     444          delete wget_cmd_chars;
     445
     446          format_map[format_here->first]
     447        = substr(fl_begin,http_find) + "cache" + substr(http_find,fl_end);
     448
     449        }
     450
     451      httpimg_find = findword(httpimg_find,fl_end,"_httpimg_");
     452    }
     453      format_here++;
     454    }
     455}
     456
     457text_t corbaproto::get_site_name () {
     458  return site_name;
    348459}
    349460
     
    356467                     ostream &/*logout*/) {
    357468
    358   cout << "Corbaproto::Collection list" << endl;
     469  // cout << "Corbaproto::Collection list" << endl;
    359470
    360471  corbatext_tarray corba_collist;
     
    362473
    363474  // get the corba client reference
    364   corbaiface_var lclient = this->getCorbaClient();
     475  // corbaiface_var lclient = this->getCorbaClient(); // ****
     476  corbaiface_var lclient = client;
    365477
    366478  // execute the corba transaction
     
    383495
    384496  // get the corba client reference
    385   corbaiface_var lclient = this->getCorbaClient();
     497  // corbaiface_var lclient = this->getCorbaClient(); // ****
     498  corbaiface_var lclient = client;
    386499
    387500  // convert all the requisite structures into their CORBA form
     
    405518
    406519  // get the corba client reference
    407   corbaiface_var lclient = this->getCorbaClient();
     520  // corbaiface_var lclient = this->getCorbaClient(); // ****
     521  corbaiface_var lclient = client;
    408522
    409523  // convert all the requisite structures into their CORBA form
     
    417531}
    418532
     533
    419534void corbaproto::get_collectinfo (const text_t &collection,
    420535                 ColInfoResponse_t &collectinfo,
     
    427542
    428543  // get the corba client reference
    429   corbaiface_var lclient = this->getCorbaClient();
     544  // corbaiface_var lclient = this->getCorbaClient(); // ****
     545  corbaiface_var lclient = client;
    430546
    431547  // convert all the requisite structures into their CORBA form
     
    447563  corbatext_corbaMapToMap(corbaCollectInfo.format, collectinfo.format);
    448564  corbatext_corbaMapToMap(corbaCollectInfo.building, collectinfo.building);
     565  corbaconv_text_t::setCorbatext(collectinfo.httpdomain,corbaCollectInfo.httpdomain);
     566  corbaconv_text_t::setCorbatext(collectinfo.httpprefix,corbaCollectInfo.httpprefix);
    449567  corbaconv_text_t::setCorbatext(collectinfo.receptionist,corbaCollectInfo.receptionist);
     568
     569  cache_missing_icons(collectinfo.format,collectinfo.httpdomain,
     570              collectinfo.httpprefix);
    450571
    451572  err = (comerror_t) corbaError; 
     
    463584 
    464585  // get the corba client reference
    465   corbaiface_var lclient = this->getCorbaClient();
     586  // corbaiface_var lclient = this->getCorbaClient(); // ****
     587  corbaiface_var lclient = client;
    466588
    467589  // convert all the requisite structures into their CORBA form
     
    492614
    493615  // get the corba client reference
    494   corbaiface_var lclient = this->getCorbaClient();
     616  // corbaiface_var lclient = this->getCorbaClient(); // ****
     617  corbaiface_var lclient = client;
    495618
    496619  // convert all the requisite structures into their CORBA form
     
    531654
    532655  // get the corba client reference
    533   corbaiface_var lclient = this->getCorbaClient();
     656  // corbaiface_var lclient = this->getCorbaClient(); // ****
     657  corbaiface_var lclient = client;
    534658
    535659  // convert all the requisite structures into their CORBA form
     
    572696
    573697  // get the corba client reference
    574   corbaiface_var lclient = this->getCorbaClient();
     698  // corbaiface_var lclient = this->getCorbaClient(); // ****
     699  corbaiface_var lclient = client;
    575700
    576701  // convert all the requisite structures into their CORBA form
  • branches/corba/gsdl/src/recpt/documentaction.cpp

    r1067 r1509  
    2828/*
    2929   $Log$
     30   Revision 1.36.2.2  2000/09/06 21:49:00  davidb
     31
     32   Improvements to corba implementation so images within a collection
     33   are handled better and images in the remote site but not in the local
     34   site are cached locally.
     35
    3036   Revision 1.36.2.1  2000/04/04 15:02:35  cs025
    3137   Corba first commit
     
    963969          << "<html><head></head>\n"
    964970          << "<frameset rows=\"68,*\" noresize border=0>\n"
    965           << "<frame scrolling=no frameborder=0 src=\"_gwcgi_?e=_compressedoptions_&a=p&p=nav\">\n"
    966           << "<frame name=\"documenttop\" frameborder=0 src=\"_gwcgi_?e=_compressedoptions_&a=d&d="
     971          << "<frame scrolling=no frameborder=0 src=\"_gwcgi_?_optsite_e=_compressedoptions_&a=p&p=nav\">\n"
     972          << "<frame name=\"documenttop\" frameborder=0 src=\"_gwcgi_?_optsite_e=_compressedoptions_&a=d&d="
    967973          << args["d"] << "\">"
    968974          << "<noframes>\n"
  • branches/corba/gsdl/src/recpt/nullproto.cpp

    r1067 r1509  
    2828/*
    2929   $Log$
     30   Revision 1.12.2.2  2000/09/06 21:49:01  davidb
     31
     32   Improvements to corba implementation so images within a collection
     33   are handled better and images in the remote site but not in the local
     34   site are cached locally.
     35
    3036   Revision 1.12.2.1  2000/04/04 15:02:36  cs025
    3137   Corba first commit
     
    101107}
    102108
     109text_t nullproto::get_site_name () {
     110  return "";
     111}
     112
    103113text_t nullproto::get_protocol_name () {
    104114  return "nullproto";
  • branches/corba/gsdl/src/recpt/nullproto.h

    r1067 r1509  
    4444  // add_collectserver should be called for each collection server
    4545  // before any configuration is done
    46   void set_collectset(collectset *set)
    47     { this->cset = set;
    48     }
     46  void set_collectset(collectset *set) { this->cset = set; }
    4947
    5048  // this configure will configure each of the collection servers
     
    5351  // this init will init each of the collection servers
    5452  bool init (ostream &logout);
     53
     54  text_t get_site_name ();
    5555
    5656  text_t get_protocol_name ();
  • branches/corba/gsdl/src/recpt/pageaction.cpp

    r1033 r1509  
    2828/*
    2929   $Log$
     30   Revision 1.29.2.1  2000/09/06 21:49:02  davidb
     31
     32   Improvements to corba implementation so images within a collection
     33   are handled better and images in the remote site but not in the local
     34   site are cached locally.
     35
    3036   Revision 1.29  2000/03/19 21:16:46  nzdl
    3137   added german language interface
     
    204210    while (collist_here != collist_end) {
    205211     
     212      text_t protocol_name = (*rprotolist_here).p->get_protocol_name ();
     213
    206214      ColInfoResponse_t cinfo;
    207215      (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, logout);
    208      
     216
    209217      if (err == noError) {
    210218        if (cinfo.isPublic && (cinfo.buildDate > 0)) {
     
    217225          text_t collectionname = *collist_here;
    218226          text_t alt = collectionname;
     227
    219228          if (get_info ("collection", *collist_here, metadata, false,
    220229                (*rprotolist_here).p, response, logout)) {
    221230        if (!response.docInfo[0].metadata["collectionname"].values[0].empty())
    222231          alt = response.docInfo[0].metadata["collectionname"].values[0];
    223        
     232
     233        text_t iconurl;
     234        iconurl.clear();
     235
    224236        if (!response.docInfo[0].metadata["iconcollectionsmall"].values[0].empty())
    225             collectionname = "<img width=150 border=1 src=\""
    226               + response.docInfo[0].metadata["iconcollectionsmall"].values[0]
    227               + "\" alt=\"" + alt + "\">";
     237          {
     238            iconurl = response.docInfo[0].metadata["iconcollectionsmall"].values[0];
     239
     240          }
    228241        else if (!response.docInfo[0].metadata["iconcollection"].values[0].empty())
    229           collectionname = "<img width=150 border=1 src=\""
    230             + response.docInfo[0].metadata["iconcollection"].values[0]
    231             + "\" alt=\"" + alt + "\">";
    232         else collectionname = alt;
     242          {
     243            iconurl = response.docInfo[0].metadata["iconcollection"].values[0];
     244          }
     245
     246        if (!iconurl.empty())
     247          {
     248            // check to see URL is local to colserver
     249            text_t::iterator iconurl_head = iconurl.begin();
     250            text_t iconhead = substr(iconurl_head,iconurl_head+16);
     251            if (iconhead=="_httpcollection_")
     252              {
     253            // local and using _httpcollection_
     254            text_t icontail = substr(iconurl_head+16,iconurl.end());
     255            iconurl = "http://" + cinfo.httpdomain
     256              + cinfo.httpprefix + "/collect/"
     257              + *collist_here + "/" + icontail;
     258              }
     259            else if (iconurl[0]=='/')
     260              {
     261            // local but with full path
     262            iconurl = "http://" + cinfo.httpdomain + iconurl;
     263              }
     264
     265            collectionname
     266              = "<img width=150 border=1 src=\"" + iconurl + "\" alt=\"" + alt + "\">";
     267          }
     268        else
     269          {
     270            collectionname = alt;
     271          }
     272
    233273          }
    234274       
     
    246286          }
    247287         
    248           text_t link = "<a href=\"_gwcgi_?a=p&p=about&c=" + *collist_here + "\">";
     288          text_t optsite = "";
     289          text_t site_name = (*rprotolist_here).p->get_site_name ();
     290          if (!site_name.empty()) { optsite = "site="+site_name+"&"; }
     291
     292          text_t link = "<a href=\"_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here + "\">";
    249293          if (*collist_here == "chinese")
    250         link = "<a href=\"_gwcgi_?a=p&p=about&l=zh&nw=u&c=" + *collist_here + "\">";
     294        link = "<a href=\"_gwcgi_?"+optsite+"a=p&p=about&l=zh&nw=u&c=" + *collist_here + "\">";
    251295          if (*collist_here == "arabic")
    252         link = "<a href=\"_gwcgi_?a=p&p=about&w=a&c=" + *collist_here + "\">";
     296        link = "<a href=\"_gwcgi_?"+optsite+"a=p&p=about&w=a&c=" + *collist_here + "\">";
    253297
    254298          if (!cinfo.receptionist.empty())
     
    266310      collist_here ++;
    267311    }
    268     homeextra += "</tr></table></center>\n";
    269     disp.setmacro ("homeextra", "home", homeextra);
    270       }
    271     }
     312      }
     313    }
     314    homeextra += "</td>";
    272315    rprotolist_here ++;
    273316  }
     317  homeextra += "</tr></table></center>\n";
     318  disp.setmacro ("homeextra", "home", homeextra);
     319
    274320}
    275321
  • branches/corba/gsdl/src/recpt/queryaction.cpp

    r962 r1509  
    2828/*
    2929   $Log$
     30   Revision 1.36.2.1  2000/09/06 21:49:03  davidb
     31
     32   Improvements to corba implementation so images within a collection
     33   are handled better and images in the remote site but not in the local
     34   site are cached locally.
     35
    3036   Revision 1.36  2000/02/21 21:57:48  sjboddie
    3137   actions are now configured with gsdlhome
     
    648654      if (size>5&&args["hcl"]==1) { //compress the list, show the expand button
    649655       
    650       historylist += "<td><a href=\"_gwcgi_?e=_compressedoptions_&a=q&hcl=0\">_textexpand_</a></td>\n";
     656      historylist += "<td><a href=\"_gwcgi_?_optsite_e=_compressedoptions_&a=q&hcl=0\">_textexpand_</a></td>\n";
    651657      }
    652658      else if (size >5 && args["hcl"]==0) { // expand the list, show contract button
    653     historylist += "<td><a href=\"_gwcgi_?e=_compressedoptions_&a=q&hcl=1\">_textcontract_</a></td>\n";
     659    historylist += "<td><a href=\"_gwcgi_?_optsite_e=_compressedoptions_&a=q&hcl=1\">_textcontract_</a></td>\n";
    654660      }
    655661      historylist += "</table>\n";
     
    673679    historylist += "<tr> <td width=40 align=center>"+c+"</td>\n";
    674680    historylist += "<td width=340 align=left>"+query+"</td><td width=60 align=center>"+numdocs+"</td>\n";
    675     historylist += "<td width=60 align=center><a href=\"_gwcgi_?e=_compressedoptions_&";
     681    historylist += "<td width=60 align=center><a href=\"_gwcgi_?_optsite_e=_compressedoptions_&";
    676682    historylist += *here+"\"><img name=\"display\" src=\"_httpicondisplay_\" width=_widthdisplay_ ";
    677683    historylist += "height=_heightdisplay_ border=\"0\" alt=\"" + userinfo +"\"></a></td></tr>\n";
     
    714720      << "<form name=QueryForm method=get action=\"_gwcgi_\">\n"
    715721      << "<input type=hidden name=a value=\"q\">\n"
     722      << "<input type=hidden name=site value=\"_cgiargsite_\">\n"
    716723      << "<input type=hidden name=e value=\"_compressedoptions_\">\n"
    717724      << "<input type=hidden name=ccp value=\"1\">\n"
  • branches/corba/gsdl/src/recpt/receptionist.cpp

    r950 r1509  
    2828/*
    2929   $Log$
     30   Revision 1.47.2.1  2000/09/06 21:49:04  davidb
     31
     32   Improvements to corba implementation so images within a collection
     33   are handled better and images in the remote site but not in the local
     34   site are cached locally.
     35
    3036   Revision 1.47  2000/02/17 22:26:17  sjboddie
    3137   set macros for displaying macrons in utf8
     
    12301236  disp.setmacro ("httpimg", "Global", configinfo.httpimg);
    12311237  disp.setmacro ("httpprefix", "Global", configinfo.httpprefix);
     1238
     1239  if (!collection.empty()) {
     1240    // DB // ****
     1241    ColInfoResponse_t cinfo;
     1242    comerror_t err;
     1243    recptproto *collectproto = protocols.getrecptproto (collection, logout);
     1244    if (collectproto != NULL) {
     1245      collectproto->get_collectinfo (collection, cinfo, err, logout);
     1246      text_t httpcollection
     1247    = "http://" + cinfo.httpdomain + cinfo.httpprefix
     1248        +"/collect/" + collection;
     1249     
     1250      disp.setmacro ("httpcollection", "Global", httpcollection);
     1251    }
     1252  }
     1253
    12321254  text_t compressedoptions = get_compressed_arg(args, logout);
    12331255  disp.setmacro ("compressedoptions", "Global", dm_safe(compressedoptions));
     
    12961318    }
    12971319      }
    1298     }
    1299   }
    1300 }
     1320
     1321      text_t iconcollection;
     1322      disp.expandstring ("Global", "_iconcollection_", iconcollection);
     1323      if (!iconcollection.empty())
     1324    {
     1325      if (iconcollection[0]=='/')
     1326        {
     1327          // local but with full path
     1328          ColInfoResponse_t cinfo;
     1329          comerror_t err;
     1330          collectproto->get_collectinfo (collection, cinfo, err, logout);
     1331          iconcollection = "http://" + cinfo.httpdomain + iconcollection;
     1332          disp.setmacro("iconcollection","Global",iconcollection);
     1333        }
     1334    }
     1335    }
     1336  }
     1337}
     1338
  • branches/corba/gsdl/src/recpt/recptconfig.cpp

    r1074 r1509  
    2828/*
    2929   $Log$
     30   Revision 1.6.2.3  2000/09/06 21:49:05  davidb
     31
     32   Improvements to corba implementation so images within a collection
     33   are handled better and images in the remote site but not in the local
     34   site are cached locally.
     35
    3036   Revision 1.6.2.2  2000/04/06 11:11:40  cs025
    3137   Corba improvements; tidied client initialisation in corbaproto and also
     
    8490private:
    8591  text_t *gsdlhome;
     92  text_t *httpdomain;
     93  text_t *httpprefix;
    8694  int    *maxrequests;
    8795public:
    8896  __site_configuration (text_t *_gsdlhome, int *_maxrequests) {
    8997    gsdlhome = _gsdlhome;
     98    httpdomain = NULL;
     99    httpprefix = NULL;
    90100    maxrequests = _maxrequests;
    91101  }
    92102
    93   __site_configuration (text_t *_gsdlhome) {
     103  __site_configuration (text_t *_gsdlhome, text_t *_httpdomain,
     104            text_t *_httpprefix) {
    94105    gsdlhome    = _gsdlhome;
     106    httpdomain = _httpdomain;
     107    httpprefix = _httpprefix;
    95108    maxrequests = NULL;
    96109  }
     
    99112    if (key == "gsdlhome") {
    100113      *gsdlhome = cfgline[0];
     114    }
     115
     116    if (key == "httpprefix" &&
     117    httpprefix != NULL) {
     118      *httpprefix = cfgline[0];
     119    }
     120
     121    if (key == "httpdomain" &&
     122    httpdomain != NULL) {
     123      *httpdomain = cfgline[0];
    101124    }
    102125
     
    124147  // blank the gsdl home text
    125148  gsdlhome.clear();
    126 
    127   /*
    128   // Look for gsdlsite.cfg in same directory that executable is in.
    129   text_tarray cfgline;
    130   text_t key;
    131   ifstream confin ("gsdlsite.cfg");
    132 
    133   if (confin) {
    134     while (read_cfg_line(confin, cfgline) >= 0) {
    135       if (cfgline.size () >= 2) {
    136     key = cfgline[0];
    137     cfgline.erase(cfgline.begin());
    138 
    139     sitecfg.configure(key, cfgline);
    140     // configure the receptionist
    141     recpt.configure (key, cfgline);
    142       }
    143     }
    144     confin.close ();
    145 
    146     return true;
    147   }
    148   */
     149  // also set  maxrequests to 0 ??
    149150
    150151  if (gsdlconfigurator.configure("gsdlsite.cfg")) {
     
    154155}
    155156
    156 // this version just grabs gsdlhome, returns false if it can't find it
    157 bool site_cfg_read (text_t &gsdlhome) {
     157// this version grabs gsdlhome, httpdomain and httpprefix,
     158// returns false if it can't find all of them
     159bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain,
     160            text_t &httpprefix) {
    158161  // get gsdlhome etc
    159   __site_configuration sitecfg(&gsdlhome);
     162  __site_configuration sitecfg(&gsdlhome,&httpdomain,&httpprefix);
    160163  configurator gsdlconfigurator(&sitecfg);
    161164
    162165  gsdlhome.clear();
     166  httpdomain.clear();
     167  httpprefix.clear();
    163168
    164169  if (gsdlconfigurator.configure("gsdlsite.cfg") &&
    165       !gsdlhome.empty()) {
     170      !gsdlhome.empty() && !httpdomain.empty() && !httpprefix.empty()) {
    166171    return true;
    167172  }
    168   /*
    169   // Look for gsdlsite.cfg in same directory that executable is in.
    170   text_tarray cfgline;
    171   text_t key;
    172   ifstream confin ("gsdlsite.cfg");
    173 
    174   if (confin) {
    175     while (read_cfg_line(confin, cfgline) >= 0) {
    176       if (cfgline.size () >= 2) {
    177     if (cfgline[0] == "gsdlhome") {
    178       gsdlhome = cfgline[1];
    179       return true;
    180     }
    181       }
    182     }
    183     confin.close ();
    184   }
    185   */
     173
    186174  return false;
    187175}
  • branches/corba/gsdl/src/recpt/recptconfig.h

    r1067 r1509  
    3939// reads site configuration file returning true on success
    4040bool site_cfg_read (receptionist &recpt, text_t &gsdlhome, int &maxrequests);
    41 bool site_cfg_read (text_t &gsdlhome);
     41bool site_cfg_read (text_t &gsdlhome, text_t &httpdomain, text_t &httpprefix);
    4242
    4343// main_cfg_read reads either collect.cfg or main.cfg and returning
  • branches/corba/gsdl/src/recpt/recptproto.cpp

    r533 r1509  
    2828/*
    2929   $Log$
     30   Revision 1.7.2.1  2000/09/06 21:49:06  davidb
     31
     32   Improvements to corba implementation so images within a collection
     33   are handled better and images in the remote site but not in the local
     34   site are cached locally.
     35
    3036   Revision 1.7  1999/09/07 04:56:59  sjboddie
    3137   added GPL notice
     
    6975bool recptproto::init (ostream &/*logout*/) {
    7076  return true;
     77}
     78
     79// get_site_name should return the name of the site used.
     80// This is trivially empty in the case of a null protocol.  If a remote
     81// connection to a site is being used then this should return the name
     82// used to label a site.
     83text_t recptproto::get_site_name () {
     84  return "";
    7185}
    7286
  • branches/corba/gsdl/src/recpt/recptproto.h

    r722 r1509  
    6262  // out to the log file and no other output should be produced.
    6363  virtual bool init (ostream &logout);
     64
     65  // get_site_name should return the name of the site used.
     66  // This is trivially empty in the case of a null protocol.  If a remote
     67  // connection to a site is being used then this should return the name
     68  // used to label a site.
     69  virtual text_t get_site_name ();
    6470
    6571  // get_protocol_name should return the name of this protocol (e.g. recptproto)
  • branches/corba/gsdl/src/recpt/statusaction.cpp

    r995 r1509  
    2828/*
    2929   $Log$
     30   Revision 1.25.2.1  2000/09/06 21:49:07  davidb
     31
     32   Improvements to corba implementation so images within a collection
     33   are handled better and images in the remote site but not in the local
     34   site are cached locally.
     35
    3036   Revision 1.25  2000/02/29 21:00:31  sjboddie
    3137   fixed some compiler warnings
     
    443449      } else {
    444450        textout << outconvert << disp
    445             << "\"<a href=\"_gwcgi_?e=_compressedoptions_&a=status&sp=collectioninfo&pr="
     451            << "\"<a href=\"_gwcgi_?_optsite_e=_compressedoptions_&a=status&sp=collectioninfo&pr="
    446452            << protoname
    447453            << "&c="
Note: See TracChangeset for help on using the changeset viewer.