[metacat-cvs] metacat/src/spatial/cpp metacat_shapefile.cpp
Mathew Perry
perry at ecoinformatics.org
Thu Aug 31 16:37:13 PDT 2006
perry 06/08/31 16:37:13
Modified: . build.properties build.xml
lib metacat.properties
lib/style/common branding.js
lib/style/skins/default default.css default.js index.jsp
lib/style/skins/dev devtools.html
lib/style/skins/knp index.jsp
src/edu/ucsb/nceas/metacat DBQuery.java DocumentImpl.java
DocumentImplWrapper.java MetaCatServlet.java
MetaCatUtil.java
src/spatial/cpp metacat_shapefile.cpp
Added: lib/style/skins/default include_map.jsp
Removed: lib/style/skins/knp map.css
lib/xalan xalan.jar xml-apis.jar
Log:
initial import of changes to metacat source and config files to support spatial option
Revision Changes Path
1.25 +5 -1 metacat/build.properties
Index: build.properties
===================================================================
RCS file: /cvs/metacat/build.properties,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- build.properties 6 Jun 2006 17:23:46 -0000 1.24
+++ build.properties 31 Aug 2006 23:37:12 -0000 1.25
@@ -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, at 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/timeScal
eName,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, at packageId,/reviewHistory/review/packageId,EcogridRegEntry/description,EcogridRegEntry/serviceName,EcogridRegEntry/endPoint,associatedParty/individualName/surName,associat
edParty/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
1.252 +69 -3 metacat/build.xml
Index: build.xml
===================================================================
RCS file: /cvs/metacat/build.xml,v
retrieving revision 1.251
retrieving revision 1.252
diff -u -r1.251 -r1.252
--- build.xml 18 Aug 2006 21:36:25 -0000 1.251
+++ build.xml 31 Aug 2006 23:37:12 -0000 1.252
@@ -6,9 +6,9 @@
* National Center for Ecological Analysis and Synthesis
* For Details: http://www.nceas.ucsb.edu/
*
- * '$Author: sgarg $'
- * '$Date: 2006/08/18 21:36:25 $'
- * '$Revision: 1.251 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:12 $'
+ * '$Revision: 1.252 $'
*
* Build file for the Ant cross-platform build system for metacat
* See http://jakarta.apache.org for details on Ant
@@ -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>
1.110 +18 -1 metacat/lib/metacat.properties
Index: metacat.properties
===================================================================
RCS file: /cvs/metacat/lib/metacat.properties,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- metacat.properties 17 Jul 2006 18:10:37 -0000 1.109
+++ metacat.properties 31 Aug 2006 23:37:12 -0000 1.110
@@ -4,7 +4,7 @@
# Matt Jones, Dan Higgins, Jivka Bojilova
-# '$Id: metacat.properties,v 1.109 2006/07/17 18:10:37 sgarg Exp $'
+# '$Id: metacat.properties,v 1.110 2006/08/31 23:37:12 perry Exp $'
#
@@ -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
1.7 +16 -3 metacat/lib/style/common/branding.js
Index: branding.js
===================================================================
RCS file: /cvs/metacat/lib/style/common/branding.js,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- branding.js 2 Mar 2006 06:40:02 -0000 1.6
+++ branding.js 31 Aug 2006 23:37:13 -0000 1.7
@@ -8,9 +8,9 @@
* National Center for Ecological Analysis and Synthesis
* Authors: Matt Jones
*
- * '$Author: jones $'
- * '$Date: 2006/03/02 06:40:02 $'
- * '$Revision: 1.6 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.7 $'
*
* 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
@@ -159,6 +159,19 @@
}
+
+/**
+ * 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
*/
1.6 +10 -3 metacat/lib/style/skins/default/default.css
Index: default.css
===================================================================
RCS file: /cvs/metacat/lib/style/skins/default/default.css,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- default.css 16 Nov 2005 18:34:08 -0000 1.5
+++ default.css 31 Aug 2006 23:37:13 -0000 1.6
@@ -8,9 +8,9 @@
* National Center for Ecological Analysis and Synthesis
* Authors: Matt Jones
*
- * '$Author: costa $'
- * '$Date: 2005/11/16 18:34:08 $'
- * '$Revision: 1.5 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.6 $'
*
* 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
@@ -56,6 +56,13 @@
margin: 0px;
}
+.iframemapclass {
+ height: 570px;
+ width: 100%;
+ border: 0px;
+ margin: 0px;
+}
+
.iframeloginboxclass {
height: 250px;
width: 100%;
1.4 +9 -3 metacat/lib/style/skins/default/default.js
Index: default.js
===================================================================
RCS file: /cvs/metacat/lib/style/skins/default/default.js,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- default.js 16 Nov 2005 18:32:40 -0000 1.3
+++ default.js 31 Aug 2006 23:37:13 -0000 1.4
@@ -7,9 +7,9 @@
* National Center for Ecological Analysis and Synthesis
* Authors: Matt Jones
*
- * '$Author: costa $'
- * '$Date: 2005/11/16 18:32:40 $'
- * '$Revision: 1.3 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.4 $'
*
* 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
@@ -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";
1.3 +8 -4 metacat/lib/style/skins/default/index.jsp
Index: index.jsp
===================================================================
RCS file: /cvs/metacat/lib/style/skins/default/index.jsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- index.jsp 21 Nov 2003 23:05:53 -0000 1.2
+++ index.jsp 31 Aug 2006 23:37:13 -0000 1.3
@@ -6,9 +6,9 @@
* National Center for Ecological Analysis and Synthesis
* For Details: http://www.nceas.ucsb.edu/
*
- * '$Author: brooke $'
- * '$Date: 2003/11/21 23:05:53 $'
- * '$Revision: 1.2 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.3 $'
*
* 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
@@ -48,7 +48,11 @@
insertTemplateOpening();
insertSearchBox();
</script>
- </br>
+ <br/>
+ <script language="javascript">
+ insertMap();
+ </script>
+ <br/>
<script language="javascript">
insertLoginBox();
</script>
1.1 metacat/lib/style/skins/default/include_map.jsp
Index: include_map.jsp
===================================================================
<%@ page language="java" %>
<!--
/**
* '$RCSfile: include_map.jsp,v $'
* 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: perry $'
* '$Date: 2006/08/31 23:37:13 $'
* '$Revision: 1.1 $'
*
* 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>
1.2 +1 -0 metacat/lib/style/skins/dev/devtools.html
Index: devtools.html
===================================================================
RCS file: /cvs/metacat/lib/style/skins/dev/devtools.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- devtools.html 18 Apr 2005 23:23:23 -0000 1.1
+++ devtools.html 31 Aug 2006 23:37:13 -0000 1.2
@@ -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>
1.3 +29 -5 metacat/lib/style/skins/knp/index.jsp
Index: index.jsp
===================================================================
RCS file: /cvs/metacat/lib/style/skins/knp/index.jsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- index.jsp 22 Mar 2006 22:44:34 -0000 1.2
+++ index.jsp 31 Aug 2006 23:37:13 -0000 1.3
@@ -5,9 +5,9 @@
* Copyright: 2006 Regents of the University of California and the
* National Center for Ecological Analysis and Synthesis
*
- * '$Author: sgarg $'
- * '$Date: 2006/03/22 22:44:34 $'
- * '$Revision: 1.2 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.3 $'
*
* 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
@@ -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,12 +56,14 @@
</head>
<body>
<script language="JavaScript">
+
function getMapFrame() {
return document.getElementById('mapFrame');
}
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. <a href="http://dataknp.sanparks.org/geoserver/data/mbdemos/demo/metacat_wfs/pma.html" target="_blank">This content</a> 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.
+ <a href="<%=mapUrl%>" target="_blank">
+ This content</a> should have been displayed at this location
+ </iframe>
</td></tr>
<tr><td>
<p>
1.122 +5 -40 metacat/src/edu/ucsb/nceas/metacat/DBQuery.java
Index: DBQuery.java
===================================================================
RCS file: /cvs/metacat/src/edu/ucsb/nceas/metacat/DBQuery.java,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- DBQuery.java 8 Jun 2006 18:09:26 -0000 1.121
+++ DBQuery.java 31 Aug 2006 23:37:13 -0000 1.122
@@ -10,9 +10,9 @@
* Authors: Matt Jones
* Release: @release@
*
- * '$Author: sgarg $'
- * '$Date: 2006/06/08 18:09:26 $'
- * '$Revision: 1.121 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.122 $'
*
* 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
@@ -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
1.181 +20 -2 metacat/src/edu/ucsb/nceas/metacat/DocumentImpl.java
Index: DocumentImpl.java
===================================================================
RCS file: /cvs/metacat/src/edu/ucsb/nceas/metacat/DocumentImpl.java,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -r1.180 -r1.181
--- DocumentImpl.java 19 Jul 2006 22:00:04 -0000 1.180
+++ DocumentImpl.java 31 Aug 2006 23:37:13 -0000 1.181
@@ -6,9 +6,9 @@
* Authors: Matt Jones
* Release: @release@
*
- * '$Author: sgarg $'
- * '$Date: 2006/07/19 22:00:04 $'
- * '$Revision: 1.180 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.181 $'
*
* 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
@@ -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)
1.6 +4 -8 metacat/src/edu/ucsb/nceas/metacat/DocumentImplWrapper.java
Index: DocumentImplWrapper.java
===================================================================
RCS file: /cvs/metacat/src/edu/ucsb/nceas/metacat/DocumentImplWrapper.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DocumentImplWrapper.java 21 Feb 2006 03:41:34 -0000 1.5
+++ DocumentImplWrapper.java 31 Aug 2006 23:37:13 -0000 1.6
@@ -7,9 +7,9 @@
* Authors: Jing Tao
* Release: @release@
*
- * '$Author: harris $'
- * '$Date: 2006/02/21 03:41:34 $'
- * '$Revision: 1.5 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.6 $'
*
* 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
@@ -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);
}
1.259 +34 -23 metacat/src/edu/ucsb/nceas/metacat/MetaCatServlet.java
Index: MetaCatServlet.java
===================================================================
RCS file: /cvs/metacat/src/edu/ucsb/nceas/metacat/MetaCatServlet.java,v
retrieving revision 1.258
retrieving revision 1.259
diff -u -r1.258 -r1.259
--- MetaCatServlet.java 31 Jul 2006 21:50:43 -0000 1.258
+++ MetaCatServlet.java 31 Aug 2006 23:37:13 -0000 1.259
@@ -7,8 +7,8 @@
* Release: @release@
*
* '$Author: perry $'
- * '$Date: 2006/07/31 21:50:43 $'
- * '$Revision: 1.258 $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.259 $'
*
* 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
@@ -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,16 +788,15 @@
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();
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");
1.64 +9 -5 metacat/src/edu/ucsb/nceas/metacat/MetaCatUtil.java
Index: MetaCatUtil.java
===================================================================
RCS file: /cvs/metacat/src/edu/ucsb/nceas/metacat/MetaCatUtil.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- MetaCatUtil.java 8 May 2006 20:46:17 -0000 1.63
+++ MetaCatUtil.java 31 Aug 2006 23:37:13 -0000 1.64
@@ -6,9 +6,9 @@
* Authors: Matt Jones, Jivka Bojilova
* Release: @release@
*
- * '$Author: sgarg $'
- * '$Date: 2006/05/08 20:46:17 $'
- * '$Revision: 1.63 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.64 $'
*
* 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
@@ -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,7 +112,10 @@
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);
1.7 +7 -5 metacat/src/spatial/cpp/metacat_shapefile.cpp
Index: metacat_shapefile.cpp
===================================================================
RCS file: /cvs/metacat/src/spatial/cpp/metacat_shapefile.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- metacat_shapefile.cpp 23 Feb 2006 19:16:08 -0000 1.6
+++ metacat_shapefile.cpp 31 Aug 2006 23:37:13 -0000 1.7
@@ -5,9 +5,9 @@
* Authors: John Harris
* Release: @release@
*
- * '$Author: harris $'
- * '$Date: 2006/02/23 19:16:08 $'
- * '$Revision: 1.6 $'
+ * '$Author: perry $'
+ * '$Date: 2006/08/31 23:37:13 $'
+ * '$Revision: 1.7 $'
*
* 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
@@ -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,13 +117,15 @@
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 );
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) );
More information about the Metacat-cvs
mailing list