hey Mike,

how about simply adding it to ReaderWriterFileDataSource.getDriverProperties() 
? a uri should probably be checked for a file:// prefix before creating a file 
path out of it.

..ede

On 06.10.2016 13:46, [email protected] wrote:
> Revision: 5052
>           http://sourceforge.net/p/jump-pilot/code/5052
> Author:   michaudm
> Date:     2016-10-06 11:46:06 +0000 (Thu, 06 Oct 2016)
> Log Message:
> -----------
> Revert most of r5047 commit, work in progress
> 
> Revision Links:
> --------------
>     http://sourceforge.net/p/jump-pilot/code/5047
> 
> Modified Paths:
> --------------
>     
> core/trunk/src/com/vividsolutions/jump/io/datasource/ReaderWriterFileDataSource.java
>     
> core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/OpenProjectPlugIn.java
>     core/trunk/src/jumptest/io/Playground.java
>     core/trunk/src/org/openjump/core/ui/io/file/DataSourceFileLayerLoader.java
>     
> core/trunk/src/org/openjump/core/ui/plugin/file/open/OpenProjectWizard.java
>     
> core/trunk/src/org/openjump/core/ui/plugin/mousemenu/SaveDatasetsPlugIn.java
> 
> Modified: 
> core/trunk/src/com/vividsolutions/jump/io/datasource/ReaderWriterFileDataSource.java
> ===================================================================
> --- 
> core/trunk/src/com/vividsolutions/jump/io/datasource/ReaderWriterFileDataSource.java
>       2016-10-06 10:57:45 UTC (rev 5051)
> +++ 
> core/trunk/src/com/vividsolutions/jump/io/datasource/ReaderWriterFileDataSource.java
>       2016-10-06 11:46:06 UTC (rev 5052)
> @@ -31,7 +31,6 @@
>   */
>  package com.vividsolutions.jump.io.datasource;
>  
> -import java.io.File;
>  import java.net.URI;
>  import java.util.ArrayList;
>  import java.util.Collection;
> @@ -120,10 +119,6 @@
>          if (dp.getProperty(DataSource.URI_KEY) != null) {
>            uri = new URI(dp.getProperty(DataSource.URI_KEY));
>          }
> -        // for legacy plugins
> -        else if (dp.getProperty(DataSource.FILE_KEY) != null) {
> -          uri = new File(dp.getProperty(DataSource.FILE_KEY)).toURI();
> -        }
>          if (writer instanceof TaskMonitorSupport) {
>            ((TaskMonitorSupport) writer).setTaskMonitor(monitor);
>            TaskMonitorUtil
> 
> Modified: 
> core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/OpenProjectPlugIn.java
> ===================================================================
> --- 
> core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/OpenProjectPlugIn.java
>  2016-10-06 10:57:45 UTC (rev 5051)
> +++ 
> core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/OpenProjectPlugIn.java
>  2016-10-06 11:46:06 UTC (rev 5052)
> @@ -237,7 +237,6 @@
>                          {
>                              //set the new source for this layer
>                               Map properties = 
> layer.getDataSourceQuery().getDataSource().getProperties();
> -                            properties.put(DataSource.URI_KEY, new 
> File(filename).toURI().toString());
>                              properties.put(DataSource.FILE_KEY, filename);
>                               
> layer.getDataSourceQuery().getDataSource().setProperties(properties);         
>               
>                               load(layer, registry, monitor);
> 
> Modified: core/trunk/src/jumptest/io/Playground.java
> ===================================================================
> --- core/trunk/src/jumptest/io/Playground.java        2016-10-06 10:57:45 UTC 
> (rev 5051)
> +++ core/trunk/src/jumptest/io/Playground.java        2016-10-06 11:46:06 UTC 
> (rev 5052)
> @@ -10,7 +10,6 @@
>  import com.vividsolutions.jump.task.DummyTaskMonitor;
>  
>  
> -import java.io.File;
>  import java.util.ArrayList;
>  import java.util.Collections;
>  import java.util.Iterator;
> 
> Modified: 
> core/trunk/src/org/openjump/core/ui/io/file/DataSourceFileLayerLoader.java
> ===================================================================
> --- 
> core/trunk/src/org/openjump/core/ui/io/file/DataSourceFileLayerLoader.java    
>     2016-10-06 10:57:45 UTC (rev 5051)
> +++ 
> core/trunk/src/org/openjump/core/ui/io/file/DataSourceFileLayerLoader.java    
>     2016-10-06 11:46:06 UTC (rev 5052)
> @@ -27,7 +27,6 @@
>  package org.openjump.core.ui.io.file;
>  
>  import java.io.File;
> -import java.net.MalformedURLException;
>  import java.net.URI;
>  import java.net.URISyntaxException;
>  import java.util.ArrayList;
> @@ -42,7 +41,6 @@
>  
>  import org.openjump.core.ccordsys.srid.SRIDStyle;
>  import org.openjump.core.ccordsys.utils.ProjUtils;
> -import org.openjump.core.ccordsys.utils.SRSInfo;
>  import org.openjump.core.ui.util.ExceptionUtil;
>  import org.openjump.core.ui.util.TaskUtil;
>  import org.openjump.util.UriUtil;
> @@ -397,7 +395,6 @@
>        file = new File(uri);
>      }
>      String filePath = file.getAbsolutePath();
> -    properties.put(DataSource.URI_KEY, uri.toString());
>      properties.put(DataSource.FILE_KEY, filePath);
>      properties.putAll(options);
>      return properties;
> 
> Modified: 
> core/trunk/src/org/openjump/core/ui/plugin/file/open/OpenProjectWizard.java
> ===================================================================
> --- 
> core/trunk/src/org/openjump/core/ui/plugin/file/open/OpenProjectWizard.java   
>     2016-10-06 10:57:45 UTC (rev 5051)
> +++ 
> core/trunk/src/org/openjump/core/ui/plugin/file/open/OpenProjectWizard.java   
>     2016-10-06 11:46:06 UTC (rev 5052)
> @@ -301,23 +301,18 @@
>                              DataSourceQuery dataSourceQuery = 
> layer.getDataSourceQuery();
>                              DataSource dataSource = 
> dataSourceQuery.getDataSource();
>                              Map properties = dataSource.getProperties();
> -                            String fname = null;
> -                            if (properties.get(DataSource.URI_KEY) != null 
> && properties.get(DataSource.URI_KEY).toString().length()>0) {
> -                                fname = new 
> URI(properties.get(DataSource.URI_KEY).toString()).getPath();
> +                            if (properties.get(DataSource.FILE_KEY) != null) 
> {
> +                                String fname = 
> properties.get(DataSource.FILE_KEY).toString();
> +                                String filename = 
> findFile.getFileName(fname);
> +                                if (filename.length() > 0) {
> +                                    // set the new source for this layer
> +                                    properties.put(DataSource.FILE_KEY, 
> filename);
> +                                    dataSource.setProperties(properties);
> +                                    load(layer, registry, monitor);
> +                                } else {
> +                                    break;
> +                                }
>                              }
> -                            //if (fname == null) {
> -                            //    fname = 
> properties.get(DataSource.FILE_KEY).toString();
> -                            //}
> -                            String filename = findFile.getFileName(fname);
> -                            if (filename.length() > 0) {
> -                                // set the new source for this layer
> -                                //properties.put(DataSource.FILE_KEY, 
> filename);
> -                                properties.put(DataSource.URI_KEY, new 
> File(filename).toURI().toString());
> -                                dataSource.setProperties(properties);
> -                                load(layer, registry, monitor);
> -                            } else {
> -                                break;
> -                            }
>                          }
>                      } else if (layerable instanceof RasterImageLayer) {
>  
> @@ -438,9 +433,7 @@
>        DataSource dataSource = dataSourceQuery.getDataSource();
>        Map properties = dataSource.getProperties();
>        File layerFile = null;
> -      if (properties.get(DataSource.URI_KEY) != null && 
> properties.get(DataSource.URI_KEY).toString().length() > 0) {
> -          layerFile = new 
> File(URI.create(properties.get(DataSource.URI_KEY).toString()).toURL().toExternalForm());
> -      } else if (properties.get(DataSource.FILE_KEY) != null && 
> properties.get(DataSource.FILE_KEY).toString().length() > 0) {
> +      if (properties.get(DataSource.FILE_KEY) != null) {
>            layerFile = new 
> File(properties.get(DataSource.FILE_KEY).toString());
>        }
>        return layerFile;
> @@ -450,7 +443,6 @@
>        DataSourceQuery dataSourceQuery = layer.getDataSourceQuery();
>        DataSource dataSource = dataSourceQuery.getDataSource();
>        Map properties = dataSource.getProperties();
> -      properties.put(DataSource.URI_KEY, file.toURI().toString());
>        properties.put(DataSource.FILE_KEY, file.getAbsolutePath());
>     }
>    
> 
> Modified: 
> core/trunk/src/org/openjump/core/ui/plugin/mousemenu/SaveDatasetsPlugIn.java
> ===================================================================
> --- 
> core/trunk/src/org/openjump/core/ui/plugin/mousemenu/SaveDatasetsPlugIn.java  
>     2016-10-06 10:57:45 UTC (rev 5051)
> +++ 
> core/trunk/src/org/openjump/core/ui/plugin/mousemenu/SaveDatasetsPlugIn.java  
>     2016-10-06 11:46:06 UTC (rev 5052)
> @@ -627,7 +627,7 @@
>            String newFileName = path + newLayer.getName() + ".shp";
>            HashMap properties = new HashMap();
>            properties.put(DataSource.COORDINATE_SYSTEM_KEY, "Unspecified");
> -          properties.put(DataSource.URI_KEY, new 
> File(newFileName).toURI().toString());
> +          properties.put(DataSource.URI_KEY, new 
> File(newFileName).toURI().toURL().toExternalForm());
>            properties.put(DataSource.FILE_KEY, newFileName);
>            DataSource dataSource = 
> StandardReaderWriterFileDataSource.Shapefile.class
>                .newInstance();
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most 
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Jump-pilot-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to