[Gvsig_english] [ gvSIG 2.0 extension development ] How toimplement and register a new DAL provider

Jorge Piera Llodrá jpiera at prodevelop.es
Wed Aug 4 09:15:17 CEST 2010


On 08/04/2010 01:31 AM, luca bianconi wrote:
> Hi all,
>
> it has past some time since I've started studying gvSIG DAL providing 
> system and, even if I've received many useful explanations (thanks 
> kind Cèsar!), read longly the documentation [1] about it, read other 
> DAL providers code, made coding tests, I'm unfortunately still plenty 
> of doubts.
>
> I'd like asking the community some help to understand some things (I'm 
> very sorry if some of them could sound very trivial to some of you).
>
> First of all, just a curiosity I'd like to ask Spanish speaking people :
> I understand the word "almacèn" as "provider", referred in 
> documentation as the DAL provider. Is it correct ?

I'm not completely agree. An "Almacén" is a "DataStore" that uses a 
provider (DataStoreProvider) to retrieve data from a data source.

The "Almacen o DataStore" is the API of DAL that can be used by a data 
consumer to retrieve data. Providers are a part of the Service Provider 
Interface (SPI) and they register in DAL new formats that can be managed 
using the DAL API.

>
> If this is correct, and I want to register a new DAL provider I guess, 
> after having of course read the whole available (as much as I know) 
> documentation [1] on fmap.dal, I should use as main reference the 
> chapter "Creación de un nuevo almacén" [2] .

This document explains how you can create a new DataStore using the API. 
In this example it is creating a new DBF. The "DBF provider" has to be 
previously registered with a name or the line 
"serverExplorer.getAddParameters("DBF")" will send an exception.

>
> I've been suggested to give a glance, as example, at the extDwg 
> extension for better understanding how the registration of a DAL 
> provider works.
> I see that in this provider, as in other ones, four classes are always 
> implemented:
>
> DWGLibrary -> Does it register the provider ? Does it in 
> doPostInitialize() method ?

Thats right. It registers the DWG provider and the DWG explorer that is 
used to browse by a directory tree for searching DWG's of creating new DWG's

> DWGFilesystemServerProvider, DWGStoreParameters, DWGStoreProvider -> 
> How do they work exactly ? What do they do ?

DWGFilesystemServerProvider -> It is used to browse by a directory tree 
and search DWG resources. It can be used to get the DataStoreParameters 
that are used to open an existing DWG creating a new DataStore or it 
also can be used to get the NewDataStoreParameters that are used to 
create a new DWG.

DWGStoreParameters -> Defines the parameters that are needed to open a DWG

DWGStoreProvider -> This provider is created from a DWGStoreParameters 
and it is able to read (or write) a DWG.

>
> After having implemented it, how can I register the provider with a 
> plugin ?

The project xxx.app.extension is the responsible to add a new plugin in 
gvSIG. It will contain the new provider.
>
> Which class among those provided by the plugin structure  should I use ?
>
> These are the classes:
>
> - A xxxManager: is the entry point to the API. Provides the main 
> services of the library.
> - A xxxLocator: the responsible to provide access to the single 
> Manager instance.
> - A xxxLibrary: initialization and configuration of the library.
> - A xxxService: another interface for the API. You may use it or not 
> depending on your library's functionality.
Well, it depends on any project. The Library class is normally located 
in all the projects, but the other classes will be contained depending 
on what are you developing. (e.g. extDWG is a DAL provider and it don't 
need any Manager)

I Hope I clarify you some doubts.

Regards,
Jorge

>
> Thanks a lot for the help,
> Luca
>
>
> [1] 
> http://www.gvsig.org/web/projects/gvsig-desktop/docs/devel/org.gvsig.fmap.dal/2.0.0/featurestore
> [2] 
> http://www.gvsig.org/web/projects/gvsig-desktop/docs/devel/org.gvsig.fmap.dal/2.0.0/featurestore/consumer-services/creacion-de-un-nuevo-almacen
>
>
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at listserv.gva.es
> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>    


-- 
Jorge Piera Llodrá
gvSIG Development Team
PRODEVELOP
Plaza Don Juan de Villarrasa, 14 - 5
46001 Valencia
Tel: +34 963510612
Fax: +34 963510908
e-mail: jpiera at prodevelop.es
http://www.prodevelop.es
http://www.gvsig.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20100804/a3d3cc03/attachment.htm 


More information about the Gvsig_internacional mailing list