We made the Datastore API cache connections and reuse them if a user 
requested a connection with the same connection params.  So when you 
load layers from a project file they will reuse already-open connections 
whereever they can.

At least, this is how it's *supposed* to work...  it's been a while 
since I wrote that code, and I don't know if anything changed during the 
port to OJ.  Can someone report on this?

P.Rizzi Ag.Mobilità Ambiente wrote:
> I can't completely understand what you're saying...
> Using the Datastore API you can open several layers from
> a single connection...
> You can try my PostGIS/Oracle plugin from:
> http://sourceforge.net/project/showfiles.php?group_id=118054&package_id=217237
>
> But you pointed out something I never realized before,
> that inside a project/task file each layer has it's connection
> parameter repeated, does it mean that when a project/task is opened
> the Datastore API opens a separate connection for each layer???
> I don't know that...
>
> But the connection dialog lists each connection only once, so there
> may be some smart code that "put together" identical connection
> opening them only once.
>
> I'll have to find the time to debug this...
>
> Anyway something able to "group" layers would be a great thing,
> so you can operate on a "group" (or may we call it a theme???)
> as a whole (hide/show, refresh, etc.).
>
> While I'm at it, even if it's not strictly related to this post,
> it would be great to be able to save inside a project/task file 
> also a layer coming from Datastore query, otherwise you to manually
> recreate and restyle it every time you run OJ anew.
>
> Bye
> Paolo Rizzi
>
>
>   
>> -----Messaggio originale-----
>> Da: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] 
>> conto di Paul
>> Austin
>> Inviato: martedì 29 maggio 2007 22.16
>> A: jump-pilot-devel@lists.sourceforge.net
>> Oggetto: [JPP-Devel] Multiple Layers from the same database connection
>>
>>
>> All,
>>
>> I've been looking at the existing database and file plugins and the
>> com.vividsolutions.jump.io.datasource.DataSource class and from what I
>> can tell there is a one to one relationship between a layer and a data
>> source.
>>
>> What I would like to do for some of the file and database based data
>> sources is to have the concept of a DataSource that can contain many
>> different layers. Within a project you would be able to select which
>> layers you wanted to view from that data source.
>>
>> In the database world this concept would relate to having a connection
>> to the data base using a java.sql.Connection. When adding the database
>> connection to a project there would be a UI that would list the
>> available layers (database tables) and the user could select which
>> layers they wish to view. This compares to the current PostGIS plug-in
>> where you have to manually enter the connection and table details for
>> each layer.
>>
>> When the project is closed then the "connection" must also be closed.
>>
>> In the Jump project file the "connection" parameters would be stored
>> once, then the data sources used for each layer would reference the
>> "connection" and have a different query for each table.
>>
>> Now if we look at a file based example, I have a file format which is
>> basically a zip file that contains one file for each layer along with
>> some metadata files. I would like to be able to open the zip file and
>> create a layer for each of the layers in the zip file. To do this I
>> would extract the file to the temp directory and as required load the
>> data from the individual files in the temp directory. Then when you
>> close the project the "connection" is closed by deleting the temporary
>> files.
>>
>> Another file based example would be to open a directory of files,
>> loading each layer file in that directory, this is basically 
>> the same as
>> the zip file idea but without the temporary files.
>>
>> In both the file cases once the file is loaded the first time the user
>> can select which of the layers to view.
>>
>> So the question is, does any of the existing functionality in 
>> JUMP allow
>> for multi-layer data sources? If not I'm going to do some prototyping
>> for the file format I have and then share this with the group for
>> comment to see if it would be useful elsewhere.
>>
>> After that I have an interest in Oracle connections so would 
>> need to do
>> the same kind of thing there.
>>
>> One other question, where would I find the code for writing out the
>> project .jmp XML files as I'd need to add the "connection" definitions
>> to this.
>>
>> Cheers,
>> Paul
>>
>> --------------------------------------------------------------
>> -----------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Jump-pilot-devel mailing list
>> Jump-pilot-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>
>>     
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to