[Geoserver-devel] Alternate shapefile data store ignored

Any help would be appreciated. I have juat created a Shapefile data
store plugin which access the four
shape file components (.shp,.shx,.dbf,.prj) which are stored in a
repository via a single file url. I used
the ShapefileDataStore and ShapefileDataStoreFactory as templates, and
it seems to work. What I
basically do is parse the single file to get the url's for the
component files and then instantiate
readers for therm. It seems to work, and I can load data and view it
in the demo window
of geoserver.

However when I look in the tomcat logs I see the following exception message:

java.io.FileNotFoundException:
http://localhost:8090/library/bitstream/1876/15/10/parishes.spl.dbf
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1239)
        at org.geotools.data.shapefile.ShapefileDataStore.getReadChannel(ShapefileDataStore.java:329)
        at org.geotools.data.shapefile.ShapefileRendererUtil.getDBFReader(ShapefileRendererUtil.java:101)
        at org.geotools.renderer.shape.ShapefileRenderer.getDBFHeader(ShapefileRenderer.java:270)
        at org.geotools.renderer.shape.ShapefileRenderer.createFeatureType(ShapefileRenderer.java:761)
        at org.geotools.renderer.shape.ShapefileRenderer.processStylers(ShapefileRenderer.java:300)
        at org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:1399)
        at org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:262)
        at org.vfny.geoserver.wms.responses.DefaultRasterMapProducer.produceMap(DefaultRasterMapProducer.java:310)
        at org.vfny.geoserver.wms.responses.GetMapResponse.execute(GetMapResponse.java:424)
        at org.geoserver.ows.adapters.ResponseAdapter.getMimeType(ResponseAdapter.java:48)
        at org.geoserver.ows.Dispatcher.response(Dispatcher.java:616)
        at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:192)
        at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:347)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

The http://localhost:8090/library/bitstream/1876/15/10/parishes.spl is
the file which holds the
list of urls for the various components and is what is sepcified inn
the datastore connection.

It appears to me that in the map renderer the factory data store is
not used to instantiate a data store
but the classic shapefile data store. Can someone say anything about
this, or am I missing something.

John

John Preston ha scritto:

Any help would be appreciated. I have juat created a Shapefile data
store plugin which access the four
shape file components (.shp,.shx,.dbf,.prj) which are stored in a
repository via a single file url. I used
the ShapefileDataStore and ShapefileDataStoreFactory as templates, and
it seems to work. What I
basically do is parse the single file to get the url's for the
component files and then instantiate
readers for therm. It seems to work, and I can load data and view it
in the demo window
of geoserver.

However when I look in the tomcat logs I see the following exception message:

java.io.FileNotFoundException:
http://localhost:8090/library/bitstream/1876/15/10/parishes.spl.dbf
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1239)
        at org.geotools.data.shapefile.ShapefileDataStore.getReadChannel(ShapefileDataStore.java:329)
        at org.geotools.data.shapefile.ShapefileRendererUtil.getDBFReader(ShapefileRendererUtil.java:101)
        at org.geotools.renderer.shape.ShapefileRenderer.getDBFHeader(ShapefileRenderer.java:270)
        at org.geotools.renderer.shape.ShapefileRenderer.createFeatureType(ShapefileRenderer.java:761)
        at org.geotools.renderer.shape.ShapefileRenderer.processStylers(ShapefileRenderer.java:300)
        at org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:1399)
        at org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:262)
        at org.vfny.geoserver.wms.responses.DefaultRasterMapProducer.produceMap(DefaultRasterMapProducer.java:310)
        at org.vfny.geoserver.wms.responses.GetMapResponse.execute(GetMapResponse.java:424)
        at org.geoserver.ows.adapters.ResponseAdapter.getMimeType(ResponseAdapter.java:48)
        at org.geoserver.ows.Dispatcher.response(Dispatcher.java:616)
        at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:192)
        at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:347)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

The http://localhost:8090/library/bitstream/1876/15/10/parishes.spl is
the file which holds the
list of urls for the various components and is what is sepcified inn
the datastore connection.

It appears to me that in the map renderer the factory data store is
not used to instantiate a data store
but the classic shapefile data store. Can someone say anything about
this, or am I missing something.

When you create a datastore with GeoServer a property map is built
with the parameters, and then a finder scans the SPI for all the datastores, and asks each if it can handle the provided parameters.
Given you used shapefile datastore as a template, your datastore
probably asks only for a URL, meaning that both the shapefile datastore
and yours do respond "true" to the request on whether they can handle
the parameter.

Maybe try adding a new parameter to your reader with a default value
so that it can be differentiated from the shapefile one.

Oh, btw, I'm curious, how is your datastore performing? And why weren't
you able to use a shapefile directly?

Cheers
Andrea

John Preston ha scritto:

When you create a datastore with GeoServer a property map is built
with the parameters, and then a finder scans the SPI for all the datastores,
and asks each if it can handle the provided parameters.

This is the call to the canProcess(map) method which should return
true if the SPI can process the url. Yes?

Correct

Given you used shapefile datastore as a template, your datastore
probably asks only for a URL, meaning that both the shapefile datastore
and yours do respond "true" to the request on whether they can handle
the parameter.

My datastore only asks for a url which ends in .spl. Since this is
different from the .shp extention used by shape files, I was thinking
that the regular shapefile datastore would ignore my url. However if
this is not so, are you saying that I need a unique parameter that is
only available in my datastore definition, to force the datastore
finder to only return one datastore for my url. I that it?

I checked the shapefile factory and indeed it should only catch
URL that do end with "shp". What I can suggest is that you setup
GeoServer for debugging and check what's going on when the datastore
is looked up. The web module contains a "Start" class that can
be used to startup GeoServer + embedded Jetty, you can use it
from an IDE to run GeoServer like a normal java app and thus
easily debug it.

This part of the developer guide should give you some clue:
http://geoserver.org/display/GEOSDOC/3+Eclipse+Quickstart

Cheers
Andrea