Index: lib/xalan/xalan.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/xalan/xalan.jar
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: lib/xalan/xml-apis.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/xalan/xml-apis.jar
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: lib/style/skins/knp/map.css
===================================================================
--- lib/style/skins/knp/map.css	(revision 3033)
+++ lib/style/skins/knp/map.css	(nonexistent)
@@ -1,104 +0,0 @@
- /*
-  *   '$RCSfile$'
-  *     Purpose: Default style sheet for KNB project web pages 
-  *              Using this stylesheet rather than placing styles directly in 
-  *              the KNB web documents allows us to globally change the 
-  *              formatting styles of the entire site in one easy place.
-  *   Copyright: 2000 Regents of the University of California and the
-  *               National Center for Ecological Analysis and Synthesis
-  *     Authors: Matt Jones
-  *
-  *    '$Author$'
-  *      '$Date$'
-  *  '$Revision$'
-  *
-  * This program is free software; you can redistribute it and/or modify
-  * it under the terms of the GNU General Public License as published by
-  * the Free Software Foundation; either version 2 of the License, or
-  * (at your option) any later version.
-  *
-  * This program is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  * GNU General Public License for more details.
-  *
-  * You should have received a copy of the GNU General Public License
-  * along with this program; if not, write to the Free Software
-  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-  */
-#mapContainer {
-    position: absolute;
-    right: 0px;
-    top: 0px;
-		 /*
-    width: 290px;
-	*/
-}
-
-#mapControl {
-	height: 48px;
-	width: 31px;
-}
-
-div#mapControlHide,
-div#mapControlShow {
-	width: 100%;
-	height: 100%;
-	vertical-align: center;
-}
-
-div#mapControl a {
-	display: block;
-	margin: 0; padding:0;
-	width:100%;
-	height:100%;
-	overflow:hidden;
-}
-
-
-div#mapControlShow {
-	background: transparent url(/knp/style/skins/knp/images/show_map.gif) no-repeat bottom left;
-	/*
-	background: transparent url(http://nebulous.msi.ucsb.edu:8080/geoserver/data/mbdemos/demo/metacat_wfs/show_map.gif) no-repeat bottom left;
-	*/
-}
-
-div#mapControlHide {
-	background: transparent url(/knp/style/skins/knp/images/hide_map.gif) no-repeat bottom left;
-	/*
-	background: transparent url(http://nebulous.msi.ucsb.edu:8080/geoserver/data/mbdemos/demo/metacat_wfs/hide_map.gif) no-repeat bottom left;
-	*/
-}
-
-div#mapControlShow a {
-	background: transparent url(/knp/style/skins/knp/images/show_map.gif) no-repeat top left;
-	/*
-	background: transparent url(http://nebulous.msi.ucsb.edu:8080/geoserver/data/mbdemos/demo/metacat_wfs/show_map.gif) no-repeat top left;
-	*/
-}
-div#mapControlHide a {
-	background: transparent url(/knp/style/skins/knp/images/hide_map.gif) no-repeat top left;
-	/*
-	background: transparent url(http://nebulous.msi.ucsb.edu:8080/geoserver/data/mbdemos/demo/metacat_wfs/hide_map.gif) no-repeat top left;
-	*/
-}
-div#mapControlShow a:hover,
-div#mapControlHide a:hover {
-	background:none;
-	text-decoration: none;
-}
-
-/*
-div#mapControlShow a {
-	background: #efefef url(http://nebulous.msi.ucsb.edu:8080/geoserver/data/mbdemos/demo/metacat_wfs/left_arrow.gif) no-repeat center center;
-}
-div#mapControlHide a {
-	background: #efefef url(http://nebulous.msi.ucsb.edu:8080/geoserver/data/mbdemos/demo/metacat_wfs/right_arrow.gif) no-repeat center center;
-}
-
-div#mapControlShow a:hover,
-div#mapControlHide a:hover {
-	background-color: #e0e0e0 ;
-	text-decoration: none;
-}
-*/

Property changes on: lib/style/skins/knp/map.css
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/default/default.js
===================================================================
--- lib/style/skins/default/default.js	(revision 3033)
+++ lib/style/skins/default/default.js	(revision 3034)
@@ -100,6 +100,9 @@
 var LOGINBOX_URL
   = "@style-skins-path@/default/include_login.jsp";
 
+var MAP_URL
+  = "@style-skins-path@/default/include_map.jsp";
+
 //  Location of the header that will be displayed at the top of the page
 var LEFTCOL_URL 
   = "";
@@ -143,6 +146,9 @@
 //(metacat only) advanced search box iframe class
 var IFRAME_ADVANCED_SEARCHBOX_CLASS = "iframeadvancedsearchboxclass";
 
+// Interactive Map
+var IFRAME_MAP_CLASS            = "iframemapclass";
+
 //(metacat only) login box iframe class
 var IFRAME_LOGINBOX_CLASS      = "iframeloginboxclass";
 
Index: lib/style/skins/default/index.jsp
===================================================================
--- lib/style/skins/default/index.jsp	(revision 3033)
+++ lib/style/skins/default/index.jsp	(revision 3034)
@@ -48,8 +48,12 @@
 	  insertTemplateOpening();
 	  insertSearchBox();
   </script>
-  </br>
+  <br/>
   <script language="javascript">
+	  insertMap();
+  </script>
+  <br/>
+  <script language="javascript">
 	  insertLoginBox();
   </script>
   <script language="javascript">
Index: lib/style/skins/default/default.css
===================================================================
--- lib/style/skins/default/default.css	(revision 3033)
+++ lib/style/skins/default/default.css	(revision 3034)
@@ -56,6 +56,13 @@
     margin:   0px;
 }
 
+.iframemapclass {
+    height:   570px; 
+    width:    100%;
+    border:   0px;
+    margin:   0px;
+}
+
 .iframeloginboxclass {
     height:   250px; 
     width:    100%;
Index: lib/style/skins/default/include_map.jsp
===================================================================
--- lib/style/skins/default/include_map.jsp	(nonexistent)
+++ lib/style/skins/default/include_map.jsp	(revision 3034)
@@ -0,0 +1,72 @@
+<%@ page     language="java" %>
+<!--
+/**
+  *  '$RCSfile$'
+  *      Authors:     Matthew Perry
+  *      Copyright:   2005 University of New Mexico and
+  *                   Regents of the University of California and the
+  *                   National Center for Ecological Analysis and Synthesis
+  *      For Details: http://www.nceas.ucsb.edu/
+  *
+  *   '$Author$'
+  *     '$Date$'
+  * '$Revision$'
+  * 
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+  * the Free Software Foundation; either version 2 of the License, or
+  * (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software
+  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+  *
+  */
+-->
+<%@ include file="settings.jsp"%>
+<%@ include file="session_vars.jsp"%>
+<!-- *********************** START Map ************************* -->
+<html>
+<head>
+  <title>Metacat Data Catalog Map</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+  <link href="<%=relativeRoot%>/default.css" rel="stylesheet" type="text/css">
+
+  <script language="javascript" 
+    type="text/javascript" src="<%=relativeRoot%>/default.js">
+  </script>
+</head>
+<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
+  <table width="750px" align="center" cellspacing="0" cellpadding="0" >
+    <tr> 
+      <td width="10" align="right" valign="top">
+        <img src="<%=relativeRoot%>/images/panelhead_bg_lcorner.gif" 
+          width="10" height="21">
+      </td>
+      <td class="sectionheader">
+        Data Catalog Map
+      </td>
+      <td width="10" align="left" valign="top"> 
+        <img src="<%=relativeRoot%>/images/panelhead_bg_rcorner.gif" 
+          width="10" height="21">
+      </td>
+    </tr>
+    <tr>       
+      <td colspan="3">
+        <table width="100%" cellspacing="0" cellpadding="0" border="0" class="subpanel">
+          <tr><td> 
+           <iframe frameborder="0" width="750" height="520" src="<%=relativeRoot%>/../../common/spatial_templates/spatial1/map.html"> You need iframe support </iframe>
+          </td></tr>
+         </table>
+      </td>
+    </tr>
+  </table>
+</body>
+</html>
+
+

Property changes on: lib/style/skins/default/include_map.jsp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/style/skins/knp/index.jsp
===================================================================
--- lib/style/skins/knp/index.jsp	(revision 3033)
+++ lib/style/skins/knp/index.jsp	(revision 3034)
@@ -25,6 +25,23 @@
   */
 %>
 <%@ include file="../../common/common-settings.jsp"%>
+<%@ include file="../../common/map-settings.jsp"%>
+<% 
+
+//SPATIAL_MAP = "knp";
+SPATIAL_TEMPLATE = "basic_layers";
+
+/* Construct Web Map URL
+String mapUrl = SPATIAL_BASE_URL + 
+                "?map=" + SPATIAL_MAP + 
+                "&template=" + SPATIAL_TEMPLATE +
+                "&client=" + SPATIAL_CLIENT;
+ */
+
+//String mapUrl = "@systemidserver@/@context@/spatial/mapbuilder/demo/metacat_knp/pma.html";
+
+String mapUrl = "@systemidserver@/@context@/style/skins/knp/spatial/pma.html";
+%>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
@@ -39,6 +56,7 @@
 </head>
 <body>
 <script language="JavaScript">
+
 function getMapFrame() {
 	return document.getElementById('mapFrame');
 }
@@ -45,6 +63,7 @@
 insertTemplateOpening();
 insertSearchBox();
 </script>
+
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr><td colspan="1" style="padding-right:60px">
 <p>
@@ -178,8 +197,13 @@
 </p>
   </td>
   <td class="mapColumn" rowspan="2" style="vertical-align:top">
-	<iframe src="http://dataknp.sanparks.org/geoserver/data/mbdemos/demo/metacat_wfs/pma.html" class="mapFrame" 
-	id="mapFrame" name="mapFrame" marginheight="0" marginwidth="0" border="0" framespacing="0" hspace="0" vspace="0" frameborder="0" scrolling="no">Your browser does not support the iframe tag. &lt;a href="http://dataknp.sanparks.org/geoserver/data/mbdemos/demo/metacat_wfs/pma.html" target="_blank"&gt;This content&lt;/a&gt; should have been displayed at this location</iframe>
+	<iframe src="<%=mapUrl%>" class="mapFrame" 
+	id="mapFrame" name="mapFrame" marginheight="0" marginwidth="0" border="0" 
+	framespacing="0" hspace="0" vspace="0" frameborder="0" scrolling="no">
+	  Your browser does not support the iframe tag. 
+	  &lt;a href="<%=mapUrl%>" target="_blank"&gt;
+	  This content&lt;/a&gt; should have been displayed at this location
+	</iframe>
   </td></tr>
   <tr><td>
     <p>
Index: lib/style/skins/dev/devtools.html
===================================================================
--- lib/style/skins/dev/devtools.html	(revision 3033)
+++ lib/style/skins/dev/devtools.html	(revision 3034)
@@ -12,6 +12,7 @@
       <li><a href="validate.html">validate a doc</a></li>
       <li><a href="replControl.html">replication control</a></li>
       <li><a href="querymetacat.html">query the db</a></li>
+      <li><a href="map.jsp">map interface</a></li>
     </ul>
   </body>
 </html>
Index: lib/style/common/branding.js
===================================================================
--- lib/style/common/branding.js	(revision 3033)
+++ lib/style/common/branding.js	(revision 3034)
@@ -159,7 +159,20 @@
 
 }
 
+
 /**
+ *  inserts the header referenced by the SEARCHBOX_URL setting
+ */
+function insertMap() { 
+
+  if (!_isBlank(MAP_URL)) {
+
+    _createIFrameWithURL(MAP_URL, IFRAME_MAP_CLASS);
+  }
+
+}
+
+/**
  *  inserts the header referenced by the ADVANCED_SEARCHBOX_URL setting
  */
 function insertAdvancedSearchBox() { 
Index: lib/metacat.properties
===================================================================
--- lib/metacat.properties	(revision 3033)
+++ lib/metacat.properties	(revision 3034)
@@ -222,3 +222,20 @@
 ValidateHarvestListSuccess=Success validating harvest list,Debug
 
 # End of Harvester properties
+
+
+# BEGIN spatial options
+runSpatialOption=true
+regenerateCacheOnRestart=true
+
+# XML paths to the four bounding coordinates
+# these paths must be included in your indexPaths variable in build.properties
+# these are the defaults for EML and have not been tested with other schemas
+westBoundingCoordinatePath=geographicCoverage/boundingCoordinates/westBoundingCoordinate
+eastBoundingCoordinatePath=geographicCoverage/boundingCoordinates/eastBoundingCoordinate
+southBoundingCoordinatePath=geographicCoverage/boundingCoordinates/southBoundingCoordinate
+northBoundingCoordinatePath=geographicCoverage/boundingCoordinates/northBoundingCoordinate
+
+metacatUrl=@systemidserver@@servlet-path@
+baseUrl=@systemidserver@@html-path@
+# END spatial options
Index: src/spatial/cpp/metacat_shapefile.cpp
===================================================================
--- src/spatial/cpp/metacat_shapefile.cpp	(revision 3033)
+++ src/spatial/cpp/metacat_shapefile.cpp	(revision 3034)
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
-#include "iostream.h"
+#include "iostream"
 #include <fstream>
 #include <string>
 #include <vector>
@@ -117,7 +117,7 @@
       hSHPHandle = SHPCreate( pszFilename, nSHPType );
 
        ii = 0;
-       for ( ii = 0; ii < number_data_lines; ii++ )
+       for ( ii = 0; ii < number_data_lines_x; ii++ )
        {
          double area_coef = sqrt( pow((max_pntx[2][ii]-min_pntx[2][ii]),2) + pow((max_pnty[2][ii]-min_pnty[2][ii]),2)  );
          double ave_x = ( (min_pntx[2][ii]+max_pntx[2][ii])/2 );
@@ -124,6 +124,8 @@
          double ave_y = ( (min_pnty[2][ii]+max_pnty[2][ii])/2 );
          double ave_z = ( pointz[2][ii] );
 
+         cout << "area coef: " << area_coef << endl;
+
          if (ave_x < 180 && ave_x > -180 && ave_y < 90 && ave_y >-90 ) {
 
          psShape = SHPCreateObject( SHPT_POINT, ii, 0, NULL, NULL, 1, &ave_x, &ave_y, &ave_z, NULL );
@@ -132,7 +134,7 @@
          SHPDestroyObject( psShape );
          //do the update to the dbf file too
          iRecord = DBFGetRecordCount( hDBF );
-
+ 
         DBFWriteStringAttribute(hDBF, iRecord, url_field, urlvec[ii].c_str() );
         DBFWriteStringAttribute(hDBF, iRecord, docid_field, docidvec[ii].c_str() );
         DBFWriteIntegerAttribute(hDBF, iRecord, id_field, int(ii) );
Index: src/edu/ucsb/nceas/metacat/MetaCatUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatUtil.java	(revision 3033)
+++ src/edu/ucsb/nceas/metacat/MetaCatUtil.java	(revision 3034)
@@ -53,7 +53,7 @@
     
     public static HashMap skinconfigs = new HashMap();
 
-    private static Options options = null;
+    private static edu.ucsb.nceas.utilities.Options options = null;
 
     private static boolean debug = true;
     
@@ -74,6 +74,7 @@
         } catch (Exception e) {
             System.err.println("Error in MetaCatUtil static block:"
                     + e.getMessage());
+            e.printStackTrace();
         }
 
         // read administrator and moderator lists from metacat.properties
@@ -111,8 +112,11 @@
     public static String getOption(String optionName)
     {
         if (options == null) {
-            options = Options.getInstance();
+            options = edu.ucsb.nceas.utilities.Options.getInstance();
         }
+        if (options == null) {
+        	MetaCatUtil.printMessage("options is null");
+        }
         String value = options.getOption(optionName);
         return value;
     }
@@ -125,7 +129,7 @@
     public static void setOption(String optionName, String newValue)
     {
         if (options == null) {
-            options = Options.getInstance();
+            options = edu.ucsb.nceas.utilities.Options.getInstance();
         }
         options.setOption(optionName, newValue);
         
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 3033)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 3034)
@@ -70,10 +70,7 @@
 import com.oreilly.servlet.multipart.Part;
 
 import edu.ucsb.nceas.utilities.Options;
-import edu.ucsb.nceas.metacat.spatial.MetacatSpatialQuery;
-import edu.ucsb.nceas.metacat.spatial.MetacatSpatialDocument;
-import edu.ucsb.nceas.metacat.spatial.MetacatSpatialDataset;
-import edu.ucsb.nceas.metacat.spatial.MetacatSpatialConstants;
+import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
 
 /**
  * A metadata catalog server implemented as a Java Servlet
@@ -207,20 +204,29 @@
                 MetaCatUtil.skinconfigs.put(skinName, skinOption);
             }
 
+            /*
+             *  If spatial option is turned on and set to regenerate the
+             *  spatial cache on restart, trigger the harvester 
+             */
+            if ( MetaCatUtil.getOption("runSpatialOption").equals("true") &&
+                 MetaCatUtil.getOption("regenerateCacheOnRestart").equals("true") ) {
 
-	if (MetacatSpatialConstants.runSpatialOption == true ) {	    
-        
-	    // create a spatial index of the database
-            MetacatSpatialConstants.setServerContext(MetaCatUtil.getOption("server"));
-            MetacatSpatialQuery  _spatialQuery = new MetacatSpatialQuery();
-            
-            // issue the query  -- using the geographic bounds of the Earth
-            MetacatSpatialDataset _data = _spatialQuery.queryDatasetByCartesianBounds(-180, -90, 180, 90);
-            
-            // write the data to the appropriate theme 
-            _data.writeMetacatSpatialCache();
-	 
-	}
+                // Begin timer
+                long before = System.currentTimeMillis();
+                 
+                // regenerate the entire spatial cache
+                // may be expensive with many documents
+                SpatialHarvester sh = new SpatialHarvester();
+                sh.regenerate();
+                sh.destroy();
+
+                // End timer
+                long after = System.currentTimeMillis();
+                MetaCatUtil.printMessage(" ------ Spatial Harvester Time  " + (after - before) + "ms");
+
+	    } else {
+                MetaCatUtil.printMessage(" \n **** Spatial cache is not set to regenerate on restart");
+            }
            
            
             MetaCatUtil.printMessage("Metacat (" + Version.getVersion()
@@ -782,9 +788,8 @@
                                     String sess_id) {
       
       Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
-      //MBJDELETED MetacatSpatialQuery _spatialQuery = new MetacatSpatialQuery();
 
-	if (MetacatSpatialConstants.runSpatialOption == false ) {
+	if ( !MetaCatUtil.getOption("runSpatialOption").equals("true") ) {
         	response.setContentType("text/html");
         	out.println("<html> Metacat Spatial Option is turned off <html>");
         	out.close();
@@ -791,7 +796,7 @@
 		return ;
 	}		
       
-      MetacatSpatialQuery _spatialQuery = new MetacatSpatialQuery();
+      //MetacatSpatialQuery _spatialQuery = new MetacatSpatialQuery();
       
       
       // switch -- html/xml print
@@ -2298,6 +2303,12 @@
                     out.println("Document deleted.");
                     out.println("</success>");
                     logMetacat.info("Document deleted.");
+
+                    // Delete from spatial cache
+                    SpatialHarvester sh = new SpatialHarvester();
+                    sh.addToDeleteQue( MetaCatUtil.getSmartDocId( docid[0] ) );
+                    sh.destroy();
+
                 }
                 catch (AccessionNumberException ane) {
                     response.setContentType("text/xml");
Index: src/edu/ucsb/nceas/metacat/DocumentImpl.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 3033)
+++ src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 3034)
@@ -51,6 +51,7 @@
 import java.util.Vector;
 
 import edu.ucsb.nceas.dbadapter.AbstractDatabase;
+import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
 
 import org.apache.log4j.Logger;
 import org.xml.sax.ContentHandler;
@@ -124,6 +125,7 @@
     protected long rootnodeid;
     private ElementNode rootNode = null;
     private TreeSet nodeRecordList = null;
+
     
     private static Logger logMetacat = Logger.getLogger(DocumentImpl.class);
 
@@ -1338,6 +1340,13 @@
         }
         
     	logMetacat.warn("BuildIndex complete for docid " + docid);
+
+        // Adds the docid to the spatial data cache 
+        SpatialHarvester spatialHarvester = new SpatialHarvester();
+        logMetacat.warn(" --------- Attempting to update the spatial cache for docid " + docid );
+        spatialHarvester.addToUpdateQue(docid);
+        spatialHarvester.destroy();
+        
     }
 
     /**
@@ -2880,6 +2889,15 @@
        // add force delete replcation document here.
        ForceReplicationHandler frh = new ForceReplicationHandler(
                         accnum, ForceReplicationHandler.DELETE, isXML, notifyServer);
+
+       // Deletes the docid from the spatial data cache 
+       /* MPTODO : getting "non-static variable cannot be reffered to from a static context" error
+       SpatialHarvester spatialHarvester = new SpatialHarvester();
+       logMetacat.warn(" --------- Attempting to delete the spatial cache for docid " + docid );
+       spatialHarvester.addToDeleteQue(docid);
+       spatialHarvester.destroy();
+       */
+
     }
 
     private static String getDocTypeFromDB(DBConnection conn, String docidWithoutRev)
Index: src/edu/ucsb/nceas/metacat/DocumentImplWrapper.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentImplWrapper.java	(revision 3033)
+++ src/edu/ucsb/nceas/metacat/DocumentImplWrapper.java	(revision 3034)
@@ -39,7 +39,7 @@
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.XMLReaderFactory;
 
-import edu.ucsb.nceas.metacat.spatial.MetacatSpatialDocument;
+//import edu.ucsb.nceas.metacat.spatial.MetacatSpatialDocument;
 
 /**
  * This class a wrapper class for documentimpl for insert or update. It will 
@@ -70,10 +70,6 @@
                       String action, String docid, String user, String[] groups)
                       throws Exception
   {
-    
-    //jhh register this transaction with the Metacat Spatial Option
-    MetacatSpatialDocument msdoc = new MetacatSpatialDocument(docid);
-    
     return DocumentImpl.write(conn, xml, pub, dtd, action, docid, user, 
                               groups, ruleBase, needValidation);
   }
Index: src/edu/ucsb/nceas/metacat/DBQuery.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 3033)
+++ src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 3034)
@@ -59,11 +59,6 @@
 import edu.ucsb.nceas.morpho.datapackage.Triple;
 import edu.ucsb.nceas.morpho.datapackage.TripleCollection;
 
-import edu.ucsb.nceas.metacat.spatial.MetacatSpatialQuery;
-import edu.ucsb.nceas.metacat.spatial.PersistentMetacatSpatialDataset;
-import edu.ucsb.nceas.metacat.spatial.MetacatSpatialDataset;
-import edu.ucsb.nceas.metacat.spatial.MetacatSpatialDocument;
-import edu.ucsb.nceas.metacat.spatial.MetacatSpatialConstants;
 
 /**
  * A Class that searches a relational DB for elements and attributes that have
@@ -392,11 +387,6 @@
                                       throws Exception
     {
       
-      MetacatSpatialDataset metacatSpatialData = null; 
-      
-if (MetacatSpatialConstants.runSpatialOption == true  ) {
-        metacatSpatialData = new MetacatSpatialDataset(); 
-}  
       int offset = 1;
       // this is a hack for offset
       if (out == null)
@@ -456,33 +446,6 @@
       while (tableHasRows)
       {
         docid = rs.getString(1).trim();
-        //if ( METACAT_SPATIAL ) {
-	if (MetacatSpatialConstants.runSpatialOption == true  ) {
-          System.out.println("###################################################");
-          System.out.println("###################################################");
-          System.out.println("###################################################");
-          System.out.println("###################################################");
-          System.out.println("###################################################");
-          System.out.println("################ " + docid + " ####################");
-          
-          // make sure that the spatial dataset is initialized
-          MetacatSpatialQuery spatialQuery = new  MetacatSpatialQuery();
-          
-          // create the spatial document 
-          MetacatSpatialDocument msdoc = spatialQuery.getSpatialDocument(docid);
-
-          // add the spatial document to the spatial dataset
-          metacatSpatialData.add(msdoc);
-
-          // write the persistent spatial dataset
-          //////metacatSpatialData.write();
-          
-          System.out.println("###################################################");
-          System.out.println("###################################################");
-          System.out.println("###################################################");
-          System.out.println("###################################################");
-          System.out.println("###################################################");
-        }
         docname = rs.getString(2);
         doctype = rs.getString(3);
         createDate = rs.getString(4);
@@ -658,10 +621,12 @@
 
      
      //write the persistent spatial dataset
+     /*
 	 if(metacatSpatialData != null){
 		metacatSpatialData.writeTextQueryData();
 	 }
-	
+      */
+
      return resultsetBuffer;
     }//findReturnDoclist
 
Index: build.properties
===================================================================
--- build.properties	(revision 3033)
+++ build.properties	(revision 3034)
@@ -110,10 +110,14 @@
 compile.optimize=true
 
 # paths to be indexed when document is inserted. these are the paths which will be searched often
-indexPaths=organizationName,originator/individualName/surName,originator/individualName/givenName,originator/organizationName,creator/individualName/surName,creator/individualName/givenName,creator/organizationName,dataset/title,keyword,northBoundingCoordinate,southBoundingCoordinate,westBoundingCoordinate,eastBoundingCoordinate,title,entityName,individualName/surName,abstract/para,surName,givenName,para,geographicDescription,literalLayout,eastbc,northbc,westbc,southbc,dataset/access/allow/principal,entityName,taxonRankValue,dataset/dataTable/physical/distribution/online/url,dataset/spatialRaster/physical/distribution/online/url,@packageId,/reviewHistory/review/packageId,EcogridRegEntry/description,EcogridRegEntry/serviceName,EcogridRegEntry/endPoint,associatedParty/individualName/surName,associatedParty/organizationName,coverage/temporalCoverage/singleDateTime/alternativeTimeScale/timeScaleName,coverage/temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale/timeScaleName,coverage/temporalCoverage/rangeOfDates/endDate/alternativeTimeScale/timeScaleName
+indexPaths=organizationName,originator/individualName/surName,originator/individualName/givenName,originator/organizationName,creator/individualName/surName,creator/individualName/givenName,creator/organizationName,dataset/title,keyword,geographicCoverage/boundingCoordinates/northBoundingCoordinate,geographicCoverage/boundingCoordinates/southBoundingCoordinate,geographicCoverage/boundingCoordinates/westBoundingCoordinate,geographicCoverage/boundingCoordinates/eastBoundingCoordinate,eastBoundingCoordinate,title,entityName,individualName/surName,abstract/para,surName,givenName,para,geographicDescription,literalLayout,eastbc,northbc,westbc,southbc,dataset/access/allow/principal,entityName,taxonRankValue,dataset/dataTable/physical/distribution/online/url,dataset/spatialRaster/physical/distribution/online/url,@packageId,/reviewHistory/review/packageId,EcogridRegEntry/description,EcogridRegEntry/serviceName,EcogridRegEntry/endPoint,associatedParty/individualName/surName,associatedParty/organizationName,coverage/temporalCoverage/singleDateTime/alternativeTimeScale/timeScaleName,coverage/temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale/timeScaleName,coverage/temporalCoverage/rangeOfDates/endDate/alternativeTimeScale/timeScaleName
 
 # Flag to install ecogird or not. Possible values are true or false
 install.ecogrid=false
+
+# Flag to install and enable spatial metacat options
+install.spatial=true
+
 # The metacat current dir's abolute value. If you set install.ecogrid=false, this variable
 #  do NOT need to be configured
 metacat.dir=/home/tao/project/metacat
Index: build.xml
===================================================================
--- build.xml	(revision 3033)
+++ build.xml	(revision 3034)
@@ -48,6 +48,11 @@
   <condition property="enable.ecogrid">
     <equals arg1="${install.ecogrid}" arg2="true" />
   </condition>
+
+  <!-- Determine if geoserver and spatial options are to be enabled   -->
+  <condition property="enable.spatial">
+    <equals arg1="${install.spatial}" arg2="true" />
+  </condition>
 	
   <target name="check-db">
     <condition property="use-oracle">
@@ -159,7 +164,14 @@
           <include name="msbase.jar"/>
           <include name="msutil.jar"/>
           <include name="mssqlserver.jar"/>
+       </fileset>
+
+        <!-- Include geoserver, geotools, et. al. -->
+        <fileset dir="lib/spatial/geoserver/WEB-INF/lib">
+          <include name="*.jar"/>
         </fileset>
+        <pathelement location="lib/spatial/geoserver/WEB-INF/classes"/>
+
        </path>
       
       <!-- It is less likely you'll need to make any changes from here down,
@@ -770,6 +782,58 @@
       </sql>
    </target>
 
+   <target name="install-spatial" depends="jar,clientjar,harvesterjar" if="enable.spatial"
+           description="Installs spatial option for metacat">
+
+      <property name="spatial.dir" value="./lib/spatial"/>
+      <property name="spatial.geoserver.dir" value="${spatial.dir}/geoserver"/>
+      <property name="spatial.webinf-mods" value="${spatial.dir}/WEB-INF"/>
+
+      <!-- Copy geoserver libs into ${war.lib} -->
+      <copy todir="${war.lib}" filtering="no">
+        <fileset dir="${spatial.geoserver.dir}/WEB-INF/lib">
+          <include name="**"/>
+        </fileset>
+      </copy>
+
+      <!-- Copy everything in geoservers WEB-INF (except the libs) into ${war.webinf} -->
+      <copy todir="${war.webinf}" filtering="no">
+        <fileset dir="${spatial.geoserver.dir}/WEB-INF">
+          <exclude name="lib/**"/>
+          <exclude name="web.xml"/>
+        </fileset>
+      </copy>
+
+      <!-- Copy the rest of the geoserver codebase into ${war.context} -->
+      <copy todir="${war.context}" filtering="no">
+        <fileset dir="${spatial.geoserver.dir}">
+          <exclude name="WEB-INF/**"/>
+          <exclude name="index.jsp"/>
+        </fileset>
+      </copy>
+
+      <!-- Copy the geoserver index.jsp but rename it to avoid conflicting w/metcat   -->
+     <copy file="${spatial.geoserver.dir}/WEB-INF/pages/index.jsp"
+          tofile="${war.context}/geoserver.jsp"
+          overwrite="true"
+          filtering="no"/>
+
+      <!-- Copy the geoserver/metacat combined web.xml into ${build.war}/web.xml   -->
+      <copy file="${spatial.webinf-mods}/web.xml.combined"
+          tofile="${build.war}/web.xml"
+          overwrite="true"
+          filtering="no"/>
+
+      <!-- Copy the rest of the modified geoserver web-inf files
+      <copy todir="${war.webinf}" filtering="no">
+        <fileset dir="${spatial.webinf-mods}">
+          <exclude name="web.xml.combined"/>
+        </fileset>
+      </copy> -->
+
+    </target>
+
+
    <target name="install" depends="install-ecogrid" description="* Full Install *">
        <mkdir dir="${datafilepath}" />
        <mkdir dir="${inlinedatafilepath}" />
@@ -927,7 +991,7 @@
       <echo message="Install Skin completed." />
    </target>
 
-   <target name="war" depends="warPrepare,warMSSQL"
+   <target name="war" depends="warPrepare,warMSSQL,install-spatial"
             description="Create a web archive (WAR) for servlet deployment">
        <mkdir dir="${dist.dir}" />
        <war destfile="${dist.dir}/${metacat.context}.war"
@@ -996,6 +1060,8 @@
            <exclude name="lsid_conf/**"/>
            <exclude name="LiveMap_30/**"/>
            <exclude name="skin.configs/**"/>
+           <exclude name="spatial/geoserver/**"/>
+           <exclude name="spatial/WEB-INF/**"/>
          </fileset>
        </copy>
    </target>
