Stefano,

the app-schema resolver gives priority to schemas on the classpath over 
schemas downloaded and stored in the app-schema cache:
http://docs.geoserver.org/latest/en/user/data/app-schema/app-schema-resolution.html

The gt-app-schema module includes several test dependencies that are jar 
files containing application schemas, built using these poms (and 
manually deployed to the osgeo Maven repository):
https://github.com/geotools/geotools/tree/master/modules/extension/app-schema/app-schema-packages

I will list these schema jars later in this email.

By manually adding the gt-app-schema project to the GeoServer classpath 
rather than using Maven eclipse:eclipse (with the -Papp-schema profile) 
you are adding transitive dependencies and including test dependencies. 
Key differences between Maven and Eclipse are that Eclipse has no 
concept of phase (compile versus test) and no way of excluding 
transitive dependencies. Eclipse dependencies tend to be a superset of 
Maven dependencies.

Maven dependency:tree with -Papp-schema inside GeoServer src/web/app 
includes only the following related to app-schema (no schema jars):

[INFO] +- org.geotools:gt-app-schema:jar:14-SNAPSHOT:compile
[INFO] |  +- org.geotools:gt-complex:jar:tests:14-SNAPSHOT:compile
[INFO] |  +- commons-digester:commons-digester:jar:1.7:compile
[INFO] |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] |  +- org.geotools:gt-app-schema-resolver:jar:14-SNAPSHOT:compile
[INFO] |  \- xpp3:xpp3_min:jar:1.1.4c:compile

Now compare with this excerpt (schema jars only) from Maven 
dependency:tree run inside GeoTools 
modules/extension/app-schema/app-schema; all these will be included by 
your Eclipse project dependency:

[INFO] +- org.geotools.schemas:geosciml-2.0:jar:2.0.2-4:test
[INFO] |  +- org.geotools.schemas:gml-3.1:jar:3.1.1-4:test
[INFO] |  |  \- org.geotools.schemas:xlink-1.0:jar:1.0.0-3:test
[INFO] |  +- org.geotools.schemas:sampling-1.0:jar:1.0.0-4:test
[INFO] |  |  +- org.geotools.schemas:om-1.0:jar:1.0.0-4:test
[INFO] |  |  |  \- org.geotools.schemas:sensorML-1.0:jar:1.0.1-4:test
[INFO] |  |  |     \- org.geotools.schemas:ic-2.0:jar:2.0.0-3:test
[INFO] |  |  \- org.geotools.schemas:sweCommon-1.0:jar:1.0.1-4:test
[INFO] |  \- org.geotools.schemas:cgiutilities-1.0:jar:1.0.0-4:test
[INFO] +- org.geotools.schemas:earthresourceml-1.1:jar:1.1.0-3:test
[INFO] +- org.geotools.schemas:xml-1.0:jar:1.0.0-3:test
[INFO] +- org.geotools.schemas:geosciml-3.0-seegrid:jar:3.0.0-1:test
[INFO] |  +- org.geotools.schemas:gml-3.2:jar:3.2.1-1:test
[INFO] |  +- org.geotools.schemas:iso-19139-2007:jar:1.0.0-1:test
[INFO] |  +- org.geotools.schemas:iso-19156-seegrid:jar:2.0.0-1:test
[INFO] |  |  +- org.geotools.schemas:om-2.0:jar:2.0.0-1:test
[INFO] |  |  \- org.geotools.schemas:sampling-2.0:jar:2.0.0-1:test
[INFO] |  \- org.geotools.schemas:sweCommon-1.0-gml32:jar:1.0.1-1:test
[INFO] +- org.geotools.schemas:geosciml-3.2:jar:3.2.0-1:test
[INFO] |  +- org.geotools.schemas:sweCommon-2.0:jar:2.0-1:test
[INFO] |  |  \- org.geotools.schemas:xlink-1999:jar:1.0.0-1:test
[INFO] |  \- org.geotools.schemas:samplingSpatial-2.0:jar:2.0-1:test

You have added to the Eclipse classpath jars that contain GML 3.2, GMD, 
a pre-release O&M 2.0 (iso-19156-seegrid), and Sampling, amongst others. 
The app-schema resolver will give these priority over anything it caches 
from the net, so you may be using these older Maven-cached versions of 
the schemas, not the latest ones from the net.

Kind regards,
Ben.

On 24/06/15 05:35, Stefano Costa wrote:
> Hi all,
> I'm resurrecting this old thread because I've been working on this again
> and I've made a few new discoveries.
>
> As a quick reminder, the mapping I'm struggling with is:
>
> <AttributeMapping>
>    <targetAttribute>
> lcv:extent/gmd:EX_Extent/gmd:geographicElement/gmd:EX_BoundingPolygon/gmd:polygon/gml:AbstractGeometry
>    </targetAttribute>
>    <sourceExpression><OCQL>geom</OCQL></sourceExpression>
>    <targetAttributeNode>gml:MultiSurfaceType</targetAttributeNode>
> </AttributeMapping>
>
> which produces an empty gml:AbstractGeometry tag.
>
> First of all, the weirdest of thigs: I found a way to make it work as
> expected (actually, my colleague Mauro Bartolomeoli did).
> Steps to reproduce:
> 1) inside Eclipse, import all GeoServer projects, plus gt-app-schema
> from GeoTools.
> 2) add the gt-app-schema project to the classpath of gs-web-app the
> Eclipse way (Configure build path --> Projects --> Add) and NOT by
> running mvn eclipse:clean eclipse:eclipse -Papp-schema
> 3) start GeoServer from Eclipse... et voilĂ , it works! The
> gml:AbstractGeometry tag inside gmd:polygon is correctly encoded as a
> gml:MultiSurface geometry.
> If I run GeoServer from Eclipse the standard way or build a WAR, deploy
> and run it, all I get is an empty gml:AbstractGeometry element.
>
> Second, I've found where the code goes wrong, but I can't explain why.
> The problem occurs inside org.geotools.xml.Encoder, line 769:
>
> if (entry.element.isAbstract()) {
> ..
> }
>
> If I run GeoServer from Eclipse the standard way, when the time to
> encode gml:AbstractGeometry comes, entry.element.isAbstract() returns
> false, causing the code inside the if block to be skipped. If I add
> gt-app-schema to the build path as described previously,
> entry.element.isAbstract() returns true and the geometry is encoded just
> fine.
> Apparently, this wrong element declaration comes from a call to
> encoder.getSchemaIndex().getChildElementParticles() inside the class
> org.geotools.xml.impl.BindingPropertyExtractor:
> https://github.com/geotools/geotools/blob/aa0d0346e4bb4a5a2055559c22d2b12ded7cbd20/modules/extension/xsd/xsd-core/src/main/java/org/geotools/xml/impl/BindingPropertyExtractor.java#L71
>
>
> Does this ring any bell? Any suggestion on what other things I could
> try?
>
> BTW, I'm working on GeoServer/GeoTools master.
>
> Many thanks!

-- 
Ben Caradoc-Davies <b...@transient.nz>
Director
Transient Software Limited <http://transient.nz/>
New Zealand

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to