Hi Andrea,

As quoted from Andrea Aime <[EMAIL PROTECTED]>:
> Gertjan van Oosten ha scritto:
> > When I try to insert a feature of this type (from my Java code, using
> > FeatureType, FeatureStore, FeatureCollection etc.), the data that gets
> > sent to the WFS-T (Geoserver) contains this on the wire:
> > 
> >   [...]
> >   <west:timestamp>Wed Feb 22 20:15:00 CET 1995</west:timestamp>
> >   [...]
> > 
> > Geoserver then (rightly) complains that it can't parse that into a
> > java.util.Date.  (I say rightly, because that string does not conform to
> > the XML Schema spec. for the dateTime datatype.)
> > 
> > This is with the gt2-2.4-M4 jars.  What can I do to get it to format the
> > dateTime correctly?
> 
> Debug and provide a fix? :)

Bummer, that's not the answer I was hoping for... ;-)

> I guess you're using the WFS datastore right?

Yup; my code started out from the
  demo/example/src/main/java/org/geotools/demo/example/WFSExample.java
Except that I create a new feature of course, something like this:

      final Transaction t                = new DefaultTransaction();
      final FeatureType       ft         =
        FeatureTypeBuilder.newFeatureType(
          data.getSchema(typeName).getAttributeTypes(), typeName
        );
      final Feature           newFeature = ft.create(attributes);
      final FeatureStore      store      =
        (FeatureStore) data.getFeatureSource(typeName);
      final FeatureCollection features   = FeatureCollections.newCollection();
      features.add(newFeature);
      store.setTransaction(t);
      store.addFeatures(features);
      t.commit();

> Locate where the feature is produced,

I tried to follow the code, but I got lost.  Any pointers?

> and then use DateUtils to encode
> the date with the appropriate type, and you should get exactly the
> same behaviour as GeoServer.

We-ellll...  GeoServer (at least the 1.5.1 I'm running) still uses
the class TemporalAttributeType that does:

    // this might be right, maybe not, but anyway, its a default formatting
    static java.text.DateFormat format = java.text.DateFormat.getInstance();

for new features.  Which uses some default DateTime format that is
Locale-dependent, and not the ISO 8601 format that is used when updating
existing features.  There are open issues on JIRA for that one IIRC.
And yes, it's *very* inconvenient, so my application currently has a
work-around: if the feature is new (has no fid) I use a Locale-dependent
format, otherwise I use the ISO 8601 format...

> As you can see, I'm wasn't kidding, the WFS datastore is basically
> unmantained at the moment :(

Isn't that a bit odd?  One would think that that would be a core
component...

Regards,
-- 
-- Gertjan van Oosten, [EMAIL PROTECTED], West Consulting B.V., +31 15 2191 600

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to