platform independent file URL
authorAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Thu, 23 Sep 2010 08:26:27 +0000 (08:26 +0000)
committerAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Thu, 23 Sep 2010 08:26:27 +0000 (08:26 +0000)
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/EndnoteImportWizard.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/JaxbImportWizard.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/SddImportWizard.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/TcsImportWizard.java

index 53123b8879ec36bb9d7a392293b792c66d89af65..832901428eca4e0cee8107bf6f48e62d62d0f9b0 100644 (file)
@@ -10,6 +10,9 @@
 
 package eu.etaxonomy.taxeditor.io.wizard;
 
+import java.io.File;
+import java.net.URI;
+
 import org.apache.log4j.Logger;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IImportWizard;
@@ -37,15 +40,16 @@ public class EndnoteImportWizard extends AbstractImportWizard<EndnoteImportConfi
        @Override
        public boolean performFinish() {
                
-               String file = dataSourcePage.getFile();
+               String platformDependendFile = dataSourcePage.getFile();
+               
                
                // TcsXmlImport expects a string that can be used to instantiate a URL instance
                // TODO consolidate import and exports regarding what may be passed in as source
                // will construct a url string for now
                
-               file = "file://" + file;
-               
-               configurator.setSource(file);
+               File file = new File(platformDependendFile);
+               URI fileUri  = file.toURI();
+               configurator.setSource(fileUri.toString());
                
                CdmStore.getImportHandler().run(configurator);
                
index fa7db3282aa055c5f72cf4436106a151bd6061c6..15cd84d461202aede5ec49696606b8c9bdd1e844 100644 (file)
@@ -10,6 +10,9 @@
 
 package eu.etaxonomy.taxeditor.io.wizard;
 
+import java.io.File;
+import java.net.URI;
+
 import org.apache.log4j.Logger;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IWorkbench;
@@ -44,15 +47,18 @@ public class JaxbImportWizard extends AbstractImportWizard<JaxbImportConfigurato
         */
        @Override
        public boolean performFinish() {
-               String file = dataSourcePage.getFile();
+               
+               String platformDependendFile = dataSourcePage.getFile();
+               
                
                // Imports are expecting a string that can be used to instantiate a URL instance
                // TODO consolidate import and exports regarding what may be passed in as source
                // will construct a url string for now
                
-               file = "file://" + file;
+               File file = new File(platformDependendFile);
+               URI fileUri  = file.toURI();
                
-               configurator.setSource(file);
+               configurator.setSource(fileUri.toString());
                configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
                
                CdmStore.getImportHandler().run(configurator);
index ed36a971b215222379811ffec4a5bacd82309bc1..d03e5a458e5f0b2c4781d168726c7b9a2f80773e 100644 (file)
@@ -10,6 +10,9 @@
 
 package eu.etaxonomy.taxeditor.io.wizard;
 
+import java.io.File;
+import java.net.URI;
+
 import org.apache.log4j.Logger;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IWorkbench;
@@ -59,15 +62,17 @@ public class SddImportWizard extends AbstractImportWizard<SDDImportConfigurator>
        public boolean performFinish() {
                // TODO this is a quick copy from JAXB import. It might not work at all.
                
-               String file = dataSourcePage.getFile();
+               String platformDependendFile = dataSourcePage.getFile();
+               
                
                // Imports are expecting a string that can be used to instantiate a URL instance
                // TODO consolidate import and exports regarding what may be passed in as source
                // will construct a url string for now
                
-               file = "file://" + file;
+               File file = new File(platformDependendFile);
+               URI fileUri  = file.toURI();
                
-               configurator.setSource(file);
+               configurator.setSource(fileUri.toString());
                configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
                
                CdmStore.getImportHandler().run(configurator);
index 6d25c2cf1ad8123fd56ccc0dd6789afe6602fb81..26f4fa88dd1f2c57b929770f06b318ea0f9a1de6 100644 (file)
@@ -10,6 +10,9 @@
 
 package eu.etaxonomy.taxeditor.io.wizard;
 
+import java.io.File;
+import java.net.URI;
+
 import org.apache.log4j.Logger;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IWorkbench;
@@ -36,15 +39,17 @@ public class TcsImportWizard extends AbstractImportWizard<TcsXmlImportConfigurat
        @Override
        public boolean performFinish() {
                
-               String file = dataSourcePage.getFile();
+               String platformDependendFile = dataSourcePage.getFile();
+               
                
                // TcsXmlImport expects a string that can be used to instantiate a URL instance
                // TODO consolidate import and exports regarding what may be passed in as source
                // will construct a url string for now
                
-               file = "file://" + file;
+               File file = new File(platformDependendFile);
+               URI fileUri  = file.toURI();
                
-               configurator.setSource(file);
+               configurator.setSource(fileUri.toString());
                configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
                
                CdmStore.getImportHandler().run(configurator);