Index: /greenstone3/trunk/src/java/org/greenstone/gsdl3/service/GS2MGRetrieve.java
===================================================================
--- /greenstone3/trunk/src/java/org/greenstone/gsdl3/service/GS2MGRetrieve.java	(revision 14430)
+++ /greenstone3/trunk/src/java/org/greenstone/gsdl3/service/GS2MGRetrieve.java	(revision 14431)
@@ -35,8 +35,7 @@
 
 public class GS2MGRetrieve
-    extends AbstractGS2DocumentRetrieve
-{
-   static Logger logger = Logger.getLogger(org.greenstone.gsdl3.service.GS2MGRetrieve.class.getName());
-
+extends AbstractGS2DocumentRetrieve {
+    static Logger logger = Logger.getLogger (org.greenstone.gsdl3.service.GS2MGRetrieve.class.getName ());
+    
     // Elements used in the config file that are specific to this class
     private static final String DEFAULT_INDEX_ELEM = "defaultIndex";
@@ -45,65 +44,66 @@
     private static final String DEFAULT_INDEX_SUBCOLLECTION_ELEM = "defaultIndexSubcollection";
     private static final String DEFAULT_INDEX_LANGUAGE_ELEM = "defaultIndexLanguage";
-  
-    private MGWrapper mg_src = null;
+    
+    private MGRetrieveWrapper mg_src = null;
+//    private MGWrapper mg_src = null;
+    
     private String mg_basedir = null;
     private String mg_textdir = null;
     private String default_index = null;
     private boolean has_default_index = false;
-	
-    public GS2MGRetrieve() {
-	this.mg_src = new MGWrapper();
+    
+    public GS2MGRetrieve () {
+        this.mg_src = new MGRetrieveWrapper ();
     }
-
-    public void cleanUp() {
-	super.cleanUp();
-	this.mg_src.unloadIndexData();
+    
+    public void cleanUp () {
+        super.cleanUp ();
+        this.mg_src.unloadIndexData ();
     }
-
+    
     /** configure this service */
-    public boolean configure(Element info, Element extra_info)
-    {
-	if (!super.configure(info, extra_info)){
-	    return false;
-	}
-	
-	// Do specific configuration
-	logger.info("Configuring GS2MGRetrieve...");
-	
-	// Get the default index out of <defaultIndex> (buildConfig.xml)
-	Element def = (Element) GSXML.getChildByTagName(info, DEFAULT_INDEX_ELEM);
-	if (def != null) {
-	    this.default_index = def.getAttribute(GSXML.SHORTNAME_ATT);
-	}
-         Element defSub = (Element) GSXML.getChildByTagName(info, DEFAULT_INDEX_SUBCOLLECTION_ELEM); 
-	if (defSub != null) {
-	    this.default_index += defSub.getAttribute(GSXML.SHORTNAME_ATT);
-	    logger.info("default indexSubcollection is "+defSub.getAttribute(GSXML.SHORTNAME_ATT));      
-	} //concate defaultIndex + defaultIndexSubcollection
-
-	//get the default indexLanguage out of <defaultIndexLanguage> (buildConfig.xml)
-        Element defLang = (Element) GSXML.getChildByTagName(info, DEFAULT_INDEX_LANGUAGE_ELEM); 
-	if (defLang != null) {
-	    this.default_index += defLang.getAttribute(GSXML.SHORTNAME_ATT);
-            logger.info("default indexLanguage is "+defLang.getAttribute(GSXML.SHORTNAME_ATT)); 
-	} //concate defaultIndex + defaultIndexSubcollection + defaultIndexLanguage
-     
-
-	if (this.default_index == null || this.default_index.equals("")) {
-             logger.error("default index is not specified, the content of a document will not be retrieved");
-              has_default_index = false;
-	      return true;
-	    //}
-	}
-	logger.debug("Default index: " + this.default_index);
-       
-	// The location of the MG index and text files
-	mg_basedir = GSFile.collectionBaseDir(this.site_home, this.cluster_name) + File.separatorChar;  // Needed by MG
-	mg_textdir = GSFile.collectionTextPath(this.index_stem);
-	// index is only needed to start up MG, not used so just use the default index
-	String indexpath = GSFile.collectionIndexPath(this.index_stem, this.default_index);
-	this.mg_src.setIndex(indexpath);
-	has_default_index = true;
-	return true;
+    public boolean configure (Element info, Element extra_info) {
+        if (!super.configure (info, extra_info)){
+            return false;
+        }
+        
+        // Do specific configuration
+        logger.info ("Configuring GS2MGRetrieve...");
+        
+        // Get the default index out of <defaultIndex> (buildConfig.xml)
+        Element def = (Element) GSXML.getChildByTagName (info, DEFAULT_INDEX_ELEM);
+        if (def != null) {
+            this.default_index = def.getAttribute (GSXML.SHORTNAME_ATT);
+        }
+        Element defSub = (Element) GSXML.getChildByTagName (info, DEFAULT_INDEX_SUBCOLLECTION_ELEM);
+        if (defSub != null) {
+            this.default_index += defSub.getAttribute (GSXML.SHORTNAME_ATT);
+            logger.info ("default indexSubcollection is "+defSub.getAttribute (GSXML.SHORTNAME_ATT));
+        } //concate defaultIndex + defaultIndexSubcollection
+        
+        //get the default indexLanguage out of <defaultIndexLanguage> (buildConfig.xml)
+        Element defLang = (Element) GSXML.getChildByTagName (info, DEFAULT_INDEX_LANGUAGE_ELEM);
+        if (defLang != null) {
+            this.default_index += defLang.getAttribute (GSXML.SHORTNAME_ATT);
+            logger.info ("default indexLanguage is "+defLang.getAttribute (GSXML.SHORTNAME_ATT));
+        } //concate defaultIndex + defaultIndexSubcollection + defaultIndexLanguage
+        
+        
+        if (this.default_index == null || this.default_index.equals ("")) {
+            logger.error ("default index is not specified, the content of a document will not be retrieved");
+            has_default_index = false;
+            return true;
+            //}
+        }
+        logger.debug ("Default index: " + this.default_index);
+        
+        // The location of the MG index and text files
+        mg_basedir = GSFile.collectionBaseDir (this.site_home, this.cluster_name) + File.separatorChar;  // Needed by MG
+        mg_textdir = GSFile.collectionTextPath (this.index_stem);
+        // index is only needed to start up MG, not used so just use the default index
+        String indexpath = GSFile.collectionIndexPath (this.index_stem, this.default_index);
+        this.mg_src.setIndex (indexpath);
+        has_default_index = true;
+        return true;
     }
     
@@ -112,37 +112,37 @@
      * <nodeContent>text content or other elements</nodeContent>
      */
-    protected Element getNodeContent(String doc_id, String lang) throws GSException {
-	long doc_num = this.gdbm_src.OID2Docnum(doc_id);
-	if (doc_num == -1) {
-	    logger.error("OID "+doc_id +" couldn't be converted to mg num");
-	    return null;
-	}
-	Element content_node = this.doc.createElement(GSXML.NODE_CONTENT_ELEM);
-	
-         
-	String doc_content = null;
-
-        //means that this.mg_src is up and running  
-	if (has_default_index ){
-            doc_content =  this.mg_src.getDocument(this.mg_basedir,
-				  	     this.mg_textdir, doc_num);
-	}
- 
-	if (doc_content!=null) {
-	    // remove any ctrl-c or ctrl-b 
-	    doc_content = doc_content.replaceAll("\u0002|\u0003", "");
-	    // replace _httpimg_ with the correct address
-	    doc_content = resolveTextMacros(doc_content, doc_id, lang);
-	    //GSXML.addDocText(this.doc, doc, doc_content);
-	} else {
-	    logger.error("the doc content was null, not getting that section\n");
-	    doc_content = "couldn't retrieve content for this section, please check the log file for more detail\n";
-	}
-	Text t = this.doc.createTextNode(doc_content);
-	content_node.appendChild(t);
-	return content_node;
-
+    protected Element getNodeContent (String doc_id, String lang) throws GSException {
+        long doc_num = this.gdbm_src.OID2Docnum (doc_id);
+        if (doc_num == -1) {
+            logger.error ("OID "+doc_id +" couldn't be converted to mg num");
+            return null;
+        }
+        Element content_node = this.doc.createElement (GSXML.NODE_CONTENT_ELEM);
+        
+        
+        String doc_content = null;
+        
+        //means that this.mg_src is up and running
+        if (has_default_index ){
+            doc_content =  this.mg_src.getDocument (this.mg_basedir,
+            this.mg_textdir, doc_num);
+        }
+        
+        if (doc_content!=null) {
+            // remove any ctrl-c or ctrl-b
+            doc_content = doc_content.replaceAll ("\u0002|\u0003", "");
+            // replace _httpimg_ with the correct address
+            doc_content = resolveTextMacros (doc_content, doc_id, lang);
+            //GSXML.addDocText(this.doc, doc, doc_content);
+        } else {
+            logger.error ("the doc content was null, not getting that section\n");
+            doc_content = "couldn't retrieve content for this section, please check the log file for more detail\n";
+        }
+        Text t = this.doc.createTextNode (doc_content);
+        content_node.appendChild (t);
+        return content_node;
+        
     }
-
-
+    
+    
 }
