I guess if the binding declares it returns ReferencedEnvelope.class in
getType() it should be respected...
like in class EnvelopeTypeBinding extends AbstractComplexTypeBinding{
public Class getType() {
return ReferencedEnvelope.class;
}
}
though not sure that is the solution actually...
Gabriel
On Thursday 10 July 2008 03:43:30 pm Alessio Fabiani wrote:
> Hi all,
>
> I'm trying to create a new binding for the GML EnvelopeType as a JTS
> Envelope, since I couldn't use geotools gml2/3 EMF models due to some
> specific Elements defined only for WCS 1.0.0.
> Nevertheless I followed the implementation of the existing gt-GML3 module
> EvnelopeTypeBinding, returning a ReferencedEnvelope object as result of the
> EnvelopeTypeBinding parsing.
>
> Now ... all seems working fine until I try to parse a WCS 1.0.0
> SpatialSubsetType ... here I get an exception like the following:
>
> org.vfny.geoserver.wcs.WcsException: Parsing failed, the xml request is
> most probably not compliant to the wcs schema
> at org.geoserver.wcs.xml.v1_0_0.WcsXmlReader.read(WcsXmlReader.java:50)
> at
> org.geoserver.wcs.xml.GetCoverageXmlParserTest.testBasic(GetCoverageXmlPars
>erTest.java:86) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
> java.lang.reflect.Method.invoke(Unknown Source)
> at junit.framework.TestCase.runTest(TestCase.java:164)
> at junit.framework.TestCase.runBare(TestCase.java:130)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:120)
> at junit.framework.TestSuite.runTest(TestSuite.java:230)
> at junit.framework.TestSuite.run(TestSuite.java:225)
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3
>TestReference.java:130) at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:
>38) at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestR
>unner.java:460) at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestR
>unner.java:673) at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner
>.java:386) at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunne
>r.java:196) Caused by: java.lang.RuntimeException: Parsing failed for
> spatialSubset: java.lang.RuntimeException: Unable to set property: Envelope
> for eobject: { http://www.opengis.net/wcs}SpatialSubsetType
> at org.geotools.xml.impl.ParseExecutor.visit(ParseExecutor.java:152)
> at
> org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWa
>lker.java:208) at
> org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:174) at
> org.geotools.xml.impl.ElementHandlerImpl.endElement(ElementHandlerImpl.java
>:222) at
> org.geotools.xml.impl.ParserHandler.endElement(ParserHandler.java:582)
> at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
> Source)
> at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispat
>cher.dispatch(Unknown Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.geotools.xml.Parser.parse(Parser.java:180)
> at org.geotools.xml.Parser.parse(Parser.java:158)
> at org.geoserver.wcs.xml.v1_0_0.WcsXmlReader.read(WcsXmlReader.java:48)
> ... 19 more
> Caused by: java.lang.RuntimeException: Unable to set property: Envelope for
> eobject: {http://www.opengis.net/wcs}SpatialSubsetType
> at
> org.geotools.xml.AbstractComplexEMFBinding.setProperty(AbstractComplexEMFBi
>nding.java:271) at
> org.geotools.xml.AbstractComplexEMFBinding.setProperties(AbstractComplexEMF
>Binding.java:202) at
> org.geotools.xml.AbstractComplexEMFBinding.parse(AbstractComplexEMFBinding.
>java:143) at
> org.geotools.xml.impl.ParseExecutor.visit(ParseExecutor.java:143) ... 35
> more
> Caused by: java.lang.ClassCastException: The feature 'envelope's type
> 'EnvelopeType' does not permit a value of type
> 'org.geotools.geometry.jts.ReferencedEnvelope'
> at
> org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$BasicFeatureMapEntry.vali
>date(EStructuralFeatureImpl.java:2843) at
> org.eclipse.emf.ecore.util.FeatureMapUtil.createEntry(FeatureMapUtil.java:1
>46) at
> org.eclipse.emf.ecore.util.BasicFeatureMap.createEntry(BasicFeatureMap.java
>:94) at
> org.eclipse.emf.ecore.util.BasicFeatureMap.addAll(BasicFeatureMap.java:1253
>) at
> org.eclipse.emf.ecore.util.FeatureMapUtil$FeatureEList.addAll(FeatureMapUti
>l.java:656) at org.geotools.xml.EMFUtils.add(EMFUtils.java:93)
> at
> org.geotools.xml.AbstractComplexEMFBinding.setProperty(AbstractComplexEMFBi
>nding.java:230) ... 38 more
>
> And if I return an EvnelopeType all works well ...
>
> any ideas? am I missing something? Do I have to build a geotools converter
> or something like that?
>
> Any help kindly appreciated.
>
> Cheers,
> Alessio.
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel