Hi,
while working on cleaning up gt-main I stumbled into this raw type
parameter, in DataStoreFinder:

public static synchronized DataStore getDataStore(Map params) throws
IOException ...
https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/DataStoreFinder.java#L66

while the underlying API requires a Map<String, Serializable>:
https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/DataStoreFactorySpi.java#L94

as well as the DataAccessFactory sibling:
https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/DataAccessFactory.java#L110

At first I thought to fix DataStoreFinder, but then came to realize the API
as declared is not a match for the practice.
DataStore/DataAccess factory accept all kinds of objects that are not
required to be Serializable, are often not Serializable, and don't
make sense to be made Serializable, like:

   - DataSource in JDBC data stores (e.g., JNDI factories)
   - Repository in pre-generalized data store
   - (there might be others, I did not perform an exhaustive search)

I believe the API should be modified to match practice, and require a
"Map<String, ?>" instead.
It will still cause a bit of friction, as for example Properties is not a
match and cannot be cast to it, but for this particular case we can
build a conversion method in DataUtilities.

Opinions?

Cheers
Andrea

== 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 di Montramito 3/A 55054 Massarosa
(LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
http://www.geo-solutions.it http://twitter.com/geosolutions_it
------------------------------------------------------- *Con riferimento
alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 -
Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni
circostanza inerente alla presente email (il suo contenuto, gli eventuali
allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i
destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per
errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
sarei comunque grato se potesse darmene notizia. This email is intended
only for the person or entity to which it is addressed and may contain
information that is privileged, confidential or otherwise protected from
disclosure. We remind that - as provided by European Regulation 2016/679
“GDPR” - copying, dissemination or use of this e-mail or the information
herein by anyone other than the intended recipient is prohibited. If you
have received this email by mistake, please notify us immediately by
telephone or e-mail.*
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to