Index: /main/trunk/greenstone2/runtime-src/src/colservr/Makefile.in
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/colservr/Makefile.in	(revision 31387)
+++ /main/trunk/greenstone2/runtime-src/src/colservr/Makefile.in	(revision 31388)
@@ -145,4 +145,5 @@
 	collectserver.cpp \
 	collectset.cpp \
+	colservertools.cpp \
         colservrconfig.cpp \
 	comtypes.cpp \
@@ -169,4 +170,5 @@
 	collectserver.o \
 	collectset.o \
+	colservertools.o \
         colservrconfig.o \
 	comtypes.o \
Index: /main/trunk/greenstone2/runtime-src/src/colservr/browsefilter.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/colservr/browsefilter.cpp	(revision 31387)
+++ /main/trunk/greenstone2/runtime-src/src/colservr/browsefilter.cpp	(revision 31388)
@@ -25,4 +25,5 @@
 
 #include "browsefilter.h"
+#include "colservertools.h"
 #include "fileutil.h"
 #include <assert.h>
@@ -87,5 +88,6 @@
   }
 
-  db_filename = resolve_db_filename(indexstem,db_ptr->getfileextension());
+  db_filename = resolve_db_filename(gsdlhome, dbhome, collecthome, collection,
+				    indexstem,db_ptr->getfileextension());
   if (!file_exists(db_filename)) {
     logout << text_t2ascii
@@ -94,5 +96,6 @@
   }
 
-  oaidb_filename = resolve_oaidb_filename(oaidb_ptr->getfileextension());
+  oaidb_filename = resolve_oaidb_filename(gsdlhome, dbhome, collecthome, collection,
+					  oaidb_ptr->getfileextension());
 
   return true;
Index: /main/trunk/greenstone2/runtime-src/src/colservr/filter.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/colservr/filter.cpp	(revision 31387)
+++ /main/trunk/greenstone2/runtime-src/src/colservr/filter.cpp	(revision 31388)
@@ -61,57 +61,4 @@
 }
 
-text_t filterclass::getcollectionpath()
-{
-  text_t resolved_filename;
-  
-  if (gsdlhome==dbhome) {
-    // dbhome has defaulted to gsdlhome which we take to means the 
-    // database has been specifically moved out of gsdlhome area.
-    // => it should be whereever collecthome is set to
-    resolved_filename = filename_cat(collecthome, collection);
-  }
-  else {
-    // dbhome is explicitly set to something other than gsdlhome
-    // => use dbhome
-    resolved_filename = filename_cat(dbhome, "collect", collection);
-  }
-
-  return resolved_filename;
-}
-
-text_t filterclass::resolve_db_filename(const text_t& idx,
-					const text_t& file_ext)
-{
-  /*
-  text_t resolved_filename;
-
-  if (gsdlhome==dbhome) {
-    // dbhome has defaulted to gsdlhome which we take to means the 
-    // database has been specifically moved out of gsdlhome area.
-    // => it should be whereever collecthome is set to
-    resolved_filename = filename_cat(collecthome, collection, "index", "text", idx);
-  }
-  else {
-    // dbhome is explicitly set to something other than gsdlhome
-    // => use dbhome
-    resolved_filename = filename_cat(dbhome, "collect", collection, "index", "text", idx);
-  }
-  */
-  
-  text_t resolved_filename = filename_cat(getcollectionpath(), "index", "text", idx);
-  resolved_filename += file_ext;
-
-  return resolved_filename;
-}
-
-text_t filterclass::resolve_oaidb_filename(const text_t& file_ext)
-{
-  text_t resolved_filename = filename_cat(getcollectionpath(), "etc", "oai-inf");
-
-  resolved_filename += file_ext;
-
-  return resolved_filename;
-}
-
 
 // init should be called after all the configuration is done but
Index: /main/trunk/greenstone2/runtime-src/src/colservr/filter.h
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/colservr/filter.h	(revision 31387)
+++ /main/trunk/greenstone2/runtime-src/src/colservr/filter.h	(revision 31388)
@@ -66,9 +66,4 @@
 		       FilterResponse_t &response,
 		       comerror_t &err, ostream &logout);
-
- protected:
-  text_t resolve_db_filename(const text_t& idx,const text_t& file_ext);
-  text_t resolve_oaidb_filename(const text_t& file_ext);
-  text_t getcollectionpath();
 
 };
Index: /main/trunk/greenstone2/runtime-src/src/colservr/queryfilter.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/colservr/queryfilter.cpp	(revision 31387)
+++ /main/trunk/greenstone2/runtime-src/src/colservr/queryfilter.cpp	(revision 31388)
@@ -25,4 +25,5 @@
 
 #include "queryfilter.h"
+#include "colservertools.h"
 #include "fileutil.h"
 
@@ -253,5 +254,6 @@
     indexstem = collection;
   }
-  db_filename = resolve_db_filename(indexstem,db_ptr->getfileextension());
+  db_filename = resolve_db_filename(gsdlhome, dbhome, collecthome, collection,
+				    indexstem,db_ptr->getfileextension());
   if (!file_exists(db_filename)) {
     logout << text_t2ascii
Index: /main/trunk/greenstone2/runtime-src/src/colservr/source.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/colservr/source.cpp	(revision 31387)
+++ /main/trunk/greenstone2/runtime-src/src/colservr/source.cpp	(revision 31388)
@@ -25,4 +25,5 @@
 
 #include "source.h"
+#include "colservertools.h"
 #include "fileutil.h"
 #include "OIDtools.h"
@@ -88,67 +89,4 @@
 }
 
-text_t sourceclass::getcollectionpath()
-{
-  text_t resolved_filename;
-  
-  if (gsdlhome==dbhome) {
-    // dbhome has defaulted to gsdlhome which we take to means the 
-    // database has been specifically moved out of gsdlhome area.
-    // => it should be whereever collecthome is set to
-    resolved_filename = filename_cat(collecthome, collection);
-  }
-  else {
-    // dbhome is explicitly set to something other than gsdlhome
-    // => use dbhome
-    resolved_filename = filename_cat(dbhome, "collect", collection);
-  }
-
-  return resolved_filename;
-}
-
-text_t sourceclass::resolve_db_filename(const text_t& idx,
-					const text_t& file_ext)
-{
-  // This is an exact copy of the method (of the same name) in filterclass
-  // Makes sense to merge them, in which either gsdlhome, collecthome,
-  // dbhome, and collection need to also be passed in as parameters,
-  // or else there is some notion of a shared base class that both
-  // filter and source inherit from
-
-  // NB: there is an even greater opportunity to share more code in this
-  // function if sql_db_ptr/db_ptr and db_filename and sql_db_filename
-  // are also drawn from one object
-
-  /*
-  text_t resolved_filename;
-
-  if (gsdlhome==dbhome) {
-    // dbhome has defaulted to gsdlhome which we take to means the 
-    // database has been specifically moved out of gsdlhome area.
-    // => it should be whereever collecthome is set to
-
-    resolved_filename = filename_cat(collecthome, collection, "index", "text", idx);
-  }
-  else {
-    // dbhome is explicitly set to something other than gsdlhome
-    // => use dbhome
-    resolved_filename = filename_cat(dbhome, "collect", collection, "index", "text", idx);
-  }
-  */
-
-  text_t resolved_filename = filename_cat(getcollectionpath(), "index", "text", idx);
-  resolved_filename += file_ext;
-
-  return resolved_filename;
-}
-
-text_t sourceclass::resolve_oaidb_filename(const text_t& file_ext)
-{
-  text_t resolved_filename = filename_cat(getcollectionpath(), "etc", "oai-inf");
-
-  resolved_filename += file_ext;
-
-  return resolved_filename;
-}
 
 // init should be called after all the configuration is done but
@@ -204,5 +142,6 @@
     indexstem = collection;
   }
-  db_filename = resolve_db_filename(indexstem, db_ptr->getfileextension());
+  db_filename = resolve_db_filename(gsdlhome, dbhome, collecthome, collection,
+				    indexstem, db_ptr->getfileextension());
   if (!file_exists(db_filename)) {
     logout << text_t2ascii
@@ -211,5 +150,6 @@
   }
   
-  oaidb_filename = resolve_oaidb_filename(oaidb_ptr->getfileextension());
+  oaidb_filename = resolve_oaidb_filename(gsdlhome, dbhome, collecthome, collection,
+					  oaidb_ptr->getfileextension());
 
   return true;
Index: /main/trunk/greenstone2/runtime-src/src/colservr/source.h
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/colservr/source.h	(revision 31387)
+++ /main/trunk/greenstone2/runtime-src/src/colservr/source.h	(revision 31388)
@@ -109,10 +109,4 @@
   virtual bool is_searchable(bool &issearchable, comerror_t &err, ostream &logout);
 
- protected:
-  text_t resolve_db_filename(const text_t& idx,
-			     const text_t& file_ext);
-  text_t resolve_oaidb_filename(const text_t& file_ext);
-  text_t getcollectionpath();
-
 };
 
Index: /main/trunk/greenstone2/runtime-src/src/colservr/sqlfilter.cpp
===================================================================
--- /main/trunk/greenstone2/runtime-src/src/colservr/sqlfilter.cpp	(revision 31387)
+++ /main/trunk/greenstone2/runtime-src/src/colservr/sqlfilter.cpp	(revision 31388)
@@ -26,4 +26,5 @@
 
 #include "fileutil.h"
+#include "colservertools.h"
 #include "sqlfilter.h"
 
@@ -67,5 +68,6 @@
 
   // get the filename for the database and make sure it exists
-  sql_db_filename = resolve_db_filename(indexstem,sql_db_ptr->getfileextension());
+  sql_db_filename = resolve_db_filename(gsdlhome, dbhome, collecthome, collection,
+					indexstem,sql_db_ptr->getfileextension());
   if (!file_exists(sql_db_filename))
   {
