source: trunk/gsdl/src/recpt/corbaproto.mpp@ 1860

Last change on this file since 1860 was 1860, checked in by cs025, 23 years ago

Included CORBA branch for first time

  • Property svn:keywords set to Author Date Id Revision
File size: 22.1 KB
Line 
1/**********************************************************************
2 *
3 * corbaproto.cpp --
4 * Copyright (C) 2000 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * $Id: corbaproto.mpp 1860 2001-01-25 18:26:45Z cs025 $
25 *
26 *********************************************************************/
27
28#include <iostream.h>
29#include <fstream.h>
30
31#include "fileutil.h"
32
33// protocol headers for CORBA
34#include "corbaiface.h"
35using namespace gsdlInterface;
36
37// greenstone library headers
38#include "corbaconv_text_t.h"
39
40// greenstone local headers
41#include "corbatext_t.h"
42
43#include "corbaproto.h"
44#include "colservrconfig.h"
45
46// default headers
47#include <assert.h>
48
49void corbatext_optionValueArrayToCorba(OptionValue_tarray array, corbaOptionValue_array &corba)
50{
51 unsigned int i = 0;
52 OptionValue_tarray::iterator here = array.begin();
53 OptionValue_tarray::iterator end = array.end();
54
55 while (here != end)
56 {
57 corba.length(i+1);
58
59 corbaconv_text_t::getCorbatext(here->name,corba[i].name);
60 corbaconv_text_t::getCorbatext(here->value,corba[i].value);
61
62 i ++;
63 here ++;
64 }
65 // cout << "Options " << i << endl;
66}
67
68void corbaresponse_resultMetadataToCorba(MetadataInfo_t &meta, corbaMetadataInfo &corbaMeta)
69{
70 corbaconv_text_t::getCorbatext(meta.params,corbaMeta.params);
71 corbatext_arrayToCorbaArray(meta.values, &corbaMeta.values);
72 corbaMeta.isRef = meta.isRef;
73}
74
75void corbaresponse_resultMetadataToC(const corbaMetadataInfo &corbaMeta, MetadataInfo_t &meta)
76{
77 corbaconv_text_t::setCorbatext(meta.params,corbaMeta.params);
78 corbatext_corbaArrayToArray(corbaMeta.values, &meta.values);
79 meta.isRef = corbaMeta.isRef;
80}
81
82int corbaresponse_resultMetaParentToCorba(MetadataInfo_t *parent, corbaMetadataInfo_array &corbaparent)
83{
84 int reply = -1, pid = -1;
85
86 // extend for new parent
87 reply = corbaparent.length();
88 corbaparent.length(reply+1);
89
90 // copy content into new array element
91 corbaresponse_resultMetadataToCorba(*parent, corbaparent[reply]);
92
93 // deal with our own parent
94 if (parent->parent != NULL)
95 {
96 // get offset of new parent and extend parent vector
97
98 pid = corbaresponse_resultMetaParentToCorba(parent->parent, corbaparent);
99 }
100 corbaparent[reply].parentid = pid;
101
102 // return the parent id from here
103 return reply;
104}
105
106MetadataInfo_t *corbaresponse_resultMetaParentToC(corbaMetadataInfo_array &corbaparent, int pid)
107{
108 MetadataInfo_t *reply;
109
110 reply = new MetadataInfo_t;
111
112 corbaresponse_resultMetadataToC(corbaparent[pid], *reply);
113
114 // deal with our own parent
115 if (corbaparent[pid].parentid >= 0)
116 {
117 // get offset of new parent and extend parent vector
118
119 reply->parent = corbaresponse_resultMetaParentToC(corbaparent, corbaparent[pid].parentid);
120 }
121 else
122 {
123 reply->parent = NULL;
124 }
125
126 // return the parent id from here
127 return reply;
128}
129
130void corbaresponse_resultDocInfoToCorba(ResultDocInfo_tarray docinfo, corbaResultDocInfo_array &corbainfo)
131{
132 ResultDocInfo_tarray::iterator here = docinfo.begin();
133 ResultDocInfo_tarray::iterator end = docinfo.end();
134 unsigned int i;
135
136 i = 0;
137 while (here != end)
138 {
139 corbainfo.length(i+1);
140
141 // copy the easy bits
142 corbaconv_text_t::getCorbatext(here->OID,corbainfo[i].OID);
143
144 corbainfo[i].resultNum = here->result_num;
145 corbainfo[i].ranking = here->ranking;
146 corbainfo[i].termsMatched = here->num_terms_matched;
147 corbainfo[i].phraseMatched = here->num_phrase_match;
148
149 // copy the docFreq array
150 vector<int>::iterator fhere = here->docFreq.begin();
151 vector<int>::iterator fend = here->docFreq.end();
152 unsigned int fi = 0;
153
154 while (fhere != fend)
155 {
156 corbainfo[i].docFreq.length(fi+1);
157
158 corbainfo[i].docFreq[fi] = *fhere;
159
160 fhere ++;
161 fi ++;
162 }
163
164 // copy the MetadataInfo map
165 MetadataInfo_tmap::iterator mhere = here->metadata.begin();
166 MetadataInfo_tmap::iterator mend = here->metadata.end();
167 unsigned int mi = 0;
168
169 while (mhere != mend)
170 {
171 corbainfo[i].metadata.names.length(mi+1);
172 corbainfo[i].metadata.values.length(mi+1);
173
174 // copy name
175 corbaconv_text_t::getCorbatext((*mhere).first,corbainfo[i].metadata.names[mi]);
176
177 // copy metadata
178 corbaresponse_resultMetadataToCorba((*mhere).second, corbainfo[i].metadata.values[mi]);
179 if (mhere->second.parent != NULL)
180 {
181 int pid;
182
183 pid = corbaresponse_resultMetaParentToCorba(mhere->second.parent,
184 corbainfo[i].metaparents);
185 corbainfo[i].metadata.values[mi].parentid = pid;
186 }
187 else
188 {
189 corbainfo[i].metadata.values[mi].parentid = -1;
190 }
191
192 cout << "Parent " << mi << " " << (int) &mhere->second << " " << (int) mhere->second.parent << endl;
193
194 mhere ++;
195 mi ++;
196 }
197
198 // Copy the classifier variables
199 corbaconv_text_t::getCorbatext(here->classifier_metadata_type, corbainfo[i].classifierMetadataType);
200 corbainfo[i].classifierMetadataOffset = here->classifier_metadata_offset;
201
202 // Get next Docinfo item
203 i++;
204 here ++;
205 }
206}
207
208void corbaresponse_resultDocInfoToC(corbaResultDocInfo_array corbainfo, ResultDocInfo_tarray &docinfo)
209{
210 unsigned int i;
211 ResultDocInfo_t doc;
212
213 for (i = 0; i < corbainfo.length(); i++)
214 {
215 corbaconv_text_t::setCorbatext(doc.OID,corbainfo[i].OID);
216 doc.result_num = corbainfo[i].resultNum;
217 doc.ranking = corbainfo[i].ranking;
218 doc.num_terms_matched = corbainfo[i].termsMatched;
219 doc.num_phrase_match = corbainfo[i].phraseMatched;
220
221 // copy the doc freq array
222 unsigned int fi;
223 for (fi = 0; fi < corbainfo[i].docFreq.length(); fi ++)
224 {
225 doc.docFreq.push_back(corbainfo[i].docFreq[fi]);
226 }
227
228 // copy the MetadataInfomap
229 unsigned int mi;
230 text_t mname;
231 MetadataInfo_t mdata;
232
233 doc.metadata.clear();
234 for (mi = 0; mi < corbainfo[i].metadata.names.length(); mi ++)
235 {
236 // get name
237 corbaconv_text_t::setCorbatext(mname,corbainfo[i].metadata.names[mi]);
238
239 // get metadata
240 corbaresponse_resultMetadataToC(corbainfo[i].metadata.values[mi], mdata);
241
242 if (corbainfo[i].metadata.values[mi].parentid >= 0)
243 {
244 mdata.parent =
245 corbaresponse_resultMetaParentToC(corbainfo[i].metaparents,
246 corbainfo[i].metadata.values[mi].parentid);
247 }
248
249 doc.metadata.insert(make_pair(mname, mdata));
250 }
251
252 // GRB: sort out parent data
253 for (mi = 0; mi < corbainfo[i].metadata.names.length(); mi ++)
254 {
255 if (corbainfo[i].metadata.values[mi].parentid != 0)
256 {
257 int pi;
258
259 for (pi = 0; pi < corbainfo[i].metadata.names.length(); pi ++)
260 {
261 if (pi != mi &&
262 corbainfo[i].metadata.values[mi].parentid ==
263 corbainfo[i].metadata.values[pi].id)
264 {
265 doc.metadata[mi].parent = &doc.metadata[pi];
266 }
267 }
268 }
269 }
270 // doc.metadata
271
272 // convert metadata classifer information
273 corbaconv_text_t::setCorbatext(doc.classifier_metadata_type,corbainfo[i].classifierMetadataType);
274 doc.classifier_metadata_offset = corbainfo[i].classifierMetadataOffset;
275
276 docinfo.push_back(doc);
277 }
278}
279
280corbaproto::corbaproto(char* _site_name)
281{ char *dummyv[1] = {""};
282 int dummyc = 0;
283 // CORBA variables
284 /* static CORBA::ORB_var orb = CORBA::ORB_init( dummyc , dummyv, "mico-local-orb" );
285 static CORBA::BOA_var boa = orb->BOA_init( dummyc , dummyv, "mico-local-boa" ); */
286
287 CORBA::ORB_var orb = CORBA::ORB_init( dummyc , dummyv, "mico-local-orb" );
288 CORBA::BOA_var boa = orb->BOA_init( dummyc , dummyv, "mico-local-boa" );
289
290 char objid_filename[256];
291 sprintf(objid_filename,"/tmp/%s.objid",_site_name);
292
293 // Get ref from "naming service"
294 ifstream in (objid_filename);
295 char ref[1000];
296 in >> ref;
297 in.close ();
298
299 // startup corba
300 // static CORBA::Object_var obj = orb->string_to_object (ref);
301 CORBA::Object_var obj = orb->string_to_object (ref);
302
303 client = corbaiface::_narrow( obj );
304 // client = NULL; // ****
305
306 gsdlhome.clear();
307 site_name = _site_name;
308}
309
310corbaiface_var corbaproto::getCorbaClient()
311{
312 // This function was written to help corba when ORB and BOA were
313 // not working in "persistent" mode.
314 // Now that persistent mode is working it is not longer needed/used.
315
316 char *dummyv[1] = {""};
317 int dummyc = 0;
318 // CORBA variables
319// static CORBA::ORB_var orb = CORBA::ORB_init( dummyc , dummyv, "mico-local-orb" );
320// static CORBA::BOA_var boa = orb->BOA_init( dummyc , dummyv, "mico-local-boa" );
321
322 // DB // Try this out!! // ****
323 CORBA::ORB_var orb = CORBA::ORB_init( dummyc , dummyv, "mico-local-orb" );
324 CORBA::BOA_var boa = orb->BOA_init( dummyc , dummyv, "mico-local-boa" );
325
326 /* char* site_name_chars = site_name.getcstr();
327 char objid_filename[256];
328 sprintf(objid_filename,"/tmp/%s.objid",site_name_chars);
329 // delete site_name_chars; */
330
331 text_t objid_filename = "/tmp/" + site_name + ".objid";
332
333 // Get ref from "naming service"
334 ifstream in (objid_filename.getcstr());
335 char ref[1000];
336 in >> ref;
337 in.close ();
338
339 // startup corba
340 // DB // Try this out!! // ****
341 // static CORBA::Object_var obj = orb->string_to_object (ref);
342 CORBA::Object_var obj = orb->string_to_object (ref);
343
344 return corbaiface::_narrow( obj );
345}
346
347
348// this configure will configure each of the collection servers
349void corbaproto::configure (const text_t &key, const text_tarray &cfgline) {
350 // the naming of the collection should not be done here,
351 // it should be done just after the collection server has been
352 // created
353
354 // cout << "Corbaproto::Configure" << endl;
355 corbatext_t corbaKey;
356 corbatext_tarray corbaCfgline;
357
358 // get the corba client reference
359 // corbaiface_var lclient = this->getCorbaClient(); // ****
360 corbaiface_var lclient = client;
361
362 // convert all the requisite structures into their CORBA form
363 corbaconv_text_t::getCorbatext(key,corbaKey);
364 corbatext_arrayToCorbaArray(cfgline, &corbaCfgline);
365
366 // execute the corba transaction
367 lclient->configure(corbaKey, corbaCfgline);
368
369 if (key=="gsdlhome")
370 {
371 // store gsdlhome in corba prototype so it can be used later to
372 // check if icons specified in format statements exist on the
373 // recptionist's side
374 gsdlhome = cfgline[0];
375 }
376}
377
378// this init will configure and init each of the collection servers
379bool corbaproto::init (ostream &logout) {
380// cout << "Corbaproto::Init" << endl;
381
382 // get the corba client reference
383 // corbaiface_var lclient = this->getCorbaClient(); // ****
384 corbaiface_var lclient = client;
385
386 // execute the corba transaction
387 return lclient->initialise();
388}
389
390void corbaproto::cache_missing_icons(text_tmap& format_map,
391 text_t& httpdomain,
392 text_t& httpprefix)
393{
394 // consider making this a member function in the object?
395
396 text_tmap::iterator format_here = format_map.begin();
397 text_tmap::iterator format_end = format_map.end();
398 while (format_here!=format_end)
399 {
400 text_t format_line = format_here->second;
401
402 // cout << "*** format line = " << format_line << endl; // ****
403
404 text_t::iterator fl_begin = format_line.begin();
405 text_t::iterator fl_end = format_line.end();
406
407 text_t::iterator httpimg_find = findword(fl_begin,fl_end,"_httpimg_");
408 text_t::iterator http_find = httpimg_find;
409
410 while (httpimg_find!=fl_end)
411 {
412 http_find = httpimg_find+5;
413 httpimg_find += 9;
414
415 // look for white space " or >
416 text_t::iterator filename_end = httpimg_find;
417 while (filename_end != fl_end)
418 {
419 if (*filename_end == ' ') break;
420 if (*filename_end == '\t') break;
421 if (*filename_end == '\"') break;
422 if (*filename_end == '>') break;
423 filename_end++;
424 }
425
426 text_t img_filename = substr(httpimg_find,filename_end);
427
428 text_t site_img_filename = filename_cat(gsdlhome,"images",img_filename);
429
430 // look to see if img filename exists in images directory
431 if (!file_exists(site_img_filename))
432 {
433 text_t cache_img_dir
434 = filename_cat(gsdlhome,"images",".cache");
435
436 text_t remote_img_url = "http://" + httpdomain + httpprefix
437 + "/images" + img_filename;
438
439 text_t wget_cmd = "wget -q -N --directory-prefix="+cache_img_dir
440 + " " + remote_img_url;
441
442 char* wget_cmd_chars = wget_cmd.getcstr();
443
444 system(wget_cmd_chars);
445 delete wget_cmd_chars;
446
447 format_map[format_here->first]
448 = substr(fl_begin,http_find) + "cache" + substr(http_find,fl_end);
449
450 }
451
452 httpimg_find = findword(httpimg_find,fl_end,"_httpimg_");
453 }
454 format_here++;
455 }
456}
457
458text_t corbaproto::get_site_name () {
459 return site_name;
460}
461
462text_t corbaproto::get_protocol_name () {
463 return "corbaproto";
464}
465
466
467void corbaproto::get_collection_list (text_tarray &collist, comerror_t &err,
468 ostream &/*logout*/) {
469
470 // cout << "Corbaproto::Collection list" << endl;
471
472 corbatext_tarray corba_collist;
473 text_tarray tcollist;
474
475 // get the corba client reference
476 // corbaiface_var lclient = this->getCorbaClient(); // ****
477 corbaiface_var lclient = client;
478
479 // execute the corba transaction
480 lclient->collectionList(corba_collist);
481
482 // convert the response back to normal form
483 corbatext_corbaArrayToArray(corba_collist, &tcollist);
484 collist = tcollist;
485
486 err = noError;
487}
488
489void corbaproto::has_collection (const text_t &collection, bool &hascollection,
490 comerror_t &err, ostream &/*logout*/) {
491 // cout << "Corbaproto::Has collection" << endl;
492
493 corbatext_t corbaCollection;
494 corbaComError corbaError;
495 CORBA::Boolean corbaHas;
496
497 // get the corba client reference
498 // corbaiface_var lclient = this->getCorbaClient(); // ****
499 corbaiface_var lclient = client;
500
501 // convert all the requisite structures into their CORBA form
502 corbaconv_text_t::getCorbatext(collection,corbaCollection);
503
504 // execute the corba transaction
505 lclient->hasCollection(corbaCollection, corbaHas, corbaError);
506
507 // convert the response back to normal form
508 hascollection = (corbaHas != 0);
509 err = noError;
510}
511
512void corbaproto::ping (const text_t &collection, bool &wassuccess,
513 comerror_t &err, ostream &/*logout*/) {
514 // cout << "Corbaproto::Ping" << endl;
515
516 corbatext_t corbaCollect;
517 corbaComError corbaError;
518 bool success;
519
520 // get the corba client reference
521 // corbaiface_var lclient = this->getCorbaClient(); // ****
522 corbaiface_var lclient = client;
523
524 // convert all the requisite structures into their CORBA form
525 corbaconv_text_t::getCorbatext(collection,corbaCollect);
526
527 // execute the corba transaction
528 success = lclient->ping(corbaCollect, corbaError);
529
530 // convert the response back to normal form
531 wassuccess = (success != 0);
532}
533
534
535void corbaproto::get_collectinfo (const text_t &collection,
536 ColInfoResponse_t &collectinfo,
537 comerror_t &err, ostream &logout) {
538 // cout << "Corbaproto::Collectinfo" << endl;
539
540 corbatext_t corbaCollection;
541 corbaComError corbaError;
542 corbaColInfoResponse corbaCollectInfo;
543
544 // get the corba client reference
545 // corbaiface_var lclient = this->getCorbaClient(); // ****
546 corbaiface_var lclient = client;
547
548 // convert all the requisite structures into their CORBA form
549 corbaconv_text_t::getCorbatext(collection,corbaCollection);
550
551 // execute the corba transaction
552 lclient->getCollectInfo(corbaCollection, corbaCollectInfo, corbaError);
553
554 // convert the response back to normal form
555 collectinfo.isPublic = corbaCollectInfo.isPublic;
556 collectinfo.isBeta = corbaCollectInfo.isBeta;
557 collectinfo.buildDate = corbaCollectInfo.buildDate;
558 corbatext_corbaArrayToArray(corbaCollectInfo.ccsCols, &collectinfo.ccsCols);
559 corbatext_corbaArrayToArray(corbaCollectInfo.languages, &collectinfo.languages);
560 collectinfo.numDocs = corbaCollectInfo.numDocs;
561 collectinfo.numWords = corbaCollectInfo.numWords;
562 collectinfo.numBytes = corbaCollectInfo.numBytes;
563 corbatext_corbaMapToMap(corbaCollectInfo.collectionMeta, collectinfo.collectionmeta);
564 corbatext_corbaMapToMap(corbaCollectInfo.format, collectinfo.format);
565 corbatext_corbaMapToMap(corbaCollectInfo.building, collectinfo.building);
566 corbaconv_text_t::setCorbatext(collectinfo.httpdomain,corbaCollectInfo.httpdomain);
567 corbaconv_text_t::setCorbatext(collectinfo.httpprefix,corbaCollectInfo.httpprefix);
568 corbaconv_text_t::setCorbatext(collectinfo.receptionist,corbaCollectInfo.receptionist);
569
570 cache_missing_icons(collectinfo.format,collectinfo.httpdomain,
571 collectinfo.httpprefix);
572
573 err = (comerror_t) corbaError;
574}
575
576
577void corbaproto::get_filterinfo (const text_t &collection,
578 InfoFiltersResponse_t &response,
579 comerror_t &err, ostream &logout) {
580 // cout << "Corbaproto::Filterinfo" << endl;
581
582 corbatext_t corbaCollection;
583 corbatext_tset corbaResponse;
584 corbaComError corbaError;
585
586 // get the corba client reference
587 // corbaiface_var lclient = this->getCorbaClient(); // ****
588 corbaiface_var lclient = client;
589
590 // convert all the requisite structures into their CORBA form
591 corbaconv_text_t::getCorbatext(collection,corbaCollection);
592
593 // execute the corba transaction
594 lclient->getFilterInfo(corbaCollection, corbaResponse, corbaError);
595
596 // convert the response back to normal form
597 corbatext_corbaArrayToSet(corbaResponse, &response.filterNames);
598
599 err = (comerror_t) corbaError;
600}
601
602void corbaproto::get_filteroptions (const text_t &collection,
603 const InfoFilterOptionsRequest_t &request,
604 InfoFilterOptionsResponse_t &response,
605 comerror_t &err, ostream &logout) {
606 // cout << "Corbaproto::Filteroptions" << endl;
607
608 corbatext_t corbaCollection;
609 corbatext_t filterName;
610 corbaFilterOptionsResponse corbaResponse;
611 corbaComError corbaError;
612 unsigned int i;
613 corbaconv_text_t *cc_name;
614 FilterOption_t *option;
615
616 // get the corba client reference
617 // corbaiface_var lclient = this->getCorbaClient(); // ****
618 corbaiface_var lclient = client;
619
620 // convert all the requisite structures into their CORBA form
621 corbaconv_text_t::getCorbatext(collection,corbaCollection);
622 corbaconv_text_t::getCorbatext(request.filterName,filterName);
623
624 // execute the corba transaction
625 lclient->getFilterOptions(corbaCollection, filterName, corbaResponse, corbaError);
626
627 // convert the response back to normal form
628 for (i = 0; i < corbaResponse.names.length(); i ++)
629 {
630 cc_name = new corbaconv_text_t(corbaResponse.names[i]);
631
632 option = new FilterOption_t;
633 corbaconv_text_t::setCorbatext(option->name,corbaResponse.options[i].name);
634 option->type = (FilterOption_t::type_t) corbaResponse.options[i].type;
635 option->repeatable = (FilterOption_t::repeatable_t) corbaResponse.options[i].repeatable;
636 corbaconv_text_t::setCorbatext(option->defaultValue,corbaResponse.options[i].defaultValue);
637 corbatext_corbaArrayToArray(corbaResponse.options[i].validValues, &option->validValues);
638
639 response.filterOptions.insert(make_pair(*cc_name, *option)); // typecast to text_t
640 }
641
642 err = (comerror_t) corbaError;
643}
644
645void corbaproto::filter (const text_t &collection,
646 FilterRequest_t &request,
647 FilterResponse_t &response,
648 comerror_t &err, ostream &logout) {
649 // cout << "Corbaproto::Filter" << endl;
650
651 corbaFilterRequest corbaRequest;
652 corbaFilterResponse corbaResponse;
653 corbatext_t corbaCollection;
654 corbaComError corbaError;
655
656 // get the corba client reference
657 // corbaiface_var lclient = this->getCorbaClient(); // ****
658 corbaiface_var lclient = client;
659
660 // convert all the requisite structures into their CORBA form
661 corbaconv_text_t::getCorbatext(collection,corbaCollection);
662 corbaconv_text_t::getCorbatext(request.filterName,corbaRequest.filter);
663 corbatext_optionValueArrayToCorba(request.filterOptions, corbaRequest.filterOptions);
664 corbatext_arrayToCorbaArray(request.docSet, &corbaRequest.docSet);
665 corbaRequest.filterResultOptions = request.filterResultOptions;
666 corbaconv_text_t::getCorbatext(request.requestParams,corbaRequest.requestParams);
667 corbaconv_text_t::getCorbatext(request.refParams,corbaRequest.refParams);
668 corbaRequest.getParents = request.getParents;
669 corbatext_setToCorbaArray(request.fields, &corbaRequest.fields);
670
671 corbaResponse.numDocs = response.numDocs;
672 corbaresponse_resultDocInfoToCorba(response.docInfo, corbaResponse.docInfo);
673
674 // execute the corba transaction
675 lclient->filter (corbaCollection, corbaRequest, corbaResponse, corbaError);
676
677 // convert the response back to normal form
678 response.numDocs = corbaResponse.numDocs;
679 response.isApprox = corbaResponse.isApprox;
680 corbaresponse_resultDocInfoToC(corbaResponse.docInfo, response.docInfo);
681
682 err = (comerror_t) corbaError;
683 // cout << "Corbaproto::Filter" << endl;
684
685}
686
687void corbaproto::get_document (const text_t &collection,
688 const DocumentRequest_t &request,
689 DocumentResponse_t &response,
690 comerror_t &err, ostream &logout) {
691 // cout << "Corbaproto::Get Document" << endl;
692
693 corbatext_t corbaCollect;
694 corbaDocRequest corbaRequest;
695 corbaDocResponse corbaResponse;
696 corbaComError corbaError;
697
698 // get the corba client reference
699 // corbaiface_var lclient = this->getCorbaClient(); // ****
700 corbaiface_var lclient = client;
701
702 // convert all the requisite structures into their CORBA form
703 corbaconv_text_t::getCorbatext(collection,corbaCollect);
704 corbaconv_text_t::getCorbatext(request.OID,corbaRequest.OID);
705 corbaconv_text_t::getCorbatext(request.docType,corbaRequest.docType);
706 corbaconv_text_t::getCorbatext(request.docFormat,corbaRequest.docFormat);
707
708 // execute the corba transaction
709 lclient->getDocument(corbaCollect, corbaRequest, corbaResponse, corbaError);
710
711 // convert the response back to normal form
712 corbaconv_text_t::setCorbatext(response.doc,corbaResponse.doc);
713
714 err = (comerror_t) corbaError;
715}
716
Note: See TracBrowser for help on using the repository browser.