Index: /gsdl/trunk/src/colservr/Makefile.in
===================================================================
--- /gsdl/trunk/src/colservr/Makefile.in	(revision 15458)
+++ /gsdl/trunk/src/colservr/Makefile.in	(revision 15459)
@@ -24,4 +24,8 @@
 #
 ###########################################################################
+
+GSDL_DIR = ../..
+INDEXERS_DIR = $(GSDL_DIR)/indexers
+COLSERVR_DIR = $(GSDL_DIR)/src/colservr
 
 CC = @CC@
@@ -58,45 +62,4 @@
 COMPILE = $(CC) -c $(CFLAGS) $(DEFS) $(INCLUDES)
 CXXCOMPILE = $(CXX) -c $(CXXFLAGS) $(DEFS) $(INCLUDES)
-
-
-# ===========================================================================================
-#   CORBA SUPPORT
-
-USE_CORBA = @USE_CORBA@
-
-MCFLAGS = @CFLAGS@ -Wall -Wunused
-
-MICO_DIR = @MICO_DIR@
-ifeq ($(MICO_DIR), default)
-MICO_INC = -I../../packages/mico/include
-MICO_PATH = ../../bin/linux/
-else
-ifeq ($(MICO_DIR), yes)
-MICO_INC =
-MICO_PATH =
-else
-MICO_INC = -I$(MICO_DIR)
-MICO_PATH =
-endif
-endif
-MINCLUDES = -I. -I../../lib -I../recpt  -I$(INDEXERS_DIR)/mgpp/text $(MICO_INC)
-
-MCOMPILE = $(MICO_PATH)mico-c++ -x c++ $(MCFLAGS) $(DEFS) $(MINCLUDES) -c
-
-.SUFFIXES: .mpp .o
-.mpp.o:
-	$(MCOMPILE) $<
-
-ifneq ($(USE_CORBA), 0)
-CORBAHEADERS = corbaServer.h
-CORBASOURCES = corbaServer.mpp
-CORBAOBJECTS = corbaServer.o ../../lib/corbaiface_skel.o
-else
-CORBAHEADERS = 
-CORBASOURCES = 
-CORBAOBJECTS = 
-endif
-
-# ===========================================================================================
 
 
Index: dl/trunk/src/colservr/corbaServer.mpp
===================================================================
--- /gsdl/trunk/src/colservr/corbaServer.mpp	(revision 15458)
+++ 	(revision )
@@ -1,491 +1,0 @@
-// Standard headers
-#include <iostream.h>
-#include <fstream.h>
-
-// protocol headers
-#include "corbaiface.h"
-using namespace gsdlInterface;
-
-#include "corbaconv_text_t.h"
-
-// library headers
-#include "fileutil.h"
-//#include "gsdlhome.h"
-
-// greenstone headers
-#include "comtypes.h"
-#include "recptproto.h"
-#include "nullproto.h"
-
-// local headers
-#include "corbatext_t.h"
-
-void corbatext_setToCorbaArray(text_tset set, corbatext_tset *cset);
-void corbatext_corbaArrayToSet(corbatext_tset cset, text_tset *set);
-void corbatext_mapToCorbaMap(text_tmap map, corbatext_tmap *tm);
-void corbaresponse_resultDocInfoToCorba(ResultDocInfo_tarray docinfo, corbaResultDocInfo_array &corbainfo);
-
-void corbaresponse_termInfoToCorba(TermInfo_tarray terminfo, corbaTermInfo_array &corbainfo) {
-  TermInfo_tarray::iterator here = terminfo.begin();
-  TermInfo_tarray::iterator end  = terminfo.end();
-  unsigned int i;
-	
-  i = 0;
-
-  while (here != end) 
-    {
-      corbainfo.length(i+1);
-      
-      corbainfo[i].frequency = here->freq;
-      corbaconv_text_t::getCorbatext(here->term,corbainfo[i].term);
-      corbatext_arrayToCorbaArray(here->matchTerms, &corbainfo[i].matchTerms);
-
-      i ++;
-      here ++;
-    }
-  cout << "Terminfo " << i << endl;
-}
-
-void corbatext_optionValueArrayToC(corbaOptionValue_array corba, OptionValue_tarray &array)
-{
-  unsigned int i = 0;
-  OptionValue_t option;
-
-  for (i = 0; i < corba.length(); i ++)
-    {
-      corbaconv_text_t::setCorbatext(option.name,corba[i].name);
-      corbaconv_text_t::setCorbatext(option.value,corba[i].value);
-
-      // cout << corbatext_string(corba[i].name) << "?" << option
-
-      array.push_back(option);
-    }
-}
-
-class corbaServer : virtual public corbaiface_skel
-{
-private:
-  text_tarray collections;
-  recptproto *protocol;
-  text_t      gsdlhome;
-
-  void openLogfile(text_t extension, ofstream &out)
-  {
-    char *cfilename;
-    text_t filename;
-
-    filename = filename_cat(gsdlhome, extension);
-    cfilename = filename.getcstr();
-
-    out.open(cfilename);
-    delete cfilename;
-  }
-
-public:
-  corbaServer(recptproto *protocol, text_t home)
-  { 
-    text_t dirname;
-    char * cdirname;
-
-    cout << "CorbaServer: gsdlhome = " << home << endl;
-
-    this->gsdlhome = home;
-    cout << gsdlhome.getcstr() << endl;
-    dirname = filename_cat(gsdlhome, "/collect");
-    cdirname = dirname.getcstr();
-    if (!read_dir (cdirname, collections)) {
-      cout << "Unable to read the gsdl directory; terminating" << endl;
-      exit (1);
-    }
-    delete cdirname;
-
-    cout << "Constructing set list server" << endl;
-    this->protocol = protocol;
-
-  }
-  
-  CORBA::Boolean initialise(corbaComError &err) 
-  {
-      ofstream      logout;
-      int           reply;
-      comerror_t    error = noError;
-
-      this->openLogfile("/etc/corbaout.txt", logout);
-      reply = protocol->init(error, logout);
-      logout.close();
-      return (reply != 0 ? 1 : 0);
-    }
-
-  void configure(const corbatext_t &corbaKey, const corbatext_tarray &corbaCfgline,corbaComError &err)
-    {
-      text_t        key;
-      text_tarray   cfgline;
-      comerror_t    error = noError;
-
-      corbaconv_text_t::setCorbatext(key,corbaKey);
-      corbatext_corbaArrayToArray(corbaCfgline, &cfgline);
-
-
-      // ****
-      cout << "Recieved " << key << " = ";
-      for (int unsigned i=0; i<cfgline.size(); i++)
-	{
-	  cout << cfgline[i] << " ";
-	}
-      cout << endl;
-
-      // DB // ****
-      if (key=="gsdlhome")
-	{  
-	  text_tarray cfgline;
-	  cfgline.push_back (gsdlhome);
-	  cout << "Changing gsdlhome to " << gsdlhome << endl;
-	  protocol->configure(key, cfgline, error);
-	}
-      else if (key=="httpdomain")
-	{
-	  // Only let gsdlhome through !!!! // ****
-	  cout << "Supressing httpdomain" << endl;
-	}
-      else if (key=="httpprefix")
-	{
-	  cout << "Supressing httpprefix" << endl;
-	}
-      else
-	{ 
-	  protocol->configure(key, cfgline,error);
-	}
-    }
-
-  void hasCollection(const corbatext_t &corbaCollect, CORBA::Boolean &has,
-                     corbaComError &error) {
-    // do nowt!
-    corbaconv_text_t *cct;
-    bool    _has;
-    comerror_t err = noError;
-    ofstream logout;
-
-    this->openLogfile("/etc/corbaout.txt", logout);
-
-    cct = new corbaconv_text_t(corbaCollect);
-
-    cout << "Collection: " << cct->getcstr() << endl;
-
-    protocol->has_collection(*cct, _has, err, logout); // 'cct' typecast to text_t
-    if (_has)
-      { 
-	has = 1;
-      }
-    else
-      {
-	has = 0;
-      }
-
-    // cout << "  " << has << endl;
-
-    delete cct;
-
-    error = corbaNoError;
-    logout.close();
-  }
-
-  void ping(const struct corbatext_t &corbaCollect, CORBA::Boolean &wasSuccess, corbaComError &corbaError)
-  { 
-    text_t collection;
-    bool   success;
-    comerror_t error = noError;
-    ofstream logout;
-
-    this->openLogfile("/etc/corbaout.txt", logout);
-
-    corbaconv_text_t::setCorbatext(collection,corbaCollect);
-    protocol->ping(collection, success, error, logout);
-
-    corbaError = (corbaComError) error;
-    wasSuccess = (CORBA::Boolean) success;
-    logout.close();
-  }
-
-  void filter(const struct corbatext_t &corbaCollect,
-	      const struct corbaFilterRequest &corbaRequest,
-	      struct corbaFilterResponse &corbaResponse,
-	      corbaComError &corbaError)
-  {
-    // variables for action
-    FilterRequest_t request;
-    FilterResponse_t response;
-    comerror_t       error = noError;
-    text_t           collection;
-    ofstream         logout;
-
-    this->openLogfile("/etc/corbaout.txt", logout);
-
-    // copy collection id
-    corbaconv_text_t::setCorbatext(collection,corbaCollect);
-
-    // copy request values
-    corbaconv_text_t::setCorbatext(request.filterName,corbaRequest.filter);
-    corbatext_optionValueArrayToC(corbaRequest.filterOptions, request.filterOptions);
-    corbatext_corbaArrayToArray(corbaRequest.docSet, &request.docSet);
-    request.filterResultOptions = corbaRequest.filterResultOptions;
-    corbaconv_text_t::setCorbatext(request.requestParams,corbaRequest.requestParams);
-    corbaconv_text_t::setCorbatext(request.refParams,corbaRequest.refParams);
-    corbatext_corbaArrayToSet(corbaRequest.fields, &request.fields);
-    request.getParents = corbaRequest.getParents;
-
-    protocol->filter(collection, request, response, error, logout);
-
-    // copy response values
-    corbaResponse.numDocs = response.numDocs;
-    corbaResponse.isApprox = (::gsdlInterface::corbaIsApprox) response.isApprox;
-    corbaresponse_termInfoToCorba(response.termInfo, corbaResponse.termInfo);
-    corbaresponse_resultDocInfoToCorba(response.docInfo, corbaResponse.docInfo);
-
-    // tidy up variables
-    logout.close();
-    corbaError = (corbaComError) error;
-    cout << "Filter prepared" << corbaResponse.docInfo.length() << "," << corbaResponse.numDocs << endl;
-  }
-
-  void getCollectInfo(const struct corbatext_t &corbaCollect,
-                      corbaColInfoResponse &corbaResponse,
-                      corbaComError &corbaError)
-  {
-    ColInfoResponse_t response;
-    comerror_t       error = noError;
-    text_t           collection;
-    ofstream logout;
-
-    this->openLogfile("/etc/corbaout.txt", logout);
-
-    corbaconv_text_t::setCorbatext(collection,corbaCollect);
-    protocol->get_collectinfo(collection, response, error, logout);
-
-    cout << "IsPublic  = " << ((response.isPublic)?"True":"False") << endl;
-    cout << "IsBeta    = " << ((response.isBeta)  ?"True":"False") << endl;
-    cout << "BuildDate = " << response.buildDate << endl;
-    cout << "NumDocs   = " << response.numDocs << endl;
-    cout << "NumBytes  = " << response.numBytes << endl;
-    cout << "NumWords  = " << response.numWords << endl;
-    cout << "UseBook   = " << ((response.useBook)  ?"True":"False") << endl;
-    
-    corbaResponse.useBook   = response.useBook;
-    corbaResponse.isPublic  = response.isPublic;
-    corbaResponse.isBeta    = response.isBeta;
-    corbaResponse.buildDate = response.buildDate;
-    corbatext_arrayToCorbaArray(response.languages, &corbaResponse.languages);
-    corbatext_arrayToCorbaArray(response.ccsCols, &corbaResponse.ccsCols);
-    corbaResponse.numDocs   = response.numDocs;
-    corbaResponse.numBytes  = response.numBytes;
-    corbaResponse.numWords  = response.numWords;
-
-    corbatext_mapToCorbaMap(response.collectionmeta, &corbaResponse.collectionMeta);
-    corbatext_mapToCorbaMap(response.format, &corbaResponse.format);
-    corbatext_mapToCorbaMap(response.building, &corbaResponse.building);
-    corbaconv_text_t::getCorbatext(response.httpdomain,corbaResponse.httpdomain);
-
-    corbaconv_text_t::getCorbatext(response.httpprefix,corbaResponse.httpprefix);
-    corbaconv_text_t::getCorbatext(response.receptionist,corbaResponse.receptionist);
-
-    /* text_tmap::iterator f_here = response.format.begin();
-    text_tmap::iterator f_end = response.format.end();
-    while (f_here!=f_end)
-    {
-      cout << "**** format: " << f_here->first << " = " << f_here->second << endl;
-      f_here++;
-    } 
-    */ // ****
-
-    logout.close();
-    corbaError = (corbaComError) error;
-  }
-
-  void getFilterOptions(const struct corbatext_t &corbaCollect,
-			const struct corbatext_t &corbaFilterName,
-			struct corbaFilterOptionsResponse &corbaResponse,
-			enum corbaComError &corbaError)
-  {   
-    text_t collection;
-    InfoFilterOptionsRequest_t request;
-    InfoFilterOptionsResponse_t response;
-    comerror_t error = noError;
-    unsigned int i;
-    ofstream logout;
-
-    this->openLogfile("/etc/corbaout.txt", logout);
-
-    corbaconv_text_t::setCorbatext(collection,corbaCollect);
-    corbaconv_text_t::setCorbatext(request.filterName,corbaFilterName);
-    protocol->get_filteroptions(collection, request, response, error, logout);
-
-    // decode filters back into corba format
-    FilterOption_tmap::iterator here = response.filterOptions.begin();
-    FilterOption_tmap::iterator end = response.filterOptions.end();
-    i = 0;
-    while (here != end)
-      {
-	// set array for name/options to be one bigger
-	corbaResponse.names.length(i+1);
-	corbaResponse.options.length(i+1);
-
-	// get left-hand side of map
-	corbaconv_text_t::getCorbatext((*here).first,corbaResponse.names[i]);
-	
-	// get right-hand side of map
-	corbaconv_text_t::getCorbatext((*here).second.name,corbaResponse.options[i].name);
-	corbaResponse.options[i].type = 
-	  (::gsdlInterface::corbaFilterType)(*here).second.type;
-	corbaResponse.options[i].repeatable = 
-	  (::gsdlInterface::corbaFilterRepeatable)(*here).second.repeatable;
-	corbaconv_text_t::getCorbatext((*here).second.defaultValue,corbaResponse.options[i].defaultValue);
-	corbatext_arrayToCorbaArray((*here).second.validValues, &corbaResponse.options[i].validValues);
-
-	// take next iterators
-	i++;
-	here ++;
-      }
-
-    logout.close();
-    corbaError = (corbaComError) error;
-  }
-
-  void getFilterInfo(const struct corbatext_t &corbaCollect, 
-		     corbatext_tarray &filterNames, 
-		     enum corbaComError &corbaError)
-  { text_tarray ta;
-    comerror_t error = noError;
-    text_t collection;    
-    InfoFiltersResponse_t response;
-    ofstream logout;
-
-    this->openLogfile("/etc/corbaout.txt", logout);
-
-    corbaconv_text_t::setCorbatext(collection,corbaCollect);
-    cout << collection.getcstr() << endl;
-			    
-    protocol->get_filterinfo(collection, response, error, logout);
-    corbatext_setToCorbaArray(response.filterNames, &filterNames);
-
-    corbaError = (corbaComError) error;
-    logout.close();
-  }
-  
-  void getDocument(const struct corbatext_t &corbaCollection, struct corbaDocRequest &corbaRequest, 
-		   struct corbaDocResponse &corbaResponse,  enum corbaComError &corbaError)
-  { DocumentRequest_t request;
-    DocumentResponse_t response;
-    comerror_t         error = noError;
-    text_t             collection;
-    ofstream logout;
-
-    this->openLogfile("/etc/corbaout.txt", logout);
-
-    // set up request
-    corbaconv_text_t::setCorbatext(collection,corbaCollection);
-    corbaconv_text_t::setCorbatext(request.OID,corbaRequest.OID);
-    corbaconv_text_t::setCorbatext(request.docType,corbaRequest.docType);
-    corbaconv_text_t::setCorbatext(request.docFormat,corbaRequest.docFormat);
-
-    // do actual get document
-    protocol->get_document(collection, request, response, error, logout);
-    corbaconv_text_t::getCorbatext(response.doc,corbaResponse.doc);
-
-    // decode response
-    corbaError = (corbaComError) error;
-
-    logout.close();
-  }
-
-  void collectionList(corbatext_tarray &corbalist, corbaComError &error)
-  {
-    /* stringSeq *reply;
-    unsigned int i;
-    char *istring; */
-
-    text_tarray collist;
-    comerror_t  err;
-    ofstream logout;
-
-    cout << "Received collection list request" << endl;
-
-    this->openLogfile("/etc/corbaout.txt", logout);
-
-    protocol->get_collection_list(collist, err, logout);
-
-    /*    reply = new stringSeq(collections.size());
-    
-    (*reply).length(collections.size());
-    for (i = 0; i < collections.size(); i ++)
-      {
-	istring = collections[i].getcstr();
-	(*reply)[i] = CORBA::string_dup(istring);
-	delete istring;
-      }
-    
-    return reply;
-    */
-
-    corbatext_arrayToCorbaArray(collist, &corbalist);
-    cout << "Replying " << collist.size() << ": " << endl;
-
-    for (int unsigned i = 0; i < collist.size(); i ++)
-      {
-	cout << collist[i];
-	if (i<collist.size()-1) cout << ", ";
-      }
-    cout << endl;
-
-    logout.close();
-    // CORBA::string_dup(_listString);
-  }
-};
-
-int main (int argc, char *argv[])
-{
-  nullproto protocol;
-  collectset *cservers;
-  text_t     gsdlhome;
-
-  cservers = new collectset(gsdlhome);
-  protocol.set_collectset(cservers);
-
-  cout << "Started Corba ..." << endl;
-
-  // ORB initialization
-  CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "mico-local-orb" );
-  CORBA::BOA_var boa = orb->BOA_init( argc, argv, "mico-local-boa" );
-
-  cout << "Initialised ORB and BOA" << endl;
-
-  corbaServer* server = new corbaServer(&protocol, gsdlhome);
-
-  cout << "Initialised server" << endl;
-
-  CORBA::String_var ref = orb->object_to_string( server );
-
-  cout << "Mapped Corba object to string" << endl;
-
-  // write id to "naming service"
-  ofstream out ("/tmp/localcorba.objid");
-	if (out.is_open()) {
-		out << ref << endl;
-		if (out.fail() || out.bad()) {
-			cout << "Failed " << endl;
-		}
-		out.close ();
-	}
-	else {
-		cout << "Unable to write string to file /tmp/localcorba.objid" << endl;
-		cout << "Please check the file permissions/ownership" << endl;
-		return 0;
-	}
-  cout << "Corba string is " << ref << endl;
-
-  // indicate readiness and run
-  boa->impl_is_ready( CORBA::ImplementationDef::_nil() );
-  orb->run ();
-  CORBA::release( server );
-  return 0;
-}
-
-
Index: /gsdl/trunk/src/corba/Makefile.in
===================================================================
--- /gsdl/trunk/src/corba/Makefile.in	(revision 15459)
+++ /gsdl/trunk/src/corba/Makefile.in	(revision 15459)
@@ -0,0 +1,39 @@
+# ===========================================================================================
+#   CORBA SUPPORT
+
+USE_CORBA = @USE_CORBA@
+
+MCFLAGS = @CFLAGS@ -Wall -Wunused
+
+MICO_DIR = @MICO_DIR@
+ifeq ($(MICO_DIR), default)
+MICO_INC = -I../../packages/mico/include
+MICO_PATH = ../../bin/linux/
+else
+ifeq ($(MICO_DIR), yes)
+MICO_INC =
+MICO_PATH =
+else
+MICO_INC = -I$(MICO_DIR)
+MICO_PATH =
+endif
+endif
+MINCLUDES = -I. -I../../lib -I../recpt  -I$(INDEXERS_DIR)/mgpp/text $(MICO_INC)
+
+MCOMPILE = $(MICO_PATH)mico-c++ -x c++ $(MCFLAGS) $(DEFS) $(MINCLUDES) -c
+
+.SUFFIXES: .mpp .o
+.mpp.o:
+	$(MCOMPILE) $<
+
+ifneq ($(USE_CORBA), 0)
+CORBAHEADERS = corbaServer.h
+CORBASOURCES = corbaServer.mpp
+CORBAOBJECTS = corbaServer.o ../../lib/corbaiface_skel.o
+else
+CORBAHEADERS = 
+CORBASOURCES = 
+CORBAOBJECTS = 
+endif
+
+# ===========================================================================================
Index: /gsdl/trunk/src/corba/corbaServer.mpp
===================================================================
--- /gsdl/trunk/src/corba/corbaServer.mpp	(revision 15459)
+++ /gsdl/trunk/src/corba/corbaServer.mpp	(revision 15459)
@@ -0,0 +1,491 @@
+// Standard headers
+#include <iostream.h>
+#include <fstream.h>
+
+// protocol headers
+#include "corbaiface.h"
+using namespace gsdlInterface;
+
+#include "corbaconv_text_t.h"
+
+// library headers
+#include "fileutil.h"
+//#include "gsdlhome.h"
+
+// greenstone headers
+#include "comtypes.h"
+#include "recptproto.h"
+#include "nullproto.h"
+
+// local headers
+#include "corbatext_t.h"
+
+void corbatext_setToCorbaArray(text_tset set, corbatext_tset *cset);
+void corbatext_corbaArrayToSet(corbatext_tset cset, text_tset *set);
+void corbatext_mapToCorbaMap(text_tmap map, corbatext_tmap *tm);
+void corbaresponse_resultDocInfoToCorba(ResultDocInfo_tarray docinfo, corbaResultDocInfo_array &corbainfo);
+
+void corbaresponse_termInfoToCorba(TermInfo_tarray terminfo, corbaTermInfo_array &corbainfo) {
+  TermInfo_tarray::iterator here = terminfo.begin();
+  TermInfo_tarray::iterator end  = terminfo.end();
+  unsigned int i;
+	
+  i = 0;
+
+  while (here != end) 
+    {
+      corbainfo.length(i+1);
+      
+      corbainfo[i].frequency = here->freq;
+      corbaconv_text_t::getCorbatext(here->term,corbainfo[i].term);
+      corbatext_arrayToCorbaArray(here->matchTerms, &corbainfo[i].matchTerms);
+
+      i ++;
+      here ++;
+    }
+  cout << "Terminfo " << i << endl;
+}
+
+void corbatext_optionValueArrayToC(corbaOptionValue_array corba, OptionValue_tarray &array)
+{
+  unsigned int i = 0;
+  OptionValue_t option;
+
+  for (i = 0; i < corba.length(); i ++)
+    {
+      corbaconv_text_t::setCorbatext(option.name,corba[i].name);
+      corbaconv_text_t::setCorbatext(option.value,corba[i].value);
+
+      // cout << corbatext_string(corba[i].name) << "?" << option
+
+      array.push_back(option);
+    }
+}
+
+class corbaServer : virtual public corbaiface_skel
+{
+private:
+  text_tarray collections;
+  recptproto *protocol;
+  text_t      gsdlhome;
+
+  void openLogfile(text_t extension, ofstream &out)
+  {
+    char *cfilename;
+    text_t filename;
+
+    filename = filename_cat(gsdlhome, extension);
+    cfilename = filename.getcstr();
+
+    out.open(cfilename);
+    delete cfilename;
+  }
+
+public:
+  corbaServer(recptproto *protocol, text_t home)
+  { 
+    text_t dirname;
+    char * cdirname;
+
+    cout << "CorbaServer: gsdlhome = " << home << endl;
+
+    this->gsdlhome = home;
+    cout << gsdlhome.getcstr() << endl;
+    dirname = filename_cat(gsdlhome, "/collect");
+    cdirname = dirname.getcstr();
+    if (!read_dir (cdirname, collections)) {
+      cout << "Unable to read the gsdl directory; terminating" << endl;
+      exit (1);
+    }
+    delete cdirname;
+
+    cout << "Constructing set list server" << endl;
+    this->protocol = protocol;
+
+  }
+  
+  CORBA::Boolean initialise(corbaComError &err) 
+  {
+      ofstream      logout;
+      int           reply;
+      comerror_t    error = noError;
+
+      this->openLogfile("/etc/corbaout.txt", logout);
+      reply = protocol->init(error, logout);
+      logout.close();
+      return (reply != 0 ? 1 : 0);
+    }
+
+  void configure(const corbatext_t &corbaKey, const corbatext_tarray &corbaCfgline,corbaComError &err)
+    {
+      text_t        key;
+      text_tarray   cfgline;
+      comerror_t    error = noError;
+
+      corbaconv_text_t::setCorbatext(key,corbaKey);
+      corbatext_corbaArrayToArray(corbaCfgline, &cfgline);
+
+
+      // ****
+      cout << "Recieved " << key << " = ";
+      for (int unsigned i=0; i<cfgline.size(); i++)
+	{
+	  cout << cfgline[i] << " ";
+	}
+      cout << endl;
+
+      // DB // ****
+      if (key=="gsdlhome")
+	{  
+	  text_tarray cfgline;
+	  cfgline.push_back (gsdlhome);
+	  cout << "Changing gsdlhome to " << gsdlhome << endl;
+	  protocol->configure(key, cfgline, error);
+	}
+      else if (key=="httpdomain")
+	{
+	  // Only let gsdlhome through !!!! // ****
+	  cout << "Supressing httpdomain" << endl;
+	}
+      else if (key=="httpprefix")
+	{
+	  cout << "Supressing httpprefix" << endl;
+	}
+      else
+	{ 
+	  protocol->configure(key, cfgline,error);
+	}
+    }
+
+  void hasCollection(const corbatext_t &corbaCollect, CORBA::Boolean &has,
+                     corbaComError &error) {
+    // do nowt!
+    corbaconv_text_t *cct;
+    bool    _has;
+    comerror_t err = noError;
+    ofstream logout;
+
+    this->openLogfile("/etc/corbaout.txt", logout);
+
+    cct = new corbaconv_text_t(corbaCollect);
+
+    cout << "Collection: " << cct->getcstr() << endl;
+
+    protocol->has_collection(*cct, _has, err, logout); // 'cct' typecast to text_t
+    if (_has)
+      { 
+	has = 1;
+      }
+    else
+      {
+	has = 0;
+      }
+
+    // cout << "  " << has << endl;
+
+    delete cct;
+
+    error = corbaNoError;
+    logout.close();
+  }
+
+  void ping(const struct corbatext_t &corbaCollect, CORBA::Boolean &wasSuccess, corbaComError &corbaError)
+  { 
+    text_t collection;
+    bool   success;
+    comerror_t error = noError;
+    ofstream logout;
+
+    this->openLogfile("/etc/corbaout.txt", logout);
+
+    corbaconv_text_t::setCorbatext(collection,corbaCollect);
+    protocol->ping(collection, success, error, logout);
+
+    corbaError = (corbaComError) error;
+    wasSuccess = (CORBA::Boolean) success;
+    logout.close();
+  }
+
+  void filter(const struct corbatext_t &corbaCollect,
+	      const struct corbaFilterRequest &corbaRequest,
+	      struct corbaFilterResponse &corbaResponse,
+	      corbaComError &corbaError)
+  {
+    // variables for action
+    FilterRequest_t request;
+    FilterResponse_t response;
+    comerror_t       error = noError;
+    text_t           collection;
+    ofstream         logout;
+
+    this->openLogfile("/etc/corbaout.txt", logout);
+
+    // copy collection id
+    corbaconv_text_t::setCorbatext(collection,corbaCollect);
+
+    // copy request values
+    corbaconv_text_t::setCorbatext(request.filterName,corbaRequest.filter);
+    corbatext_optionValueArrayToC(corbaRequest.filterOptions, request.filterOptions);
+    corbatext_corbaArrayToArray(corbaRequest.docSet, &request.docSet);
+    request.filterResultOptions = corbaRequest.filterResultOptions;
+    corbaconv_text_t::setCorbatext(request.requestParams,corbaRequest.requestParams);
+    corbaconv_text_t::setCorbatext(request.refParams,corbaRequest.refParams);
+    corbatext_corbaArrayToSet(corbaRequest.fields, &request.fields);
+    request.getParents = corbaRequest.getParents;
+
+    protocol->filter(collection, request, response, error, logout);
+
+    // copy response values
+    corbaResponse.numDocs = response.numDocs;
+    corbaResponse.isApprox = (::gsdlInterface::corbaIsApprox) response.isApprox;
+    corbaresponse_termInfoToCorba(response.termInfo, corbaResponse.termInfo);
+    corbaresponse_resultDocInfoToCorba(response.docInfo, corbaResponse.docInfo);
+
+    // tidy up variables
+    logout.close();
+    corbaError = (corbaComError) error;
+    cout << "Filter prepared" << corbaResponse.docInfo.length() << "," << corbaResponse.numDocs << endl;
+  }
+
+  void getCollectInfo(const struct corbatext_t &corbaCollect,
+                      corbaColInfoResponse &corbaResponse,
+                      corbaComError &corbaError)
+  {
+    ColInfoResponse_t response;
+    comerror_t       error = noError;
+    text_t           collection;
+    ofstream logout;
+
+    this->openLogfile("/etc/corbaout.txt", logout);
+
+    corbaconv_text_t::setCorbatext(collection,corbaCollect);
+    protocol->get_collectinfo(collection, response, error, logout);
+
+    cout << "IsPublic  = " << ((response.isPublic)?"True":"False") << endl;
+    cout << "IsBeta    = " << ((response.isBeta)  ?"True":"False") << endl;
+    cout << "BuildDate = " << response.buildDate << endl;
+    cout << "NumDocs   = " << response.numDocs << endl;
+    cout << "NumBytes  = " << response.numBytes << endl;
+    cout << "NumWords  = " << response.numWords << endl;
+    cout << "UseBook   = " << ((response.useBook)  ?"True":"False") << endl;
+    
+    corbaResponse.useBook   = response.useBook;
+    corbaResponse.isPublic  = response.isPublic;
+    corbaResponse.isBeta    = response.isBeta;
+    corbaResponse.buildDate = response.buildDate;
+    corbatext_arrayToCorbaArray(response.languages, &corbaResponse.languages);
+    corbatext_arrayToCorbaArray(response.ccsCols, &corbaResponse.ccsCols);
+    corbaResponse.numDocs   = response.numDocs;
+    corbaResponse.numBytes  = response.numBytes;
+    corbaResponse.numWords  = response.numWords;
+
+    corbatext_mapToCorbaMap(response.collectionmeta, &corbaResponse.collectionMeta);
+    corbatext_mapToCorbaMap(response.format, &corbaResponse.format);
+    corbatext_mapToCorbaMap(response.building, &corbaResponse.building);
+    corbaconv_text_t::getCorbatext(response.httpdomain,corbaResponse.httpdomain);
+
+    corbaconv_text_t::getCorbatext(response.httpprefix,corbaResponse.httpprefix);
+    corbaconv_text_t::getCorbatext(response.receptionist,corbaResponse.receptionist);
+
+    /* text_tmap::iterator f_here = response.format.begin();
+    text_tmap::iterator f_end = response.format.end();
+    while (f_here!=f_end)
+    {
+      cout << "**** format: " << f_here->first << " = " << f_here->second << endl;
+      f_here++;
+    } 
+    */ // ****
+
+    logout.close();
+    corbaError = (corbaComError) error;
+  }
+
+  void getFilterOptions(const struct corbatext_t &corbaCollect,
+			const struct corbatext_t &corbaFilterName,
+			struct corbaFilterOptionsResponse &corbaResponse,
+			enum corbaComError &corbaError)
+  {   
+    text_t collection;
+    InfoFilterOptionsRequest_t request;
+    InfoFilterOptionsResponse_t response;
+    comerror_t error = noError;
+    unsigned int i;
+    ofstream logout;
+
+    this->openLogfile("/etc/corbaout.txt", logout);
+
+    corbaconv_text_t::setCorbatext(collection,corbaCollect);
+    corbaconv_text_t::setCorbatext(request.filterName,corbaFilterName);
+    protocol->get_filteroptions(collection, request, response, error, logout);
+
+    // decode filters back into corba format
+    FilterOption_tmap::iterator here = response.filterOptions.begin();
+    FilterOption_tmap::iterator end = response.filterOptions.end();
+    i = 0;
+    while (here != end)
+      {
+	// set array for name/options to be one bigger
+	corbaResponse.names.length(i+1);
+	corbaResponse.options.length(i+1);
+
+	// get left-hand side of map
+	corbaconv_text_t::getCorbatext((*here).first,corbaResponse.names[i]);
+	
+	// get right-hand side of map
+	corbaconv_text_t::getCorbatext((*here).second.name,corbaResponse.options[i].name);
+	corbaResponse.options[i].type = 
+	  (::gsdlInterface::corbaFilterType)(*here).second.type;
+	corbaResponse.options[i].repeatable = 
+	  (::gsdlInterface::corbaFilterRepeatable)(*here).second.repeatable;
+	corbaconv_text_t::getCorbatext((*here).second.defaultValue,corbaResponse.options[i].defaultValue);
+	corbatext_arrayToCorbaArray((*here).second.validValues, &corbaResponse.options[i].validValues);
+
+	// take next iterators
+	i++;
+	here ++;
+      }
+
+    logout.close();
+    corbaError = (corbaComError) error;
+  }
+
+  void getFilterInfo(const struct corbatext_t &corbaCollect, 
+		     corbatext_tarray &filterNames, 
+		     enum corbaComError &corbaError)
+  { text_tarray ta;
+    comerror_t error = noError;
+    text_t collection;    
+    InfoFiltersResponse_t response;
+    ofstream logout;
+
+    this->openLogfile("/etc/corbaout.txt", logout);
+
+    corbaconv_text_t::setCorbatext(collection,corbaCollect);
+    cout << collection.getcstr() << endl;
+			    
+    protocol->get_filterinfo(collection, response, error, logout);
+    corbatext_setToCorbaArray(response.filterNames, &filterNames);
+
+    corbaError = (corbaComError) error;
+    logout.close();
+  }
+  
+  void getDocument(const struct corbatext_t &corbaCollection, struct corbaDocRequest &corbaRequest, 
+		   struct corbaDocResponse &corbaResponse,  enum corbaComError &corbaError)
+  { DocumentRequest_t request;
+    DocumentResponse_t response;
+    comerror_t         error = noError;
+    text_t             collection;
+    ofstream logout;
+
+    this->openLogfile("/etc/corbaout.txt", logout);
+
+    // set up request
+    corbaconv_text_t::setCorbatext(collection,corbaCollection);
+    corbaconv_text_t::setCorbatext(request.OID,corbaRequest.OID);
+    corbaconv_text_t::setCorbatext(request.docType,corbaRequest.docType);
+    corbaconv_text_t::setCorbatext(request.docFormat,corbaRequest.docFormat);
+
+    // do actual get document
+    protocol->get_document(collection, request, response, error, logout);
+    corbaconv_text_t::getCorbatext(response.doc,corbaResponse.doc);
+
+    // decode response
+    corbaError = (corbaComError) error;
+
+    logout.close();
+  }
+
+  void collectionList(corbatext_tarray &corbalist, corbaComError &error)
+  {
+    /* stringSeq *reply;
+    unsigned int i;
+    char *istring; */
+
+    text_tarray collist;
+    comerror_t  err;
+    ofstream logout;
+
+    cout << "Received collection list request" << endl;
+
+    this->openLogfile("/etc/corbaout.txt", logout);
+
+    protocol->get_collection_list(collist, err, logout);
+
+    /*    reply = new stringSeq(collections.size());
+    
+    (*reply).length(collections.size());
+    for (i = 0; i < collections.size(); i ++)
+      {
+	istring = collections[i].getcstr();
+	(*reply)[i] = CORBA::string_dup(istring);
+	delete istring;
+      }
+    
+    return reply;
+    */
+
+    corbatext_arrayToCorbaArray(collist, &corbalist);
+    cout << "Replying " << collist.size() << ": " << endl;
+
+    for (int unsigned i = 0; i < collist.size(); i ++)
+      {
+	cout << collist[i];
+	if (i<collist.size()-1) cout << ", ";
+      }
+    cout << endl;
+
+    logout.close();
+    // CORBA::string_dup(_listString);
+  }
+};
+
+int main (int argc, char *argv[])
+{
+  nullproto protocol;
+  collectset *cservers;
+  text_t     gsdlhome;
+
+  cservers = new collectset(gsdlhome);
+  protocol.set_collectset(cservers);
+
+  cout << "Started Corba ..." << endl;
+
+  // ORB initialization
+  CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "mico-local-orb" );
+  CORBA::BOA_var boa = orb->BOA_init( argc, argv, "mico-local-boa" );
+
+  cout << "Initialised ORB and BOA" << endl;
+
+  corbaServer* server = new corbaServer(&protocol, gsdlhome);
+
+  cout << "Initialised server" << endl;
+
+  CORBA::String_var ref = orb->object_to_string( server );
+
+  cout << "Mapped Corba object to string" << endl;
+
+  // write id to "naming service"
+  ofstream out ("/tmp/localcorba.objid");
+	if (out.is_open()) {
+		out << ref << endl;
+		if (out.fail() || out.bad()) {
+			cout << "Failed " << endl;
+		}
+		out.close ();
+	}
+	else {
+		cout << "Unable to write string to file /tmp/localcorba.objid" << endl;
+		cout << "Please check the file permissions/ownership" << endl;
+		return 0;
+	}
+  cout << "Corba string is " << ref << endl;
+
+  // indicate readiness and run
+  boa->impl_is_ready( CORBA::ImplementationDef::_nil() );
+  orb->run ();
+  CORBA::release( server );
+  return 0;
+}
+
+
