Index: main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.cpp	(revision 24114)
+++ main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.cpp	(revision 27528)
@@ -29,5 +29,4 @@
 #include <stdlib.h>
 #include "fileutil.h"
-
 
 /**
@@ -211,4 +210,36 @@
     }
   }
+  else if (key == "oaisupercollection" && cfgline.size() > 1) {
+
+    // Configure a hierarchical super set
+    // The line should read 
+    //
+    // oaisupercollection <setName> [collections part of this set]
+    //
+    // Records in specified collections will be advertised as being part 
+    // of the SetName set as well as their collectionName set
+    //
+    // This configuration should only appear in oai.cfg
+    //
+    if (this->collection != "") {
+      cerr << "Attempt to configure an oai super collection outside of oai.cfg" << endl;
+      cerr << "Configuration attempted in " << this->collection << " collection." << endl;
+      exit(1);
+    }
+    
+    text_t super_set = cfgline[0];
+    this->superCollectList.push_back(super_set);
+    this->superCollectMap[super_set] = new oaisupercollectconfig(super_set);
+    for (int c = 1; c < cfgline.size(); ++c) {
+      text_t sub_coll = cfgline[c];
+      // Add the collection into the list for this supercoll
+      this->superCollectMap[super_set]->collectionList.push_back(sub_coll);
+      // Add the super coll into the list for the collection
+      if (this->collectMap[sub_coll]== NULL) {
+	this->collectMap[sub_coll] = new oaicollectconfig(sub_coll);
+      }
+      this->collectMap[sub_coll]->superCollectList.push_back(super_set);
+    }
+  }
   else if (key == "oaimetadata" && cfgline.size() >= 1) {
     // List of metadata prefixes to suuport
@@ -274,11 +305,20 @@
     }
     if (value != "") {
-      if (this->collectMap[coll_name] == NULL) {
-	this->collectMap[coll_name] = new oaicollectconfig(coll_name);
-      }
-      if (key == "oaisetname") {
-	this->collectMap[coll_name]->setName = value;
-      } else if (key == "oaisetdescription") {
-	this->collectMap[coll_name]->setDescription = value;
+      // check first for super collection
+      if (this->superCollectMap[coll_name] != NULL) {
+	if (key == "oaisetname") {
+	  this->superCollectMap[coll_name]->setName = value;
+	} else if (key == "oaisetdescription") {
+	  this->superCollectMap[coll_name]->setDescription = value;
+	}
+      } else {
+	if (this->collectMap[coll_name] == NULL) {
+	  this->collectMap[coll_name] = new oaicollectconfig(coll_name);
+	}
+	if (key == "oaisetname") {
+	  this->collectMap[coll_name]->setName = value;
+	} else if (key == "oaisetdescription") {
+	  this->collectMap[coll_name]->setDescription = value;
+	}
       }
     }
@@ -418,19 +458,46 @@
 text_t oaiconfig::getSetName(const text_t &setSpec)
 {
-  if (this->collectMap[setSpec] == NULL) {
-    return "" ;
-  }
+  if (this->collectMap[setSpec] != NULL) {
+    this->collectMap[setSpec]->setName;
+  }
+  if (this->superCollectMap[setSpec] != NULL) {
+    return this->superCollectMap[setSpec]->setName;
+  }
+  return "" ;
   
-  return this->collectMap[setSpec]->setName;
+}
+
+text_t oaiconfig::getSetDescription(const text_t &setSpec)
+{
+  if (this->collectMap[setSpec] != NULL) {
+  return this->collectMap[setSpec]->setDescription;
+  }
+  if (this->superCollectMap[setSpec] != NULL) {
+    return this->superCollectMap[setSpec]->setDescription;
+  }
   
-}
-
-text_t oaiconfig::getSetDescription(const text_t &setSpec)
-{
-  if (this->collectMap[setSpec] == NULL) {
-    return "" ;
-  }
+  return "" ;
   
-  return this->collectMap[setSpec]->setDescription;
-}
-
+}
+
+text_tarray oaiconfig::getSuperCollectionsForThisCollection(const text_t &collection) {
+
+  text_tarray super_colls;
+  if (this->superCollectList.size() == 0) {
+    return super_colls;
+  }
+
+  for (int s = 0; s < this->superCollectList.size(); s++) {
+    text_tarray colls = this->superCollectMap[this->superCollectList[s]]->collectionList;
+    for (int c = 0; c < colls.size(); c++)
+    {
+      if (colls[c] == collection)
+      {
+	super_colls.push_back(this->superCollectList[s]);
+	break;
+      }
+    }
+  }
+   
+  return super_colls;
+}
