[Geoserver-devel] CoverageStoreInfo (package org.vnf.geoserver.global in main module)

Dear list,

I'm creating a new type of Coverage Store, that does not require an URL to be set by the user.
In fact, the user has to fill two new fields I've added to the form : date and series.
With this information, I'm able to get the appropriate file in my system directory, using a connection on a Postgis database, which stores the path, date and series of raster files on my computer.

But I have a problem : I've added two fields Date and Series to the form, but when I fill these fields, I'm not able to get the values that I've put.

In the main module, in org.vnf.geoserver.global.CoverageStoreInfo.java, I've added two private variables date and series (two String), with getters/setters.
I've added them in the constructor and in the toDTO() method too.
I've done the same for org.vfny.geoserver.global.dto.CoverageStoreInfoDTO.java, and for org.vfny.geoserver.config.CoverageStoreConfig.java, where I've put for date the format for my date "dd/MM/yyyy hh:mm:ss". When I configure the plugin, this string appears correctly in my date fields.

So I've configured the whole form for my coverage (letting the url fields empty, I've disabled the test which verify that the url fields contains a valid way for a file), and I thought the getReader() method in CoverageStoreInfo returned a GridCoverageReader, but it returns null.
In this method this line "final CoverageStoreInfo gcInfo = data.getFormatInfo(id);" gives me a null value for the variable gcInfo. Is this a normal thing ? Because with gcInfo, I thought I would be able to make a gcInfo.getDate() and a gcInfo.getSeries(), to get these values...
The "id" variable contains the name for the coverage store I've just written (so it's ok), but the data private parameter for this class does not seem to contain an entry for the format I'm setting up.
I've seen that, for the GeoTiff plugin, the same null value seems to be returned, so maybe it is the normal behaviour, because the coverage store is not completely set.

My question is :
- In which class the values that I set (date and series) in the Coverage Store form can be gotten ?

Thanks for your attention,
Cédric B.

Cédric Briançon ha scritto:

Dear list,

I'm creating a new type of Coverage Store, that does not require an URL to be set by the user.
In fact, the user has to fill two new fields I've added to the form : date and series.
With this information, I'm able to get the appropriate file in my system directory, using a connection on a Postgis database, which stores the path, date and series of raster files on my computer.

But I have a problem : I've added two fields Date and Series to the form, but when I fill these fields, I'm not able to get the values that I've put.

Have you modified the form file? Struts is a kludge, you have to modify
a ton of files to have a simple form work, afaik you have to modify
the action class, the form class, and the struts configuration too (bleah!).
Use other attributes in the same form as a reference and copy.

In the main module, in org.vnf.geoserver.global.CoverageStoreInfo.java, I've added two private variables date and series (two String), with getters/setters.
I've added them in the constructor and in the toDTO() method too.
I've done the same for org.vfny.geoserver.global.dto.CoverageStoreInfoDTO.java, and for org.vfny.geoserver.config.CoverageStoreConfig.java, where I've put for date the format for my date "dd/MM/yyyy hh:mm:ss". When I configure the plugin, this string appears correctly in my date fields.

So I've configured the whole form for my coverage (letting the url fields empty, I've disabled the test which verify that the url fields contains a valid way for a file), and I thought the getReader() method in CoverageStoreInfo returned a GridCoverageReader, but it returns null.
In this method this line "final CoverageStoreInfo gcInfo = data.getFormatInfo(id);" gives me a null value for the variable gcInfo. Is this a normal thing ?

It usually means you did not apply the changes after saving them.
Have you tried running Geoserver form the Start.java class you can
find in the web module (test section) and eventually step by step
debug it?

Because with gcInfo, I thought I would be able to make a gcInfo.getDate() and a gcInfo.getSeries(), to get these values...
The "id" variable contains the name for the coverage store I've just written (so it's ok), but the data private parameter for this class does not seem to contain an entry for the format I'm setting up.
I've seen that, for the GeoTiff plugin, the same null value seems to be returned, so maybe it is the normal behaviour, because the coverage store is not completely set.

That is a bit new to me, but I did not write the Coverage config stuff
so I may be just out of touch as you. Alessio, do you know more?

My question is :
- In which class the values that I set (date and series) in the Coverage Store form can be gotten ?

Usually configuration is written first to CoverageStoreInfoDTO, and one
you hit apply, transferred to CoverageStoreInfo too...

Cheers
Andrea

Andrea Aime a écrit :

Cédric Briançon ha scritto:

Dear list,

I'm creating a new type of Coverage Store, that does not require an URL to be set by the user.
In fact, the user has to fill two new fields I've added to the form : date and series.
With this information, I'm able to get the appropriate file in my system directory, using a connection on a Postgis database, which stores the path, date and series of raster files on my computer.

But I have a problem : I've added two fields Date and Series to the form, but when I fill these fields, I'm not able to get the values that I've put.

Have you modified the form file? Struts is a kludge, you have to modify
a ton of files to have a simple form work, afaik you have to modify
the action class, the form class, and the struts configuration too (bleah!).
Use other attributes in the same form as a reference and copy.

I've found my error : in the web module, in CoverageStoresEditorAction, I've forgotten to add a series and date values, which are instanciated with the values in the form, and then sent to the CoverageStoreConfig... :frowning:
Now I can get the values in my form, I've to think about how I can transmit these values to my CoverageStoreReader. Maybe I will try to add a series and date variables in the AbstractGridCoverage2DReader class of Geotools' coverage module. With that, my coverage reader can get these parameters to select the right file I want (using the postgres DB already configured) and return the GridCoverage I've requested ...

Thanks for your answer :slight_smile:

In the main module, in org.vnf.geoserver.global.CoverageStoreInfo.java, I've added two private variables date and series (two String), with getters/setters.
I've added them in the constructor and in the toDTO() method too.
I've done the same for org.vfny.geoserver.global.dto.CoverageStoreInfoDTO.java, and for org.vfny.geoserver.config.CoverageStoreConfig.java, where I've put for date the format for my date "dd/MM/yyyy hh:mm:ss". When I configure the plugin, this string appears correctly in my date fields.

So I've configured the whole form for my coverage (letting the url fields empty, I've disabled the test which verify that the url fields contains a valid way for a file), and I thought the getReader() method in CoverageStoreInfo returned a GridCoverageReader, but it returns null.
In this method this line "final CoverageStoreInfo gcInfo = data.getFormatInfo(id);" gives me a null value for the variable gcInfo. Is this a normal thing ?

It usually means you did not apply the changes after saving them.
Have you tried running Geoserver form the Start.java class you can
find in the web module (test section) and eventually step by step
debug it?

Because with gcInfo, I thought I would be able to make a gcInfo.getDate() and a gcInfo.getSeries(), to get these values...
The "id" variable contains the name for the coverage store I've just written (so it's ok), but the data private parameter for this class does not seem to contain an entry for the format I'm setting up.
I've seen that, for the GeoTiff plugin, the same null value seems to be returned, so maybe it is the normal behaviour, because the coverage store is not completely set.

That is a bit new to me, but I did not write the Coverage config stuff
so I may be just out of touch as you. Alessio, do you know more?

My question is :
- In which class the values that I set (date and series) in the Coverage Store form can be gotten ?

Usually configuration is written first to CoverageStoreInfoDTO, and one
you hit apply, transferred to CoverageStoreInfo too...

Cheers
Andrea

Cédric Briançon ha scritto:
...

I've found my error : in the web module, in CoverageStoresEditorAction, I've forgotten to add a series and date values, which are instanciated with the values in the form, and then sent to the CoverageStoreConfig... :frowning:
Now I can get the values in my form, I've to think about how I can transmit these values to my CoverageStoreReader. Maybe I will try to add a series and date variables in the AbstractGridCoverage2DReader class of Geotools' coverage module. With that, my coverage reader can get these parameters to select the right file I want (using the postgres DB already configured) and return the GridCoverage I've requested ...

Sigh, yeah, there are so many places to edit that the likeliness to do
it right the first shot is in close proximity of zero... :frowning:

Expanding the topic a bit, I think Simone was fiddling with some idea
to make coverage formats accept multiple parameters just like data
store do. Simone, is this still in the works, and if so, can you
give us some updates? I think Saul would be interested as well,
with his ArcSDE raster extensions.

Cheers
Andrea