Hi Leonardo, you should asks these questions on the pertinent devel list, in this case it's going to be 90% of the work in GeoTools so I'm cc'ing it, please subscribe to it before following up with the discussion, and keep the thread on the list.
So, about hstore, as far as I understand it, it's really nothing more than a Java Map equivalent, so I'd go an map it to the Map Java type. And this poses some questions... The first is, the JDBCDataStore maps to SimpleFeature, which would become "not so simple" (we have a similar concern with a feature request asking to parse arrays out of JSON btw). Anyways, it does not look so bad that we would have to rewrite the store to support complex features either, at least imho... And here I need feedback from other developers too, but I believe the jump to the difficulties and slowness of using complex features is not warranted in this case. Fo reference, we already have nested features sneaked in at the JDBCStore level, when we do joins (the result is a feature with some attributes whose value is another SimpleFeature). So let's assume we create a SimpleFeature with a Map<String, String> in one of its fields, to do that, one would have to update this class for the mapping: https://github.com/geotools/geotools/blob/master/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostGISDialect.java Adding a simpler mapping, for UUID, was done in this commit, it might get you started: https://github.com/geotools/geotools/commit/233eac4368904a8319549ed30ed41b0166d99f56 Then we have the actual reading... not sure what ResultSet.getObject will give you back for a hstore in this method: https://github.com/geotools/geotools/blob/master/modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCFeatureReader.java#L627 If it's not a Map, you might need to roll your own ConverterFactory/Converter implementation, you can use the Oracle date converter as a template, here is class and SPI registration: https://github.com/geotools/geotools/blob/master/modules/plugin/jdbc/jdbc-oracle/src/main/java/org/geotools/data/oracle/OracleDateConverterFactory.java https://github.com/geotools/geotools/blob/master/modules/plugin/jdbc/jdbc-oracle/src/main/resources/META-INF/services/org.geotools.util.ConverterFactory This should be it for reading (make sure you have tests for every bit of code you added) without filtering. And then you need to add support for filtering agaisnt HStore entries, assuming you want to use properties like "myHStoreAttribute/myHStoreKey", you'll probably have to modify this class so that it writes the right sql: https://github.com/geotools/geotools/blob/master/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/FilterToSqlHelper.java Then it's the turn of output generation. Nothing uses a Map yet, so you're on greenfield, and you'll have to add support for each and every output you need. Rendering and filtering wise, the properties of the map need to be made accessible, so I guess you'll need to write your own PropertyAccessor... and I'm not sure how that can work, people that have worked on complex features might want to chime in here. Finally, you have the WFS output formats in GeoServer, none of them knows about Map, you'll have to upgrade each one of them in a different way I'm afraid. XML wise, I believe you'll want to to map the Map property to xs:Any, and then modify the GML encoders to handle that. On the master series the GML encoding of simple features is delegated to the set of classes emanating from this one: https://github.com/geotools/geotools/blob/master/modules/extension/xsd/xsd-gml2/src/main/java/org/geotools/gml2/simple/FeatureCollectionEncoderDelegate.java And then there are the other formats too... shapefile, csv, geojson, excel, and so on... each one will likely need a differen strategy to handle a map with variable content. It's going to be quite a bit of work, hopefully the discussion on the list here will make some things a bit clearer. Oh, don't forget to read the contribution instructions about copyright assignment, developing on master, tests, coding conventions and so on: https://github.com/geotools/geotools/blob/master/CONTRIBUTING.md Cheers Andrea On Thu, Jul 30, 2015 at 8:59 PM, Leonardo Graterol <[email protected]> wrote: > Hi, > > I'm sorry to bother you. > > I read this discussion about HStore support in Geoserver where you > suggested that the feature could be added to Geoserver if someone had the > time to do it. > > http://sourceforge.net/p/geoserver/mailman/message/31941408/ > > I really need HStore support in Geoserver for a LARGE project I'm working > and I'd be willing to contribute if you could point me in the right > direction in the source code. > > Regards > > Leonardo Graterol UquillasDesarrollador de Software > > 56 2 2829 5027 | 56 2 2829 5000 > [email protected] | > www.mapcity.com | <http://www.mapcity.com/> > corp.mapcity.cl <http://corporativo.mapcity.com/> > > San Sebastián 2952, piso 3, Las Condes, Santiago, Chile > <http://www.mapcity.cl/#t=1:a=CALLE_SAN_SEBASTIAN__2952.LAS_CONDES> > <http://corporativo.mapcity.com/> > <http://zoominmobiliario.com/> <http://www.mientorno.cl/home#/home> > <http://www.justter.com/#/center=-33.423132,-70.61119&zoom=15> > > Cuide el medio ambiente, no imprima este mensaje de no ser necesario > -- == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003. The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc. -------------------------------------------------------
------------------------------------------------------------------------------
_______________________________________________ GeoTools-Devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
