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...> - 2012-02-15 13:04:27
|
Author: aaime
Date: 2012-02-15 05:04:15 -0800 (Wed, 15 Feb 2012)
New Revision: 38573
Modified:
branches/2.7.x/modules/library/data/src/main/java/org/geotools/data/directory/DirectoryTypeCache.java
Log:
Get better error message if the feature type we're looking for is not there
Modified: branches/2.7.x/modules/library/data/src/main/java/org/geotools/data/directory/DirectoryTypeCache.java
===================================================================
--- branches/2.7.x/modules/library/data/src/main/java/org/geotools/data/directory/DirectoryTypeCache.java 2012-02-15 13:04:00 UTC (rev 38572)
+++ branches/2.7.x/modules/library/data/src/main/java/org/geotools/data/directory/DirectoryTypeCache.java 2012-02-15 13:04:15 UTC (rev 38573)
@@ -127,7 +127,12 @@
updateCache();
// TODO: check about re-creating the datastore when the cache
// is turned into a soft map
- return ftCache.get(typeName).getStore(true);
+ FileEntry entry = ftCache.get(typeName);
+ if(entry != null) {
+ return entry.getStore(true);
+ } else {
+ return null;
+ }
} finally {
lock.readLock().unlock();
}
|
Author: aaime
Date: 2012-02-15 05:04:00 -0800 (Wed, 15 Feb 2012)
New Revision: 38572
Added:
branches/2.7.x/modules/unsupported/imagecollection/
branches/2.7.x/modules/unsupported/imagecollection/pom.xml
Modified:
branches/2.7.x/modules/plugin/imagemosaic/pom.xml
branches/2.7.x/modules/plugin/imagepyramid/pom.xml
branches/2.7.x/modules/plugin/jp2k/pom.xml
branches/2.7.x/modules/unsupported/coveragetools/pom.xml
branches/2.7.x/modules/unsupported/geotiff_new/pom.xml
branches/2.7.x/pom.xml
Log:
[GEOT-4044] Upgrade commons-io to version 2.1
Modified: branches/2.7.x/modules/plugin/imagemosaic/pom.xml
===================================================================
--- branches/2.7.x/modules/plugin/imagemosaic/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
+++ branches/2.7.x/modules/plugin/imagemosaic/pom.xml 2012-02-15 13:04:00 UTC (rev 38572)
@@ -190,7 +190,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
</dependencies>
<build>
Modified: branches/2.7.x/modules/plugin/imagepyramid/pom.xml
===================================================================
--- branches/2.7.x/modules/plugin/imagepyramid/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
+++ branches/2.7.x/modules/plugin/imagepyramid/pom.xml 2012-02-15 13:04:00 UTC (rev 38572)
@@ -84,7 +84,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
Modified: branches/2.7.x/modules/plugin/jp2k/pom.xml
===================================================================
--- branches/2.7.x/modules/plugin/jp2k/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
+++ branches/2.7.x/modules/plugin/jp2k/pom.xml 2012-02-15 13:04:00 UTC (rev 38572)
@@ -116,7 +116,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
</dependencies>
</project>
Modified: branches/2.7.x/modules/unsupported/coveragetools/pom.xml
===================================================================
--- branches/2.7.x/modules/unsupported/coveragetools/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
+++ branches/2.7.x/modules/unsupported/coveragetools/pom.xml 2012-02-15 13:04:00 UTC (rev 38572)
@@ -114,8 +114,7 @@
</dependency>
<dependency>
<groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.4</version>
+ <artifactId>commons-io</artifactId>
</dependency>
</dependencies>
Modified: branches/2.7.x/modules/unsupported/geotiff_new/pom.xml
===================================================================
--- branches/2.7.x/modules/unsupported/geotiff_new/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
+++ branches/2.7.x/modules/unsupported/geotiff_new/pom.xml 2012-02-15 13:04:00 UTC (rev 38572)
@@ -149,8 +149,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
</dependencies>
-
</project>
Copied: branches/2.7.x/modules/unsupported/imagecollection/pom.xml (from rev 38570, branches/2.7.x/modules/unsupported/geotiff_new/pom.xml)
===================================================================
--- branches/2.7.x/modules/unsupported/imagecollection/pom.xml (rev 0)
+++ branches/2.7.x/modules/unsupported/imagecollection/pom.xml 2012-02-15 13:04:00 UTC (rev 38572)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- =======================================================================
+ Maven Project Configuration File
+
+ The Geotools Project
+ http://www.geotools.org/
+
+ Version: $Id: pom.xml 33470 2009-07-03 07:15:22Z danieleromagnoli $
+ ======================================================================= -->
+ <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>unsupported</artifactId>
+ <version>8-SNAPSHOT</version>
+ </parent>
+
+
+ <!-- =========================================================== -->
+ <!-- Module Description -->
+ <!-- =========================================================== -->
+ <groupId>org.geotools</groupId>
+ <artifactId>gt-imagecollection</artifactId>
+ <packaging>jar</packaging>
+ <name>ImageCollection module</name>
+
+
+ <scm>
+ <connection>
+ scm:svn:http://svn.osgeo.org/geotools/trunk/modules/unsupported/imagecollection/
+ </connection>
+ <url>http://svn.osgeo.org/geotools/trunk/modules/unsupported/imagecollection/</url>
+ </scm>
+
+ <description>
+ Datasource created to read images from an ImageCollection available on a folder.
+ </description>
+
+ <licenses>
+ <license>
+ <name>Lesser General Public License (LGPL)</name>
+ <url>http://www.gnu.org/copyleft/lesser.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <!-- =========================================================== -->
+ <!-- Dependency Management -->
+ <!-- =========================================================== -->
+ <dependencies>
+ <dependency>
+ <groupId>org.geotools</groupId>
+ <artifactId>gt-main</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.geotools</groupId>
+ <artifactId>gt-coverage</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.geotools</groupId>
+ <artifactId>gt-referencing</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.geotools</groupId>
+ <artifactId>gt-geotiff</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.media</groupId>
+ <artifactId>jai_imageio</artifactId>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <!-- We need this to make the referencing module useful. -->
+ <groupId>org.geotools</groupId>
+ <artifactId>gt-epsg-hsql</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <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-cql</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.media</groupId>
+ <artifactId>jai_codec</artifactId>
+ <!-- The version number is specified in the parent POM. -->
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ </dependency>
+ </dependencies>
+
+</project>
Modified: branches/2.7.x/pom.xml
===================================================================
--- branches/2.7.x/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
+++ branches/2.7.x/pom.xml 2012-02-15 13:04:00 UTC (rev 38572)
@@ -778,7 +778,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.2</version>
+ <version>2.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
|
Author: aaime
Date: 2012-02-15 01:33:07 -0800 (Wed, 15 Feb 2012)
New Revision: 38571
Modified:
trunk/modules/plugin/imagemosaic/pom.xml
trunk/modules/plugin/imagepyramid/pom.xml
trunk/modules/plugin/jp2k/pom.xml
trunk/modules/unsupported/coveragetools/pom.xml
trunk/modules/unsupported/geotiff_new/pom.xml
trunk/modules/unsupported/imagecollection/pom.xml
trunk/pom.xml
Log:
[GEOT-4044] Upgrade commons-io to version 2.1
Modified: trunk/modules/plugin/imagemosaic/pom.xml
===================================================================
--- trunk/modules/plugin/imagemosaic/pom.xml 2012-02-14 15:31:21 UTC (rev 38570)
+++ trunk/modules/plugin/imagemosaic/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
@@ -190,7 +190,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
</dependencies>
<build>
Modified: trunk/modules/plugin/imagepyramid/pom.xml
===================================================================
--- trunk/modules/plugin/imagepyramid/pom.xml 2012-02-14 15:31:21 UTC (rev 38570)
+++ trunk/modules/plugin/imagepyramid/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
@@ -84,7 +84,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
Modified: trunk/modules/plugin/jp2k/pom.xml
===================================================================
--- trunk/modules/plugin/jp2k/pom.xml 2012-02-14 15:31:21 UTC (rev 38570)
+++ trunk/modules/plugin/jp2k/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
@@ -116,7 +116,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
</dependencies>
</project>
Modified: trunk/modules/unsupported/coveragetools/pom.xml
===================================================================
--- trunk/modules/unsupported/coveragetools/pom.xml 2012-02-14 15:31:21 UTC (rev 38570)
+++ trunk/modules/unsupported/coveragetools/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
@@ -139,7 +139,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
Modified: trunk/modules/unsupported/geotiff_new/pom.xml
===================================================================
--- trunk/modules/unsupported/geotiff_new/pom.xml 2012-02-14 15:31:21 UTC (rev 38570)
+++ trunk/modules/unsupported/geotiff_new/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
@@ -143,7 +143,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
<dependency>
<groupId>org.jaitools</groupId>
Modified: trunk/modules/unsupported/imagecollection/pom.xml
===================================================================
--- trunk/modules/unsupported/imagecollection/pom.xml 2012-02-14 15:31:21 UTC (rev 38570)
+++ trunk/modules/unsupported/imagecollection/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
@@ -105,7 +105,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
</dependencies>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-02-14 15:31:21 UTC (rev 38570)
+++ trunk/pom.xml 2012-02-15 09:33:07 UTC (rev 38571)
@@ -857,7 +857,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.2</version>
+ <version>2.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
|
|
From: <svn...@os...> - 2012-02-14 15:31:32
|
Author: groldan
Date: 2012-02-14 07:31:21 -0800 (Tue, 14 Feb 2012)
New Revision: 38570
Modified:
branches/2.7.x/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java
Log:
fix test
Modified: branches/2.7.x/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java
===================================================================
--- branches/2.7.x/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java 2012-02-14 15:22:36 UTC (rev 38569)
+++ branches/2.7.x/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java 2012-02-14 15:31:21 UTC (rev 38570)
@@ -112,7 +112,7 @@
}
public void testParseTime() throws Exception {
- SimpleType timeBinding = XSISimpleTypes.DateTime.getInstance();
+ SimpleType timeBinding = XSISimpleTypes.Time.getInstance();
Element element = null;
Attributes attrs = null;
|
|
From: <svn...@os...> - 2012-02-14 15:22:47
|
Author: groldan
Date: 2012-02-14 07:22:36 -0800 (Tue, 14 Feb 2012)
New Revision: 38569
Modified:
trunk/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java
Log:
fix test
Modified: trunk/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java
===================================================================
--- trunk/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java 2012-02-14 15:21:52 UTC (rev 38568)
+++ trunk/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java 2012-02-14 15:22:36 UTC (rev 38569)
@@ -112,7 +112,7 @@
}
public void testParseTime() throws Exception {
- SimpleType timeBinding = XSISimpleTypes.DateTime.getInstance();
+ SimpleType timeBinding = XSISimpleTypes.Time.getInstance();
Element element = null;
Attributes attrs = null;
|
|
From: <svn...@os...> - 2012-02-14 15:22:04
|
Author: groldan
Date: 2012-02-14 07:21:52 -0800 (Tue, 14 Feb 2012)
New Revision: 38568
Added:
trunk/modules/library/xml/src/test/java/org/geotools/xml/xsi/
trunk/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java
Modified:
trunk/modules/library/xml/src/main/java/org/geotools/xml/xsi/XSISimpleTypes.java
Log:
GEOT-4043: use Converters API to parse date/time in org.geotools.xml.xsi.XSISimpleTypes
Modified: trunk/modules/library/xml/src/main/java/org/geotools/xml/xsi/XSISimpleTypes.java
===================================================================
--- trunk/modules/library/xml/src/main/java/org/geotools/xml/xsi/XSISimpleTypes.java 2012-02-14 15:13:26 UTC (rev 38567)
+++ trunk/modules/library/xml/src/main/java/org/geotools/xml/xsi/XSISimpleTypes.java 2012-02-14 15:21:52 UTC (rev 38568)
@@ -19,14 +19,15 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.sql.Timestamp;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.TimeZone;
import javax.naming.OperationNotSupportedException;
+import org.geotools.util.Converters;
import org.geotools.xml.PrintHandler;
import org.geotools.xml.schema.Attribute;
import org.geotools.xml.schema.AttributeValue;
@@ -1170,25 +1171,11 @@
Attributes attrs, Map hints) throws SAXException {
if ((value.length == 1) && (value[0].getValue() != null)) {
java.lang.String svalue = (java.lang.String) value[0].getValue();
- java.lang.String[] values = svalue.split("\\-");
-
- if (values.length != 3) {
- throw new SAXException("Could not parse the DateTime "
- + value);
+ java.sql.Date parsed = Converters.convert(svalue, java.sql.Date.class);
+ if (null == parsed) {
+ throw new SAXException("Could not parse the Date '" + svalue + "'");
}
-
- int year;
- int month;
- int day;
- year = java.lang.Integer.parseInt(values[0]);
- month = java.lang.Integer.parseInt(values[1]);
- day = java.lang.Integer.parseInt(values[2]);
-
- Calendar c = Calendar.getInstance();
- c.clear();
- c.set(year, month, day);
-
- return c.getTime();
+ return parsed;
}
return null;
@@ -1233,76 +1220,11 @@
Attributes attrs, Map hints) throws SAXException {
if ((value.length == 1) && (value[0].getValue() != null)) {
java.lang.String svalue = (java.lang.String) value[0].getValue();
- java.lang.String[] values = svalue.split("T");
-
- if (values.length != 2) {
- throw new SAXException("Could not parse the DateTime "
- + value);
+ Timestamp parsed = Converters.convert(svalue, java.sql.Timestamp.class);
+ if (null == parsed) {
+ throw new SAXException("Could not parse the DateTime '" + svalue + "'");
}
-
- java.lang.String date = values[0];
- java.lang.String time = values[1];
-
- values = date.split("\\-");
-
- if (values.length != 3) {
- throw new SAXException("Could not parse the DateTime "
- + value);
- }
-
- int year;
- int month;
- int day;
- year = java.lang.Integer.parseInt(values[0]);
- month = java.lang.Integer.parseInt(values[1]);
- day = java.lang.Integer.parseInt(values[2]);
-
- values = time.split("\\:", 3);
-
- if (values.length != 3) {
- throw new SAXException("Could not parse the DateTime "
- + value);
- }
-
- int hour;
- int minute;
- int second;
- hour = java.lang.Integer.parseInt(values[0]);
- minute = java.lang.Integer.parseInt(values[1]);
-
- int i = values[2].indexOf("-");
- Calendar c = null;
-
- if (i == -1) {
- i = values[2].indexOf("+");
- }
-
- if (i == -1) {
- if (values[2].endsWith("Z")) {
- second = (int) java.lang.Float.parseFloat(values[2]
- .substring(0, values[2].length() - 1));
- } else {
- second = (int) java.lang.Float.parseFloat(values[2]);
- }
-
- TimeZone tz = TimeZone.getTimeZone("GMT");
- c = Calendar.getInstance(tz);
- c.clear();
- } else {
- second = (int) java.lang.Float.parseFloat(values[2]
- .substring(0, i));
-
- TimeZone tz = TimeZone.getTimeZone("GMT"
- + values[2].substring(i));
- c = Calendar.getInstance(tz);
- c.clear();
- }
-
- c.set(year, month, day, hour, minute, second);
-
- java.util.Date r = c.getTime();
-
- return r;
+ return parsed;
}
return null;
@@ -1728,54 +1650,11 @@
Attributes attrs, Map hints) throws SAXException {
if ((value.length == 1) && (value[0].getValue() != null)) {
java.lang.String svalue = (java.lang.String) value[0].getValue();
- java.lang.String[] values = svalue.split("\\:", 3);
-
- if (values.length != 3) {
- throw new SAXException("Could not parse the DateTime "
- + value);
+ java.sql.Time parsed = Converters.convert(svalue, java.sql.Time.class);
+ if (null == parsed) {
+ throw new SAXException("Could not parse the DateTime '" + svalue + "'");
}
-
- int hour;
- int minute;
- int second;
- hour = java.lang.Integer.parseInt(values[0]);
- minute = java.lang.Integer.parseInt(values[1]);
-
- int i = values[2].indexOf("-");
- Calendar c = null;
-
- if (i == -1) {
- i = values[2].indexOf("+");
- }
-
- if (i == -1) {
- if (values[2].endsWith("Z")) {
- second = (int) java.lang.Float.parseFloat(values[2]
- .substring(0, values[2].length() - 1));
- } else {
- second = (int) java.lang.Float.parseFloat(values[2]);
- }
-
- TimeZone tz = TimeZone.getTimeZone("GMT");
- c = Calendar.getInstance(tz);
- c.clear();
- } else {
- second = (int) java.lang.Float.parseFloat(values[2]
- .substring(0, i));
-
- TimeZone tz = TimeZone.getTimeZone("GMT"
- + values[2].substring(i));
- c = Calendar.getInstance(tz);
- c.clear();
- }
-
- c.set(Calendar.HOUR_OF_DAY, hour);
- c.set(Calendar.MINUTE, minute);
- c.set(Calendar.SECOND, second);
-
- java.util.Date r = c.getTime();
-
- return r;
+ return parsed;
}
return null;
Added: trunk/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java
===================================================================
--- trunk/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java (rev 0)
+++ trunk/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java 2012-02-14 15:21:52 UTC (rev 38568)
@@ -0,0 +1,157 @@
+package org.geotools.xml.xsi;
+
+import java.sql.Date;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.geotools.util.Converters;
+import org.geotools.xml.schema.Element;
+import org.geotools.xml.schema.ElementValue;
+import org.geotools.xml.schema.SimpleType;
+import org.geotools.xml.schema.impl.ElementValueGT;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class XSISimpleTypesTest extends TestCase {
+
+ public void testParseDate() throws Exception {
+ SimpleType dateBinding = XSISimpleTypes.Date.getInstance();
+
+ Element element = null;
+ Attributes attrs = null;
+ Map hints = null;
+ ElementValue[] value;
+ Date expected;
+ String sval;
+ Object actual;
+
+ sval = "2012-02-14";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Date.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2012-02-14Z";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Date.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2011-10-24T10:53:24.200Z";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Date.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "10:53:24.255+03:00";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ try {
+ dateBinding.getValue(element, value, attrs, hints);
+ } catch (SAXException e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testParseDateTime() throws Exception {
+ SimpleType dateTimeBinding = XSISimpleTypes.DateTime.getInstance();
+
+ Element element = null;
+ Attributes attrs = null;
+ Map hints = null;
+ ElementValue[] value;
+ java.util.Date expected;
+ String sval;
+ Object actual;
+
+ sval = "2012-02-14";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateTimeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Timestamp.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2012-02-14Z";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateTimeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Timestamp.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2011-10-24T10:53:24.200Z";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateTimeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Timestamp.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2011-10-24T00:00:00.200+03:00";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateTimeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Timestamp.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "10:53:24.255+03:00";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ try {
+ dateTimeBinding.getValue(element, value, attrs, hints);
+ } catch (SAXException e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testParseTime() throws Exception {
+ SimpleType timeBinding = XSISimpleTypes.DateTime.getInstance();
+
+ Element element = null;
+ Attributes attrs = null;
+ Map hints = null;
+ ElementValue[] value;
+ java.util.Date expected;
+ String sval;
+ Object actual;
+
+ sval = "10:53:24Z";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = timeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Time.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "10:53:24-03:00";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = timeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Time.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "10:53:24.255+03:00";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = timeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Time.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2012-02-14";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ try {
+ timeBinding.getValue(element, value, attrs, hints);
+ } catch (SAXException e) {
+ assertTrue(true);
+ }
+ }
+}
Property changes on: trunk/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
|
|
From: <svn...@os...> - 2012-02-14 15:13:38
|
Author: groldan
Date: 2012-02-14 07:13:26 -0800 (Tue, 14 Feb 2012)
New Revision: 38567
Added:
branches/2.7.x/modules/library/xml/src/test/java/org/geotools/xml/xsi/
branches/2.7.x/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java
Modified:
branches/2.7.x/modules/library/xml/src/main/java/org/geotools/xml/xsi/XSISimpleTypes.java
Log:
GEOT-4043: use Converters API to parse date/time in org.geotools.xml.xsi.XSISimpleTypes
Modified: branches/2.7.x/modules/library/xml/src/main/java/org/geotools/xml/xsi/XSISimpleTypes.java
===================================================================
--- branches/2.7.x/modules/library/xml/src/main/java/org/geotools/xml/xsi/XSISimpleTypes.java 2012-02-14 12:40:49 UTC (rev 38566)
+++ branches/2.7.x/modules/library/xml/src/main/java/org/geotools/xml/xsi/XSISimpleTypes.java 2012-02-14 15:13:26 UTC (rev 38567)
@@ -19,14 +19,15 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.sql.Timestamp;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.TimeZone;
import javax.naming.OperationNotSupportedException;
+import org.geotools.util.Converters;
import org.geotools.xml.PrintHandler;
import org.geotools.xml.schema.Attribute;
import org.geotools.xml.schema.AttributeValue;
@@ -1169,25 +1170,11 @@
Attributes attrs, Map hints) throws SAXException {
if ((value.length == 1) && (value[0].getValue() != null)) {
java.lang.String svalue = (java.lang.String) value[0].getValue();
- java.lang.String[] values = svalue.split("\\-");
-
- if (values.length != 3) {
- throw new SAXException("Could not parse the DateTime "
- + value);
+ java.sql.Date parsed = Converters.convert(svalue, java.sql.Date.class);
+ if (null == parsed) {
+ throw new SAXException("Could not parse the Date '" + svalue + "'");
}
-
- int year;
- int month;
- int day;
- year = java.lang.Integer.parseInt(values[0]);
- month = java.lang.Integer.parseInt(values[1]);
- day = java.lang.Integer.parseInt(values[2]);
-
- Calendar c = Calendar.getInstance();
- c.clear();
- c.set(year, month, day);
-
- return c.getTime();
+ return parsed;
}
return null;
@@ -1232,76 +1219,11 @@
Attributes attrs, Map hints) throws SAXException {
if ((value.length == 1) && (value[0].getValue() != null)) {
java.lang.String svalue = (java.lang.String) value[0].getValue();
- java.lang.String[] values = svalue.split("T");
-
- if (values.length != 2) {
- throw new SAXException("Could not parse the DateTime "
- + value);
+ Timestamp parsed = Converters.convert(svalue, java.sql.Timestamp.class);
+ if (null == parsed) {
+ throw new SAXException("Could not parse the DateTime '" + svalue + "'");
}
-
- java.lang.String date = values[0];
- java.lang.String time = values[1];
-
- values = date.split("\\-");
-
- if (values.length != 3) {
- throw new SAXException("Could not parse the DateTime "
- + value);
- }
-
- int year;
- int month;
- int day;
- year = java.lang.Integer.parseInt(values[0]);
- month = java.lang.Integer.parseInt(values[1]);
- day = java.lang.Integer.parseInt(values[2]);
-
- values = time.split("\\:", 3);
-
- if (values.length != 3) {
- throw new SAXException("Could not parse the DateTime "
- + value);
- }
-
- int hour;
- int minute;
- int second;
- hour = java.lang.Integer.parseInt(values[0]);
- minute = java.lang.Integer.parseInt(values[1]);
-
- int i = values[2].indexOf("-");
- Calendar c = null;
-
- if (i == -1) {
- i = values[2].indexOf("+");
- }
-
- if (i == -1) {
- if (values[2].endsWith("Z")) {
- second = (int) java.lang.Float.parseFloat(values[2]
- .substring(0, values[2].length() - 1));
- } else {
- second = (int) java.lang.Float.parseFloat(values[2]);
- }
-
- TimeZone tz = TimeZone.getTimeZone("GMT");
- c = Calendar.getInstance(tz);
- c.clear();
- } else {
- second = (int) java.lang.Float.parseFloat(values[2]
- .substring(0, i));
-
- TimeZone tz = TimeZone.getTimeZone("GMT"
- + values[2].substring(i));
- c = Calendar.getInstance(tz);
- c.clear();
- }
-
- c.set(year, month, day, hour, minute, second);
-
- java.util.Date r = c.getTime();
-
- return r;
+ return parsed;
}
return null;
@@ -1727,54 +1649,11 @@
Attributes attrs, Map hints) throws SAXException {
if ((value.length == 1) && (value[0].getValue() != null)) {
java.lang.String svalue = (java.lang.String) value[0].getValue();
- java.lang.String[] values = svalue.split("\\:", 3);
-
- if (values.length != 3) {
- throw new SAXException("Could not parse the DateTime "
- + value);
+ java.sql.Time parsed = Converters.convert(svalue, java.sql.Time.class);
+ if (null == parsed) {
+ throw new SAXException("Could not parse the DateTime '" + svalue + "'");
}
-
- int hour;
- int minute;
- int second;
- hour = java.lang.Integer.parseInt(values[0]);
- minute = java.lang.Integer.parseInt(values[1]);
-
- int i = values[2].indexOf("-");
- Calendar c = null;
-
- if (i == -1) {
- i = values[2].indexOf("+");
- }
-
- if (i == -1) {
- if (values[2].endsWith("Z")) {
- second = (int) java.lang.Float.parseFloat(values[2]
- .substring(0, values[2].length() - 1));
- } else {
- second = (int) java.lang.Float.parseFloat(values[2]);
- }
-
- TimeZone tz = TimeZone.getTimeZone("GMT");
- c = Calendar.getInstance(tz);
- c.clear();
- } else {
- second = (int) java.lang.Float.parseFloat(values[2]
- .substring(0, i));
-
- TimeZone tz = TimeZone.getTimeZone("GMT"
- + values[2].substring(i));
- c = Calendar.getInstance(tz);
- c.clear();
- }
-
- c.set(Calendar.HOUR_OF_DAY, hour);
- c.set(Calendar.MINUTE, minute);
- c.set(Calendar.SECOND, second);
-
- java.util.Date r = c.getTime();
-
- return r;
+ return parsed;
}
return null;
Added: branches/2.7.x/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java
===================================================================
--- branches/2.7.x/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java (rev 0)
+++ branches/2.7.x/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java 2012-02-14 15:13:26 UTC (rev 38567)
@@ -0,0 +1,157 @@
+package org.geotools.xml.xsi;
+
+import java.sql.Date;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.geotools.util.Converters;
+import org.geotools.xml.schema.Element;
+import org.geotools.xml.schema.ElementValue;
+import org.geotools.xml.schema.SimpleType;
+import org.geotools.xml.schema.impl.ElementValueGT;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class XSISimpleTypesTest extends TestCase {
+
+ public void testParseDate() throws Exception {
+ SimpleType dateBinding = XSISimpleTypes.Date.getInstance();
+
+ Element element = null;
+ Attributes attrs = null;
+ Map hints = null;
+ ElementValue[] value;
+ Date expected;
+ String sval;
+ Object actual;
+
+ sval = "2012-02-14";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Date.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2012-02-14Z";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Date.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2011-10-24T10:53:24.200Z";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Date.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "10:53:24.255+03:00";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ try {
+ dateBinding.getValue(element, value, attrs, hints);
+ } catch (SAXException e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testParseDateTime() throws Exception {
+ SimpleType dateTimeBinding = XSISimpleTypes.DateTime.getInstance();
+
+ Element element = null;
+ Attributes attrs = null;
+ Map hints = null;
+ ElementValue[] value;
+ java.util.Date expected;
+ String sval;
+ Object actual;
+
+ sval = "2012-02-14";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateTimeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Timestamp.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2012-02-14Z";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateTimeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Timestamp.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2011-10-24T10:53:24.200Z";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateTimeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Timestamp.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2011-10-24T00:00:00.200+03:00";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = dateTimeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Timestamp.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "10:53:24.255+03:00";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ try {
+ dateTimeBinding.getValue(element, value, attrs, hints);
+ } catch (SAXException e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testParseTime() throws Exception {
+ SimpleType timeBinding = XSISimpleTypes.DateTime.getInstance();
+
+ Element element = null;
+ Attributes attrs = null;
+ Map hints = null;
+ ElementValue[] value;
+ java.util.Date expected;
+ String sval;
+ Object actual;
+
+ sval = "10:53:24Z";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = timeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Time.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "10:53:24-03:00";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = timeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Time.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "10:53:24.255+03:00";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ actual = timeBinding.getValue(element, value, attrs, hints);
+ assertNotNull(actual);
+ expected = Converters.convert(sval, java.sql.Time.class);
+ assertEquals(expected.getClass().getName() + "[" + expected + "] : "
+ + actual.getClass().getName() + "[" + actual + "]", expected, actual);
+
+ sval = "2012-02-14";
+ value = new ElementValue[] { new ElementValueGT(null, sval) };
+ try {
+ timeBinding.getValue(element, value, attrs, hints);
+ } catch (SAXException e) {
+ assertTrue(true);
+ }
+ }
+}
Property changes on: branches/2.7.x/modules/library/xml/src/test/java/org/geotools/xml/xsi/XSISimpleTypesTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
|
|
From: <svn...@os...> - 2012-02-14 12:41:00
|
Author: groldan
Date: 2012-02-14 04:40:49 -0800 (Tue, 14 Feb 2012)
New Revision: 38566
Modified:
trunk/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_0_0/WFSFeatureSource.java
Log:
GEOT-4041: avoid NPE if keywords are missing in WFS capabilities
Modified: trunk/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_0_0/WFSFeatureSource.java
===================================================================
--- trunk/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_0_0/WFSFeatureSource.java 2012-02-14 12:40:20 UTC (rev 38565)
+++ trunk/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_0_0/WFSFeatureSource.java 2012-02-14 12:40:49 UTC (rev 38566)
@@ -22,10 +22,13 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
+import net.opengis.ows10.KeywordsType;
+
import org.geotools.data.AbstractFeatureSource;
import org.geotools.data.DataStore;
import org.geotools.data.DefaultFeatureResults;
@@ -125,8 +128,26 @@
@SuppressWarnings("unchecked")
public Set<String> getKeywords() {
- return new HashSet<String>(featureSetDescription.getKeywords());
+ return extractKeywords(featureSetDescription.getKeywords());
}
+
+ @SuppressWarnings("unchecked")
+ private Set<String> extractKeywords(List<KeywordsType> keywordsList) {
+ Set<String> keywords = new HashSet<String>();
+ if (keywordsList != null) {
+ for (KeywordsType keys : keywordsList) {
+ if (keys != null) {
+ List<String> kws = keys.getKeyword();
+ for (String kw : kws) {
+ if (kw != null && kw.trim().length() > 0) {
+ keywords.add(kw);
+ }
+ }
+ }
+ }
+ }
+ return keywords;
+ }
public String getName() {
return fname;
|
|
From: <svn...@os...> - 2012-02-14 12:40:31
|
Author: groldan
Date: 2012-02-14 04:40:20 -0800 (Tue, 14 Feb 2012)
New Revision: 38565
Modified:
trunk/modules/library/main/src/main/java/org/geotools/data/AbstractFeatureSource.java
trunk/modules/library/main/src/main/java/org/geotools/data/Diff.java
trunk/modules/library/main/src/main/java/org/geotools/data/DiffFeatureReader.java
trunk/modules/library/main/src/main/java/org/geotools/data/TransactionStateDiff.java
trunk/modules/library/main/src/test/java/org/geotools/data/DiffWriterTest.java
Log:
Change usages of deprecated direct access to Diff.modified2 and Diff.added by the getModified() and getAdded() methods
Modified: trunk/modules/library/main/src/main/java/org/geotools/data/AbstractFeatureSource.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/data/AbstractFeatureSource.java 2012-02-14 12:39:37 UTC (rev 38564)
+++ trunk/modules/library/main/src/main/java/org/geotools/data/AbstractFeatureSource.java 2012-02-14 12:40:20 UTC (rev 38565)
@@ -388,14 +388,14 @@
}
Diff diff = ((AbstractDataStore)dataStore).state(t).diff(namedQuery(query).getTypeName());
synchronized (diff) {
- Iterator it = diff.added.values().iterator();
+ Iterator it = diff.getAdded().values().iterator();
while(it.hasNext()){
Object feature = it.next();
if( query.getFilter().evaluate(feature) )
delta++;
}
- it = diff.modified2.values().iterator();
+ it = diff.getModified().values().iterator();
while(it.hasNext()){
Object feature = it.next();
Modified: trunk/modules/library/main/src/main/java/org/geotools/data/Diff.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/data/Diff.java 2012-02-14 12:39:37 UTC (rev 38564)
+++ trunk/modules/library/main/src/main/java/org/geotools/data/Diff.java 2012-02-14 12:40:20 UTC (rev 38565)
@@ -317,7 +317,7 @@
tree.insert(ReferencedEnvelope.reference(f.getBounds()), f);
}
}
- Iterator<Entry<String,SimpleFeature>> j = diff.modified2.entrySet().iterator();
+ Iterator<Entry<String,SimpleFeature>> j = diff.getModified().entrySet().iterator();
while( j.hasNext() ){
Entry<String,SimpleFeature> e = j.next();
SimpleFeature f = (SimpleFeature) e.getValue();
Modified: trunk/modules/library/main/src/main/java/org/geotools/data/DiffFeatureReader.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/data/DiffFeatureReader.java 2012-02-14 12:39:37 UTC (rev 38564)
+++ trunk/modules/library/main/src/main/java/org/geotools/data/DiffFeatureReader.java 2012-02-14 12:40:20 UTC (rev 38565)
@@ -20,12 +20,14 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import org.geotools.feature.IllegalAttributeException;
import org.geotools.filter.AttributeExpression;
import org.opengis.feature.Feature;
+import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.type.FeatureType;
import org.opengis.filter.Filter;
import org.opengis.filter.Id;
@@ -110,8 +112,8 @@
if( indexedGeometryFilter ){
spatialIndexIterator=getIndexedFeatures().iterator();
}
- addedIterator=(Iterator<F>)diff.added.values().iterator();
- modifiedIterator=(Iterator<F>)diff.modified2.values().iterator();
+ addedIterator=(Iterator<F>)diff.getAdded().values().iterator();
+ modifiedIterator=(Iterator<F>)diff.getModified().values().iterator();
}
}
@@ -162,8 +164,9 @@
String fid = peek.getIdentifier().getID();
encounteredFids.add(fid);
- if (diff.modified2.containsKey(fid)) {
- F changed = (F) diff.modified2.get(fid);
+ Map<String, SimpleFeature> modified = diff.getModified();
+ if (modified.containsKey(fid)) {
+ F changed = (F) modified.get(fid);
if (changed == TransactionStateDiff.NULL || !filter.evaluate(changed) ) {
continue;
} else {
@@ -243,9 +246,9 @@
while( fids.hasNext() && next == null ) {
String fid = fids.next().toString();
if( !encounteredFids.contains(fid) ){
- next = (F) diff.modified2.get(fid);
+ next = (F) diff.getModified().get(fid);
if( next==null ){
- next = (F) diff.added.get(fid);
+ next = (F) diff.getAdded().get(fid);
}
}
}
Modified: trunk/modules/library/main/src/main/java/org/geotools/data/TransactionStateDiff.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/data/TransactionStateDiff.java 2012-02-14 12:39:37 UTC (rev 38564)
+++ trunk/modules/library/main/src/main/java/org/geotools/data/TransactionStateDiff.java 2012-02-14 12:40:20 UTC (rev 38565)
@@ -201,8 +201,8 @@
feature = (SimpleFeature) writer.next();
String fid = feature.getID();
- if (diff.modified2.containsKey(fid)) {
- update = (SimpleFeature) diff.modified2.get(fid);
+ if (diff.getModified().containsKey(fid)) {
+ update = (SimpleFeature) diff.getModified().get(fid);
if (update == NULL) {
writer.remove();
Modified: trunk/modules/library/main/src/test/java/org/geotools/data/DiffWriterTest.java
===================================================================
--- trunk/modules/library/main/src/test/java/org/geotools/data/DiffWriterTest.java 2012-02-14 12:39:37 UTC (rev 38564)
+++ trunk/modules/library/main/src/test/java/org/geotools/data/DiffWriterTest.java 2012-02-14 12:40:20 UTC (rev 38565)
@@ -61,18 +61,18 @@
writer.next();
SimpleFeature feature=writer.next();
writer.remove();
- assertNull(writer.diff.added.get(feature.getID()));
+ assertNull(writer.diff.getAdded().get(feature.getID()));
}
public void testHasNext() throws Exception {
assertTrue(writer.hasNext());
- assertEquals(2, writer.diff.added.size()+writer.diff.modified2.size());
+ assertEquals(2, writer.diff.getAdded().size()+writer.diff.getModified().size());
writer.next();
assertTrue(writer.hasNext());
- assertEquals(2, writer.diff.added.size()+writer.diff.modified2.size());
+ assertEquals(2, writer.diff.getAdded().size()+writer.diff.getModified().size());
writer.next();
assertFalse(writer.hasNext());
- assertEquals(2, writer.diff.added.size()+writer.diff.modified2.size());
+ assertEquals(2, writer.diff.getAdded().size()+writer.diff.getModified().size());
}
public void testWrite() throws IOException, Exception {
@@ -84,13 +84,13 @@
feature.setAttribute("name", "new1");
writer.write();
- assertEquals(2, writer.diff.added.size() );
+ assertEquals(2, writer.diff.getAdded().size() );
feature=writer.next();
feature.setAttribute("name", "new2");
writer.write();
- assertEquals(3, writer.diff.added.size() );
+ assertEquals(3, writer.diff.getAdded().size() );
}
|
|
From: <svn...@os...> - 2012-02-14 12:39:48
|
Author: groldan
Date: 2012-02-14 04:39:37 -0800 (Tue, 14 Feb 2012)
New Revision: 38564
Modified:
trunk/modules/library/data/src/main/java/org/geotools/data/store/DiffTransactionState.java
Log:
allow DiffTransactionState to be extended
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 2012-02-14 12:35:25 UTC (rev 38563)
+++ trunk/modules/library/data/src/main/java/org/geotools/data/store/DiffTransactionState.java 2012-02-14 12:39:37 UTC (rev 38564)
@@ -34,17 +34,17 @@
/**
* Transaction state responsible for holding an in memory {@link Diff} of any modifications.
*/
-class DiffTransactionState implements Transaction.State {
- Diff diff;
+public class DiffTransactionState implements Transaction.State {
+ protected Diff diff;
/** The transaction (ie session) associated with this state */
- Transaction transaction;
+ protected Transaction transaction;
/**
* ContentState for this transaction used to hold information for
* FeatureReader implementations
*/
- ContentState state;
+ protected ContentState state;
/**
* Transaction state responsible for holding an in memory {@link Diff}.
|
|
From: <svn...@os...> - 2012-02-14 12:35:36
|
Author: groldan
Date: 2012-02-14 04:35:25 -0800 (Tue, 14 Feb 2012)
New Revision: 38563
Modified:
branches/2.7.x/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_0_0/WFSFeatureSource.java
Log:
GEOT-4041: avoid NPE if keywords are missing in WFS capabilities
Modified: branches/2.7.x/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_0_0/WFSFeatureSource.java
===================================================================
--- branches/2.7.x/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_0_0/WFSFeatureSource.java 2012-02-11 11:08:23 UTC (rev 38562)
+++ branches/2.7.x/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_0_0/WFSFeatureSource.java 2012-02-14 12:35:25 UTC (rev 38563)
@@ -22,10 +22,13 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
+import net.opengis.ows10.KeywordsType;
+
import org.geotools.data.AbstractFeatureSource;
import org.geotools.data.DataStore;
import org.geotools.data.DefaultFeatureResults;
@@ -122,8 +125,26 @@
@SuppressWarnings("unchecked")
public Set<String> getKeywords() {
- return new HashSet<String>(featureSetDescription.getKeywords());
+ return extractKeywords(featureSetDescription.getKeywords());
}
+
+ @SuppressWarnings("unchecked")
+ private Set<String> extractKeywords(List<KeywordsType> keywordsList) {
+ Set<String> keywords = new HashSet<String>();
+ if (keywordsList != null) {
+ for (KeywordsType keys : keywordsList) {
+ if (keys != null) {
+ List<String> kws = keys.getKeyword();
+ for (String kw : kws) {
+ if (kw != null && kw.trim().length() > 0) {
+ keywords.add(kw);
+ }
+ }
+ }
+ }
+ }
+ return keywords;
+ }
public String getName() {
return fname;
|
|
From: <svn...@os...> - 2012-02-11 11:08:30
|
Author: aaime
Date: 2012-02-11 03:08:23 -0800 (Sat, 11 Feb 2012)
New Revision: 38562
Modified:
trunk/modules/library/render/src/main/java/org/geotools/renderer/lite/FastBBOX.java
Log:
Adding toString to FastBBOX
Modified: trunk/modules/library/render/src/main/java/org/geotools/renderer/lite/FastBBOX.java
===================================================================
--- trunk/modules/library/render/src/main/java/org/geotools/renderer/lite/FastBBOX.java 2012-02-10 06:27:55 UTC (rev 38561)
+++ trunk/modules/library/render/src/main/java/org/geotools/renderer/lite/FastBBOX.java 2012-02-11 11:08:23 UTC (rev 38562)
@@ -200,4 +200,11 @@
return MatchAction.ANY;
}
+ @Override
+ public String toString() {
+ return "FastBBOX [property=" + property + ", envelope=" + envelope + "]";
+ }
+
+
+
}
|
Author: ang05a
Date: 2012-02-09 22:27:55 -0800 (Thu, 09 Feb 2012)
New Revision: 38561
Removed:
trunk/modules/unsupported/app-schema/webservice/src/test/resources/test-data/GuDaBackend.xml
Modified:
trunk/modules/extension/app-schema/app-schema/pom.xml
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/AttributeMapping.java
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/DataAccessMappingFeatureIterator.java
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/FeatureTypeMapping.java
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/AppSchemaDataAccessConfigurator.java
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/AttributeMapping.java
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/XMLConfigDigester.java
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/filter/UnmappingFilterVisitor.java
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/filter/XPath.java
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/feature/Types.java
trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/filter/NestedAttributeExpression.java
trunk/modules/extension/app-schema/app-schema/src/test/java/org/geotools/data/complex/PolymorphicChainingTest.java
trunk/modules/extension/app-schema/app-schema/src/test/resources/test-data/AppSchemaDataAccess.xsd
trunk/modules/unsupported/app-schema/webservice/src/test/java/org/geotools/data/ws/AppSchemaWithBackendDataAccessIntegrationTest.java
trunk/modules/unsupported/app-schema/webservice/src/test/resources/test-data/xmlDataAccessConfig.xml
Log:
- GEOT-3584: App-schema will return results when filter xpath is incomplete
- support isList in app-schema
Modified: trunk/modules/extension/app-schema/app-schema/pom.xml
===================================================================
--- trunk/modules/extension/app-schema/app-schema/pom.xml 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/pom.xml 2012-02-10 06:27:55 UTC (rev 38561)
@@ -76,8 +76,11 @@
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
</dependency>
-
<dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-data</artifactId>
<version>${project.version}</version>
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/AttributeMapping.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/AttributeMapping.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/AttributeMapping.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -46,6 +46,8 @@
protected StepList targetXPath;
private boolean isMultiValued;
+
+ private boolean isList;
/**
* If present, represents our way to deal polymorphic attribute instances, so this node should
@@ -93,6 +95,10 @@
public boolean isMultiValued() {
return isMultiValued;
}
+
+ public boolean isList() {
+ return isList;
+ }
public Expression getSourceExpression() {
return sourceExpression;
@@ -142,6 +148,10 @@
this.instancePath = instancePath;
}
+ public void setList(boolean isList) {
+ this.isList = isList;
+ }
+
/********END specific web service methods*******************/
@Override
@@ -160,6 +170,9 @@
&& Utilities.equals(sourceExpression, other.sourceExpression)
&& Utilities.equals(targetXPath, other.targetXPath)
&& Utilities.equals(targetNodeInstance, other.targetNodeInstance)
+ && Utilities.equals(isList, other.isList)
+ && Utilities.equals(isMultiValued, other.isMultiValued)
+ && Utilities.equals(clientProperties, other.clientProperties)
&& Utilities.equals(label, other.label)
&& Utilities.equals(parentLabel, other.parentLabel);
}
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/DataAccessMappingFeatureIterator.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/DataAccessMappingFeatureIterator.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/DataAccessMappingFeatureIterator.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -30,6 +30,7 @@
import javax.xml.namespace.QName;
+import org.apache.commons.lang.StringUtils;
import org.geotools.data.DataAccess;
import org.geotools.data.DataSourceException;
import org.geotools.data.FeatureSource;
@@ -439,14 +440,12 @@
if (mappingName != null) {
if (nestedMapping.isSameSource() && mappingName instanceof Name) {
// data type polymorphism mapping
- setPolymorphicValues((Name) mappingName, target, id, nestedMapping, source,
+ return setPolymorphicValues((Name) mappingName, target, id, nestedMapping, source,
xpath, clientPropsMappings);
- return null;
} else if (mappingName instanceof String) {
// referential polymorphism mapping
- setPolymorphicReference((String) mappingName, clientPropsMappings, target,
+ return setPolymorphicReference((String) mappingName, clientPropsMappings, target,
xpath, targetNodeType);
- return null;
}
} else {
// polymorphism could result in null, to skip the attribute
@@ -507,6 +506,7 @@
return null;
}
}
+ Attribute instance = null;
if (values instanceof Collection) {
// nested feature type could have multiple instances as the whole purpose
// of feature chaining is to cater for multi-valued properties
@@ -534,7 +534,7 @@
} else {
valueList.add(singleVal);
}
- Attribute instance = xpathAttributeBuilder.set(target, xpath, valueList, id,
+ instance = xpathAttributeBuilder.set(target, xpath, valueList, id,
targetNodeType, false, sourceExpression);
setClientProperties(instance, source, clientPropsMappings);
}
@@ -549,16 +549,12 @@
}
values = ((Attribute) values).getValue();
}
- Attribute instance = xpathAttributeBuilder.set(target, xpath, values, id,
+ instance = xpathAttributeBuilder.set(target, xpath, values, id,
targetNodeType, false, sourceExpression);
setClientProperties(instance, source, clientPropsMappings);
- // required by XmlMappingFeatureIterator so it can be passed on for setting
- // client properties there
- return instance;
-
}
- return null;
+ return instance;
}
/**
@@ -576,7 +572,7 @@
* @param targetNodeType
* the type of the attribute to be cast to, if any
*/
- private void setPolymorphicReference(String uri,
+ private Attribute setPolymorphicReference(String uri,
Map<Name, Expression> clientPropsMappings, Attribute target, StepList xpath,
AttributeType targetNodeType) {
@@ -587,7 +583,9 @@
newClientProps.putAll(clientPropsMappings);
newClientProps.put(XLINK_HREF_NAME, namespaceAwareFilterFactory.literal(uri));
setClientProperties(instance, null, newClientProps);
+ return instance;
}
+ return null;
}
/**
@@ -608,7 +606,7 @@
* Client properties
* @throws IOException
*/
- private void setPolymorphicValues(Name mappingName, Attribute target, String id,
+ private Attribute setPolymorphicValues(Name mappingName, Attribute target, String id,
NestedAttributeMapping nestedMapping, Object source, StepList xpath,
Map<Name, Expression> clientPropsMappings) throws IOException {
// process sub-type mapping
@@ -640,7 +638,9 @@
}
setAttributeValue(instance, null, source, mapping, null, null, selectedProperties.get(mapping));
}
+ return instance;
}
+ return null;
}
/**
@@ -816,10 +816,32 @@
// as it was already set
continue;
}
-
- // extract the values from multiple source features of the same id
- // and set them to one built feature
- if (attMapping.isMultiValued()) {
+ if (attMapping.isList()) {
+ Attribute instance = setAttributeValue(target, null, sources.get(0),
+ attMapping, null, null, selectedProperties.get(attMapping));
+ if (sources.size() > 1 && instance != null) {
+ Object[] values = new Object[sources.size()];
+ Expression sourceExpr = attMapping.getSourceExpression();
+ int i = 0;
+ for (Feature source : sources) {
+ values[i] = getValue(sourceExpr, source);
+ i++;
+ }
+ String valueString = StringUtils.join(values, " ");
+ StepList fullPath = attMapping.getTargetXPath();
+ StepList leafPath = fullPath.subList(fullPath.size() - 1, fullPath.size());
+ if (ComplexFeatureConstants.SIMPLE_CONTENT.equals(instance.getDescriptor()
+ .getName())) {
+ instance.setValue(valueString);
+ } else {
+ // xpath builder will work out the leaf attribute to set values on
+ xpathAttributeBuilder.set(instance, leafPath, valueString, null, null,
+ false, sourceExpr);
+ }
+ }
+ } else if (attMapping.isMultiValued()) {
+ // extract the values from multiple source features of the same id
+ // and set them to one built feature
for (Feature source : sources) {
setAttributeValue(target, null, source, attMapping, null, null, selectedProperties.get(attMapping));
}
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/FeatureTypeMapping.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/FeatureTypeMapping.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/FeatureTypeMapping.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -32,7 +32,6 @@
import org.geotools.data.complex.filter.XPath.StepList;
import org.geotools.data.joining.JoiningNestedAttributeMapping;
import org.geotools.feature.Types;
-import org.geotools.filter.NestedAttributeExpression;
import org.geotools.gml3.GML;
import org.opengis.feature.Feature;
import org.opengis.feature.type.AttributeDescriptor;
@@ -108,7 +107,7 @@
}
}
if (featureFidMapping == null) {
- featureFidMapping = Expression.NIL;
+ featureFidMapping = Expression.NIL;
}
}
@@ -116,6 +115,16 @@
return Collections.unmodifiableList(attributeMappings);
}
+ public List<NestedAttributeMapping> getNestedMappings() {
+ List<NestedAttributeMapping> mappings = new ArrayList<NestedAttributeMapping>();
+ for (AttributeMapping mapping : attributeMappings) {
+ if (mapping instanceof NestedAttributeMapping) {
+ mappings.add((NestedAttributeMapping) mapping);
+ }
+ }
+ return mappings;
+ }
+
public Expression getFeatureIdExpression() {
return featureFidMapping;
}
@@ -292,22 +301,12 @@
} else {
clientProperties = attMapping.getClientProperties();
// NC -added
- if (clientPropertyName.equals(GML.id)) {
+ if (Types.equals(clientPropertyName, GML.id)) {
clientPropertyExpressions.add(attMapping.getIdentifierExpression());
} else if (clientProperties.containsKey(clientPropertyName)) {
// end NC - added
propertyExpression = (Expression) clientProperties.get(clientPropertyName);
clientPropertyExpressions.add(propertyExpression);
- } else if (attMapping.isNestedAttribute()
- && Types.isSimpleContent(parentPath, getTargetFeature().getType())) {
- // create the full xpath from the parent's attribute
- // only bother if this is a simple content
- // otherwise, it would be handled in NestedAttributeExpression since it'd
- // already have the full path then
- StepList fullXpath = parentPath.clone();
- fullXpath.add(new Step(Types.toQName(clientPropertyName, namespaces), 1, true,
- false));
- clientPropertyExpressions.add(new NestedAttributeExpression(fullXpath, this));
}
}
}
@@ -329,14 +328,14 @@
if (mapping instanceof JoiningNestedAttributeMapping) {
// if it's joining for simple content feature chaining it has to be null
// so it will be added to the post filter
- sourceExpression = null;
- } else if (mapping instanceof NestedAttributeMapping) {
- // nested attribute with simple content is possible now
- sourceExpression = new NestedAttributeExpression(mapping.getTargetXPath(), this);
+ expressions.add(null);
} else {
sourceExpression = mapping.getSourceExpression();
+ if (!Expression.NIL.equals(sourceExpression)) {
+ // some filters can't handle Expression.NIL and just dies
+ expressions.add(sourceExpression);
+ }
}
- expressions.add(sourceExpression);
}
return expressions;
}
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/AppSchemaDataAccessConfigurator.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/AppSchemaDataAccessConfigurator.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/AppSchemaDataAccessConfigurator.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -345,6 +345,8 @@
validateConfiguredNamespaces(targetXPathSteps);
final boolean isMultiValued = attDto.isMultiple();
+
+ final boolean isList = attDto.isList();
final Expression idExpression = (idXpath == null) ? parseOgcCqlExpression(idExpr)
: new AttributeExpressionImpl(idXpath, new Hints(
@@ -402,6 +404,10 @@
attMapping = new AttributeMapping(idExpression, sourceExpression, targetXPathSteps,
expectedInstanceOf, isMultiValued, clientProperties);
}
+
+ if (attDto.isList()) {
+ attMapping.setList(true);
+ }
/**
* Label and parent label are specific for web service backend
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/AttributeMapping.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/AttributeMapping.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/AttributeMapping.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -114,10 +114,17 @@
/**
* If <code>true</code>, indicates that one instance of this attribute mapping must be
- * created for every repeating group of attributes. In other words, indicates wether this
+ * created for every repeating group of attributes. In other words, indicates whether this
* attribute corresponds to a multivalued or a single valued attribute.
*/
private boolean isMultiple;
+
+ /**
+ * If <code>true</code>, indicates that this attribute corresponds to a list of values.
+ * This is similar to isMultiple, except the values are concatenated as a big String inside
+ * the attribute.
+ */
+ private boolean isList;
/**
* Client properties definitions for instances of the target attribute. The map is keys are
@@ -306,9 +313,9 @@
public boolean isMultiple() {
return isMultiple;
}
-
+
/**
- * Sets wether this attribute should be treated as a single or multi valued property.
+ * Sets whether this attribute should be treated as a single or multi valued property.
*
* @param isMultiple
* <code>true</code> if this attribute corresponds to a multivalued property,
@@ -319,8 +326,40 @@
}
/**
+ * Sets whether this attribute should be treated as a list valued property.
+ *
+ * @param isList
+ * <code>true</code> if this attribute corresponds to a list valued property,
+ * <code>false</code> otherwise.
+ */
+ public void setList(boolean isList) {
+ this.isList = isList;
+ }
+
+ /**
* Helper method to allow config digester passing a string.
*
+ * @see #setList(boolean)
+ * @param isList
+ */
+ public void setList(String list) {
+ boolean isList = Boolean.valueOf(list).booleanValue();
+ setList(isList);
+ }
+
+ /**
+ * Returns whether this attribute should be treated as a list valued property.
+ *
+ * @return <code>true</code> if this attribute corresponds to a list valued property,
+ * <code>false</code> otherwise.
+ */
+ public boolean isList() {
+ return isList;
+ }
+
+ /**
+ * Helper method to allow config digester passing a string.
+ *
* @see #setMultiple(boolean)
* @param isMultiple
*/
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/XMLConfigDigester.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/XMLConfigDigester.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/config/XMLConfigDigester.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -222,6 +222,9 @@
digester.addCallMethod(attMap + "/isMultiple", "setMultiple", 1);
digester.addCallParam(attMap + "/isMultiple", 0);
+
+ digester.addCallMethod(attMap + "/isList", "setList", 1);
+ digester.addCallParam(attMap + "/isList", 0);
digester.addCallMethod(attMap + "/targetAttribute", "setTargetAttributePath", 1);
digester.addCallParam(attMap + "/targetAttribute", 0);
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/filter/UnmappingFilterVisitor.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/filter/UnmappingFilterVisitor.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/filter/UnmappingFilterVisitor.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -30,6 +30,7 @@
import org.geotools.data.complex.AttributeMapping;
import org.geotools.data.complex.FeatureTypeMapping;
+import org.geotools.data.complex.NestedAttributeMapping;
import org.geotools.data.complex.filter.XPath.Step;
import org.geotools.data.complex.filter.XPath.StepList;
import org.geotools.factory.CommonFactoryFinder;
@@ -808,14 +809,20 @@
NamespaceSupport namespaces = mappings.getNamespaces();
AttributeDescriptor root = mappings.getTargetFeature();
+ List<NestedAttributeMapping> nestedMappings = mappings.getNestedMappings();
// break into single steps
StepList simplifiedSteps = XPath.steps(root, targetXPath, namespaces);
List<Expression> matchingMappings = mappings.findMappingsFor(simplifiedSteps);
- if (matchingMappings.isEmpty() && simplifiedSteps.size() > 1) {
- // means some attributes are probably mapped separately in feature chaining
- matchingMappings.add(new NestedAttributeExpression(targetXPath, mappings));
+ if (!nestedMappings.isEmpty()) {
+ // means some attributes are mapped separately in feature chaining
+ for (NestedAttributeMapping nestedMapping : nestedMappings) {
+ if (simplifiedSteps.startsWith(nestedMapping.getTargetXPath())) {
+ matchingMappings.add(new NestedAttributeExpression(simplifiedSteps,
+ nestedMapping));
+ }
+ }
}
if (matchingMappings.size() == 0) {
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/filter/XPath.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/filter/XPath.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/filter/XPath.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -160,6 +160,18 @@
return false;
}
+
+ public boolean startsWith(StepList other) {
+ if (other.size() > this.size()) {
+ return false;
+ }
+ for (int i = 0; i < other.size(); i++) {
+ if (!this.get(i).equalsIgnoreIndex(other.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
public StepList subList(int fromIndex, int toIndex) {
if (fromIndex < 0)
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/feature/Types.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/feature/Types.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/feature/Types.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -762,29 +762,4 @@
return isSimpleContentType(superType);
}
}
-
- public static boolean isSimpleContent(StepList parentPath, PropertyType schema) {
- boolean isSimpleContent = false;
- if (schema instanceof ComplexType) {
- Iterator<Step> iterator = parentPath.iterator();
- Step step = iterator.next();
- PropertyDescriptor parentDescriptor = ((ComplexType) schema).getDescriptor(Types
- .toTypeName(step.getName()));
- while (iterator.hasNext() && parentDescriptor != null) {
- step = iterator.next();
- schema = parentDescriptor.getType();
- if (schema instanceof ComplexType) {
- parentDescriptor = ((ComplexType) schema).getDescriptor(Types.toTypeName(step
- .getName()));
- } else {
- parentDescriptor = null;
- }
- }
- if (parentDescriptor != null) {
- isSimpleContent = Types.isSimpleContentType(parentDescriptor.getType());
- }
- }
- return isSimpleContent;
- }
-
}
Modified: trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/filter/NestedAttributeExpression.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/filter/NestedAttributeExpression.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/main/java/org/geotools/filter/NestedAttributeExpression.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -28,7 +28,6 @@
import org.geotools.data.complex.AttributeMapping;
import org.geotools.data.complex.FeatureTypeMapping;
import org.geotools.data.complex.NestedAttributeMapping;
-import org.geotools.data.complex.filter.XPath;
import org.geotools.data.complex.filter.XPath.Step;
import org.geotools.data.complex.filter.XPath.StepList;
import org.geotools.factory.CommonFactoryFinder;
@@ -55,15 +54,10 @@
* /java/org/geotools/filter/NestedAttributeExpression.java $
*/
public class NestedAttributeExpression extends AttributeExpressionImpl {
- private FeatureTypeMapping mappings;
- private StepList fullSteps;
+ private NestedAttributeMapping rootMapping;
- /**
- * Used for polymorphism. Would be null if mappings is known. Otherwise used to determine the
- * FeatureTypeMapping to use, depending on the function evaluation upon a feature.
- */
-// private Expression function;
+ private StepList fullSteps;
/**
* First constructor
@@ -73,29 +67,11 @@
* @param expressions
* List of broken up expressions
*/
- public NestedAttributeExpression(String xpath, FeatureTypeMapping mappings) {
- super(xpath);
- this.mappings = mappings;
- fullSteps = XPath.steps(mappings.getTargetFeature(), this.attPath.toString(), mappings
- .getNamespaces());
- }
-
- public NestedAttributeExpression(StepList xpath, FeatureTypeMapping mappings) {
+ public NestedAttributeExpression(StepList xpath, NestedAttributeMapping nestedMapping) {
super(xpath.toString());
- this.mappings = mappings;
- fullSteps = xpath;
+ this.rootMapping = nestedMapping;
+ this.fullSteps = xpath;
}
-
- public NestedAttributeExpression(Expression expression, FeatureTypeMapping mappings) {
- super(expression.toString());
- this.mappings = mappings;
- fullSteps = XPath.steps(mappings.getTargetFeature(), this.attPath.toString(), mappings
- .getNamespaces());
- }
-
-// private boolean isConditional() {
-// return function != null;
-// }
/**
* see {@link org.geotools.filter.AttributeExpressionImpl#evaluate(Object)}
@@ -111,286 +87,159 @@
throw new UnsupportedOperationException(
"Expecting a feature to apply filter, but found: " + object);
}
-
- // if (object instanceof FeatureImpl) {
- // AttributeExpressionImpl exp = new AttributeExpressionImpl(attPath, new Hints(
- // FeaturePropertyAccessorFactory.NAMESPACE_CONTEXT, namespaces));
- // List<Object> values = new ArrayList<Object>(1);
- // values.add(exp.evaluate(object));
- // return values;
- // }
-
- List<Feature> roots = new ArrayList<Feature>();
- roots.add((Feature) object);
-// if (isConditional()) {
-// fullSteps = XPath.steps(((Feature) object).getDescriptor(), this.attPath, this.namespaceSupport);
-// String fTypeString = function.evaluate(object, String.class);
-// if (fTypeString != null) {
-// Name fTypeName = Types.degloseName(fTypeString, this.namespaceSupport);
-// try {
-// FeatureSource<FeatureType, Feature> fSource = DataAccessRegistry.getFeatureSource(fTypeName);
-// if (fSource != null && fSource instanceof MappingFeatureSource) {
-// mappings = ((MappingFeatureSource) fSource).getMapping();
-// } else {
-// return null;
-// }
-// } catch (IOException e) {
-// return null;
-// }
-// } else {
-// return null;
-// }
-// }
-
- return getValues(0, 0, roots, mappings, null);
+ return getValues(((Feature)object), rootMapping, fullSteps);
}
-
- private boolean isLastStep(int index) {
- return index >= fullSteps.size();
- }
-
- private List<Object> getValues(int startIndex, int endIndex, List<Feature> roots,
- FeatureTypeMapping fMapping, AttributeMapping prevMapping) {
+
+ private List<Object> getValues(Feature feature, NestedAttributeMapping nestedMapping,
+ StepList steps) {
List<Object> values = new ArrayList<Object>();
-
- if (startIndex > fullSteps.size() || endIndex > fullSteps.size()) {
- return values;
+ FeatureTypeMapping nextFMapping;
+ try {
+ nextFMapping = nestedMapping.getFeatureTypeMapping(feature);
+ } catch (IOException e) {
+ nextFMapping = null;
}
-
- while (startIndex <= endIndex) {
- List<AttributeMapping> attMappings = new ArrayList<AttributeMapping>();
- StepList steps = null;
- if (isLastStep(endIndex)) {
- // exhausted all paths
+ if (nextFMapping == null) {
+ // throw error unless this is polymorphism
+ if (nestedMapping.isConditional()) {
return values;
}
-
- while (attMappings.isEmpty() && endIndex < fullSteps.size()) {
- endIndex++;
- steps = fullSteps.subList(startIndex, endIndex);
- attMappings = fMapping.getAttributeMappingsIgnoreIndex(steps);
-
- if (steps.size() == 1) {
- if (Types.equals(fMapping.getTargetFeature().getName(), steps.get(0).getName())
- && !(Types.isSimpleContentType(fMapping.getTargetFeature().getType()))) {
- // skip element type name, but not when it's a simple content
- // like gml:name because it wouldn't have the element type name in the xpath
- startIndex++;
- endIndex = startIndex;
- steps = fullSteps.subList(startIndex, endIndex);
- attMappings = fMapping.getAttributeMappingsIgnoreIndex(steps);
- continue;
- } else if (attMappings.isEmpty() && steps.get(0).isId()) {
- // sometimes there's no explicit attribute mapping for top element name
- // but id should still resolve to primary key by default
- // e.g. gsml:GeologicUnit/@gml:id should resolve even though there's no
- // AttributeMapping for gsml:GeologicUnit
- setIdValues(null, roots, values);
- return values;
- }
- }
- }
-
- if (attMappings.isEmpty()) {
- // not found here, but might be found in other nodes if multi-valued
- // and polymorphic
- continue;
- }
-
- for (AttributeMapping mapping : attMappings) {
- if (mapping instanceof NestedAttributeMapping) {
- if (isClientProperty(endIndex)) {
- // check for client properties
- boolean isNestedXlinkHref = isXlinkHref(mapping);
- boolean valueFound = false;
- if (!isNestedXlinkHref) {
- // check if client properties are set in the parent attributeMapping in root mapping file
- valueFound = getClientProperties(mapping, values, roots);
- }
- if (!valueFound) {
- // or if they're set in the attributeMapping in feature chained mapping file
- getNestedClientProperties((NestedAttributeMapping) mapping, roots,
- values, isNestedXlinkHref);
- }
- } else {
- boolean isSimpleContent = Types.isSimpleContent(steps, fMapping
- .getTargetFeature().getType());
- // if simple content, then it doesn't need to increment the next starting
- // index
- // since there will be no type name in the xpath, e.g. when gml:name is
- // feature
- // chained
- // the path stays as gml:name.. but if it's a complex type with complex
- // content,
- // e.g. gsml:specification
- // the path will be gsml:specification/gsml:GeologicUnit/<some leaf
- // attribute to
- // filter by>
- getNestedValues((NestedAttributeMapping) mapping, roots, values,
- isSimpleContent ? startIndex : startIndex + 1);
- }
- } else {
- // normal attribute mapping
- if (endIndex == fullSteps.size()) {
- Expression exp = mapping.getSourceExpression();
- for (Feature f : roots) {
- Object value = getValue(exp, f);
- if (value != null) {
- values.add(value);
- }
- }
- } else if (isClientProperty(endIndex)) {
- // peek at the next attribute to check for client properties
- if (getLastStep().isId()) {
- setIdValues(mapping, roots, values);
- } else {
- getClientProperties(mapping, values, roots);
- }
- } else {
- // increment the xpath
- List<Object> nestedValues = getValues(startIndex, endIndex, roots,
- fMapping, mapping);
- if (nestedValues != null) {
- values.addAll(nestedValues);
- }
- }
- }
- }
-
- return values;
+ throw new UnsupportedOperationException("FeatureTypeMapping not found for " + attPath
+ + ". Please revise PropertyName in your filter!");
}
- return values;
- }
-
- private boolean isXlinkHref(AttributeMapping mapping) {
- if (fullSteps.get(fullSteps.size() - 1).getName().equals(XLINK.HREF)) {
- // special case for xlink:href by feature chaining
- // must get the value from the nested attribute mapping instead, i.e. from another table
- // if it's to get the values from the local table, it shouldn't be set with feature chaining
- return true;
- }
- return false;
- }
-
- private void getNestedValues(NestedAttributeMapping mapping, List<Feature> features, List<Object> values, int nextIndex) {
- FeatureTypeMapping nextFMapping = null;
- for (Feature f : features) {
+ List<Feature> nestedFeatures = new ArrayList<Feature>();
+ if (nestedMapping.isSameSource()) {
+ // same root/database row, different mappings, used in
+ // polymorphism
+ nestedFeatures = new ArrayList<Feature>();
+ nestedFeatures.add(feature);
+ } else {
+ // get nested features
try {
- nextFMapping = mapping.getFeatureTypeMapping(f);
+ nestedFeatures = getNestedFeatures(feature, nestedMapping, nextFMapping);
} catch (IOException e) {
- nextFMapping = null;
- }
- if (nextFMapping != null && mapping.isSameSource()) {
- // same root/database row, different mappings, used in
- // polymorphism
- List<Feature> nestedRoots = new ArrayList<Feature>(1);
- nestedRoots.add(f);
- List<Object> nestedValues = getValues(nextIndex, nextIndex, nestedRoots,
- nextFMapping, mapping);
-
- if (nestedValues != null) {
- values.addAll(nestedValues);
- }
- continue;
- }
- try {
- List<Feature> nestedFeatures = getNestedFeatures(f,
- mapping, nextFMapping);
- if (nestedFeatures == null || nestedFeatures.isEmpty()) {
- continue;
- }
-
- if (nextFMapping != null) {
- List<Object> nestedValues = getValues(nextIndex, nextIndex, nestedFeatures,
- nextFMapping, mapping);
- if (nestedValues != null) {
- values.addAll(nestedValues);
- }
- } else if (!nestedFeatures.isEmpty()) {
- throw new UnsupportedOperationException(
- "FeatureTypeMapping not found for "
- + attPath
- + ". This shouldn't happen if it's set in AppSchemaDataAccess mapping file!");
- }
- } catch (IOException e) {
- throw new RuntimeException("Failed evaluating filter expression: '"
- + attPath + "'. Caused by: " + e.getMessage());
+ throw new RuntimeException("Failed evaluating filter expression: '" + attPath
+ + "'. Caused by: " + e.getMessage());
} catch (IllegalArgumentException e) {
// might be a polymorphic case where it's looking for an attribute
// from another type
// that doesn't match this, but might match another database row
// so just continue
- continue;
+ return values;
}
}
- }
-
- private void getNestedClientProperties(NestedAttributeMapping mapping, List<Feature> features,
- List<Object> values, boolean isXlinkHref) {
- FeatureTypeMapping nextFMapping = null;
- for (Feature f : features) {
- try {
- nextFMapping = mapping.getFeatureTypeMapping(f);
- if (nextFMapping != null) {
- List<Feature> nestedFeatures;
- nestedFeatures = getNestedFeatures(f, mapping, nextFMapping);
- if (nestedFeatures == null || nestedFeatures.isEmpty()) {
- continue;
+
+ boolean isClientProperty = isClientProperty(steps);
+ StepList newSteps = null;
+ if (isClientProperty) {
+ // check for client properties for this mapping
+ newSteps = steps.subList(0, steps.size() - 1);
+ if (newSteps.size() == 1) {
+ // special case for client property for this NestedAttributeMapping
+ for (Feature f : nestedFeatures) {
+ values.addAll(getClientProperties(nestedMapping, f));
+ }
+ }
+ }
+ // skip element name that is mapped at the next FeatureTypeMapping
+ // except when it's a simple content
+ // if simple content, then there will be no type name in the xpath, e.g. when gml:name
+ // is
+ // feature chained the path stays as gml:name.. but if it's a complex type with complex
+ // content, e.g. gsml:specification the path will be
+ // gsml:specification/gsml:GeologicUnit/<some leaf attribute to filter by>
+ Name nextElementName = nextFMapping.getTargetFeature().getName();
+ // starting index for the next search
+ int startPos = -1;
+ if (Types.equals(nextElementName, steps.get(0).getName())) {
+ // simple contents where nested element name is the same as the nesting element
+ startPos = 0;
+ } else {
+ Step elementNameStep = steps.get(nestedMapping.getTargetXPath().size());
+ // support polymorphism
+ // check that element type matches the steps
+ if (Types.equals(nextElementName, elementNameStep.getName())) {
+ startPos = nestedMapping.getTargetXPath().size();
+ if (steps.size() > startPos + 1 && !steps.get(startPos + 1).isXmlAttribute()) {
+ // skip next element name for next evaluation
+ // except if the next step is a client property for that element name
+ // since we'd need the AttributeMapping for the client property
+ startPos++;
+ }
+ }
+ }
+ if (startPos > -1) {
+ newSteps = steps.subList(startPos, steps.size());
+ if (!newSteps.isEmpty()) {
+ List<NestedAttributeMapping> nestedMappings = nextFMapping.getNestedMappings();
+ if (!nestedMappings.isEmpty()) {
+ for (NestedAttributeMapping mapping : nestedMappings) {
+ if (newSteps.startsWith(mapping.getTargetXPath())) {
+ for (Feature f : nestedFeatures) {
+ // loop to this method
+ values.addAll(getValues(f, mapping, newSteps));
+ }
+ }
}
- if (isXlinkHref) {
- // xlink:href mapping done in the root mapping file
- // there is no need to find attributeMapping in the nested feature type mapping
- getClientProperties(mapping, values, nestedFeatures);
+ }
+ if (isClientProperty) {
+ // check for client properties
+ newSteps = newSteps.subList(0, newSteps.size() - 1);
+ }
+ boolean isXlinkHref = isClientProperty && isXlinkHref(steps);
+
+ List<AttributeMapping> attMappings = nextFMapping
+ .getAttributeMappingsIgnoreIndex(newSteps);
+ for (AttributeMapping attMapping : attMappings) {
+ if (isClientProperty) {
+ if (!(isXlinkHref && attMapping instanceof NestedAttributeMapping)) {
+ // if it's an xlink href,
+ // ignore nested attribute mappings as the values should come from
+ // nested features.. so should be evaluated at the next call
+ for (Feature f : nestedFeatures) {
+ values.addAll(getClientProperties(attMapping, f));
+ }
+ }
} else {
- List<AttributeMapping> nestedAttMappings = nextFMapping
- .getAttributeMappingsIgnoreIndex(mapping.getTargetXPath());
- AttributeMapping attMapping = null;
- boolean found = false;
- if (!nestedAttMappings.isEmpty()) {
- attMapping = nestedAttMappings.get(0);
- found = getClientProperties(attMapping, values, nestedFeatures);
+ for (Feature f : nestedFeatures) {
+ values.add(getValue(attMapping.getSourceExpression(), f));
}
- if (!found && getLastStep().isId()) {
- setIdValues(attMapping, nestedFeatures, values);
- }
}
}
- } catch (IOException e) {
- throw new RuntimeException("Failed evaluating filter expression: '" + attPath
- + "'. Caused by: " + e.getMessage());
- } catch (IllegalArgumentException e) {
- // might be a polymorphic case where it's looking for an attribute
- // from another type
- // that doesn't match this, but might match another database row
- // so just continue
- continue;
}
}
-
+ return values;
}
- private boolean isClientProperty(int endIndex) {
- if (endIndex == fullSteps.size() - 1) {
- return fullSteps.get(endIndex).isXmlAttribute();
+ private boolean isXlinkHref(StepList steps) {
+ if (steps.isEmpty()) {
+ return false;
}
- return false;
+ // special case for xlink:href by feature chaining
+ // must get the value from the nested attribute mapping instead, i.e. from another table
+ // if it's to get the values from the local table, it shouldn't be set with feature chaining
+ return steps.get(steps.size() - 1).getName().equals(XLINK.HREF);
}
- private boolean getClientProperties(AttributeMapping attMapping, List<Object> values, List<Feature> features) {
- boolean expressionFound = false;
+ private boolean isClientProperty(StepList steps) {
+ if (steps.isEmpty()) {
+ return false;
+ }
+ return steps.get(steps.size() - 1).isXmlAttribute();
+ }
+
+ private List<Object> getClientProperties(AttributeMapping attMapping, Feature f) {
+ List<Object> values = new ArrayList<Object>();
Step lastStep = getLastStep();
Expression exp = getClientPropertyExpression(attMapping, lastStep);
if (exp != null) {
- for (Feature f : features) {
- Object value = getValue(exp, f);
- if (value != null) {
- values.add(value);
- }
- }
- expressionFound = true;
+ Object value = getValue(exp, f);
+ if (value != null) {
+ values.add(value);
+ }
}
- return expressionFound;
+ return values;
}
private Step getLastStep() {
@@ -409,8 +258,7 @@
* @return list of nested features
* @throws IOException
*/
- private List<Feature> getNestedFeatures(Feature root, NestedAttributeMapping nestedMapping,
- FeatureTypeMapping fMapping) throws IOException {
+ private List<Feature> getNestedFeatures(Feature root, NestedAttributeMapping nestedMapping, FeatureTypeMapping fMapping) throws IOException {
Object fTypeName = nestedMapping.getNestedFeatureType(root);
if (fTypeName == null || !(fTypeName instanceof Name)) {
return null;
@@ -465,26 +313,7 @@
}
}
return value;
- }
-
- private void setIdValues(AttributeMapping mapping, List<Feature> features, List<Object> values) {
- Expression exp = null;
- if (mapping == null || mapping.getIdentifierExpression() == Expression.NIL) {
- // no specific attribute mapping or that idExpression is not mapped
- // use primary key
- exp = CommonFactoryFinder.getFilterFactory(null).property("@id");
- } else {
- exp = mapping.getIdentifierExpression();
- }
- if (exp != null) {
- for (Feature f : features) {
- Object value = getValue(exp, f);
- if (value != null) {
- values.add(value);
- }
- }
- }
- }
+ }
/**
* Find the source expression if the step is a client property.
@@ -499,7 +328,9 @@
* the full target xpath
* @return
*/
+
private Expression getClientPropertyExpression(AttributeMapping mapping, Step lastStep) {
+ Expression exp = null;
if (lastStep.isXmlAttribute()) {
Map<Name, Expression> clientProperties = mapping.getClientProperties();
QName lastStepQName = lastStep.getName();
@@ -516,9 +347,18 @@
}
if (clientProperties.containsKey(lastStepName)) {
// end NC - added
- return (Expression) clientProperties.get(lastStepName);
+ exp = (Expression) clientProperties.get(lastStepName);
+ } else if (lastStep.isId()) {
+ if (mapping.getIdentifierExpression() == Expression.NIL) {
+ // no specific attribute mapping or that idExpression is not mapped
+ // use primary key
+ exp = CommonFactoryFinder.getFilterFactory(null).property("@id");
+ } else {
+ exp = mapping.getIdentifierExpression();
+ }
}
}
- return null;
+ return exp;
}
+
}
Modified: trunk/modules/extension/app-schema/app-schema/src/test/java/org/geotools/data/complex/PolymorphicChainingTest.java
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/test/java/org/geotools/data/complex/PolymorphicChainingTest.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/test/java/org/geotools/data/complex/PolymorphicChainingTest.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -123,11 +123,11 @@
retVal = getFeatures(filteredResults);
assertEquals(0, retVal.size());
-// property = ff.property("ex:attributes/ex:key");
-// filter = ff.equals(property, ff.literal("stringKey1"));
-// filteredResults = artifactSource.getFeatures(filter);
-// retVal = getFeatures(filteredResults);
-// assertEquals(0, retVal.size());
+ property = ff.property("ex:attributes/ex:key");
+ filter = ff.equals(property, ff.literal("stringKey1"));
+ filteredResults = artifactSource.getFeatures(filter);
+ retVal = getFeatures(filteredResults);
+ assertEquals(0, retVal.size());
}
protected static void assertId(String expected, Feature f) {
Modified: trunk/modules/extension/app-schema/app-schema/src/test/resources/test-data/AppSchemaDataAccess.xsd
===================================================================
--- trunk/modules/extension/app-schema/app-schema/src/test/resources/test-data/AppSchemaDataAccess.xsd 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/extension/app-schema/app-schema/src/test/resources/test-data/AppSchemaDataAccess.xsd 2012-02-10 06:27:55 UTC (rev 38561)
@@ -430,6 +430,15 @@
</documentation>
</annotation>
</element>
+ <element name="isList" type="boolean" default="false" minOccurs="0">
+ <annotation>
+ <documentation>
+ <![CDATA[ Flag to indicate the target element addressed by this mapping has to be treated as
+ a container of a list of values. This is similar to isMultiple except the values are concatenated
+ as one big value instead of multiple elements with each value.]]>
+ </documentation>
+ </annotation>
+ </element>
<element name="ClientProperty" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
Modified: trunk/modules/unsupported/app-schema/webservice/src/test/java/org/geotools/data/ws/AppSchemaWithBackendDataAccessIntegrationTest.java
===================================================================
--- trunk/modules/unsupported/app-schema/webservice/src/test/java/org/geotools/data/ws/AppSchemaWithBackendDataAccessIntegrationTest.java 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/unsupported/app-schema/webservice/src/test/java/org/geotools/data/ws/AppSchemaWithBackendDataAccessIntegrationTest.java 2012-02-10 06:27:55 UTC (rev 38561)
@@ -85,7 +85,7 @@
setFilterFactory();
typeName = Types.typeName("GeologicUnit1");
URL url = XmlDataStoreTest.class.getResource(schemaBase
- + "GuDaBackend.xml");
+ + "xmlDataAccessConfig.xml");
assertNotNull(url);
Deleted: trunk/modules/unsupported/app-schema/webservice/src/test/resources/test-data/GuDaBackend.xml
===================================================================
--- trunk/modules/unsupported/app-schema/webservice/src/test/resources/test-data/GuDaBackend.xml 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/unsupported/app-schema/webservice/src/test/resources/test-data/GuDaBackend.xml 2012-02-10 06:27:55 UTC (rev 38561)
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema"
- xmlns:ogc="http://www.opengis.net/ogc" xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.geotools.org/app-schema AppSchemaDataAccess.xsd
- http://www.opengis.net/ogc http://schemas.opengis.net/filter/1.1.0/expr.xsd">
- <namespaces>
- <Namespace>
- <prefix>gml</prefix>
- <uri>http://www.opengis.net/gml</uri>
- </Namespace>
- <Namespace>
- <prefix>gsml</prefix>
- <uri>urn:cgi:xmlns:CGI:GeoSciML:2.0</uri>
- </Namespace>
- <Namespace>
- <prefix>gss</prefix>
- <uri>http://www.xxx.yyy.zzz/erd/gss</uri>
- </Namespace>
- <Namespace>
- <prefix>soapenv</prefix>
- <uri>http://schemas.xmlsoap.org/soap/envelope/</uri>
- </Namespace>
- <Namespace>
- <prefix>xlink</prefix>
- <uri>http://www.w3.org/1999/xlink</uri>
- </Namespace>
- <Namespace>
- <prefix>qaz</prefix>
- <uri>http://www.xxx.yyy.zzz/testWebService/</uri>
- </Namespace>
- <Namespace>
- <prefix>erd</prefix>
- <uri>http://www.xxx.yyy.zzz/erd</uri>
- </Namespace>
- </namespaces>
- <sourceDataStores>
- <DataStore>
- <id>GeologicUnit1</id>
- <parameters>
- <Parameter>
- <name>dbtype</name>
- <value>app-schema</value>
- </Parameter>
- <Parameter>
- <name>url</name>
- <value>file:./xmlDataAccessConfig.xml</value>
- </Parameter>
- </parameters>
- </DataStore>
- </sourceDataStores>
- <catalog>mappedPolygons.oasis.xml</catalog>
- <targetTypes>
- <FeatureType>
- <schemaUri>http://www.geosciml.org/geosciml/2.0/xsd/geosciml.xsd</schemaUri>
- </FeatureType>
- </targetTypes>
- <typeMappings>
- <FeatureTypeMapping>
- <mappingName>GeologicUnit1</mappingName>
- <sourceDataStore>GeologicUnit1</sourceDataStore>
- <sourceType>gsml:GeologicUnit</sourceType>
- <targetElement>gsml:GeologicUnit</targetElement>
- <attributeMappings>
- <AttributeMapping>
- <targetAttribute>gsml:GeologicUnit</targetAttribute>
- </AttributeMapping>
-
- <AttributeMapping>
- <targetAttribute>gml:description</targetAttribute>
- <sourceExpression>
- <OCQL>gml:description</OCQL>
- </sourceExpression>
- <isMultiple>true</isMultiple>
- </AttributeMapping>
-
- <AttributeMapping>
- <targetAttribute>gml:name</targetAttribute>
- <sourceExpression>
- <OCQL>gml:name</OCQL>
- </sourceExpression>
- <isMultiple>true</isMultiple>
- </AttributeMapping>
-
- <AttributeMapping>
- <targetAttribute>gsml:observationMethod</targetAttribute>
- <sourceExpression>
- <OCQL>gsml:observationMethod</OCQL>
- </sourceExpression>
- <isMultiple>true</isMultiple>
- </AttributeMapping>
-
- <AttributeMapping>
- <targetAttribute>gsml:purpose</targetAttribute>
- <sourceExpression>
- <OCQL>gsml:purpose</OCQL>
- </sourceExpression>
- <isMultiple>true</isMultiple>
- </AttributeMapping>
-
- <AttributeMapping>
- <targetAttribute>gsml:rank</targetAttribute>
- <sourceExpression>
- <OCQL>gsml:rank</OCQL>
- </sourceExpression>
- <isMultiple>true</isMultiple>
- </AttributeMapping>
-
- </attributeMappings>
- </FeatureTypeMapping>
- </typeMappings>
-</as:AppSchemaDataAccess>
Modified: trunk/modules/unsupported/app-schema/webservice/src/test/resources/test-data/xmlDataAccessConfig.xml
===================================================================
--- trunk/modules/unsupported/app-schema/webservice/src/test/resources/test-data/xmlDataAccessConfig.xml 2012-02-08 21:14:27 UTC (rev 38560)
+++ trunk/modules/unsupported/app-schema/webservice/src/test/resources/test-data/xmlDataAccessConfig.xml 2012-02-10 06:27:55 UTC (rev 38561)
@@ -49,6 +49,7 @@
</targetTypes>
<typeMappings>
<FeatureTypeMapping>
+ <mappingName>GeologicUnit1</mappingName>
<sourceDataStore>ws</sourceDataStore>
<sourceType>gss:GEOLOGICALUNIT_250K_POLY</sourceType>
<targetElement>gsml:GeologicUnit</targetElement>
|
|
From: <cca...@gm...> - 2012-02-09 06:12:14
|
กลุ่ม “นิติราษฎร์” เริ่มต้นจากความขัดแย้งกันของคนสองคนคือ ปริญญา เทวานฤมิตรกุล
กับ วรเจตน์ ภาคีรัตน์ ซึ่งทั้งสองท่านก็เป็นอาจารย์ภาควิชากฎหมายมหาชน คณะนิติศาสตร์
มหาวิทยาลัยธรรมศาสตร์ ขึ้นเวทีแสดงความคิดเห็นพร้อมกันเมื่อไหร่หันหน้าไปคนละทางเลย
ความขัดแย้งทำให้เกิดการชิงดีชิงเด่นจนทำให้ อ.ปริญญา ค่อนข้างประนีประนอมก็ไปทำหน้าที่รอง
อธิการบดีฝ่ายการนักศึกษาอย่างขยันขันแข็ง ส่วน อ.วรเจตน์ ผู้ที่ชื่นชอบ พ.ต.ท. ทักษิณ ชินวัตร
เป็นทุนเดิมอยู่แล้ว เห็นช่องทางทำให้ตัวเองมีชื่อเสียงด้วยประเด็นร้อนเรื่อง ม.112 ก็ใช้เรื่องนี้มา
เคลื่อนไหวตามสื่อต่างๆ แต่ก็ไม่ค่อยดังอย่างที่คิด เมื่อความคิดสมานฉันท์หรือปรองดองถูก
นำเสนอขึ้นมา อ.วรเจตน์ ก็ฉวยโอกาสกวาดต้นบรรดาอาจารย์ลิ่วล้อมาตั้งกลุ่ม “นิติราษฎร์”
ความคิดของนักวิชาการด้านกฎหมายอย่าง อ.วรเจตน์ และอีกหลายท่านเห็นว่า ความ
ยุติธรรมอยู่ที่ตัวบทกฎหมาย แต่ไม่ได้มองถึงความสงบสุขของคนในบ้านเมือง คนทั่วโลกจึงไม่เอา
นักกฎหมายมาเป็นผู้นำ แต่จะเลือกผู้นำที่มีแนวคิดทางรัฐศาสตร์มาปกครองบ้านเมือง ถ้า อ.วรเจตน์
อยากดังจริงๆ ก็ควรไปสมัครเป็น สส. ดีกว่ามาสร้างความแตกแยกในสังคม
นายอรรถพร พลบุตร “ผมไม่เข้าใจความนึก คิดของอาจารย์กลุ่มเล็กๆ กลุ่มนี้ว่า การที่
กฏหมายห้ามหมิ่นประมาท ดูหมิ่น หรือแสดงความอาฆาตมาดร้ายพระมหากษัตริย์จะทำให้บ้าน
ถล่มดินทลาย หรือทำให้คนกลุ่มนี้ขาดใจตายหรืออย่างไร จึงต้องดิ้นรนทุกวิถีทางที่จะแก้ไขมาตรา
112”
|
|
From: <svn...@os...> - 2012-02-08 21:14:37
|
Author: jdeolive
Date: 2012-02-08 13:14:27 -0800 (Wed, 08 Feb 2012)
New Revision: 38560
Modified:
trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_area.java
trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_in8.java
trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_in9.java
Log:
GEOT-4037, fixing function name clashes
Modified: trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_area.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_area.java 2012-02-08 20:40:55 UTC (rev 38559)
+++ trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_area.java 2012-02-08 21:14:27 UTC (rev 38560)
@@ -33,7 +33,7 @@
*/
public class FilterFunction_area extends FunctionExpressionImpl {
- public static FunctionName NAME = new FunctionNameImpl("area",
+ public static FunctionName NAME = new FunctionNameImpl("area2",
parameter("area", Double.class),
parameter("geometry", Geometry.class));
Modified: trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_in8.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_in8.java 2012-02-08 20:40:55 UTC (rev 38559)
+++ trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_in8.java 2012-02-08 21:14:27 UTC (rev 38560)
@@ -31,7 +31,7 @@
*/
public class FilterFunction_in8 extends FunctionExpressionImpl {
- public static FunctionName NAME = new FunctionNameImpl("in10", Boolean.class,
+ public static FunctionName NAME = new FunctionNameImpl("in8", Boolean.class,
parameter("value", Boolean.class),
parameter("in1", Object.class),
parameter("in2", Object.class),
Modified: trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_in9.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_in9.java 2012-02-08 20:40:55 UTC (rev 38559)
+++ trunk/modules/library/main/src/main/java/org/geotools/filter/function/FilterFunction_in9.java 2012-02-08 21:14:27 UTC (rev 38560)
@@ -31,7 +31,7 @@
*/
public class FilterFunction_in9 extends FunctionExpressionImpl {
- public static FunctionName NAME = new FunctionNameImpl("in10", Boolean.class,
+ public static FunctionName NAME = new FunctionNameImpl("in9", Boolean.class,
parameter("value", Boolean.class),
parameter("in1", Object.class),
parameter("in2", Object.class),
|
|
From: <svn...@os...> - 2012-02-08 20:41:05
|
Author: jdeolive
Date: 2012-02-08 12:40:55 -0800 (Wed, 08 Feb 2012)
New Revision: 38559
Modified:
trunk/modules/library/metadata/src/main/java/org/geotools/util/NumberRange.java
trunk/modules/library/metadata/src/main/java/org/geotools/util/Range.java
trunk/modules/library/referencing/pom.xml
Log:
GEOT-4038, osx build issues
Modified: trunk/modules/library/metadata/src/main/java/org/geotools/util/NumberRange.java
===================================================================
--- trunk/modules/library/metadata/src/main/java/org/geotools/util/NumberRange.java 2012-02-07 01:29:03 UTC (rev 38558)
+++ trunk/modules/library/metadata/src/main/java/org/geotools/util/NumberRange.java 2012-02-08 20:40:55 UTC (rev 38559)
@@ -492,7 +492,7 @@
* throw an exception otherwise.
*/
range = convertAndCast((Range) range, (Class) type);
- return castTo((Class) type).containsNC(range);
+ return castTo((Class) type).containsNC((Range) range);
}
/**
@@ -509,7 +509,7 @@
* throw an exception otherwise.
*/
range = convertAndCast((Range) range, (Class) type);
- return castTo((Class) type).intersectsNC(range);
+ return castTo((Class) type).intersectsNC((Range)range);
}
/**
@@ -521,7 +521,7 @@
public NumberRange<?> union(Range<?> range) {
final Class<? extends Number> type = getWidestClass(elementClass, getElementClass(range));
range = convertAndCast((Range) range, (Class) type);
- return (NumberRange) castTo((Class) type).unionNC(range);
+ return (NumberRange) castTo((Class) type).unionNC((Range)range);
}
/**
Modified: trunk/modules/library/metadata/src/main/java/org/geotools/util/Range.java
===================================================================
--- trunk/modules/library/metadata/src/main/java/org/geotools/util/Range.java 2012-02-07 01:29:03 UTC (rev 38558)
+++ trunk/modules/library/metadata/src/main/java/org/geotools/util/Range.java 2012-02-08 20:40:55 UTC (rev 38559)
@@ -298,9 +298,9 @@
* Implementation of {@link #contains(T)} to be invoked directly by subclasses.
* "NC" stands for "No Cast" - this method do not try to cast the value to a compatible type.
*/
- final boolean containsNC(final T value) {
+ final boolean containsNC(final Comparable value) {
if (minValue != null) {
- final int c = minValue.compareTo(value);
+ final int c = minValue.compareTo((T)value);
if (c >= 0) {
if (c != 0 || !isMinIncluded) {
return false;
@@ -308,7 +308,7 @@
}
}
if (maxValue != null) {
- final int c = maxValue.compareTo(value);
+ final int c = maxValue.compareTo((T)value);
if (c <= 0) {
if (c != 0 || !isMaxIncluded) {
return false;
Modified: trunk/modules/library/referencing/pom.xml
===================================================================
--- trunk/modules/library/referencing/pom.xml 2012-02-07 01:29:03 UTC (rev 38558)
+++ trunk/modules/library/referencing/pom.xml 2012-02-08 20:40:55 UTC (rev 38559)
@@ -206,5 +206,18 @@
</dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>mac</id>
+ <activation>
+ <os>
+ <family>mac</family>
+ </os>
+ </activation>
+ <properties>
+ <test.exclude.pattern>**/WarpTransformTest.*</test.exclude.pattern>
+ </properties>
+ </profile>
+ </profiles>
</project>
|
|
From: <svn...@os...> - 2012-02-07 01:29:12
|
Author: jive
Date: 2012-02-06 17:29:03 -0800 (Mon, 06 Feb 2012)
New Revision: 38558
Modified:
trunk/modules/library/main/src/main/java/org/geotools/feature/collection/AdaptorFeatureCollection.java
Log:
Update javadocs and unsupported operation exception to aid in debugging
Modified: trunk/modules/library/main/src/main/java/org/geotools/feature/collection/AdaptorFeatureCollection.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/feature/collection/AdaptorFeatureCollection.java 2012-02-06 18:22:01 UTC (rev 38557)
+++ trunk/modules/library/main/src/main/java/org/geotools/feature/collection/AdaptorFeatureCollection.java 2012-02-07 01:29:03 UTC (rev 38558)
@@ -40,11 +40,16 @@
/**
* Implement a feature collection just based on provision of iterator.
- *
- * @author Jody Garnett (Refractions Research Inc)
+ * <p>
+ * You will need to implement the following methods:
+ * <ul>
+ * <li>{@link #getBounds()}</li>
+ * <li>{@link #size()}</li>
+ * <li>{@link #closeIterator(Iterator)}</li>
+ * <li>{@link #openIterator()}</li>
+ * </ul>
+ * @author Jody Garnett (LISAsoft)
*
- *
- *
* @source $URL$
*/
public abstract class AdaptorFeatureCollection implements SimpleFeatureCollection {
@@ -601,7 +606,6 @@
listeners.remove(listener);
}
-
public SimpleFeatureType getSchema() {
return schema;
}
@@ -610,6 +614,6 @@
* Subclasses need to override this.
*/
public ReferencedEnvelope getBounds() {
- throw new UnsupportedOperationException("subclasses should override");
+ throw new UnsupportedOperationException("Subclasses "+getClass().getSimpleName()+" should override");
}
}
|
|
From: <svn...@os...> - 2012-02-06 18:22:09
|
Author: ischneider
Date: 2012-02-06 10:22:01 -0800 (Mon, 06 Feb 2012)
New Revision: 38557
Modified:
trunk/modules/library/main/src/main/java/org/geotools/util/CommonsConverterFactory.java
trunk/modules/library/main/src/main/java/org/geotools/util/TemporalConverterFactory.java
trunk/modules/library/main/src/test/java/org/geotools/util/CommonsConverterFactoryTest.java
trunk/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java
Log:
[GEOT-3913] support for TimeZone conversion
Modified: trunk/modules/library/main/src/main/java/org/geotools/util/CommonsConverterFactory.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/util/CommonsConverterFactory.java 2012-02-06 18:21:24 UTC (rev 38556)
+++ trunk/modules/library/main/src/main/java/org/geotools/util/CommonsConverterFactory.java 2012-02-06 18:22:01 UTC (rev 38557)
@@ -27,6 +27,7 @@
import java.util.Date;
import java.util.HashMap;
+import java.util.TimeZone;
import org.geotools.factory.Hints;
/**
@@ -304,6 +305,19 @@
}
}
}
+ static class TimeZoneConverter implements Converter {
+ public <T> T convert(Object source, Class<T> target) throws Exception {
+ if( source == null ) return null;
+ String string = (String) source;
+ TimeZone timezone = TimeZone.getTimeZone(string);
+ if (!string.equals(timezone.getID())) {
+ // timezone will return UTC if nothing matches, so technically,
+ // this is not a valid parse
+ return null;
+ }
+ return target.cast(timezone);
+ }
+ }
/**
* No need for FastHashMap - we are only registering during construction
*/
@@ -340,6 +354,7 @@
register.put(java.sql.Date.class, new SQLDateConverter() );
register.put(java.sql.Time.class, new SQLTimeConverter() );
register.put(java.sql.Timestamp.class, new SQLTimestampConverter() );
+ register.put(TimeZone.class, new TimeZoneConverter());
register.put(Date.class, new DateConverter() );
Modified: trunk/modules/library/main/src/main/java/org/geotools/util/TemporalConverterFactory.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/util/TemporalConverterFactory.java 2012-02-06 18:21:24 UTC (rev 38556)
+++ trunk/modules/library/main/src/main/java/org/geotools/util/TemporalConverterFactory.java 2012-02-06 18:22:01 UTC (rev 38557)
@@ -23,6 +23,7 @@
import java.util.GregorianCalendar;
import java.util.TimeZone;
+import java.util.TimeZone;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
@@ -43,6 +44,7 @@
* <li>{@link Calendar} to {@link XMLGregorianCalendar}
* <li>{@link XMLGregorianCalendar} to {@link Date}
* <li>{@link Date} to {@link XMLGregorianCalendar}
+ * <li>{@link String} to {@link TimeZone}
* </ul>
* </p>
* <p>
@@ -220,6 +222,19 @@
};
}
}
+
+ if (TimeZone.class.isAssignableFrom(source)) {
+ if (String.class == target) {
+ return new Converter() {
+ public <T> T convert(Object source, Class<T> target) throws Exception {
+ if (source == null) {
+ return null;
+ }
+ return target.cast(((TimeZone) source).getID());
+ }
+ };
+ }
+ }
return null;
}
Modified: trunk/modules/library/main/src/test/java/org/geotools/util/CommonsConverterFactoryTest.java
===================================================================
--- trunk/modules/library/main/src/test/java/org/geotools/util/CommonsConverterFactoryTest.java 2012-02-06 18:21:24 UTC (rev 38556)
+++ trunk/modules/library/main/src/test/java/org/geotools/util/CommonsConverterFactoryTest.java 2012-02-06 18:22:01 UTC (rev 38557)
@@ -18,6 +18,7 @@
import java.math.BigDecimal;
+import java.util.TimeZone;
import junit.framework.TestCase;
/**
@@ -55,6 +56,12 @@
assertEquals(d,convert("123.45", BigDecimal.class));
}
+ public void testTimeZoneConversion() throws Exception {
+ assertEquals(TimeZone.getTimeZone("UTC"), convert("UTC", TimeZone.class));
+ assertNull(convert("foobar", TimeZone.class));
+ assertNull(factory.createConverter(String.class, TimeZone.class, null).convert(null, TimeZone.class));
+ }
+
Object convert( Object source, Class target ) throws Exception {
return factory.createConverter( source.getClass(), target, null ).convert( source, target );
}
Modified: trunk/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java
===================================================================
--- trunk/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java 2012-02-06 18:21:24 UTC (rev 38556)
+++ trunk/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java 2012-02-06 18:22:01 UTC (rev 38557)
@@ -22,6 +22,7 @@
import java.util.Date;
import java.util.TimeZone;
+import java.util.TimeZone;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
@@ -283,4 +284,12 @@
assertEquals( date, gc.toGregorianCalendar().getTime() );
}
+
+ public void testTimeZoneToString() throws Exception {
+ Converter converter = factory.createConverter(TimeZone.class, String.class, null);
+ assertNotNull(converter);
+
+ assertEquals(TimeZone.getDefault().getID(), converter.convert(TimeZone.getDefault(), String.class));
+ assertNull(converter.convert(null,String.class));
+ }
}
|
|
From: <svn...@os...> - 2012-02-06 18:21:31
|
Author: ischneider
Date: 2012-02-06 10:21:24 -0800 (Mon, 06 Feb 2012)
New Revision: 38556
Modified:
branches/2.7.x/modules/library/main/src/main/java/org/geotools/util/CommonsConverterFactory.java
branches/2.7.x/modules/library/main/src/main/java/org/geotools/util/TemporalConverterFactory.java
branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/CommonsConverterFactoryTest.java
branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java
Log:
[GEOT-3913] support for TimeZone conversion
Modified: branches/2.7.x/modules/library/main/src/main/java/org/geotools/util/CommonsConverterFactory.java
===================================================================
--- branches/2.7.x/modules/library/main/src/main/java/org/geotools/util/CommonsConverterFactory.java 2012-02-04 14:57:37 UTC (rev 38555)
+++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/util/CommonsConverterFactory.java 2012-02-06 18:21:24 UTC (rev 38556)
@@ -27,6 +27,7 @@
import java.util.Date;
import java.util.HashMap;
+import java.util.TimeZone;
import org.geotools.factory.Hints;
/**
@@ -303,6 +304,19 @@
}
}
}
+ static class TimeZoneConverter implements Converter {
+ public <T> T convert(Object source, Class<T> target) throws Exception {
+ if( source == null ) return null;
+ String string = (String) source;
+ TimeZone timezone = TimeZone.getTimeZone(string);
+ if (!string.equals(timezone.getID())) {
+ // timezone will return UTC if nothing matches, so technically,
+ // this is not a valid parse
+ return null;
+ }
+ return target.cast(timezone);
+ }
+ }
/**
* No need for FastHashMap - we are only registering during construction
*/
@@ -339,6 +353,7 @@
register.put(java.sql.Date.class, new SQLDateConverter() );
register.put(java.sql.Time.class, new SQLTimeConverter() );
register.put(java.sql.Timestamp.class, new SQLTimestampConverter() );
+ register.put(TimeZone.class, new TimeZoneConverter());
register.put(Date.class, new DateConverter() );
Modified: branches/2.7.x/modules/library/main/src/main/java/org/geotools/util/TemporalConverterFactory.java
===================================================================
--- branches/2.7.x/modules/library/main/src/main/java/org/geotools/util/TemporalConverterFactory.java 2012-02-04 14:57:37 UTC (rev 38555)
+++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/util/TemporalConverterFactory.java 2012-02-06 18:21:24 UTC (rev 38556)
@@ -23,6 +23,7 @@
import java.util.GregorianCalendar;
import java.util.TimeZone;
+import java.util.TimeZone;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
@@ -43,6 +44,7 @@
* <li>{@link Calendar} to {@link XMLGregorianCalendar}
* <li>{@link XMLGregorianCalendar} to {@link Date}
* <li>{@link Date} to {@link XMLGregorianCalendar}
+ * <li>{@link String} to {@link TimeZone}
* </ul>
* </p>
* <p>
@@ -220,6 +222,19 @@
};
}
}
+
+ if (TimeZone.class.isAssignableFrom(source)) {
+ if (String.class == target) {
+ return new Converter() {
+ public <T> T convert(Object source, Class<T> target) throws Exception {
+ if (source == null) {
+ return null;
+ }
+ return target.cast(((TimeZone) source).getID());
+ }
+ };
+ }
+ }
return null;
}
Modified: branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/CommonsConverterFactoryTest.java
===================================================================
--- branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/CommonsConverterFactoryTest.java 2012-02-04 14:57:37 UTC (rev 38555)
+++ branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/CommonsConverterFactoryTest.java 2012-02-06 18:21:24 UTC (rev 38556)
@@ -18,6 +18,7 @@
import java.math.BigDecimal;
+import java.util.TimeZone;
import junit.framework.TestCase;
public class CommonsConverterFactoryTest extends TestCase {
@@ -52,6 +53,12 @@
}
+ public void testTimeZoneConversion() throws Exception {
+ assertEquals(TimeZone.getTimeZone("UTC"), convert("UTC", TimeZone.class));
+ assertNull(convert("foobar", TimeZone.class));
+ assertNull(factory.createConverter(String.class, TimeZone.class, null).convert(null, TimeZone.class));
+ }
+
Object convert( Object source, Class target ) throws Exception {
return factory.createConverter( source.getClass(), target, null ).convert( source, target );
}
Modified: branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java
===================================================================
--- branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java 2012-02-04 14:57:37 UTC (rev 38555)
+++ branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java 2012-02-06 18:21:24 UTC (rev 38556)
@@ -22,6 +22,7 @@
import java.util.Date;
import java.util.TimeZone;
+import java.util.TimeZone;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
@@ -283,4 +284,12 @@
assertEquals( date, gc.toGregorianCalendar().getTime() );
}
+
+ public void testTimeZoneToString() throws Exception {
+ Converter converter = factory.createConverter(TimeZone.class, String.class, null);
+ assertNotNull(converter);
+
+ assertEquals(TimeZone.getDefault().getID(), converter.convert(TimeZone.getDefault(), String.class));
+ assertNull(converter.convert(null,String.class));
+ }
}
|
|
From: <svn...@os...> - 2012-02-04 14:57:45
|
Author: jdeolive Date: 2012-02-04 06:57:37 -0800 (Sat, 04 Feb 2012) New Revision: 38555 Added: trunk/modules/library/main/src/main/java/org/geotools/styling/AbstractStyleVisitor.java Log: an abstract style visitor for visiting all components of a style Added: trunk/modules/library/main/src/main/java/org/geotools/styling/AbstractStyleVisitor.java =================================================================== --- trunk/modules/library/main/src/main/java/org/geotools/styling/AbstractStyleVisitor.java (rev 0) +++ trunk/modules/library/main/src/main/java/org/geotools/styling/AbstractStyleVisitor.java 2012-02-04 14:57:37 UTC (rev 38555) @@ -0,0 +1,435 @@ +/* + * GeoTools - The Open Source Java GIS Toolkit + * http://geotools.org + * + * (C) 2002-2012, 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.styling; + +/** + * A basic implementation of the StyleVisitor interface. + * <p> + * This class implements the full StyleVisitor interface and visits all components of a style object + * tree. + * </p> + */ +public class AbstractStyleVisitor implements StyleVisitor { + + @Override + public void visit(StyledLayerDescriptor sld) { + for (StyledLayer sl : sld.getStyledLayers()) { + if (sl instanceof UserLayer) { + ((UserLayer)sl).accept(this); + } else if (sl instanceof NamedLayer) { + ((NamedLayer)sl).accept(this); + } + } + } + + @Override + public void visit(NamedLayer layer) { + for (Style s : layer.getStyles()) { + s.accept(this); + } + for (FeatureTypeConstraint ftc : layer.getLayerFeatureConstraints()) { + ftc.accept(this); + } + } + + @Override + public void visit(UserLayer layer) { + for (Style s : layer.getUserStyles()) { + s.accept(this); + } + for (FeatureTypeConstraint ftc : layer.getLayerFeatureConstraints()) { + ftc.accept(this); + } + } + + @Override + public void visit(FeatureTypeConstraint ftc) { + } + + @Override + public void visit(Style style) { + for (FeatureTypeStyle fts : style.getFeatureTypeStyles()) { + fts.accept(this); + } + } + + @Override + public void visit(Rule rule) { + for (Symbolizer sym : rule.getSymbolizers()) { + sym.accept(this); + } + } + + @Override + public void visit(FeatureTypeStyle fts) { + for (Rule r : fts.getRules()) { + r.accept(this); + } + } + + @Override + public void visit(Fill fill) { + if (fill.getColor() != null) { + //fill.getColor().accept(visitor, extraData) + } + if (fill.getGraphicFill() != null) { + fill.getGraphicFill().accept(this); + } + if (fill.getOpacity() != null) { + //fill.getOpacity().accept(visitor, extraData) + } + } + + @Override + public void visit(Stroke stroke) { + if (stroke.getColor() != null) { + //stroke.getColor().accept(visitor, extraData) + } + if (stroke.getDashOffset() != null) { + //stroke.getDashOffset().accept(visitor, extraData) + } + if (stroke.getGraphicFill() != null) { + stroke.getGraphicFill().accept(this); + } + if (stroke.getGraphicStroke() != null) { + stroke.getGraphicStroke().accept(this); + } + if (stroke.getLineCap() != null) { + //stroke.getLineCap().accept(visitor, extraData) + } + if (stroke.getLineJoin() != null) { + //stroke.getLineJoin().accept(visitor, extraData) + } + if (stroke.getOpacity() != null) { + //stroke.getOpacity().accept(visitor, extraData) + } + if (stroke.getWidth() != null) { + //stroke.getWidth().accept(visitor, extraData) + } + } + + @Override + public void visit(Symbolizer sym) { + if( sym instanceof RasterSymbolizer){ + visit( (RasterSymbolizer) sym ); + } + else if( sym instanceof LineSymbolizer){ + visit( (LineSymbolizer) sym ); + } + else if( sym instanceof PolygonSymbolizer){ + visit( (PolygonSymbolizer) sym ); + } + else if( sym instanceof PointSymbolizer){ + visit( (PointSymbolizer) sym ); + } + else if( sym instanceof TextSymbolizer){ + visit( (TextSymbolizer) sym ); + } + else { + throw new RuntimeException("visit(Symbolizer) unsupported"); + } + } + + @Override + public void visit(PointSymbolizer ps) { + if (ps.getDescription() != null) { + ps.getDescription().accept(this); + } + if (ps.getGeometry() != null) { + //ps.getGeometry().accept(visitor, extraData) + } + if (ps.getGraphic() != null) { + ps.getGraphic().accept(this); + } + } + + @Override + public void visit(LineSymbolizer line) { + if (line.getDescription() != null) { + line.getDescription().accept(this); + } + if (line.getGeometry() != null) { + //line.getGeometry().accept(visitor, extraData) + } + if (line.getPerpendicularOffset() != null) { + //line.getPerpendicularOffset().accept(visitor, extraData) + } + if (line.getStroke() != null) { + line.getStroke().accept(this); + } + } + + @Override + public void visit(PolygonSymbolizer poly) { + if (poly.getDescription() != null) { + poly.getDescription().accept(this); + } + if (poly.getDisplacement() != null) { + poly.getDisplacement().accept(this); + } + if (poly.getFill() != null) { + poly.getFill().accept(this); + } + if (poly.getGeometry() != null) { + //poly.getGeometry().accept(visitor, extraData); + } + if (poly.getPerpendicularOffset() != null) { + //poly.getPerpendicularOffset().accept(visitor, extraData) + } + if (poly.getStroke() != null) { + poly.getStroke().accept(this); + } + } + + @Override + public void visit(TextSymbolizer text) { + if (text.getDescription() != null) { + text.getDescription().accept(this); + } + if (text.getFill() != null) { + text.getFill().accept(this); + } + if (text.getFont() != null) { + //text.getFont().accept(this, null); + } + if (text.getGeometry() != null) { + //text.getGeometry().accept(visitor, extraData) + } + if (text.getHalo() != null) { + text.getHalo().accept(this); + } + if (text.getLabel() != null) { + //text.getLabel().accept(visitor, extraData) + } + if (text.getLabelPlacement() != null) { + text.getLabelPlacement().accept(this); + } + if (text.getPriority() != null) { + //text.getPriority().accept(visitor, extraData) + } + } + + @Override + public void visit(RasterSymbolizer raster) { + if (raster.getChannelSelection() != null) { + raster.getChannelSelection().accept(this); + } + if (raster.getColorMap() != null) { + raster.getColorMap().accept(this); + } + if (raster.getContrastEnhancement() != null) { + raster.getContrastEnhancement().accept(this); + } + if (raster.getDescription() != null) { + raster.getDescription().accept(this); + } + if (raster.getGeometry() != null) { + //raster.getGeometry().accept(visitor, extraData) + } + if (raster.getImageOutline() != null) { + raster.getImageOutline().accept(this); + } + if (raster.getOpacity() != null) { + //raster.getOpacity().accept(visitor, extraData) + } + if (raster.getOverlap() != null) { + //raster.getOverlap().accept(visitor, extraData); + } + + if (raster.getShadedRelief() != null) { + raster.getShadedRelief().accept(this); + } + } + + @Override + public void visit(Graphic gr) { + if (gr.getAnchorPoint() != null) { + gr.getAnchorPoint().accept(this); + } + if (gr.getDisplacement() != null) { + gr.getDisplacement().accept(this); + } + for (ExternalGraphic eg : gr.getExternalGraphics()) { + eg.accept(this); + } + + if (gr.getGap() != null) { + //gr.getGap().accept(visitor, extraData) + } + if (gr.getInitialGap() != null) { + //gr.getInitialGap().accept(visitor, extraData) + } + for (Mark m : gr.getMarks()) { + m.accept(this); + } + if (gr.getOpacity() != null) { + //gr.getOpacity().accept(visitor, extraData) + } + if (gr.getRotation() != null) { + //gr.getRotation().accept(visitor, extraData) + } + if (gr.getSize() != null) { + //gr.getSize().accept(visitor, extraData) + } + + } + + @Override + public void visit(Mark mark) { + if (mark.getExternalMark() != null) { + //mark.getExternalMark().accept(this, extraData); + } + if (mark.getFill() != null) { + mark.getFill().accept(this); + } + if (mark.getStroke() != null) { + mark.getStroke().accept(this); + } + if (mark.getWellKnownName() != null) { + //mark.getWellKnownName().accept(visitor, extraData) + } + } + + @Override + public void visit(ExternalGraphic exgr) { + for (org.opengis.style.ColorReplacement cr : exgr.getColorReplacements()) { + //cr.accept(visitor, extraData) + } + } + + @Override + public void visit(PointPlacement pp) { + if (pp.getAnchorPoint() != null) { + pp.getAnchorPoint().accept(this); + } + if (pp.getDisplacement() != null) { + pp.getDisplacement().accept(this); + } + if (pp.getRotation() != null) { + //pp.getRotation().accept(visitor, extraData) + } + } + + @Override + public void visit(AnchorPoint ap) { + if (ap.getAnchorPointX() != null) { + //ap.getAnchorPointX().accept(visitor, extraData) + } + if (ap.getAnchorPointY() != null) { + //ap.getAnchorPointY().accept(visitor, extraData) + } + } + + @Override + public void visit(Displacement dis) { + if (dis.getDisplacementX() != null) { + //dis.getDisplacementX().accept(visitor, extraData) + } + if (dis.getDisplacementY() != null) { + //dis.getDisplacementY().accept(visitor, extraData) + } + } + + @Override + public void visit(LinePlacement lp) { + if (lp.getGap() != null) { + //lp.getGap().accept(visitor, extraData) + } + if (lp.getInitialGap() != null) { + //lp.getInitialGap().accept(visitor, extraData) + } + if (lp.getPerpendicularOffset() != null) { + //lp.getPerpendicularOffset().accept(visitor, extraData) + } + } + + @Override + public void visit(Halo halo) { + if (halo.getFill() != null) { + halo.getFill().accept(this); + } + if (halo.getRadius() != null) { + //halo.getRadius().accept(visitor, extraData) + } + } + + @Override + public void visit(ColorMap colorMap) { + for (ColorMapEntry cme : colorMap.getColorMapEntries()) { + cme.accept(this); + } + if (colorMap.getFunction() != null) { + //colorMap.getFunction().accept(visitor, extraData) + } + } + + @Override + public void visit(ColorMapEntry colorMapEntry) { + if (colorMapEntry.getColor() != null) { + //colorMapEntry.getColor().accept(visitor, extraData) + } + if (colorMapEntry.getOpacity() != null) { + //colorMapEntry.getOpacity().accept(visitor, extraData) + } + if (colorMapEntry.getQuantity() != null) { + //colorMapEntry.getQuantity().accept(visitor, extraData) + } + } + + @Override + public void visit(ContrastEnhancement contrastEnhancement) { + if (contrastEnhancement.getGammaValue() != null) { + //contrastEnhancement.getGammaValue().accept(visitor, extraData) + } + } + + @Override + public void visit(ImageOutline outline) { + if (outline.getSymbolizer() != null) { + outline.getSymbolizer().accept(this); + } + } + + @Override + public void visit(ChannelSelection cs) { + if (cs.getGrayChannel() != null) { + cs.getGrayChannel().accept(this); + } + for (SelectedChannelType ch : cs.getRGBChannels()) { + ch.accept(this); + } + } + + @Override + public void visit(OverlapBehavior ob) { + } + + @Override + public void visit(SelectedChannelType sct) { + if (sct.getContrastEnhancement() != null) { + sct.getContrastEnhancement().accept(this); + } + } + + @Override + public void visit(ShadedRelief sr) { + if (sr.getReliefFactor() != null) { + //sr.getReliefFactor().accept(visitor, extraData) + } + } + +} Property changes on: trunk/modules/library/main/src/main/java/org/geotools/styling/AbstractStyleVisitor.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Id URL Added: svn:eol-style + native |
|
From: <svn...@os...> - 2012-02-04 11:13:48
|
Author: aaime
Date: 2012-02-04 03:13:42 -0800 (Sat, 04 Feb 2012)
New Revision: 38554
Modified:
branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/DataTestCase.java
branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/DataUtilities.java
branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/DataUtilitiesTest.java
Log:
[GEOT-4033] Add support for UUID to DataUtilities, patch by Shane StClair
Modified: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/DataTestCase.java
===================================================================
--- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/DataTestCase.java 2012-02-04 11:12:46 UTC (rev 38553)
+++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/DataTestCase.java 2012-02-04 11:13:42 UTC (rev 38554)
@@ -21,6 +21,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.NoSuchElementException;
+import java.util.UUID;
import junit.framework.TestCase;
@@ -111,7 +112,7 @@
protected void dataSetUp() throws Exception {
String namespace = getName();
roadType = DataUtilities.createType(namespace + ".road",
- "id:0,geom:LineString,name:String");
+ "id:0,geom:LineString,name:String,uuid:UUID");
subRoadType = DataUtilities.createType(namespace + "road",
"id:0,geom:LineString");
gf = new GeometryFactory();
@@ -126,6 +127,7 @@
new Integer(1),
line(new int[] { 1, 1, 2, 2, 4, 2, 5, 1 }),
"r1",
+ UUID.randomUUID()
},
"road.rd1"
);
@@ -137,7 +139,8 @@
// 3,0+
roadFeatures[1] = SimpleFeatureBuilder.build(roadType, new Object[] {
new Integer(2), line(new int[] { 3, 0, 3, 2, 3, 3, 3, 4 }),
- "r2"
+ "r2",
+ UUID.randomUUID()
},
"road.rd2"
);
@@ -147,7 +150,9 @@
// 3,2 +----+ 4,2
roadFeatures[2] = SimpleFeatureBuilder.build(roadType, new Object[] {
new Integer(3),
- line(new int[] { 3, 2, 4, 2, 5, 3 }), "r3"
+ line(new int[] { 3, 2, 4, 2, 5, 3 }),
+ "r3",
+ UUID.randomUUID()
},
"road.rd3"
);
@@ -170,7 +175,7 @@
// / rd4
// + 1,2
newRoad = SimpleFeatureBuilder.build(roadType, new Object[] {
- new Integer(4), line(new int[] { 1, 2, 2, 3 }), "r4"
+ new Integer(4), line(new int[] { 1, 2, 2, 3 }), "r4", UUID.randomUUID()
}, "road.rd4");
riverType = DataUtilities.createType(namespace+".river",
Modified: branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/DataUtilities.java
===================================================================
--- branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/DataUtilities.java 2012-02-04 11:12:46 UTC (rev 38553)
+++ branches/2.7.x/modules/library/main/src/main/java/org/geotools/data/DataUtilities.java 2012-02-04 11:13:42 UTC (rev 38554)
@@ -44,6 +44,7 @@
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.StringTokenizer;
+import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -164,6 +165,9 @@
typeMap.put("true", Boolean.class);
typeMap.put("false", Boolean.class);
+ typeEncode.put(UUID.class, "UUID");
+ typeMap.put("UUID", UUID.class);
+
typeEncode.put(Geometry.class, "Geometry");
typeMap.put("Geometry", Geometry.class);
@@ -826,8 +830,20 @@
* <ul>
* <li>String</li>
* <li>Object - will return empty string</li>
- * <li>Number</li>
+ * <li>Integer</li>
+ * <li>Double</li>
+ * <li>Long</li>
+ * <li>Short</li>
+ * <li>Float</li>
+ * <li>BigDecimal</li>
+ * <li>BigInteger</li>
* <li>Character</li>
+ * <li>Boolean</li>
+ * <li>UUID</li>
+ * <li>Timestamp</li>
+ * <li>java.sql.Date</li>
+ * <li>java.sql.Time</li>
+ * <li>java.util.Date</li>
* <li>JTS Geometries</li>
* </ul>
*
@@ -866,6 +882,9 @@
if (type == Boolean.class) {
return Boolean.FALSE;
}
+ if (type == UUID.class) {
+ return UUID.fromString("00000000-0000-0000-0000-000000000000");
+ }
if (type == Timestamp.class)
return new Timestamp(System.currentTimeMillis());
if (type == java.sql.Date.class)
Modified: branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/DataUtilitiesTest.java
===================================================================
--- branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/DataUtilitiesTest.java 2012-02-04 11:12:46 UTC (rev 38553)
+++ branches/2.7.x/modules/library/main/src/test/java/org/geotools/data/DataUtilitiesTest.java 2012-02-04 11:13:42 UTC (rev 38554)
@@ -239,10 +239,11 @@
String[] names;
names = DataUtilities.attributeNames(roadType);
- assertEquals(3, names.length);
+ assertEquals(4, names.length);
assertEquals("id", names[0]);
assertEquals("geom", names[1]);
assertEquals("name", names[2]);
+ assertEquals("uuid", names[3]);
names = DataUtilities.attributeNames(subRoadType);
assertEquals(2, names.length);
@@ -375,7 +376,7 @@
// different namespace
SimpleFeatureType road3 = DataUtilities.createType("test.road",
- "id:0,geom:LineString,name:String");
+ "id:0,geom:LineString,name:String,uuid:UUID");
assertEquals(0, DataUtilities.compare(road3, roadType));
}
|
|
From: <svn...@os...> - 2012-02-04 11:12:53
|
Author: aaime
Date: 2012-02-04 03:12:46 -0800 (Sat, 04 Feb 2012)
New Revision: 38553
Modified:
trunk/modules/library/main/src/main/java/org/geotools/data/DataTestCase.java
trunk/modules/library/main/src/main/java/org/geotools/data/DataUtilities.java
trunk/modules/library/main/src/test/java/org/geotools/data/DataUtilitiesTest.java
Log:
[GEOT-4033] Add support for UUID to DataUtilities, patch by Shane StClair
Modified: trunk/modules/library/main/src/main/java/org/geotools/data/DataTestCase.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/data/DataTestCase.java 2012-02-04 11:09:07 UTC (rev 38552)
+++ trunk/modules/library/main/src/main/java/org/geotools/data/DataTestCase.java 2012-02-04 11:12:46 UTC (rev 38553)
@@ -21,6 +21,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.NoSuchElementException;
+import java.util.UUID;
import junit.framework.TestCase;
@@ -108,7 +109,7 @@
protected void dataSetUp() throws Exception {
String namespace = getName();
roadType = DataUtilities.createType(namespace + ".road",
- "id:0,geom:LineString,name:String");
+ "id:0,geom:LineString,name:String,uuid:UUID");
subRoadType = DataUtilities.createType(namespace + "road",
"id:0,geom:LineString");
gf = new GeometryFactory();
@@ -123,6 +124,7 @@
new Integer(1),
line(new int[] { 1, 1, 2, 2, 4, 2, 5, 1 }),
"r1",
+ UUID.randomUUID()
},
"road.rd1"
);
@@ -134,7 +136,8 @@
// 3,0+
roadFeatures[1] = SimpleFeatureBuilder.build(roadType, new Object[] {
new Integer(2), line(new int[] { 3, 0, 3, 2, 3, 3, 3, 4 }),
- "r2"
+ "r2",
+ UUID.randomUUID()
},
"road.rd2"
);
@@ -144,7 +147,9 @@
// 3,2 +----+ 4,2
roadFeatures[2] = SimpleFeatureBuilder.build(roadType, new Object[] {
new Integer(3),
- line(new int[] { 3, 2, 4, 2, 5, 3 }), "r3"
+ line(new int[] { 3, 2, 4, 2, 5, 3 }),
+ "r3",
+ UUID.randomUUID()
},
"road.rd3"
);
@@ -167,7 +172,7 @@
// / rd4
// + 1,2
newRoad = SimpleFeatureBuilder.build(roadType, new Object[] {
- new Integer(4), line(new int[] { 1, 2, 2, 3 }), "r4"
+ new Integer(4), line(new int[] { 1, 2, 2, 3 }), "r4", UUID.randomUUID()
}, "road.rd4");
riverType = DataUtilities.createType(namespace+".river",
Modified: trunk/modules/library/main/src/main/java/org/geotools/data/DataUtilities.java
===================================================================
--- trunk/modules/library/main/src/main/java/org/geotools/data/DataUtilities.java 2012-02-04 11:09:07 UTC (rev 38552)
+++ trunk/modules/library/main/src/main/java/org/geotools/data/DataUtilities.java 2012-02-04 11:12:46 UTC (rev 38553)
@@ -44,6 +44,7 @@
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.StringTokenizer;
+import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -167,6 +168,9 @@
typeMap.put("true", Boolean.class);
typeMap.put("false", Boolean.class);
+ typeEncode.put(UUID.class, "UUID");
+ typeMap.put("UUID", UUID.class);
+
typeEncode.put(Geometry.class, "Geometry");
typeMap.put("Geometry", Geometry.class);
@@ -872,8 +876,20 @@
* <ul>
* <li>String</li>
* <li>Object - will return empty string</li>
- * <li>Number</li>
+ * <li>Integer</li>
+ * <li>Double</li>
+ * <li>Long</li>
+ * <li>Short</li>
+ * <li>Float</li>
+ * <li>BigDecimal</li>
+ * <li>BigInteger</li>
* <li>Character</li>
+ * <li>Boolean</li>
+ * <li>UUID</li>
+ * <li>Timestamp</li>
+ * <li>java.sql.Date</li>
+ * <li>java.sql.Time</li>
+ * <li>java.util.Date</li>
* <li>JTS Geometries</li>
* </ul>
*
@@ -912,6 +928,9 @@
if (type == Boolean.class) {
return Boolean.FALSE;
}
+ if (type == UUID.class) {
+ return UUID.fromString("00000000-0000-0000-0000-000000000000");
+ }
if (type == Timestamp.class)
return new Timestamp(System.currentTimeMillis());
if (type == java.sql.Date.class)
Modified: trunk/modules/library/main/src/test/java/org/geotools/data/DataUtilitiesTest.java
===================================================================
--- trunk/modules/library/main/src/test/java/org/geotools/data/DataUtilitiesTest.java 2012-02-04 11:09:07 UTC (rev 38552)
+++ trunk/modules/library/main/src/test/java/org/geotools/data/DataUtilitiesTest.java 2012-02-04 11:12:46 UTC (rev 38553)
@@ -246,10 +246,11 @@
String[] names;
names = DataUtilities.attributeNames(roadType);
- assertEquals(3, names.length);
+ assertEquals(4, names.length);
assertEquals("id", names[0]);
assertEquals("geom", names[1]);
assertEquals("name", names[2]);
+ assertEquals("uuid", names[3]);
names = DataUtilities.attributeNames(subRoadType);
assertEquals(2, names.length);
@@ -382,7 +383,7 @@
// different namespace
SimpleFeatureType road3 = DataUtilities.createType("test.road",
- "id:0,geom:LineString,name:String");
+ "id:0,geom:LineString,name:String,uuid:UUID");
assertEquals(0, DataUtilities.compare(road3, roadType));
}
|
|
From: <svn...@os...> - 2012-02-04 11:09:13
|
Author: aaime
Date: 2012-02-04 03:09:07 -0800 (Sat, 04 Feb 2012)
New Revision: 38552
Modified:
branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java
Log:
[GEOT-4032] TemportalConverterFactoryTest.testCalendarToTime failing in certain time zones, patch by Shane StClair
Modified: branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java
===================================================================
--- branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java 2012-02-04 11:08:38 UTC (rev 38551)
+++ branches/2.7.x/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java 2012-02-04 11:09:07 UTC (rev 38552)
@@ -102,7 +102,7 @@
}
public void testCalendarToTime() throws Exception {
- Calendar calendar = Calendar.getInstance();
+ Calendar calendar = Calendar.getInstance( TimeZone.getTimeZone("GMT") );
calendar.clear();
calendar.set(Calendar.HOUR_OF_DAY, 17);
calendar.set(Calendar.MINUTE, 0);
|
|
From: <svn...@os...> - 2012-02-04 11:08:45
|
Author: aaime
Date: 2012-02-04 03:08:38 -0800 (Sat, 04 Feb 2012)
New Revision: 38551
Modified:
trunk/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java
Log:
[GEOT-4032] TemportalConverterFactoryTest.testCalendarToTime failing in certain time zones, patch by Shane StClair
Modified: trunk/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java
===================================================================
--- trunk/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java 2012-02-04 11:06:12 UTC (rev 38550)
+++ trunk/modules/library/main/src/test/java/org/geotools/util/TemporalConverterFactoryTest.java 2012-02-04 11:08:38 UTC (rev 38551)
@@ -102,7 +102,7 @@
}
public void testCalendarToTime() throws Exception {
- Calendar calendar = Calendar.getInstance();
+ Calendar calendar = Calendar.getInstance( TimeZone.getTimeZone("GMT") );
calendar.clear();
calendar.set(Calendar.HOUR_OF_DAY, 17);
calendar.set(Calendar.MINUTE, 0);
|
|
From: <svn...@os...> - 2012-02-04 11:06:19
|
Author: aaime
Date: 2012-02-04 03:06:12 -0800 (Sat, 04 Feb 2012)
New Revision: 38550
Modified:
trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileDataStore.java
trunk/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/ShapefileDataStoreTest.java
Log:
[GEOT-4031] Add UUID support to shapefile output, patch by Shane StClair
Modified: trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileDataStore.java
===================================================================
--- trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileDataStore.java 2012-02-04 11:04:45 UTC (rev 38549)
+++ trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileDataStore.java 2012-02-04 11:06:12 UTC (rev 38550)
@@ -1166,7 +1166,7 @@
header.addColumn(colName, 'D', fieldLen, 0);
} else if (colType == Boolean.class) {
header.addColumn(colName, 'L', 1, 0);
- } else if (CharSequence.class.isAssignableFrom(colType)) {
+ } else if (CharSequence.class.isAssignableFrom(colType) || colType == java.util.UUID.class) {
// Possible fix for GEOT-42 : ArcExplorer doesn't like 0 length
// ensure that maxLength is at least 1
header.addColumn(colName, 'C', Math.min(254, fieldLen), 0);
Modified: trunk/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/ShapefileDataStoreTest.java
===================================================================
--- trunk/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/ShapefileDataStoreTest.java 2012-02-04 11:04:45 UTC (rev 38549)
+++ trunk/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/ShapefileDataStoreTest.java 2012-02-04 11:06:12 UTC (rev 38550)
@@ -34,6 +34,7 @@
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
+import java.util.UUID;
import org.geotools.TestData;
import org.geotools.data.DataUtilities;
@@ -538,7 +539,8 @@
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTimeInMillis(i);
build.add(calendar);
-
+ build.add(UUID.randomUUID());
+
SimpleFeature feature = build.buildFeature(null);
features.add(feature);
}
@@ -561,6 +563,7 @@
build.add("k", BigDecimal.class);
build.add("l", BigInteger.class);
build.add("m", Calendar.class);
+ build.add("n", UUID.class);
return build.buildFeatureType();
}
|