Couldn't you use the Provider approach that is for instance used in the neo4j 
indexing module.
So whenever you leave off the lucene-jars from your maven pom or class path 
there is no lucene indexer (which might be fine for you).

Mostly this could be done by declaring the dependencies as scope-provided, and 
instantiating the relevant classes (that refer to the geotools libs) only
if and when they are triggered externally (export, providing DataSource for 
GeoTools server, etc). Java classes that are not loaded don't request their 
dependencies.

That should get you rid of most of the deps as a developer using neo4j spatial, 
I assume the only dependency you'd need then is neo4j and jts both of which are 
transitively pulled.

Cheers

Michael


Am 15.03.2011 um 21:55 schrieb Craig Taverner:

> Hi,
> 
> There were a few comments on twitter about the use of GeoTools in Neo4j
> Spatial, so I wanted to elaborate on the discussion with a short description
> of where and why we include some GeoTools libraries in Neo4j Spatial.
> 
> The discussion started with two tweets by
> martengustafson<http://twitter.com/#!/martengustafson>
> :
> 
> Current state of Java GIS libraries and their interdependencies:
> #fail<http://twitter.com/#!/search?q=%23fail>
> 
> followed shortly by:
> 
> I'm sorry Neo4J spatial. I'm sure you're nice and all but the endless cruft
> that is OpenGIS and GeoTools brought you down with them.
> 
> 
> There followed a short chat between Martin and I to find out what his
> concerns were. You can follow the chat on twitter, but my summary of it is
> that Martin noticed the use of the Coordinate and Geometry classes in my
> blog post at
> http://blog.neo4j.org/2011/03/neo4j-spatial-part1-finding-things.html. In
> addition he noticed that to run the test cases, or the code on the blog, you
> needed to include geotools libraries in the classpath, and he had negative
> experiences with geotools in the past. So he felt this dependency reflected
> negatively on Neo4j Spatial.
> 
> My answers to Martin were to explain briefly why we use GeoTools and where.
> I would like to elaborate in more detail here. Firstly, the main core of
> Neo4j Spatial does not use GeoTools, but rather JTS, a lower level topology
> library with a lot less dependency-complexity than GeoTools, and so
> hopefully much less of a concern to Martin. The Coordinate and Geometry
> classes used in the blog are from JTS. Martin admitted that he thought JTS
> used GeoTools, not the other way round. The TestSimplePointLayer test case
> the blog was based on has no GeoTools dependencies itself.
> 
> However, the fact remains that several GeoTools libraries are still
> dependencies of Neo4j Spatial. While the core design does not require
> GeoTools, there are three places they are used:
> 
>   - The API's to expose the Neo4j Spatial data to well known GIS's that use
>   GeoTools, like
> GeoServer<http://wiki.neo4j.org/content/Neo4j_Spatial_in_GeoServer>and
>   uDig <http://wiki.neo4j.org/content/Neo4j_Spatial_in_uDig>. Obviously we
>   need GeoTools libraries to enable GeoTools compatibility.
>   - Some current and future import/export utiltiies. The ShapefileImporter,
>   for example, uses GeoTools support for reading shapefiles. We have
>   investigated, but not included, GeoJSON support based on GeoTools also.
>   - The DefaultLayer implementation uses GeoTools for the WKB and WKT
>   Geometry Encoders, since WKB and WKT are well supported in GeoTools. While
>   this is currently part of the core code, the design of Neo4j Spatial is
>   plugable, so you do not need to use this code. However, you do need to
>   include the relevant GeoTools libraries.
> 
> Early on in the project, it was considered to split Neo4j Spatial into two
> parts, a core that only required JTS and extensions that required GeoTools.
> However, this route was not taken for a few reasons. Chief among them was
> the fact that most people trying out Neo4j Spatial were happy with maven,
> and so dependencies were not a serious issue. So simplicity of development
> won out, and we kept GeoTools dependencies in the core.
> 
> Recently I felt the negative side of this when I developed the
> neo4j-spatial.rb <https://rubygems.org/gems/neo4j-spatial> Ruby gem, and
> needed to include dependencies in the gem. The maven dependencies were a bit
> over zealous and so too many libraries were included. Michael Hunger came to
> the rescue and cleaned up the dependencies somewhat, so the current gem is
> quite a lot thinner than the earlier ones.
> 
> Anyway, aside from my larger-than-necessary early gems, Martins concerns on
> twitter are the first community criticism of the use of GeoTools in Neo4j
> Spatial. I would like to know if others feel this is something we should be
> concerned with, and try to split the core out so as not to require GeoTools?
> My personal impression is that the benefits far outweigh the disadvantages,
> but I would like to know what others think.
> 
> Regards, Craig
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to