You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(39) |
Dec
(70) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(52) |
Feb
(168) |
Mar
(248) |
Apr
(143) |
May
(418) |
Jun
(558) |
Jul
(702) |
Aug
(311) |
Sep
(141) |
Oct
(350) |
Nov
(172) |
Dec
(182) |
| 2003 |
Jan
(320) |
Feb
(362) |
Mar
(356) |
Apr
(218) |
May
(447) |
Jun
(203) |
Jul
(745) |
Aug
(494) |
Sep
(175) |
Oct
(422) |
Nov
(554) |
Dec
(162) |
| 2004 |
Jan
(217) |
Feb
(353) |
Mar
(228) |
Apr
(407) |
May
(211) |
Jun
(270) |
Jul
(264) |
Aug
(198) |
Sep
(268) |
Oct
(227) |
Nov
(118) |
Dec
(47) |
| 2005 |
Jan
(207) |
Feb
(243) |
Mar
(297) |
Apr
(197) |
May
(281) |
Jun
(166) |
Jul
(164) |
Aug
(92) |
Sep
(155) |
Oct
(196) |
Nov
(189) |
Dec
(114) |
| 2006 |
Jan
(129) |
Feb
(219) |
Mar
(274) |
Apr
(213) |
May
(245) |
Jun
(220) |
Jul
(376) |
Aug
(347) |
Sep
(179) |
Oct
(493) |
Nov
(448) |
Dec
(339) |
| 2007 |
Jan
(304) |
Feb
(273) |
Mar
(237) |
Apr
(186) |
May
(215) |
Jun
(320) |
Jul
(229) |
Aug
(313) |
Sep
(331) |
Oct
(279) |
Nov
(347) |
Dec
(266) |
| 2008 |
Jan
(332) |
Feb
(280) |
Mar
(203) |
Apr
(277) |
May
(301) |
Jun
(356) |
Jul
(292) |
Aug
(203) |
Sep
(277) |
Oct
(142) |
Nov
(210) |
Dec
(239) |
| 2009 |
Jan
(250) |
Feb
(193) |
Mar
(174) |
Apr
(183) |
May
(342) |
Jun
(230) |
Jul
(292) |
Aug
(161) |
Sep
(204) |
Oct
(280) |
Nov
(281) |
Dec
(175) |
| 2010 |
Jan
(113) |
Feb
(106) |
Mar
(199) |
Apr
(166) |
May
(298) |
Jun
(147) |
Jul
(175) |
Aug
(192) |
Sep
(71) |
Oct
(79) |
Nov
(58) |
Dec
(55) |
| 2011 |
Jan
(83) |
Feb
(169) |
Mar
(142) |
Apr
(207) |
May
(311) |
Jun
(183) |
Jul
(218) |
Aug
(190) |
Sep
(158) |
Oct
(197) |
Nov
(93) |
Dec
(74) |
| 2012 |
Jan
(92) |
Feb
(50) |
Mar
(64) |
Apr
(45) |
May
(100) |
Jun
(70) |
Jul
(3) |
Aug
(1) |
Sep
(2) |
Oct
(5) |
Nov
(7) |
Dec
(4) |
| 2013 |
Jan
(6) |
Feb
(2) |
Mar
(2) |
Apr
(4) |
May
(3) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2014 |
Jan
(2) |
Feb
(2) |
Mar
(2) |
Apr
(3) |
May
(3) |
Jun
(1) |
Jul
|
Aug
(4) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <svn...@os...> - 2011-12-19 00:02:21
|
Author: simonegiannecchini
Date: 2011-12-18 16:02:15 -0800 (Sun, 18 Dec 2011)
New Revision: 38428
Modified:
branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java
Log:
minor improvement to messaging and mosaic caching
Modified: branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java
===================================================================
--- branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java 2011-12-19 00:00:17 UTC (rev 38427)
+++ branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java 2011-12-19 00:02:15 UTC (rev 38428)
@@ -172,7 +172,7 @@
}
if(!f.renameTo(new File(zeroLevelDirectory, f.getName())))
LOGGER.log(Level.WARNING, "Could not move " + f.getAbsolutePath() +
- " to " + zeroLevelDirectory);
+ " to " + zeroLevelDirectory+ " check the permission inside the source directory "+f.getParent()+ " and target directory "+zeroLevelDirectory);
}
directories = directory.listFiles((FileFilter) directoryFilter);
} else {
|
|
From: <svn...@os...> - 2011-12-19 00:00:23
|
Author: simonegiannecchini
Date: 2011-12-18 16:00:17 -0800 (Sun, 18 Dec 2011)
New Revision: 38427
Modified:
trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java
Log:
minor improvements to messaging and mosaic caching
Modified: trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java
===================================================================
--- trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java 2011-12-18 23:24:41 UTC (rev 38426)
+++ trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java 2011-12-19 00:00:17 UTC (rev 38427)
@@ -172,7 +172,7 @@
}
if(!f.renameTo(new File(zeroLevelDirectory, f.getName())))
LOGGER.log(Level.WARNING, "Could not move " + f.getAbsolutePath() +
- " to " + zeroLevelDirectory);
+ " to " + zeroLevelDirectory+ " check the permission inside the source directory "+f.getParent()+ " and target directory "+zeroLevelDirectory);
}
directories = directory.listFiles((FileFilter) directoryFilter);
} else {
|
|
From: <svn...@os...> - 2011-12-18 23:24:48
|
Author: simonegiannecchini
Date: 2011-12-18 15:24:41 -0800 (Sun, 18 Dec 2011)
New Revision: 38426
Modified:
trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidFormat.java
trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidReader.java
trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java
Log:
minor improvements to messaging and mosaic caching
Modified: trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidFormat.java
===================================================================
--- trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidFormat.java 2011-12-18 23:23:59 UTC (rev 38425)
+++ trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidFormat.java 2011-12-18 23:24:41 UTC (rev 38426)
@@ -55,7 +55,7 @@
/** Logger. */
private final static Logger LOGGER = org.geotools.util.logging.Logging.getLogger("org.geotools.gce.imagepyramid");
- /**
+ /**
* Creates an instance and sets the metadata.
*/
public ImagePyramidFormat() {
@@ -124,28 +124,36 @@
*/
@Override
public boolean accepts(Object source, Hints hints) {
- try {
+ if(source==null){
+ throw new NullPointerException("Null parameter provided to the accepts method of this ImagePyramidFormat");
+ }
+
+ try {
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Accepts method of ImagePyramid with source" + source);
+ }
- // /////////////////////////////////////////////////////////////////////
//
// Check source
//
- // /////////////////////////////////////////////////////////////////////
- URL sourceURL = Utils.checkSource(source, hints);
+ URL sourceURL = Utils.checkSource(source, hints);
if(sourceURL == null)
return false;
try {
sourceURL.openStream().close();
} catch (Throwable e) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.log(Level.FINE,e.getLocalizedMessage(),e);
+ }
return false;
}
- // ///////////////////////////////////////////////////////////////////
+
//
// Trying to load informations
//
//
- // ///////////////////////////////////////////////////////////////////
+
// //
//
// get the crs if able to
@@ -162,15 +170,15 @@
if (tempcrs == null) {
// use the default crs
tempcrs = AbstractGridFormat.getDefaultCRS();
- LOGGER.log(Level.FINE,new StringBuffer("Unable to find a CRS for this coverage, using a default one: ").append(tempcrs.toWKT()).toString());
+ LOGGER.log(Level.FINE,new StringBuilder("Unable to find a CRS for this coverage, using a default one: ").append(tempcrs.toWKT()).toString());
}
//
- // ///////////////////////////////////////////////////////////////////
+
//
// Load properties file with information about levels and envelope
//
//
- // ///////////////////////////////////////////////////////////////////
+
// property file
final Properties properties = new Properties();
BufferedInputStream propertyStream = null;
Modified: trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidReader.java
===================================================================
--- trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidReader.java 2011-12-18 23:23:59 UTC (rev 38425)
+++ trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidReader.java 2011-12-18 23:24:41 UTC (rev 38426)
@@ -24,9 +24,9 @@
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.nio.channels.Channels;
-import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -49,7 +49,6 @@
import org.geotools.geometry.GeneralEnvelope;
import org.geotools.referencing.CRS;
import org.geotools.referencing.operation.builder.GridToEnvelopeMapper;
-import org.geotools.util.SoftValueHashMap;
import org.opengis.coverage.grid.Format;
import org.opengis.coverage.grid.GridCoverage;
import org.opengis.coverage.grid.GridCoverageReader;
@@ -141,8 +140,8 @@
/**
* Cache of {@link ImageMosaicReader} objects for the different levels.
*
- */
- private Map<Integer, ImageMosaicReader> readers;
+ */
+ private ConcurrentHashMap<Integer, ImageMosaicReader> readers =new ConcurrentHashMap<Integer, ImageMosaicReader>();
/**
* Constructor for an {@link ImagePyramidReader}.
@@ -175,23 +174,16 @@
// //
if (source == null) {
- final NullPointerException ex = new NullPointerException("ImagePyramidReader:No source set to read this coverage.");
- throw new DataSourceException(ex);
+ throw new DataSourceException("ImagePyramidReader:null source set to read this coverage.");
}
this.source = source;
this.sourceURL = Utils.checkSource(source, uHints);
if(sourceURL == null) {
- throw new IllegalArgumentException(
- "This plugin accepts only File, URL and String pointing to a file");
+ throw new IllegalArgumentException("This plugin accepts only File, URL and String pointing to a file");
}
// //
- //
- // Load tiles informations, especially the bounds, which will be
- // reused
- //
// //
- // //
//
// get the crs if able to
//
@@ -228,8 +220,6 @@
//
// Load properties file with information about levels and envelope
//
-
- // property file
parseMainFile(sourceURL);
}
@@ -242,6 +232,10 @@
* @throws FileNotFoundException
*/
private void parseMainFile(final URL sourceURL) throws IOException {
+
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.fine("Parsing pyramid properties file at:"+sourceURL.toExternalForm());
+ }
BufferedInputStream propertyStream = null;
InputStream openStream = null;
try {
@@ -267,10 +261,6 @@
numOverviews = Integer.parseInt(properties.getProperty("LevelsNum")) - 1;
levelsDirs = properties.getProperty("LevelsDirs").split(" ");
- // readers soft map
- final int readersCacheSize = (numOverviews + 1) / 3;
- readers = new SoftValueHashMap<Integer, ImageMosaicReader>(readersCacheSize == 0 ? numOverviews + 1 : readersCacheSize);
-
// resolutions levels
final String levels = properties.getProperty("Levels");
pairs = levels.split(" ");
@@ -297,7 +287,11 @@
);
final GridToEnvelopeMapper geMapper= new GridToEnvelopeMapper(originalGridRange,originalEnvelope);
geMapper.setPixelAnchor(PixelInCell.CELL_CORNER);
- raster2Model= geMapper.createTransform();
+ raster2Model= geMapper.createTransform();
+
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.fine("Parsed pyramid properties file at:"+sourceURL.toExternalForm());
+ }
} finally {
// close input stream
if (propertyStream != null)
@@ -369,11 +363,10 @@
}
}
}
- // /////////////////////////////////////////////////////////////////////
+
//
// Loading tiles
//
- // /////////////////////////////////////////////////////////////////////
return loadTiles(requestedEnvelope, dim, params, overviewPolicy);
}
@@ -393,7 +386,7 @@
Rectangle dim, GeneralParameterValue[] params, OverviewPolicy overviewPolicy)
throws IOException {
- // /////////////////////////////////////////////////////////////////////
+
//
// Check if we have something to load by intersecting the requested
// envelope with the bounds of the data set.
@@ -402,7 +395,7 @@
// we have to perform a conversion towards the latter crs before
// intersecting anything.
//
- // /////////////////////////////////////////////////////////////////////
+
if (requestedEnvelope != null) {
if (!CRS.equalsIgnoreMetadata(requestedEnvelope
.getCoordinateReferenceSystem(), this.crs)) {
@@ -470,37 +463,56 @@
throws TransformException, IOException {
// if we get here we have something to load
- // /////////////////////////////////////////////////////////////////////
+
//
// compute the requested resolution
//
- // /////////////////////////////////////////////////////////////////////
final ImageReadParam readP = new ImageReadParam();
Integer imageChoice=0;
if (dim != null)
imageChoice = setReadParams(overviewPolicy, readP,requestedEnvelope, dim);
- // /////////////////////////////////////////////////////////////////////
+
//
// Check to have the needed reader in memory
//
- // /////////////////////////////////////////////////////////////////////
- ImageMosaicReader reader = null;
- synchronized (readers) {
- Object o = readers.get(imageChoice);
- if (o == null) {
- final String levelDirName = levelsDirs[imageChoice.intValue()];
- final URL parentUrl = DataUtilities.getParentUrl(sourceURL);
- // look for a shapefile first
- final String extension = new StringBuilder(levelDirName).append("/").append(coverageName).append(".shp").toString();
- final URL shpFileUrl = DataUtilities.extendURL(parentUrl,extension);
- if(shpFileUrl.getProtocol()!=null&&shpFileUrl.getProtocol().equalsIgnoreCase("file")&&!DataUtilities.urlToFile(shpFileUrl).exists())
- reader= new ImageMosaicReader(DataUtilities.extendURL(parentUrl,levelDirName), hints);
- else
- reader = new ImageMosaicReader(shpFileUrl,hints);
- readers.put(imageChoice, reader);
-
- } else
- reader = (ImageMosaicReader) o;
+
+ // light check to see if this reader had been disposed, not synching for performance.
+ if (readers == null) {
+ throw new IllegalStateException("This ImagePyramidReader has already been disposed");
+ }
+
+ ImageMosaicReader reader = readers.get(imageChoice);
+ if (reader == null) {
+
+ //
+ // we must create the underlying mosaic
+ //
+ final String levelDirName = levelsDirs[imageChoice.intValue()];
+ final URL parentUrl = DataUtilities.getParentUrl(sourceURL);
+ // look for a shapefile first
+ final String extension = new StringBuilder(levelDirName).append("/").append(coverageName).append(".shp").toString();
+ final URL shpFileUrl = DataUtilities.extendURL(parentUrl, extension);
+ if (shpFileUrl.getProtocol() != null
+ && shpFileUrl.getProtocol().equalsIgnoreCase("file")
+ && !DataUtilities.urlToFile(shpFileUrl).exists())
+ reader = new ImageMosaicReader(DataUtilities.extendURL(parentUrl, levelDirName), hints);
+ else
+ reader = new ImageMosaicReader(shpFileUrl, hints);
+ final ImageMosaicReader putByOtherThreadJustNow =readers.putIfAbsent(imageChoice, reader);
+ if(putByOtherThreadJustNow!=null){
+ // some other thread just did inserted this
+ try{
+ reader.dispose();
+ } catch (Exception e) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.log(Level.FINE,e.getLocalizedMessage(),e);
+ }
+ }
+
+ //use the other one
+ reader=putByOtherThreadJustNow;
+ }
+
}
Modified: trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java
===================================================================
--- trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java 2011-12-18 23:23:59 UTC (rev 38425)
+++ trunk/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java 2011-12-18 23:24:41 UTC (rev 38426)
@@ -1,291 +1,356 @@
-/*
- * GeoTools - The Open Source Java GIS Toolkit
- * http://geotools.org
- *
- * (C) 2006-2008, Open Source Geospatial Foundation (OSGeo)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License.
- *
- * This library 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
- * Lesser General Public License for more details.
- */
-package org.geotools.gce.imagepyramid;
-
-import java.awt.geom.AffineTransform;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.commons.io.filefilter.FileFilterUtils;
-import org.apache.commons.io.filefilter.IOFileFilter;
-import org.geotools.data.DataUtilities;
-import org.geotools.factory.Hints;
-import org.geotools.gce.imagemosaic.ImageMosaicFormat;
-import org.geotools.gce.imagemosaic.ImageMosaicReader;
-import org.geotools.geometry.GeneralEnvelope;
-import org.geotools.resources.coverage.CoverageUtilities;
-import org.geotools.util.logging.Logging;
-import org.opengis.referencing.datum.PixelInCell;
-
-/**
- * Code to build a pyramid from a gdal_retile output
- *
- * @author Andrea Aime - OpenGeo
- *
- */
-class Utils {
-
- static final Logger LOGGER = Logging.getLogger(Utils.class);
-
- static URL checkSource(Object source) {
- return checkSource(source, null);
- }
-
- static URL checkSource(Object source, Hints hints) {
- URL sourceURL = null;
- File sourceFile = null;
- // /////////////////////////////////////////////////////////////////////
- //
- // Check source
- //
- // /////////////////////////////////////////////////////////////////////
- // if it is a URL or a String let's try to see if we can get a file to
- // check if we have to build the index
- if (source instanceof File) {
- sourceFile = (File) source;
- sourceURL = DataUtilities.fileToURL(sourceFile);
- } else if (source instanceof URL) {
- sourceURL = (URL) source;
- if (sourceURL.getProtocol().equals("file")) {
- sourceFile = DataUtilities.urlToFile(sourceURL);
- }
- } else if (source instanceof String) {
- // is it a File?
- final String tempSource = (String) source;
- File tempFile = new File(tempSource);
- if (!tempFile.exists()) {
- // is it a URL
- try {
- sourceURL = new URL(tempSource);
- source = DataUtilities.urlToFile(sourceURL);
- } catch (MalformedURLException e) {
- sourceURL = null;
- source = null;
- }
- } else {
- sourceURL = DataUtilities.fileToURL(tempFile);
- sourceFile = tempFile;
- }
- } else {
- // we really don't know how to convert the thing... give up
- return null;
- }
-
- // /////////////////////////////////////////////////////////////////////
- //
- // Handle cases where the pyramid descriptor file already exists
- //
- // /////////////////////////////////////////////////////////////////////
-
- // can't do anything with it
- if(sourceFile == null || !sourceFile.exists())
- return sourceURL;
-
- // if it's already a file we don't need to adjust it, will try to open as is
- if(!sourceFile.isDirectory())
- return sourceURL;
-
- // it's a directory, let's see if it already has a pyramid description file inside
- File directory = sourceFile;
- sourceFile = new File(directory, directory.getName() + ".properties");
- if(sourceFile.exists())
- return DataUtilities.fileToURL(sourceFile);
-
-
- // /////////////////////////////////////////////////////////////////////
- //
- // Try to build the sub-folders mosaics
- //
- // /////////////////////////////////////////////////////////////////////
-
- // if the structure of the directories is gdal_retile like, move the root files in their
- // own sub directory
- File zeroLevelDirectory = new File(directory, "0");
- IOFileFilter directoryFilter = FileFilterUtils.directoryFileFilter();
- File[] numericDirectories = directory.listFiles(new NumericDirectoryFilter());
- File[] directories = directory.listFiles((FileFilter) directoryFilter);
-
- // do we have at least one sub-directory?
- if(directories.length == 0)
- return null;
-
- // check the gdal case and move files if necessary
- if(!zeroLevelDirectory.exists() && numericDirectories.length == directories.length) {
- LOGGER.log(Level.INFO, "Detected gdal_retile file structure, " +
- "moving root files to the '0' subdirectory");
- if(zeroLevelDirectory.mkdir()) {
- FileFilter notDirFilter = FileFilterUtils.notFileFilter(directoryFilter);
- for (File f : directory.listFiles(notDirFilter)) {
- if(!f.renameTo(new File(zeroLevelDirectory, f.getName())))
- LOGGER.log(Level.INFO, "Could not move " + f.getAbsolutePath() +
- " to " + zeroLevelDirectory);
- }
- directories = directory.listFiles((FileFilter) directoryFilter);
- }
- }
-
- // scan each subdirectory and try to build a mosaic in it, accumulate the resulting mosaics
- List<MosaicInfo> mosaics = new ArrayList<MosaicInfo>();
- ImageMosaicFormat mosaicFactory = new ImageMosaicFormat();
- for (File subdir : directories) {
- if(mosaicFactory.accepts(subdir, hints)) {
- mosaics.add(new MosaicInfo(subdir, mosaicFactory.getReader(subdir, hints)));
- }
- }
-
- // do we have at least one level?
- if(mosaics.size() == 0)
- return null;
-
- // sort the mosaics by resolution and check they are actually in ascending resolution order
- // for both X and Y resolutions
- Collections.sort(mosaics);
- for(int i = 1; i < mosaics.size(); i++) {
- double[] resprev = mosaics.get(i - 1).getResolutions();
- double[] res = mosaics.get(i).getResolutions();
- if(resprev[1] > res[1]) {
- LOGGER.log(Level.INFO, "Invalid mosaic, y resolution in "
- + mosaics.get(i - 1).getPath() + " is greater than the one in "
- + mosaics.get(i).getPath() + " whilst x resolutions " +
- "have the opposite relationship");
- return null;
- }
- }
-
- // /////////////////////////////////////////////////////////////////////
- //
- // We have everything we need, build the final pyramid descriptor info
- //
- // /////////////////////////////////////////////////////////////////////
-
- // build the property file
- Properties properties = new Properties();
- properties.put("Name", directory.getName());
- properties.put("LevelsNum", String.valueOf(mosaics.size()));
- StringBuilder sbDirNames = new StringBuilder();
- StringBuilder sbLevels = new StringBuilder();
- for(MosaicInfo mi : mosaics) {
- sbDirNames.append(mi.getName()).append(" ");
- double[] resolutions = mi.getResolutions();
- sbLevels.append(resolutions[0]).append(",").append(resolutions[1]).append(" ");
- }
- properties.put("LevelsDirs", sbDirNames.toString());
- properties.put("Levels", sbLevels.toString());
- GeneralEnvelope envelope = mosaics.get(0).getEnvelope();
- properties.put("Envelope2D", envelope.getMinimum(0) + "," + envelope.getMinimum(1) + " " +
- envelope.getMaximum(0) + "," + envelope.getMaximum(1));
- OutputStream os = null;
- try {
- os = new FileOutputStream(sourceFile);
- properties.store(os, "Automatically generated");
- } catch(IOException e) {
- LOGGER.log(Level.INFO, "We could not generate the pyramid propert file " +
- sourceFile.getPath(), e);
- return null;
- } finally {
- if(os != null)
- try { os.close(); } catch(IOException e) {}
- }
-
- // build the .prj file if possible
- if(envelope.getCoordinateReferenceSystem() != null) {
- File prjFile = new File(directory, directory.getName() + ".prj");
- PrintWriter pw = null;
- try {
- pw = new PrintWriter(new FileOutputStream(prjFile));
- pw.print(envelope.getCoordinateReferenceSystem().toString());
- } catch(IOException e) {
- LOGGER.log(Level.INFO, "We could not write out the projection file " +
- prjFile.getPath(), e);
- return null;
- } finally {
- pw.close();
- }
- }
-
- return DataUtilities.fileToURL(sourceFile);
- }
-
-
- /**
- * Stores informations about a mosaic
- */
- static class MosaicInfo implements Comparable<MosaicInfo>{
- File directory;
- ImageMosaicReader reader;
- double[] resolutions;
-
- MosaicInfo(File directory, ImageMosaicReader reader) {
- this.directory = directory;
- this.reader = reader;
- this.resolutions = CoverageUtilities.getResolution((AffineTransform) reader.getOriginalGridToWorld(PixelInCell.CELL_CORNER));
- }
-
- double[] getResolutions() {
- return resolutions;
- }
-
- String getPath() {
- return directory.getPath();
- }
-
- String getName() {
- return directory.getName();
- }
-
- GeneralEnvelope getEnvelope() {
- return reader.getOriginalEnvelope();
- }
-
- public int compareTo(MosaicInfo other) {
- // we make an easy comparison against the x resolution, we'll do a sanity
- // check about the y resolution later
- return resolutions[0] > other.resolutions[0] ? 1 : -1;
- }
- }
-
- /**
- * A file filter that only returns directories whose name is an integer number
- * @author Andrea Aime - OpenGeo
- */
- static class NumericDirectoryFilter implements FileFilter {
-
- public boolean accept(File pathname) {
- if(!pathname.isDirectory())
- return false;
- try {
- Integer.parseInt(pathname.getName());
- return true;
- } catch(NumberFormatException e) {
- return false;
- }
- }
- }
-
-}
+/*
+ * GeoTools - The Open Source Java GIS Toolkit
+ * http://geotools.org
+ *
+ * (C) 2006-2008, Open Source Geospatial Foundation (OSGeo)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ */
+package org.geotools.gce.imagepyramid;
+
+import java.awt.geom.AffineTransform;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.filefilter.FileFilterUtils;
+import org.apache.commons.io.filefilter.IOFileFilter;
+import org.geotools.data.DataUtilities;
+import org.geotools.factory.Hints;
+import org.geotools.gce.imagemosaic.ImageMosaicFormat;
+import org.geotools.gce.imagemosaic.ImageMosaicReader;
+import org.geotools.geometry.GeneralEnvelope;
+import org.geotools.resources.coverage.CoverageUtilities;
+import org.geotools.util.logging.Logging;
+import org.opengis.referencing.datum.PixelInCell;
+
+/**
+ * Code to build a pyramid from a gdal_retile output
+ *
+ * @author Andrea Aime - GeoSolutions SAS
+ * @author Simone Giannecchini, GeoSolutions SAS
+ *
+ */
+class Utils {
+
+ static final Logger LOGGER = Logging.getLogger(Utils.class);
+
+ static URL checkSource(Object source) {
+ return checkSource(source, null);
+ }
+
+ static URL checkSource(Object source, Hints hints) {
+ URL sourceURL = null;
+ File sourceFile = null;
+
+ //
+ // Check source
+ //
+ // if it is a URL or a String let's try to see if we can get a file to
+ // check if we have to build the index
+ if (source instanceof File) {
+ sourceFile = (File) source;
+ sourceURL = DataUtilities.fileToURL(sourceFile);
+ } else if (source instanceof URL) {
+ sourceURL = (URL) source;
+ if (sourceURL.getProtocol().equals("file")) {
+ sourceFile = DataUtilities.urlToFile(sourceURL);
+ }
+ } else if (source instanceof String) {
+ // is it a File?
+ final String tempSource = (String) source;
+ File tempFile = new File(tempSource);
+ if (!tempFile.exists()) {
+ // is it a URL
+ try {
+ sourceURL = new URL(tempSource);
+ source = DataUtilities.urlToFile(sourceURL);
+ } catch (MalformedURLException e) {
+ sourceURL = null;
+ source = null;
+ }
+ } else {
+ sourceURL = DataUtilities.fileToURL(tempFile);
+ sourceFile = tempFile;
+ }
+ } else {
+ // we really don't know how to convert the thing... give up
+ if(LOGGER.isLoggable(Level.WARNING)){
+ LOGGER.warning("we really don't know how to convert the thing:"+source!=null?source.toString():"null");
+ }
+ return null;
+ }
+
+ // logging
+ if(LOGGER.isLoggable(Level.INFO)){
+ if(sourceFile!=null){
+ final String message = fileStatus(sourceFile);
+ LOGGER.info(message);
+ }
+ }
+
+ //
+ // Handle cases where the pyramid descriptor file already exists
+ //
+ // can't do anything with it
+ if(sourceFile == null || !sourceFile.exists())
+ return sourceURL;
+
+ // if it's already a file we don't need to adjust it, will try to open as is
+ if(!sourceFile.isDirectory())
+ return sourceURL;
+
+ // it's a directory, let's see if it already has a pyramid description file inside
+ File directory = sourceFile;
+ sourceFile = new File(directory, directory.getName() + ".properties");
+ // logging
+ if(LOGGER.isLoggable(Level.INFO)){
+ if(sourceFile!=null){
+ final String message = fileStatus(sourceFile);
+ LOGGER.info(message);
+ }
+ }
+ if(sourceFile.exists())
+ return DataUtilities.fileToURL(sourceFile);
+
+
+ //
+ // Try to build the sub-folders mosaics
+ //
+ // if the structure of the directories is gdal_retile like, move the root files in their
+ // own sub directory
+ File zeroLevelDirectory = new File(directory, "0");
+ IOFileFilter directoryFilter = FileFilterUtils.directoryFileFilter();
+ File[] numericDirectories = directory.listFiles(new NumericDirectoryFilter());
+ File[] directories = directory.listFiles((FileFilter) directoryFilter);
+
+ // do we have at least one sub-directory?
+ if(directories.length == 0){
+ if(LOGGER.isLoggable(Level.INFO)){
+ LOGGER.info("I was unable to determine a structure similar to the GDAL Retile one!!");
+ }
+ return null;
+ }
+
+ // check the gdal case and move files if necessary
+ if(!zeroLevelDirectory.exists() && numericDirectories.length == directories.length) {
+ LOGGER.log(Level.INFO, "Detected gdal_retile file structure, " +
+ "moving root files to the '0' subdirectory");
+ if(zeroLevelDirectory.mkdir()) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.fine("Created '0' subidr, now moving files");
+ }
+ FileFilter notDirFilter = FileFilterUtils.notFileFilter(directoryFilter);
+ for (File f : directory.listFiles(notDirFilter)) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.fine("Moving file"+f.getAbsolutePath());
+ }
+ if(LOGGER.isLoggable(Level.FINEST)){
+ LOGGER.finest(fileStatus(f));
+ }
+ if(!f.renameTo(new File(zeroLevelDirectory, f.getName())))
+ LOGGER.log(Level.WARNING, "Could not move " + f.getAbsolutePath() +
+ " to " + zeroLevelDirectory);
+ }
+ directories = directory.listFiles((FileFilter) directoryFilter);
+ } else {
+ if(LOGGER.isLoggable(Level.INFO)){
+ LOGGER.info("I was unable to create the 0 directory. check the file permission in the parent directory:"+sourceFile.getParent());
+ }
+ return null;
+ }
+ }
+
+ // scan each subdirectory and try to build a mosaic in it, accumulate the resulting mosaics
+ List<MosaicInfo> mosaics = new ArrayList<MosaicInfo>();
+ ImageMosaicFormat mosaicFactory = new ImageMosaicFormat();
+ for (File subdir : directories) {
+ if(mosaicFactory.accepts(subdir, hints)) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.fine("Trying to build mosaic for the directory:"+subdir.getAbsolutePath());
+ }
+ mosaics.add(new MosaicInfo(subdir, mosaicFactory.getReader(subdir, hints)));
+ } else {
+ if(LOGGER.isLoggable(Level.INFO)){
+ LOGGER.info("Unable to build mosaic for the directory:"+subdir.getAbsolutePath());
+ }
+ }
+ }
+
+ // do we have at least one level?
+ if(mosaics.size() == 0)
+ return null;
+
+ // sort the mosaics by resolution and check they are actually in ascending resolution order
+ // for both X and Y resolutions
+ Collections.sort(mosaics);
+ for(int i = 1; i < mosaics.size(); i++) {
+ double[] resprev = mosaics.get(i - 1).getResolutions();
+ double[] res = mosaics.get(i).getResolutions();
+ if(resprev[1] > res[1]) {
+ LOGGER.log(Level.INFO, "Invalid mosaic, y resolution in "
+ + mosaics.get(i - 1).getPath() + " is greater than the one in "
+ + mosaics.get(i).getPath() + " whilst x resolutions " +
+ "have the opposite relationship");
+ return null;
+ }
+ }
+
+ //
+ // We have everything we need, build the final pyramid descriptor info
+ //
+ // build the property file
+ Properties properties = new Properties();
+ properties.put("Name", directory.getName());
+ properties.put("LevelsNum", String.valueOf(mosaics.size()));
+ StringBuilder sbDirNames = new StringBuilder();
+ StringBuilder sbLevels = new StringBuilder();
+ for(MosaicInfo mi : mosaics) {
+ sbDirNames.append(mi.getName()).append(" ");
+ double[] resolutions = mi.getResolutions();
+ sbLevels.append(resolutions[0]).append(",").append(resolutions[1]).append(" ");
+ }
+ properties.put("LevelsDirs", sbDirNames.toString());
+ properties.put("Levels", sbLevels.toString());
+ GeneralEnvelope envelope = mosaics.get(0).getEnvelope();
+ properties.put("Envelope2D", envelope.getMinimum(0) + "," + envelope.getMinimum(1) + " " +
+ envelope.getMaximum(0) + "," + envelope.getMaximum(1));
+ OutputStream os = null;
+ try {
+ os = new FileOutputStream(sourceFile);
+ properties.store(os, "Automatically generated");
+ } catch(IOException e) {
+ LOGGER.log(Level.INFO, "We could not generate the pyramid propert file " +
+ sourceFile.getPath(), e);
+ return null;
+ } finally {
+ if(os != null)
+ IOUtils.closeQuietly(os);
+ }
+
+ // build the .prj file if possible
+ if(envelope.getCoordinateReferenceSystem() != null) {
+ File prjFile = new File(directory, directory.getName() + ".prj");
+ PrintWriter pw = null;
+ try {
+ pw = new PrintWriter(new FileOutputStream(prjFile));
+ pw.print(envelope.getCoordinateReferenceSystem().toString());
+ } catch(IOException e) {
+ LOGGER.log(Level.INFO, "We could not write out the projection file " +
+ prjFile.getPath(), e);
+ return null;
+ } finally {
+ pw.close();
+ }
+ }
+
+ return DataUtilities.fileToURL(sourceFile);
+ }
+
+ /**
+ * Prepares a message with the status of the provided file.
+ * @param sourceFile The {@link File} to provided the status message for
+ * @return a status message for the provided {@link File} or a {@link NullPointerException} in case the {@link File}is <code>null</code>.
+ */
+ private static String fileStatus(File sourceFile) {
+ if(sourceFile==null){
+ throw new NullPointerException("Provided null input to fileStatus method");
+ }
+ final StringBuilder builder = new StringBuilder();
+ builder.append("Checking file:").append(FilenameUtils.getFullPath(sourceFile.getAbsolutePath())).append("\n");
+ builder.append("exists").append(sourceFile.exists()).append("\n");
+ builder.append("isFile").append(sourceFile.isFile()).append("\n");
+ builder.append("canRead:").append(sourceFile.canRead()).append("\n");
+ builder.append("canWrite").append(sourceFile.canWrite()).append("\n");
+ builder.append("canExecute").append(sourceFile.canExecute()).append("\n");
+ builder.append("isHidden:").append(sourceFile.isHidden()).append("\n");
+ builder.append("lastModified").append(sourceFile.lastModified()).append("\n");
+
+ return builder.toString();
+ }
+
+
+ /**
+ * Stores informations about a mosaic
+ */
+ static class MosaicInfo implements Comparable<MosaicInfo>{
+ @Override
+ public String toString() {
+ return "MosaicInfo [directory=" + directory + ", resolutions="
+ + Arrays.toString(resolutions) + "]";
+ }
+
+ File directory;
+ ImageMosaicReader reader;
+ double[] resolutions;
+
+ MosaicInfo(File directory, ImageMosaicReader reader) {
+ this.directory = directory;
+ this.reader = reader;
+ this.resolutions = CoverageUtilities.getResolution((AffineTransform) reader.getOriginalGridToWorld(PixelInCell.CELL_CORNER));
+ }
+
+ double[] getResolutions() {
+ return resolutions;
+ }
+
+ String getPath() {
+ return directory.getPath();
+ }
+
+ String getName() {
+ return directory.getName();
+ }
+
+ GeneralEnvelope getEnvelope() {
+ return reader.getOriginalEnvelope();
+ }
+
+ public int compareTo(MosaicInfo other) {
+ // we make an easy comparison against the x resolution, we'll do a sanity
+ // check about the y resolution later
+ return resolutions[0] > other.resolutions[0] ? 1 : -1;
+ }
+ }
+
+ /**
+ * A file filter that only returns directories whose name is an integer number
+ * @author Andrea Aime - OpenGeo
+ */
+ static class NumericDirectoryFilter implements FileFilter {
+
+ public boolean accept(File pathname) {
+ if(!pathname.isDirectory())
+ return false;
+ try {
+ Integer.parseInt(pathname.getName());
+ return true;
+ } catch(NumberFormatException e) {
+ return false;
+ }
+ }
+ }
+
+}
|
|
From: <svn...@os...> - 2011-12-18 23:24:06
|
Author: simonegiannecchini
Date: 2011-12-18 15:23:59 -0800 (Sun, 18 Dec 2011)
New Revision: 38425
Modified:
branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidFormat.java
branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidReader.java
branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java
branches/2.7.x/modules/plugin/imagepyramid/src/test/java/org/geotools/gce/imagepyramid/ImagePyramidReaderTest.java
Log:
minor improvement to messaging and mosaic caching
Modified: branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidFormat.java
===================================================================
--- branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidFormat.java 2011-12-18 11:57:59 UTC (rev 38424)
+++ branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidFormat.java 2011-12-18 23:23:59 UTC (rev 38425)
@@ -166,28 +166,36 @@
*/
@Override
public boolean accepts(Object source, Hints hints) {
- try {
+ if(source==null){
+ throw new NullPointerException("Null parameter provided to the accepts method of this ImagePyramidFormat");
+ }
+
+ try {
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("Accepts method of ImagePyramid with source" + source);
+ }
- // /////////////////////////////////////////////////////////////////////
//
// Check source
//
- // /////////////////////////////////////////////////////////////////////
- URL sourceURL = Utils.checkSource(source, hints);
+ URL sourceURL = Utils.checkSource(source, hints);
if(sourceURL == null)
return false;
try {
sourceURL.openStream().close();
} catch (Throwable e) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.log(Level.FINE,e.getLocalizedMessage(),e);
+ }
return false;
}
- // ///////////////////////////////////////////////////////////////////
+
//
// Trying to load informations
//
//
- // ///////////////////////////////////////////////////////////////////
+
// //
//
// get the crs if able to
@@ -204,15 +212,15 @@
if (tempcrs == null) {
// use the default crs
tempcrs = AbstractGridFormat.getDefaultCRS();
- LOGGER.log(Level.FINE,new StringBuffer("Unable to find a CRS for this coverage, using a default one: ").append(tempcrs.toWKT()).toString());
+ LOGGER.log(Level.FINE,new StringBuilder("Unable to find a CRS for this coverage, using a default one: ").append(tempcrs.toWKT()).toString());
}
//
- // ///////////////////////////////////////////////////////////////////
+
//
// Load properties file with information about levels and envelope
//
//
- // ///////////////////////////////////////////////////////////////////
+
// property file
final Properties properties = new Properties();
BufferedInputStream propertyStream = null;
Modified: branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidReader.java
===================================================================
--- branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidReader.java 2011-12-18 11:57:59 UTC (rev 38424)
+++ branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/ImagePyramidReader.java 2011-12-18 23:23:59 UTC (rev 38425)
@@ -24,8 +24,8 @@
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.nio.channels.Channels;
-import java.util.Map;
import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -48,7 +48,6 @@
import org.geotools.geometry.GeneralEnvelope;
import org.geotools.referencing.CRS;
import org.geotools.referencing.operation.builder.GridToEnvelopeMapper;
-import org.geotools.util.SoftValueHashMap;
import org.opengis.coverage.grid.Format;
import org.opengis.coverage.grid.GridCoverage;
import org.opengis.coverage.grid.GridCoverageReader;
@@ -139,8 +138,8 @@
/**
* Cache of {@link ImageMosaicReader} objects for the different levels.
*
- */
- private Map<Integer, ImageMosaicReader> readers;
+ */
+ private ConcurrentHashMap<Integer, ImageMosaicReader> readers =new ConcurrentHashMap<Integer, ImageMosaicReader>();
/**
* Constructor for an {@link ImagePyramidReader}.
@@ -173,23 +172,16 @@
// //
if (source == null) {
- final NullPointerException ex = new NullPointerException("ImagePyramidReader:No source set to read this coverage.");
- throw new DataSourceException(ex);
+ throw new DataSourceException("ImagePyramidReader:Null source set to read this coverage.");
}
this.source = source;
this.sourceURL = Utils.checkSource(source, uHints);
if(sourceURL == null) {
- throw new IllegalArgumentException(
- "This plugin accepts only File, URL and String pointing to a file");
+ throw new IllegalArgumentException("This plugin accepts only File, URL and String pointing to a file");
}
// //
- //
- // Load tiles informations, especially the bounds, which will be
- // reused
- //
// //
- // //
//
// get the crs if able to
//
@@ -226,8 +218,6 @@
//
// Load properties file with information about levels and envelope
//
-
- // property file
parseMainFile(sourceURL);
}
@@ -240,6 +230,10 @@
* @throws FileNotFoundException
*/
private void parseMainFile(final URL sourceURL) throws IOException {
+
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.fine("Parsing pyramid properties file at:"+sourceURL.toExternalForm());
+ }
BufferedInputStream propertyStream = null;
InputStream openStream = null;
try {
@@ -265,10 +259,6 @@
numOverviews = Integer.parseInt(properties.getProperty("LevelsNum")) - 1;
levelsDirs = properties.getProperty("LevelsDirs").split(" ");
- // readers soft map
- final int readersCacheSize = (numOverviews + 1) / 3;
- readers = new SoftValueHashMap<Integer, ImageMosaicReader>(readersCacheSize == 0 ? numOverviews + 1 : readersCacheSize);
-
// resolutions levels
final String levels = properties.getProperty("Levels");
pairs = levels.split(" ");
@@ -295,7 +285,11 @@
);
final GridToEnvelopeMapper geMapper= new GridToEnvelopeMapper(originalGridRange,originalEnvelope);
geMapper.setPixelAnchor(PixelInCell.CELL_CORNER);
- raster2Model= geMapper.createTransform();
+ raster2Model= geMapper.createTransform();
+
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.fine("Parsed pyramid properties file at:"+sourceURL.toExternalForm());
+ }
} finally {
// close input stream
if (propertyStream != null)
@@ -335,21 +329,26 @@
*
* @see org.opengis.coverage.grid.GridCoverageReader#read(org.opengis.parameter.GeneralParameterValue[])
*/
- @SuppressWarnings("unchecked")
public GridCoverage2D read(GeneralParameterValue[] params) throws IOException {
+
+ //light check to see if this reader had been disposed, not synching for performance. We'll check again later on.
+ if(readers==null){
+ throw new IllegalStateException("This ImagePyramidReader has already been disposed");
+ }
GeneralEnvelope requestedEnvelope = null;
Rectangle dim = null;
OverviewPolicy overviewPolicy=null;
if (params != null) {
- // /////////////////////////////////////////////////////////////////////
+
//
// Checking params
//
- // /////////////////////////////////////////////////////////////////////
+
if (params != null) {
for (int i = 0; i < params.length; i++) {
- final ParameterValue param = (ParameterValue) params[i];
+ @SuppressWarnings("rawtypes")
+ final ParameterValue param = (ParameterValue) params[i];
if (param == null){
continue;
}
@@ -367,11 +366,10 @@
}
}
}
- // /////////////////////////////////////////////////////////////////////
+
//
// Loading tiles
//
- // /////////////////////////////////////////////////////////////////////
return loadTiles(requestedEnvelope, dim, params, overviewPolicy);
}
@@ -391,7 +389,7 @@
Rectangle dim, GeneralParameterValue[] params, OverviewPolicy overviewPolicy)
throws IOException {
- // /////////////////////////////////////////////////////////////////////
+
//
// Check if we have something to load by intersecting the requested
// envelope with the bounds of the data set.
@@ -400,7 +398,7 @@
// we have to perform a conversion towards the latter crs before
// intersecting anything.
//
- // /////////////////////////////////////////////////////////////////////
+
if (requestedEnvelope != null) {
if (!CRS.equalsIgnoreMetadata(requestedEnvelope
.getCoordinateReferenceSystem(), this.crs)) {
@@ -468,37 +466,56 @@
throws TransformException, IOException {
// if we get here we have something to load
- // /////////////////////////////////////////////////////////////////////
+
//
// compute the requested resolution
//
- // /////////////////////////////////////////////////////////////////////
final ImageReadParam readP = new ImageReadParam();
Integer imageChoice=0;
if (dim != null)
imageChoice = setReadParams(overviewPolicy, readP,requestedEnvelope, dim);
- // /////////////////////////////////////////////////////////////////////
+
//
// Check to have the needed reader in memory
//
- // /////////////////////////////////////////////////////////////////////
- ImageMosaicReader reader = null;
- synchronized (readers) {
- Object o = readers.get(imageChoice);
- if (o == null) {
- final String levelDirName = levelsDirs[imageChoice.intValue()];
- final URL parentUrl = DataUtilities.getParentUrl(sourceURL);
- // look for a shapefile first
- final String extension = new StringBuilder(levelDirName).append("/").append(coverageName).append(".shp").toString();
- final URL shpFileUrl = DataUtilities.extendURL(parentUrl,extension);
- if(shpFileUrl.getProtocol()!=null&&shpFileUrl.getProtocol().equalsIgnoreCase("file")&&!DataUtilities.urlToFile(shpFileUrl).exists())
- reader= new ImageMosaicReader(DataUtilities.extendURL(parentUrl,levelDirName), hints);
- else
- reader = new ImageMosaicReader(shpFileUrl,hints);
- readers.put(imageChoice, reader);
-
- } else
- reader = (ImageMosaicReader) o;
+
+ // light check to see if this reader had been disposed, not synching for performance.
+ if (readers == null) {
+ throw new IllegalStateException("This ImagePyramidReader has already been disposed");
+ }
+
+ ImageMosaicReader reader = readers.get(imageChoice);
+ if (reader == null) {
+
+ //
+ // we must create the underlying mosaic
+ //
+ final String levelDirName = levelsDirs[imageChoice.intValue()];
+ final URL parentUrl = DataUtilities.getParentUrl(sourceURL);
+ // look for a shapefile first
+ final String extension = new StringBuilder(levelDirName).append("/").append(coverageName).append(".shp").toString();
+ final URL shpFileUrl = DataUtilities.extendURL(parentUrl, extension);
+ if (shpFileUrl.getProtocol() != null
+ && shpFileUrl.getProtocol().equalsIgnoreCase("file")
+ && !DataUtilities.urlToFile(shpFileUrl).exists())
+ reader = new ImageMosaicReader(DataUtilities.extendURL(parentUrl, levelDirName), hints);
+ else
+ reader = new ImageMosaicReader(shpFileUrl, hints);
+ final ImageMosaicReader putByOtherThreadJustNow =readers.putIfAbsent(imageChoice, reader);
+ if(putByOtherThreadJustNow!=null){
+ // some other thread just did inserted this
+ try{
+ reader.dispose();
+ } catch (Exception e) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.log(Level.FINE,e.getLocalizedMessage(),e);
+ }
+ }
+
+ //use the other one
+ reader=putByOtherThreadJustNow;
+ }
+
}
@@ -521,7 +538,31 @@
@Override
public synchronized void dispose() {
super.dispose();
+
+ // dispose all the underlying ImageMosaicReader if we need to
+ if(readers==null){
+ return;
+ }
+ for(ImageMosaicReader reader:readers.values()){
+ try{
+ reader.dispose();
+ } catch (Exception e) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.log(Level.FINE,e.getLocalizedMessage(),e);
+ }
+ }
+ }
+ // now clear the map
+ try{
+
+ readers.clear();
+ } catch (Exception e) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.log(Level.FINE,e.getLocalizedMessage(),e);
+ }
+ }
readers.clear();
+ readers=null;
}
/**
Modified: branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java
===================================================================
--- branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java 2011-12-18 11:57:59 UTC (rev 38424)
+++ branches/2.7.x/modules/plugin/imagepyramid/src/main/java/org/geotools/gce/imagepyramid/Utils.java 2011-12-18 23:23:59 UTC (rev 38425)
@@ -26,12 +26,15 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.io.filefilter.FileFilterUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.geotools.data.DataUtilities;
@@ -46,7 +49,8 @@
/**
* Code to build a pyramid from a gdal_retile output
*
- * @author Andrea Aime - OpenGeo
+ * @author Andrea Aime - GeoSolutions SAS
+ * @author Simone Giannecchini, GeoSolutions SAS
*
*/
class Utils {
@@ -60,11 +64,10 @@
static URL checkSource(Object source, Hints hints) {
URL sourceURL = null;
File sourceFile = null;
- // /////////////////////////////////////////////////////////////////////
+
//
// Check source
//
- // /////////////////////////////////////////////////////////////////////
// if it is a URL or a String let's try to see if we can get a file to
// check if we have to build the index
if (source instanceof File) {
@@ -94,15 +97,23 @@
}
} else {
// we really don't know how to convert the thing... give up
+ if(LOGGER.isLoggable(Level.WARNING)){
+ LOGGER.warning("we really don't know how to convert the thing:"+source!=null?source.toString():"null");
+ }
return null;
}
-
- // /////////////////////////////////////////////////////////////////////
+
+ // logging
+ if(LOGGER.isLoggable(Level.INFO)){
+ if(sourceFile!=null){
+ final String message = fileStatus(sourceFile);
+ LOGGER.info(message);
+ }
+ }
+
//
// Handle cases where the pyramid descriptor file already exists
//
- // /////////////////////////////////////////////////////////////////////
-
// can't do anything with it
if(sourceFile == null || !sourceFile.exists())
return sourceURL;
@@ -114,16 +125,20 @@
// it's a directory, let's see if it already has a pyramid description file inside
File directory = sourceFile;
sourceFile = new File(directory, directory.getName() + ".properties");
+ // logging
+ if(LOGGER.isLoggable(Level.INFO)){
+ if(sourceFile!=null){
+ final String message = fileStatus(sourceFile);
+ LOGGER.info(message);
+ }
+ }
if(sourceFile.exists())
return DataUtilities.fileToURL(sourceFile);
- // /////////////////////////////////////////////////////////////////////
//
// Try to build the sub-folders mosaics
//
- // /////////////////////////////////////////////////////////////////////
-
// if the structure of the directories is gdal_retile like, move the root files in their
// own sub directory
File zeroLevelDirectory = new File(directory, "0");
@@ -132,21 +147,39 @@
File[] directories = directory.listFiles((FileFilter) directoryFilter);
// do we have at least one sub-directory?
- if(directories.length == 0)
+ if(directories.length == 0){
+ if(LOGGER.isLoggable(Level.INFO)){
+ LOGGER.info("I was unable to determine a structure similar to the GDAL Retile one!!");
+ }
return null;
+ }
// check the gdal case and move files if necessary
if(!zeroLevelDirectory.exists() && numericDirectories.length == directories.length) {
LOGGER.log(Level.INFO, "Detected gdal_retile file structure, " +
"moving root files to the '0' subdirectory");
if(zeroLevelDirectory.mkdir()) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.fine("Created '0' subidr, now moving files");
+ }
FileFilter notDirFilter = FileFilterUtils.notFileFilter(directoryFilter);
for (File f : directory.listFiles(notDirFilter)) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.fine("Moving file"+f.getAbsolutePath());
+ }
+ if(LOGGER.isLoggable(Level.FINEST)){
+ LOGGER.finest(fileStatus(f));
+ }
if(!f.renameTo(new File(zeroLevelDirectory, f.getName())))
- LOGGER.log(Level.INFO, "Could not move " + f.getAbsolutePath() +
+ LOGGER.log(Level.WARNING, "Could not move " + f.getAbsolutePath() +
" to " + zeroLevelDirectory);
}
directories = directory.listFiles((FileFilter) directoryFilter);
+ } else {
+ if(LOGGER.isLoggable(Level.INFO)){
+ LOGGER.info("I was unable to create the 0 directory. check the file permission in the parent directory:"+sourceFile.getParent());
+ }
+ return null;
}
}
@@ -155,7 +188,14 @@
ImageMosaicFormat mosaicFactory = new ImageMosaicFormat();
for (File subdir : directories) {
if(mosaicFactory.accepts(subdir, hints)) {
+ if(LOGGER.isLoggable(Level.FINE)){
+ LOGGER.fine("Trying to build mosaic for the directory:"+subdir.getAbsolutePath());
+ }
mosaics.add(new MosaicInfo(subdir, mosaicFactory.getReader(subdir, hints)));
+ } else {
+ if(LOGGER.isLoggable(Level.INFO)){
+ LOGGER.info("Unable to build mosaic for the directory:"+subdir.getAbsolutePath());
+ }
}
}
@@ -178,12 +218,9 @@
}
}
- // /////////////////////////////////////////////////////////////////////
//
// We have everything we need, build the final pyramid descriptor info
- //
- // /////////////////////////////////////////////////////////////////////
-
+ //
// build the property file
Properties properties = new Properties();
properties.put("Name", directory.getName());
@@ -210,7 +247,7 @@
return null;
} finally {
if(os != null)
- try { os.close(); } catch(IOException e) {}
+ IOUtils.closeQuietly(os);
}
// build the .prj file if possible
@@ -231,12 +268,40 @@
return DataUtilities.fileToURL(sourceFile);
}
+
+ /**
+ * Prepares a message with the status of the provided file.
+ * @param sourceFile The {@link File} to provided the status message for
+ * @return a status message for the provided {@link File} or a {@link NullPointerException} in case the {@link File}is <code>null</code>.
+ */
+ private static String fileStatus(File sourceFile) {
+ if(sourceFile==null){
+ throw new NullPointerException("Provided null input to fileStatus method");
+ }
+ final StringBuilder builder = new StringBuilder();
+ builder.append("Checking file:").append(FilenameUtils.getFullPath(sourceFile.getAbsolutePath())).append("\n");
+ builder.append("exists").append(sourceFile.exists()).append("\n");
+ builder.append("isFile").append(sourceFile.isFile()).append("\n");
+ builder.append("canRead:").append(sourceFile.canRead()).append("\n");
+ builder.append("canWrite").append(sourceFile.canWrite()).append("\n");
+ builder.append("canExecute").append(sourceFile.canExecute()).append("\n");
+ builder.append("isHidden:").append(sourceFile.isHidden()).append("\n");
+ builder.append("lastModified").append(sourceFile.lastModified()).append("\n");
+
+ return builder.toString();
+ }
/**
* Stores informations about a mosaic
*/
static class MosaicInfo implements Comparable<MosaicInfo>{
+ @Override
+ public String toString() {
+ return "MosaicInfo [directory=" + directory + ", resolutions="
+ + Arrays.toString(resolutions) + "]";
+ }
+
File directory;
ImageMosaicReader reader;
double[] resolutions;
Modified: branches/2.7.x/modules/plugin/imagepyramid/src/test/java/org/geotools/gce/imagepyramid/ImagePyramidReaderTest.java
===================================================================
--- branches/2.7.x/modules/plugin/imagepyramid/src/test/java/org/geotools/gce/imagepyramid/ImagePyramidReaderTest.java 2011-12-18 11:57:59 UTC (rev 38424)
+++ branches/2.7.x/modules/plugin/imagepyramid/src/test/java/org/geotools/gce/imagepyramid/ImagePyramidReaderTest.java 2011-12-18 23:23:59 UTC (rev 38425)
@@ -159,22 +159,22 @@
public void testDefaultParameterValue() throws IOException,
MismatchedDimensionException, NoSuchAuthorityCodeException {
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final URL testFile = TestData.getResource(this, TEST_FILE);//
assertNotNull(testFile);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get a reader
//
//
- // /////////////////////////////////////////////////////////////////
+
final AbstractGridFormat format = new ImagePyramidFormat();
assertTrue(format.accepts(testFile));
final ImagePyramidReader reader = (ImagePyramidReader) format
@@ -182,12 +182,12 @@
assertNotNull(reader);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Show the coverage
//
//
- // /////////////////////////////////////////////////////////////////
+
final GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
assertEquals("pyramid", coverage.getName().toString());
assertNotNull("Null value returned instead of a coverage", coverage);
@@ -205,22 +205,22 @@
public void testDefaultParameterValueFile() throws IOException,
MismatchedDimensionException, NoSuchAuthorityCodeException {
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final File testFile = TestData.file(this, TEST_FILE);//
assertNotNull(testFile);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get a reader
//
//
- // /////////////////////////////////////////////////////////////////
+
final AbstractGridFormat format = new ImagePyramidFormat();
assertTrue(format.accepts(testFile));
final ImagePyramidReader reader = (ImagePyramidReader) format
@@ -228,12 +228,12 @@
assertNotNull(reader);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Show the coverage
//
//
- // /////////////////////////////////////////////////////////////////
+
final GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
assertNotNull("Null value returned instead of a coverage", coverage);
assertTrue("coverage dimensions different from what we expected",
@@ -250,23 +250,23 @@
public void testDefaultParameterValueString() throws IOException,
MismatchedDimensionException, NoSuchAuthorityCodeException {
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final String testFile = TestData.file(this, TEST_FILE)
.getCanonicalPath();//
assertNotNull(testFile);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get a reader
//
//
- // /////////////////////////////////////////////////////////////////
+
final AbstractGridFormat format = new ImagePyramidFormat();
assertTrue(format.accepts(testFile));
final ImagePyramidReader reader = (ImagePyramidReader) format
@@ -274,12 +274,12 @@
assertNotNull(reader);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Show the coverage
//
//
- // /////////////////////////////////////////////////////////////////
+
final GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
assertNotNull("Null value returned instead of a coverage", coverage);
assertTrue("coverage dimensions different from what we expected",
@@ -296,21 +296,21 @@
public void testForErrors() throws IOException,
MismatchedDimensionException, NoSuchAuthorityCodeException {
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final File testFile = TestData.file(this, TEST_FILE);//
assertNotNull(testFile);
- // /////////////////////////////////////////////////////////////////
+
//
// Null argument
//
//
- // /////////////////////////////////////////////////////////////////
+
ImagePyramidReader reader = null;
try {
reader = new ImagePyramidReader(null, new Hints(
@@ -320,12 +320,12 @@
}
assertNull(reader);
- // /////////////////////////////////////////////////////////////////
+
//
// Illegal arguments
//
//
- // /////////////////////////////////////////////////////////////////
+
try {
reader = new ImagePyramidReader(new FileInputStream(testFile),
new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER,
@@ -343,12 +343,12 @@
}
assertNull(reader);
- // /////////////////////////////////////////////////////////////////
+
//
// Unsopported operations
//
//
- // /////////////////////////////////////////////////////////////////
+
reader = new ImagePyramidReader(testFile, new Hints(
Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE));
@@ -381,43 +381,43 @@
MismatchedDimensionException, NoSuchAuthorityCodeException {
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final URL testFile = TestData.getResource(this, TEST_FILE);
assertNotNull(testFile);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get a reader
//
//
- // /////////////////////////////////////////////////////////////////
+
final ImagePyramidReader reader = new ImagePyramidReader(
testFile,
new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE));
assertNotNull(reader);
//
- // /////////////////////////////////////////////////////////////////
+
//
// alpha on output
//
//
- // /////////////////////////////////////////////////////////////////
+
final ParameterValue<Color> transp = ImageMosaicFormat.INPUT_TRANSPARENT_COLOR.createValue();
transp.setValue(Color.black);
- // /////////////////////////////////////////////////////////////////
+
//
// Show the coverage
//
//
- // /////////////////////////////////////////////////////////////////
+
GridCoverage2D coverage = (GridCoverage2D) reader.read(new GeneralParameterValue[] { transp });
assertNotNull(coverage);
assertTrue("coverage dimensions different from what we expected",coverage.getGridGeometry().getGridRange().getSpan(0) == 250&& coverage.getGridGeometry().getGridRange().getSpan(1) == 250);
@@ -475,31 +475,31 @@
public void testCropHighestLevel() throws IOException,
MismatchedDimensionException, NoSuchAuthorityCodeException {
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final URL testFile = TestData.getResource(this, TEST_FILE);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get a reader
//
//
- // /////////////////////////////////////////////////////////////////
+
final AbstractGridFormat format = new ImagePyramidFormat();
final ImagePyramidReader reader = (ImagePyramidReader) format.getReader(testFile);
assertNotNull(reader);
- // /////////////////////////////////////////////////////////////////
+
//
// crop
//
//
- // /////////////////////////////////////////////////////////////////
+
final ParameterValue<GridGeometry2D> gg = ImageMosaicFormat.READ_GRIDGEOMETRY2D.createValue();
final GeneralEnvelope oldEnvelop = reader.getOriginalEnvelope();
final GeneralEnvelope cropEnvelope = new GeneralEnvelope(new double[] {
@@ -514,12 +514,12 @@
250, 250)), cropEnvelope));
//
- // /////////////////////////////////////////////////////////////////
+
//
// Show the coverage
//
//
- // /////////////////////////////////////////////////////////////////
+
GridCoverage2D coverage = ((GridCoverage2D) reader
.read(new GeneralParameterValue[] { gg }));
assertNotNull("Null value returned instead of a coverage", coverage);
@@ -553,31 +553,31 @@
public void testCropLevel1() throws IOException,
MismatchedDimensionException, NoSuchAuthorityCodeException {
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final URL testFile = TestData.getResource(this, TEST_FILE);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get a reader
//
//
- // /////////////////////////////////////////////////////////////////
+
final AbstractGridFormat format = new ImagePyramidFormat();
final ImagePyramidReader reader = (ImagePyramidReader) format.getReader(testFile);
assertNotNull(reader);
- // /////////////////////////////////////////////////////////////////
+
//
// crop
//
//
- // /////////////////////////////////////////////////////////////////
+
final ParameterValue<GridGeometry2D> gg = ImageMosaicFormat.READ_GRIDGEOMETRY2D.createValue();
final GeneralEnvelope oldEnvelop = reader.getOriginalEnvelope();
final GeneralEnvelope cropEnvelope = new GeneralEnvelope(new double[] {
@@ -592,12 +592,12 @@
125, 125)), cropEnvelope));
//
- // /////////////////////////////////////////////////////////////////
+
//
// Show the coverage
//
//
- // /////////////////////////////////////////////////////////////////
+
GridCoverage2D coverage = ((GridCoverage2D) reader
.read(new GeneralParameterValue[] { gg }));
assertNotNull("Null value returned instead of a coverage", coverage);
@@ -631,31 +631,31 @@
public void testCropLevel2() throws IOException,
MismatchedDimensionException, NoSuchAuthorityCodeException {
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final URL testFile = TestData.getResource(this, TEST_FILE);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get a reader
//
//
- // /////////////////////////////////////////////////////////////////
+
final AbstractGridFormat format = new ImagePyramidFormat();
final ImagePyramidReader reader = (ImagePyramidReader) format.getReader(testFile);
assertNotNull(reader);
- // /////////////////////////////////////////////////////////////////
+
//
// crop
//
//
- // /////////////////////////////////////////////////////////////////
+
final ParameterValue<GridGeometry2D> gg = ImageMosaicFormat.READ_GRIDGEOMETRY2D
.createValue();
final GeneralEnvelope oldEnvelop = reader.getOriginalEnvelope();
@@ -671,12 +671,12 @@
62, 62)), cropEnvelope));
//
- // /////////////////////////////////////////////////////////////////
+
//
// Show the coverage
//
//
- // /////////////////////////////////////////////////////////////////
+
GridCoverage2D coverage = ((GridCoverage2D) reader
.read(new GeneralParameterValue[] { gg }));
assertNotNull("Null value returned instead of a coverage", coverage);
@@ -710,31 +710,31 @@
public void testCropLevel3() throws IOException,
MismatchedDimensionException, NoSuchAuthorityCodeException {
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final URL testFile = TestData.getResource(this, TEST_FILE);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get a reader
//
//
- // /////////////////////////////////////////////////////////////////
+
final AbstractGridFormat format = new ImagePyramidFormat();
final ImagePyramidReader reader = (ImagePyramidReader) format.getReader(testFile);
assertNotNull(reader);
- // /////////////////////////////////////////////////////////////////
+
//
// crop
//
//
- // /////////////////////////////////////////////////////////////////
+
final ParameterValue<GridGeometry2D> gg = ImageMosaicFormat.READ_GRIDGEOMETRY2D.createValue();
final GeneralEnvelope oldEnvelop = reader.getOriginalEnvelope();
final GeneralEnvelope cropEnvelope = new GeneralEnvelope(new double[] {
@@ -749,12 +749,12 @@
25, 25)), cropEnvelope));
//
- // /////////////////////////////////////////////////////////////////
+
//
// Show the coverage
//
//
- // /////////////////////////////////////////////////////////////////
+
GridCoverage2D coverage = ((GridCoverage2D) reader
.read(new GeneralParameterValue[] { gg }));
assertNotNull("Null value returned instead of a coverage", coverage);
@@ -778,12 +778,12 @@
public void testDefaultParameterValueURLtoJAR() throws IOException,
MismatchedDimensionException, NoSuchAuthorityCodeException {
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final URL testJarFile = TestData.getResource(this, TEST_JAR_FILE);
assertNotNull(testJarFile);
@@ -793,12 +793,12 @@
assertNotNull(testFile);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get a reader
//
//
- // /////////////////////////////////////////////////////////////////
+
final AbstractGridFormat format = new ImagePyramidFormat();
assertTrue(format.accepts(testFile));
final ImagePyramidReader reader = (ImagePyramidReader) format
@@ -806,12 +806,12 @@
assertNotNull(reader);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Show the coverage
//
//
- // /////////////////////////////////////////////////////////////////
+
final GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
assertNotNull("Null value returned instead of a coverage", coverage);
assertTrue("coverage dimensions different from what we expected",
@@ -834,12 +834,12 @@
public void testDefaultParameterValueStringtoURLtoJAR() throws IOException,
MismatchedDimensionException, NoSuchAuthorityCodeException {
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get the resource.
//
//
- // /////////////////////////////////////////////////////////////////
+
final URL testJarFile = TestData.getResource(this, TEST_JAR_FILE);
assertNotNull(testJarFile);
@@ -848,12 +848,12 @@
assertNotNull(spec);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Get a reader
//
//
- // /////////////////////////////////////////////////////////////////
+
final AbstractGridFormat format = new ImagePyramidFormat();
assertTrue(format.accepts(spec));
final ImagePyramidReader reader = (ImagePyramidReader) format
@@ -861,12 +861,12 @@
assertNotNull(reader);
//
- // /////////////////////////////////////////////////////////////////
+
//
// Show the coverage
//
//
- // /////////////////////////////////////////////////////////////////
+
final GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
assertNotNull("Null value returned instead of a coverage", coverage);
assertTrue("coverage dimensions different from what we expected",
|
|
From: <svn...@os...> - 2011-12-18 11:58:05
|
Author: jive
Date: 2011-12-18 03:57:59 -0800 (Sun, 18 Dec 2011)
New Revision: 38424
Modified:
trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureCollection.java
trunk/modules/unsupported/pom.xml
Log:
Ask ContentFeatureCollection to generate the resulting FeatureType using the same FeatureTypes.transform method as employed by the feature readers - see GEOT-2026
Modified: trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureCollection.java
===================================================================
--- trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureCollection.java 2011-12-18 11:54:33 UTC (rev 38423)
+++ trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureCollection.java 2011-12-18 11:57:59 UTC (rev 38424)
@@ -25,6 +25,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.geotools.data.DataUtilities;
import org.geotools.data.DefaultQuery;
@@ -40,9 +42,11 @@
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
import org.geotools.feature.FeatureTypes;
+import org.geotools.feature.SchemaException;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.filter.SortBy;
import org.geotools.geometry.jts.ReferencedEnvelope;
+import org.geotools.util.logging.Logging;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;
@@ -63,6 +67,7 @@
*/
public class ContentFeatureCollection implements SimpleFeatureCollection {
+ protected static final Logger LOGGER = Logging.getLogger("org.geotools.data.store");
/**
* feature store the collection originated from.
*/
@@ -103,8 +108,7 @@
listener.collectionChanged( event );
}
catch (Throwable t ){
- //TODO: log this
- //ContentDataStore.LOGGER.log( Level.WARNING, "Problem encountered during notification of "+event, t );
+ LOGGER.log( Level.WARNING, "Problem encountered during notification of "+event, t );
}
}
}
@@ -121,6 +125,19 @@
this.featureType =
SimpleFeatureTypeBuilder.retype(this.featureType, query.getPropertyNames() );
}
+ // Check for change in coordinate reference system
+ // (Even if featureSource.canReproject the feature reader, we will need to adjust the
+ // featureType generated here to be correct)
+ try {
+ if (query.getCoordinateSystemReproject() != null){
+ this.featureType = FeatureTypes.transform(this.featureType, query.getCoordinateSystemReproject() );
+ }
+ else if (query.getCoordinateSystem() != null){
+ this.featureType = FeatureTypes.transform(this.featureType, query.getCoordinateSystem() );
+ }
+ } catch (SchemaException e) {
+ LOGGER.log(Level.FINER,"Problem handling Query change of CoordinateReferenceSystem:"+e,e);
+ }
//check for join and expand attributes as necessary
if (!query.getJoins().isEmpty()) {
Modified: trunk/modules/unsupported/pom.xml
===================================================================
--- trunk/modules/unsupported/pom.xml 2011-12-18 11:54:33 UTC (rev 38423)
+++ trunk/modules/unsupported/pom.xml 2011-12-18 11:57:59 UTC (rev 38424)
@@ -152,12 +152,6 @@
</modules>
</profile>
<profile>
- <id>property</id>
- <modules>
- <module>property-ng</module>
- </modules>
- </profile>
- <profile>
<id>feature-aggreate</id>
<modules>
<module>feature-aggreate</module>
@@ -201,6 +195,7 @@
<module>mark-wkt</module>
<module>feature-aggregate</module>
<module>mongodb</module>
+ <module>property-ng</module>
</modules>
</profile>
</profiles>
|
|
From: <svn...@os...> - 2011-12-18 11:54:40
|
Author: jive
Date: 2011-12-18 03:54:33 -0800 (Sun, 18 Dec 2011)
New Revision: 38423
Added:
trunk/modules/library/data/src/main/java/org/geotools/data/store/EventContentFeatureWriter.java
Removed:
trunk/modules/unsupported/property-ng/src/main/java/org/geotools/data/property/ng/PropertyAttributeWriter.java
Modified:
trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureSource.java
trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureStore.java
trunk/modules/library/data/src/main/java/org/geotools/data/store/DiffTransactionState.java
trunk/modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCFeatureStore.java
trunk/modules/unsupported/csv/src/main/java/org/geotools/data/csv/CSVFeatureStore.java
trunk/modules/unsupported/property-ng/src/main/java/org/geotools/data/property/ng/PropertyFeatureStore.java
Log:
Initial cut of EventContentFeatureWriter for GEOT-3956
Modified: trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureSource.java
===================================================================
--- trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureSource.java 2011-12-13 11:08:18 UTC (rev 38422)
+++ trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureSource.java 2011-12-18 11:54:33 UTC (rev 38423)
@@ -860,13 +860,26 @@
* If a subclass can handle transactions natively it should override this
* method to return <code>true</code> and deal with transactions on its own,
* including firing feature modifications events.
- * @return
+ * @return true if transaction independence has custom implementation
*/
protected boolean canTransact() {
return false;
}
/**
+ * Determines if the store takes responsibility for issuing events.
+ * <p>
+ * If a subclass issue events (as part of its low level writer implementation)
+ * then it should override this method to return true.
+ *
+ * @return true if event notification has custom implementation
+ */
+ protected boolean canEvent() {
+ return false;
+ }
+
+
+ /**
* Creates a new feature source for the specified query.
* <p>
* If the current feature source already has a defining query it is joined
Modified: trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureStore.java
===================================================================
--- trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureStore.java 2011-12-13 11:08:18 UTC (rev 38422)
+++ trunk/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureStore.java 2011-12-18 11:54:33 UTC (rev 38423)
@@ -141,6 +141,7 @@
query = resolvePropertyNames(query);
FeatureWriter<SimpleFeatureType, SimpleFeature> writer;
+
if (!canTransact() && transaction != null && transaction != Transaction.AUTO_COMMIT) {
DiffTransactionState state = (DiffTransactionState) getTransaction().getState(getEntry());
FeatureReader<SimpleFeatureType, SimpleFeature> reader = getReader(query);
@@ -148,6 +149,10 @@
} else {
writer = getWriterInternal(query, flags);
+ // events
+ if (canTransact() && !canEvent()){
+ writer = new EventContentFeatureWriter(this, writer );
+ }
// filtering
if (!canFilter()) {
if (query.getFilter() != null && query.getFilter() != Filter.INCLUDE) {
Modified: trunk/modules/library/data/src/main/java/org/geotools/data/store/DiffTransactionState.java
===================================================================
--- trunk/modules/library/data/src/main/java/org/geotools/data/store/DiffTransactionState.java 2011-12-13 11:08:18 UTC (rev 38422)
+++ trunk/modules/library/data/src/main/java/org/geotools/data/store/DiffTransactionState.java 2011-12-18 11:54:33 UTC (rev 38423)
@@ -79,35 +79,8 @@
/**
* Will apply differences to store.
*
- * @see org.geotools.data.Transaction.State#commit()
- */
- public synchronized void commit() throws IOException {
- applyDiff();
- }
-
- @Override
- /**
- * @see org.geotools.data.Transaction.State#rollback()
- */
- public synchronized void rollback() throws IOException {
- diff.clear(); // rollback differences
- state.fireBatchFeatureEvent(false);
- }
-
- @Override
-
- /**
- * @see org.geotools.data.Transaction.State#addAuthorization(java.lang.String)
- */
- public synchronized void addAuthorization(String AuthID) throws IOException {
- // not required for TransactionStateDiff
- }
-
- /**
- * Called by commit() to apply one set of diff
- *
* <p>
- * The provided <code> will be modified as the differences are applied,
+ * The provided diff will be modified as the differences are applied,
* If the operations are all successful diff will be empty at
* the end of this process.
* </p>
@@ -131,9 +104,10 @@
* @param diff differences to apply to FeatureWriter
*
* @throws IOException If the entire diff cannot be writen out
- * @throws DataSourceException If the entire diff cannot be writen out
+ * @t
+ * @see org.geotools.data.Transaction.State#commit()
*/
- void applyDiff() throws IOException {
+ public synchronized void commit() throws IOException {
if (diff.isEmpty()) {
return; // nothing to do
}
@@ -242,4 +216,22 @@
}
}
}
+
+ @Override
+ /**
+ * @see org.geotools.data.Transaction.State#rollback()
+ */
+ public synchronized void rollback() throws IOException {
+ diff.clear(); // rollback differences
+ state.fireBatchFeatureEvent(false);
+ }
+
+ @Override
+
+ /**
+ * @see org.geotools.data.Transaction.State#addAuthorization(java.lang.String)
+ */
+ public synchronized void addAuthorization(String AuthID) throws IOException {
+ // not required for TransactionStateDiff
+ }
}
\ No newline at end of file
Added: trunk/modules/library/data/src/main/java/org/geotools/data/store/EventContentFeatureWriter.java
===================================================================
--- trunk/modules/library/data/src/main/java/org/geotools/data/store/EventContentFeatureWriter.java (rev 0)
+++ trunk/modules/library/data/src/main/java/org/geotools/data/store/EventContentFeatureWriter.java 2011-12-18 11:54:33 UTC (rev 38423)
@@ -0,0 +1,184 @@
+/*
+ * GeoTools - The Open Source Java GIS Toolkit
+ * http://geotools.org
+ *
+ * (C) 2011, Open Source Geospatial Foundation (OSGeo)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ */
+package org.geotools.data.store;
+
+import java.io.IOException;
+
+import org.geotools.data.BatchFeatureEvent;
+import org.geotools.data.Diff;
+import org.geotools.data.DiffFeatureWriter;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.Transaction;
+import org.geotools.geometry.jts.ReferencedEnvelope;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+
+/**
+ * FeatureWriter wrapper that issues events modifications as required.
+ * <p>
+ * It is the responsibility of a FeatureStore to issue events to interested parties as content is modified. The {@link ContentState} keeps track of
+ * the listeners, while {@link EventContentFeatureWriter} is willing to fire the events as needed.
+ * <p>
+ * Event generation happens in two passes:
+ * <ul>
+ * <li>As features are modified events are sent out one at a time</li>
+ * <li>When commit() or rollback() is called a "batch" event is sent out</li>
+ * </ul>
+ * The only trick is the comment() event contains our only indication of the final FeatureIDs generated for new features. The
+ * {@link BatchFeatureEvent} maintains a map of BEFORE/AFTER values allowing any interested party to update their seleciton.
+ * <p>
+ * Please note that if you are using {@link DiffFeatureWriter} it sends out events on its own.
+ *
+ * @author Jody Garnett (LISASoft)
+ *
+ * @source $URL$
+ */
+public class EventContentFeatureWriter implements FeatureWriter<SimpleFeatureType, SimpleFeature> {
+
+ ContentState state;
+
+ SimpleFeature feature; // live value supplied by writer
+
+ ContentFeatureStore store;
+
+ FeatureWriter<SimpleFeatureType, SimpleFeature> writer;
+
+
+ /**
+ * EventContentFeatureWriter construction.
+ *
+ * @param reader
+ * @param diff
+ * @param filter
+ */
+ public EventContentFeatureWriter(ContentFeatureStore store,
+ FeatureWriter<SimpleFeatureType, SimpleFeature> writer) {
+ this.store = store;
+ this.writer = writer;
+ this.state = store.getState();
+
+ Transaction t = state.getTransaction();
+ if( t != Transaction.AUTO_COMMIT ){
+ // auto commit does not issue batch events
+ t.putState(this,new EventContentTransactionState());
+ }
+ }
+
+ /**
+ * Supplys FeatureTypeFrom reader
+ *
+ * @see org.geotools.data.FeatureWriter#getFeatureType()
+ */
+ public SimpleFeatureType getFeatureType() {
+ return writer.getFeatureType();
+ }
+
+ /**
+ * Next Feature from reader or new content.
+ *
+ * @see org.geotools.data.FeatureWriter#next()
+ */
+ public SimpleFeature next() throws IOException {
+ feature = writer.next();
+ return feature;
+ }
+
+ /**
+ * @see org.geotools.data.FeatureWriter#remove()
+ */
+ public void remove() throws IOException {
+ state.fireFeatureRemoved(store, feature);
+ writer.remove();
+ }
+
+ /**
+ * Writes out the current feature.
+ *
+ * @throws IOException
+ *
+ * @see org.geotools.data.FeatureWriter#write()
+ */
+ public void write() throws IOException {
+ writer.write();
+ if (feature == null) {
+ throw new IOException("No feature available to write");
+ }
+ if (writer.hasNext()) {
+ // modify existing feature
+ ReferencedEnvelope bounds = ReferencedEnvelope.reference(feature.getBounds());
+ state.fireFeatureUpdated(store, feature, bounds);
+ feature = null;
+ } else {
+ // modify a new feature - ie we are adding something
+ state.fireFeatureAdded(store, feature);
+ }
+ }
+
+ /**
+ * Query for more content.
+ *
+ * @see org.geotools.data.FeatureWriter#hasNext()
+ */
+ public boolean hasNext() throws IOException {
+ return writer.hasNext();
+ }
+
+ /**
+ * Clean up resources associated with this writer.
+ *
+ * <p>
+ * Diff is not clear()ed as it is assumed that it belongs to a Transaction.State object and may yet be written out.
+ * </p>
+ *
+ * @see org.geotools.data.FeatureWriter#close()
+ */
+ public void close() throws IOException {
+ Transaction t = state.getTransaction();
+ if (t != Transaction.AUTO_COMMIT ){
+ t.removeState(this);
+ }
+ if( writer != null ){
+ writer.close();
+ writer = null;
+ }
+ feature = null;
+ }
+ /**
+ * Used to detect commit() and rollback() in order to fire batch feature events.
+ * @author jody
+ *
+ */
+ class EventContentTransactionState implements Transaction.State {
+ @Override
+ public void commit() throws IOException {
+ store.getState().fireBatchFeatureEvent(true);
+ }
+ @Override
+ public void rollback() throws IOException {
+ store.getState().fireBatchFeatureEvent(false);
+ }
+ @Override
+ public void setTransaction(Transaction transaction) {
+ // not needed to issue batch events (as they pretend to be from AUTO_COMMIT)
+ }
+ @Override
+ public void addAuthorization(String AuthID) throws IOException {
+ // functionality not restricted by lock authorisation
+ }
+ }
+
+}
\ No newline at end of file
Modified: trunk/modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCFeatureStore.java
===================================================================
--- trunk/modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCFeatureStore.java 2011-12-13 11:08:18 UTC (rev 38422)
+++ trunk/modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCFeatureStore.java 2011-12-18 11:54:33 UTC (rev 38423)
@@ -93,6 +93,11 @@
getDataStore().getSQLDialect().addSupportedHints(jdbcHints);
hints=Collections.unmodifiableSet(jdbcHints);
}
+
+ /** We handle events internally */
+ protected boolean canEvent() {
+ return true;
+ }
@Override
public JDBCDataStore getDataStore() {
Modified: trunk/modules/unsupported/csv/src/main/java/org/geotools/data/csv/CSVFeatureStore.java
===================================================================
--- trunk/modules/unsupported/csv/src/main/java/org/geotools/data/csv/CSVFeatureStore.java 2011-12-13 11:08:18 UTC (rev 38422)
+++ trunk/modules/unsupported/csv/src/main/java/org/geotools/data/csv/CSVFeatureStore.java 2011-12-18 11:54:33 UTC (rev 38423)
@@ -29,6 +29,11 @@
public CSVFeatureStore(ContentEntry entry, Query query) {
super(entry,query);
}
+ /** We handle events internally */
+ protected boolean canEvent() {
+ return true;
+ }
+
/**
* Access parent CSVDataStore
*/
Deleted: trunk/modules/unsupported/property-ng/src/main/java/org/geotools/data/property/ng/PropertyAttributeWriter.java
===================================================================
--- trunk/modules/unsupported/property-ng/src/main/java/org/geotools/data/property/ng/PropertyAttributeWriter.java 2011-12-13 11:08:18 UTC (rev 38422)
+++ trunk/modules/unsupported/property-ng/src/main/java/org/geotools/data/property/ng/PropertyAttributeWriter.java 2011-12-18 11:54:33 UTC (rev 38423)
@@ -1,152 +0,0 @@
-/*
- * GeoTools - The Open Source Java GIS Toolkit
- * http://geotools.org
- *
- * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License.
- *
- * This library 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
- * Lesser General Public License for more details.
- */
-package org.geotools.data.property.ng;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import org.geotools.data.AttributeWriter;
-import org.geotools.data.DataUtilities;
-import org.geotools.util.Converters;
-import org.opengis.feature.simple.SimpleFeatureType;
-import org.opengis.feature.type.AttributeDescriptor;
-
-import com.vividsolutions.jts.geom.Geometry;
-
-/**
- * Simple AttributeWriter that produces Java properties files.
- * <p>
- * This AttributeWriter is part of the geotools2 DataStore tutorial, and should
- * be considered a Toy.
- * </p>
- * <p>
- * The content produced witll start with the property "_" with the value being
- * the typeSpec describing the featureType. Thereafter each line will represent
- * a Features with FeatureID as the property and the attribtues as the value
- * separated by | characters.
- * </p>
- *
- * <pre>
- * <code>
- * _=id:Integer|name:String|geom:Geometry
- * fid1=1|Jody|<i>well known text</i>
- * fid2=2|Brent|<i>well known text</i>
- * fid3=3|Dave|<i>well known text</i>
- * </code>
- * </pre>
- *
- * @author Jody Garnett
- *
- *
- * @source $URL$
- */
-public class PropertyAttributeWriter implements AttributeWriter {
- BufferedWriter writer;
-
- SimpleFeatureType type;
-
- public PropertyAttributeWriter(File file, SimpleFeatureType featureType)
- throws IOException {
- writer = new BufferedWriter(new FileWriter(file));
- type = featureType;
- writer.write("_=");
- writer.write(DataUtilities.spec(type));
- }
-
- public int getAttributeCount() {
- return type.getAttributeCount();
- }
-
- public AttributeDescriptor getAttributeType(int index)
- throws ArrayIndexOutOfBoundsException {
- return type.getDescriptor(index);
- }
- // constructor end
- // next start
- public boolean hasNext() throws IOException {
- return false;
- }
-
- public void next() throws IOException {
- if (writer == null) {
- throw new IOException("Writer has been closed");
- }
- writer.newLine();
- writer.flush();
- }
- // next end
-
- // writeFeatureID start
- public void writeFeatureID(String fid) throws IOException {
- if (writer == null) {
- throw new IOException("Writer has been closed");
- }
- writer.write(fid);
- }
- // writeFeatureID end
-
- // write start
- public void write(int position, Object attribute) throws IOException {
- if (writer == null) {
- throw new IOException("Writer has been closed");
- }
- writer.write(position == 0 ? "=" : "|");
- if (attribute == null) {
- writer.write("<null>"); // nothing!
- } else if( attribute instanceof String){
- // encode newlines
- String txt = (String) attribute;
- txt = txt.replace("\n", "\\n");
- txt = txt.replace("\r", "\\r");
- writer.write( txt );
- } else if (attribute instanceof Geometry) {
- Geometry geometry = (Geometry) attribute;
- writer.write( geometry.toText() );
- } else {
- String txt = Converters.convert( attribute, String.class );
- if( txt == null ){ // could not convert?
- txt = attribute.toString();
- }
- writer.write( txt );
- }
- }
- // write end
-
- // close start
- public void close() throws IOException {
- if (writer == null) {
- throw new IOException("Writer has already been closed");
- }
- writer.close();
- writer = null;
- type = null;
- }
- // close end
- // echoLine start
- public void echoLine(String line) throws IOException {
- if (writer == null) {
- throw new IOException("Writer has been closed");
- }
- if (line == null) {
- return;
- }
- writer.write(line);
- }
- // echoLine end
-}
Modified: trunk/modules/unsupported/property-ng/src/main/java/org/geotools/data/property/ng/PropertyFeatureStore.java
===================================================================
--- trunk/modules/unsupported/property-ng/src/main/java/org/geotools/data/property/ng/PropertyFeatureStore.java 2011-12-13 11:08:18 UTC (rev 38422)
+++ trunk/modules/unsupported/property-ng/src/main/java/org/geotools/data/property/ng/PropertyFeatureStore.java 2011-12-18 11:54:33 UTC (rev 38423)
@@ -48,7 +48,11 @@
this.store = (PropertyDataStore) entry.getDataStore();
this.typeName = entry.getTypeName();
}
-
+ /** We handle events internally */
+ protected boolean canEvent() {
+ return false;
+ }
+
protected QueryCapabilities buildQueryCapabilities() {
return new QueryCapabilities(){
public boolean isUseProvidedFIDSupported() {
|
|
From: <svn...@os...> - 2011-12-13 11:08:29
|
Author: aaime
Date: 2011-12-13 03:08:18 -0800 (Tue, 13 Dec 2011)
New Revision: 38422
Modified:
trunk/modules/library/coverage/src/test/java/org/geotools/image/io/GridCoverageProgressAdapterTest.java
Log:
[GEOT-3980] GridCoverageProgressAdapterTest fails if native JAI ImageIO is installed
Modified: trunk/modules/library/coverage/src/test/java/org/geotools/image/io/GridCoverageProgressAdapterTest.java
===================================================================
--- trunk/modules/library/coverage/src/test/java/org/geotools/image/io/GridCoverageProgressAdapterTest.java 2011-12-13 11:08:02 UTC (rev 38421)
+++ trunk/modules/library/coverage/src/test/java/org/geotools/image/io/GridCoverageProgressAdapterTest.java 2011-12-13 11:08:18 UTC (rev 38422)
@@ -36,7 +36,9 @@
import org.opengis.util.InternationalString;
import org.opengis.util.ProgressListener;
+import com.sun.media.imageioimpl.common.PackageUtil;
+
/**
* @author Simone Giannecchini, GeoSolutions SAS
*
@@ -161,7 +163,9 @@
image.flush();
image=null;
- assertFalse(adaptee.isCompleted());
+ if(!PackageUtil.isCodecLibAvailable()) {
+ assertFalse(adaptee.isCompleted());
+ }
assertTrue(adaptee.isStarted());
assertTrue(adaptee.isCanceled());
}
|
|
From: <svn...@os...> - 2011-12-13 11:08:13
|
Author: aaime
Date: 2011-12-13 03:08:02 -0800 (Tue, 13 Dec 2011)
New Revision: 38421
Added:
trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileQueryCapabilities.java
Modified:
trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureLocking.java
trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureSource.java
trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureStore.java
Log:
[GEOT-3977] Have shapefile declare support for natural order sorting
Modified: trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureLocking.java
===================================================================
--- trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureLocking.java 2011-12-13 11:07:42 UTC (rev 38420)
+++ trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureLocking.java 2011-12-13 11:08:02 UTC (rev 38421)
@@ -42,6 +42,7 @@
super(hints);
shapefile = shapefileDataStore;
this.featureType = featureType;
+ this.queryCapabilities = new ShapefileQueryCapabilities();
}
public DataStore getDataStore() {
return shapefile;
Modified: trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureSource.java
===================================================================
--- trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureSource.java 2011-12-13 11:07:42 UTC (rev 38420)
+++ trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureSource.java 2011-12-13 11:08:02 UTC (rev 38421)
@@ -23,9 +23,11 @@
import org.geotools.data.DataStore;
import org.geotools.data.FeatureListener;
import org.geotools.data.Query;
+import org.geotools.data.QueryCapabilities;
import org.geotools.data.ResourceInfo;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.filter.sort.SortBy;
/**
* Allows transaction control when editing a shapefile.
@@ -40,6 +42,7 @@
super(hints);
shapefile = shapefileDataStore;
this.featureType = featureType;
+ this.queryCapabilities = new ShapefileQueryCapabilities();
}
public DataStore getDataStore() {
return shapefile;
Modified: trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureStore.java
===================================================================
--- trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureStore.java 2011-12-13 11:07:42 UTC (rev 38420)
+++ trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureStore.java 2011-12-13 11:08:02 UTC (rev 38421)
@@ -43,6 +43,7 @@
super(hints);
shapefile = shapefileDataStore;
this.featureType = featureType;
+ this.queryCapabilities = new ShapefileQueryCapabilities();
}
public DataStore getDataStore() {
return shapefile;
Added: trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileQueryCapabilities.java
===================================================================
--- trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileQueryCapabilities.java (rev 0)
+++ trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileQueryCapabilities.java 2011-12-13 11:08:02 UTC (rev 38421)
@@ -0,0 +1,39 @@
+/*
+ * GeoTools - The Open Source Java GIS Toolkit
+ * http://geotools.org
+ *
+ * (C) 2008, Open Source Geospatial Foundation (OSGeo)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ */
+package org.geotools.data.shapefile;
+
+import org.geotools.data.QueryCapabilities;
+import org.opengis.filter.sort.SortBy;
+
+/**
+ * The usual capabilities, plug a twist: we always return features sorted according to the
+ * feature id
+ *
+ * @author Andrea Aime - GeoSolutions
+ */
+class ShapefileQueryCapabilities extends QueryCapabilities {
+
+ @Override
+ public boolean supportsSorting(SortBy[] sortAttributes) {
+ // we always return features in the pk increasing order
+ if(sortAttributes != null && sortAttributes.length == 1 && sortAttributes[0] == SortBy.NATURAL_ORDER) {
+ return true;
+ } else {
+ return super.supportsSorting(sortAttributes);
+ }
+ }
+}
|
|
From: <svn...@os...> - 2011-12-13 11:07:53
|
Author: aaime
Date: 2011-12-13 03:07:42 -0800 (Tue, 13 Dec 2011)
New Revision: 38420
Modified:
trunk/modules/library/main/src/main/java/org/geotools/feature/collection/MaxSimpleFeatureCollection.java
trunk/modules/library/main/src/test/java/org/geotools/data/store/MaxFeaturesFeatureCollectionTest.java
Log:
[GEOT-3976] MaxSimpleFeatureCollection goes into infinite recursion if start != 0
Modified: trunk/modules/library/main/src/main/java/org/geotools/feature/collection/MaxSimpleFeatureCollection.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/feature/collection/MaxSimpleFeatureCollection.java 2011-12-13 11:07:14 UTC (rev 38419)
+++ trunk/modules/library/main/src/main/java/org/geotools/feature/collection/MaxSimpleFeatureCollection.java 2011-12-13 11:07:42 UTC (rev 38420)
@@ -99,7 +99,12 @@
}
public int size() {
- return (int) Math.min( Math.max(0, delegate.size() - start), max );
+ int size = delegate.size();
+ if(size < start) {
+ return 0;
+ } else {
+ return (int) Math.min( size - start, max );
+ }
}
public boolean isEmpty() {
Modified: trunk/modules/library/main/src/test/java/org/geotools/data/store/MaxFeaturesFeatureCollectionTest.java
===================================================================
--- trunk/modules/library/main/src/test/java/org/geotools/data/store/MaxFeaturesFeatureCollectionTest.java 2011-12-13 11:07:14 UTC (rev 38419)
+++ trunk/modules/library/main/src/test/java/org/geotools/data/store/MaxFeaturesFeatureCollectionTest.java 2011-12-13 11:07:42 UTC (rev 38420)
@@ -28,25 +28,42 @@
public class MaxFeaturesFeatureCollectionTest extends
FeatureCollectionWrapperTestSupport {
- MaxSimpleFeatureCollection max;
-
- protected void setUp() throws Exception {
- super.setUp();
- max = new MaxSimpleFeatureCollection( delegate, 2 );
- }
-
- public void testSize() throws Exception {
- assertEquals( 2, max.size() );
- }
-
- public void testIterator() throws Exception {
-
- Iterator i = max.iterator();
- for ( int x = 0; x < 2; x++ ) {
- assertTrue( i.hasNext() );
- i.next();
- }
-
- assertFalse( i.hasNext() );
- }
+ public void testSize() throws Exception {
+ // in the common case it's as big as the max
+ MaxSimpleFeatureCollection max = new MaxSimpleFeatureCollection(delegate, 2);
+ assertEquals(2, max.size());
+
+ // however if we skip much it's going to be just as big as the remainder
+ max = new MaxSimpleFeatureCollection(delegate, delegate.size() - 1, 10);
+ assertEquals(1, max.size());
+
+ // and if we skip more than the size
+ max = new MaxSimpleFeatureCollection(delegate, delegate.size() + 1, 10);
+ assertEquals(0, max.size());
+ }
+
+ public void testIteratorMax() throws Exception {
+ MaxSimpleFeatureCollection max = new MaxSimpleFeatureCollection(delegate, 2);
+ Iterator i = max.iterator();
+ for (int x = 0; x < 2; x++) {
+ assertTrue(i.hasNext());
+ i.next();
+ }
+
+ assertFalse(i.hasNext());
+ }
+
+ public void testIteratorSkipMax() throws Exception {
+ MaxSimpleFeatureCollection max = new MaxSimpleFeatureCollection(delegate, delegate.size() - 1, 2);
+ Iterator i = max.iterator();
+ assertTrue(i.hasNext());
+ i.next();
+ assertFalse(i.hasNext());
+ }
+
+ public void testIteratorSkipMoreSize() throws Exception {
+ MaxSimpleFeatureCollection max = new MaxSimpleFeatureCollection(delegate, delegate.size() + 1, 2);
+ Iterator i = max.iterator();
+ assertFalse(i.hasNext());
+ }
}
|
|
From: <svn...@os...> - 2011-12-13 11:07:25
|
Author: aaime
Date: 2011-12-13 03:07:14 -0800 (Tue, 13 Dec 2011)
New Revision: 38419
Added:
trunk/modules/library/main/src/main/java/org/geotools/feature/collection/SortedSimpleFeatureCollection.java
trunk/modules/library/main/src/test/java/org/geotools/data/collection/SortedFeatureCollectionTest.java
Log:
[GEOT-3975] Create a sorted feature collection decorator that does not require in memory sorting
Added: trunk/modules/library/main/src/main/java/org/geotools/feature/collection/SortedSimpleFeatureCollection.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/feature/collection/SortedSimpleFeatureCollection.java (rev 0)
+++ trunk/modules/library/main/src/main/java/org/geotools/feature/collection/SortedSimpleFeatureCollection.java 2011-12-13 11:07:14 UTC (rev 38419)
@@ -0,0 +1,61 @@
+package org.geotools.feature.collection;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.geotools.data.simple.SimpleFeatureCollection;
+import org.geotools.data.simple.SimpleFeatureIterator;
+import org.geotools.data.sort.SortedFeatureIterator;
+import org.geotools.data.store.FeatureIteratorIterator;
+import org.geotools.factory.Hints;
+import org.geotools.feature.FeatureIterator;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.filter.sort.SortBy;
+
+/**
+ * A wrapper that will sort a feature collection using a size sensitive algorithm, in main memory
+ * for small collections, using secondary memory otherwise. The threshold is defined by the
+ * {@link Hints#MAX_MEMORY_SORT} feature count
+ *
+ * @author Andrea Aime - GeoSolutions
+ *
+ */
+public class SortedSimpleFeatureCollection extends DecoratingSimpleFeatureCollection {
+
+ private SortBy[] sort;
+
+ public SortedSimpleFeatureCollection(SimpleFeatureCollection delegate, SortBy[] sort) {
+ super(delegate);
+ this.sort = sort;
+ }
+
+ @Override
+ public SimpleFeatureIterator features() {
+ try {
+ SimpleFeatureIterator features = ((SimpleFeatureCollection) delegate).features();
+ // sort if necessary
+ if (sort != null) {
+ features = new SortedFeatureIterator(features, getSchema(), sort, -1);
+ }
+ return features;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public Iterator iterator() {
+ return new FeatureIteratorIterator<SimpleFeature>(features());
+ }
+
+ @Override
+ public void close(FeatureIterator<SimpleFeature> close) {
+ close.close();
+ }
+
+ @Override
+ public void close(Iterator<SimpleFeature> close) {
+ FeatureIteratorIterator<SimpleFeature> fii = (FeatureIteratorIterator<SimpleFeature>) close;
+ delegate.close(fii.getDelegate());
+ }
+}
Added: trunk/modules/library/main/src/test/java/org/geotools/data/collection/SortedFeatureCollectionTest.java
===================================================================
--- trunk/modules/library/main/src/test/java/org/geotools/data/collection/SortedFeatureCollectionTest.java (rev 0)
+++ trunk/modules/library/main/src/test/java/org/geotools/data/collection/SortedFeatureCollectionTest.java 2011-12-13 11:07:14 UTC (rev 38419)
@@ -0,0 +1,68 @@
+/*
+ * GeoTools - The Open Source Java GIS Toolkit
+ * http://geotools.org
+ *
+ * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ */
+package org.geotools.data.collection;
+
+import java.util.Comparator;
+
+import org.geotools.data.DataUtilities;
+import org.geotools.data.simple.SimpleFeatureIterator;
+import org.geotools.data.store.FeatureCollectionWrapperTestSupport;
+import org.geotools.factory.CommonFactoryFinder;
+import org.geotools.feature.collection.SortedSimpleFeatureCollection;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.filter.FilterFactory2;
+import org.opengis.filter.sort.SortBy;
+import org.opengis.filter.sort.SortOrder;
+
+public class SortedFeatureCollectionTest extends FeatureCollectionWrapperTestSupport {
+
+ FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
+
+ public void testNaturalSort() throws Exception {
+ SortedSimpleFeatureCollection sorted = new SortedSimpleFeatureCollection(delegate,
+ new SortBy[] { SortBy.NATURAL_ORDER });
+ checkSorted(sorted, DataUtilities.sortComparator(SortBy.NATURAL_ORDER));
+ }
+
+ public void testReverseSort() throws Exception {
+ SortedSimpleFeatureCollection sorted = new SortedSimpleFeatureCollection(delegate,
+ new SortBy[] { SortBy.REVERSE_ORDER });
+ checkSorted(sorted, DataUtilities.sortComparator(SortBy.REVERSE_ORDER));
+ }
+
+ public void testSortAttribute() throws Exception {
+ SortBy sort = ff.sort("someAtt", SortOrder.ASCENDING);
+ SortedSimpleFeatureCollection sorted = new SortedSimpleFeatureCollection(delegate,
+ new SortBy[] { sort });
+ checkSorted(sorted, DataUtilities.sortComparator(sort));
+ }
+
+ private void checkSorted(SortedSimpleFeatureCollection sorted,
+ Comparator<SimpleFeature> comparator) {
+ SimpleFeatureIterator fi = sorted.features();
+ SimpleFeature prev = null;
+ while (fi.hasNext()) {
+ SimpleFeature curr = fi.next();
+ if (prev != null) {
+ assertTrue("Failed on " + prev + " / " + curr, comparator.compare(prev, curr) <= 0);
+ }
+ prev = curr;
+ }
+ fi.close();
+ }
+
+}
|
|
From: <svn...@os...> - 2011-12-13 09:40:38
|
Author: aaime
Date: 2011-12-13 01:40:29 -0800 (Tue, 13 Dec 2011)
New Revision: 38418
Modified:
branches/2.7.x/modules/library/coverage/src/test/java/org/geotools/image/io/GridCoverageProgressAdapterTest.java
Log:
[GEOT-3980] GridCoverageProgressAdapterTest fails if native JAI ImageIO is installed
Modified: branches/2.7.x/modules/library/coverage/src/test/java/org/geotools/image/io/GridCoverageProgressAdapterTest.java
===================================================================
--- branches/2.7.x/modules/library/coverage/src/test/java/org/geotools/image/io/GridCoverageProgressAdapterTest.java 2011-12-13 09:40:15 UTC (rev 38417)
+++ branches/2.7.x/modules/library/coverage/src/test/java/org/geotools/image/io/GridCoverageProgressAdapterTest.java 2011-12-13 09:40:29 UTC (rev 38418)
@@ -29,6 +29,7 @@
import org.geotools.TestData;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.image.ImageWorkerTest;
+import org.geotools.resources.image.ImageUtilities;
import org.geotools.util.DefaultProgressListener;
import org.geotools.util.logging.Logging;
import org.junit.Assert;
@@ -36,7 +37,9 @@
import org.opengis.util.InternationalString;
import org.opengis.util.ProgressListener;
+import com.sun.media.imageioimpl.common.PackageUtil;
+
/**
* @author Simone Giannecchini, GeoSolutions SAS
*
@@ -161,7 +164,10 @@
image.flush();
image=null;
- assertFalse(adaptee.isCompleted());
+ // this particular test does not work if CLIB is available
+ if(!PackageUtil.isCodecLibAvailable()) {
+ assertFalse(adaptee.isCompleted());
+ }
assertTrue(adaptee.isStarted());
assertTrue(adaptee.isCanceled());
}
|
|
From: <svn...@os...> - 2011-12-13 09:40:22
|
Author: aaime
Date: 2011-12-13 01:40:15 -0800 (Tue, 13 Dec 2011)
New Revision: 38417
Modified:
branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/GetFeatureType.java
branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/WfsPackage.java
branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/impl/GetFeatureTypeImpl.java
branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/impl/WfsPackageImpl.java
branches/2.7.x/modules/ogc/net.opengis.wfs/wfs.ecore
branches/2.7.x/modules/ogc/net.opengis.wfs/wfs.genmodel
Log:
[GEOT-3978] Backport startIndex support for WFS GetFeature bindings from trunk
Modified: branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/GetFeatureType.java
===================================================================
--- branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/GetFeatureType.java 2011-12-13 09:39:58 UTC (rev 38416)
+++ branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/GetFeatureType.java 2011-12-13 09:40:15 UTC (rev 38417)
@@ -39,6 +39,7 @@
* <li>{@link net.opengis.wfs.GetFeatureType#getTraverseXlinkExpiry <em>Traverse Xlink Expiry</em>}</li>
* <li>{@link net.opengis.wfs.GetFeatureType#getFormatOptions <em>Format Options</em>}</li>
* <li>{@link net.opengis.wfs.GetFeatureType#getMetadata <em>Metadata</em>}</li>
+ * <li>{@link net.opengis.wfs.GetFeatureType#getStartIndex <em>Start Index</em>}</li>
* </ul>
* </p>
*
@@ -93,7 +94,28 @@
*/
void setMaxFeatures(BigInteger value);
+ /**
+ * The initial index of a feature result set in which to return features.
+ * <p>
+ * This property is coupled with {@link #getMaxFeatures()} to page through
+ * a feature result set.
+ * </p>
+ * @model
+ */
+ BigInteger getStartIndex();
+
+
/**
+ * Sets the value of the '{@link net.opengis.wfs.GetFeatureType#getStartIndex <em>Start Index</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Start Index</em>' attribute.
+ * @see #getStartIndex()
+ * @generated
+ */
+ void setStartIndex(BigInteger value);
+
+ /**
* Returns the value of the '<em><b>Output Format</b></em>' attribute.
* The default value is <code>"text/xml; subtype=gml/3.1.1"</code>.
* <!-- begin-user-doc -->
Modified: branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/WfsPackage.java
===================================================================
--- branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/WfsPackage.java 2011-12-13 09:39:58 UTC (rev 38416)
+++ branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/WfsPackage.java 2011-12-13 09:40:15 UTC (rev 38417)
@@ -1176,13 +1176,22 @@
int GET_FEATURE_TYPE__METADATA = BASE_REQUEST_TYPE_FEATURE_COUNT + 7;
/**
+ * The feature id for the '<em><b>Start Index</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GET_FEATURE_TYPE__START_INDEX = BASE_REQUEST_TYPE_FEATURE_COUNT + 8;
+
+ /**
* The number of structural features of the '<em>Get Feature Type</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int GET_FEATURE_TYPE_FEATURE_COUNT = BASE_REQUEST_TYPE_FEATURE_COUNT + 8;
+ int GET_FEATURE_TYPE_FEATURE_COUNT = BASE_REQUEST_TYPE_FEATURE_COUNT + 9;
/**
* The meta object id for the '{@link net.opengis.wfs.impl.GetFeatureWithLockTypeImpl <em>Get Feature With Lock Type</em>}' class.
@@ -1321,6 +1330,15 @@
int GET_FEATURE_WITH_LOCK_TYPE__METADATA = GET_FEATURE_TYPE__METADATA;
/**
+ * The feature id for the '<em><b>Start Index</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GET_FEATURE_WITH_LOCK_TYPE__START_INDEX = GET_FEATURE_TYPE__START_INDEX;
+
+ /**
* The feature id for the '<em><b>Expiry</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3743,6 +3761,17 @@
EAttribute getGetFeatureType_Metadata();
/**
+ * Returns the meta object for the attribute '{@link net.opengis.wfs.GetFeatureType#getStartIndex <em>Start Index</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Start Index</em>'.
+ * @see net.opengis.wfs.GetFeatureType#getStartIndex()
+ * @see #getGetFeatureType()
+ * @generated
+ */
+ EAttribute getGetFeatureType_StartIndex();
+
+ /**
* Returns the meta object for class '{@link net.opengis.wfs.GetFeatureWithLockType <em>Get Feature With Lock Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -5719,6 +5748,14 @@
EAttribute GET_FEATURE_TYPE__METADATA = eINSTANCE.getGetFeatureType_Metadata();
/**
+ * The meta object literal for the '<em><b>Start Index</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute GET_FEATURE_TYPE__START_INDEX = eINSTANCE.getGetFeatureType_StartIndex();
+
+ /**
* The meta object literal for the '{@link net.opengis.wfs.impl.GetFeatureWithLockTypeImpl <em>Get Feature With Lock Type</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Modified: branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/impl/GetFeatureTypeImpl.java
===================================================================
--- branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/impl/GetFeatureTypeImpl.java 2011-12-13 09:39:58 UTC (rev 38416)
+++ branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/impl/GetFeatureTypeImpl.java 2011-12-13 09:40:15 UTC (rev 38417)
@@ -45,6 +45,7 @@
* <li>{@link net.opengis.wfs.impl.GetFeatureTypeImpl#getTraverseXlinkExpiry <em>Traverse Xlink Expiry</em>}</li>
* <li>{@link net.opengis.wfs.impl.GetFeatureTypeImpl#getFormatOptions <em>Format Options</em>}</li>
* <li>{@link net.opengis.wfs.impl.GetFeatureTypeImpl#getMetadata <em>Metadata</em>}</li>
+ * <li>{@link net.opengis.wfs.impl.GetFeatureTypeImpl#getStartIndex <em>Start Index</em>}</li>
* </ul>
* </p>
*
@@ -220,7 +221,27 @@
protected Map metadata = METADATA_EDEFAULT;
/**
+ * The default value of the '{@link #getStartIndex() <em>Start Index</em>}' attribute.
* <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStartIndex()
+ * @generated
+ * @ordered
+ */
+ protected static final BigInteger START_INDEX_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getStartIndex() <em>Start Index</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStartIndex()
+ * @generated
+ * @ordered
+ */
+ protected BigInteger startIndex = START_INDEX_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@@ -451,6 +472,27 @@
/**
* <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public BigInteger getStartIndex() {
+ return startIndex;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setStartIndex(BigInteger newStartIndex) {
+ BigInteger oldStartIndex = startIndex;
+ startIndex = newStartIndex;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, WfsPackage.GET_FEATURE_TYPE__START_INDEX, oldStartIndex, startIndex));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@@ -485,6 +527,8 @@
return getFormatOptions();
case WfsPackage.GET_FEATURE_TYPE__METADATA:
return getMetadata();
+ case WfsPackage.GET_FEATURE_TYPE__START_INDEX:
+ return getStartIndex();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -521,6 +565,9 @@
case WfsPackage.GET_FEATURE_TYPE__METADATA:
setMetadata((Map)newValue);
return;
+ case WfsPackage.GET_FEATURE_TYPE__START_INDEX:
+ setStartIndex((BigInteger)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -556,6 +603,9 @@
case WfsPackage.GET_FEATURE_TYPE__METADATA:
setMetadata(METADATA_EDEFAULT);
return;
+ case WfsPackage.GET_FEATURE_TYPE__START_INDEX:
+ setStartIndex(START_INDEX_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -583,6 +633,8 @@
return FORMAT_OPTIONS_EDEFAULT == null ? formatOptions != null : !FORMAT_OPTIONS_EDEFAULT.equals(formatOptions);
case WfsPackage.GET_FEATURE_TYPE__METADATA:
return METADATA_EDEFAULT == null ? metadata != null : !METADATA_EDEFAULT.equals(metadata);
+ case WfsPackage.GET_FEATURE_TYPE__START_INDEX:
+ return START_INDEX_EDEFAULT == null ? startIndex != null : !START_INDEX_EDEFAULT.equals(startIndex);
}
return super.eIsSet(featureID);
}
@@ -610,6 +662,8 @@
result.append(formatOptions);
result.append(", metadata: ");
result.append(metadata);
+ result.append(", startIndex: ");
+ result.append(startIndex);
result.append(')');
return result.toString();
}
Modified: branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/impl/WfsPackageImpl.java
===================================================================
--- branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/impl/WfsPackageImpl.java 2011-12-13 09:39:58 UTC (rev 38416)
+++ branches/2.7.x/modules/ogc/net.opengis.wfs/src/net/opengis/wfs/impl/WfsPackageImpl.java 2011-12-13 09:40:15 UTC (rev 38417)
@@ -1348,6 +1348,15 @@
/**
* <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getGetFeatureType_StartIndex() {
+ return (EAttribute)getFeatureTypeEClass.getEStructuralFeatures().get(8);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@@ -2485,6 +2494,7 @@
createEAttribute(getFeatureTypeEClass, GET_FEATURE_TYPE__TRAVERSE_XLINK_EXPIRY);
createEAttribute(getFeatureTypeEClass, GET_FEATURE_TYPE__FORMAT_OPTIONS);
createEAttribute(getFeatureTypeEClass, GET_FEATURE_TYPE__METADATA);
+ createEAttribute(getFeatureTypeEClass, GET_FEATURE_TYPE__START_INDEX);
getFeatureWithLockTypeEClass = createEClass(GET_FEATURE_WITH_LOCK_TYPE);
createEAttribute(getFeatureWithLockTypeEClass, GET_FEATURE_WITH_LOCK_TYPE__EXPIRY);
@@ -2767,6 +2777,7 @@
initEAttribute(getGetFeatureType_TraverseXlinkExpiry(), theXMLTypePackage.getPositiveInteger(), "traverseXlinkExpiry", null, 0, 1, GetFeatureType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getGetFeatureType_FormatOptions(), this.getMap(), "formatOptions", null, 0, 1, GetFeatureType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getGetFeatureType_Metadata(), this.getMap(), "metadata", null, 0, 1, GetFeatureType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getGetFeatureType_StartIndex(), ecorePackage.getEBigInteger(), "startIndex", null, 0, 1, GetFeatureType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(getFeatureWithLockTypeEClass, GetFeatureWithLockType.class, "GetFeatureWithLockType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getGetFeatureWithLockType_Expiry(), theXMLTypePackage.getPositiveInteger(), "expiry", "5", 0, 1, GetFeatureWithLockType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
Modified: branches/2.7.x/modules/ogc/net.opengis.wfs/wfs.ecore
===================================================================
--- branches/2.7.x/modules/ogc/net.opengis.wfs/wfs.ecore 2011-12-13 09:39:58 UTC (rev 38416)
+++ branches/2.7.x/modules/ogc/net.opengis.wfs/wfs.ecore 2011-12-13 09:40:15 UTC (rev 38417)
@@ -762,6 +762,7 @@
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="formatOptions" eType="#//Map"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="metadata" eType="#//Map"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="startIndex" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBigInteger"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GetFeatureWithLockType" eSuperTypes="#//GetFeatureType">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
Modified: branches/2.7.x/modules/ogc/net.opengis.wfs/wfs.genmodel
===================================================================
--- branches/2.7.x/modules/ogc/net.opengis.wfs/wfs.genmodel 2011-12-13 09:39:58 UTC (rev 38416)
+++ branches/2.7.x/modules/ogc/net.opengis.wfs/wfs.genmodel 2011-12-13 09:40:15 UTC (rev 38417)
@@ -146,6 +146,7 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute wfs.ecore#//GetFeatureType/traverseXlinkExpiry"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute wfs.ecore#//GetFeatureType/formatOptions"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute wfs.ecore#//GetFeatureType/metadata"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute wfs.ecore#//GetFeatureType/startIndex"/>
</genClasses>
<genClasses ecoreClass="wfs.ecore#//GetFeatureWithLockType">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute wfs.ecore#//GetFeatureWithLockType/expiry"/>
|
|
From: <svn...@os...> - 2011-12-13 09:40:08
|
Author: aaime
Date: 2011-12-13 01:39:58 -0800 (Tue, 13 Dec 2011)
New Revision: 38416
Added:
branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileQueryCapabilities.java
Modified:
branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureLocking.java
branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureSource.java
branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureStore.java
Log:
[GEOT-3977] Have shapefile declare support for natural order sorting
Modified: branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureLocking.java
===================================================================
--- branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureLocking.java 2011-12-13 09:39:43 UTC (rev 38415)
+++ branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureLocking.java 2011-12-13 09:39:58 UTC (rev 38416)
@@ -37,6 +37,7 @@
super(hints);
shapefile = shapefileDataStore;
this.featureType = featureType;
+ this.queryCapabilities = new ShapefileQueryCapabilities();
}
public DataStore getDataStore() {
return shapefile;
Modified: branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureSource.java
===================================================================
--- branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureSource.java 2011-12-13 09:39:43 UTC (rev 38415)
+++ branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureSource.java 2011-12-13 09:39:58 UTC (rev 38416)
@@ -23,9 +23,11 @@
import org.geotools.data.DataStore;
import org.geotools.data.FeatureListener;
import org.geotools.data.Query;
+import org.geotools.data.QueryCapabilities;
import org.geotools.data.ResourceInfo;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.filter.sort.SortBy;
/**
* Allows transaction control when editing a shapefile.
@@ -40,6 +42,7 @@
super(hints);
shapefile = shapefileDataStore;
this.featureType = featureType;
+ this.queryCapabilities = new ShapefileQueryCapabilities();
}
public DataStore getDataStore() {
return shapefile;
Modified: branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureStore.java
===================================================================
--- branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureStore.java 2011-12-13 09:39:43 UTC (rev 38415)
+++ branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileFeatureStore.java 2011-12-13 09:39:58 UTC (rev 38416)
@@ -42,6 +42,7 @@
super(hints);
shapefile = shapefileDataStore;
this.featureType = featureType;
+ this.queryCapabilities = new ShapefileQueryCapabilities();
}
public DataStore getDataStore() {
return shapefile;
Added: branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileQueryCapabilities.java
===================================================================
--- branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileQueryCapabilities.java (rev 0)
+++ branches/2.7.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileQueryCapabilities.java 2011-12-13 09:39:58 UTC (rev 38416)
@@ -0,0 +1,39 @@
+/*
+ * GeoTools - The Open Source Java GIS Toolkit
+ * http://geotools.org
+ *
+ * (C) 2008, Open Source Geospatial Foundation (OSGeo)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ */
+package org.geotools.data.shapefile;
+
+import org.geotools.data.QueryCapabilities;
+import org.opengis.filter.sort.SortBy;
+
+/**
+ * The usual capabilities, plug a twist: we always return features sorted according to the
+ * feature id
+ *
+ * @author Andrea Aime - GeoSolutions
+ */
+class ShapefileQueryCapabilities extends QueryCapabilities {
+
+ @Override
+ public boolean supportsSorting(SortBy[] sortAttributes) {
+ // we always return features in the pk increasing order
+ if(sortAttributes != null && sortAttributes.length == 1 && sortAttributes[0] == SortBy.NATURAL_ORDER) {
+ return true;
+ } else {
+ return super.supportsSorting(sortAttributes);
+ }
+ }
+}
|
Author: aaime
Date: 2011-12-13 01:39:43 -0800 (Tue, 13 Dec 2011)
New Revision: 38415
Modified:
branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/store/MaxFeaturesIterator.java
branches/2.7.x/modules/library/main/src/main/java/org/geotools/feature/collection/MaxSimpleFeatureCollection.java
branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/store/MaxFeaturesFeatureCollectionTest.java
Log:
[GEOT-3976] MaxSimpleFeatureCollection goes into infinite recursion if start != 0
Modified: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/store/MaxFeaturesIterator.java
===================================================================
--- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/store/MaxFeaturesIterator.java 2011-12-13 09:39:22 UTC (rev 38414)
+++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/store/MaxFeaturesIterator.java 2011-12-13 09:39:43 UTC (rev 38415)
@@ -83,7 +83,7 @@
private void skip() {
if (counter < start) {
- while (hasNext() && counter < start) {
+ while (delegate.hasNext() && counter < start) {
counter++;
F skip = delegate.next(); // skip!
}
Modified: branches/2.7.x/modules/library/main/src/main/java/org/geotools/feature/collection/MaxSimpleFeatureCollection.java
===================================================================
--- branches/2.7.x/modules/library/main/src/main/java/org/geotools/feature/collection/MaxSimpleFeatureCollection.java 2011-12-13 09:39:22 UTC (rev 38414)
+++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/feature/collection/MaxSimpleFeatureCollection.java 2011-12-13 09:39:43 UTC (rev 38415)
@@ -98,7 +98,13 @@
}
public int size() {
- return (int) Math.min( delegate.size(), max );
+ int size = delegate.size();
+ if(size < start) {
+ return 0;
+ } else {
+ return (int) Math.min( size - start, max );
+ }
+
}
public boolean isEmpty() {
Modified: branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/store/MaxFeaturesFeatureCollectionTest.java
===================================================================
--- branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/store/MaxFeaturesFeatureCollectionTest.java 2011-12-13 09:39:22 UTC (rev 38414)
+++ branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/store/MaxFeaturesFeatureCollectionTest.java 2011-12-13 09:39:43 UTC (rev 38415)
@@ -20,28 +20,44 @@
import org.geotools.feature.collection.MaxSimpleFeatureCollection;
-public class MaxFeaturesFeatureCollectionTest extends
- FeatureCollectionWrapperTestSupport {
+public class MaxFeaturesFeatureCollectionTest extends FeatureCollectionWrapperTestSupport {
- MaxSimpleFeatureCollection max;
-
- protected void setUp() throws Exception {
- super.setUp();
- max = new MaxSimpleFeatureCollection( delegate, 2 );
- }
-
- public void testSize() throws Exception {
- assertEquals( 2, max.size() );
- }
-
- public void testIterator() throws Exception {
-
- Iterator i = max.iterator();
- for ( int x = 0; x < 2; x++ ) {
- assertTrue( i.hasNext() );
- i.next();
- }
-
- assertFalse( i.hasNext() );
- }
+ public void testSize() throws Exception {
+ // in the common case it's as big as the max
+ MaxSimpleFeatureCollection max = new MaxSimpleFeatureCollection(delegate, 2);
+ assertEquals(2, max.size());
+
+ // however if we skip much it's going to be just as big as the remainder
+ max = new MaxSimpleFeatureCollection(delegate, delegate.size() - 1, 10);
+ assertEquals(1, max.size());
+
+ // and if we skip more than the size
+ max = new MaxSimpleFeatureCollection(delegate, delegate.size() + 1, 10);
+ assertEquals(0, max.size());
+ }
+
+ public void testIteratorMax() throws Exception {
+ MaxSimpleFeatureCollection max = new MaxSimpleFeatureCollection(delegate, 2);
+ Iterator i = max.iterator();
+ for (int x = 0; x < 2; x++) {
+ assertTrue(i.hasNext());
+ i.next();
+ }
+
+ assertFalse(i.hasNext());
+ }
+
+ public void testIteratorSkipMax() throws Exception {
+ MaxSimpleFeatureCollection max = new MaxSimpleFeatureCollection(delegate, delegate.size() - 1, 2);
+ Iterator i = max.iterator();
+ assertTrue(i.hasNext());
+ i.next();
+ assertFalse(i.hasNext());
+ }
+
+ public void testIteratorSkipMoreSize() throws Exception {
+ MaxSimpleFeatureCollection max = new MaxSimpleFeatureCollection(delegate, delegate.size() + 1, 2);
+ Iterator i = max.iterator();
+ assertFalse(i.hasNext());
+ }
}
|
|
From: <svn...@os...> - 2011-12-13 09:39:31
|
Author: aaime Date: 2011-12-13 01:39:22 -0800 (Tue, 13 Dec 2011) New Revision: 38414 Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/CompositeComparator.java branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FeatureBlockReader.java branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FeatureReaderFeatureIterator.java branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FidComparator.java branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/MergeSortDumper.java branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/MergeSortReader.java branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/PropertyComparator.java branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/SortedFeatureIterator.java branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/SortedFeatureReader.java branches/2.7.x/modules/library/main/src/main/java/org/geotools/feature/collection/SortedSimpleFeatureCollection.java branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/collection/SortedFeatureCollectionTest.java branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/sort/ branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/sort/SortedReaderTest.java Modified: branches/2.7.x/modules/library/metadata/src/main/java/org/geotools/factory/Hints.java Log: [GEOT-3975] Create a sorted feature collection decorator that does not require in memory sorting Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/CompositeComparator.java =================================================================== --- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/CompositeComparator.java (rev 0) +++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/CompositeComparator.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,49 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2004-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.sort; + +import java.util.Comparator; +import java.util.List; + +import org.opengis.feature.simple.SimpleFeature; + +/** + * A composite comparator that applies the provided comparators as a hierarchical list, the first + * comparator that returns a non zero value "wins" + * + * @author Andrea Aime - GeoSolutions + * + */ +class CompositeComparator implements Comparator<SimpleFeature> { + + List<Comparator<SimpleFeature>> comparators; + + public CompositeComparator(List<Comparator<SimpleFeature>> comparators) { + this.comparators = comparators; + } + + public int compare(SimpleFeature f1, SimpleFeature f2) { + for (Comparator<SimpleFeature> comp : comparators) { + int result = comp.compare(f1, f2); + if (result != 0) { + return result; + } + } + return 0; + } + +} Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FeatureBlockReader.java =================================================================== --- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FeatureBlockReader.java (rev 0) +++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FeatureBlockReader.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,159 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2004-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.sort; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.RandomAccessFile; + +import org.geotools.feature.simple.SimpleFeatureBuilder; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.feature.type.AttributeDescriptor; + +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.io.ParseException; +import com.vividsolutions.jts.io.WKBReader; + +/** + * Reads the features stored in the specified block of a {@link RandomAccessFile} + * + * @author Andrea Aime - GeoSolutions + */ +class FeatureBlockReader { + + RandomAccessFile raf; + + SimpleFeatureType schema; + + SimpleFeatureBuilder builder; + + SimpleFeature curr; + + long offset; + + int count; + + public FeatureBlockReader(RandomAccessFile raf, long start, int count, SimpleFeatureType schema) { + this.raf = raf; + this.offset = start; + this.count = count; + this.schema = schema; + this.builder = new SimpleFeatureBuilder(schema); + } + + public SimpleFeature feature() throws IOException { + if (curr == null && count > 0) { + curr = readNextFeature(); + } + return curr; + } + + public SimpleFeature next() throws IOException { + curr = readNextFeature(); + return curr; + } + + private SimpleFeature readNextFeature() throws IOException { + if (count <= 0) { + return null; + } + + // move to the next feature offset + raf.seek(offset); + + // read the fid, check for file end + String fid = raf.readUTF(); + // read the other attributes, build the feature + for (AttributeDescriptor ad : schema.getAttributeDescriptors()) { + Object att = readAttribute(ad); + builder.add(att); + } + // update the offset for the next feature + offset = raf.getFilePointer(); + count--; + + // return the feature + return builder.buildFeature(fid); + } + + /** + * Reads the attributes. + * + * @param ad + * @return + * @throws IOException + */ + Object readAttribute(AttributeDescriptor ad) throws IOException { + // See the comments in {@link MergeSortDumper#writeAttribute(RandomAccessFile, + // AttributeDescriptor, Object)} to get an insight on why the method is built like this + boolean isNull = raf.readBoolean(); + if (isNull) { + return null; + } else { + Class<?> binding = ad.getType().getBinding(); + if (binding == Boolean.class) { + return raf.readBoolean(); + } else if (binding == Byte.class || binding == byte.class) { + return raf.readByte(); + } else if (binding == Short.class || binding == short.class) { + return raf.readShort(); + } else if (binding == Integer.class || binding == int.class) { + return raf.readInt(); + } else if (binding == Long.class || binding == long.class) { + return raf.readLong(); + } else if (binding == Float.class || binding == float.class) { + return raf.readFloat(); + } else if (binding == Double.class || binding == double.class) { + return raf.readDouble(); + } else if (binding == String.class) { + return raf.readUTF(); + } else if (binding == java.sql.Date.class) { + return new java.sql.Date(raf.readLong()); + } else if (binding == java.sql.Time.class) { + return new java.sql.Time(raf.readLong()); + } else if (binding == java.sql.Timestamp.class) { + return new java.sql.Timestamp(raf.readLong()); + } else if (binding == java.util.Date.class) { + return new java.util.Date(raf.readLong()); + } else if (Geometry.class.isAssignableFrom(binding)) { + WKBReader reader = new WKBReader(); + int length = raf.readInt(); + byte[] buffer = new byte[length]; + raf.read(buffer); + try { + return reader.read(buffer); + } catch (ParseException e) { + throw (IOException ) new IOException("Failed to parse the geometry WKB").initCause(e); + } + } else { + int length = raf.readInt(); + byte[] buffer = new byte[length]; + raf.read(buffer); + ByteArrayInputStream bis = new ByteArrayInputStream(buffer); + ObjectInputStream ois = new ObjectInputStream(bis); + try { + return ois.readObject(); + } catch (ClassNotFoundException e) { + throw (IOException) new IOException("Could not read back object").initCause(e); + } + } + } + } + +} Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FeatureReaderFeatureIterator.java =================================================================== --- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FeatureReaderFeatureIterator.java (rev 0) +++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FeatureReaderFeatureIterator.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,62 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2004-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.sort; + +import java.io.IOException; +import java.util.NoSuchElementException; + +import org.geotools.data.simple.SimpleFeatureIterator; +import org.geotools.data.simple.SimpleFeatureReader; +import org.opengis.feature.simple.SimpleFeature; + +/** + * A simple feature iterator wrapping a feature reader + */ +class FeatureReaderFeatureIterator implements SimpleFeatureIterator { + SimpleFeatureReader reader; + + public FeatureReaderFeatureIterator(SimpleFeatureReader reader) { + this.reader = reader; + } + + public boolean hasNext() { + try { + return reader.hasNext(); + } catch (IOException e) { + throw new RuntimeException("Reader failed", e); + } + } + + public SimpleFeature next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + try { + return reader.next(); + } catch (Exception e) { + throw new RuntimeException("Reader failed", e); + } + } + + public void close() { + try { + reader.close(); + } catch (IOException e) { + // we tried, n problem + } + } +}; Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FidComparator.java =================================================================== --- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FidComparator.java (rev 0) +++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/FidComparator.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,67 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2004-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.sort; + +import java.util.Comparator; + +import org.opengis.feature.simple.SimpleFeature; + +/** + * Compares two feature based on their feature id + * + * @author Andrea Aime - GeoSolutions + */ +class FidComparator implements Comparator<SimpleFeature> { + + boolean ascending; + + /** + * Builds a new comparator + * + * @param inverse If true the comparator will force an ascending order (descending otherwise) + */ + public FidComparator(boolean ascending) { + this.ascending = ascending; + } + + public int compare(SimpleFeature f1, SimpleFeature f2) { + int result = compareAscending(f1, f2); + if (ascending) { + return result; + } else { + return result * -1; + } + } + + private int compareAscending(SimpleFeature f1, SimpleFeature f2) { + String id1 = f1.getID(); + String id2 = f2.getID(); + + if (id1 == null) { + if (id2 == null) { + return 0; + } else { + return -1; + } + } else if (id2 == null) { + return 1; + } else { + return id1.compareTo(id2); + } + } + +} Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/MergeSortDumper.java =================================================================== --- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/MergeSortDumper.java (rev 0) +++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/MergeSortDumper.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,273 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2004-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.sort; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.RandomAccessFile; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; + +import org.geotools.data.Query; +import org.geotools.data.collection.ListFeatureCollection; +import org.geotools.data.simple.DelegateSimpleFeatureReader; +import org.geotools.data.simple.SimpleFeatureIterator; +import org.geotools.data.simple.SimpleFeatureReader; +import org.geotools.factory.Hints; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.feature.type.AttributeDescriptor; +import org.opengis.filter.sort.SortBy; +import org.opengis.filter.sort.SortOrder; + +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.io.WKBWriter; + +class MergeSortDumper { + + static final boolean canSort(SimpleFeatureType schema, SortBy[] sortBy) { + if (sortBy == SortBy.UNSORTED) { + return true; + } + + // check all attributes are serializable + for (AttributeDescriptor ad : schema.getAttributeDescriptors()) { + Class<?> binding = ad.getType().getBinding(); + if (!Serializable.class.isAssignableFrom(binding)) { + return false; + } + } + + // check all sorting attributes are comparable + for (SortBy sb : sortBy) { + if (sb != SortBy.NATURAL_ORDER && sb != SortBy.REVERSE_ORDER) { + AttributeDescriptor ad = schema.getDescriptor(sb.getPropertyName() + .getPropertyName()); + Class<?> binding = ad.getType().getBinding(); + if (ad == null || !Comparable.class.isAssignableFrom(binding) + || Geometry.class.isAssignableFrom(binding)) { + return false; + } + } + } + + return true; + } + + static SimpleFeatureReader getDelegateReader(SimpleFeatureReader reader, Query query) + throws IOException { + Hints hints = query.getHints(); + int maxFeatures = 1000; + if (hints != null && hints.get(Hints.MAX_MEMORY_SORT) != null) { + maxFeatures = (Integer) hints.get(Hints.MAX_MEMORY_SORT); + } else if (Hints.getSystemDefault(Hints.MAX_MEMORY_SORT) != null) { + maxFeatures = (Integer) Hints.getSystemDefault(Hints.MAX_MEMORY_SORT); + } + + return getDelegateReader(reader, query.getSortBy(), maxFeatures); + } + + static SimpleFeatureReader getDelegateReader(SimpleFeatureReader reader, SortBy[] sortBy, + int maxFeatures) throws IOException { + Comparator<SimpleFeature> comparator = getComparator(sortBy); + + // easy case, no sorting needed + if (comparator == null) { + return reader; + } + + // double check + SimpleFeatureType schema = reader.getFeatureType(); + if (!canSort(schema, sortBy)) { + throw new IllegalArgumentException( + "The specified reader cannot be sorted, either the " + + "sorting properties are not comparable or the attributes are not serializable"); + } + + int count = 0; + File file = null; + RandomAccessFile raf = null; + List<SimpleFeature> features = new ArrayList<SimpleFeature>(); + List<FeatureBlockReader> readers = new ArrayList<FeatureBlockReader>(); + boolean cleanFile = true; + try { + // read and store into files as necessary + while (reader.hasNext()) { + SimpleFeature f = reader.next(); + features.add(f); + count++; + + if (count > maxFeatures) { + Collections.sort(features, comparator); + if (raf == null) { + file = File.createTempFile("sorted", ".features"); + file.delete(); + raf = new RandomAccessFile(file, "rw"); + } + FeatureBlockReader fbr = storeToFile(raf, features, schema); + readers.add(fbr); + count = 0; + features.clear(); + } + } + + // return the appropriate reader + if (raf == null) { + // simple case, we managed to keep everything in memory, sort and return a + // reader based on the collection contents + Collections.sort(features, comparator); + + SimpleFeatureIterator fi = new ListFeatureCollection(schema, features).features(); + return new DelegateSimpleFeatureReader(schema, fi); + } else { + // go merge-sort + cleanFile = false; + return new MergeSortReader(schema, raf, file, readers, comparator); + } + + } finally { + if (cleanFile && raf != null) { + raf.close(); + file.delete(); + } + + reader.close(); + } + } + + /** + * Writes the feature attributes to a binary file + * + * @param features + * @return + * @throws IOException + */ + static FeatureBlockReader storeToFile(RandomAccessFile raf, List<SimpleFeature> features, + SimpleFeatureType schema) throws IOException { + long start = raf.getFilePointer(); + + // write each attribute in the random access file + List<AttributeDescriptor> attributes = schema.getAttributeDescriptors(); + for (SimpleFeature sf : features) { + // write feature id + raf.writeUTF(sf.getID()); + // write the attributes + for (AttributeDescriptor ad : attributes) { + Object value = sf.getAttribute(ad.getLocalName()); + writeAttribute(raf, ad, value); + } + } + + return new FeatureBlockReader(raf, start, features.size(), schema); + } + + static void writeAttribute(RandomAccessFile raf, AttributeDescriptor ad, Object value) + throws IOException { + if (value == null) { + // null marker + raf.writeBoolean(true); + } else { + // not null, write the contents. This one requires some explanation. We are not + // writing any type metadata in the stream for the types we can optimize (primitives, + // numbers, + // strings and the like). This means we have to be 100% sure the class we're writing is + // actually the one we can optimize for, and not some subclass. Thus, we are authorized + // to use identity comparison instead of isAssignableFrom or equality, when we read back + // it must be as if we did not serialize stuff at all + raf.writeBoolean(false); + Class<?> binding = ad.getType().getBinding(); + if (binding == Boolean.class) { + raf.writeBoolean((Boolean) value); + } else if (binding == Byte.class || binding == byte.class) { + raf.writeByte((Byte) value); + } else if (binding == Short.class || binding == short.class) { + raf.writeShort((Short) value); + } else if (binding == Integer.class || binding == int.class) { + raf.writeInt((Integer) value); + } else if (binding == Long.class || binding == long.class) { + raf.writeLong((Long) value); + } else if (binding == Float.class || binding == float.class) { + raf.writeFloat((Float) value); + } else if (binding == Double.class || binding == double.class) { + raf.writeDouble((Double) value); + } else if (binding == String.class) { + raf.writeUTF((String) value); + } else if (binding == java.sql.Date.class || binding == java.sql.Time.class + || binding == java.sql.Timestamp.class || binding == java.util.Date.class) { + raf.writeLong(((Date) value).getTime()); + } else if (Geometry.class.isAssignableFrom(binding)) { + WKBWriter writer = new WKBWriter(); + byte[] buffer = writer.write((Geometry) value); + int length = buffer.length; + raf.writeInt(length); + raf.write(buffer); + } else { + // can't optimize, in this case we use an ObjectOutputStream to write out + // full metadata + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(value); + oos.flush(); + byte[] bytes = bos.toByteArray(); + raf.writeInt(bytes.length); + raf.write(bytes); + } + } + } + + /** + * Builds a comparator out of the sortBy list + * + * @param sortBy + * @return + */ + static Comparator<SimpleFeature> getComparator(SortBy[] sortBy) { + // handle the easy cases, no sorting or natural sorting + if (sortBy == SortBy.UNSORTED || sortBy == null) { + return null; + } + + // build a list of comparators + List<Comparator<SimpleFeature>> comparators = new ArrayList<Comparator<SimpleFeature>>(); + for (SortBy sb : sortBy) { + if (sb == SortBy.NATURAL_ORDER) { + comparators.add(new FidComparator(true)); + } else if (sb == SortBy.REVERSE_ORDER) { + comparators.add(new FidComparator(false)); + } else { + String name = sb.getPropertyName().getPropertyName(); + boolean ascending = sb.getSortOrder() == SortOrder.ASCENDING; + comparators.add(new PropertyComparator(name, ascending)); + } + } + + // return the final comparator + if (comparators.size() == 1) { + return comparators.get(0); + } else { + return new CompositeComparator(comparators); + } + + } + +} Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/MergeSortReader.java =================================================================== --- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/MergeSortReader.java (rev 0) +++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/MergeSortReader.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,101 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2004-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.sort; + +import java.io.File; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.Comparator; +import java.util.List; +import java.util.NoSuchElementException; + +import org.geotools.data.simple.SimpleFeatureReader; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; + +/** + * Reads from a list of {@link FeatureBlockReader} backed by a {@link RandomAccessFile} and performs + * the classic merge-sort algorithm + * + * @author Andrea Aime - GeoSolutions + * + */ +class MergeSortReader implements SimpleFeatureReader { + + List<FeatureBlockReader> readers; + + RandomAccessFile raf; + + File file; + + SimpleFeatureType schema; + + Comparator<SimpleFeature> comparator; + + public MergeSortReader(SimpleFeatureType schema, RandomAccessFile raf, File file, + List<FeatureBlockReader> readers, Comparator<SimpleFeature> comparator) { + this.schema = schema; + this.comparator = comparator; + this.readers = readers; + this.raf = raf; + this.file = file; + } + + public SimpleFeatureType getFeatureType() { + return schema; + } + + public SimpleFeature next() throws IOException, IllegalArgumentException, + NoSuchElementException { + if (readers.size() == 0) { + throw new NoSuchElementException(); + } + + // find the smallest feature + int selected = 0; + for (int i = 1; i < readers.size(); i++) { + SimpleFeature sf = readers.get(selected).feature(); + SimpleFeature cf = readers.get(i).feature(); + if (comparator.compare(sf, cf) > 0) { + selected = i; + } + } + + // move on the reader of the selected feature + FeatureBlockReader reader = readers.get(selected); + SimpleFeature sf = reader.feature(); + if (reader.next() == null) { + readers.remove(selected); + } + + // return the selected feature + return sf; + } + + public boolean hasNext() throws IOException { + return readers.size() > 0; + } + + public void close() throws IOException { + try { + raf.close(); + } finally { + file.delete(); + } + } + +} Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/PropertyComparator.java =================================================================== --- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/PropertyComparator.java (rev 0) +++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/PropertyComparator.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,71 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2004-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.sort; + +import java.util.Comparator; + +import org.opengis.feature.simple.SimpleFeature; + +/** + * Compares two feature based on an attribute value + * + * @author Andrea Aime - GeoSolutions + */ +class PropertyComparator implements Comparator<SimpleFeature> { + + String propertyName; + + boolean ascending; + + /** + * Builds a new comparator + * + * @param propertyName The property name to be used + * @param inverse If true the comparator will force an ascending order (descending otherwise) + */ + public PropertyComparator(String propertyName, boolean ascending) { + this.propertyName = propertyName; + this.ascending = ascending; + } + + public int compare(SimpleFeature f1, SimpleFeature f2) { + int result = compareAscending(f1, f2); + if (ascending) { + return result; + } else { + return result * -1; + } + } + + private int compareAscending(SimpleFeature f1, SimpleFeature f2) { + Comparable o1 = (Comparable) f1.getAttribute(propertyName); + Comparable o2 = (Comparable) f2.getAttribute(propertyName); + + if (o1 == null) { + if (o2 == null) { + return 0; + } else { + return -1; + } + } else if (o2 == null) { + return 1; + } else { + return o1.compareTo(o2); + } + } + +} Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/SortedFeatureIterator.java =================================================================== --- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/SortedFeatureIterator.java (rev 0) +++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/SortedFeatureIterator.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,70 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2004-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.sort; + +import java.io.IOException; +import java.io.Serializable; +import java.util.NoSuchElementException; + +import org.geotools.data.simple.DelegateSimpleFeatureReader; +import org.geotools.data.simple.SimpleFeatureIterator; +import org.geotools.data.simple.SimpleFeatureReader; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.filter.sort.SortBy; + +/** + * Sorts features based on the specified sorting order + * + * @source $URL$ + */ +public class SortedFeatureIterator implements SimpleFeatureIterator { + + FeatureReaderFeatureIterator delegate; + + /** + * Checks if the schema and the sortBy are suitable for merge/sort. All attributes need to be + * {@link Serializable}, all sorting attributes need to be {@link Comparable} + * + * @param schema + * @param sortBy + * @return + */ + public static final boolean canSort(SimpleFeatureType schema, SortBy[] sortBy) { + return MergeSortDumper.canSort(schema, sortBy); + } + + public SortedFeatureIterator(SimpleFeatureIterator iterator, SimpleFeatureType schema, + SortBy[] sortBy, int maxFeatures) throws IOException { + DelegateSimpleFeatureReader reader = new DelegateSimpleFeatureReader(schema, iterator); + SimpleFeatureReader sorted = new SortedFeatureReader(reader, sortBy, maxFeatures); + this.delegate = new FeatureReaderFeatureIterator(sorted); + } + + public boolean hasNext() { + return delegate.hasNext(); + } + + public SimpleFeature next() throws NoSuchElementException { + return delegate.next(); + } + + public void close() { + delegate.close(); + + } +} Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/SortedFeatureReader.java =================================================================== --- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/SortedFeatureReader.java (rev 0) +++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/sort/SortedFeatureReader.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,94 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2004-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.sort; + +import java.io.IOException; +import java.io.Serializable; +import java.util.NoSuchElementException; + +import org.geotools.data.Query; +import org.geotools.data.simple.SimpleFeatureReader; +import org.geotools.factory.Hints; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.filter.sort.SortBy; + +/** + * FeatureReader used to sort contents. + * <p> + * The implementation makes use of {@link MergeSortDumper). + * + * @source $URL$ + */ +public class SortedFeatureReader implements SimpleFeatureReader { + + SimpleFeatureReader delegate; + + /** + * Checks if the schema and the sortBy are suitable for merge/sort. All attributes need to be + * {@link Serializable}, all sorting attributes need to be {@link Comparable} + * + * @param schema + * @param sortBy + * @return + */ + public static final boolean canSort(SimpleFeatureType schema, SortBy[] sortBy) { + return MergeSortDumper.canSort(schema, sortBy); + } + + /** + * Builds a new sorting feature reader + * + * @param reader The reader to be sorted + * @param query The query holding the SortBy directives, and the eventual max features in memory + * hint {@link Hints#MAX_MEMORY_SORT} + */ + public SortedFeatureReader(SimpleFeatureReader reader, Query query) throws IOException { + this.delegate = MergeSortDumper.getDelegateReader(reader, query); + } + + /** + * Builds a new sorting feature reader + * + * @param reader The reader to be sorted + * @param sortBy The sorting directives + * @param maxFeatures The maximum number of features to keep in memory + * @throws IOException + */ + public SortedFeatureReader(SimpleFeatureReader reader, SortBy[] sortBy, int maxFeatures) + throws IOException { + this.delegate = MergeSortDumper.getDelegateReader(reader, sortBy, maxFeatures); + } + + public SimpleFeatureType getFeatureType() { + return delegate.getFeatureType(); + } + + public SimpleFeature next() throws IOException, IllegalArgumentException, + NoSuchElementException { + return delegate.next(); + } + + public boolean hasNext() throws IOException { + return delegate.hasNext(); + } + + public void close() throws IOException { + delegate.close(); + } + +} Added: branches/2.7.x/modules/library/main/src/main/java/org/geotools/feature/collection/SortedSimpleFeatureCollection.java =================================================================== --- branches/2.7.x/modules/library/main/src/main/java/org/geotools/feature/collection/SortedSimpleFeatureCollection.java (rev 0) +++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/feature/collection/SortedSimpleFeatureCollection.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,61 @@ +package org.geotools.feature.collection; + +import java.io.IOException; +import java.util.Iterator; + +import org.geotools.data.simple.SimpleFeatureCollection; +import org.geotools.data.simple.SimpleFeatureIterator; +import org.geotools.data.sort.SortedFeatureIterator; +import org.geotools.data.store.FeatureIteratorIterator; +import org.geotools.factory.Hints; +import org.geotools.feature.FeatureIterator; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.filter.sort.SortBy; + +/** + * A wrapper that will sort a feature collection using a size sensitive algorithm, in main memory + * for small collections, using secondary memory otherwise. The threshold is defined by the + * {@link Hints#MAX_MEMORY_SORT} feature count + * + * @author Andrea Aime - GeoSolutions + * + */ +public class SortedSimpleFeatureCollection extends DecoratingSimpleFeatureCollection { + + private SortBy[] sort; + + public SortedSimpleFeatureCollection(SimpleFeatureCollection delegate, SortBy[] sort) { + super(delegate); + this.sort = sort; + } + + @Override + public SimpleFeatureIterator features() { + try { + SimpleFeatureIterator features = ((SimpleFeatureCollection) delegate).features(); + // sort if necessary + if (sort != null) { + features = new SortedFeatureIterator(features, getSchema(), sort, -1); + } + return features; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Override + public Iterator iterator() { + return new FeatureIteratorIterator<SimpleFeature>(features()); + } + + @Override + public void close(FeatureIterator<SimpleFeature> close) { + close.close(); + } + + @Override + public void close(Iterator<SimpleFeature> close) { + FeatureIteratorIterator<SimpleFeature> fii = (FeatureIteratorIterator<SimpleFeature>) close; + delegate.close(fii.getDelegate()); + } +} Added: branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/collection/SortedFeatureCollectionTest.java =================================================================== --- branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/collection/SortedFeatureCollectionTest.java (rev 0) +++ branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/collection/SortedFeatureCollectionTest.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,68 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.collection; + +import java.util.Comparator; + +import org.geotools.data.DataUtilities; +import org.geotools.data.simple.SimpleFeatureIterator; +import org.geotools.data.store.FeatureCollectionWrapperTestSupport; +import org.geotools.factory.CommonFactoryFinder; +import org.geotools.feature.collection.SortedSimpleFeatureCollection; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.filter.FilterFactory2; +import org.opengis.filter.sort.SortBy; +import org.opengis.filter.sort.SortOrder; + +public class SortedFeatureCollectionTest extends FeatureCollectionWrapperTestSupport { + + FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); + + public void testNaturalSort() throws Exception { + SortedSimpleFeatureCollection sorted = new SortedSimpleFeatureCollection(delegate, + new SortBy[] { SortBy.NATURAL_ORDER }); + checkSorted(sorted, DataUtilities.sortComparator(SortBy.NATURAL_ORDER)); + } + + public void testReverseSort() throws Exception { + SortedSimpleFeatureCollection sorted = new SortedSimpleFeatureCollection(delegate, + new SortBy[] { SortBy.REVERSE_ORDER }); + checkSorted(sorted, DataUtilities.sortComparator(SortBy.REVERSE_ORDER)); + } + + public void testSortAttribute() throws Exception { + SortBy sort = ff.sort("someAtt", SortOrder.ASCENDING); + SortedSimpleFeatureCollection sorted = new SortedSimpleFeatureCollection(delegate, + new SortBy[] { sort }); + checkSorted(sorted, DataUtilities.sortComparator(sort)); + } + + private void checkSorted(SortedSimpleFeatureCollection sorted, + Comparator<SimpleFeature> comparator) { + SimpleFeatureIterator fi = sorted.features(); + SimpleFeature prev = null; + while (fi.hasNext()) { + SimpleFeature curr = fi.next(); + if (prev != null) { + assertTrue("Failed on " + prev + " / " + curr, comparator.compare(prev, curr) <= 0); + } + prev = curr; + } + fi.close(); + } + +} Added: branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/sort/SortedReaderTest.java =================================================================== --- branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/sort/SortedReaderTest.java (rev 0) +++ branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/sort/SortedReaderTest.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -0,0 +1,276 @@ +package org.geotools.data.sort; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.util.Date; +import java.util.NoSuchElementException; + +import org.geotools.data.simple.DelegateSimpleFeatureReader; +import org.geotools.data.simple.SimpleFeatureCollection; +import org.geotools.data.simple.SimpleFeatureIterator; +import org.geotools.data.simple.SimpleFeatureReader; +import org.geotools.factory.CommonFactoryFinder; +import org.geotools.feature.DefaultFeatureCollection; +import org.geotools.feature.simple.SimpleFeatureBuilder; +import org.geotools.feature.simple.SimpleFeatureTypeBuilder; +import org.geotools.referencing.crs.DefaultGeographicCRS; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.filter.FilterFactory; +import org.opengis.filter.sort.SortBy; +import org.opengis.filter.sort.SortOrder; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.Point; + +/** + * + * + * @source $URL$ + */ +public class SortedReaderTest { + + SimpleFeatureReader fr; + + FilterFactory ff; + + SortBy[] peopleAsc; + + SortBy[] peopleDesc; + + SortBy[] fidAsc; + + SimpleFeatureType schema; + + SimpleFeatureCollection fc; + + private SortBy[] dateAsc; + + @Before + public void setup() throws IOException { + SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); + + typeBuilder.setName("test"); + typeBuilder.setNamespaceURI("test"); + typeBuilder.setCRS(DefaultGeographicCRS.WGS84); + typeBuilder.add("defaultGeom", Point.class, DefaultGeographicCRS.WGS84); + typeBuilder.add("PERSONS", Integer.class); + typeBuilder.add("byte", Byte.class); + typeBuilder.add("short", Short.class); + typeBuilder.add("long", Long.class); + typeBuilder.add("float", Float.class); + typeBuilder.add("double", Double.class); + typeBuilder.add("date", Date.class); + typeBuilder.add("sql_date", java.sql.Date.class); + typeBuilder.add("sql_time", java.sql.Time.class); + typeBuilder.add("sql_timestamp", java.sql.Timestamp.class); + typeBuilder.add("otherGeom", LineString.class); + typeBuilder.setDefaultGeometry("defaultGeom"); + + schema = (SimpleFeatureType) typeBuilder.buildFeatureType(); + + SimpleFeatureBuilder builder = new SimpleFeatureBuilder(schema); + + GeometryFactory gf = new GeometryFactory(); + fc = new DefaultFeatureCollection("test", schema); + + double x = -140; + double y = 45; + final int features = 500; + for (int i = 0; i < features; i++) { + Point point = gf.createPoint(new Coordinate(x + i, y + i)); + point.setUserData(DefaultGeographicCRS.WGS84); + + builder.add(point); + builder.add(new Integer(i)); + builder.add(new Byte((byte) i)); + builder.add(new Short((short) i)); + builder.add(new Long(i)); + builder.add(new Float(i)); + builder.add(new Double(i)); + builder.add(new Date()); + builder.add(new java.sql.Date(System.currentTimeMillis())); + builder.add(new java.sql.Time(System.currentTimeMillis())); + builder.add(new java.sql.Timestamp(System.currentTimeMillis())); + + LineString line = gf.createLineString(new Coordinate[] { new Coordinate(x + i, y + i), + new Coordinate(x + i + 1, y + i + 1) }); + line.setUserData(DefaultGeographicCRS.WGS84); + builder.add(line); + + fc.add(builder.buildFeature(i + "")); + } + + // add a feature with a null geometry + builder.add(null); + builder.add(new Integer(-1)); + builder.add(null); + fc.add(builder.buildFeature((features + 1) + "")); + + fr = new DelegateSimpleFeatureReader(schema, fc.features()); + + ff = CommonFactoryFinder.getFilterFactory(null); + peopleAsc = new SortBy[] { ff.sort("PERSONS", SortOrder.ASCENDING) }; + peopleDesc = new SortBy[] { ff.sort("PERSONS", SortOrder.DESCENDING) }; + dateAsc = new SortBy[] { ff.sort("date", SortOrder.ASCENDING) }; + fidAsc = new SortBy[] { SortBy.NATURAL_ORDER }; + } + + @After + public void tearDown() throws IOException { + fr.close(); + } + + @Test + public void testCanSort() { + assertTrue(SortedFeatureReader.canSort(schema, peopleAsc)); + assertTrue(SortedFeatureReader.canSort(schema, peopleDesc)); + assertTrue(SortedFeatureReader.canSort(schema, fidAsc)); + } + + @Test + public void testMemorySort() throws IOException { + // make it so that we are not going to hit the disk + SimpleFeatureReader sr = null; + try { + sr = new SortedFeatureReader(fr, peopleAsc, 1000); + assertSortedOnPeopleAsc(sr); + } finally { + if (sr != null) { + sr.close(); + } + } + } + + @Test + public void testFileSortDate() throws IOException { + // make it so that we are not going to hit the disk + SimpleFeatureReader sr = null; + try { + sr = new SortedFeatureReader(fr, dateAsc, 100); + assertSortedOnDateAsc(sr); + } finally { + if (sr != null) { + sr.close(); + } + } + } + + @Test + public void testFileSortPeople() throws IOException { + // make it so that we are not going to hit the disk + SimpleFeatureReader sr = null; + try { + sr = new SortedFeatureReader(fr, peopleAsc, 5); + assertSortedOnPeopleAsc(sr); + } finally { + if (sr != null) { + sr.close(); + } + } + } + + @Test + public void testIteratorSortReduce() throws IOException { + // make it so that we are not going to hit the disk + SimpleFeatureIterator fi = null; + try { + fi = new SortedFeatureIterator(fc.features(), schema, peopleAsc, 1000); + assertSortedOnPeopleAsc(fi); + } finally { + if (fi != null) { + fi.close(); + } + } + } + + @Test + public void testSortDescending() throws IOException { + // make it so that we are not going to hit the disk + SimpleFeatureReader sr = null; + try { + sr = new SortedFeatureReader(fr, peopleDesc, 1000); + double prev = -1; + while (fr.hasNext()) { + SimpleFeature f = fr.next(); + double curr = (Double) f.getAttribute("PERSONS"); + if (prev > 0) { + assertTrue(curr <= prev); + } + prev = curr; + } + } finally { + if (sr != null) { + sr.close(); + } + } + } + + @Test + public void testSortNatural() throws IOException { + // make it so that we are not going to hit the disk + SimpleFeatureReader sr = null; + try { + sr = new SortedFeatureReader(fr, fidAsc, 1000); + String prev = null; + while (fr.hasNext()) { + SimpleFeature f = fr.next(); + String id = f.getID(); + if (prev != null) { + assertTrue(id.compareTo(prev) >= 0); + } + prev = id; + } + } finally { + if (sr != null) { + sr.close(); + } + } + } + + private void assertSortedOnPeopleAsc(SimpleFeatureReader fr) throws IllegalArgumentException, + NoSuchElementException, IOException { + double prev = -1; + while (fr.hasNext()) { + SimpleFeature f = fr.next(); + int curr = (Integer) f.getAttribute("PERSONS"); + if (prev > 0) { + assertTrue(curr >= prev); + } + prev = curr; + } + } + + private void assertSortedOnDateAsc(SimpleFeatureReader fr) throws IllegalArgumentException, + NoSuchElementException, IOException { + Date prev = null; + while (fr.hasNext()) { + SimpleFeature f = fr.next(); + Date curr = (Date) f.getAttribute("date"); + if (prev != null) { + assertTrue(prev.compareTo(curr) <= 0); + } + prev = curr; + } + } + + private void assertSortedOnPeopleAsc(SimpleFeatureIterator fi) throws IllegalArgumentException, + NoSuchElementException, IOException { + double prev = -1; + while (fi.hasNext()) { + SimpleFeature f = fi.next(); + int curr = (Integer) f.getAttribute("PERSONS"); + if (prev > 0) { + assertTrue(curr >= prev); + } + prev = curr; + } + } + +} Modified: branches/2.7.x/modules/library/metadata/src/main/java/org/geotools/factory/Hints.java =================================================================== --- branches/2.7.x/modules/library/metadata/src/main/java/org/geotools/factory/Hints.java 2011-12-08 22:39:09 UTC (rev 38413) +++ branches/2.7.x/modules/library/metadata/src/main/java/org/geotools/factory/Hints.java 2011-12-13 09:39:22 UTC (rev 38414) @@ -573,6 +573,15 @@ public static final Key FEATURE_2D = new Key(Boolean.class); /** + * Key to control the maximum number of features that will be kept in memory + * when performing a fallback merge-sort (used when the datastore does not have + * native means to handle feature sorting) + * + * @since 2.7.4 + */ + public static final Key MAX_MEMORY_SORT = new Key(Integer.class); + + /** * Asks a datastore having a vector pyramid (pre-generalized geometries) * to return the geometry version whose points have been generalized * less than the spefiedi distance (further generalization might be |
|
From: <svn...@os...> - 2011-12-08 22:39:17
|
Author: mleslie
Date: 2011-12-08 14:39:09 -0800 (Thu, 08 Dec 2011)
New Revision: 38413
Added:
trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/RepositoryTestCase.java
trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGITRepositoryTestCase.java
Modified:
trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitDataStoreTest.java
trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitFeatureSourceTest.java
trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitFeatureStoreTest.java
trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/versioning/VersioningTestSupport.java
trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/versioning/decorator/DecoratedTestCase.java
trunk/modules/unsupported/pom.xml
Log:
Reducing the memory footprint of test cases in the geogit-versioned module and adding it back into the build.
Added: trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/RepositoryTestCase.java
===================================================================
--- trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/RepositoryTestCase.java (rev 0)
+++ trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/RepositoryTestCase.java 2011-12-08 22:39:09 UTC (rev 38413)
@@ -0,0 +1,109 @@
+package org.geoserver.data;
+
+import java.io.File;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.io.FileUtils;
+import org.geogit.repository.Repository;
+import org.geogit.storage.RepositoryDatabase;
+import org.geogit.storage.bdbje.EntityStoreConfig;
+import org.geogit.storage.bdbje.EnvironmentBuilder;
+import org.geogit.storage.bdbje.JERepositoryDatabase;
+import org.geoserver.data.geogit.GeoGITRepositoryTestCase;
+import org.geotools.feature.simple.SimpleFeatureBuilder;
+import org.geotools.geometry.jts.WKTReader2;
+import org.geotools.util.logging.Logging;
+import org.opengis.feature.Feature;
+import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.feature.type.GeometryDescriptor;
+
+import com.sleepycat.je.Environment;
+import com.vividsolutions.jts.io.ParseException;
+
+public abstract class RepositoryTestCase extends TestCase {
+ protected Repository repo;
+
+ private File envHome;
+
+ // prevent recursion
+ private boolean setup = false;
+
+ protected RepositoryDatabase repositoryDatabase;
+
+ protected static final Logger LOGGER = Logging
+ .getLogger(GeoGITRepositoryTestCase.class);
+
+ @Override
+ protected void setUp() throws Exception {
+ if (setup) {
+ throw new IllegalStateException("Are you calling super.setUp()!?");
+ }
+ setup = true;
+ Logging.ALL.forceMonolineConsoleOutput();
+ envHome = new File(new File("target"), "mockblobstore");
+ final File repositoryHome = new File(envHome, "repository");
+ final File indexHome = new File(envHome, "index");
+
+ FileUtils.deleteDirectory(envHome);
+ repositoryHome.mkdirs();
+ indexHome.mkdirs();
+
+ EntityStoreConfig config = new EntityStoreConfig();
+ config.setCacheMemoryPercentAllowed(25);
+ EnvironmentBuilder esb = new EnvironmentBuilder(config);
+ Properties bdbEnvProperties = null;
+ Environment environment;
+ environment = esb.buildEnvironment(repositoryHome, bdbEnvProperties);
+
+ Environment stagingEnvironment;
+ stagingEnvironment = esb.buildEnvironment(indexHome, bdbEnvProperties);
+
+ repositoryDatabase = new JERepositoryDatabase(environment, stagingEnvironment);
+
+ // repositoryDatabase = new FileSystemRepositoryDatabase(envHome);
+
+ repo = new Repository(repositoryDatabase, envHome);
+
+ repo.create();
+
+ setUpInternal();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (!setup) {
+ throw new IllegalStateException("Are you calling super.setUp()!?");
+ }
+ setup = false;
+ tearDownInternal();
+ if (repo != null) {
+ repo.close();
+ repo = null;
+ }
+ repositoryDatabase = null;
+
+ FileUtils.deleteDirectory(envHome);
+ }
+
+ protected abstract void setUpInternal() throws Exception;
+
+ protected abstract void tearDownInternal() throws Exception;
+
+ protected Feature feature(SimpleFeatureType type, String id, Object... values)
+ throws ParseException {
+ SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);
+ for (int i = 0; i < values.length; i++) {
+ Object value = values[i];
+ if (type.getDescriptor(i) instanceof GeometryDescriptor) {
+ if (value instanceof String) {
+ value = new WKTReader2().read((String) value);
+ }
+ }
+ builder.set(i, value);
+ }
+ return builder.buildFeature(id);
+ }
+}
Added: trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGITRepositoryTestCase.java
===================================================================
--- trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGITRepositoryTestCase.java (rev 0)
+++ trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGITRepositoryTestCase.java 2011-12-08 22:39:09 UTC (rev 38413)
@@ -0,0 +1,312 @@
+/* Copyright (c) 2011 TOPP - www.openplans.org. All rights reserved.
+ * This code is licensed under the GPL 2.0 license, available at the root
+ * application directory.
+ */
+package org.geoserver.data.geogit;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.io.FileUtils;
+import org.geogit.api.GeoGIT;
+import org.geogit.api.ObjectId;
+import org.geogit.api.Ref;
+import org.geogit.api.RevCommit;
+import org.geogit.repository.Repository;
+import org.geogit.repository.StagingArea;
+import org.geogit.repository.Triplet;
+import org.geogit.storage.ObjectWriter;
+import org.geogit.storage.RepositoryDatabase;
+import org.geogit.storage.WrappedSerialisingFactory;
+import org.geogit.storage.bdbje.EntityStoreConfig;
+import org.geogit.storage.bdbje.EnvironmentBuilder;
+import org.geogit.storage.bdbje.JERepositoryDatabase;
+import org.geoserver.data.RepositoryTestCase;
+import org.geoserver.data.versioning.decorator.DecoratedTestCase;
+import org.geotools.data.DataUtilities;
+import org.geotools.feature.NameImpl;
+import org.geotools.feature.simple.SimpleFeatureBuilder;
+import org.geotools.geometry.jts.ReferencedEnvelope;
+import org.geotools.geometry.jts.WKTReader2;
+import org.geotools.referencing.CRS;
+import org.geotools.util.NullProgressListener;
+import org.geotools.util.logging.Logging;
+import org.opengis.feature.Feature;
+import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.feature.type.GeometryDescriptor;
+import org.opengis.feature.type.Name;
+import org.opengis.geometry.BoundingBox;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
+import com.sleepycat.je.Environment;
+import com.sleepycat.je.dbi.DbEnvPool;
+import com.sleepycat.je.dbi.EnvironmentImpl;
+import com.vividsolutions.jts.io.ParseException;
+
+public abstract class GeoGITRepositoryTestCase extends RepositoryTestCase {
+
+ protected static final String idL1 = "Lines.1";
+
+ protected static final String idL2 = "Lines.2";
+
+ protected static final String idL3 = "Lines.3";
+
+ protected static final String idP1 = "Points.1";
+
+ protected static final String idP2 = "Points.2";
+
+ protected static final String idP3 = "Points.3";
+
+ protected static final String pointsNs = "http://geogit.points";
+
+ protected static final String pointsName = "Points";
+
+ protected static final String pointsTypeSpec = "sp:String,ip:Integer,pp:Point:srid=4326";
+
+ protected static final Name pointsTypeName = new NameImpl(pointsNs, pointsName);
+
+ protected SimpleFeatureType pointsType;
+
+ protected Feature points1;
+
+ protected Feature points2;
+
+ protected Feature points3;
+
+ protected static final String linesNs = "http://geogit.lines";
+
+ protected static final String linesName = "Lines";
+
+ protected static final String linesTypeSpec = "sp:String,ip:Integer,pp:LineString:srid=4326";
+
+ protected static final Name linesTypeName = new NameImpl(linesNs, linesName);
+
+ protected SimpleFeatureType linesType;
+
+ protected Feature lines1;
+
+ protected Feature lines2;
+
+ protected Feature lines3;
+
+ private boolean setupInternal = false;
+
+ @Override
+ protected final void setUpInternal() throws Exception {
+ if (setupInternal) {
+ throw new IllegalStateException("Are you calling super.setUpInternal()!?");
+ }
+ setupInternal = true;
+ pointsType = DataUtilities.createType(pointsNs, pointsName, pointsTypeSpec);
+
+ points1 = feature(pointsType, idP1, "StringProp1_1", new Integer(1000), "POINT(1 1)");
+ points2 = feature(pointsType, idP2, "StringProp1_2", new Integer(2000), "POINT(2 2)");
+ points3 = feature(pointsType, idP3, "StringProp1_3", new Integer(3000), "POINT(3 3)");
+
+ linesType = DataUtilities.createType(linesNs, linesName, linesTypeSpec);
+
+ lines1 = feature(linesType, idL1, "StringProp2_1", new Integer(1000),
+ "LINESTRING (1 1, 2 2)");
+ lines2 = feature(linesType, idL2, "StringProp2_2", new Integer(2000),
+ "LINESTRING (3 3, 4 4)");
+ lines3 = feature(linesType, idL3, "StringProp2_3", new Integer(3000),
+ "LINESTRING (5 5, 6 6)");
+
+ setUpChild();
+ }
+
+ @Override
+ protected final void tearDownInternal() throws Exception {
+ if (!setupInternal) {
+ throw new IllegalStateException("Are you calling super.tearDownInternal()!?");
+ }
+ setupInternal = false;
+ tearDownChild();
+
+ }
+
+ /**
+ * Called as the last step in {@link #setUp()}
+ */
+ protected abstract void setUpChild() throws Exception;
+
+ /**
+ * Called before {@link #tearDown()}, subclasses may override as appropriate
+ */
+ protected abstract void tearDownChild() throws Exception;
+
+ public Repository getRepository() {
+ return repo;
+ }
+
+ protected List<RevCommit> populate(boolean oneCommitPerFeature, Feature... features)
+ throws Exception {
+ return populate(oneCommitPerFeature, Arrays.asList(features));
+ }
+
+ protected List<RevCommit> populate(boolean oneCommitPerFeature, List<Feature> features)
+ throws Exception {
+
+ final GeoGIT ggit = new GeoGIT(getRepository());
+
+ List<RevCommit> commits = new ArrayList<RevCommit>();
+
+ for (Feature f : features) {
+ insertAndAdd(f);
+ if (oneCommitPerFeature) {
+ RevCommit commit = ggit.commit().call();
+ commits.add(commit);
+ }
+ }
+
+ if (!oneCommitPerFeature) {
+ RevCommit commit = ggit.commit().call();
+ commits.add(commit);
+ }
+
+ return commits;
+ }
+
+ /**
+ * Inserts the Feature to the index and stages it to be committed.
+ */
+ protected ObjectId insertAndAdd(Feature f) throws Exception {
+ ObjectId objectId = insert(f);
+
+ new GeoGIT(getRepository()).add().call();
+ return objectId;
+ }
+
+ /**
+ * Inserts the feature to the index but does not stages it to be committed
+ */
+ protected ObjectId insert(Feature f) throws Exception {
+ final StagingArea index = getRepository().getIndex();
+ Name name = f.getType().getName();
+ String namespaceURI = name.getNamespaceURI();
+ String localPart = name.getLocalPart();
+ String id = f.getIdentifier().getID();
+
+ Ref ref = index.inserted(
+ WrappedSerialisingFactory.getInstance().createFeatureWriter(f), f.getBounds(), namespaceURI, localPart, id);
+ ObjectId objectId = ref.getObjectId();
+ return objectId;
+ }
+
+ protected void insertAndAdd(Feature... features) throws Exception {
+ insert(features);
+ new GeoGIT(getRepository()).add().call();
+ }
+
+ protected void insert(Feature... features) throws Exception {
+
+ final StagingArea index = getRepository().getIndex();
+
+ Iterator<Triplet<ObjectWriter<?>, BoundingBox, List<String>>> iterator;
+ Function<Feature, Triplet<ObjectWriter<?>, BoundingBox, List<String>>> function = new Function<Feature, Triplet<ObjectWriter<?>, BoundingBox, List<String>>>() {
+
+ @Override
+ public Triplet<ObjectWriter<?>, BoundingBox, List<String>> apply(final Feature f) {
+ Name name = f.getType().getName();
+ String namespaceURI = name.getNamespaceURI();
+ String localPart = name.getLocalPart();
+ String id = f.getIdentifier().getID();
+
+ Triplet<ObjectWriter<?>, BoundingBox, List<String>> tuple;
+ ObjectWriter<?> writer = WrappedSerialisingFactory.getInstance().createFeatureWriter(f);
+ BoundingBox bounds = f.getBounds();
+ List<String> path = Arrays.asList(namespaceURI, localPart, id);
+ tuple = new Triplet<ObjectWriter<?>, BoundingBox, List<String>>(writer, bounds,
+ path);
+ return tuple;
+ }
+ };
+
+ iterator = Iterators.transform(Iterators.forArray(features), function);
+
+ index.inserted(iterator, new NullProgressListener(), null);
+
+ }
+
+ /**
+ * Deletes a feature from the index
+ *
+ * @param f
+ * @return
+ * @throws Exception
+ */
+ protected boolean deleteAndAdd(Feature f) throws Exception {
+ boolean existed = delete(f);
+ if (existed) {
+ new GeoGIT(getRepository()).add().call();
+ }
+
+ return existed;
+ }
+
+ protected boolean delete(Feature f) throws Exception {
+ final StagingArea index = getRepository().getIndex();
+ Name name = f.getType().getName();
+ String namespaceURI = name.getNamespaceURI();
+ String localPart = name.getLocalPart();
+ String id = f.getIdentifier().getID();
+ boolean existed = index.deleted(namespaceURI, localPart, id);
+ return existed;
+ }
+
+ protected <E> List<E> toList(Iterator<E> logs) {
+ List<E> logged = new ArrayList<E>();
+ Iterators.addAll(logged, logs);
+ return logged;
+ }
+
+ protected <E> List<E> toList(Iterable<E> logs) {
+ List<E> logged = new ArrayList<E>();
+ Iterables.addAll(logged, logs);
+ return logged;
+ }
+
+ /**
+ * Computes the aggregated bounds of {@code features}, assuming all of them are in the same CRS
+ */
+ protected ReferencedEnvelope boundsOf(Feature... features) {
+ ReferencedEnvelope bounds = null;
+ for (int i = 0; i < features.length; i++) {
+ Feature f = features[i];
+ if (bounds == null) {
+ bounds = (ReferencedEnvelope) f.getBounds();
+ } else {
+ bounds.include(f.getBounds());
+ }
+ }
+ return bounds;
+ }
+
+ /**
+ * Computes the aggregated bounds of {@code features} in the {@code targetCrs}
+ */
+ protected ReferencedEnvelope boundsOf(CoordinateReferenceSystem targetCrs, Feature... features)
+ throws Exception {
+ ReferencedEnvelope bounds = new ReferencedEnvelope(targetCrs);
+
+ for (int i = 0; i < features.length; i++) {
+ Feature f = features[i];
+ BoundingBox fbounds = f.getBounds();
+ if (!CRS.equalsIgnoreMetadata(targetCrs, fbounds)) {
+ fbounds = fbounds.toBounds(targetCrs);
+ }
+ bounds.include(fbounds);
+ }
+ return bounds;
+ }
+}
Modified: trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitDataStoreTest.java
===================================================================
--- trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitDataStoreTest.java 2011-12-08 19:57:35 UTC (rev 38412)
+++ trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitDataStoreTest.java 2011-12-08 22:39:09 UTC (rev 38413)
@@ -30,20 +30,24 @@
import org.geogit.storage.RefDatabase;
import org.geogit.storage.WrappedSerialisingFactory;
import org.geogit.storage.hessian.HessianSimpleFeatureTypeReader;
-import org.geogit.test.RepositoryTestCase;
import org.geotools.data.SchemaNotFoundException;
import org.geotools.data.simple.SimpleFeatureSource;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.Name;
-public class GeoGitDataStoreTest extends RepositoryTestCase {
+public class GeoGitDataStoreTest extends GeoGITRepositoryTestCase {
private GeoGitDataStore dataStore;
@Override
- protected void setUpInternal() throws Exception {
+ protected void setUpChild() throws Exception {
dataStore = new GeoGitDataStore(repo);
}
+
+ @Override
+ protected void tearDownChild() throws Exception {
+ dataStore = null;
+ }
public void testCreateSchema() throws IOException {
final RefDatabase refDatabase = repo.getRefDatabase();
@@ -114,9 +118,9 @@
assertEquals(2, dataStore.getNames().size());
assertTrue(dataStore.getNames().contains(
- RepositoryTestCase.linesTypeName));
+ GeoGITRepositoryTestCase.linesTypeName));
assertTrue(dataStore.getNames().contains(
- RepositoryTestCase.pointsTypeName));
+ GeoGITRepositoryTestCase.pointsTypeName));
}
public void testGetTypeNames() throws IOException {
@@ -131,13 +135,13 @@
List<String> simpleNames = Arrays.asList(dataStore.getTypeNames());
- assertTrue(simpleNames.contains(RepositoryTestCase.linesName));
- assertTrue(simpleNames.contains(RepositoryTestCase.pointsName));
+ assertTrue(simpleNames.contains(GeoGITRepositoryTestCase.linesName));
+ assertTrue(simpleNames.contains(GeoGITRepositoryTestCase.pointsName));
}
public void testGetSchemaName() throws IOException {
try {
- dataStore.getSchema(RepositoryTestCase.linesTypeName);
+ dataStore.getSchema(GeoGITRepositoryTestCase.linesTypeName);
fail("Expected SchemaNotFoundException");
} catch (SchemaNotFoundException e) {
assertTrue(true);
@@ -145,11 +149,11 @@
dataStore.createSchema(super.linesType);
SimpleFeatureType lines = dataStore
- .getSchema(RepositoryTestCase.linesTypeName);
+ .getSchema(GeoGITRepositoryTestCase.linesTypeName);
assertEquals(super.linesType, lines);
try {
- dataStore.getSchema(RepositoryTestCase.pointsTypeName);
+ dataStore.getSchema(GeoGITRepositoryTestCase.pointsTypeName);
fail("Expected SchemaNotFoundException");
} catch (SchemaNotFoundException e) {
assertTrue(true);
@@ -157,13 +161,13 @@
dataStore.createSchema(super.pointsType);
SimpleFeatureType points = dataStore
- .getSchema(RepositoryTestCase.pointsTypeName);
+ .getSchema(GeoGITRepositoryTestCase.pointsTypeName);
assertEquals(super.pointsType, points);
}
public void testGetSchemaString() throws IOException {
try {
- dataStore.getSchema(RepositoryTestCase.linesName);
+ dataStore.getSchema(GeoGITRepositoryTestCase.linesName);
fail("Expected SchemaNotFoundException");
} catch (SchemaNotFoundException e) {
assertTrue(true);
@@ -171,11 +175,11 @@
dataStore.createSchema(super.linesType);
SimpleFeatureType lines = dataStore
- .getSchema(RepositoryTestCase.linesName);
+ .getSchema(GeoGITRepositoryTestCase.linesName);
assertEquals(super.linesType, lines);
try {
- dataStore.getSchema(RepositoryTestCase.pointsName);
+ dataStore.getSchema(GeoGITRepositoryTestCase.pointsName);
fail("Expected SchemaNotFoundException");
} catch (SchemaNotFoundException e) {
assertTrue(true);
@@ -183,13 +187,13 @@
dataStore.createSchema(super.pointsType);
SimpleFeatureType points = dataStore
- .getSchema(RepositoryTestCase.pointsName);
+ .getSchema(GeoGITRepositoryTestCase.pointsName);
assertEquals(super.pointsType, points);
}
public void testGetFeatureSourceName() throws IOException {
try {
- dataStore.getFeatureSource(RepositoryTestCase.linesTypeName);
+ dataStore.getFeatureSource(GeoGITRepositoryTestCase.linesTypeName);
fail("Expected SchemaNotFoundException");
} catch (SchemaNotFoundException e) {
assertTrue(true);
@@ -198,24 +202,24 @@
SimpleFeatureSource source;
dataStore.createSchema(super.linesType);
- source = dataStore.getFeatureSource(RepositoryTestCase.linesTypeName);
+ source = dataStore.getFeatureSource(GeoGITRepositoryTestCase.linesTypeName);
assertTrue(source instanceof GeoGitFeatureSource);
try {
- dataStore.getFeatureSource(RepositoryTestCase.pointsTypeName);
+ dataStore.getFeatureSource(GeoGITRepositoryTestCase.pointsTypeName);
fail("Expected SchemaNotFoundException");
} catch (SchemaNotFoundException e) {
assertTrue(true);
}
dataStore.createSchema(super.pointsType);
- source = dataStore.getFeatureSource(RepositoryTestCase.pointsTypeName);
+ source = dataStore.getFeatureSource(GeoGITRepositoryTestCase.pointsTypeName);
assertTrue(source instanceof GeoGitFeatureSource);
}
public void testGetFeatureSourceString() throws IOException {
try {
- dataStore.getFeatureSource(RepositoryTestCase.linesName);
+ dataStore.getFeatureSource(GeoGITRepositoryTestCase.linesName);
fail("Expected SchemaNotFoundException");
} catch (SchemaNotFoundException e) {
assertTrue(true);
@@ -224,18 +228,18 @@
SimpleFeatureSource source;
dataStore.createSchema(super.linesType);
- source = dataStore.getFeatureSource(RepositoryTestCase.linesName);
+ source = dataStore.getFeatureSource(GeoGITRepositoryTestCase.linesName);
assertTrue(source instanceof GeoGitFeatureSource);
try {
- dataStore.getFeatureSource(RepositoryTestCase.pointsName);
+ dataStore.getFeatureSource(GeoGITRepositoryTestCase.pointsName);
fail("Expected SchemaNotFoundException");
} catch (SchemaNotFoundException e) {
assertTrue(true);
}
dataStore.createSchema(super.pointsType);
- source = dataStore.getFeatureSource(RepositoryTestCase.pointsName);
+ source = dataStore.getFeatureSource(GeoGITRepositoryTestCase.pointsName);
assertTrue(source instanceof GeoGitFeatureSource);
}
Modified: trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitFeatureSourceTest.java
===================================================================
--- trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitFeatureSourceTest.java 2011-12-08 19:57:35 UTC (rev 38412)
+++ trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitFeatureSourceTest.java 2011-12-08 22:39:09 UTC (rev 38413)
@@ -29,7 +29,6 @@
import org.geogit.api.GeoGIT;
import org.geogit.api.Ref;
import org.geogit.api.RevTree;
-import org.geogit.test.RepositoryTestCase;
import org.geotools.data.Query;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
@@ -50,7 +49,7 @@
import com.vividsolutions.jts.geom.Polygon;
-public class GeoGitFeatureSourceTest extends RepositoryTestCase {
+public class GeoGitFeatureSourceTest extends GeoGITRepositoryTestCase {
private static final FilterFactory2 ff = CommonFactoryFinder
.getFilterFactory2(null);
@@ -62,7 +61,7 @@
private GeoGitFeatureSource linesSource;
@Override
- protected void setUpInternal() throws Exception {
+ protected void setUpChild() throws Exception {
dataStore = new GeoGitDataStore(repo);
dataStore.createSchema(super.pointsType);
dataStore.createSchema(super.linesType);
@@ -73,6 +72,13 @@
pointsSource = dataStore.getFeatureSource(pointsTypeName);
linesSource = dataStore.getFeatureSource(linesTypeName);
}
+
+ @Override
+ protected void tearDownChild() throws Exception {
+ dataStore = null;
+ pointsSource = null;
+ linesSource = null;
+ }
public void testGetName() {
assertEquals(pointsTypeName, pointsSource.getName());
@@ -139,7 +145,7 @@
Filter filter;
filter = ff.id(Collections.singleton(ff
- .featureId(RepositoryTestCase.idP2)));
+ .featureId(GeoGITRepositoryTestCase.idP2)));
bounds = pointsSource.getBounds(new Query(pointsName, filter));
assertEquals(boundsOf(points2), bounds);
@@ -180,7 +186,7 @@
Filter filter;
filter = ff.id(Collections.singleton(ff
- .featureId(RepositoryTestCase.idP2)));
+ .featureId(GeoGITRepositoryTestCase.idP2)));
assertEquals(1, pointsSource.getCount(new Query(pointsName, filter)));
ReferencedEnvelope queryBounds = boundsOf(points1, points2);
@@ -255,7 +261,7 @@
Filter filter;
filter = ff.id(Collections.singleton(ff
- .featureId(RepositoryTestCase.idP2)));
+ .featureId(GeoGITRepositoryTestCase.idP2)));
collection = pointsSource.getFeatures(new Query(pointsName, filter));
actual = new HashSet<Collection<Property>>();
for (Feature f : toList(collection.iterator())) {
Modified: trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitFeatureStoreTest.java
===================================================================
--- trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitFeatureStoreTest.java 2011-12-08 19:57:35 UTC (rev 38412)
+++ trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/geogit/GeoGitFeatureStoreTest.java 2011-12-08 22:39:09 UTC (rev 38413)
@@ -23,7 +23,6 @@
import java.util.Set;
import org.geogit.api.GeoGIT;
-import org.geogit.test.RepositoryTestCase;
import org.geotools.data.DataUtilities;
import org.geotools.data.DefaultTransaction;
import org.geotools.data.Transaction;
@@ -38,7 +37,7 @@
import org.opengis.filter.identity.FeatureId;
import org.opengis.filter.identity.ResourceId;
-public class GeoGitFeatureStoreTest extends RepositoryTestCase {
+public class GeoGitFeatureStoreTest extends GeoGITRepositoryTestCase {
private static final FilterFactory2 ff = CommonFactoryFinder
.getFilterFactory2(null);
@@ -50,7 +49,7 @@
private GeoGitFeatureStore lines;
@Override
- protected void setUpInternal() throws Exception {
+ protected void setUpChild() throws Exception {
dataStore = new GeoGitDataStore(repo);
dataStore.createSchema(super.pointsType);
dataStore.createSchema(super.linesType);
@@ -59,6 +58,13 @@
.getFeatureSource(pointsTypeName);
lines = (GeoGitFeatureStore) dataStore.getFeatureSource(linesTypeName);
}
+
+ @Override
+ protected void tearDownChild() throws Exception {
+ dataStore = null;
+ points = null;
+ lines = null;
+ }
public void testAddFeatures() throws Exception {
Modified: trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/versioning/VersioningTestSupport.java
===================================================================
--- trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/versioning/VersioningTestSupport.java 2011-12-08 19:57:35 UTC (rev 38412)
+++ trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/versioning/VersioningTestSupport.java 2011-12-08 22:39:09 UTC (rev 38413)
@@ -16,7 +16,7 @@
*/
package org.geoserver.data.versioning;
-import org.geogit.test.RepositoryTestCase;
+import org.geoserver.data.geogit.GeoGITRepositoryTestCase;
import org.geoserver.data.versioning.decorator.DataStoreDecorator;
import org.geotools.data.DataStore;
import org.geotools.data.simple.SimpleFeatureStore;
@@ -24,12 +24,12 @@
/**
* Base class for versioning tests.
* <p>
- * {@link #setUpInternal()} leaves {@link #unversionedStore} with two features,
- * {@link RepositoryTestCase#lines1} and {@link RepositoryTestCase#lines2}
+ * {@link #setUpChild()} leaves {@link #unversionedStore} with two features,
+ * {@link GeoGITRepositoryTestCase#lines1} and {@link GeoGITRepositoryTestCase#lines2}
*
* @author groldan
*/
-public abstract class VersioningTestSupport extends RepositoryTestCase {
+public abstract class VersioningTestSupport extends GeoGITRepositoryTestCase {
protected DataStore unversionedStore;
@@ -39,7 +39,7 @@
@SuppressWarnings({ "rawtypes" })
@Override
- protected void setUpInternal() throws Exception {
+ protected void setUpChild() throws Exception {
unversionedStore = new SimpleMemoryDataAccess();
versioningStore = new DataStoreDecorator(unversionedStore, super.repo);
Modified: trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/versioning/decorator/DecoratedTestCase.java
===================================================================
--- trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/versioning/decorator/DecoratedTestCase.java 2011-12-08 19:57:35 UTC (rev 38412)
+++ trunk/modules/unsupported/geogit-versioned/src/test/java/org/geoserver/data/versioning/decorator/DecoratedTestCase.java 2011-12-08 22:39:09 UTC (rev 38413)
@@ -25,7 +25,7 @@
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.io.FileUtils;
-import org.geogit.test.RepositoryTestCase;
+import org.geoserver.data.RepositoryTestCase;
import org.geotools.data.DataStore;
import org.geotools.data.DataUtilities;
import org.geotools.data.DefaultTransaction;
@@ -119,7 +119,10 @@
* Holds a reference to the unversioned datastore.
*/
protected DataStore unversioned;
+
+ private boolean setupInternal = false;
+
/**
* Holds a reference to the decorated datastore that will track versioning
* info in the backing geogit repository.
@@ -130,93 +133,7 @@
protected static final Logger LOGGER = Logging
.getLogger(DecoratedTestCase.class);
-
- @Override
- protected void setUpInternal() throws Exception {
- PropertyDataStoreFactory fact = new PropertyDataStoreFactory();
-
- File target = new File("target");
- File directory = new File(target, "properties");
- FileUtils.deleteDirectory(directory);
-
- Map params = new HashedMap();
- params.put(PropertyDataStoreFactory.DIRECTORY.key, directory.getPath());
- params.put(PropertyDataStoreFactory.NAMESPACE.key, sampleNs);
-
- unversioned = fact.createNewDataStore(params);
-
- versioned = new DataStoreDecorator(unversioned, repo);
-
- sampleType = DataUtilities.createType(sampleNs, sampleName,
- sampleTypeSpec);
-
- sample1 = (SimpleFeature) feature(sampleType, idS1, "Sample String 1",
- new Integer(1), "POINT (0 1)", new Double(2.34));
- sample1.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
- sample2 = (SimpleFeature) feature(sampleType, idS2, "Sample String 2",
- new Integer(4), "POINT (1 0)", new Double(3380));
- sample2.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
- sample3 = (SimpleFeature) feature(sampleType, idS3, "Sample String 3",
- new Integer(81), "POINT (2 2)", new Double(78.2));
- sample3.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
- LOGGER.info(sample1.toString());
- LOGGER.info(sample2.toString());
- LOGGER.info(sample3.toString());
-
- testType = DataUtilities.createType(sampleNs, testName, testTypeSpec);
-
- test1 = (SimpleFeature) feature(testType, idT1, "Test String A",
- "LINESTRING(1 0,0 0,0 1)", new Integer(5));
- test1.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
- test2 = (SimpleFeature) feature(testType, idT2, "Test String B",
- "LINESTRING(2 6,2 8,3 18)", new Integer(-2));
- test2.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
- test3 = (SimpleFeature) feature(testType, idT3, "Test String C",
- "LINESTRING(1 0,0 1,-1 0,0 -1,1 0)", new Integer(37));
- test3.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
- LOGGER.info(test1.toString());
- LOGGER.info(test2.toString());
- LOGGER.info(test3.toString());
-
- versioned.createSchema(sampleType);
- SimpleFeatureStore store = (SimpleFeatureStore) versioned
- .getFeatureSource(sampleName);
- Transaction tranny = new DefaultTransaction(
- "DecoratedTestCase.setupInternal()");
- store.setTransaction(tranny);
-
- DefaultFeatureCollection collection = new DefaultFeatureCollection(
- sampleName, sampleType);
- collection.add(sample1);
- collection.add(sample2);
- collection.add(sample3);
- List<FeatureId> ids = store.addFeatures(collection);
- assertEquals(3, ids.size());
- sampleFid1 = ids.get(0);
- sampleFid2 = ids.get(1);
- sampleFid3 = ids.get(2);
-
- tranny.commit();
- tranny.close();
-
- versioned.createSchema(testType);
- SimpleFeatureStore store2 = (SimpleFeatureStore) versioned
- .getFeatureSource(testName);
- Transaction tranny2 = new DefaultTransaction(
- "DecoratedTestCase.setupInternal().2");
- store2.setTransaction(tranny2);
-
- DefaultFeatureCollection collection2 = new DefaultFeatureCollection(
- testName, testType);
- collection2.add(test1);
- collection2.add(test2);
- collection2.add(test3);
- store2.addFeatures(collection2);
-
- tranny2.commit();
- tranny2.close();
- }
-
+
protected void updateSampleFeatures() throws Exception {
Transaction trans = null;
assertNull(sample1b);
@@ -235,13 +152,12 @@
newString2, newInt }, filter);
trans.commit();
- SimpleFeatureBuilder fb = new SimpleFeatureBuilder(sampleType);
- sample1b = fb.copy(sample1);
+ sample1b = SimpleFeatureBuilder.copy(sample1);
sample1b.setAttribute("st", newString1);
- sample2b = fb.copy(sample2);
+ sample2b = SimpleFeatureBuilder.copy(sample2);
sample2b.setAttribute("st", newString2);
sample2b.setAttribute("it", newInt);
- sample3b = fb.copy(sample3);
+ sample3b = SimpleFeatureBuilder.copy(sample3);
sample3b.setAttribute("st", newString2);
sample3b.setAttribute("it", newInt);
@@ -273,13 +189,12 @@
newString2, newInt }, filter);
trans.commit();
- SimpleFeatureBuilder fb = new SimpleFeatureBuilder(testType);
- test1b = fb.copy(test1);
+ test1b = SimpleFeatureBuilder.copy(test1);
test1b.setAttribute("st", newString1);
- test2b = fb.copy(test2);
+ test2b = SimpleFeatureBuilder.copy(test2);
test2b.setAttribute("st", newString2);
test2b.setAttribute("it", newInt);
- test3b = fb.copy(test3);
+ test3b = SimpleFeatureBuilder.copy(test3);
test3b.setAttribute("st", newString2);
test3b.setAttribute("it", newInt);
} catch (Exception ex) {
@@ -306,8 +221,7 @@
store.modifyFeatures("st", newString3, filter);
trans.commit();
- SimpleFeatureBuilder fb = new SimpleFeatureBuilder(testType);
- test2c = fb.copy(test2b);
+ test2c = SimpleFeatureBuilder.copy(test2b);
test2c.setAttribute("st", newString3);
} catch (Exception ex) {
if (trans != null)
@@ -440,4 +354,118 @@
}
return true;
}
+
+ @Override
+ public void setUpInternal() throws Exception {
+ if (setupInternal) {
+ throw new IllegalStateException("Are you calling super.setUpInternal()!?");
+ }
+ setupInternal = true;
+
+ PropertyDataStoreFactory fact = new PropertyDataStoreFactory();
+
+ File target = new File("target");
+ File directory = new File(target, "properties");
+ FileUtils.deleteDirectory(directory);
+
+ Map params = new HashedMap();
+ params.put(PropertyDataStoreFactory.DIRECTORY.key, directory.getPath());
+ params.put(PropertyDataStoreFactory.NAMESPACE.key, sampleNs);
+
+ unversioned = fact.createNewDataStore(params);
+
+ versioned = new DataStoreDecorator(unversioned, repo);
+
+ sampleType = DataUtilities.createType(sampleNs, sampleName,
+ sampleTypeSpec);
+
+ sample1 = (SimpleFeature) feature(sampleType, idS1, "Sample String 1",
+ new Integer(1), "POINT (0 1)", new Double(2.34));
+ sample1.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
+ sample2 = (SimpleFeature) feature(sampleType, idS2, "Sample String 2",
+ new Integer(4), "POINT (1 0)", new Double(3380));
+ sample2.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
+ sample3 = (SimpleFeature) feature(sampleType, idS3, "Sample String 3",
+ new Integer(81), "POINT (2 2)", new Double(78.2));
+ sample3.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
+ LOGGER.info(sample1.toString());
+ LOGGER.info(sample2.toString());
+ LOGGER.info(sample3.toString());
+
+ testType = DataUtilities.createType(sampleNs, testName, testTypeSpec);
+
+ test1 = (SimpleFeature) feature(testType, idT1, "Test String A",
+ "LINESTRING(1 0,0 0,0 1)", new Integer(5));
+ test1.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
+ test2 = (SimpleFeature) feature(testType, idT2, "Test String B",
+ "LINESTRING(2 6,2 8,3 18)", new Integer(-2));
+ test2.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
+ test3 = (SimpleFeature) feature(testType, idT3, "Test String C",
+ "LINESTRING(1 0,0 1,-1 0,0 -1,1 0)", new Integer(37));
+ test3.getUserData().put(Hints.USE_PROVIDED_FID, Boolean.TRUE);
+ LOGGER.info(test1.toString());
+ LOGGER.info(test2.toString());
+ LOGGER.info(test3.toString());
+
+ versioned.createSchema(sampleType);
+ SimpleFeatureStore store = (SimpleFeatureStore) versioned
+ .getFeatureSource(sampleName);
+ Transaction tranny = new DefaultTransaction(
+ "DecoratedTestCase.setupInternal()");
+ store.setTransaction(tranny);
+
+ DefaultFeatureCollection collection = new DefaultFeatureCollection(
+ sampleName, sampleType);
+ collection.add(sample1);
+ collection.add(sample2);
+ collection.add(sample3);
+ List<FeatureId> ids = store.addFeatures(collection);
+ assertEquals(3, ids.size());
+ sampleFid1 = ids.get(0);
+ sampleFid2 = ids.get(1);
+ sampleFid3 = ids.get(2);
+
+ tranny.commit();
+ tranny.close();
+
+ versioned.createSchema(testType);
+ SimpleFeatureStore store2 = (SimpleFeatureStore) versioned
+ .getFeatureSource(testName);
+ Transaction tranny2 = new DefaultTransaction(
+ "DecoratedTestCase.setupInternal().2");
+ store2.setTransaction(tranny2);
+
+ DefaultFeatureCollection collection2 = new DefaultFeatureCollection(
+ testName, testType);
+ collection2.add(test1);
+ collection2.add(test2);
+ collection2.add(test3);
+ store2.addFeatures(collection2);
+
+ tranny2.commit();
+ tranny2.close();
+
+ setUpChild();
+ }
+
+ @Override
+ public void tearDownInternal() throws Exception {
+ if (!setupInternal) {
+ throw new IllegalStateException("Are you calling super.tearDownInternal()!?");
+ }
+ setupInternal = false;
+ tearDownChild();
+ unversioned = null;
+ versioned = null;
+ repositoryDatabase = null;
+ }
+
+ protected void setUpChild() throws Exception {
+
+ }
+
+ protected void tearDownChild() throws Exception {
+
+ }
+
}
Modified: trunk/modules/unsupported/pom.xml
===================================================================
--- trunk/modules/unsupported/pom.xml 2011-12-08 19:57:35 UTC (rev 38412)
+++ trunk/modules/unsupported/pom.xml 2011-12-08 22:39:09 UTC (rev 38413)
@@ -177,6 +177,9 @@
</profile>
<profile>
<id>geogit-versioned</id>
+ <activation>
+ <property><name>all</name></property>
+ </activation>
<modules>
<module>geogit-versioned</module>
</modules>
|
Author: mpazos Date: 2011-12-08 11:57:35 -0800 (Thu, 08 Dec 2011) New Revision: 38412 Added: trunk/spike/mauro/ogr/ trunk/spike/mauro/ogr/.classpath trunk/spike/mauro/ogr/.project trunk/spike/mauro/ogr/.settings/ trunk/spike/mauro/ogr/.settings/org.eclipse.jdt.core.prefs trunk/spike/mauro/ogr/jnaerate.sh trunk/spike/mauro/ogr/old_ogr_code/ trunk/spike/mauro/ogr/pom.xml trunk/spike/mauro/ogr/src/ trunk/spike/mauro/ogr/src/main/ trunk/spike/mauro/ogr/src/main/java/ trunk/spike/mauro/ogr/src/main/java/org/ trunk/spike/mauro/ogr/src/main/java/org/geotools/ trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/ trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FeatureMapper.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FeatureTypeMapper.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FilterToRestrictedWhere.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/GdalInit.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/GeometryMapper.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/OGRDataStore.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/OGRDataStoreFactory.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/OGRDirectFeatureWriter.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/OGRFeatureReader.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/OGRFeatureSource.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/OGRFeatureStore.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/OGRFilterTranslator.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/OGRUtils.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/bridj/ trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/bridj/BridjUtilities.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/bridj/CplErrorLibrary.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/bridj/OGREnvelope.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/bridj/OGRField.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/bridj/OgrLibrary.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/bridj/OsrLibrary.java trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/bridj/__locale_struct.java trunk/spike/mauro/ogr/src/main/resources/ trunk/spike/mauro/ogr/src/main/resources/META-INF/ trunk/spike/mauro/ogr/src/main/resources/META-INF/services/ trunk/spike/mauro/ogr/src/main/resources/META-INF/services/org.geotools.data.DataStoreFactorySpi trunk/spike/mauro/ogr/src/site/ trunk/spike/mauro/ogr/src/site/apt/ trunk/spike/mauro/ogr/src/site/apt/review.apt trunk/spike/mauro/ogr/src/test/ trunk/spike/mauro/ogr/src/test/java/ trunk/spike/mauro/ogr/src/test/java/org/ trunk/spike/mauro/ogr/src/test/java/org/geotools/ trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ogr/ trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ogr/DumpShapefile.java trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ogr/GeometryMapperTest.java trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ogr/OGRDataStoreFactoryTest.java trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ogr/OGRDataStoreTest.java trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ogr/OGRDataStoreWriter.java trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ogr/OGRPeformanceTest.java trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ogr/TabFileReader.java trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ogr/TabFileWriter.java trunk/spike/mauro/ogr/src/test/java/org/geotools/data/ogr/TestCaseSupport.java trunk/spike/mauro/ogr/src/test/resources/ trunk/spike/mauro/ogr/src/test/resources/org/ trunk/spike/mauro/ogr/src/test/resources/org/geotools/ trunk/spike/mauro/ogr/src/test/resources/org/geotools/data/ trunk/spike/mauro/ogr/src/test/resources/org/geotools/data/ogr/ trunk/spike/mauro/ogr/src/test/resources/org/geotools/data/ogr/test-data/ trunk/spike/mauro/ogr/src/test/resources/org/geotools/data/ogr/test-data/keepme.txt Log: ogr spike Added: trunk/spike/mauro/ogr/.classpath =================================================================== --- trunk/spike/mauro/ogr/.classpath (rev 0) +++ trunk/spike/mauro/ogr/.classpath 2011-12-08 19:57:35 UTC (rev 38412) @@ -0,0 +1,31 @@ +<classpath> + <classpathentry kind="src" path="src/main/java"/> + <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/> + <classpathentry kind="src" path="src/test/java" output="target/test-classes"/> + <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/> + <classpathentry kind="output" path="target/classes"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="var" path="M2_REPO/com/nativelibs4java/bridj/0.6/bridj-0.6-c-only.jar"/> + <classpathentry kind="var" path="M2_REPO/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar" sourcepath="M2_REPO/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/org/geotools/gt-api/8-SNAPSHOT/gt-api-8-SNAPSHOT.jar" sourcepath="M2_REPO/org/geotools/gt-api/8-SNAPSHOT/gt-api-8-SNAPSHOT-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/org/geotools/gt-data/8-SNAPSHOT/gt-data-8-SNAPSHOT.jar" sourcepath="M2_REPO/org/geotools/gt-data/8-SNAPSHOT/gt-data-8-SNAPSHOT-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/org/geotools/gt-epsg-hsql/8-SNAPSHOT/gt-epsg-hsql-8-SNAPSHOT.jar" sourcepath="M2_REPO/org/geotools/gt-epsg-hsql/8-SNAPSHOT/gt-epsg-hsql-8-SNAPSHOT-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/org/geotools/gt-main/8-SNAPSHOT/gt-main-8-SNAPSHOT.jar" sourcepath="M2_REPO/org/geotools/gt-main/8-SNAPSHOT/gt-main-8-SNAPSHOT-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/org/geotools/gt-metadata/8-SNAPSHOT/gt-metadata-8-SNAPSHOT.jar" sourcepath="M2_REPO/org/geotools/gt-metadata/8-SNAPSHOT/gt-metadata-8-SNAPSHOT-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/org/geotools/gt-opengis/8-SNAPSHOT/gt-opengis-8-SNAPSHOT.jar" sourcepath="M2_REPO/org/geotools/gt-opengis/8-SNAPSHOT/gt-opengis-8-SNAPSHOT-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/org/geotools/gt-referencing/8-SNAPSHOT/gt-referencing-8-SNAPSHOT.jar" sourcepath="M2_REPO/org/geotools/gt-referencing/8-SNAPSHOT/gt-referencing-8-SNAPSHOT-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/org/geotools/gt-sample-data/8-SNAPSHOT/gt-sample-data-8-SNAPSHOT.jar" sourcepath="M2_REPO/org/geotools/gt-sample-data/8-SNAPSHOT/gt-sample-data-8-SNAPSHOT-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/org/geotools/gt-shapefile/8-SNAPSHOT/gt-shapefile-8-SNAPSHOT.jar" sourcepath="M2_REPO/org/geotools/gt-shapefile/8-SNAPSHOT/gt-shapefile-8-SNAPSHOT-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar"/> + <classpathentry kind="var" path="M2_REPO/javax/media/jai_core/1.1.3/jai_core-1.1.3.jar"/> + <classpathentry kind="var" path="M2_REPO/jdom/jdom/1.0/jdom-1.0.jar" sourcepath="M2_REPO/jdom/jdom/1.0/jdom-1.0-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/net/java/dev/jsr-275/jsr-275/1.0-beta-2/jsr-275-1.0-beta-2.jar" sourcepath="M2_REPO/net/java/dev/jsr-275/jsr-275/1.0-beta-2/jsr-275-1.0-beta-2-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/com/vividsolutions/jts/1.12/jts-1.12.jar" sourcepath="M2_REPO/com/vividsolutions/jts/1.12/jts-1.12-sources.jar"/> + <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"> + <attributes> + <attribute value="jar:file:/home/mauro/.m2/repository/junit/junit/4.4/junit-4.4-javadoc.jar!/" name="javadoc_location"/> + </attributes> + </classpathentry> + <classpathentry kind="var" path="M2_REPO/java3d/vecmath/1.3.2/vecmath-1.3.2.jar"/> + <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.7.1/xercesImpl-2.7.1.jar"/> +</classpath> \ No newline at end of file Property changes on: trunk/spike/mauro/ogr/.classpath ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Id Added: svn:eol-style + native Added: trunk/spike/mauro/ogr/.project =================================================================== --- trunk/spike/mauro/ogr/.project (rev 0) +++ trunk/spike/mauro/ogr/.project 2011-12-08 19:57:35 UTC (rev 38412) @@ -0,0 +1,13 @@ +<projectDescription> + <name>gt-ogr</name> + <comment>A datastore levearing OGR for reading/writing a slew of data formats</comment> + <projects/> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> \ No newline at end of file Property changes on: trunk/spike/mauro/ogr/.project ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Id Added: svn:eol-style + native Added: trunk/spike/mauro/ogr/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/spike/mauro/ogr/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ trunk/spike/mauro/ogr/.settings/org.eclipse.jdt.core.prefs 2011-12-08 19:57:35 UTC (rev 38412) @@ -0,0 +1,5 @@ +#Mon Nov 28 12:30:30 CET 2011 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 Added: trunk/spike/mauro/ogr/jnaerate.sh =================================================================== --- trunk/spike/mauro/ogr/jnaerate.sh (rev 0) +++ trunk/spike/mauro/ogr/jnaerate.sh 2011-12-08 19:57:35 UTC (rev 38412) @@ -0,0 +1,3 @@ +export JNAERATOR=/home/aaime/devel/gdal/jnaerator-0.9.9-SNAPSHOT-shaded.jar +export GDAL_BASE=/home/aaime/devel/gdal/gdal-1.8.0 +java -jar $JNAERATOR -I. -I$GDAL_BASE/gcore -I$GDAL_BASEport -I$GDAL_BASEogr -package org.geotools.data.ogr.bridj -library osr $GDAL_BASE/ogr/ogr_srs_api.h -library ogr $GDAL_BASE/ogr/ogr_core.h $GDAL_BASE/ogr/ogr_api.h -library cplError $GDAL_BASE/port/cpl_error.h -o src/main/java -v -runtime BridJ -reification -nocpp -DCPL_DLL= -DCPL_STDCALL= -DCPL_C_START= -DCPL_C_END= -noComp -parseInOneChunk Property changes on: trunk/spike/mauro/ogr/jnaerate.sh ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Id Added: svn:eol-style + native Added: trunk/spike/mauro/ogr/pom.xml =================================================================== --- trunk/spike/mauro/ogr/pom.xml (rev 0) +++ trunk/spike/mauro/ogr/pom.xml 2011-12-08 19:57:35 UTC (rev 38412) @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- ======================================================================= + Maven Project Configuration File + + The Geotools Project + http://www.geotools.org/ + + Version: $Id$ + ======================================================================= --> + <project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.geotools</groupId> + <artifactId>geotools</artifactId> + <version>8-SNAPSHOT</version> + </parent> + + <!-- =========================================================== --> + <!-- Module Description --> + <!-- =========================================================== --> + <groupId>org.geotools</groupId> + <artifactId>gt-ogr</artifactId> + <packaging>jar</packaging> + <name>OGR datastore module (Spike)</name> + + + + <scm> + <connection> + scm:svn:http://svn.geotools.org/trunk/modules/unsupported/ogr/ + </connection> + <url>http://svn.geotools.org/trunk/modules/unsupported/ogr/</url> + </scm> + + <description> + A datastore levearing OGR for reading/writing a slew of data formats + </description> + + <licenses> + <license> + <name>Lesser General Public License (LGPL)</name> + <url>http://www.gnu.org/copyleft/lesser.txt</url> + <distribution>repo</distribution> + </license> + </licenses> + + <repositories> + <repository> + <id>nativelibs4java-repo</id> + <name>NativeLibs4Java Maven Repository</name> + <url>http://nativelibs4java.sourceforge.net/maven</url> + </repository> + </repositories> + + + <!-- =========================================================== --> + <!-- Developers and Contributors --> + <!-- =========================================================== --> + <developers> + <developer> + <name>Andrea Aime</name> + <id>aaime</id> + <email>aa...@us...</email> + <organization>University of Modena and Reggio Emilia</organization> + <roles> + <role>Module Maintainer</role> + <role>Java Developer</role> + </roles> + </developer> + </developers> + + + <!-- =========================================================== --> + <!-- Dependency Management --> + <!-- =========================================================== --> + <dependencies> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-data</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.nativelibs4java</groupId> + <artifactId>bridj</artifactId> + <classifier>c-only</classifier> + <version>0.6</version> + + <exclusions> + <exclusion> + <groupId>com.nativelibs4java.thirdparty.com.google.android</groupId> + <artifactId>dx</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- Test dependencies --> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-sample-data</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-epsg-hsql</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-shapefile</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <systemProperties> + <property> + <name>java.library.path</name> + <value>${java.library.path}</value> + </property> + </systemProperties> + </configuration> + </plugin> + </plugins> + </build> + +</project> Property changes on: trunk/spike/mauro/ogr/pom.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Id Added: svn:eol-style + native Added: trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FeatureMapper.java =================================================================== --- trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FeatureMapper.java (rev 0) +++ trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FeatureMapper.java 2011-12-08 19:57:35 UTC (rev 38412) @@ -0,0 +1,373 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2007-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.ogr; + +import static org.bridj.Pointer.*; +import static org.geotools.data.ogr.bridj.OgrLibrary.*; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.text.DateFormat; +import java.text.DecimalFormatSymbols; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.TimeZone; + +import org.bridj.Pointer; +import org.geotools.data.DataSourceException; +import org.geotools.data.ogr.bridj.OgrLibrary.OGRFieldType; +import org.geotools.feature.simple.SimpleFeatureBuilder; +import org.geotools.util.Converters; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.feature.type.AttributeDescriptor; +import org.opengis.feature.type.GeometryDescriptor; + +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.MultiLineString; +import com.vividsolutions.jts.geom.MultiPolygon; +import com.vividsolutions.jts.geom.Polygon; + +/** + * Maps OGR features into Geotools ones, and vice versa. Chances are that if you need to update a + * decode method a simmetric modification will be needed in the encode method. This class is not + * thread safe, so each thread should create its own instance. + * + * @author Andrea Aime - OpenGeo + * + */ +class FeatureMapper { + + SimpleFeatureBuilder builder; + + SimpleFeatureType schema; + + GeometryMapper geomMapper; + + GeometryFactory geomFactory; + + /** + * The date time format used by OGR when getting/setting times using strings + */ + DateFormat dateTimeFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss"); + + DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); + + DateFormat timeFormat = new SimpleDateFormat("hh:mm:ss"); + + HashMap<String, Integer> attributeIndexes; + + /** + * TODO: this is subscepitble to changes to the Locale in Java that might not affect + * the C code... we should probably figure out a way to get the OS level locale? + */ + static final DecimalFormatSymbols DECIMAL_SYMBOLS = new DecimalFormatSymbols(); + + public FeatureMapper(SimpleFeatureType targetSchema, Pointer layer, GeometryFactory geomFactory) { + this.schema = targetSchema; + this.builder = new SimpleFeatureBuilder(schema); + this.geomMapper = new GeometryMapper.WKB(geomFactory); + this.geomFactory = geomFactory; + + attributeIndexes = new HashMap<String, Integer>(); + Pointer layerDefinition = OGR_L_GetLayerDefn(layer); + int size = OGR_FD_GetFieldCount(layerDefinition); + for(int i = 0; i < size; i++) { + Pointer field = OGR_FD_GetFieldDefn(layerDefinition, i); + Pointer<Byte> namePtr = OGR_Fld_GetNameRef(field); + String name = namePtr.getCString(); + if(targetSchema.getDescriptor(name) != null) { + attributeIndexes.put(name, i); + } + } + } + + /** + * Converts an OGR feature into a GeoTools one + * + * @param schema + * @param ogrFeature + * @return + * @throws IOException + */ + SimpleFeature convertOgrFeature(Pointer<?> ogrFeature) + throws IOException { + // Extract all attributes (do not assume any specific order, the feature + // type may have been re-ordered by the Query) + Object[] attributes = new Object[schema.getAttributeCount()]; + + // .. then extract each attribute using the attribute type to determine + // which extraction method to call + for (int i = 0; i < attributes.length; i++) { + AttributeDescriptor at = schema.getDescriptor(i); + builder.add(getOgrField(at, ogrFeature)); + } + + // .. gather the FID + String fid = convertOGRFID(schema, ogrFeature); + + // .. finally create the feature + return builder.buildFeature(fid); + } + + /** + * Turns a GeoTools feature into an OGR one + * + * @param feature + * @return + * @throws DataSourceException + */ + Pointer convertGTFeature(Pointer featureDefinition, SimpleFeature feature) + throws IOException { + // create a new empty OGR feature + Pointer ogrFeature = OGR_F_Create(featureDefinition); + + // go thru GeoTools feature attributes, and convert + SimpleFeatureType schema = feature.getFeatureType(); + for (int i = 0, j = 0; i < schema.getAttributeCount(); i++) { + Object attribute = feature.getAttribute(i); + if (attribute instanceof Geometry) { + // using setGeoemtryDirectly the feature becomes the owner of the generated + // OGR geometry and we don't have to .delete() it (it's faster, too) + Pointer geometry = geomMapper.parseGTGeometry((Geometry) attribute); + OGR_F_SetGeometryDirectly(ogrFeature, geometry); + } else { + setFieldValue(featureDefinition, ogrFeature, j, attribute); + j++; + } + } + + return ogrFeature; + } + + static void setFieldValue(Pointer featureDefinition, Pointer ogrFeature, int fieldIdx, + Object value) throws IOException { + if (value == null) { + OGR_F_UnsetField(ogrFeature, fieldIdx); + } else { + Pointer fieldDefinition = OGR_FD_GetFieldDefn(featureDefinition, fieldIdx); + long ogrType = OGR_Fld_GetType(fieldDefinition).value(); + if (ogrType == OGRFieldType.OFTInteger.value()) { + OGR_F_SetFieldInteger(ogrFeature, fieldIdx, ((Number) value).intValue()); + } else if (ogrType == OGRFieldType.OFTReal.value()) { + OGR_F_SetFieldDouble(ogrFeature, fieldIdx, ((Number) value).doubleValue()); + } else if (ogrType == OGRFieldType.OFTBinary.value()) { + byte[] attValue = (byte[]) value; + OGR_F_SetFieldBinary(ogrFeature, fieldIdx, attValue.length, pointerToBytes(attValue)); + } else if (ogrType == OGRFieldType.OFTDate.value()) { + Calendar cal = Calendar.getInstance(); + cal.setTime((Date) value); + int year = cal.get(Calendar.YEAR); + int month = cal.get(Calendar.MONTH); + int day = cal.get(Calendar.DAY_OF_MONTH); + OGR_F_SetFieldDateTime(ogrFeature, fieldIdx, year, month, day, 0, 0, 0, 0); + } else if (ogrType == OGRFieldType.OFTTime.value()) { + Calendar cal = Calendar.getInstance(); + cal.setTime((Date) value); + int hour = cal.get(Calendar.HOUR_OF_DAY); + int minute = cal.get(Calendar.MINUTE); + int second = cal.get(Calendar.SECOND); + OGR_F_SetFieldDateTime(ogrFeature, fieldIdx, 0, 0, 0, hour, minute, second, 0); + } else if (ogrType == OGRFieldType.OFTDateTime.value()) { + Calendar cal = Calendar.getInstance(); + cal.setTime((Date) value); + int year = cal.get(Calendar.YEAR); + int month = cal.get(Calendar.MONTH); + int day = cal.get(Calendar.DAY_OF_MONTH); + int hour = cal.get(Calendar.HOUR_OF_DAY); + int minute = cal.get(Calendar.MINUTE); + int second = cal.get(Calendar.SECOND); + OGR_F_SetFieldDateTime(ogrFeature, fieldIdx, year, month, day, hour, minute, second, 0); + } else { + // anything else we treat as a string + String str = Converters.convert(value, String.class); + OGR_F_SetFieldString(ogrFeature, fieldIdx, pointerToCString(str)); + } + } + } + + /** + * Turns line and polygon into multiline and multipolygon. This is a stop-gap measure to make + * things works against shapefiles, I've asked the GDAL mailing list on how to properly handle + * this in the meantime + * + * @param ogrGeometry + * @param ad + * @return + */ + Geometry fixGeometryType(Geometry ogrGeometry, AttributeDescriptor ad) { + if (MultiPolygon.class.equals(ad.getType())) { + if (ogrGeometry instanceof MultiPolygon) + return ogrGeometry; + else + return geomFactory.createMultiPolygon(new Polygon[] { (Polygon) ogrGeometry }); + } else if (MultiLineString.class.equals(ad.getType())) { + if (ogrGeometry instanceof MultiLineString) + return ogrGeometry; + else + return geomFactory + .createMultiLineString(new LineString[] { (LineString) ogrGeometry }); + } + return ogrGeometry; + + } + + + /** + * Reads the current feature's specified field using the most appropriate OGR field extraction + * method + * + * @param ad + * @return + */ + Object getOgrField(AttributeDescriptor ad, Pointer<?> ogrFeature) throws IOException { + if(ad instanceof GeometryDescriptor) { + // gets the geometry as a reference, we don't own it, we should not deallocate it + Pointer<?> ogrGeometry = OGR_F_GetGeometryRef(ogrFeature); + return fixGeometryType(geomMapper.parseOgrGeometry(ogrGeometry), ad); + } + + Integer idx = attributeIndexes.get(ad.getLocalName()); + + // check for null fields + if (idx == null || OGR_F_IsFieldSet(ogrFeature, idx) == 0) { + return null; + } + + // hum, ok try and parse it + Class clazz = ad.getType().getBinding(); + if (clazz.equals(String.class)) { + return OGR_F_GetFieldAsString(ogrFeature, idx).getCString(); + } else if (clazz.equals(Byte.class)) { + return (byte) OGR_F_GetFieldAsInteger(ogrFeature, idx); + } else if (clazz.equals(Short.class)) { + return (short) OGR_F_GetFieldAsInteger(ogrFeature, idx); + } else if (clazz.equals(Integer.class)) { + return OGR_F_GetFieldAsInteger(ogrFeature, idx); + } else if (clazz.equals(Long.class)) { + String value = OGR_F_GetFieldAsString(ogrFeature, idx).getCString(); + return new Long(value); + } else if (clazz.equals(BigInteger.class)) { + String value = OGR_F_GetFieldAsString(ogrFeature, idx).getCString(); + return new BigInteger(value); + } else if (clazz.equals(Double.class)) { + return OGR_F_GetFieldAsDouble(ogrFeature, idx); + } else if (clazz.equals(Float.class)) { + return (float) OGR_F_GetFieldAsDouble(ogrFeature, idx); + } else if (clazz.equals(BigDecimal.class)) { + String value = OGR_F_GetFieldAsString(ogrFeature, idx).getCString().trim(); + char separator = DECIMAL_SYMBOLS.getDecimalSeparator(); + if(separator != '.') { + value = value.replace(separator, '.'); + } + return new BigDecimal(value); + } else if (clazz.equals(java.sql.Date.class)) { + Calendar cal = getDateField(ogrFeature, idx); + cal.clear(Calendar.HOUR_OF_DAY); + cal.clear(Calendar.MINUTE); + cal.clear(Calendar.SECOND); + return new java.sql.Date(cal.getTimeInMillis()); + } else if (clazz.equals(java.sql.Time.class)) { + Calendar cal = getDateField(ogrFeature, idx); + cal.clear(Calendar.YEAR); + cal.clear(Calendar.MONTH); + cal.clear(Calendar.DAY_OF_MONTH); + return new java.sql.Time(cal.getTimeInMillis()); + } else if (clazz.equals(java.sql.Timestamp.class)) { + Calendar cal = getDateField(ogrFeature, idx); + return new java.sql.Time(cal.getTimeInMillis()); + } else if (clazz.equals(java.util.Date.class)) { + Calendar cal = getDateField(ogrFeature, idx); + return cal.getTime(); + } else { + throw new IllegalArgumentException("Don't know how to read " + clazz.getName() + + " fields"); + } + } + + /** + * Reads a date field from the OGR api + * @param ogrFeature + * @param idx + * @return + */ + private Calendar getDateField(Pointer<?> ogrFeature, Integer idx) { + Pointer<Integer> year = allocateInt(); + Pointer<Integer> month = allocateInt(); + Pointer<Integer> day = allocateInt(); + Pointer<Integer> hour = allocateInt(); + Pointer<Integer> minute = allocateInt(); + Pointer<Integer> second = allocateInt(); + Pointer<Integer> timeZone = allocateInt(); + + OGR_F_GetFieldAsDateTime(ogrFeature, idx, year, month, day, hour, minute, second, timeZone); + + Calendar cal = Calendar.getInstance(); + // from ogr_core.h + // 0=unknown, 1=localtime(ambiguous), 100=GMT, 104=GMT+1, 80=GMT-5, etc + int tz = timeZone.getInt(); + if(tz != 0 && tz != 1) { + int offset = tz - 100 / 4; + if(offset < 0) { + cal.setTimeZone(TimeZone.getTimeZone("GMT" + offset)); + } else if(offset == 0) { + cal.setTimeZone(TimeZone.getTimeZone("GMT")); + } else { + cal.setTimeZone(TimeZone.getTimeZone("GMT+" + offset)); + } + } + cal.clear(); + cal.set(Calendar.YEAR, year.getInt()); + cal.set(Calendar.MONTH, month.getInt()); + cal.set(Calendar.DAY_OF_MONTH, day.getInt()); + cal.set(Calendar.HOUR_OF_DAY, hour.getInt()); + cal.set(Calendar.MINUTE, minute.getInt()); + cal.set(Calendar.SECOND, second.getInt()); + return cal; + } + + /** + * Generates a GT2 feature id given its feature type and an OGR feature + * + * @param schema + * @param ogrFeature + * @return + */ + String convertOGRFID(SimpleFeatureType schema, Pointer<?> ogrFeature) { + long id = OGR_F_GetFID(ogrFeature); + return schema.getTypeName() + "." + id; + } + + /** + * Decodes a GT2 feature id into an OGR one + * + * @param feature + * @return + */ + long convertGTFID(SimpleFeature feature) { + String id = feature.getID(); + return Long.parseLong(id.substring(id.indexOf(".") + 1)); + } + +} Property changes on: trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FeatureMapper.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id Added: svn:eol-style + native Added: trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FeatureTypeMapper.java =================================================================== --- trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FeatureTypeMapper.java (rev 0) +++ trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FeatureTypeMapper.java 2011-12-08 19:57:35 UTC (rev 38412) @@ -0,0 +1,376 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2007-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.ogr; + +import static org.bridj.Pointer.*; +import static org.geotools.data.ogr.bridj.OgrLibrary.*; +import static org.geotools.data.ogr.bridj.OsrLibrary.*; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.BigInteger; + +import org.bridj.Pointer; +import org.bridj.ValuedEnum; +import org.geotools.data.ogr.bridj.OgrLibrary.OGRFieldType; +import org.geotools.data.ogr.bridj.OgrLibrary.OGRJustification; +import org.geotools.data.ogr.bridj.OgrLibrary.OGRwkbGeometryType; +import org.geotools.feature.FeatureTypes; +import org.geotools.feature.simple.SimpleFeatureTypeBuilder; +import org.geotools.feature.type.BasicFeatureTypes; +import org.geotools.referencing.CRS; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.feature.type.AttributeDescriptor; +import org.opengis.feature.type.GeometryDescriptor; +import org.opengis.referencing.crs.CoordinateReferenceSystem; + +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.GeometryCollection; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.LinearRing; +import com.vividsolutions.jts.geom.MultiLineString; +import com.vividsolutions.jts.geom.MultiPoint; +import com.vividsolutions.jts.geom.MultiPolygon; +import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jts.geom.Polygon; + +/** + * Helper mapping between geotools and OGR feature types + * + * @author Andrea Aime - GeoSolutions + */ +class FeatureTypeMapper { + + /** + * Returns the geotools feature type equivalent from the native OGR one + * + * @param layer + * @param typeName + * @param namespaceURI + * @return + * @throws IOException + */ + SimpleFeatureType getFeatureType(Pointer layer, String typeName, String namespaceURI) + throws IOException { + Pointer definition = null; + try { + // setup the builder + SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); + tb.setName(typeName); + tb.setNamespaceURI(namespaceURI); + if (tb.getNamespaceURI() == null) { + tb.setNamespaceURI(BasicFeatureTypes.DEFAULT_NAMESPACE); + } + + // grab the layer definition + definition = OGR_L_GetLayerDefn(layer); + + // figure out the geometry + Class<? extends Geometry> geometryBinding = getGeometryBinding(definition); + if (geometryBinding != null) { + CoordinateReferenceSystem crs = getCRS(layer); + tb.add("the_geom", geometryBinding, crs); + } + + // get the non geometric fields + final int count = OGR_FD_GetFieldCount(definition); + for (int i = 0; i < count; i++) { + Pointer field = OGR_FD_GetFieldDefn(definition, i); + String name = OGR_Fld_GetNameRef(field).getCString(); + Class binding = getBinding(field); + int width = OGR_Fld_GetWidth(field); + if (width > 0) { + tb.length(width); + } + tb.add(name, binding); + } + + // compute a default parent feature type + if ((geometryBinding == Point.class) || (geometryBinding == MultiPoint.class)) { + tb.setSuperType(BasicFeatureTypes.POINT); + } else if ((geometryBinding == Polygon.class) + || (geometryBinding == MultiPolygon.class)) { + tb.setSuperType(BasicFeatureTypes.POLYGON); + } else if ((geometryBinding == LineString.class) + || (geometryBinding == MultiLineString.class)) { + tb.setSuperType(BasicFeatureTypes.LINE); + } + + return tb.buildFeatureType(); + } finally { + OGRUtils.releaseDefinition(definition); + } + } + + /** + * Maps the OGR field type to a java class + * + * @param field + * @return + */ + private Class getBinding(Pointer field) { + ValuedEnum<OGRFieldType> type = OGR_Fld_GetType(field); + int width = OGR_Fld_GetWidth(field); + long value = type.value(); + if (value == OGRFieldType.OFTInteger.value()) { + if (width <= 3) { + return Byte.class; + } else if (width <= 5) { + return Short.class; + } else if (width <= 9) { + return Integer.class; + } else if (width <= 19) { + return Long.class; + } else { + return BigDecimal.class; + } + } else if (value == OGRFieldType.OFTIntegerList.value()) { + return int[].class; + } else if (value == OGRFieldType.OFTReal.value()) { + if (width <= 12) { + return Float.class; + } else if (width <= 22) { + return Double.class; + } else { + return BigDecimal.class; + } + } else if (value == OGRFieldType.OFTRealList.value()) { + return double[].class; + } else if (value == OGRFieldType.OFTBinary.value()) { + return byte[].class; + } else if (value == OGRFieldType.OFTDate.value()) { + return java.sql.Date.class; + } else if (value == OGRFieldType.OFTTime.value()) { + return java.sql.Time.class; + } else if (value == OGRFieldType.OFTDateTime.value()) { + return java.sql.Timestamp.class; + } else { + // whatever else we'll map a string + return String.class; + } + } + + /** + * Returns a OGR field definition compatible with the specified attribute descriptor where: + * <ul> + * <li>width is the number of chars needed to format the strings equivalent of the number + * <li> + * <li>precision is the number of chars after decimal pont</li> + * <li>justification: right or left (in outputs)</li> + * </ul> + * + * @param ad + * @throws IOException + */ + public Pointer getOGRFieldDefinition(AttributeDescriptor ad) throws IOException { + final Class type = ad.getType().getBinding(); + final Pointer def; + Pointer<Byte> namePtr = pointerToCString(ad.getLocalName()); + if (Boolean.class.equals(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTString); + OGR_Fld_SetWidth(def, 5); + } else if (Byte.class.equals(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTInteger); + OGR_Fld_SetWidth(def, 3); + OGR_Fld_SetJustify(def, OGRJustification.OJRight); + } else if (Short.class.equals(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTInteger); + OGR_Fld_SetWidth(def, 5); + OGR_Fld_SetJustify(def, OGRJustification.OJRight); + } else if (Integer.class.equals(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTInteger); + OGR_Fld_SetWidth(def, 9); + OGR_Fld_SetJustify(def, OGRJustification.OJRight); + } else if (Long.class.equals(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTInteger); + OGR_Fld_SetWidth(def, 19); + OGR_Fld_SetJustify(def, OGRJustification.OJRight); + } else if (BigInteger.class.equals(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTInteger); + OGR_Fld_SetWidth(def, 32); + OGR_Fld_SetJustify(def, OGRJustification.OJRight); + } else if (BigDecimal.class.equals(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTReal); + OGR_Fld_SetWidth(def, 32); + OGR_Fld_SetPrecision(def, 15); + OGR_Fld_SetJustify(def, OGRJustification.OJRight); + } else if (Float.class.equals(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTReal); + OGR_Fld_SetWidth(def, 12); + OGR_Fld_SetPrecision(def, 7); + OGR_Fld_SetJustify(def, OGRJustification.OJRight); + } else if (Double.class.equals(type) || Number.class.isAssignableFrom(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTInteger); + OGR_Fld_SetWidth(def, 22); + OGR_Fld_SetPrecision(def, 16); + OGR_Fld_SetJustify(def, OGRJustification.OJRight); + } else if (String.class.equals(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTString); + int length = FeatureTypes.getFieldLength(ad); + if (length <= 0) { + length = 255; + } + OGR_Fld_SetWidth(def, length); + } else if (byte[].class.equals(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTBinary); + } else if (java.sql.Date.class.isAssignableFrom(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTDate); + } else if (java.sql.Time.class.isAssignableFrom(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTTime); + } else if (java.util.Date.class.isAssignableFrom(type)) { + def = OGR_Fld_Create(namePtr, OGRFieldType.OFTDateTime); + } else { + throw new IOException("Cannot map " + type + " to an OGR type"); + } + + return def; + } + + /** + * Returns the OGR geometry type constant given a geometry attribute type + * + * @param descriptor + * @return + * @throws IOException + */ + public ValuedEnum<OGRwkbGeometryType> getOGRGeometryType(GeometryDescriptor descriptor) + throws IOException { + Class binding = descriptor.getType().getBinding(); + if (GeometryCollection.class.isAssignableFrom(binding)) { + if (MultiPoint.class.isAssignableFrom(binding)) { + return OGRwkbGeometryType.wkbMultiPoint; + } else if (MultiLineString.class.isAssignableFrom(binding)) { + return OGRwkbGeometryType.wkbMultiLineString; + } else if (MultiPolygon.class.isAssignableFrom(binding)) { + return OGRwkbGeometryType.wkbMultiPolygon; + } else { + return OGRwkbGeometryType.wkbGeometryCollection; + } + } else { + if (Point.class.isAssignableFrom(binding)) { + return OGRwkbGeometryType.wkbPoint; + } else if (LinearRing.class.isAssignableFrom(binding)) { + return OGRwkbGeometryType.wkbLinearRing; + } else if (LineString.class.isAssignableFrom(binding)) { + return OGRwkbGeometryType.wkbLineString; + } else if (Polygon.class.isAssignableFrom(binding)) { + return OGRwkbGeometryType.wkbPolygon; + } else { + return OGRwkbGeometryType.wkbUnknown; + } + } + } + + /** + * Returns the JTS geometry type equivalent to the layer native one + * + * @param definition + * @return + * @throws IOException + */ + private Class<? extends Geometry> getGeometryBinding(Pointer definition) throws IOException { + ValuedEnum<OGRwkbGeometryType> gt = OGR_FD_GetGeomType(definition); + long value = gt.value(); + // for line and polygon we return multi in any case since OGR will declare simple for + // multigeom + // anyways and then return simple or multi in the actual geoemtries depending on + // what it finds + if (value == OGRwkbGeometryType.wkbPoint.value() + || value == OGRwkbGeometryType.wkbPoint25D.value()) { + return Point.class; + } else if (value == OGRwkbGeometryType.wkbLinearRing.value()) { + return LinearRing.class; + } else if (value == OGRwkbGeometryType.wkbLineString.value() + || value == OGRwkbGeometryType.wkbLineString25D.value() + || value == OGRwkbGeometryType.wkbMultiLineString.value() + || value == OGRwkbGeometryType.wkbMultiLineString25D.value()) { + return MultiLineString.class; + } else if (value == OGRwkbGeometryType.wkbPolygon.value() + || value == OGRwkbGeometryType.wkbPolygon25D.value() + || value == OGRwkbGeometryType.wkbMultiPolygon.value() + || value == OGRwkbGeometryType.wkbMultiPolygon25D.value()) { + return MultiPolygon.class; + } else if (value == OGRwkbGeometryType.wkbGeometryCollection.value() + || value == OGRwkbGeometryType.wkbGeometryCollection25D.value()) { + return GeometryCollection.class; + } else if (value == OGRwkbGeometryType.wkbNone.value()) { + return null; + } else if (value == OGRwkbGeometryType.wkbUnknown.value()) { + return Geometry.class; + } else { + throw new IOException("Unknown geometry type: " + value); + } + } + + /** + * Returns the GeoTools {@link CoordinateReferenceSystem} equivalent to the layer native one + * + * @param layer + * @return + * @throws IOException + */ + private CoordinateReferenceSystem getCRS(Pointer layer) throws IOException { + Pointer spatialReference = null; + CoordinateReferenceSystem crs = null; + try { + spatialReference = OGR_L_GetSpatialRef(layer); + if (spatialReference == null) { + return null; + } + + try { + Pointer<Byte> code = OSRGetAuthorityCode(spatialReference, pointerToCString("EPSG")); + if (code != null) { + String fullCode = "EPSG:" + code; + crs = CRS.decode(fullCode); + } + } catch (Exception e) { + // fine, the code might be unknown to out authority + } + if (crs == null) { + try { + Pointer<Pointer<Byte>> wktPtr = allocatePointer(Byte.class); + OSRExportToWkt(spatialReference, wktPtr); + String wkt = wktPtr.getPointer(Byte.class).getCString(); + crs = CRS.parseWKT(wkt); + } catch (Exception e) { + // the wkt might reference an unsupported projection + } + } + return crs; + } finally { + OGRUtils.releaseSpatialReference(spatialReference); + } + } + + /** + * Returns a Pointer to a OGR spatial reference object equivalent to the specified GeoTools CRS + * + * @param crs + * @return + */ + public Pointer getSpatialReference(CoordinateReferenceSystem crs) { + if (crs == null) { + return null; + } + + // use tostring to get a lenient wkt translation + String wkt = crs.toString(); + return OSRNewSpatialReference(pointerToCString(wkt)); + } + +} Property changes on: trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FeatureTypeMapper.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id Added: svn:eol-style + native Added: trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FilterToRestrictedWhere.java =================================================================== --- trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FilterToRestrictedWhere.java (rev 0) +++ trunk/spike/mauro/ogr/src/main/java/org/geotools/data/ogr/FilterToRestrictedWhere.java 2011-12-08 19:57:35 UTC (rev 38412) @@ -0,0 +1,543 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + */ +package org.geotools.data.ogr; + +import java.io.IOException; +import java.io.StringWriter; +import java.util.Iterator; + +import org.geotools.factory.Hints; +import org.geotools.util.ConverterFactory; +import org.geotools.util.Converters; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.feature.type.AttributeDescriptor; +import org.opengis.filter.And; +import org.opengis.filter.BinaryComparisonOperator; +import org.opengis.filter.BinaryLogicOperator; +import org.opengis.filter.ExcludeFilter; +import org.opengis.filter.Filter; +import org.opengis.filter.FilterVisitor; +import org.opengis.filter.Id; +import org.opengis.filter.IncludeFilter; +import org.opengis.filter.Not; +import org.opengis.filter.Or; +import org.opengis.filter.PropertyIsBetween; +import org.opengis.filter.PropertyIsEqualTo; +import org.opengis.filter.PropertyIsGreaterThan; +import org.opengis.filter.PropertyIsGreaterThanOrEqualTo; +import org.opengis.filter.PropertyIsLessThan; +import org.opengis.filter.PropertyIsLessThanOrEqualTo; +import org.opengis.filter.PropertyIsLike; +import org.opengis.filter.PropertyIsNil; +import org.opengis.filter.PropertyIsNotEqualTo; +import org.opengis.filter.PropertyIsNull; +import org.opengis.filter.expression.Add; +import org.opengis.filter.expression.Divide; +import org.opengis.filter.expression.Expression; +import org.opengis.filter.expression.ExpressionVisitor; +import org.opengis.filter.expression.Function; +import org.opengis.filter.expression.Literal; +import org.opengis.filter.expression.Multiply; +import org.opengis.filter.expression.NilExpression; +import org.opengis.filter.expression.PropertyName; +import org.opengis.filter.expression.Subtract; +import org.opengis.filter.spatial.BBOX; +import org.opengis.filter.spatial.Beyond; +import org.opengis.filter.spatial.Contains; +import org.opengis.filter.spatial.Crosses; +import org.opengis.filter.spatial.DWithin; +import org.opengis.filter.spatial.Disjoint; +import org.opengis.filter.spatial.Equals; +import org.opengis.filter.spatial.Intersects; +import org.opengis.filter.spatial.Overlaps; +import org.opengis.filter.spatial.Touches; +import org.opengis.filter.spatial.Within; +import org.opengis.filter.temporal.After; +import org.opengis.filter.temporal.AnyInteracts; +import org.opengis.filter.temporal.Before; +import org.opengis.filter.temporal.Begins; +import org.opengis.filter.temporal.BegunBy; +import org.opengis.filter.temporal.During; +import org.opengis.filter.temporal.EndedBy; +import org.opengis.filter.temporal.Ends; +import org.opengis.filter.temporal.Meets; +import org.opengis.filter.temporal.MetBy; +import org.opengis.filter.temporal.OverlappedBy; +import org.opengis.filter.temporal.TContains; +import org.opengis.filter.temporal.TEquals; +import org.opengis.filter.temporal.TOverlaps; + +/** + * Encodes a compliant filter to the "restricted where" syntax supported by OGR: + * + * <pre> + * @condition@ = @field_name@ @binary_operator@ @value@ | "(" @condition@ ")" @binary_logical_operator@ + * "(" @condition@ ")" + * @binary_operator@ = "<" | ">" | "<=" | ">=" | "<>" | "=" + * @binary_logical_operator@ = "AND" | "OR" + * @field_name@ = @string_token@ + * @value@ = @string_token@ | @numeric_value@ | @string_value@ + * @string_value@ = "'" @characters@ "'" + * </pre> + * + * Implementation wise this is a widely cut down version of JDBC's module FilterToSQL + * + * @author Andrea Aime - GeoSolutions + */ +class FilterToRestrictedWhere implements FilterVisitor, ExpressionVisitor { + /** error message for exceptions */ + protected static final String IO_ERROR = "io problem writing filter"; + + /** the schema the encoder will be used to be encode sql for */ + protected SimpleFeatureType featureType; + + StringWriter out = new StringWriter(); + + public FilterToRestrictedWhere(SimpleFeatureType featureType) { + this.featureType = featureType; + } + + public String getRestrictedWhere() { + return out.toString(); + } + + /** + * Writes the SQL for the PropertyIsBetween Filter. + * + * @param filter the Filter to be visited. + * + * @throws RuntimeException for io exception with writer + */ + public Object visit(PropertyIsBetween filter, Object extraData) throws RuntimeException { + Expression expr = (Expression) filter.getExpression(); + Expression lowerbounds = (Expression) filter.getLowerBoundary(); + Expression upperbounds = (Expression) filter.getUpperBoundary(); + + Class context; + AttributeDescriptor attType = (AttributeDescriptor) expr.evaluate(featureType); + if (attType != null) { + context = attType.getType().getBinding(); + } else { + context = String.class; + } + + out.write("(("); + expr.accept(this, extraData); + out.write(">="); + lowerbounds.accept(this, context); + out.write(") AND ("); + expr.accept(this, extraData); + out.write("<="); + upperbounds.accept(this, context); + out.write("))"); + + return extraData; + } + + /** + * Write the SQL for an And filter + * + * @param filter the filter to visit + * @param extraData extra data (unused by this method) + * + */ + public Object visit(And filter, Object extraData) { + return visit((BinaryLogicOperator) filter, "AND"); + } + + /** + * Write the SQL for an Or filter + * + * @param filter the filter to visit + * @param extraData extra data (unused by this method) + * + */ + public Object visit(Or filter, Object extraData) { + return visit((BinaryLogicOperator) filter, "OR"); + } + + /** + * Common implementation for BinaryLogicOperator filters. This way they're all handled + * centrally. + * + * @param filter the logic statement to be turned into SQL. + * @param extraData extra filter data. Not modified directly by this method. + */ + protected Object visit(BinaryLogicOperator filter, Object extraData) { + String type = (String) extraData; + out.write("("); + + Iterator<Filter> list = filter.getChildren().iterator(); + while (list.hasNext()) { + list.next().accept(this, extraData); + + if (list.hasNext()) { + out.write(" " + type + " "); + } + } + out.write(")"); + return extraData; + } + + public Object visit(PropertyIsEqualTo filter, Object extraData) { + visitBinaryComparisonOperator((BinaryComparisonOperator) filter, "="); + return extraData; + } + + public Object visit(PropertyIsGreaterThanOrEqualTo filter, Object extraData) { + visitBinaryComparisonOperator((BinaryComparisonOperator) filter, ">="); + return extraData; + } + + public Object visit(PropertyIsGreaterThan filter, Object extraData) { + visitBinaryComparisonOperator((BinaryComparisonOperator) filter, ">"); + return extraData; + } + + public Object visit(PropertyIsLessThan filter, Object extraData) { + visitBinaryComparisonOperator((BinaryComparisonOperator) filter, "<"); + return extraData; + } + + public Object visit(PropertyIsLessThanOrEqualTo filter, Object extraData) { + visitBinaryComparisonOperator((BinaryComparisonOperator) filter, "<="); + return extraData; + } + + public Object visit(PropertyIsNotEqualTo filter, Object extraData) { + visitBinaryComparisonOperator((BinaryComparisonOperator) filter, "!="); + return extraData; + } + + protected void visitBinaryComparisonOperator(BinaryComparisonOperator filter, Object extraData) + throws RuntimeException { + Expression left = filter.getExpression1(); + Expression right = filter.getExpression2(); + + // see if we can get some indication on how to evaluate literals + Class leftContext = null, rightContext = null; + if (left instanceof PropertyName) { + AttributeDescriptor attType = (AttributeDescriptor) left.evaluate(featureType); + if (attType != null) { + rightContext = attType.getType().getBinding(); + } + } + if (rightContext == null && right instanceof PropertyName) { + AttributeDescriptor attType = (AttributeDescriptor) right.evaluate(featureType); + if (attType != null) { + leftContext = attType.getType().getBinding(); + } + } + + String type = (String) extraData; + left.accept(this, leftContext); + out.write(" " + type + " "); + right.accept(this, rightContext); + } + + public Object visit(PropertyName expression, Object extraData) throws RuntimeException { + AttributeDescriptor attribute = null; + try { + attribute = (AttributeDescriptor) expression.evaluate(featureType); + } catch (Exception e) { + // just log and fall back on just encoding propertyName straight up + String msg = "Error occured mapping " + expression + " to feature type"; + } + String name = null; + if (attribute != null) { + name = attribute.getLocalName(); + } else { + name = expression.getPropertyName(); + } + out.write(name); + + return extraData; + } + + /** + * Export the contents of a Literal Expresion + * + * @param expression the Literal to export + * + * @throws RuntimeException for io exception with writer + */ + public Object visit(Literal expression, Object context) throws RuntimeException { + // type to convert the literal to + Class target = null; + if (context instanceof Class) { + target = (Class) context; + } + + // evaluate the expression + Object literal = evaluateLiteral(expression, target); + writeLiteral(literal); + return context; + } + + protected Object evaluateLiteral(Literal expression, Class target) { + Object literal = null; + + // HACK: let expression figure out the right value for numbers, + // since the context is almost always improperly set and the + // numeric converters try to force floating points to integrals + // JD: the above is no longer true, so instead do a safe conversion + if (target != null) { + // use the target type + if (Number.class.isAssignableFrom(target)) { + literal = Converters.convert(expression.evaluate(null), target, new Hints( + ConverterFactory.SAFE_CONVERSION, true)); + } else { + literal = expression.evaluate(null, target); + } + } + // if the target was n... [truncated message content] |
Author: apm Date: 2011-12-08 06:22:32 -0800 (Thu, 08 Dec 2011) New Revision: 38411 Added: trunk/modules/unsupported/mongodb/ trunk/modules/unsupported/mongodb/README.rst trunk/modules/unsupported/mongodb/pom.xml trunk/modules/unsupported/mongodb/src/ trunk/modules/unsupported/mongodb/src/main/ trunk/modules/unsupported/mongodb/src/main/java/ trunk/modules/unsupported/mongodb/src/main/java/org/ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/FilterToMongoQuery.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoDataStore.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoDataStoreFactory.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureCollection.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureReader.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureSource.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoLayer.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoPluginConfig.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoPluginException.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoQueryCaps.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoResourceInfo.java trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoResultSet.java trunk/modules/unsupported/mongodb/src/main/javascript/ trunk/modules/unsupported/mongodb/src/main/javascript/INSTALL.txt trunk/modules/unsupported/mongodb/src/main/javascript/MetaDataCompute.js trunk/modules/unsupported/mongodb/src/main/resources/ trunk/modules/unsupported/mongodb/src/main/resources/META-INF/ trunk/modules/unsupported/mongodb/src/main/resources/META-INF/services/ trunk/modules/unsupported/mongodb/src/main/resources/META-INF/services/org.geotools.data.DataStoreFactorySpi trunk/modules/unsupported/mongodb/src/site/ trunk/modules/unsupported/mongodb/src/site/apt/ trunk/modules/unsupported/mongodb/src/site/apt/review.apt trunk/modules/unsupported/mongodb/target/ Modified: trunk/modules/unsupported/pom.xml Log: Added MongoDB data store to modules/unsupported Added: trunk/modules/unsupported/mongodb/README.rst =================================================================== --- trunk/modules/unsupported/mongodb/README.rst (rev 0) +++ trunk/modules/unsupported/mongodb/README.rst 2011-12-08 14:22:32 UTC (rev 38411) @@ -0,0 +1,18 @@ +MongoDB DataStore +================= + +Installing MongoDB +------------------------- + +Install MongoDB using the appropriate package from: +http://www.mongodb.org/downloads + +The MongoDB plugin depends on a JavaScript MapReduce script to calculate schema. The script (MetaDataCompute.js), and installation specifics (INSTALL.txt), can be found in modules/unsupported/mongodb/src/main/javascript/. Install this script on your MongoDB server. + +Functionality +------------- + +The MongoDataStore supports the use of MongoDB as a data store. This should be considered a beta version. + +The current 'design document' in use for the test cases is not necessarily the +final solution and is acknowledged to have shortcomings. Property changes on: trunk/modules/unsupported/mongodb/README.rst ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id URL Added: svn:eol-style + native Added: trunk/modules/unsupported/mongodb/pom.xml =================================================================== --- trunk/modules/unsupported/mongodb/pom.xml (rev 0) +++ trunk/modules/unsupported/mongodb/pom.xml 2011-12-08 14:22:32 UTC (rev 38411) @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.geotools</groupId> + <artifactId>unsupported</artifactId> + <version>8-SNAPSHOT</version> + </parent> + + <groupId>org.geotools</groupId> + <artifactId>gt-mongodb</artifactId> + <packaging>jar</packaging> + <name>MongoDB DataStore</name> + <description>MongoDB DataStore.</description> + + <developers> + <developer> + <id>apm</id> + <name>Alan Mangan</name> + <email>am...@da...</email> + <organization>Data Tactics Corp.</organization> + <organizationUrl>http://www.data-tactics-corp.com</organizationUrl> + <timezone>GMT-5</timezone> + <roles> + <role>Java Developer</role> + </roles> + </developer> + </developers> + + <dependencies> + <!-- GeoTools modules --> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-main</artifactId> + <version>${project.version}</version> + </dependency> + <!-- Third-party dependencies --> + <dependency> + <groupId>org.mongodb</groupId> + <artifactId>mongo-java-driver</artifactId> + <version>2.5</version> + <type>jar</type> + <optional>false</optional> + </dependency> + + </dependencies> + +</project> Property changes on: trunk/modules/unsupported/mongodb/pom.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Id URL Added: svn:eol-style + native Added: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/FilterToMongoQuery.java =================================================================== --- trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/FilterToMongoQuery.java (rev 0) +++ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/FilterToMongoQuery.java 2011-12-08 14:22:32 UTC (rev 38411) @@ -0,0 +1,685 @@ +package org.geotools.data.mongodb; + +import java.util.Iterator; +import java.util.List; +import java.util.regex.Pattern; + +import org.opengis.filter.And; +import org.opengis.filter.ExcludeFilter; +import org.opengis.filter.Filter; +import org.opengis.filter.FilterVisitor; +import org.opengis.filter.Id; +import org.opengis.filter.IncludeFilter; +import org.opengis.filter.Not; +import org.opengis.filter.Or; +import org.opengis.filter.PropertyIsBetween; +import org.opengis.filter.PropertyIsEqualTo; +import org.opengis.filter.PropertyIsGreaterThan; +import org.opengis.filter.PropertyIsGreaterThanOrEqualTo; +import org.opengis.filter.PropertyIsLessThan; +import org.opengis.filter.PropertyIsLessThanOrEqualTo; +import org.opengis.filter.PropertyIsLike; +import org.opengis.filter.PropertyIsNil; +import org.opengis.filter.PropertyIsNotEqualTo; +import org.opengis.filter.PropertyIsNull; +import org.opengis.filter.expression.Add; +import org.opengis.filter.expression.Divide; +import org.opengis.filter.expression.Expression; +import org.opengis.filter.expression.ExpressionVisitor; +import org.opengis.filter.expression.Function; +import org.opengis.filter.expression.Literal; +import org.opengis.filter.expression.Multiply; +import org.opengis.filter.expression.NilExpression; +import org.opengis.filter.expression.PropertyName; +import org.opengis.filter.expression.Subtract; +import org.opengis.filter.spatial.BBOX; +import org.opengis.filter.spatial.Beyond; +import org.opengis.filter.spatial.Contains; +import org.opengis.filter.spatial.Crosses; +import org.opengis.filter.spatial.DWithin; +import org.opengis.filter.spatial.Disjoint; +import org.opengis.filter.spatial.Equals; +import org.opengis.filter.spatial.Intersects; +import org.opengis.filter.spatial.Overlaps; +import org.opengis.filter.spatial.Touches; +import org.opengis.filter.spatial.Within; +import org.opengis.filter.temporal.After; +import org.opengis.filter.temporal.AnyInteracts; +import org.opengis.filter.temporal.Before; +import org.opengis.filter.temporal.Begins; +import org.opengis.filter.temporal.BegunBy; +import org.opengis.filter.temporal.During; +import org.opengis.filter.temporal.EndedBy; +import org.opengis.filter.temporal.Ends; +import org.opengis.filter.temporal.Meets; +import org.opengis.filter.temporal.MetBy; +import org.opengis.filter.temporal.OverlappedBy; +import org.opengis.filter.temporal.TContains; +import org.opengis.filter.temporal.TEquals; +import org.opengis.filter.temporal.TOverlaps; + +import com.mongodb.BasicDBList; +import com.mongodb.BasicDBObject; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Geometry; + +/** + * + * @author Gerald Gay, Data Tactics Corp. + * @author Alan Mangan, Data Tactics Corp. + * @source $URL$ + * + * (C) 2011, Open Source Geospatial Foundation (OSGeo) + * + * @see The GNU Lesser General Public License (LGPL) + */ +/* This library is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation; either version + * 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this library; + * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA */ +public class FilterToMongoQuery implements FilterVisitor, ExpressionVisitor +{ + + // temp holder + public FilterToMongoQuery () + { + } + + protected BasicDBObject asDBObject (Object extraData) + { + if ((extraData != null) || (extraData instanceof BasicDBObject)) + { + return (BasicDBObject) extraData; + } + return new BasicDBObject(); + } + + public Object visit (Literal expression, Object extraData) + { + Object literal = expression.getValue(); + String ret = literal.toString(); + return ret; + } + + public Object visit (PropertyName expression, Object extraData) + { + return expression.getPropertyName(); + } + + public Object visit (ExcludeFilter filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + output.put( "foo", "not_likely_to_exist" ); + return output; + } + + // An empty object should be an "all" query + public Object visit (IncludeFilter filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + return output; + } + + // Expressions like ((A == 1) AND (B == 2)) are basically + // implied. So just build up all sub expressions + public Object visit (And filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + + List<Filter> children = filter.getChildren(); + if (children != null) + { + for (Iterator<Filter> i = children.iterator(); i.hasNext();) + { + Filter child = i.next(); + child.accept( this, output ); + } + } + + return output; + } + + /** + * Encoding an Id filter is not supported by CQL. + * <p> + * This is because in the Catalog specification retrieving an object by an id is a distinct + * operation separate from a filter based query. + */ + public Object visit (Id filter, Object extraData) + { + throw new IllegalStateException( "Cannot encode an Id as legal CQL" ); + } + + public Object visit (Not filter, Object extraData) + { + + BasicDBObject output = asDBObject( extraData ); + BasicDBObject expr = (BasicDBObject) filter.getFilter().accept( this, null ); + output.put( "$not", expr ); + return output; + } + + public Object visit (Or filter, Object extraData) + { + + BasicDBObject output = asDBObject( extraData ); + List<Filter> children = filter.getChildren(); + BasicDBList orList = new BasicDBList(); + if (children != null) + { + for (Iterator<Filter> i = children.iterator(); i.hasNext();) + { + Filter child = i.next(); + BasicDBObject item = (BasicDBObject) child.accept( this, null ); + orList.add( item ); + } + output.put( "$or", orList ); + } + return output; + } + + public Object visit (PropertyIsBetween filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + Object propName = filter.getExpression().accept( this, null ); + Object lower = filter.getLowerBoundary().accept( this, null ); + Object upper = filter.getUpperBoundary().accept( this, null ); + if ((propName instanceof String) && (lower instanceof String) && (upper instanceof String)) + { + BasicDBObject dbo = new BasicDBObject(); + dbo.put( "$gte", lower ); + dbo.put( "$lte", upper ); + output.put( (String) propName, dbo ); + } + return output; + } + + public Object visit (PropertyIsEqualTo filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + Object expr1 = filter.getExpression1().accept( this, null ); + Object expr2 = filter.getExpression2().accept( this, null ); + if ((expr1 instanceof String) && (expr2 instanceof String)) + { + // try to determine if equality check against a number, and if so whether fp or int + // assuming no units/currency markings present, e.g. "$" "ft." etc. + String expr2Str = ((String) expr2).trim(); + try + { + if (expr2Str.matches( "-? ?(\\d+,)*\\d+" )) // integer + { + output.put( (String) expr1, new Long( (String) expr2 ) ); + } + else if (expr2Str.matches( "-? ?(\\d+,)*\\d+\\.\\d+" )) // floating point + { + output.put( (String) expr1, new Double( (String) expr2 ) ); + } + else + { + output.put( (String) expr1, expr2 ); + } + } + catch (NumberFormatException e) + { + output.put( (String) expr1, expr2 ); + } + } + return output; + } + + public Object visit (PropertyIsNotEqualTo filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + Object expr1 = filter.getExpression1().accept( this, null ); + Object expr2 = filter.getExpression2().accept( this, null ); + if ((expr1 instanceof String) && (expr2 instanceof String)) + { + BasicDBObject dbo = new BasicDBObject(); + try + { + dbo.put( "$ne", new Double( (String) expr2 ) ); + } + catch (NumberFormatException e) + { + dbo.put( "$ne", expr2 ); + } + output.put( (String) expr1, dbo ); + } + return output; + } + + public Object visit (PropertyIsGreaterThan filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + Object expr1 = filter.getExpression1().accept( this, null ); + Object expr2 = filter.getExpression2().accept( this, null ); + if ((expr1 instanceof String) && (expr2 instanceof String)) + { + BasicDBObject dbo = new BasicDBObject(); + try + { + dbo.put( "$gt", new Double( (String) expr2 ) ); + } + catch (NumberFormatException e) + { + dbo.put( "$gt", expr2 ); + } + output.put( (String) expr1, dbo ); + } + return output; + } + + public Object visit (PropertyIsGreaterThanOrEqualTo filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + Object expr1 = filter.getExpression1().accept( this, null ); + Object expr2 = filter.getExpression2().accept( this, null ); + if ((expr1 instanceof String) && (expr2 instanceof String)) + { + BasicDBObject dbo = new BasicDBObject(); + try + { + dbo.put( "$gte", new Double( (String) expr2 ) ); + } + catch (NumberFormatException e) + { + dbo.put( "$gte", expr2 ); + } + output.put( (String) expr1, dbo ); + } + return output; + } + + public Object visit (PropertyIsLessThan filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + Object expr1 = filter.getExpression1().accept( this, null ); + Object expr2 = filter.getExpression2().accept( this, null ); + if ((expr1 instanceof String) && (expr2 instanceof String)) + { + BasicDBObject dbo = new BasicDBObject(); + try + { + dbo.put( "$lt", new Double( (String) expr2 ) ); + } + catch (NumberFormatException e) + { + dbo.put( "$lt", expr2 ); + } + output.put( (String) expr1, dbo ); + } + return output; + } + + public Object visit (PropertyIsLessThanOrEqualTo filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + Object expr1 = filter.getExpression1().accept( this, null ); + Object expr2 = filter.getExpression2().accept( this, null ); + if ((expr1 instanceof String) && (expr2 instanceof String)) + { + BasicDBObject dbo = new BasicDBObject(); + try + { + dbo.put( "$lte", new Double( (String) expr2 ) ); + } + catch (NumberFormatException e) + { + dbo.put( "$lte", expr2 ); + } + output.put( (String) expr1, dbo ); + } + return output; + } + + // Mongo doesn't have LIKE but it does have Regex. So + // I'm converting it like this: + // + // filter.getWildCard() returns SQL-like '%' + // filter.getSingleChar() returns SQL-like '_' + // So I'm converting "foo_bar%" to /foo.bar.*/ + public Object visit (PropertyIsLike filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + Object expr = filter.getExpression(); + if (expr instanceof String) + { + String multi = filter.getWildCard(); + String single = filter.getSingleChar(); + int flags = (filter.isMatchingCase()) ? 0 : Pattern.CASE_INSENSITIVE; + String cqlPattern = filter.getLiteral(); + cqlPattern.replaceAll( multi, ".*" ); + cqlPattern.replaceAll( single, "." ); + try + { + Pattern p = Pattern.compile( cqlPattern, flags ); + output.put( (String) expr, p ); + } + catch (Throwable t) + { + } + } + return output; + } + + // There is no "NULL" in MongoDB, but I assume that TODO add null support + // the non-existence of a column is the same... + public Object visit (PropertyIsNull filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + Object expr = filter.accept( this, null ); + if (expr instanceof String) + { + BasicDBObject dbo = new BasicDBObject(); + dbo.put( "$exists", false ); + output.put( (String) expr, dbo ); + } + return output; + } + + public Object visit (BBOX filter, Object extraData) + { + BasicDBObject output = asDBObject( extraData ); + + double minX = 180; + double minY = 90; + double maxX = -180; + double maxY = -90; + // replace deprecated BBOX.getMinX() w/ getExpression2() call + // to determine mins and maxes + Expression exp2 = filter.getExpression2(); + if (exp2 instanceof Literal) + { + Geometry bbox = (Geometry) ((Literal) exp2).getValue(); + Coordinate[] coords = bbox.getEnvelope().getCoordinates(); + minX = coords[0].x; + minY = coords[0].y; + maxX = coords[2].x; + maxY = coords[2].y; + } + + if (minX < -180) + minX = -180; + if (maxX > 180) + maxX = 180; + if (minY < -90) + minY = -90; + if (maxY > 90) + maxY = 90; + + StringBuilder sb = new StringBuilder(); + sb.append( "gtmpGeoQuery([" ); + sb.append( minX ); + sb.append( "," ); + sb.append( minY ); + sb.append( "," ); + sb.append( maxX ); + sb.append( "," ); + sb.append( maxY ); + sb.append( "])" ); + output.put( "$where", sb.toString() ); + + return output; + } + + public Object visitNullFilter (Object extraData) + { + throw new NullPointerException( "Cannot encode null as a Filter" ); + } + + public Object visit (NilExpression expression, Object extraData) + { + return extraData; + } + + /****************************************************** + * The rest are either filters that don't make sense or are currently not implemented. + ******************************************************/ + + public Object visit (Beyond filter, Object extraData) + { + return extraData; + } + + public Object visit (Contains filter, Object extraData) + { + return extraData; + } + + public Object visit (Crosses filter, Object extraData) + { + return extraData; + } + + public Object visit (Disjoint filter, Object extraData) + { + return extraData; + } + + public Object visit (DWithin filter, Object extraData) + { + return extraData; + } + + public Object visit (Equals filter, Object extraData) + { + return extraData; + } + + public Object visit (Intersects filter, Object extraData) + { + return extraData; + } + + public Object visit (Overlaps filter, Object extraData) + { + return extraData; + } + + public Object visit (Touches filter, Object extraData) + { + return extraData; + } + + public Object visit (Within filter, Object extraData) + { + return extraData; + } + + public Object visit (Add expression, Object extraData) + { + return extraData; + } + + public Object visit (Divide expression, Object extraData) + { + return extraData; + } + + public Object visit (Function function, Object extraData) + { + return extraData; + } + + public Object visit (Multiply expression, Object extraData) + { + return extraData; + } + + public Object visit (Subtract expression, Object extraData) + { + return extraData; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.PropertyIsNil, + * java.lang.Object) */ + @Override + public Object visit (PropertyIsNil filter, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.After, + * java.lang.Object) */ + @Override + public Object visit (After after, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.AnyInteracts, + * java.lang.Object) */ + @Override + public Object visit (AnyInteracts anyInteracts, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.Before, + * java.lang.Object) */ + @Override + public Object visit (Before before, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.Begins, + * java.lang.Object) */ + @Override + public Object visit (Begins begins, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.BegunBy, + * java.lang.Object) */ + @Override + public Object visit (BegunBy begunBy, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.During, + * java.lang.Object) */ + @Override + public Object visit (During during, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.EndedBy, + * java.lang.Object) */ + @Override + public Object visit (EndedBy endedBy, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.Ends, + * java.lang.Object) */ + @Override + public Object visit (Ends ends, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.Meets, + * java.lang.Object) */ + @Override + public Object visit (Meets meets, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.MetBy, + * java.lang.Object) */ + @Override + public Object visit (MetBy metBy, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.OverlappedBy, + * java.lang.Object) */ + @Override + public Object visit (OverlappedBy overlappedBy, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.TContains, + * java.lang.Object) */ + @Override + public Object visit (TContains contains, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.TEquals, + * java.lang.Object) */ + @Override + public Object visit (TEquals equals, Object extraData) + { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * + * @see org.opengis.filter.FilterVisitor#visit(org.opengis.filter.temporal.TOverlaps, + * java.lang.Object) */ + @Override + public Object visit (TOverlaps contains, Object extraData) + { + // TODO Auto-generated method stub + return null; + } +} Property changes on: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/FilterToMongoQuery.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id URL Added: svn:eol-style + native Added: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoDataStore.java =================================================================== --- trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoDataStore.java (rev 0) +++ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoDataStore.java 2011-12-08 14:22:32 UTC (rev 38411) @@ -0,0 +1,350 @@ +package org.geotools.data.mongodb; + +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.logging.Logger; + +import org.bson.types.BasicBSONList; +import org.geotools.data.DataStore; +import org.geotools.data.DefaultServiceInfo; +import org.geotools.data.EmptyFeatureWriter; +import org.geotools.data.FeatureListener; +import org.geotools.data.FeatureListenerManager; +import org.geotools.data.FeatureReader; +import org.geotools.data.FeatureSource; +import org.geotools.data.FeatureWriter; +import org.geotools.data.LockingManager; +import org.geotools.data.Query; +import org.geotools.data.ServiceInfo; +import org.geotools.data.Transaction; +import org.geotools.data.mongodb.MongoLayer.GeometryType; +import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.feature.NameImpl; +import org.geotools.feature.simple.SimpleFeatureTypeBuilder; +import org.geotools.referencing.CRS; +import org.geotools.referencing.crs.DefaultGeographicCRS; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.feature.type.Name; +import org.opengis.filter.Filter; +import org.opengis.referencing.crs.CoordinateReferenceSystem; + +import com.mongodb.BasicDBObject; +import com.mongodb.DB; +import com.mongodb.DBCollection; +import com.mongodb.Mongo; +import com.mongodb.MongoException; + +/** + * Represents a mongoDB-backed GeoServer Data Store; manages layers representing mongoDB collections + * containing GeoJSON-encoded geospatial data + * + * @author Gerald Gay, Data Tactics Corp. + * @author Alan Mangan, Data Tactics Corp. + * @source $URL$ + * + * (C) 2011, Open Source Geospatial Foundation (OSGeo) + * + * @see The GNU Lesser General Public License (LGPL) + */ +/* This library is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation; either version + * 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this library; + * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA */ +public class MongoDataStore implements DataStore +{ + + /** List of mongo layers for this mongo store */ + private ArrayList<MongoLayer> layers = null; + private CoordinateReferenceSystem crs = null; + /** Config for this mongo plugin */ + private MongoPluginConfig config = null; + private FeatureListenerManager lsnMgr = null; + + /** Package logger */ + private final static Logger log = MongoPluginConfig.getLog(); + + public MongoDataStore (MongoPluginConfig config) + { + this.config = config; + lsnMgr = new FeatureListenerManager(); + layers = new ArrayList<MongoLayer>(); + log.info( "MongoDataStore; layers=" + layers ); + try + { + crs = CRS.decode( "EPSG:4326" ); + } + catch (Throwable t) + { + crs = DefaultGeographicCRS.WGS84; + } + // TODO when to look for and detect changes to layers + if (layers.size() == 0) + { + getLayers(); + } + } + + /** + * Get list of valid layers for this mongo DB; those containing at least one valid, non-null + * GeoJSON geometry + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void getLayers () + { + Mongo mongo = null; + try + { + // Get the list of collections from Mongo... + mongo = new Mongo( config.getHost(), config.getPort() ); + DB db = mongo.getDB( config.getDB() ); // TODO add authentication + Set<String> colls = db.getCollectionNames(); + for (String s : colls) + { + DBCollection dbc = db.getCollection( s ); + log.info( "getLayers; collection=" + dbc ); + // find distinct non-null geometry to determine if valid layer + // TODO branch point for separate geometry-specific layers per collection + List geoList = dbc.distinct( "geometry.type" ); + // distinct returns single BSON List, may barf if results large, > max doc. size + // trap exception on props distinct and assume it's valid since there's obviously + // something there (http://www.mongodb.org/display/DOCS/Aggregation) + List propList = null; + try + { + propList = dbc.distinct( "properties" ); + } + catch (IllegalArgumentException ex) + { + propList = new BasicBSONList(); + propList.add( "ex nihilo" ); + } + catch (MongoException ex) + { + propList = new BasicBSONList(); + propList.add( "ex nihilo" ); + } + // check that layer has valid geometry and some properties defined + if (geoList != null && propList != null && propList.size() > 0) + { + boolean hasValidGeo = false; + for (GeometryType type : GeometryType.values()) + { + if (geoList.contains( type.toString() )) + { + hasValidGeo = true; + break; + } + } + if (hasValidGeo) + { + layers.add( new MongoLayer( dbc, config ) ); + } + } + } + } + catch (Throwable t) + { + log.severe( "getLayers error; " + t.getLocalizedMessage() ); + } + if (mongo != null) + { + mongo.close(); + } + } + + public CoordinateReferenceSystem getCRS () + { + return crs; + } + + public MongoPluginConfig getConfig () + { + return config; + } + + public void addListener (FeatureSource<?, ?> src, FeatureListener listener) + { + lsnMgr.addFeatureListener( src, listener ); + } + + public void removeListener (FeatureSource<?, ?> src, FeatureListener listener) + { + lsnMgr.removeFeatureListener( src, listener ); + } + + public Set<String> getKeywords (String typeName) + { + Set<String> result = null; + + for (MongoLayer ml : layers) + { + if (ml.getName().equals( typeName )) + { + result = ml.getKeywords(); + break; + } + } + + return result; + } + + public LockingManager getLockingManager () + { + // returning null as per DataStore.getLockingManager() contract + return null; + } + + public FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriterAppend (final String typeName, + final Transaction transaction) + { + return new EmptyFeatureWriter( new SimpleFeatureTypeBuilder().buildFeatureType() ); + } + + public FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter (final String typeName, + final Transaction transaction) + { + return new EmptyFeatureWriter( new SimpleFeatureTypeBuilder().buildFeatureType() ); + } + + public FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter (final String typeName, + final Filter filter, + final Transaction transaction) + { + return new EmptyFeatureWriter( new SimpleFeatureTypeBuilder().buildFeatureType() ); + } + + public FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader (final Query query, + final Transaction transaction) + { + FilterToMongoQuery f2m = new FilterToMongoQuery(); + Filter filter = query.getFilter(); + BasicDBObject dbo = (BasicDBObject) filter.accept( f2m, null ); + MongoLayer layer = getMongoLayer( query.getTypeName() ); + MongoResultSet rs = new MongoResultSet( layer, dbo ); + return new MongoFeatureReader( rs ); + } + + public SimpleFeatureSource getFeatureSource (final String typeName) throws IOException + { + MongoLayer layer = getMongoLayer( typeName ); + return new MongoFeatureSource( this, layer ); + } + + public FeatureSource<SimpleFeatureType, SimpleFeature> getView (final Query query) + { + FilterToMongoQuery f2m = new FilterToMongoQuery(); + Filter filter = query.getFilter(); + BasicDBObject dbo = (BasicDBObject) filter.accept( f2m, null ); + MongoLayer layer = getMongoLayer( query.getTypeName() ); + return new MongoFeatureSource( this, layer, dbo ); + } + + public SimpleFeatureType getSchema (final String typeName) + { + SimpleFeatureType sft = null; + + for (MongoLayer ml : layers) + { + if (ml.getName().equals( typeName )) + { + sft = ml.getSchema(); + } + } + + return sft; + } + + public String[] getTypeNames () + { + String[] names = new String[layers.size()]; + int idx = 0; + for (MongoLayer ml : layers) + { + names[idx++] = ml.getName(); + } + return names; + } + + public void updateSchema (final String typeName, final SimpleFeatureType featureType) + throws IOException + { + throw new UnsupportedOperationException( "Schema modification not supported" ); + } + + public void dispose () + { + + } + + public SimpleFeatureSource getFeatureSource (Name name) throws IOException + { + return getFeatureSource( name.getLocalPart() ); + } + + public SimpleFeatureType getSchema (Name name) throws IOException + { + return getSchema( name.getLocalPart() ); + } + + public List<Name> getNames () throws IOException + { + List<Name> names = new ArrayList<Name>( layers.size() ); + for (MongoLayer ml : layers) + { + names.add( new NameImpl( ml.getName() ) ); + } + return names; + } + + public void updateSchema (Name typeName, SimpleFeatureType featureType) throws IOException + { + updateSchema( typeName.getLocalPart(), featureType ); + } + + public void createSchema (final SimpleFeatureType featureType) throws IOException, + IllegalArgumentException + { + + } + + public ServiceInfo getInfo () + { + DefaultServiceInfo info = new DefaultServiceInfo(); + info.setTitle( "MongoDB Data Store" ); + info.setDescription( "Features from MongoDB" ); + try + { + info.setSchema( new URI( config.getNamespace() ) ); + } + catch (Throwable t) + { + } + return info; + } + + public MongoLayer getMongoLayer (String typeName) + { + MongoLayer layer = null; + for (MongoLayer ml : layers) + { + if (ml.getName().equals( typeName )) + { + layer = ml; + break; + } + } + return layer; + } + +} Property changes on: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoDataStore.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id URL Added: svn:eol-style + native Added: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoDataStoreFactory.java =================================================================== --- trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoDataStoreFactory.java (rev 0) +++ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoDataStoreFactory.java 2011-12-08 14:22:32 UTC (rev 38411) @@ -0,0 +1,116 @@ +package org.geotools.data.mongodb; + +import java.awt.RenderingHints; +import java.io.Serializable; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import org.geotools.data.DataStore; +import org.geotools.data.DataStoreFactorySpi; + +/** + * + * @author Gerald Gay, Data Tactics Corp. + * @source $URL$ + * + * (C) 2011, Open Source Geospatial Foundation (OSGeo) + * + * @see The GNU Lesser General Public License (LGPL) + */ +/* This library is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation; either version + * 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this library; + * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA */ +public class MongoDataStoreFactory implements DataStoreFactorySpi +{ + + private static final String FACTORY_DESCRIPTION = "MongoDB GeoServer Plugin"; + private static final String FACTORY_DISPLAY_NAME = "MongoDB"; + /** Package logger */ + static private final Logger log = MongoPluginConfig.getLog(); + + public DataStore createNewDataStore (Map<String, Serializable> map) + { + return createDataStore( map ); + } + + public DataStore createDataStore (Map<String, Serializable> params) + { + DataStore theStore = null; + log.info( "DataStore.createDataStore()" ); + try + { + MongoPluginConfig config = new MongoPluginConfig( params ); + theStore = new MongoDataStore( config ); + log.info( "DataStore.createDataStore(); theStore=" + theStore ); + } + catch (Throwable t) + { + log.severe( t.getLocalizedMessage() ); + } + return theStore; + } + + public boolean isAvailable () + { + boolean result = false; + try + { + // basic check to ensure mongo jar available + Class.forName( "com.mongodb.BasicDBObject" ); + result = true; + } + catch (Throwable t) + { + log.severe( "Mongo Plugin: The MongoDB JAR file was not found on the class path." ); + } + return result; + } + + public boolean canProcess (Map<String, Serializable> params) + { + + boolean result = true; + + try + { + new MongoPluginConfig( params ); + } + catch (MongoPluginException e) + { + result = false; + } + + return result; + } + + public DataStoreFactorySpi.Param[] getParametersInfo () + { + List<Param> params = MongoPluginConfig.getPluginParams(); + return params.toArray( new Param[params.size()] ); + } + + public String getDescription () + { + return FACTORY_DESCRIPTION; + } + + public String getDisplayName () + { + return FACTORY_DISPLAY_NAME; + } + + public Map<RenderingHints.Key, ?> getImplementationHints () + { + return Collections.emptyMap(); + } +} Property changes on: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoDataStoreFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id URL Added: svn:eol-style + native Added: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureCollection.java =================================================================== --- trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureCollection.java (rev 0) +++ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureCollection.java 2011-12-08 14:22:32 UTC (rev 38411) @@ -0,0 +1,62 @@ +package org.geotools.data.mongodb; + +import org.geotools.data.FeatureReader; +import org.geotools.data.store.DataFeatureCollection; +import org.geotools.geometry.jts.ReferencedEnvelope; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; + +/** + * + * @author Gerald Gay, Data Tactics Corp. + * @source $URL$ + * + * (C) 2011, Open Source Geospatial Foundation (OSGeo) + * + * @see The GNU Lesser General Public License (LGPL) + */ +/* This library is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation; either version + * 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this library; + * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA */ +public class MongoFeatureCollection extends DataFeatureCollection +{ + + private MongoResultSet results = null; + + public MongoFeatureCollection (MongoResultSet rs) + { + results = rs; + } + + @Override + public int getCount () + { + return results.getCount(); + } + + @Override + public ReferencedEnvelope getBounds () + { + return results.getBounds(); + } + + @Override + public SimpleFeatureType getSchema () + { + return results.getSchema(); + } + + @Override + public FeatureReader<SimpleFeatureType, SimpleFeature> reader () + { + return new MongoFeatureReader( results ); + } +} Property changes on: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureCollection.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id URL Added: svn:eol-style + native Added: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureReader.java =================================================================== --- trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureReader.java (rev 0) +++ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureReader.java 2011-12-08 14:22:32 UTC (rev 38411) @@ -0,0 +1,57 @@ +package org.geotools.data.mongodb; + +import org.geotools.data.FeatureReader; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; + +/** + * + * @author Gerald Gay, Data Tactics Corp. + * @source $URL$ + * + * (C) 2011, Open Source Geospatial Foundation (OSGeo) + * + * @see The GNU Lesser General Public License (LGPL) + */ +/* This library is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation; either version + * 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this library; + * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA */ +public class MongoFeatureReader implements FeatureReader<SimpleFeatureType, SimpleFeature> +{ + + private MongoResultSet results; + private int next = 0; + + public MongoFeatureReader (MongoResultSet rs) + { + results = rs; + } + + public void close () + { + } + + public boolean hasNext () + { + return (next < results.getCount()); + } + + public SimpleFeature next () + { + return results.getFeature( next++ ); + } + + public SimpleFeatureType getFeatureType () + { + return results.getSchema(); + } + +} Property changes on: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureReader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id URL Added: svn:eol-style + native Added: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureSource.java =================================================================== --- trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureSource.java (rev 0) +++ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureSource.java 2011-12-08 14:22:32 UTC (rev 38411) @@ -0,0 +1,181 @@ +package org.geotools.data.mongodb; + +import java.awt.RenderingHints; +import java.util.Collections; +import java.util.Set; + +import org.geotools.data.DataStore; +import org.geotools.data.FeatureListener; +import org.geotools.data.Query; +import org.geotools.data.QueryCapabilities; +import org.geotools.data.ResourceInfo; +import org.geotools.data.simple.SimpleFeatureCollection; +import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.geometry.jts.ReferencedEnvelope; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.feature.type.Name; +import org.opengis.filter.Filter; + +import com.mongodb.BasicDBObject; + +/** + * + * @author Gerald Gay, Data Tactics Corp. + * @author Alan Mangan, Data Tactics Corp. + * @source $URL$ + * + * (C) 2011, Open Source Geospatial Foundation (OSGeo) + * + * @see The GNU Lesser General Public License (LGPL) + */ +/* This library is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation; either version + * 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this library; + * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA */ +public class MongoFeatureSource implements SimpleFeatureSource +{ + + private MongoDataStore store; + private MongoLayer layer = null; + private MongoResultSet results = null; + private MongoQueryCaps queryCaps = new MongoQueryCaps(); + private MongoResourceInfo info = null; + + public MongoFeatureSource (MongoDataStore store, MongoLayer layer) + { + init( store, layer, null ); + } + + public MongoFeatureSource (MongoDataStore store, MongoLayer layer, BasicDBObject dbo) + { + init( store, layer, dbo ); + } + + private void init (MongoDataStore store, MongoLayer layer, BasicDBObject dbo) + { + this.store = store; + this.layer = layer; + BasicDBObject query = dbo; + if (query == null) + { + query = new BasicDBObject(); + } + results = new MongoResultSet( layer, query ); + info = new MongoResourceInfo( this ); + } + + public MongoLayer getLayer () + { + return layer; + } + + public ReferencedEnvelope getBounds () + { + return results.getBounds(); + } + + public Set<String> getKeywords () + { + return layer.getKeywords(); + } + + public final Set<RenderingHints.Key> getSupportedHints () + { + return Collections.emptySet(); + } + + public final int getCount (final Query query) + { + int res = 0; + FilterToMongoQuery f2m = new FilterToMongoQuery(); + Filter filter = query.getFilter(); + BasicDBObject dbo = (BasicDBObject) filter.accept( f2m, null ); + MongoResultSet rs = new MongoResultSet( layer, dbo ); + res = rs.getCount(); + return res; + } + + public final ReferencedEnvelope getBounds (final Query query) + { + FilterToMongoQuery f2m = new FilterToMongoQuery(); + Filter filter = query.getFilter(); + BasicDBObject dbo = (BasicDBObject) filter.accept( f2m, null ); + MongoResultSet rs = new MongoResultSet( layer, dbo ); + return rs.getBounds(); + } + + public final SimpleFeatureCollection getFeatures () + { + return new MongoFeatureCollection( results ); + } + + public final SimpleFeatureCollection getFeatures (final Filter filter) + { + FilterToMongoQuery f2m = new FilterToMongoQuery(); + BasicDBObject dbo = (BasicDBObject) filter.accept( f2m, null ); + MongoResultSet rs = new MongoResultSet( layer, dbo ); + return new MongoFeatureCollection( rs ); + } + + public final SimpleFeatureCollection getFeatures (final Query query) + { + FilterToMongoQuery f2m = new FilterToMongoQuery(); + Filter filter = query.getFilter(); + BasicDBObject dbo = (BasicDBObject) filter.accept( f2m, null ); + MongoResultSet rs = new MongoResultSet( layer, dbo ); + // check for paging; maxFeatures and/or startIndex + int maxFeatures = query.getMaxFeatures(); + if (maxFeatures > 0) + { + int startIndex = 0; + if (query.getStartIndex() != null) + { + startIndex = query.getStartIndex().intValue(); + } + rs.paginateFeatures( startIndex, maxFeatures ); + } + return new MongoFeatureCollection( rs ); + } + + public final SimpleFeatureType getSchema () + { + return layer.getSchema(); + } + + public final void addFeatureListener (final FeatureListener listener) + { + store.addListener( this, listener ); + } + + public final void removeFeatureListener (final FeatureListener listener) + { + store.removeListener( this, listener ); + } + + public final DataStore getDataStore () + { + return store; + } + + public QueryCapabilities getQueryCapabilities () + { + return queryCaps; + } + + public ResourceInfo getInfo () + { + return info; + } + + public Name getName () + { + return layer.getSchema().getName(); + } +} Property changes on: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoFeatureSource.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Id URL Added: svn:eol-style + native Added: trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoLayer.java =================================================================== --- trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoLayer.java (rev 0) +++ trunk/modules/unsupported/mongodb/src/main/java/org/geotools/data/mongodb/MongoLayer.java 2011-12-08 14:22:32 UTC (rev 38411) @@ -0,0 +1,601 @@ +package org.geotools.data.mongodb; + +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; +import java.util.logging.Logger; + +import org.bson.BSONObject; +import org.bson.BasicBSONObject; +import org.bson.types.BasicBSONList; +import org.geotools.feature.AttributeTypeBuilder; +import org.geotools.feature.simple.SimpleFeatureTypeBuilder; +import org.geotools.referencing.CRS; +import org.geotools.referencing.crs.DefaultGeographicCRS; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.feature.type.AttributeDescriptor; +import org.opengis.referencing.crs.CoordinateReferenceSystem; + +import com.mongodb.BasicDBList; +import com.mongodb.BasicDBObject; +import com.mongodb.Bytes; +import com.mongodb.DBCollection; +import com.mongodb.DBCursor; +import com.mongodb.DBObject; +import com.vividsolutions.jts.geom.GeometryCollection; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.MultiLineString; +import com.vividsolutions.jts.geom.MultiPoint; +import com.vividsolutions.jts.geom.MultiPolygon; +import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jts.geom.Polygon; + +/** + * Represents a GeoServer layer consisting of valid GeoJSON-encoded data from a mongoDB collection. + * (A single collection containing different geometry types (Point, Polygon etc.) may be represented + * by multiple layers.) + * + * @author Gerald Gay, Data Tactics Corp. + * @author Alan Mangan, Data Tactics Corp. + * @source $URL$ + * + * (C) 2011, Open Source Geospatial Foundation (OSGeo) + * + * @see The GNU Lesser General Public License (LGPL) + */ +/* This library is free software; you can redistribute it and/or modify it under the terms of the + * GNU Lesser General Public License as published by the Free Software Foundation; either version + * 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this library; + * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA */ +public class MongoLayer +{ + + private MongoPluginConfig config = null; + private String ... [truncated message content] |
|
From: <svn...@os...> - 2011-12-08 04:41:27
|
Author: jive
Date: 2011-12-07 20:41:21 -0800 (Wed, 07 Dec 2011)
New Revision: 38410
Modified:
tags/8.0-M4/modules/unsupported/pom.xml
Log:
comment out geogit; which pulls in 8-SNAPSHOTs
Modified: tags/8.0-M4/modules/unsupported/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/pom.xml 2011-12-08 03:32:01 UTC (rev 38409)
+++ tags/8.0-M4/modules/unsupported/pom.xml 2011-12-08 04:41:21 UTC (rev 38410)
@@ -177,9 +177,6 @@
</profile>
<profile>
<id>geogit-versioned</id>
- <activation>
- <property><name>all</name></property>
- </activation>
<modules>
<module>geogit-versioned</module>
</modules>
|
|
From: <svn...@os...> - 2011-12-08 03:32:10
|
Author: jive
Date: 2011-12-07 19:32:01 -0800 (Wed, 07 Dec 2011)
New Revision: 38409
Modified:
trunk/docs/pom.xml
Log:
bad docs stay on snapshot
Modified: trunk/docs/pom.xml
===================================================================
--- trunk/docs/pom.xml 2011-12-08 03:12:41 UTC (rev 38408)
+++ trunk/docs/pom.xml 2011-12-08 03:32:01 UTC (rev 38409)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>geotools</artifactId>
- <version>8.0-M5</version>
+ <version>8-SNAPSHOT</version>
</parent>
|
|
From: <svn...@os...> - 2011-12-08 03:12:50
|
Author: jive
Date: 2011-12-07 19:12:41 -0800 (Wed, 07 Dec 2011)
New Revision: 38408
Modified:
trunk/build/rename.xml
trunk/docs/pom.xml
trunk/docs/user/tutorial/advanced/artifacts/pom.xml
trunk/docs/user/tutorial/feature/artifacts/pom.xml
trunk/docs/user/tutorial/filter/artifacts/pom.xml
trunk/docs/user/tutorial/geometry/artifacts/pom.xml
trunk/docs/user/tutorial/map/artifacts/pom.xml
trunk/docs/user/tutorial/quickstart/artifacts/pom.xml
trunk/docs/user/tutorial/raster/artifacts/pom.xml
Log:
udpate rename script while converting docs over to 8.0-M4
Modified: trunk/build/rename.xml
===================================================================
--- trunk/build/rename.xml 2011-12-07 15:35:48 UTC (rev 38407)
+++ trunk/build/rename.xml 2011-12-08 03:12:41 UTC (rev 38408)
@@ -1,33 +1,45 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Rename" default="rename">
-
- <target name="rename">
- <replace dir=".">
+
+ <target name="rename" depends="code,doc,readme"
+ description="Update the version references in code, doc and readme"
+ />
+
+ <target name="code">
+ <replace dir="..">
<include name="**/pom.xml"/>
<replacefilter token="<version>8-SNAPSHOT</version>"
- value="<version>8.0-M4</version>"/>
+ value="<version>8.0-M5</version>"/>
</replace>
- <replace dir="./modules/library/metadata/src/main/java/org/geotools/factory">
+ <replace dir="../modules/library/metadata/src/main/java/org/geotools/factory">
<include name="GeoTools.java"/>
<replacefilter token="8-SNAPSHOT"
- value="8.0-M4"/>
+ value="8.0-M5"/>
</replace>
</target>
<target name="doc">
- <replace dir="./docs/user/tutorial/">
+ <replace dir="../docs/user/tutorial/">
<include name="**/pom.xml"/>
- <replacefilter token="<geotools.version>8.0-M3</geotools.version>"
- value="<geotools.version>8.0-M4</geotools.version>"/>
+ <replacefilter token="<geotools.version>8-SNAPSHOT</geotools.version>"
+ value="<geotools.version>8.0-M5</geotools.version>"/>
</replace>
- <replace dir="./docs/">
+ <replace dir="../docs/">
<include name="pom.xml"/>
- <replacefilter token="8.0-M3"
- value="8.0-M4"/>
+ <replacefilter token="8-SNAPSHOT"
+ value="8.0-M5"/>
</replace>
</target>
+
+ <target name="readme">
+ <replace file="../README.html">
+ <replacefilter token="@RELEASE@"
+ value="8.0-M5"/>
+ <replacefilter token="@DATE@"
+ value="Dec, 8th, 2011"/>
+ </replace>
+ </target>
-
</project>
Modified: trunk/docs/pom.xml
===================================================================
--- trunk/docs/pom.xml 2011-12-07 15:35:48 UTC (rev 38407)
+++ trunk/docs/pom.xml 2011-12-08 03:12:41 UTC (rev 38408)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>geotools</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M5</version>
</parent>
@@ -240,7 +240,7 @@
<ant antfile="build.xml" dir="${basedir}" target="${target}">
<property name="build.directory" value="${build.directory}"/>
<!-- may be ${project.version} when tagged -->
- <property name="project.version" value="8.0-M3"/>
+ <property name="project.version" value="8.0-M4"/>
</ant>
</tasks>
</configuration>
Modified: trunk/docs/user/tutorial/advanced/artifacts/pom.xml
===================================================================
--- trunk/docs/user/tutorial/advanced/artifacts/pom.xml 2011-12-07 15:35:48 UTC (rev 38407)
+++ trunk/docs/user/tutorial/advanced/artifacts/pom.xml 2011-12-08 03:12:41 UTC (rev 38408)
@@ -11,7 +11,7 @@
<url>http://maven.apache.org</url>
<properties>
- <geotools.version>8.0-M3</geotools.version>
+ <geotools.version>8.0-M4</geotools.version>
</properties>
<dependencies>
Modified: trunk/docs/user/tutorial/feature/artifacts/pom.xml
===================================================================
--- trunk/docs/user/tutorial/feature/artifacts/pom.xml 2011-12-07 15:35:48 UTC (rev 38407)
+++ trunk/docs/user/tutorial/feature/artifacts/pom.xml 2011-12-08 03:12:41 UTC (rev 38408)
@@ -11,7 +11,7 @@
<url>http://maven.apache.org</url>
<properties>
- <geotools.version>8.0-M3</geotools.version>
+ <geotools.version>8.0-M4</geotools.version>
</properties>
<dependencies>
Modified: trunk/docs/user/tutorial/filter/artifacts/pom.xml
===================================================================
--- trunk/docs/user/tutorial/filter/artifacts/pom.xml 2011-12-07 15:35:48 UTC (rev 38407)
+++ trunk/docs/user/tutorial/filter/artifacts/pom.xml 2011-12-08 03:12:41 UTC (rev 38408)
@@ -11,7 +11,7 @@
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <geotools.version>8.0-M3</geotools.version>
+ <geotools.version>8.0-M4</geotools.version>
</properties>
<dependencies>
<!-- Provides map projections -->
Modified: trunk/docs/user/tutorial/geometry/artifacts/pom.xml
===================================================================
--- trunk/docs/user/tutorial/geometry/artifacts/pom.xml 2011-12-07 15:35:48 UTC (rev 38407)
+++ trunk/docs/user/tutorial/geometry/artifacts/pom.xml 2011-12-08 03:12:41 UTC (rev 38408)
@@ -11,7 +11,7 @@
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <geotools.version>8.0-M3</geotools.version>
+ <geotools.version>8.0-M4</geotools.version>
</properties>
<dependencies>
<dependency>
Modified: trunk/docs/user/tutorial/map/artifacts/pom.xml
===================================================================
--- trunk/docs/user/tutorial/map/artifacts/pom.xml 2011-12-07 15:35:48 UTC (rev 38407)
+++ trunk/docs/user/tutorial/map/artifacts/pom.xml 2011-12-08 03:12:41 UTC (rev 38408)
@@ -11,7 +11,7 @@
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <geotools.version>8.0-M3</geotools.version>
+ <geotools.version>8.0-M4</geotools.version>
</properties>
<dependencies>
<dependency>
Modified: trunk/docs/user/tutorial/quickstart/artifacts/pom.xml
===================================================================
--- trunk/docs/user/tutorial/quickstart/artifacts/pom.xml 2011-12-07 15:35:48 UTC (rev 38407)
+++ trunk/docs/user/tutorial/quickstart/artifacts/pom.xml 2011-12-08 03:12:41 UTC (rev 38408)
@@ -11,7 +11,7 @@
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <geotools.version>8.0-M3</geotools.version>
+ <geotools.version>8.0-M4</geotools.version>
</properties>
<dependencies>
<dependency>
Modified: trunk/docs/user/tutorial/raster/artifacts/pom.xml
===================================================================
--- trunk/docs/user/tutorial/raster/artifacts/pom.xml 2011-12-07 15:35:48 UTC (rev 38407)
+++ trunk/docs/user/tutorial/raster/artifacts/pom.xml 2011-12-08 03:12:41 UTC (rev 38408)
@@ -11,7 +11,7 @@
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <geotools.version>8.0-M3</geotools.version>
+ <geotools.version>8.0-M4</geotools.version>
</properties>
<dependencies>
<dependency>
|
|
From: <svn...@os...> - 2011-12-07 15:35:59
|
Author: jive Date: 2011-12-07 07:35:48 -0800 (Wed, 07 Dec 2011) New Revision: 38407 Modified: tags/8.0-M4/README.html Log: Update README links for 8.0-M4 Modified: tags/8.0-M4/README.html =================================================================== --- tags/8.0-M4/README.html 2011-12-07 15:35:00 UTC (rev 38406) +++ tags/8.0-M4/README.html 2011-12-07 15:35:48 UTC (rev 38407) @@ -2,11 +2,11 @@ <HTML> <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> - <TITLE>GeoTools @RELEASE@ README</TITLE> + <TITLE>GeoTools 8.0-M4 README</TITLE> <META NAME="GENERATOR" CONTENT="LibreOffice 3.3 (Linux)"> <META NAME="CREATED" CONTENT="0;0"> <META NAME="CHANGEDBY" CONTENT="Jody Garnett"> - <META NAME="CHANGED" CONTENT="20110428;21541200"> + <META NAME="CHANGED" CONTENT="20111212;21541200"> <META NAME="CocoaVersion" CONTENT="1038.11"> <META NAME="CHANGEDBY" CONTENT="Jody Garnett"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> @@ -23,9 +23,9 @@ </HEAD> <BODY LANG="en-AU" DIR="LTR"> <a href="http://geotools.org"><img src="geotools-logo.png"></a> -<H1 CLASS="western">GeoTools @RELEASE@</H1> -<P>Thank you for downloading GeoTools @RELEASE@. This release was -created on @DATE@.</P> +<H1 CLASS="western">GeoTools 8.0-M4</H1> +<P>Thank you for downloading GeoTools 8.0-M4. This release was +created on Dec 8th, 2011.</P> <P>This release contains only a subset of the current GeoTools code base. The full GeoTools code base contains additional unsupported @@ -54,7 +54,6 @@ <LI>Additional <A HREF="http://docs.geotools.org/latest/userguide/tutorial/advanced/index.html">advanced tutorials</A> cover topics such as making your own function, process or datastore.</LI> </UL> - <P>Welcome to GeoTools development!</P> <H2 CLASS="western">Reference</H2> <P>For full details on requirements and build process please see the @@ -70,7 +69,7 @@ some formats require the ImageIO-Ext additions which explicitly support raster formats such as MRSID and ECW. Detailed instructions on configuring your JDK with these optional extensions can be found -in our developers guide <A HREF="http://docs.geotools.org/latest/developer/guide/building/install/jdk.html">here</A>.</P> +in our developers guide <A HREF="http://docs.geotools.org/latest/userguide/advanced/build/install/jdk.html">here</A>.</P> <H3 CLASS="western">Oracle (Optional)</H3> <P>In order to use the gt-oracle or gt-jdbc-oracle modules, you need the Oracle JDBC driver from Oracle. Unlike most external libraries @@ -97,7 +96,7 @@ <A HREF="http://docs.geotools.org/latest/userguide/welcome/support.html">support options</A> are available in the user guide.</P> <P>If you are interested in the future development of GeoTools then -feel free to join the <A HREF="http://docs.geotools.org/latest/developer/guide/communication.html">geotools-devel</A> +feel free to join the <A HREF="http://docs.geotools.org/latest/developer/communication.html">geotools-devel</A> mailing list. We welcome contributions of new modules as well as keen developers who want to work on the project as a whole.</P> <P>You can find out more about the mailing lists and recent news by |
|
From: <svn...@os...> - 2011-12-07 15:35:12
|
Author: jive Date: 2011-12-07 07:35:00 -0800 (Wed, 07 Dec 2011) New Revision: 38406 Modified: trunk/README.html Log: Fix links in README.html Modified: trunk/README.html =================================================================== --- trunk/README.html 2011-12-07 15:18:24 UTC (rev 38405) +++ trunk/README.html 2011-12-07 15:35:00 UTC (rev 38406) @@ -32,6 +32,7 @@ modules covering experiments with a range of additional data formats. Only the modules which are considered to be stable have been included in this release.</P> + <P>For more information, and documentation on the GeoTools library please see the <A HREF="http://docs.geotools.org/latest/userguide/">GeoTools User Guide</A>.</P> @@ -54,7 +55,6 @@ <LI>Additional <A HREF="http://docs.geotools.org/latest/userguide/tutorial/advanced/index.html">advanced tutorials</A> cover topics such as making your own function, process or datastore.</LI> </UL> - <P>Welcome to GeoTools development!</P> <H2 CLASS="western">Reference</H2> <P>For full details on requirements and build process please see the @@ -70,7 +70,7 @@ some formats require the ImageIO-Ext additions which explicitly support raster formats such as MRSID and ECW. Detailed instructions on configuring your JDK with these optional extensions can be found -in our developers guide <A HREF="http://docs.geotools.org/latest/developer/guide/building/install/jdk.html">here</A>.</P> +in our developers guide <A HREF="http://docs.geotools.org/latest/userguide/advanced/build/install/jdk.html">here</A>.</P> <H3 CLASS="western">Oracle (Optional)</H3> <P>In order to use the gt-oracle or gt-jdbc-oracle modules, you need the Oracle JDBC driver from Oracle. Unlike most external libraries @@ -97,7 +97,7 @@ <A HREF="http://docs.geotools.org/latest/userguide/welcome/support.html">support options</A> are available in the user guide.</P> <P>If you are interested in the future development of GeoTools then -feel free to join the <A HREF="http://docs.geotools.org/latest/developer/guide/communication.html">geotools-devel</A> +feel free to join the <A HREF="http://docs.geotools.org/latest/developer/communication.html">geotools-devel</A> mailing list. We welcome contributions of new modules as well as keen developers who want to work on the project as a whole.</P> <P>You can find out more about the mailing lists and recent news by |
Author: jive
Date: 2011-12-07 07:18:24 -0800 (Wed, 07 Dec 2011)
New Revision: 38405
Modified:
tags/8.0-M4/build/maven/jar-collector/pom.xml
tags/8.0-M4/build/maven/javadoc/pom.xml
tags/8.0-M4/build/maven/jjtree-javacc/pom.xml
tags/8.0-M4/build/maven/pom.xml
tags/8.0-M4/build/maven/xmlcodegen/pom.xml
tags/8.0-M4/build/pom.xml
tags/8.0-M4/docs/pom.xml
tags/8.0-M4/modules/extension/app-schema/app-schema-example/pom.xml
tags/8.0-M4/modules/extension/app-schema/app-schema-packages/pom.xml
tags/8.0-M4/modules/extension/app-schema/app-schema-resolver/pom.xml
tags/8.0-M4/modules/extension/app-schema/app-schema/pom.xml
tags/8.0-M4/modules/extension/app-schema/pom.xml
tags/8.0-M4/modules/extension/app-schema/sample-data-access/pom.xml
tags/8.0-M4/modules/extension/brewer/pom.xml
tags/8.0-M4/modules/extension/graph/pom.xml
tags/8.0-M4/modules/extension/pom.xml
tags/8.0-M4/modules/extension/validation/pom.xml
tags/8.0-M4/modules/extension/wms/pom.xml
tags/8.0-M4/modules/extension/xsd/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-core/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-fes/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-filter/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-gml2/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-gml3/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-kml/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-ows/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-sld/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-wcs/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-wfs/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-wms/pom.xml
tags/8.0-M4/modules/extension/xsd/xsd-wps/pom.xml
tags/8.0-M4/modules/library/api/pom.xml
tags/8.0-M4/modules/library/coverage/pom.xml
tags/8.0-M4/modules/library/cql/pom.xml
tags/8.0-M4/modules/library/data/pom.xml
tags/8.0-M4/modules/library/jdbc/pom.xml
tags/8.0-M4/modules/library/main/pom.xml
tags/8.0-M4/modules/library/metadata/pom.xml
tags/8.0-M4/modules/library/metadata/src/main/java/org/geotools/factory/GeoTools.java
tags/8.0-M4/modules/library/opengis/pom.xml
tags/8.0-M4/modules/library/pom.xml
tags/8.0-M4/modules/library/referencing/pom.xml
tags/8.0-M4/modules/library/render/pom.xml
tags/8.0-M4/modules/library/sample-data/pom.xml
tags/8.0-M4/modules/library/xml/pom.xml
tags/8.0-M4/modules/ogc/net.opengis.fes/pom.xml
tags/8.0-M4/modules/ogc/net.opengis.ows/pom.xml
tags/8.0-M4/modules/ogc/net.opengis.wcs/pom.xml
tags/8.0-M4/modules/ogc/net.opengis.wfs/pom.xml
tags/8.0-M4/modules/ogc/net.opengis.wfsv/pom.xml
tags/8.0-M4/modules/ogc/net.opengis.wps/pom.xml
tags/8.0-M4/modules/ogc/org.w3.xlink/pom.xml
tags/8.0-M4/modules/ogc/pom.xml
tags/8.0-M4/modules/plugin/arcgrid/pom.xml
tags/8.0-M4/modules/plugin/arcsde/common/pom.xml
tags/8.0-M4/modules/plugin/arcsde/datastore/pom.xml
tags/8.0-M4/modules/plugin/arcsde/pom.xml
tags/8.0-M4/modules/plugin/arcsde/sde-dummy/pom.xml
tags/8.0-M4/modules/plugin/charts/pom.xml
tags/8.0-M4/modules/plugin/epsg-extension/pom.xml
tags/8.0-M4/modules/plugin/epsg-hsql/pom.xml
tags/8.0-M4/modules/plugin/epsg-postgresql/pom.xml
tags/8.0-M4/modules/plugin/epsg-wkt/pom.xml
tags/8.0-M4/modules/plugin/feature-pregeneralized/pom.xml
tags/8.0-M4/modules/plugin/geotiff/pom.xml
tags/8.0-M4/modules/plugin/grassraster/pom.xml
tags/8.0-M4/modules/plugin/gtopo30/pom.xml
tags/8.0-M4/modules/plugin/image/pom.xml
tags/8.0-M4/modules/plugin/imageio-ext-gdal/pom.xml
tags/8.0-M4/modules/plugin/imagemosaic-jdbc/pom.xml
tags/8.0-M4/modules/plugin/imagemosaic/pom.xml
tags/8.0-M4/modules/plugin/imagepyramid/pom.xml
tags/8.0-M4/modules/plugin/jdbc/jdbc-db2/pom.xml
tags/8.0-M4/modules/plugin/jdbc/jdbc-h2/pom.xml
tags/8.0-M4/modules/plugin/jdbc/jdbc-mysql/pom.xml
tags/8.0-M4/modules/plugin/jdbc/jdbc-oracle/pom.xml
tags/8.0-M4/modules/plugin/jdbc/jdbc-postgis/pom.xml
tags/8.0-M4/modules/plugin/jdbc/jdbc-spatialite/pom.xml
tags/8.0-M4/modules/plugin/jdbc/jdbc-sqlserver/pom.xml
tags/8.0-M4/modules/plugin/jdbc/jdbc-teradata/pom.xml
tags/8.0-M4/modules/plugin/jdbc/pom.xml
tags/8.0-M4/modules/plugin/jp2k/pom.xml
tags/8.0-M4/modules/plugin/pom.xml
tags/8.0-M4/modules/plugin/property/pom.xml
tags/8.0-M4/modules/plugin/referencing3D/pom.xml
tags/8.0-M4/modules/plugin/shapefile/pom.xml
tags/8.0-M4/modules/plugin/svg/pom.xml
tags/8.0-M4/modules/pom.xml
tags/8.0-M4/modules/unsupported/app-schema/pom.xml
tags/8.0-M4/modules/unsupported/app-schema/webservice/pom.xml
tags/8.0-M4/modules/unsupported/caching/pom.xml
tags/8.0-M4/modules/unsupported/couchdb/pom.xml
tags/8.0-M4/modules/unsupported/coverage-experiment/coverage-api/pom.xml
tags/8.0-M4/modules/unsupported/coverage-experiment/coverage-core/pom.xml
tags/8.0-M4/modules/unsupported/coverage-experiment/grib1/pom.xml
tags/8.0-M4/modules/unsupported/coverage-experiment/hdf4/pom.xml
tags/8.0-M4/modules/unsupported/coverage-experiment/netcdf/pom.xml
tags/8.0-M4/modules/unsupported/coverage-experiment/pom.xml
tags/8.0-M4/modules/unsupported/coveragetools/pom.xml
tags/8.0-M4/modules/unsupported/csv/pom.xml
tags/8.0-M4/modules/unsupported/dxf/pom.xml
tags/8.0-M4/modules/unsupported/edigeo/pom.xml
tags/8.0-M4/modules/unsupported/efeature/pom.xml
tags/8.0-M4/modules/unsupported/epsg-h2/pom.xml
tags/8.0-M4/modules/unsupported/epsg-oracle/pom.xml
tags/8.0-M4/modules/unsupported/example/pom.xml
tags/8.0-M4/modules/unsupported/excel/pom.xml
tags/8.0-M4/modules/unsupported/feature-aggregate/pom.xml
tags/8.0-M4/modules/unsupported/geogit-versioned/pom.xml
tags/8.0-M4/modules/unsupported/geojson/pom.xml
tags/8.0-M4/modules/unsupported/geometry/pom.xml
tags/8.0-M4/modules/unsupported/georest/pom.xml
tags/8.0-M4/modules/unsupported/geotiff_new/pom.xml
tags/8.0-M4/modules/unsupported/grid/pom.xml
tags/8.0-M4/modules/unsupported/imagecollection/pom.xml
tags/8.0-M4/modules/unsupported/jdbc-ng/jdbc-ingres/pom.xml
tags/8.0-M4/modules/unsupported/jdbc-ng/pom.xml
tags/8.0-M4/modules/unsupported/jts-wrapper/pom.xml
tags/8.0-M4/modules/unsupported/mark-wkt/pom.xml
tags/8.0-M4/modules/unsupported/matfile5/pom.xml
tags/8.0-M4/modules/unsupported/ogr/pom.xml
tags/8.0-M4/modules/unsupported/pom.xml
tags/8.0-M4/modules/unsupported/postgis-versioned/pom.xml
tags/8.0-M4/modules/unsupported/process-feature/pom.xml
tags/8.0-M4/modules/unsupported/process-geometry/pom.xml
tags/8.0-M4/modules/unsupported/process-raster/pom.xml
tags/8.0-M4/modules/unsupported/process/pom.xml
tags/8.0-M4/modules/unsupported/property-ng/pom.xml
tags/8.0-M4/modules/unsupported/sfs/pom.xml
tags/8.0-M4/modules/unsupported/shapefile-ng/pom.xml
tags/8.0-M4/modules/unsupported/shapefile-renderer/pom.xml
tags/8.0-M4/modules/unsupported/swing/pom.xml
tags/8.0-M4/modules/unsupported/swt/pom.xml
tags/8.0-M4/modules/unsupported/vpf/pom.xml
tags/8.0-M4/modules/unsupported/wfs-ng/pom.xml
tags/8.0-M4/modules/unsupported/wfs/pom.xml
tags/8.0-M4/modules/unsupported/wps/pom.xml
tags/8.0-M4/pom.xml
tags/8.0-M4/spike/jan/gsoc-transformations/pom.xml
Log:
Changed to 8.0-M4
Modified: tags/8.0-M4/build/maven/jar-collector/pom.xml
===================================================================
--- tags/8.0-M4/build/maven/jar-collector/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/build/maven/jar-collector/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.maven</groupId>
<artifactId>maven</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/build/maven/javadoc/pom.xml
===================================================================
--- tags/8.0-M4/build/maven/javadoc/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/build/maven/javadoc/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.maven</groupId>
<artifactId>maven</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/build/maven/jjtree-javacc/pom.xml
===================================================================
--- tags/8.0-M4/build/maven/jjtree-javacc/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/build/maven/jjtree-javacc/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.maven</groupId>
<artifactId>maven</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/build/maven/pom.xml
===================================================================
--- tags/8.0-M4/build/maven/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/build/maven/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.maven</groupId>
<artifactId>build</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/build/maven/xmlcodegen/pom.xml
===================================================================
--- tags/8.0-M4/build/maven/xmlcodegen/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/build/maven/xmlcodegen/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.maven</groupId>
<artifactId>maven</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/build/pom.xml
===================================================================
--- tags/8.0-M4/build/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/build/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>geotools</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/docs/pom.xml
===================================================================
--- tags/8.0-M4/docs/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/docs/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>geotools</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/app-schema/app-schema/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/app-schema/app-schema/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/app-schema/app-schema/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>app-schema</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools</groupId>
Modified: tags/8.0-M4/modules/extension/app-schema/app-schema-example/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/app-schema/app-schema-example/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/app-schema/app-schema-example/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>app-schema</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/app-schema/app-schema-packages/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/app-schema/app-schema-packages/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/app-schema/app-schema-packages/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>app-schema</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools</groupId>
Modified: tags/8.0-M4/modules/extension/app-schema/app-schema-resolver/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/app-schema/app-schema-resolver/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/app-schema/app-schema-resolver/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>app-schema</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools</groupId>
Modified: tags/8.0-M4/modules/extension/app-schema/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/app-schema/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/app-schema/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>extension</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools</groupId>
Modified: tags/8.0-M4/modules/extension/app-schema/sample-data-access/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/app-schema/sample-data-access/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/app-schema/sample-data-access/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -7,7 +7,7 @@
<parent>
<artifactId>app-schema</artifactId>
<groupId>org.geotools</groupId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools</groupId>
Modified: tags/8.0-M4/modules/extension/brewer/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/brewer/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/brewer/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>extension</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/graph/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/graph/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/graph/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>extension</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>modules</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/validation/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/validation/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/validation/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>extension</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/wms/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/wms/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/wms/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>extension</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/xsd/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>extension</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/xsd/xsd-core/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-core/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-core/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/xsd/xsd-fes/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-fes/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-fes/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/xsd/xsd-filter/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-filter/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-filter/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/xsd/xsd-gml2/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-gml2/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-gml2/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/extension/xsd/xsd-gml3/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-gml3/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-gml3/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/xsd/xsd-kml/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-kml/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-kml/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/extension/xsd/xsd-ows/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-ows/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-ows/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
@@ -71,7 +71,7 @@
<dependency>
<groupId>org.geotools.ogc</groupId>
<artifactId>net.opengis.ows</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</dependency>
<dependency>
<groupId>org.geotools.xsd</groupId>
Modified: tags/8.0-M4/modules/extension/xsd/xsd-sld/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-sld/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-sld/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/extension/xsd/xsd-wcs/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-wcs/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-wcs/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/extension/xsd/xsd-wfs/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-wfs/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-wfs/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/extension/xsd/xsd-wms/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-wms/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-wms/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/extension/xsd/xsd-wps/pom.xml
===================================================================
--- tags/8.0-M4/modules/extension/xsd/xsd-wps/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/extension/xsd/xsd-wps/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.xsd</groupId>
<artifactId>xsd</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/library/api/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/api/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/api/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/coverage/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/coverage/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/coverage/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/cql/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/cql/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/cql/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/data/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/data/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/data/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/jdbc/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/jdbc/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/jdbc/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/main/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/main/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/main/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/metadata/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/metadata/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/metadata/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/metadata/src/main/java/org/geotools/factory/GeoTools.java
===================================================================
--- tags/8.0-M4/modules/library/metadata/src/main/java/org/geotools/factory/GeoTools.java 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/metadata/src/main/java/org/geotools/factory/GeoTools.java 2011-12-07 15:18:24 UTC (rev 38405)
@@ -91,7 +91,7 @@
/**
* The current GeoTools version. The separator character must be the dot.
*/
- private static final Version VERSION = new Version(PROPS.getProperty("version", "8-SNAPSHOT"));
+ private static final Version VERSION = new Version(PROPS.getProperty("version", "8.0-M4"));
/**
* The version control (svn) revision at which this version of geotools was built.
Modified: tags/8.0-M4/modules/library/opengis/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/opengis/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/opengis/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>modules</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/referencing/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/referencing/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/referencing/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/render/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/render/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/render/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/sample-data/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/sample-data/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/sample-data/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/library/xml/pom.xml
===================================================================
--- tags/8.0-M4/modules/library/xml/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/library/xml/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>library</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/ogc/net.opengis.fes/pom.xml
===================================================================
--- tags/8.0-M4/modules/ogc/net.opengis.fes/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/ogc/net.opengis.fes/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>ogc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools.ogc</groupId>
Modified: tags/8.0-M4/modules/ogc/net.opengis.ows/pom.xml
===================================================================
--- tags/8.0-M4/modules/ogc/net.opengis.ows/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/ogc/net.opengis.ows/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>ogc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools.ogc</groupId>
@@ -28,7 +28,7 @@
<dependency>
<groupId>org.geotools.ogc</groupId>
<artifactId>org.w3.xlink</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</dependency>
</dependencies>
Modified: tags/8.0-M4/modules/ogc/net.opengis.wcs/pom.xml
===================================================================
--- tags/8.0-M4/modules/ogc/net.opengis.wcs/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/ogc/net.opengis.wcs/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>ogc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools.ogc</groupId>
Modified: tags/8.0-M4/modules/ogc/net.opengis.wfs/pom.xml
===================================================================
--- tags/8.0-M4/modules/ogc/net.opengis.wfs/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/ogc/net.opengis.wfs/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>ogc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools.ogc</groupId>
Modified: tags/8.0-M4/modules/ogc/net.opengis.wfsv/pom.xml
===================================================================
--- tags/8.0-M4/modules/ogc/net.opengis.wfsv/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/ogc/net.opengis.wfsv/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>ogc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools.ogc</groupId>
@@ -28,7 +28,7 @@
<dependency>
<groupId>org.geotools.ogc</groupId>
<artifactId>net.opengis.wfs</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</dependency>
</dependencies>
Modified: tags/8.0-M4/modules/ogc/net.opengis.wps/pom.xml
===================================================================
--- tags/8.0-M4/modules/ogc/net.opengis.wps/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/ogc/net.opengis.wps/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>ogc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools.ogc</groupId>
Modified: tags/8.0-M4/modules/ogc/org.w3.xlink/pom.xml
===================================================================
--- tags/8.0-M4/modules/ogc/org.w3.xlink/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/ogc/org.w3.xlink/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>ogc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools.ogc</groupId>
Modified: tags/8.0-M4/modules/ogc/pom.xml
===================================================================
--- tags/8.0-M4/modules/ogc/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/ogc/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>modules</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools</groupId>
Modified: tags/8.0-M4/modules/plugin/arcgrid/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/arcgrid/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/arcgrid/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/arcsde/common/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/arcsde/common/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/arcsde/common/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>arcsde-plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/arcsde/datastore/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/arcsde/datastore/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/arcsde/datastore/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>arcsde-plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/arcsde/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/arcsde/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/arcsde/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/arcsde/sde-dummy/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/arcsde/sde-dummy/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/arcsde/sde-dummy/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>arcsde-plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/charts/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/charts/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/charts/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/epsg-extension/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/epsg-extension/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/epsg-extension/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/epsg-hsql/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/epsg-hsql/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/epsg-hsql/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/epsg-postgresql/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/epsg-postgresql/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/epsg-postgresql/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/epsg-wkt/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/epsg-wkt/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/epsg-wkt/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/feature-pregeneralized/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/feature-pregeneralized/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/feature-pregeneralized/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/geotiff/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/geotiff/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/geotiff/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/grassraster/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/grassraster/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/grassraster/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/gtopo30/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/gtopo30/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/gtopo30/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/image/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/image/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/image/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/imageio-ext-gdal/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/imageio-ext-gdal/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/imageio-ext-gdal/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/plugin/imagemosaic/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/imagemosaic/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/imagemosaic/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/imagemosaic-jdbc/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/imagemosaic-jdbc/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/imagemosaic-jdbc/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/imagepyramid/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/imagepyramid/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/imagepyramid/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!--properties>
Modified: tags/8.0-M4/modules/plugin/jdbc/jdbc-db2/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/jdbc/jdbc-db2/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/jdbc/jdbc-db2/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.jdbc</groupId>
<artifactId>gt-jdbc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/jdbc/jdbc-h2/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/jdbc/jdbc-h2/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/jdbc/jdbc-h2/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.jdbc</groupId>
<artifactId>gt-jdbc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/jdbc/jdbc-mysql/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/jdbc/jdbc-mysql/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/jdbc/jdbc-mysql/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.jdbc</groupId>
<artifactId>gt-jdbc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/jdbc/jdbc-oracle/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/jdbc/jdbc-oracle/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/jdbc/jdbc-oracle/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.jdbc</groupId>
<artifactId>gt-jdbc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/jdbc/jdbc-postgis/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/jdbc/jdbc-postgis/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/jdbc/jdbc-postgis/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.jdbc</groupId>
<artifactId>gt-jdbc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/jdbc/jdbc-spatialite/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/jdbc/jdbc-spatialite/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/jdbc/jdbc-spatialite/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.jdbc</groupId>
<artifactId>gt-jdbc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/jdbc/jdbc-sqlserver/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/jdbc/jdbc-sqlserver/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/jdbc/jdbc-sqlserver/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.jdbc</groupId>
<artifactId>gt-jdbc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/jdbc/jdbc-teradata/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/jdbc/jdbc-teradata/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/jdbc/jdbc-teradata/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools.jdbc</groupId>
<artifactId>gt-jdbc</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/jdbc/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/jdbc/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/jdbc/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/jp2k/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/jp2k/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/jp2k/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -15,7 +15,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>modules</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/plugin/property/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/property/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/property/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/referencing3D/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/referencing3D/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/referencing3D/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/shapefile/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/shapefile/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/shapefile/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/plugin/svg/pom.xml
===================================================================
--- tags/8.0-M4/modules/plugin/svg/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/plugin/svg/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>plugin</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/pom.xml
===================================================================
--- tags/8.0-M4/modules/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>geotools</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/unsupported/app-schema/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/app-schema/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/app-schema/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>unsupported</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools</groupId>
Modified: tags/8.0-M4/modules/unsupported/app-schema/webservice/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/app-schema/webservice/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/app-schema/webservice/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -7,7 +7,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>app-schema-unsupported</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools</groupId>
Modified: tags/8.0-M4/modules/unsupported/caching/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/caching/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/caching/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>unsupported</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/unsupported/couchdb/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/couchdb/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/couchdb/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -5,12 +5,12 @@
<parent>
<artifactId>unsupported</artifactId>
<groupId>org.geotools</groupId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<groupId>org.geotools</groupId>
<artifactId>gt-couchdb</artifactId>
<packaging>jar</packaging>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
<name>Couchdb Data Store</name>
<url>http://maven.apache.org</url>
<description>CouchDB DataStore</description>
@@ -28,7 +28,7 @@
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geojson</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Modified: tags/8.0-M4/modules/unsupported/coverage-experiment/coverage-api/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/coverage-experiment/coverage-api/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/coverage-experiment/coverage-api/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>gt-coverage-experiment</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/unsupported/coverage-experiment/coverage-core/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/coverage-experiment/coverage-core/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/coverage-experiment/coverage-core/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>gt-coverage-experiment</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/unsupported/coverage-experiment/grib1/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/coverage-experiment/grib1/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/coverage-experiment/grib1/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>gt-coverage-experiment</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/unsupported/coverage-experiment/hdf4/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/coverage-experiment/hdf4/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/coverage-experiment/hdf4/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>gt-coverage-experiment</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/unsupported/coverage-experiment/netcdf/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/coverage-experiment/netcdf/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/coverage-experiment/netcdf/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>gt-coverage-experiment</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/unsupported/coverage-experiment/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/coverage-experiment/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/coverage-experiment/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>unsupported</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/unsupported/coveragetools/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/coveragetools/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/coveragetools/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>unsupported</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<profiles>
Modified: tags/8.0-M4/modules/unsupported/csv/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/csv/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/csv/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -8,7 +8,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>unsupported</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
<!-- =========================================================== -->
Modified: tags/8.0-M4/modules/unsupported/dxf/pom.xml
===================================================================
--- tags/8.0-M4/modules/unsupported/dxf/pom.xml 2011-12-07 11:36:39 UTC (rev 38404)
+++ tags/8.0-M4/modules/unsupported/dxf/pom.xml 2011-12-07 15:18:24 UTC (rev 38405)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.geotools</groupId>
<artifactId>unsupported</artifactId>
- <version>8-SNAPSHOT</version>
+ <version>8.0-M4</version>
</parent>
Modified: tags/8.0-M4/modules/unsupported/edigeo/pom.xml
======================================================...
[truncated message content] |
|
From: <svn...@os...> - 2011-12-07 11:36:46
|
Author: jive Date: 2011-12-07 03:36:39 -0800 (Wed, 07 Dec 2011) New Revision: 38404 Added: tags/8.0-M4/ Log: Starting the 8.0-M4 release train Property changes on: tags/8.0-M4 ___________________________________________________________________ Added: svn:ignore + .project .settings .classpath .jetproperties .wtpmodules target bin cobertura.ser nbproject nbactions.xml target.list .featurelock.patch.swp Added: svn:mergeinfo + /branches/simple-features:35278-35308 |